Skip to content

Commit

Permalink
fix(dataprocessing): disable button on activation (#3161)
Browse files Browse the repository at this point in the history
Signed-off-by: Yann Pauly <[email protected]>
  • Loading branch information
impolitepanda authored Jun 26, 2020
1 parent 7405816 commit 3efc10b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default class {
this.pciProjectLabsService = PciProjectLabsService;
this.isActivated = false;
this.agreedLab = false;
this.isActivating = false;
}

$onInit() {
Expand Down Expand Up @@ -45,6 +46,7 @@ export default class {
}

authorizeService() {
this.isActivating = true;
let labPromise;
if (this.agreedLab) {
labPromise = this.pciProjectLabsService.activateLab(
Expand All @@ -55,9 +57,14 @@ export default class {
labPromise = this.$q.resolve();
}
return labPromise.then(() => {
this.dataProcessingService.authorize(this.projectId).then(() => {
this.goBack();
});
this.dataProcessingService
.authorize(this.projectId)
.then(() => {
this.goBack();
})
.finally(() => {
this.isActivating = false;
});
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ <h1 data-translate="data_processing_title"></h1>

<oui-button
data-variant="primary"
data-disabled="!$ctrl.agreedLab && !$ctrl.isActivated"
data-disabled="!$ctrl.agreedLab && !$ctrl.isActivated || $ctrl.isActivating"
data-on-click="$ctrl.authorizeService()"
>
<span data-translate="data_processing_onboarding_action_label"></span>
<span data-ng-if="$ctrl.isActivating">
...
</span>
</oui-button>
</pci-project-empty>

0 comments on commit 3efc10b

Please sign in to comment.