blob: 975803fdbcef38d16b7d77c07f01a607469b5a4c [file] [log] [blame]
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -06001<template>
2 <b-container fluid="xl">
3 <page-title />
4 <b-row>
SurenNewarebd0c01f2021-01-20 21:13:09 +05305 <b-col md="8">
Dixsie Wolmers8f030ba2020-12-07 13:12:53 -06006 <page-section
7 :section-title="$t('pageSecuritySettings.networkServices')"
8 >
9 <b-row class="setting-section">
10 <b-col class="d-flex align-items-center justify-content-between">
11 <dl class="mr-3 w-75">
12 <dt>{{ $t('pageSecuritySettings.ssh') }}</dt>
13 <dd>
14 {{ $t('pageSecuritySettings.sshDescription') }}
15 </dd>
16 </dl>
17 <b-form-checkbox
18 id="sshSwitch"
19 v-model="sshProtocolState"
20 data-test-id="securitySettings-checkbox-switchSshProtocol"
21 switch
22 @change="changeSshProtocolState"
23 >
24 <span class="sr-only">
25 {{ $t('pageSecuritySettings.ssh') }}
26 </span>
27 <span v-if="sshProtocolState">
28 {{ $t('global.status.enabled') }}
29 </span>
30 <span v-else>{{ $t('global.status.disabled') }}</span>
31 </b-form-checkbox>
32 </b-col>
33 </b-row>
34 <b-row class="setting-section">
35 <b-col class="d-flex align-items-center justify-content-between">
36 <dl class="mt-3 mr-3 w-75">
37 <dt>{{ $t('pageSecuritySettings.ipmi') }}</dt>
38 <dd>
39 {{ $t('pageSecuritySettings.ipmiDescription') }}
40 </dd>
41 </dl>
42 <b-form-checkbox
43 id="ipmiSwitch"
44 v-model="ipmiProtocolState"
45 data-test-id="securitySettings-checkbox-switchIpmiProtocol"
46 switch
47 @change="changeIpmiProtocolState"
48 >
49 <span class="sr-only">
50 {{ $t('pageSecuritySettings.ipmi') }}
51 </span>
52 <span v-if="ipmiProtocolState">
53 {{ $t('global.status.enabled') }}
54 </span>
55 <span v-else>{{ $t('global.status.disabled') }}</span>
56 </b-form-checkbox>
57 </b-col>
58 </b-row>
59 </page-section>
60 </b-col>
61 </b-row>
62 </b-container>
63</template>
64
65<script>
66import PageSection from '@/components/Global/PageSection';
67import PageTitle from '@/components/Global/PageTitle';
68
69import LoadingBarMixin from '@/components/Mixins/LoadingBarMixin';
70import BVToastMixin from '@/components/Mixins/BVToastMixin';
71
72export default {
73 name: 'SecuritySettings',
74 components: { PageTitle, PageSection },
75 mixins: [LoadingBarMixin, BVToastMixin],
76 beforeRouteLeave(to, from, next) {
77 this.hideLoader();
78 next();
79 },
80 computed: {
81 sshProtocolState: {
82 get() {
83 return this.$store.getters['securitySettings/sshProtocolEnabled'];
84 },
85 set(newValue) {
86 return newValue;
87 },
88 },
89 ipmiProtocolState: {
90 get() {
91 return this.$store.getters['securitySettings/ipmiProtocolEnabled'];
92 },
93 set(newValue) {
94 return newValue;
95 },
96 },
97 },
98 created() {
99 this.startLoader();
100 this.$store
101 .dispatch('securitySettings/getNetworkProtocolStatus')
102 .finally(() => this.endLoader());
103 },
104 methods: {
105 changeIpmiProtocolState(state) {
106 this.$store
107 .dispatch('securitySettings/saveIpmiProtocolState', state)
108 .then((message) => this.successToast(message))
109 .catch(({ message }) => this.errorToast(message));
110 },
111 changeSshProtocolState(state) {
112 this.$store
113 .dispatch('securitySettings/saveSshProtocolState', state)
114 .then((message) => this.successToast(message))
115 .catch(({ message }) => this.errorToast(message));
116 },
117 },
118};
119</script>
120
121<style lang="scss" scoped>
122.setting-section {
123 border-bottom: 1px solid gray('300');
124}
125</style>