fixed testserver status
This commit is contained in:
@@ -94,26 +94,58 @@ module.exports = {
|
|||||||
|
|
||||||
let interval = seconds / 31536000;
|
let interval = seconds / 31536000;
|
||||||
|
|
||||||
|
// Years
|
||||||
if (interval > 1) {
|
if (interval > 1) {
|
||||||
return Math.floor(interval) + ' years';
|
return Math.floor(interval) + ' years';
|
||||||
}
|
}
|
||||||
|
// Months
|
||||||
interval = seconds / 2592000;
|
interval = seconds / 2592000;
|
||||||
if (interval > 1) {
|
if (interval > 1) {
|
||||||
return `${chalk.red(Math.floor(interval) + ' months')}`;
|
return `${chalk.red('WTF!')}`;
|
||||||
}
|
}
|
||||||
|
// Days
|
||||||
interval = seconds / 86400;
|
interval = seconds / 86400;
|
||||||
if (interval > 1) {
|
if (interval > 1) {
|
||||||
const days = Math.floor(interval);
|
const days = Math.floor(interval);
|
||||||
return `${chalk[days >= 14 ? 'yellow' : 'green'](days + ' days')}`;
|
let color = 'green';
|
||||||
|
|
||||||
|
if (days >= 2) {
|
||||||
|
if (days <= 12) {
|
||||||
|
// Gradient from yellow (#FFFF00) to dark red (#8B0000) over 10 days (days 2-12)
|
||||||
|
const gradientColors = [
|
||||||
|
'#FFFF00', // 2 days - yellow
|
||||||
|
'#FFE600', // 3 days
|
||||||
|
'#FFCC00', // 4 days
|
||||||
|
'#FFB300', // 5 days
|
||||||
|
'#FF9900', // 6 days
|
||||||
|
'#FF8000', // 7 days
|
||||||
|
'#FF6600', // 8 days
|
||||||
|
'#FF4D00', // 9 days
|
||||||
|
'#FF3300', // 10 days
|
||||||
|
'#CC2900', // 11 days
|
||||||
|
'#8B0000', // 12 days - dark red
|
||||||
|
];
|
||||||
|
const colorIndex = Math.min(days - 2, gradientColors.length - 1);
|
||||||
|
color = gradientColors[colorIndex];
|
||||||
|
} else {
|
||||||
|
color = '#8B0000'; // dark red for 12+ days
|
||||||
|
}
|
||||||
|
return `${chalk.hex(color)(days + ' days')}`;
|
||||||
|
} else {
|
||||||
|
return `${chalk.green(days + ' days')}`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// Hours
|
||||||
interval = seconds / 3600;
|
interval = seconds / 3600;
|
||||||
if (interval > 1) {
|
if (interval > 1) {
|
||||||
return `${chalk.green(Math.floor(interval) + ' hours')}`;
|
return `${chalk.green(Math.floor(interval) + ' hours')}`;
|
||||||
}
|
}
|
||||||
|
// Minutes
|
||||||
interval = seconds / 60;
|
interval = seconds / 60;
|
||||||
if (interval > 1) {
|
if (interval > 1) {
|
||||||
return `${chalk.green(Math.floor(interval) + ' minutes')}`;
|
return `${chalk.green(Math.floor(interval) + ' minutes')}`;
|
||||||
}
|
}
|
||||||
|
// Seconds
|
||||||
return Math.floor(seconds) + ' seconds';
|
return Math.floor(seconds) + ' seconds';
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -124,8 +156,8 @@ module.exports = {
|
|||||||
'stack',
|
'stack',
|
||||||
'branch',
|
'branch',
|
||||||
'issue status',
|
'issue status',
|
||||||
'issue updated',
|
// 'issue updated',
|
||||||
'stack updated',
|
'last commit',
|
||||||
// 'url'
|
// 'url'
|
||||||
])
|
])
|
||||||
.line('-');
|
.line('-');
|
||||||
@@ -149,6 +181,13 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
const issueStatuses = await Promise.all(issueStatusPromises);
|
const issueStatuses = await Promise.all(issueStatusPromises);
|
||||||
|
|
||||||
|
// Sort the testStacks list on number. They are named like photowall-test-XX where XX is the number.
|
||||||
|
testStacks.sort((a, b) => {
|
||||||
|
const aNumber = parseInt(a.name.split('photowall-test-')[1]);
|
||||||
|
const bNumber = parseInt(b.name.split('photowall-test-')[1]);
|
||||||
|
return aNumber - bNumber;
|
||||||
|
});
|
||||||
|
|
||||||
for (const stack of testStacks) {
|
for (const stack of testStacks) {
|
||||||
const regex = /^(\d+)/;
|
const regex = /^(\d+)/;
|
||||||
const match = stack.branch.match(regex);
|
const match = stack.branch.match(regex);
|
||||||
@@ -160,17 +199,17 @@ module.exports = {
|
|||||||
stack.name,
|
stack.name,
|
||||||
ellipsis(stack.branch, 24),
|
ellipsis(stack.branch, 24),
|
||||||
printIssueStatus(issueStatuses, branchIssueNumber),
|
printIssueStatus(issueStatuses, branchIssueNumber),
|
||||||
issueStatuses.find(
|
// issueStatuses.find(
|
||||||
(issueStatus) => issueStatus.issue === branchIssueNumber,
|
// (issueStatus) => issueStatus.issue === branchIssueNumber,
|
||||||
)
|
// )
|
||||||
? timeSince(
|
// ? timeSince(
|
||||||
new Date(
|
// new Date(
|
||||||
issueStatuses.find(
|
// issueStatuses.find(
|
||||||
(issueStatus) => issueStatus.issue === branchIssueNumber,
|
// (issueStatus) => issueStatus.issue === branchIssueNumber,
|
||||||
).issueUpdated,
|
// ).issueUpdated,
|
||||||
).getTime(),
|
// ).getTime(),
|
||||||
)
|
// )
|
||||||
: '-',
|
// : '-',
|
||||||
!isNaN(t.getTime())
|
!isNaN(t.getTime())
|
||||||
? timeSince(t.getTime())
|
? timeSince(t.getTime())
|
||||||
: timeSince(new Date(stack.created).getTime()),
|
: timeSince(new Date(stack.created).getTime()),
|
||||||
|
|||||||
Reference in New Issue
Block a user