Skip to content

Commit

Permalink
AWS and ECS changes according to new requirement And fixed build rela…
Browse files Browse the repository at this point in the history
…ted issue (#83)
  • Loading branch information
siddhu-opsmx authored and hanumeshc committed Oct 26, 2023
1 parent e043909 commit 494dcd6
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ export class AmazonServerGroupActions extends React.Component<IAmazonServerGroup

return (
<>
{AWSProviderSettings.adHocInfraWritesEnabled && (
{AWSProviderSettings.adHocInfraWritesEnabled && 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">
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/config/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export interface ISpinnakerSettings {
kubernetesAdHocInfraWritesEnabled: boolean;
kubernetesAdHocInfraEditEnabled: boolean;
changelogUrl: string;
ecsAdHocInfraEditEnabled: boolean;
adHocInfraEditEnabled: boolean;
}

export const SETTINGS: ISpinnakerSettings = (window as any).spinnakerSettings || {};
Expand All @@ -161,7 +161,7 @@ SETTINGS.feature = SETTINGS.feature || {};
SETTINGS.feature.roscoMode = SETTINGS.feature.roscoMode ?? true;
SETTINGS.kubernetesAdHocInfraWritesEnabled = SETTINGS.kubernetesAdHocInfraWritesEnabled ?? true;
SETTINGS.kubernetesAdHocInfraEditEnabled = SETTINGS.kubernetesAdHocInfraEditEnabled ?? false;
SETTINGS.ecsAdHocInfraEditEnabled = SETTINGS.ecsAdHocInfraEditEnabled ?? false;
SETTINGS.adHocInfraEditEnabled = SETTINGS.adHocInfraEditEnabled ?? true;
SETTINGS.analytics = SETTINGS.analytics || {};
SETTINGS.providers = SETTINGS.providers || {};
SETTINGS.defaultTimeZone = SETTINGS.defaultTimeZone || 'America/Los_Angeles';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,19 +366,7 @@ angular
};

this.isEditEnabled = () => {
const authenticatedUser = AuthenticationService.getAuthenticatedUser();
const applicationAttr = this.application.attributes;
const isExist = (arr1, arr2) => {
return arr1?.some((v) => arr2?.includes(v));
};
const isWriteEnabled = () => {
if (authenticatedUser.name !== applicationAttr.user && applicationAttr.permissions) {
return isExist(applicationAttr.permissions?.WRITE, authenticatedUser.roles);
} else {
return true;
}
};
return SETTINGS.ecsAdHocInfraEditEnabled ? isWriteEnabled() : true;
return SETTINGS.adHocInfraEditEnabled;
};
},
]);
15 changes: 0 additions & 15 deletions test/functional/cypress/integration/ecs/clusters_list.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,6 @@ describe('Amazon ECS: aws-prod-ecsdemo cluster', () => {
cy.get('.sub-group:contains("aws-prod-ecsdemo")')
.find('.server-group:contains("v000")')
.click({ force: true });

cy.get('.btn:contains("Server Group Actions")')
.click()
.get('.dropdown-menu')
.get('.ng-scope')
.should('contain.text', 'Rollback');

cy.get('a:contains("Rollback")').click({ force: true });

cy.get('.modal-title').should('contain.text', 'Rollback aws-prod-ecsdemo');
});

it('shows stored details view and ECS server group actions', () => {
Expand All @@ -47,11 +37,6 @@ describe('Amazon ECS: aws-prod-ecsdemo cluster', () => {
cy.get('.sub-group:contains("aws-prod-ecsdemo")')
.find('.server-group:contains("v000")')
.click({ force: true });

cy.get('.btn:contains("Server Group Actions")')
.click()
.get('a:contains("Rollback")')
.click();
});

it('shows stored instance details view action', () => {
Expand Down

0 comments on commit 494dcd6

Please sign in to comment.