blob: 918c8e984268ff319db11b9043b2ab39333ce055 [file] [log] [blame]
Dixsie Wolmersbb81d552020-02-26 19:52:28 -06001<template>
2 <b-container fluid="xl">
Sandeepa Singhf67f7692021-07-19 18:04:18 +05303 <page-title :description="$t('pageNetwork.pageDescription')" />
Dixsie Wolmersc4b87572021-10-07 16:15:50 -05004 <!-- Global settings for all interfaces -->
5 <network-global-settings />
6 <!-- Interface tabs -->
7 <page-section>
Dixsie Wolmersbb81d552020-02-26 19:52:28 -06008 <b-row>
Dixsie Wolmersc4b87572021-10-07 16:15:50 -05009 <b-col>
10 <b-card no-body>
11 <b-tabs
12 active-nav-item-class="font-weight-bold"
13 card
14 content-class="mt-3"
Dixsie Wolmersbb81d552020-02-26 19:52:28 -060015 >
Dixsie Wolmersc4b87572021-10-07 16:15:50 -050016 <b-tab
17 v-for="(data, index) in ethernetData"
18 :key="data.Id"
19 :title="data.Id"
20 @click="getTabIndex(index)"
21 >
22 <!-- Interface settings -->
23 <network-interface-settings :tab-index="tabIndex" />
24 <!-- IPV4 table -->
25 <table-ipv-4 :tab-index="tabIndex" />
26 <!-- Static DNS table -->
27 <table-dns :tab-index="tabIndex" />
28 </b-tab>
29 </b-tabs>
30 </b-card>
Dixsie Wolmersbb81d552020-02-26 19:52:28 -060031 </b-col>
32 </b-row>
33 </page-section>
Dixsie Wolmersbb81d552020-02-26 19:52:28 -060034 </b-container>
35</template>
36
37<script>
Dixsie Wolmersbb81d552020-02-26 19:52:28 -060038import BVToastMixin from '@/components/Mixins/BVToastMixin';
Dixsie Wolmersc4b87572021-10-07 16:15:50 -050039import DataFormatterMixin from '@/components/Mixins/DataFormatterMixin';
Yoshie Muranakad73f4962020-12-09 08:52:23 -080040import LoadingBarMixin, { loading } from '@/components/Mixins/LoadingBarMixin';
Dixsie Wolmersc4b87572021-10-07 16:15:50 -050041import NetworkGlobalSettings from './NetworkGlobalSettings.vue';
42import NetworkInterfaceSettings from './NetworkInterfaceSettings.vue';
Dixsie Wolmersbb81d552020-02-26 19:52:28 -060043import PageSection from '@/components/Global/PageSection';
44import PageTitle from '@/components/Global/PageTitle';
Dixsie Wolmersc4b87572021-10-07 16:15:50 -050045import TableIpv4 from './TableIpv4.vue';
46import TableDns from './TableDns.vue';
Dixsie Wolmersbb81d552020-02-26 19:52:28 -060047import { mapState } from 'vuex';
Dixsie Wolmersbb81d552020-02-26 19:52:28 -060048
49export default {
Sandeepa Singhf67f7692021-07-19 18:04:18 +053050 name: 'Network',
Dixsie Wolmersbb81d552020-02-26 19:52:28 -060051 components: {
Dixsie Wolmersc4b87572021-10-07 16:15:50 -050052 NetworkGlobalSettings,
53 NetworkInterfaceSettings,
Dixsie Wolmersbb81d552020-02-26 19:52:28 -060054 PageSection,
Dixsie Wolmersc4b87572021-10-07 16:15:50 -050055 PageTitle,
56 TableDns,
57 TableIpv4,
Dixsie Wolmersbb81d552020-02-26 19:52:28 -060058 },
Dixsie Wolmersc4b87572021-10-07 16:15:50 -050059 mixins: [BVToastMixin, DataFormatterMixin, LoadingBarMixin],
Derick Montague602e98a2020-10-21 16:20:00 -050060 beforeRouteLeave(to, from, next) {
61 this.hideLoader();
62 next();
63 },
Dixsie Wolmersbb81d552020-02-26 19:52:28 -060064 data() {
65 return {
Yoshie Muranakad73f4962020-12-09 08:52:23 -080066 loading,
Dixsie Wolmersc4b87572021-10-07 16:15:50 -050067 tabIndex: 0,
Dixsie Wolmersbb81d552020-02-26 19:52:28 -060068 };
69 },
70 computed: {
Dixsie Wolmersc4b87572021-10-07 16:15:50 -050071 ...mapState('network', ['ethernetData']),
Dixsie Wolmersbb81d552020-02-26 19:52:28 -060072 },
73 created() {
74 this.startLoader();
Dixsie Wolmersc4b87572021-10-07 16:15:50 -050075 const globalSettings = new Promise((resolve) => {
76 this.$root.$on('network-global-settings-complete', () => resolve());
77 });
78 const interfaceSettings = new Promise((resolve) => {
79 this.$root.$on('network-interface-settings-complete', () => resolve());
80 });
81 const networkTableDns = new Promise((resolve) => {
82 this.$root.$on('network-table-dns-complete', () => resolve());
83 });
84 const networkTableIpv4 = new Promise((resolve) => {
85 this.$root.$on('network-table-ipv4-complete', () => resolve());
86 });
87 // Combine all child component Promises to indicate
88 // when page data load complete
89 Promise.all([
90 this.$store.dispatch('network/getEthernetData'),
91 globalSettings,
92 interfaceSettings,
93 networkTableDns,
94 networkTableIpv4,
95 ]).finally(() => this.endLoader());
Dixsie Wolmersbb81d552020-02-26 19:52:28 -060096 },
Dixsie Wolmersbb81d552020-02-26 19:52:28 -060097 methods: {
Dixsie Wolmersc4b87572021-10-07 16:15:50 -050098 getTabIndex(selectedIndex) {
99 this.tabIndex = selectedIndex;
Derick Montague602e98a2020-10-21 16:20:00 -0500100 },
101 },
Dixsie Wolmersbb81d552020-02-26 19:52:28 -0600102};
103</script>