Fix status for failed stacks
This commit is contained in:
@@ -9,6 +9,7 @@ type Stack = {
|
||||
drift_status: string;
|
||||
branch: string;
|
||||
updated: string;
|
||||
created: string;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
@@ -32,7 +33,8 @@ module.exports = {
|
||||
'UPDATE_IN_PROGRESS',
|
||||
'UPDATE_FAILED',
|
||||
'CREATE_FAILED',
|
||||
'CREATE_IN_PROGRESS'
|
||||
'CREATE_IN_PROGRESS',
|
||||
'ROLLBACK_COMPLETE',
|
||||
].includes(item.StackStatus)
|
||||
) {
|
||||
try {
|
||||
@@ -55,15 +57,17 @@ module.exports = {
|
||||
status: item.StackStatus,
|
||||
drift_status: item.DriftInformation.StackDriftStatus,
|
||||
branch: branch,
|
||||
updated: lastUpdated
|
||||
updated: lastUpdated,
|
||||
created: item.CreationTime,
|
||||
};
|
||||
} catch (e) {
|
||||
return {
|
||||
name: item.StackName,
|
||||
status: 'NO_STATUS',
|
||||
status: item.StackStatus,
|
||||
drift_status: '',
|
||||
branch: '',
|
||||
updated: ''
|
||||
updated: '',
|
||||
created: item.CreationTime,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -75,17 +79,18 @@ module.exports = {
|
||||
|
||||
const status = (status: string) => {
|
||||
switch (status) {
|
||||
case 'NO_STATUS':
|
||||
return `(${chalk.red.bold('?')})`;
|
||||
case 'UPDATE_FAILED':
|
||||
case 'CREATE_FAILED':
|
||||
return `(${chalk.red.bold('FAILED')})`;
|
||||
case 'ROLLBACK_COMPLETE':
|
||||
return `(${chalk.red('FAILED')})`;
|
||||
case 'UPDATE_IN_PROGRESS':
|
||||
case 'CREATE_IN_PROGRESS':
|
||||
return `(${chalk.yellow.bold('IN PROGRESS')})`;
|
||||
return `(${chalk.yellow('IN PROGRESS')})`;
|
||||
case 'UPDATE_COMPLETE':
|
||||
case 'CREATE_COMPLETE':
|
||||
return `(${chalk.greenBright('OK')})`;
|
||||
default:
|
||||
return `(${chalk.red.bold('?')})`;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -148,7 +153,7 @@ module.exports = {
|
||||
status(stack.status),
|
||||
stack.name,
|
||||
ellipsis(stack.branch, 24),
|
||||
timeSince(t.getTime()),
|
||||
!isNaN(t.getTime()) ? timeSince(t.getTime()) : timeSince((new Date(stack.created)).getTime()),
|
||||
stackUrl(stack.name)
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user