From 75c8c8fdfb5a4c1365a0e343f9e3bc8eae82d96f Mon Sep 17 00:00:00 2001 From: David Watrous <509299+dpwatrous@users.noreply.github.com> Date: Mon, 16 Oct 2023 11:36:53 -0400 Subject: [PATCH] Enable node communication mode editing This was only enabled in dev mode before. Now that we've updated to the latest API version, we can enable in production. --- .../pool-configuration.component.ts | 18 +++++++++++--- .../configuration/pool-configuration.html | 5 ++-- desktop/src/app/decorators/pool-decorator.ts | 24 ++++++++++++++++++- 3 files changed, 40 insertions(+), 7 deletions(-) diff --git a/desktop/src/app/components/pool/details/configuration/pool-configuration.component.ts b/desktop/src/app/components/pool/details/configuration/pool-configuration.component.ts index 316ce740bc..5529fd0c8a 100644 --- a/desktop/src/app/components/pool/details/configuration/pool-configuration.component.ts +++ b/desktop/src/app/components/pool/details/configuration/pool-configuration.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, isDevMode } from "@angular/core"; +import { Component, Input } from "@angular/core"; import { autobind } from "@batch-flask/core"; import { SidebarManager } from "@batch-flask/ui/sidebar"; import { EditMetadataFormComponent } from "app/components/common/edit-metadata-form"; @@ -27,13 +27,25 @@ export class PoolConfigurationComponent { } public get pool() { return this._pool; } - public isDevMode: boolean = isDevMode(); - public decorator: PoolDecorator; public certificates: List; public appPackages: List; public metadata: List = List([]); + public get nodeCommSummary(): string { + const current = this._pool.currentNodeCommunicationMode; + const currentLabel = this.decorator.currentNodeCommunicationMode; + + const target = this._pool.targetNodeCommunicationMode; + const targetLabel = this.decorator.targetNodeCommunicationMode; + + if (target === "default" || current === target) { + return currentLabel; + } else { + return `${currentLabel} -> ${targetLabel}`; + } + } + private _pool: Pool; constructor(private sidebarManager: SidebarManager, diff --git a/desktop/src/app/components/pool/details/configuration/pool-configuration.html b/desktop/src/app/components/pool/details/configuration/pool-configuration.html index c2513bbd6a..3603c85dd5 100644 --- a/desktop/src/app/components/pool/details/configuration/pool-configuration.html +++ b/desktop/src/app/components/pool/details/configuration/pool-configuration.html @@ -155,10 +155,9 @@ - - +
- {{decorator.currentNodeCommunicationMode}} + {{nodeCommSummary}}
diff --git a/desktop/src/app/decorators/pool-decorator.ts b/desktop/src/app/decorators/pool-decorator.ts index 4f50036082..c7faa61d48 100644 --- a/desktop/src/app/decorators/pool-decorator.ts +++ b/desktop/src/app/decorators/pool-decorator.ts @@ -1,6 +1,11 @@ import { StartTaskDecorator } from "app/decorators/start-task.decorator"; import { - ApplicationPackageReference, CertificateReference, Pool, UserAccount, UserAccountElevationLevel, + ApplicationPackageReference, + CertificateReference, + NodeCommunicationMode, + Pool, + UserAccount, + UserAccountElevationLevel, } from "app/models"; import { PoolUtils } from "app/utils"; import { DecoratorBase } from "app/utils/decorators"; @@ -41,6 +46,8 @@ export class PoolDecorator extends DecoratorBase { public networkSubnetId: string; public startTask: StartTaskDecorator; public applicationLicenses: string; + public targetNodeCommunicationMode?: string; + public currentNodeCommunicationMode?: string; public get routerLink() { return this.pool.routerLink; @@ -69,6 +76,8 @@ export class PoolDecorator extends DecoratorBase { this.startTask = pool.startTask && new StartTaskDecorator(pool.startTask); this.lowPriorityNodes = PoolUtils.poolNodesStatus(pool, pool.currentLowPriorityNodes, pool.targetLowPriorityNodes); + this.targetNodeCommunicationMode = this._nodeCommsField(pool.targetNodeCommunicationMode); + this.currentNodeCommunicationMode = this._nodeCommsField(pool.currentNodeCommunicationMode); this.poolOs = this._computePoolOs(); @@ -94,4 +103,17 @@ export class PoolDecorator extends DecoratorBase { } return user.name; } + + private _nodeCommsField(value: NodeCommunicationMode): string { + switch (value) { + case "default": + return "Default"; + case "classic": + return "Classic"; + case "simplified": + return "Simplified"; + default: + return value; + } + } }