Dixsie Wolmers | 9d40e30 | 2020-02-13 13:29:40 -0600 | [diff] [blame] | 1 | <template> |
Dixsie Wolmers | 6a192d5 | 2021-09-02 15:26:58 -0500 | [diff] [blame] | 2 | <overview-card |
| 3 | :title="$t('pageOverview.networkInformation')" |
| 4 | :to="`/settings/network`" |
| 5 | > |
| 6 | <b-row class="mt-3"> |
| 7 | <b-col sm="6"> |
| 8 | <dl> |
| 9 | <dt>{{ $t('pageOverview.hostname') }}</dt> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame^] | 10 | <dd>{{ dataFormatter(hostname) }}</dd> |
Dixsie Wolmers | 6a192d5 | 2021-09-02 15:26:58 -0500 | [diff] [blame] | 11 | </dl> |
| 12 | </b-col> |
| 13 | <b-col sm="6"> |
| 14 | <dl> |
| 15 | <dt>{{ $t('pageOverview.linkStatus') }}</dt> |
| 16 | <dd> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame^] | 17 | {{ dataFormatter(linkStatus) }} |
Dixsie Wolmers | 6a192d5 | 2021-09-02 15:26:58 -0500 | [diff] [blame] | 18 | </dd> |
| 19 | </dl> |
| 20 | </b-col> |
| 21 | </b-row> |
| 22 | <b-row> |
| 23 | <b-col> |
| 24 | <dl> |
| 25 | <dt>{{ $t('pageOverview.ipv4') }}</dt> |
| 26 | <dd> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame^] | 27 | {{ dataFormatter(ipStaticAddress) }} |
Dixsie Wolmers | 6a192d5 | 2021-09-02 15:26:58 -0500 | [diff] [blame] | 28 | </dd> |
| 29 | </dl> |
| 30 | </b-col> |
| 31 | <b-col> |
| 32 | <dl> |
| 33 | <dt>{{ $t('pageOverview.dhcp') }}</dt> |
| 34 | <dd> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame^] | 35 | {{ dataFormatter(ipDhcpAddress) }} |
Dixsie Wolmers | 6a192d5 | 2021-09-02 15:26:58 -0500 | [diff] [blame] | 36 | </dd> |
| 37 | </dl> |
| 38 | </b-col> |
| 39 | </b-row> |
| 40 | </overview-card> |
Dixsie Wolmers | 9d40e30 | 2020-02-13 13:29:40 -0600 | [diff] [blame] | 41 | </template> |
| 42 | |
| 43 | <script> |
Dixsie Wolmers | 6a192d5 | 2021-09-02 15:26:58 -0500 | [diff] [blame] | 44 | import OverviewCard from './OverviewCard'; |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame^] | 45 | import DataFormatterMixin from '@/components/Mixins/DataFormatterMixin'; |
Dixsie Wolmers | 6a192d5 | 2021-09-02 15:26:58 -0500 | [diff] [blame] | 46 | import { mapState } from 'vuex'; |
| 47 | |
Dixsie Wolmers | 9d40e30 | 2020-02-13 13:29:40 -0600 | [diff] [blame] | 48 | export default { |
| 49 | name: 'Network', |
Dixsie Wolmers | 6a192d5 | 2021-09-02 15:26:58 -0500 | [diff] [blame] | 50 | components: { |
| 51 | OverviewCard, |
| 52 | }, |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame^] | 53 | mixins: [DataFormatterMixin], |
Dixsie Wolmers | 6a192d5 | 2021-09-02 15:26:58 -0500 | [diff] [blame] | 54 | data() { |
| 55 | return { |
| 56 | ipDhcpAddress: '', |
| 57 | }; |
| 58 | }, |
Dixsie Wolmers | 9d40e30 | 2020-02-13 13:29:40 -0600 | [diff] [blame] | 59 | computed: { |
Dixsie Wolmers | 6a192d5 | 2021-09-02 15:26:58 -0500 | [diff] [blame] | 60 | ...mapState({ |
| 61 | ethernetData: (state) => state.network.ethernetData[0], |
| 62 | hostname() { |
| 63 | return this.ethernetData?.HostName; |
| 64 | }, |
| 65 | linkStatus() { |
| 66 | return this.ethernetData?.LinkStatus; |
| 67 | }, |
| 68 | ipStaticAddress() { |
| 69 | return this.ethernetData?.IPv4StaticAddresses[0].Address; |
| 70 | }, |
| 71 | }), |
Dixsie Wolmers | 9d40e30 | 2020-02-13 13:29:40 -0600 | [diff] [blame] | 72 | }, |
| 73 | created() { |
Sandeepa Singh | f67f769 | 2021-07-19 18:04:18 +0530 | [diff] [blame] | 74 | this.$store.dispatch('network/getEthernetData').finally(() => { |
Sukanya Pandey | edb8a77 | 2020-10-29 11:33:42 +0530 | [diff] [blame] | 75 | this.$root.$emit('overview-network-complete'); |
Yoshie Muranaka | 598bf7e | 2020-05-01 12:26:00 -0700 | [diff] [blame] | 76 | }); |
Dixsie Wolmers | 6a192d5 | 2021-09-02 15:26:58 -0500 | [diff] [blame] | 77 | this.getDhcpInfo(); |
| 78 | }, |
| 79 | methods: { |
| 80 | getDhcpInfo() { |
| 81 | const dhcp = this.ethernetData.IPv4Addresses.filter( |
| 82 | (ipv4) => ipv4.AddressOrigin === 'DHCP' |
| 83 | ); |
| 84 | this.ipDhcpAddress = dhcp[0].Address; |
| 85 | }, |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 86 | }, |
Dixsie Wolmers | 9d40e30 | 2020-02-13 13:29:40 -0600 | [diff] [blame] | 87 | }; |
| 88 | </script> |