in services/self-service/src/main/resources/webapp/src/app/administration/configuration/configuration.component.ts [278:337]
public restartServices(): void {
const selectedServices = [];
for (const service in this.services) {
if (this.services[service].selected) {
selectedServices.push(service);
}
}
this.dialog.open(
SettingsConfirmationDialogComponent,
{
data: {
action: 'restart',
services: selectedServices,
environmentStatuses: this.environmentStatuses,
activeEndpoint: this.activeEndpoint
},
panelClass: 'modal-sm'
})
.afterClosed().subscribe(result => {
if (result) {
this.messagesStatus.error = [];
this.messagesStatus.success = [];
if (this.environmentStatuses[this.activeEndpoint] && this.services['provisioning'].selected) {
this.services['provisioning'].selected = false;
}
if (this.services['self-service'].selected) {
this.messagesStatus.counter += 1;
this.restartSingleService(true, false, false, 'Self-service');
}
if (this.services['provisioning'].selected) {
this.messagesStatus.counter += 1;
this.restartSingleService(false, true, false, 'Provisioning service');
}
if (this.services['billing'].selected) {
this.messagesStatus.counter += 1;
this.restartSingleService(false, false, true, 'Billing service');
}
let timer = setInterval(() => {
if (this.messagesStatus.counter === 0) {
for (let key in this.messagesStatus) {
if (key === 'error' && this.messagesStatus[key].length > 0) {
this.toastr.error(`${this.messagesStatus[key].join(', ')} restarting failed`, 'Oops!');
} else if (key === 'success' && this.messagesStatus[key].length > 0) {
this.toastr.success(`${this.messagesStatus[key].join(', ')} restarting started!`, 'Success!');
}
}
clearInterval(timer);
}
}, 200);
this.clearSelectedServices();
} else {
this.clearSelectedServices();
}
});
}