Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(no-ref): add new incident status #60

Merged
merged 5 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions components/incident-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const borderColor: { [key: string]: string } = {
Maintenance: "#939cfa",
"Planned Maintenance": "#939cfa",
"Implementing Fix": "#e993e0",
Monitoring: "#f2c94c",
Resolved: "#43B581",
};

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "xp-dashboard",
"version": "2.0.21",
"version": "2.0.22",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down
1 change: 1 addition & 0 deletions page-tabs/user-tabs/user-incidents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ const UserTabIncidents: FC<UserTabIncidentsProps> = () => {
{ id: `Planned Maintenance`, title: `Planned Maintenance` },
{ id: `Investigating`, title: `Investigating` },
{ id: `Implementing Fix`, title: `Implementing Fix` },
{ id: `Monitoring`, title: `Monitoring` },
{ id: `Reverting Patch`, title: `Reverting Patch` },
...(editIncident
? [{ id: `Resolved`, title: `Resolved` }]
Expand Down
50 changes: 33 additions & 17 deletions pages/status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,39 @@ const statusToClass = {

const ShardPanel: FC<{
shard: IIlumAlivePing;
}> = ({ shard }) => (
<div
className={`flex h-full w-full grow items-center justify-center whitespace-nowrap rounded-md border border-input-border p-2 px-3 text-center shadow-md ${
shard.gateway_connected &&
Date.now() - new Date(shard.updated_at).getTime() < 60000
? statusToClass.Stable
: Date.now() - new Date(shard.updated_at).getTime() < 90000
? statusToClass.Unstable
: statusToClass.Offline
}`}
>
{shard.gateway_connected &&
Date.now() - new Date(shard.updated_at).getTime() < 60000
? `Shard ${shard.shard_id} - ${shard.server_count} Servers`
: `Shard ${shard.shard_id} - Offline`}
</div>
);
}> = ({ shard }) => {
const statusClass = () => {
if (!shard.gateway_connected)
return {
title: `Shard ${shard.shard_id} - Disconnected`,
class: statusToClass.Offline,
};
if (Date.now() - new Date(shard.updated_at).getTime() < 90000)
return {
title: `Shard ${shard.shard_id} - ${shard.server_count} Servers`,
class: statusToClass.Stable,
};
if (Date.now() - new Date(shard.updated_at).getTime() < 120000)
return {
title: `Shard ${shard.shard_id} - Unstable`,
class: statusToClass.Unstable,
};
return {
title: `Shard ${shard.shard_id} - Offline`,
class: statusToClass.Offline,
};
};

return (
<div
className={`flex h-full w-full grow items-center justify-center whitespace-nowrap rounded-md border border-input-border p-2 px-3 text-center shadow-md ${
statusClass().class
}`}
>
{statusClass().title}
</div>
);
};

const Status: NextPage<HomeProps> = ({
incidents: ssgIncidents,
Expand Down