diff options
author | Enrique Alcántara <ealcantara@gitlab.com> | 2019-06-06 17:15:39 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2019-06-06 17:15:39 +0300 |
commit | 940c812d5e3788d86603a87723198842af86efaf (patch) | |
tree | 7bde45b231eba6152aca1f42dd9290b6970812db /app/assets/javascripts | |
parent | 431f33fe8e6e6fea2f5bdfcdb1e4543487e885a1 (diff) |
Replace upgrade with update
Use update term instead of update in the clusters managed app
implementation in order to make the implementation and UI
language more consistent.
Diffstat (limited to 'app/assets/javascripts')
5 files changed, 47 insertions, 66 deletions
diff --git a/app/assets/javascripts/clusters/clusters_bundle.js b/app/assets/javascripts/clusters/clusters_bundle.js index bc2e71b99f2..aacfa0d87e6 100644 --- a/app/assets/javascripts/clusters/clusters_bundle.js +++ b/app/assets/javascripts/clusters/clusters_bundle.js @@ -142,8 +142,7 @@ export default class Clusters { addListeners() { if (this.showTokenButton) this.showTokenButton.addEventListener('click', this.showToken); eventHub.$on('installApplication', this.installApplication); - eventHub.$on('upgradeApplication', data => this.upgradeApplication(data)); - eventHub.$on('dismissUpgradeSuccess', appId => this.dismissUpgradeSuccess(appId)); + eventHub.$on('updateApplication', data => this.updateApplication(data)); eventHub.$on('saveKnativeDomain', data => this.saveKnativeDomain(data)); eventHub.$on('setKnativeHostname', data => this.setKnativeHostname(data)); eventHub.$on('uninstallApplication', data => this.uninstallApplication(data)); @@ -155,8 +154,7 @@ export default class Clusters { removeListeners() { if (this.showTokenButton) this.showTokenButton.removeEventListener('click', this.showToken); eventHub.$off('installApplication', this.installApplication); - eventHub.$off('upgradeApplication', this.upgradeApplication); - eventHub.$off('dismissUpgradeSuccess', this.dismissUpgradeSuccess); + eventHub.$off('updateApplication', this.updateApplication); eventHub.$off('saveKnativeDomain'); eventHub.$off('setKnativeHostname'); eventHub.$off('uninstallApplication'); @@ -331,19 +329,13 @@ export default class Clusters { }); } - upgradeApplication(data) { - const appId = data.id; - + updateApplication({ id: appId, params }) { this.store.updateApplication(appId); - this.service.installApplication(appId, data.params).catch(() => { + this.service.installApplication(appId, params).catch(() => { this.store.notifyUpdateFailure(appId); }); } - dismissUpgradeSuccess(appId) { - this.store.acknowledgeSuccessfulUpdate(appId); - } - toggleIngressDomainHelpText({ externalIp }, { externalIp: newExternalIp }) { if (externalIp !== newExternalIp) { this.ingressDomainHelpText.classList.toggle('hide', !newExternalIp); diff --git a/app/assets/javascripts/clusters/components/application_row.vue b/app/assets/javascripts/clusters/components/application_row.vue index 7b173be599a..4771090aa7e 100644 --- a/app/assets/javascripts/clusters/components/application_row.vue +++ b/app/assets/javascripts/clusters/components/application_row.vue @@ -2,7 +2,7 @@ /* eslint-disable vue/require-default-prop */ import { GlLink, GlModalDirective } from '@gitlab/ui'; import TimeagoTooltip from '../../vue_shared/components/time_ago_tooltip.vue'; -import { s__, sprintf } from '../../locale'; +import { s__, __, sprintf } from '~/locale'; import eventHub from '../event_hub'; import identicon from '../../vue_shared/components/identicon.vue'; import loadingButton from '../../vue_shared/components/loading_button.vue'; @@ -85,7 +85,7 @@ export default { type: String, required: false, }, - upgradeAvailable: { + updateAvailable: { type: Boolean, required: false, }, @@ -113,11 +113,6 @@ export default { required: false, default: false, }, - updateAcknowledged: { - type: Boolean, - required: false, - default: true, - }, installApplicationRequestParams: { type: Object, required: false, @@ -174,11 +169,11 @@ export default { installButtonLabel() { let label; if (this.canInstall) { - label = s__('ClusterIntegration|Install'); + label = __('Install'); } else if (this.isInstalling) { - label = s__('ClusterIntegration|Installing'); + label = __('Installing'); } else if (this.installed) { - label = s__('ClusterIntegration|Installed'); + label = __('Installed'); } return label; @@ -187,7 +182,7 @@ export default { return this.manageLink && this.status === APPLICATION_STATUS.INSTALLED; }, manageButtonLabel() { - return s__('ClusterIntegration|Manage'); + return __('Manage'); }, hasError() { return this.installFailed || this.uninstallFailed; @@ -207,42 +202,42 @@ export default { }, versionLabel() { if (this.updateFailed) { - return s__('ClusterIntegration|Upgrade failed'); - } else if (this.isUpgrading) { - return s__('ClusterIntegration|Upgrading'); + return __('Update failed'); + } else if (this.isUpdating) { + return __('Updating'); } - return s__('ClusterIntegration|Upgraded'); + return __('Updated'); }, - upgradeFailureDescription() { + updateFailureDescription() { return s__('ClusterIntegration|Update failed. Please check the logs and try again.'); }, - upgradeSuccessDescription() { - return sprintf(s__('ClusterIntegration|%{title} upgraded successfully.'), { + updateSuccessDescription() { + return sprintf(s__('ClusterIntegration|%{title} updated successfully.'), { title: this.title, }); }, - upgradeButtonLabel() { + updateButtonLabel() { let label; - if (this.upgradeAvailable && !this.updateFailed && !this.isUpgrading) { - label = s__('ClusterIntegration|Upgrade'); - } else if (this.isUpgrading) { - label = s__('ClusterIntegration|Updating'); + if (this.updateAvailable && !this.updateFailed && !this.isUpdating) { + label = __('Update'); + } else if (this.isUpdating) { + label = __('Updating'); } else if (this.updateFailed) { - label = s__('ClusterIntegration|Retry update'); + label = __('Retry update'); } return label; }, - isUpgrading() { + isUpdating() { // Since upgrading is handled asynchronously on the backend we need this check to prevent any delay on the frontend return this.status === APPLICATION_STATUS.UPDATING; }, - shouldShowUpgradeDetails() { + shouldShowUpdateDetails() { // This method only returns true when; - // Upgrade was successful OR Upgrade failed - // AND new upgrade is unavailable AND version information is present. - return (this.updateSuccessful || this.updateFailed) && !this.upgradeAvailable && this.version; + // Update was successful OR Update failed + // AND new update is unavailable AND version information is present. + return (this.updateSuccessful || this.updateFailed) && !this.updateAvailable && this.version; }, uninstallSuccessDescription() { return sprintf(s__('ClusterIntegration|%{title} uninstalled successfully.'), { @@ -253,7 +248,7 @@ export default { watch: { updateSuccessful(updateSuccessful) { if (updateSuccessful) { - this.$toast.show(this.upgradeSuccessDescription); + this.$toast.show(this.updateSuccessDescription); } }, uninstallSuccessful(uninstallSuccessful) { @@ -269,8 +264,8 @@ export default { params: this.installApplicationRequestParams, }); }, - upgradeClicked() { - eventHub.$emit('upgradeApplication', { + updateClicked() { + eventHub.$emit('updateApplication', { id: this.id, params: this.installApplicationRequestParams, }); @@ -332,8 +327,8 @@ export default { <div v-if="updateable"> <div - v-if="shouldShowUpgradeDetails" - class="form-text text-muted label p-0 js-cluster-application-upgrade-details" + v-if="shouldShowUpdateDetails" + class="form-text text-muted label p-0 js-cluster-application-update-details" > {{ versionLabel }} <span v-if="updateSuccessful">to</span> @@ -342,24 +337,24 @@ export default { v-if="updateSuccessful" :href="chartRepo" target="_blank" - class="js-cluster-application-upgrade-version" + class="js-cluster-application-update-version" >chart v{{ version }}</gl-link > </div> <div - v-if="updateFailed && !isUpgrading" - class="bs-callout bs-callout-danger cluster-application-banner mt-2 mb-0 js-cluster-application-upgrade-failure-message" + v-if="updateFailed && !isUpdating" + class="bs-callout bs-callout-danger cluster-application-banner mt-2 mb-0 js-cluster-application-update-details" > - {{ upgradeFailureDescription }} + {{ updateFailureDescription }} </div> <loading-button - v-if="upgradeAvailable || updateFailed || isUpgrading" - class="btn btn-primary js-cluster-application-upgrade-button mt-2" - :loading="isUpgrading" - :disabled="isUpgrading" - :label="upgradeButtonLabel" - @click="upgradeClicked" + v-if="updateAvailable || updateFailed || isUpdating" + class="btn btn-primary js-cluster-application-update-button mt-2" + :loading="isUpdating" + :disabled="isUpdating" + :label="updateButtonLabel" + @click="updateClicked" /> </div> </div> diff --git a/app/assets/javascripts/clusters/components/applications.vue b/app/assets/javascripts/clusters/components/applications.vue index 2d129245d37..970f5a7b297 100644 --- a/app/assets/javascripts/clusters/components/applications.vue +++ b/app/assets/javascripts/clusters/components/applications.vue @@ -376,7 +376,7 @@ export default { :request-reason="applications.runner.requestReason" :version="applications.runner.version" :chart-repo="applications.runner.chartRepo" - :upgrade-available="applications.runner.upgradeAvailable" + :update-available="applications.runner.updateAvailable" :installed="applications.runner.installed" :install-failed="applications.runner.installFailed" :update-successful="applications.runner.updateSuccessful" diff --git a/app/assets/javascripts/clusters/services/application_state_machine.js b/app/assets/javascripts/clusters/services/application_state_machine.js index 14b80a116a7..17ea4d77795 100644 --- a/app/assets/javascripts/clusters/services/application_state_machine.js +++ b/app/assets/javascripts/clusters/services/application_state_machine.js @@ -123,7 +123,6 @@ const applicationStateMachine = { target: INSTALLED, effects: { updateSuccessful: true, - updateAcknowledged: false, }, }, [UPDATE_ERRORED]: { diff --git a/app/assets/javascripts/clusters/stores/clusters_store.js b/app/assets/javascripts/clusters/stores/clusters_store.js index 89e61c10a46..f64f0ca616f 100644 --- a/app/assets/javascripts/clusters/stores/clusters_store.js +++ b/app/assets/javascripts/clusters/stores/clusters_store.js @@ -56,8 +56,7 @@ export default class ClusterStore { title: s__('ClusterIntegration|GitLab Runner'), version: null, chartRepo: 'https://gitlab.com/charts/gitlab-runner', - upgradeAvailable: null, - updateAcknowledged: true, + updateAvailable: null, updateSuccessful: false, updateFailed: false, }, @@ -136,10 +135,6 @@ export default class ClusterStore { this.state.applications[appId] = transitionApplicationState(currentAppState, event); } - acknowledgeSuccessfulUpdate(appId) { - this.state.applications[appId].updateAcknowledged = true; - } - updateAppProperty(appId, prop, value) { this.state.applications[appId][prop] = value; } @@ -154,7 +149,7 @@ export default class ClusterStore { status, status_reason: statusReason, version, - update_available: upgradeAvailable, + update_available: updateAvailable, can_uninstall: uninstallable, } = serverAppEntry; const currentApplicationState = this.state.applications[appId] || {}; @@ -191,7 +186,7 @@ export default class ClusterStore { serverAppEntry.external_hostname || this.state.applications.knative.externalHostname; } else if (appId === RUNNER) { this.state.applications.runner.version = version; - this.state.applications.runner.upgradeAvailable = upgradeAvailable; + this.state.applications.runner.updateAvailable = updateAvailable; } }); } |