From e83c4ecf039e06cd3ffcb16274e74859e4eab064 Mon Sep 17 00:00:00 2001 From: Edgar Garcia Date: Thu, 19 Sep 2024 22:37:48 -0600 Subject: [PATCH] feat(gce): add resourceManagerTags option in config --- .../serverGroupCommandBuilder.service.js | 11 +++++++++++ .../advancedSettings.directive.html | 7 +++++++ .../advancedSettingsSelector.directive.spec.js | 15 +++++++++++++++ 3 files changed, 33 insertions(+) diff --git a/packages/google/src/serverGroup/configure/serverGroupCommandBuilder.service.js b/packages/google/src/serverGroup/configure/serverGroupCommandBuilder.service.js index 29548845a3b..b1d01bc5f80 100644 --- a/packages/google/src/serverGroup/configure/serverGroupCommandBuilder.service.js +++ b/packages/google/src/serverGroup/configure/serverGroupCommandBuilder.service.js @@ -285,6 +285,12 @@ angular } } + function populateResourceManagerTags(instanceTemplateResourceManagerTags, command) { + if (instanceTemplateResourceManagerTags) { + Object.assign(command.resourceManagerTags, instanceTemplateResourceManagerTags); + } + } + function populateLabels(instanceTemplateLabels, command) { if (instanceTemplateLabels) { Object.assign(command.labels, instanceTemplateLabels); @@ -363,6 +369,7 @@ angular instanceMetadata: {}, tags: [], labels: {}, + resourceManagerTags: [], enableSecureBoot: false, enableVtpm: false, enableIntegrityMonitoring: false, @@ -441,6 +448,7 @@ angular instanceMetadata: {}, tags: [], labels: {}, + resourceManagerTags: [], availabilityZones: [], enableSecureBoot: serverGroup.enableSecureBoot, enableVtpm: serverGroup.enableVtpm, @@ -574,6 +582,9 @@ angular extendedCommand.tags = []; populateTags(instanceTemplateTags, extendedCommand); + const resourceManagerTags = extendedCommand.resourceManagerTags + populateResourceManagerTags(resourceManagerTags, extendedCommand) + return extendedCommand; }); }); diff --git a/packages/google/src/serverGroup/configure/wizard/advancedSettings/advancedSettings.directive.html b/packages/google/src/serverGroup/configure/wizard/advancedSettings/advancedSettings.directive.html index bd0bed64bd5..7c1fcfad475 100644 --- a/packages/google/src/serverGroup/configure/wizard/advancedSettings/advancedSettings.directive.html +++ b/packages/google/src/serverGroup/configure/wizard/advancedSettings/advancedSettings.directive.html @@ -87,6 +87,13 @@ +
+
+ Resource Manager Tags + +
+ +
Shielded VMs diff --git a/packages/google/src/serverGroup/configure/wizard/advancedSettings/advancedSettingsSelector.directive.spec.js b/packages/google/src/serverGroup/configure/wizard/advancedSettings/advancedSettingsSelector.directive.spec.js index c7e4815284d..396f6f64034 100644 --- a/packages/google/src/serverGroup/configure/wizard/advancedSettings/advancedSettingsSelector.directive.spec.js +++ b/packages/google/src/serverGroup/configure/wizard/advancedSettings/advancedSettingsSelector.directive.spec.js @@ -55,4 +55,19 @@ describe('Directive: GCE Group Advanced Settings Selector', function () { expect(this.scope.command.tags[0].value).toEqual('myTag2'); expect(this.gceTagManager.updateSelectedTags).toHaveBeenCalled(); }); + + it('should correctly add ResourceManagerTags to the command', function () { + expect(this.scope.command.resourceManagerTags.length).toEqual(0); + + this.elem.find('table.resourceManagerTags button').trigger('click'); + this.scope.$apply(); + expect(this.scope.command.tags.length).toEqual(1); + + this.elem.find('table.resourceManagerTags input').val('myTag').trigger('input'); + this.scope.$apply(); + + expect(this.scope.command.tags.length).toEqual(1); + expect(this.scope.command.tags[0].value).toEqual('myTag'); + }); + });