in source/console/src/app/secure/systems/system.component.ts [193:242]
public deploy() {
console.log('Deploy', this.data.system.deviceIds);
swal.fire({
title: 'Are you sure you want to deploy this system?',
text: `This will overwrite whatever the device is doing!`,
type: 'question',
showCancelButton: true,
cancelButtonColor: '#3085d6',
confirmButtonColor: '#d33',
confirmButtonText: 'Yes, deploy it!'
}).then(result => {
if (result.value) {
this.blockUI.start('First refreshing the device spec for the system...');
this.systemService
.refreshSystem(this.data.system.id)
.then(() => {
this.blockUI.start('Deploying system...');
return Promise.all(
this.data.system.deviceIds.map(deviceId => {
return this.deploymentService
.addDeployment(deviceId)
.then(deployment => {
console.log(deployment);
return deployment;
})
.catch(err => {
console.error(err);
throw err;
});
})
);
})
.then(results => {
this.blockUI.stop();
swal.fire({
timer: 1000,
title: 'Success',
type: 'success',
showConfirmButton: false
}).then();
})
.catch(err => {
this.blockUI.stop();
swal.fire('Oops...', 'Something went wrong! Unable to deploy the system.', 'error');
this.logger.error('error occurred calling addDeployment api, show message');
this.logger.error(err);
});
}
});
}