Skip to content

Commit

Permalink
feat(no-ref): add new incident status (#60)
Browse files Browse the repository at this point in the history
* 2.0.21

* 2.0.22

* feat(status): shard and incident behaviour updates

---------

Co-authored-by: ConnysCode <[email protected]>
  • Loading branch information
ConnysCode and ConnysCode authored Oct 26, 2023
1 parent 697df53 commit 586b8f1
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 20 deletions.
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

0 comments on commit 586b8f1

Please sign in to comment.