From 28ad26c9b09b2bc161c2f689fb90c71bad2f7e03 Mon Sep 17 00:00:00 2001 From: Ryan Galletto Date: Thu, 19 Sep 2024 07:51:02 -0400 Subject: [PATCH] Add Tag Editor to other entity pages --- .../features/custom-tags/custom-tags.component.ts | 8 ++++++-- .../configuration/configuration-form.component.html | 11 +++++++++++ .../configuration/configuration-form.component.ts | 1 + .../edge-router-policy-form.component.html | 11 +++++++++++ .../edge-router-policy-form.component.ts | 4 ++-- .../edge-router/edge-router-form.component.ts | 1 - .../identity/identity-form.component.ts | 13 ++++++------- .../projectable-forms/projectable-form.class.ts | 1 + .../service-edge-router-policy-form.component.html | 11 +++++++++++ .../service-edge-router-policy-form.component.ts | 4 ++-- .../service-policy-form.component.html | 11 +++++++++++ .../service-policy/service-policy-form.component.ts | 6 +++--- .../service/service-form.component.ts | 1 - .../features/wrappers/zac-wrapper-service.class.ts | 2 ++ .../lib/features/wrappers/zac-wrapper.component.ts | 7 ++++--- .../lib/features/wrappers/zac-wrapper.service.ts | 4 ++-- projects/ziti-console-lib/src/lib/models/config.ts | 1 + .../src/lib/models/edge-router-policy.ts | 1 + .../src/lib/models/service-edge-router-policy.ts | 1 + .../src/lib/models/service-policy.ts | 1 + .../src/lib/services/settings-service.class.ts | 2 +- 21 files changed, 78 insertions(+), 24 deletions(-) diff --git a/projects/ziti-console-lib/src/lib/features/custom-tags/custom-tags.component.ts b/projects/ziti-console-lib/src/lib/features/custom-tags/custom-tags.component.ts index a2663014..1a7b9f35 100644 --- a/projects/ziti-console-lib/src/lib/features/custom-tags/custom-tags.component.ts +++ b/projects/ziti-console-lib/src/lib/features/custom-tags/custom-tags.component.ts @@ -14,7 +14,7 @@ limitations under the License. */ -import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core'; +import {Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges} from '@angular/core'; import {isEmpty, map, unset} from "lodash"; @Component({ @@ -22,7 +22,7 @@ import {isEmpty, map, unset} from "lodash"; templateUrl: './custom-tags.component.html', styleUrls: ['./custom-tags.component.scss'] }) -export class CustomTagsComponent implements OnInit { +export class CustomTagsComponent implements OnInit, OnChanges { @Input() tags: any = {}; @Output() tagsChange: EventEmitter = new EventEmitter(); @@ -39,6 +39,10 @@ export class CustomTagsComponent implements OnInit { this.updateTagsArray(); } + ngOnChanges(changes: SimpleChanges) { + this.updateTagsArray() + } + updateTagsArray() { this.tagsArray = map(this.tags, (value, key) => { return {name: key, value: value} diff --git a/projects/ziti-console-lib/src/lib/features/projectable-forms/configuration/configuration-form.component.html b/projects/ziti-console-lib/src/lib/features/projectable-forms/configuration/configuration-form.component.html index c59f578d..62ea61ea 100644 --- a/projects/ziti-console-lib/src/lib/features/projectable-forms/configuration/configuration-form.component.html +++ b/projects/ziti-console-lib/src/lib/features/projectable-forms/configuration/configuration-form.component.html @@ -82,6 +82,17 @@ > + +
+ + + +
AllOf + +
+ + + +
AllOf + +
+ + + +
AllOf + +
+ + + +
{ + const hasSession = !isEmpty(results?.session?.id); const controllerChanged = this.settings?.session?.controllerDomain !== results?.session?.controllerDomain; - if ((this.waitingForSession && !this.pageLoading) || controllerChanged) { + if (hasSession && (!this.pageLoading || controllerChanged)) { this.pageLoading = true; this.pageHtml = undefined; defer(async () => { @@ -81,7 +82,7 @@ export class ZacWrapperComponent implements OnInit, OnDestroy { this.pageLoading = false; }); } - this.settings = results; + this.settings = cloneDeep(results); }) ); this.subscription.add( diff --git a/projects/ziti-console-lib/src/lib/features/wrappers/zac-wrapper.service.ts b/projects/ziti-console-lib/src/lib/features/wrappers/zac-wrapper.service.ts index bc410031..9b81a413 100644 --- a/projects/ziti-console-lib/src/lib/features/wrappers/zac-wrapper.service.ts +++ b/projects/ziti-console-lib/src/lib/features/wrappers/zac-wrapper.service.ts @@ -936,13 +936,13 @@ export class ZacWrapperService extends ZacWrapperServiceClass { handleError(result: any) { this.loggerService.error(result); - const error = result; + const error = result.error ? result.error : result; let message = ''; if (error.cause&&error.causeMessage&&error.causeMessage.length>0) message = error.causeMessage; else if (error.cause&&error.cause.message&&error.cause.message.length>0) message = error.cause.message; else if (error.cause&&error.cause.reason&&error.cause.reason.length>0) message = error.cause.reason; else if (error.message&&error.message.length>0) message = error.message; else message = error; - return {error: message}; + return {error: message, data: []}; } } diff --git a/projects/ziti-console-lib/src/lib/models/config.ts b/projects/ziti-console-lib/src/lib/models/config.ts index afcc64e3..cf782b14 100644 --- a/projects/ziti-console-lib/src/lib/models/config.ts +++ b/projects/ziti-console-lib/src/lib/models/config.ts @@ -2,4 +2,5 @@ export class Config { name = ''; data = {}; configTypeId = ''; + tags: any = {}; }; \ No newline at end of file diff --git a/projects/ziti-console-lib/src/lib/models/edge-router-policy.ts b/projects/ziti-console-lib/src/lib/models/edge-router-policy.ts index 3d563645..d4a4a3d4 100644 --- a/projects/ziti-console-lib/src/lib/models/edge-router-policy.ts +++ b/projects/ziti-console-lib/src/lib/models/edge-router-policy.ts @@ -3,4 +3,5 @@ export class EdgeRouterPolicy { edgeRouterRoles: any[] = []; identityRoles: any[] = []; semantic = 'AnyOf'; + tags: any = {} }; \ No newline at end of file diff --git a/projects/ziti-console-lib/src/lib/models/service-edge-router-policy.ts b/projects/ziti-console-lib/src/lib/models/service-edge-router-policy.ts index b774563f..47f991d9 100644 --- a/projects/ziti-console-lib/src/lib/models/service-edge-router-policy.ts +++ b/projects/ziti-console-lib/src/lib/models/service-edge-router-policy.ts @@ -3,4 +3,5 @@ export class ServiceEdgeRouterPolicy { edgeRouterRoles: any[] = []; serviceRoles: any[] = []; semantic = 'AnyOf'; + tags: any = {}; }; \ No newline at end of file diff --git a/projects/ziti-console-lib/src/lib/models/service-policy.ts b/projects/ziti-console-lib/src/lib/models/service-policy.ts index 0d8da20f..120599b2 100644 --- a/projects/ziti-console-lib/src/lib/models/service-policy.ts +++ b/projects/ziti-console-lib/src/lib/models/service-policy.ts @@ -5,4 +5,5 @@ export class ServicePolicy { postureCheckRoles: any[] = []; semantic = 'AnyOf'; type = 'Bind'; + tags: any = {}; }; \ No newline at end of file diff --git a/projects/ziti-console-lib/src/lib/services/settings-service.class.ts b/projects/ziti-console-lib/src/lib/services/settings-service.class.ts index ad36fb23..f0a29ab3 100644 --- a/projects/ziti-console-lib/src/lib/services/settings-service.class.ts +++ b/projects/ziti-console-lib/src/lib/services/settings-service.class.ts @@ -66,7 +66,7 @@ export abstract class SettingsServiceClass { public supportedFeatures: any = { organization: false, - tags: false, + tags: true, customFields: false, mailer: false, recipes: false