From 52e9f0cdbd28adb18c58da56ef121ca439f95842 Mon Sep 17 00:00:00 2001 From: Oleksii Orel Date: Thu, 10 Oct 2019 17:10:58 +0300 Subject: [PATCH] fixup! Fix load factory flow in the case with policies.create=peruser --- .../load-factory/load-factory.controller.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/dashboard/src/app/factories/load-factory/load-factory.controller.ts b/dashboard/src/app/factories/load-factory/load-factory.controller.ts index 8ed7985ecae..372b7550fe9 100644 --- a/dashboard/src/app/factories/load-factory/load-factory.controller.ts +++ b/dashboard/src/app/factories/load-factory/load-factory.controller.ts @@ -245,26 +245,26 @@ export class LoadFactoryController { case 'peruser' : workspace = this.lodash.find(this.workspaces, (w: che.IWorkspace) => { if (this.factory.id) { - return this.factory.id === (w.attributes as any).factoryId; - } else if (this.routeParams.url){ - const factoryUrl = (w.attributes as any).factoryurl; + return this.factory.id === w.attributes.factoryId; + } else if (this.routeParams.url) { + const factoryUrl = w.attributes.factoryurl; // compare factory URL and route params if (angular.isDefined(factoryUrl)) { const factoryUrlObj = new (window as any).URL(factoryUrl); - const pathIsCorrect = `${factoryUrlObj.origin}${factoryUrlObj.pathname}` === this.routeParams.url; - if (pathIsCorrect === false) { + const isPathCorrect = `${factoryUrlObj.origin}${factoryUrlObj.pathname}` === this.routeParams.url; + if (isPathCorrect === false) { return false; } let factoryUrlParamsNumber = 0; let hasExtraKey = false; - factoryUrlObj.searchParams.forEach((volume: string, key: string) => { + for (const [key, value] of factoryUrlObj.searchParams) { if (hasExtraKey) { return; } factoryUrlParamsNumber++; - hasExtraKey = this.routeParams[key] !== volume; - }); + hasExtraKey = this.routeParams[key] !== value; + } if (hasExtraKey) { return false; }