From bd1122ee2fd5c8083c945390a1593b2b5774d8a1 Mon Sep 17 00:00:00 2001 From: Paul Slaughter Date: Thu, 4 Apr 2019 02:44:16 -0500 Subject: Fix vue render error for IDE status bar **What?** A Vue warning that `ide_status_bar` sent a `Boolean` to a `String` property (`img-src). **What was the fix?** Previously, `latestPipeline` could be one of the following values: | | | |----------|--------| | `null` | The pipeline hasn't loaded yet | | `false` | The pipeline has loaded, but nothing was returned. | | `Object` | The piepline has loaded. | Giving a semantic meaning to different falsey values hurts maintainability. This commit fixes the above problem by removing the `false` value and introducing a `hasLoadedPipeline` state property. --- .../javascripts/ide/components/pipelines/list.vue | 14 ++- .../ide/stores/modules/pipelines/mutations.js | 3 +- .../ide/stores/modules/pipelines/state.js | 1 + .../ide/components/pipelines/list_spec.js | 31 ++++-- .../ide/stores/modules/pipelines/mutations_spec.js | 106 +++++++++++---------- 5 files changed, 94 insertions(+), 61 deletions(-) diff --git a/app/assets/javascripts/ide/components/pipelines/list.vue b/app/assets/javascripts/ide/components/pipelines/list.vue index 451c8030e16..5ae73b2fc9c 100644 --- a/app/assets/javascripts/ide/components/pipelines/list.vue +++ b/app/assets/javascripts/ide/components/pipelines/list.vue @@ -24,7 +24,13 @@ export default { ...mapState(['pipelinesEmptyStateSvgPath', 'links']), ...mapGetters(['currentProject']), ...mapGetters('pipelines', ['jobsCount', 'failedJobsCount', 'failedStages', 'pipelineFailed']), - ...mapState('pipelines', ['isLoadingPipeline', 'latestPipeline', 'stages', 'isLoadingJobs']), + ...mapState('pipelines', [ + 'isLoadingPipeline', + 'hasLoadedPipeline', + 'latestPipeline', + 'stages', + 'isLoadingJobs', + ]), ciLintText() { return sprintf( __('You can test your .gitlab-ci.yml in %{linkStart}CI Lint%{linkEnd}.'), @@ -36,7 +42,7 @@ export default { ); }, showLoadingIcon() { - return this.isLoadingPipeline && this.latestPipeline === null; + return this.isLoadingPipeline && !this.hasLoadedPipeline; }, }, created() { @@ -51,7 +57,7 @@ export default {