89136cbf6a
Manual interventions: • decorators on the same line for service and controller injections and most computed property macros • preserving import order when possible, both per-line and intra-line • moving new imports to the bottom • removal of classic decorator for trivial cases • conversion of init to constructor when appropriate
30 lines
785 B
JavaScript
30 lines
785 B
JavaScript
import Watchable from './watchable';
|
|
|
|
export default class Deployment extends Watchable {
|
|
promote(deployment) {
|
|
const id = deployment.get('id');
|
|
const url = urlForAction(this.urlForFindRecord(id, 'deployment'), '/promote');
|
|
return this.ajax(url, 'POST', {
|
|
data: {
|
|
DeploymentId: id,
|
|
All: true,
|
|
},
|
|
});
|
|
}
|
|
}
|
|
|
|
// The deployment action API endpoints all end with the ID
|
|
// /deployment/:action/:deployment_id instead of /deployment/:deployment_id/:action
|
|
function urlForAction(url, extension = '') {
|
|
const [path, params] = url.split('?');
|
|
const pathParts = path.split('/');
|
|
const idPart = pathParts.pop();
|
|
let newUrl = `${pathParts.join('/')}${extension}/${idPart}`;
|
|
|
|
if (params) {
|
|
newUrl += `?${params}`;
|
|
}
|
|
|
|
return newUrl;
|
|
}
|