Skip to content

Commit

Permalink
[MS] Hide cancel button when job is done
Browse files Browse the repository at this point in the history
  • Loading branch information
fabienSvstr authored and Ironicbay committed Feb 13, 2025
1 parent bbd32f2 commit de78665
Showing 1 changed file with 25 additions and 20 deletions.
45 changes: 25 additions & 20 deletions client/src/views/users/BulkRoleAssignmentModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

<div
class="modal-content"
v-if="currentPage === Steps.Summary && targetUser"
v-if="[Steps.Summary, Steps.End].includes(currentPage) && targetUser"
>
<div class="chosen-users">
<user-avatar-name
Expand All @@ -64,13 +64,17 @@
:icon="arrowForward"
class="arrow-icon"
/>
<div class="chosen-users-target">
<div
class="chosen-users-target"
:class="currentPage === Steps.Summary ? 'chosen-users-target-active' : ''"
>
<user-avatar-name
:user-avatar="targetUser.humanHandle.label"
:user-name="targetUser.humanHandle.label"
/>
<ion-icon
:icon="pencil"
v-show="currentPage !== Steps.End"
@click="currentPage = Steps.SelectUser"
/>
</div>
Expand Down Expand Up @@ -131,6 +135,7 @@
fill="clear"
size="default"
@click="cancel"
v-if="currentPage !== Steps.End"
>
{{ $msTranslate('MyProfilePage.cancelButton') }}
</ion-button>
Expand Down Expand Up @@ -310,15 +315,19 @@ async function assignNewRoles(): Promise<void> {
}

async function nextStep(): Promise<void> {
if (currentPage.value === Steps.SelectUser) {
currentPage.value = Steps.Processing;
await findWorkspaces();
} else if (currentPage.value === Steps.Summary) {
if (roleUpdates.value.length === 0 || finished.value) {
await modalController.dismiss(null, MsModalResult.Confirm);
} else {
switch (currentPage.value) {
case Steps.SelectUser:
currentPage.value = Steps.Processing;
await findWorkspaces();
break;
case Steps.Summary:
await assignNewRoles();
}
if (roleUpdates.value.length === 0 || finished.value) {
currentPage.value = Steps.End;
}
break;
case Steps.End:
await modalController.dismiss(null, MsModalResult.Confirm);
}
}

Expand All @@ -328,16 +337,12 @@ async function cancel(): Promise<void> {

function getNextButtonText(): string {
switch (currentPage.value) {
case Steps.SelectUser: {
case Steps.SelectUser:
return 'UsersPage.assignRoles.select';
}
case Steps.Summary: {
if (roleUpdates.value.length === 0 || finished.value) {
return 'UsersPage.assignRoles.close';
} else {
return 'UsersPage.assignRoles.okButton';
}
}
case Steps.Summary:
return 'UsersPage.assignRoles.okButton';
case Steps.End:
return 'UsersPage.assignRoles.close';
default:
return '';
}
Expand Down Expand Up @@ -365,7 +370,7 @@ function getNextButtonText(): string {
flex-grow: 1;
}

.chosen-users-target {
.chosen-users-target-active {
justify-content: space-between;
cursor: pointer;
transition: background 150ms ease-in-out;
Expand Down

0 comments on commit de78665

Please sign in to comment.