From a1798d6900f094defa39199bcdeecf115d3c4e1d Mon Sep 17 00:00:00 2001 From: Coenen Benjamin Date: Tue, 28 Nov 2017 14:18:01 +0100 Subject: [PATCH] fix(ui): load version without remote filter if no repository linked (#1591) Signed-off-by: Benjamin Coenen --- engine/api/workflowv0/workflow.go | 8 ++++---- .../show/workflow/application.workflow.component.ts | 6 ++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/engine/api/workflowv0/workflow.go b/engine/api/workflowv0/workflow.go index 2350d5f604..78e89143d0 100644 --- a/engine/api/workflowv0/workflow.go +++ b/engine/api/workflowv0/workflow.go @@ -301,9 +301,9 @@ func LoadCDTree(db gorp.SqlExecutor, store cache.Store, projectkey, appName stri pipeline.LoadPipelineBuildOpts.WithBranchName(branchName), } - if remote == "" || remote == root.Application.RepositoryFullname { + if remote == "" || (root.Application.RepositoryFullname != "" && remote == root.Application.RepositoryFullname) { opts = append(opts, pipeline.LoadPipelineBuildOpts.WithEmptyRemote(root.Application.RepositoryFullname)) - } else { + } else if root.Application.RepositoryFullname != "" && remote != "" { opts = append(opts, pipeline.LoadPipelineBuildOpts.WithRemoteName(remote)) } @@ -319,9 +319,9 @@ func LoadCDTree(db gorp.SqlExecutor, store cache.Store, projectkey, appName stri pipeline.LoadPipelineBuildOpts.WithBranchName(branchName), } - if remote == "" || remote == root.Application.RepositoryFullname { + if remote == "" || (root.Application.RepositoryFullname != "" && remote == root.Application.RepositoryFullname) { opts = append(opts, pipeline.LoadPipelineBuildOpts.WithEmptyRemote(root.Application.RepositoryFullname)) - } else { + } else if root.Application.RepositoryFullname != "" && remote != "" { opts = append(opts, pipeline.LoadPipelineBuildOpts.WithRemoteName(remote)) } diff --git a/ui/src/app/views/application/show/workflow/application.workflow.component.ts b/ui/src/app/views/application/show/workflow/application.workflow.component.ts index 88892f958e..0948afd13a 100644 --- a/ui/src/app/views/application/show/workflow/application.workflow.component.ts +++ b/ui/src/app/views/application/show/workflow/application.workflow.component.ts @@ -316,10 +316,8 @@ export class ApplicationWorkflowComponent implements OnInit, OnDestroy { */ loadVersions(key: string, appName: string): Observable> { this.loading.version = true; - return this._appWorkflow.getVersions(key, appName, this.applicationFilter.branch, this.applicationFilter.remote).pipe( - finalize(() => { - this.loading.version = false; - })) + return this._appWorkflow.getVersions(key, appName, this.applicationFilter.branch || 'master', this.applicationFilter.remote) + .pipe(finalize(() => this.loading.version = false)) .map((versions) => this.versions = [' ', ...versions.map((v) => v.toString())]); }