Skip to content

Commit

Permalink
Merge pull request #61 from xp-bot/development
Browse files Browse the repository at this point in the history
feat(no-ref): add new incident status (#60)
  • Loading branch information
ConnysCode authored Oct 26, 2023
2 parents 8d343fb + 586b8f1 commit 3696140
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 17 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
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 3696140

Please sign in to comment.