Skip to content

Commit

Permalink
feat(gce): add resourceManagerTags option in config
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarulg committed Sep 20, 2024
1 parent 08b95df commit e83c4ec
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -363,6 +369,7 @@ angular
instanceMetadata: {},
tags: [],
labels: {},
resourceManagerTags: [],
enableSecureBoot: false,
enableVtpm: false,
enableIntegrityMonitoring: false,
Expand Down Expand Up @@ -441,6 +448,7 @@ angular
instanceMetadata: {},
tags: [],
labels: {},
resourceManagerTags: [],
availabilityZones: [],
enableSecureBoot: serverGroup.enableSecureBoot,
enableVtpm: serverGroup.enableVtpm,
Expand Down Expand Up @@ -574,6 +582,9 @@ angular
extendedCommand.tags = [];
populateTags(instanceTemplateTags, extendedCommand);

const resourceManagerTags = extendedCommand.resourceManagerTags
populateResourceManagerTags(resourceManagerTags, extendedCommand)

return extendedCommand;
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@
</div>
<map-editor model="vm.command.labels" add-button-label="Add New Label" allow-empty="true"></map-editor>
</div>
<div class="form-group">
<div class="sm-label-left">
<b>Resource Manager Tags</b>
<help-field key="gce.serverGroup.resourceManagerTags"></help-field>
</div>
<map-editor model="vm.command.resourceManagerTags" add-button-label="Add New Tag" allow-empty="true"></map-editor>
</div>
<div class="form-group">
<div class="sm-label-left">
Shielded VMs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});

});

0 comments on commit e83c4ec

Please sign in to comment.