From 602e98aa32f82fd3b0c3d250c7cc1f8da971db24 Mon Sep 17 00:00:00 2001 From: Derick Montague Date: Wed, 21 Oct 2020 16:20:00 -0500 Subject: Update linting packages to use latest - 99% of changes were small syntax changes that were changed by the lint command. There were a couple of small manual changes to meet the property order patterns established as part of the vue:recommended guidelines. There are rules that were set from errors to warnings and new stories are being opened to address those issues. Testing: - Successfully ran npm run serve - Successfully ran npm run lint - Verified functionality works as expected, e.g. success and failure use cases - Resolved any JavaScript errors thrown to the console Signed-off-by: Derick Montague Change-Id: Ie082f31c73ccbe8a60afa8f88a9ef6dbf33d9fd2 --- src/views/Control/Kvm/Kvm.vue | 2 +- src/views/Control/Kvm/KvmConsole.vue | 12 ++++---- .../Control/ManagePowerUsage/ManagePowerUsage.vue | 30 +++++++++---------- src/views/Control/RebootBmc/RebootBmc.vue | 20 ++++++------- src/views/Control/SerialOverLan/SerialOverLan.vue | 4 +-- .../Control/SerialOverLan/SerialOverLanConsole.vue | 22 +++++++------- src/views/Control/ServerLed/ServerLed.vue | 18 ++++++------ .../Control/ServerPowerOperations/BootSettings.vue | 28 +++++++++--------- .../ServerPowerOperations.vue | 34 +++++++++++----------- .../VirtualMedia/ModalConfigureConnection.vue | 28 +++++++++--------- src/views/Control/VirtualMedia/VirtualMedia.vue | 14 +++++---- 11 files changed, 107 insertions(+), 105 deletions(-) (limited to 'src/views/Control') diff --git a/src/views/Control/Kvm/Kvm.vue b/src/views/Control/Kvm/Kvm.vue index 66b2e5f7..10322bde 100644 --- a/src/views/Control/Kvm/Kvm.vue +++ b/src/views/Control/Kvm/Kvm.vue @@ -13,7 +13,7 @@ import KvmConsole from './KvmConsole'; export default { name: 'Kvm', - components: { PageTitle, KvmConsole } + components: { PageTitle, KvmConsole }, }; diff --git a/src/views/Control/Kvm/KvmConsole.vue b/src/views/Control/Kvm/KvmConsole.vue index 8438b35c..43dc7271 100644 --- a/src/views/Control/Kvm/KvmConsole.vue +++ b/src/views/Control/Kvm/KvmConsole.vue @@ -60,8 +60,8 @@ export default { props: { isFullWindow: { type: Boolean, - default: true - } + default: true, + }, }, data() { return { @@ -70,7 +70,7 @@ export default { terminalClass: this.isFullWindow ? 'full-window' : '', marginClass: this.isFullWindow ? 'margin-left-full-window' : '', status: Connecting, - convasRef: null + convasRef: null, }; }, computed: { @@ -89,7 +89,7 @@ export default { return this.$t('pageKvm.disconnected'); } return this.$t('pageKvm.connecting'); - } + }, }, mounted() { this.openTerminal(); @@ -141,8 +141,8 @@ export default { '_blank', 'directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=700,height=550' ); - } - } + }, + }, }; diff --git a/src/views/Control/ManagePowerUsage/ManagePowerUsage.vue b/src/views/Control/ManagePowerUsage/ManagePowerUsage.vue index 5a7eed08..5fcf938b 100644 --- a/src/views/Control/ManagePowerUsage/ManagePowerUsage.vue +++ b/src/views/Control/ManagePowerUsage/ManagePowerUsage.vue @@ -46,7 +46,7 @@ {{ $t('pageManagePowerUsage.powerCapLabelTextInfo', { min: 1, - max: 10000 + max: 10000, }) }} @@ -97,9 +97,13 @@ export default { name: 'ManagePowerUsage', components: { PageTitle }, mixins: [VuelidateMixin, BVToastMixin, LoadingBarMixin], + beforeRouteLeave(to, from, next) { + this.hideLoader(); + next(); + }, computed: { ...mapGetters({ - powerConsumptionValue: 'powerControl/powerConsumptionValue' + powerConsumptionValue: 'powerControl/powerConsumptionValue', }), /** @@ -114,7 +118,7 @@ export default { let newValue = value ? '' : null; this.$v.$reset(); this.$store.dispatch('powerControl/setPowerCapUpdatedValue', newValue); - } + }, }, powerCapValue: { get() { @@ -123,8 +127,8 @@ export default { set(value) { this.$v.$touch(); this.$store.dispatch('powerControl/setPowerCapUpdatedValue', value); - } - } + }, + }, }, created() { this.startLoader(); @@ -132,17 +136,13 @@ export default { .dispatch('powerControl/getPowerControl') .finally(() => this.endLoader()); }, - beforeRouteLeave(to, from, next) { - this.hideLoader(); - next(); - }, validations: { powerCapValue: { between: between(1, 10000), - required: requiredIf(function() { + required: requiredIf(function () { return this.isPowerCapFieldEnabled; - }) - } + }), + }, }, methods: { submitForm() { @@ -151,10 +151,10 @@ export default { this.startLoader(); this.$store .dispatch('powerControl/setPowerControl', this.powerCapValue) - .then(message => this.successToast(message)) + .then((message) => this.successToast(message)) .catch(({ message }) => this.errorToast(message)) .finally(() => this.endLoader()); - } - } + }, + }, }; diff --git a/src/views/Control/RebootBmc/RebootBmc.vue b/src/views/Control/RebootBmc/RebootBmc.vue index 29932535..03880b38 100644 --- a/src/views/Control/RebootBmc/RebootBmc.vue +++ b/src/views/Control/RebootBmc/RebootBmc.vue @@ -43,10 +43,14 @@ export default { name: 'RebootBmc', components: { PageTitle, PageSection }, mixins: [BVToastMixin, LoadingBarMixin], + beforeRouteLeave(to, from, next) { + this.hideLoader(); + next(); + }, computed: { lastBmcRebootTime() { return this.$store.getters['controls/lastBmcRebootTime']; - } + }, }, created() { this.startLoader(); @@ -54,28 +58,24 @@ export default { .dispatch('controls/getLastBmcRebootTime') .finally(() => this.endLoader()); }, - beforeRouteLeave(to, from, next) { - this.hideLoader(); - next(); - }, methods: { onClick() { this.$bvModal .msgBoxConfirm(this.$t('pageRebootBmc.modal.confirmMessage'), { title: this.$t('pageRebootBmc.modal.confirmTitle'), - okTitle: this.$t('global.action.confirm') + okTitle: this.$t('global.action.confirm'), }) - .then(confirmed => { + .then((confirmed) => { if (confirmed) this.rebootBmc(); }); }, rebootBmc() { this.$store .dispatch('controls/rebootBmc') - .then(message => this.successToast(message)) + .then((message) => this.successToast(message)) .catch(({ message }) => this.errorToast(message)); - } - } + }, + }, }; diff --git a/src/views/Control/SerialOverLan/SerialOverLan.vue b/src/views/Control/SerialOverLan/SerialOverLan.vue index 037a4963..48a68345 100644 --- a/src/views/Control/SerialOverLan/SerialOverLan.vue +++ b/src/views/Control/SerialOverLan/SerialOverLan.vue @@ -18,7 +18,7 @@ export default { components: { PageSection, PageTitle, - SerialOverLanConsole - } + SerialOverLanConsole, + }, }; diff --git a/src/views/Control/SerialOverLan/SerialOverLanConsole.vue b/src/views/Control/SerialOverLan/SerialOverLanConsole.vue index d5e9b214..b734bb13 100644 --- a/src/views/Control/SerialOverLan/SerialOverLanConsole.vue +++ b/src/views/Control/SerialOverLan/SerialOverLanConsole.vue @@ -42,13 +42,13 @@ export default { name: 'SerialOverLanConsole', components: { IconLaunch, - StatusIcon + StatusIcon, }, props: { isFullWindow: { type: Boolean, - default: true - } + default: true, + }, }, computed: { hostStatus() { @@ -61,7 +61,7 @@ export default { return this.hostStatus === 'on' ? this.$t('pageSerialOverLan.connected') : this.$t('pageSerialOverLan.disconnected'); - } + }, }, created() { this.$store.dispatch('global/getHostStatus'); @@ -74,7 +74,7 @@ export default { const token = this.$store.getters['authentication/token']; const ws = new WebSocket(`wss://${window.location.host}/console0`, [ - token + token, ]); // Refer https://github.com/xtermjs/xterm.js/ for xterm implementation and addons. @@ -82,7 +82,7 @@ export default { const term = new Terminal({ fontSize: 15, fontFamily: - 'SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace' + 'SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace', }); const attachAddon = new AttachAddon(ws); @@ -94,7 +94,7 @@ export default { const SOL_THEME = { background: '#19273c', cursor: 'rgba(83, 146, 255, .5)', - scrollbar: 'rgba(83, 146, 255, .5)' + scrollbar: 'rgba(83, 146, 255, .5)', }; term.setOption('theme', SOL_THEME); @@ -102,10 +102,10 @@ export default { fitAddon.fit(); try { - ws.onopen = function() { + ws.onopen = function () { console.log('websocket console0/ opened'); }; - ws.onclose = function(event) { + ws.onclose = function (event) { console.log( 'websocket console0/ closed. code: ' + event.code + @@ -123,8 +123,8 @@ export default { '_blank', 'directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=600,height=550' ); - } - } + }, + }, }; diff --git a/src/views/Control/ServerLed/ServerLed.vue b/src/views/Control/ServerLed/ServerLed.vue index b2eab0e6..73ec704f 100644 --- a/src/views/Control/ServerLed/ServerLed.vue +++ b/src/views/Control/ServerLed/ServerLed.vue @@ -38,6 +38,10 @@ export default { name: 'ServerLed', components: { PageTitle, PageSection }, mixins: [LoadingBarMixin, BVToastMixin], + beforeRouteLeave(to, from, next) { + this.hideLoader(); + next(); + }, computed: { indicatorLed: { get() { @@ -45,8 +49,8 @@ export default { }, set(newValue) { return newValue; - } - } + }, + }, }, created() { this.startLoader(); @@ -54,15 +58,11 @@ export default { .dispatch('serverLed/getIndicatorValue') .finally(() => this.endLoader()); }, - beforeRouteLeave(to, from, next) { - this.hideLoader(); - next(); - }, methods: { changeLedValue(indicatorLed) { this.$store .dispatch('serverLed/saveIndicatorLedValue', indicatorLed) - .then(message => this.successToast(message)) + .then((message) => this.successToast(message)) .catch(({ message }) => { this.errorToast(message); if (indicatorLed === 'Off') { @@ -71,7 +71,7 @@ export default { this.indicatorLed === 'Off'; } }); - } - } + }, + }, }; diff --git a/src/views/Control/ServerPowerOperations/BootSettings.vue b/src/views/Control/ServerPowerOperations/BootSettings.vue index 3435f1c6..a94da0c3 100644 --- a/src/views/Control/ServerPowerOperations/BootSettings.vue +++ b/src/views/Control/ServerPowerOperations/BootSettings.vue @@ -62,8 +62,8 @@ export default { form: { bootOption: this.$store.getters['hostBootSettings/bootSource'], oneTimeBoot: this.$store.getters['hostBootSettings/overrideEnabled'], - tpmPolicyOn: this.$store.getters['hostBootSettings/tpmEnabled'] - } + tpmPolicyOn: this.$store.getters['hostBootSettings/tpmEnabled'], + }, }; }, computed: { @@ -71,19 +71,19 @@ export default { 'bootSourceOptions', 'bootSource', 'overrideEnabled', - 'tpmEnabled' - ]) + 'tpmEnabled', + ]), }, watch: { - bootSource: function(value) { + bootSource: function (value) { this.form.bootOption = value; }, - overrideEnabled: function(value) { + overrideEnabled: function (value) { this.form.oneTimeBoot = value; }, - tpmEnabled: function(value) { + tpmEnabled: function (value) { this.form.tpmPolicyOn = value; - } + }, }, validations: { // Empty validations to leverage vuelidate form states @@ -91,13 +91,13 @@ export default { form: { bootOption: {}, oneTimeBoot: {}, - tpmPolicyOn: {} - } + tpmPolicyOn: {}, + }, }, created() { Promise.all([ this.$store.dispatch('hostBootSettings/getBootSettings'), - this.$store.dispatch('hostBootSettings/getTpmPolicy') + this.$store.dispatch('hostBootSettings/getTpmPolicy'), ]).finally(() => this.$root.$emit('serverPowerOperations::bootSettings::complete') ); @@ -124,7 +124,7 @@ export default { this.$store .dispatch('hostBootSettings/saveSettings', settings) - .then(message => this.successToast(message)) + .then((message) => this.successToast(message)) .catch(({ message }) => this.errorToast(message)) .finally(() => { this.$v.form.$reset(); @@ -135,7 +135,7 @@ export default { this.$v.form.bootOption.$touch(); // Disable one time boot if selected boot option is 'None' if (selectedOption === 'None') this.form.oneTimeBoot = false; - } - } + }, + }, }; diff --git a/src/views/Control/ServerPowerOperations/ServerPowerOperations.vue b/src/views/Control/ServerPowerOperations/ServerPowerOperations.vue index 32b2ea86..9bc259f8 100644 --- a/src/views/Control/ServerPowerOperations/ServerPowerOperations.vue +++ b/src/views/Control/ServerPowerOperations/ServerPowerOperations.vue @@ -148,12 +148,16 @@ export default { name: 'ServerPowerOperations', components: { PageTitle, PageSection, BootSettings, Alert }, mixins: [BVToastMixin, LoadingBarMixin], + beforeRouteLeave(to, from, next) { + this.hideLoader(); + next(); + }, data() { return { form: { rebootOption: 'orderly', - shutdownOption: 'orderly' - } + shutdownOption: 'orderly', + }, }; }, computed: { @@ -168,24 +172,20 @@ export default { }, oneTimeBootEnabled() { return this.$store.getters['hostBootSettings/overrideEnabled']; - } + }, }, created() { this.startLoader(); - const bootSettingsPromise = new Promise(resolve => { + const bootSettingsPromise = new Promise((resolve) => { this.$root.$on('serverPowerOperations::bootSettings::complete', () => resolve() ); }); Promise.all([ this.$store.dispatch('controls/getLastPowerOperationTime'), - bootSettingsPromise + bootSettingsPromise, ]).finally(() => this.endLoader()); }, - beforeRouteLeave(to, from, next) { - this.hideLoader(); - next(); - }, methods: { powerOn() { this.$store.dispatch('controls/hostPowerOn'); @@ -196,19 +196,19 @@ export default { ); const modalOptions = { title: this.$t('pageServerPowerOperations.modal.confirmRebootTitle'), - okTitle: this.$t('global.action.confirm') + okTitle: this.$t('global.action.confirm'), }; if (this.form.rebootOption === 'orderly') { this.$bvModal .msgBoxConfirm(modalMessage, modalOptions) - .then(confirmed => { + .then((confirmed) => { if (confirmed) this.$store.dispatch('controls/hostSoftReboot'); }); } else if (this.form.rebootOption === 'immediate') { this.$bvModal .msgBoxConfirm(modalMessage, modalOptions) - .then(confirmed => { + .then((confirmed) => { if (confirmed) this.$store.dispatch('controls/hostHardReboot'); }); } @@ -219,24 +219,24 @@ export default { ); const modalOptions = { title: this.$t('pageServerPowerOperations.modal.confirmShutdownTitle'), - okTitle: this.$t('global.action.confirm') + okTitle: this.$t('global.action.confirm'), }; if (this.form.shutdownOption === 'orderly') { this.$bvModal .msgBoxConfirm(modalMessage, modalOptions) - .then(confirmed => { + .then((confirmed) => { if (confirmed) this.$store.dispatch('controls/hostSoftPowerOff'); }); } if (this.form.shutdownOption === 'immediate') { this.$bvModal .msgBoxConfirm(modalMessage, modalOptions) - .then(confirmed => { + .then((confirmed) => { if (confirmed) this.$store.dispatch('controls/hostHardPowerOff'); }); } - } - } + }, + }, }; diff --git a/src/views/Control/VirtualMedia/ModalConfigureConnection.vue b/src/views/Control/VirtualMedia/ModalConfigureConnection.vue index 2c75ae2a..21907734 100644 --- a/src/views/Control/VirtualMedia/ModalConfigureConnection.vue +++ b/src/views/Control/VirtualMedia/ModalConfigureConnection.vue @@ -6,7 +6,7 @@ @hidden="resetForm" @show="initModal" > -