Skip to content

Commit

Permalink
Launch form: "auto pause" option should be available to admins and ad…
Browse files Browse the repository at this point in the history
…vanced users only
  • Loading branch information
rodichenko committed Dec 10, 2024
1 parent 58c738f commit 1319271
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions client/src/components/pipelines/launch/form/LaunchPipelineForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,7 @@ class LaunchPipelineForm extends localization.LocalizedReactComponent {
};

friendlyUrlAvailable = () => {
if (!this.props.authenticatedUserInfo.loaded) {
return false;
}
const {
admin,
roles = []
} = this.props.authenticatedUserInfo.value;
return admin || roles.find(r => /^ROLE_ADVANCED_USER$/i.test(r.name));
return this.isAdmin || this.isAdvancedUser;
};

static propTypes = {
Expand Down Expand Up @@ -2947,6 +2940,17 @@ class LaunchPipelineForm extends localization.LocalizedReactComponent {
return admin;
}

@computed
get isAdvancedUser () {
if (!this.props.authenticatedUserInfo.loaded) {
return false;
}
const {
roles = []
} = this.props.authenticatedUserInfo.value;
return roles.find(r => /^ROLE_ADVANCED_USER$/i.test(r.name));
}

isSystemParameterRestrictedByRole = (parameter) => {
if (
parameter &&
Expand Down Expand Up @@ -4699,7 +4703,12 @@ class LaunchPipelineForm extends localization.LocalizedReactComponent {
autoScaledCluster,
launchCluster
} = this.state;
if (!isSpot && !autoScaledCluster && !launchCluster) {
if (
!isSpot &&
!autoScaledCluster &&
!launchCluster &&
(this.isAdmin || this.isAdvancedUser)
) {
const onChange = (e) => {
this.setState({
autoPause: e.target.checked
Expand Down

0 comments on commit 1319271

Please sign in to comment.