Skip to content

Commit

Permalink
OP-21070 - Backporting changes related to OP-21127 feature (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
siddhu-opsmx authored Sep 19, 2023
1 parent 5b96042 commit b2ba044
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ export class AmazonServerGroupActions extends React.Component<IAmazonServerGroup
const entityTagTargets: IOwnerOption[] = ClusterTargetBuilder.buildClusterTargets(serverGroup);

return (
<Dropdown className="dropdown" id="server-group-actions-dropdown">
SETTINGS.adHocInfraEditEnabled ? (<Dropdown className="dropdown" id="server-group-actions-dropdown">
<Dropdown.Toggle className="btn btn-sm btn-primary dropdown-toggle">Server Group Actions</Dropdown.Toggle>
<Dropdown.Menu className="dropdown-menu">
{this.isRollbackEnabled() && (
Expand Down Expand Up @@ -336,7 +336,7 @@ export class AmazonServerGroupActions extends React.Component<IAmazonServerGroup
/>
)}
</Dropdown.Menu>
</Dropdown>
</Dropdown>):null
);
}
}
2 changes: 2 additions & 0 deletions packages/core/src/config/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ export interface ISpinnakerSettings {
triggerTypes: string[];
useClassicFirewallLabels: boolean;
kubernetesAdHocInfraWritesEnabled: boolean;
adHocInfraEditEnabled: boolean;
changelogUrl: string;
}

Expand All @@ -151,6 +152,7 @@ SETTINGS.analytics = SETTINGS.analytics || {};
SETTINGS.providers = SETTINGS.providers || {};
SETTINGS.defaultTimeZone = SETTINGS.defaultTimeZone || 'America/Los_Angeles';
SETTINGS.dockerInsights = SETTINGS.dockerInsights || { enabled: false, url: '' };
SETTINGS.adHocInfraEditEnabled = SETTINGS.adHocInfraEditEnabled ?? true;
SETTINGS.changelogUrl =
SETTINGS.changelogUrl || 'https://www.spinnaker.io/community/releases/versions/:version-changelog';
SETTINGS.managedDelivery = SETTINGS.managedDelivery || {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
SERVER_GROUP_WRITER,
ServerGroupReader,
ServerGroupWarningMessageService,
SETTINGS,
SubnetReader,
} from '@spinnaker/core';

Expand Down Expand Up @@ -313,6 +314,8 @@ angular
});
};

this.isEditEnabled = () => SETTINGS.adHocInfraEditEnabled;

this.resizeServerGroup = () => {
$uibModal.open({
templateUrl: overrideRegistry.getTemplate('ecs.resize.modal', require('./resize/resizeServerGroup.html')),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ <h3 class="horizontal middle space-between flex-1" select-on-dbl-click>
</h3>
</div>
<div>
<div class="actions" ng-class="{ insights: ctrl.serverGroup.insightActions.length > 0 }">
<div class="actions" ng-class="{ insights: ctrl.serverGroup.insightActions.length > 0 }" ng-if=" ctrl.isEditEnabled">
<div class="dropdown" uib-dropdown dropdown-append-to-body>
<button type="button" class="btn btn-sm btn-primary dropdown-toggle" uib-dropdown-toggle>
Server Group Actions <span class="caret"></span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ class KubernetesServerGroupDetailsController implements IController {
});
}

public isEditEnabled () {
return SETTINGS.adHocInfraEditEnabled;
}

private configureEntityTagTargets(): IOwnerOption[] {
return ClusterTargetBuilder.buildClusterTargets(this.serverGroup);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/kubernetes/src/serverGroup/details/details.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ <h3 class="horizontal middle space-between flex-1" select-on-dbl-click>
</render-if-feature>
</h3>
</div>
<div class="actions">
<div class="actions" ng-if="ctrl.isEditEnabled()">
<div class="dropdown" uib-dropdown dropdown-append-to-body>
<button type="button" class="btn btn-sm btn-primary dropdown-toggle" uib-dropdown-toggle ng-hide="isDisabled">
{{ctrl.serverGroup.kind | robotToHuman}} Actions <span class="caret"></span>
Expand Down

0 comments on commit b2ba044

Please sign in to comment.