Skip to content

[feat] Enhance Event Status Handling with Planned and Cancelled States; Refactor UI Components for Consistent Status Display #162

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"test": "vitest"
},
"dependencies": {
"@fluentui/react-components": "^9.63.0",
"@fluentui/react-components": "^9.64.0",
"@telekom/scale-components": "3.0.0-beta.155",
"@telekom/scale-components-react": "3.0.0-beta.155",
"ahooks": "^3.8.4",
Expand All @@ -31,12 +31,12 @@
"@farmfe/core": "^1.7.5",
"@farmfe/js-plugin-postcss": "^1.12.0",
"@farmfe/plugin-react": "^1.2.6",
"@tailwindcss/postcss": "^4.1.6",
"@tailwindcss/postcss": "^4.1.7",
"@testing-library/react": "^16.3.0",
"@types/lodash": "^4.17.16",
"@types/node": "^22.15.17",
"@types/react": "^19.1.3",
"@types/react-dom": "^19.1.3",
"@types/node": "^22.15.18",
"@types/react": "^19.1.4",
"@types/react-dom": "^19.1.5",
"@types/react-helmet": "^6.1.11",
"autoprefixer": "^10.4.21",
"core-js": "^3.42.0",
Expand All @@ -46,7 +46,7 @@
"react-refresh": "^0.17.0",
"tailwindcss": "3.4.17",
"tailwindcss-scoped-preflight": "^3.4.12",
"typescript-eslint": "^8.32.0"
"typescript-eslint": "^8.32.1"
},
"packageManager": "pnpm@10.10.0"
"packageManager": "pnpm@10.11.0"
}
1,834 changes: 912 additions & 922 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion src/Components/Event/Enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ export enum EventStatus {
Observing = "Observing",
Resolved = "Resolved",

Planned = "Planned",
Modified = "Modified",
InProgress = "InProgress",
Completed = "Completed",
Cancelled = "Cancelled",

Reopened = "Reopened",
Changed = "Changed",
Expand All @@ -74,7 +76,7 @@ export enum EventStatus {
* @version 0.1.0
*/
export function IsOpenStatus(status: EventStatus): boolean {
return ![EventStatus.Completed, EventStatus.Resolved].includes(status);
return ![EventStatus.Completed, EventStatus.Resolved, EventStatus.Cancelled].includes(status);
}

/**
Expand Down Expand Up @@ -102,5 +104,9 @@ export function GetStatusString(status: EventStatus): string {
return StatusEnum.Reopened;
case EventStatus.Changed:
return StatusEnum.Changed;
case EventStatus.Planned:
return StatusEnum.Planned;
case EventStatus.Cancelled:
return StatusEnum.Cancelled;
}
}
14 changes: 6 additions & 8 deletions src/Components/Event/EventCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@ export function EventCard({ Event }: { Event: Models.IEvent }) {
Impact Type:
</label>

{Event.Type !== EventType.Maintenance &&
<label className="text-xl font-medium text-slate-600 whitespace-nowrap">
Current Status:
</label>}
<label className="text-xl font-medium text-slate-600 whitespace-nowrap">
Current Status:
</label>

<label className="text-xl font-medium text-slate-600">
Start At:
Expand All @@ -73,10 +72,9 @@ export function EventCard({ Event }: { Event: Models.IEvent }) {
{Event.Type}
</label>

{Event.Type !== EventType.Maintenance &&
<label className="text-xl font-medium text-slate-700">
{Event.Status}
</label>}
<label className="text-xl font-medium text-slate-700">
{Event.Status}
</label>

<label className="text-xl font-medium text-slate-700">
{dayjs(Event.Start).tz(Dic.TZ).format(Dic.TimeTZ)}
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Event/EventEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export function EventEditor({ Event }: { Event: Models.IEvent }) {
{Object.values(EventStatus)
.slice(
State.type === EventType.Maintenance ? 4 : 0,
State.type === EventType.Maintenance ? 7 : 4
State.type === EventType.Maintenance ? 9 : 4
).map((status, i) =>
<ScaleDropdownSelectItem value={status} key={i}>
{status}
Expand Down
2 changes: 2 additions & 0 deletions src/Services/Status.Entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,6 @@ export const enum StatusEnum {
Resolved = "resolved",
Scheduled = "scheduled",
System = "SYSTEM",
Planned = "planned",
Cancelled = "cancelled",
}
6 changes: 5 additions & 1 deletion src/Services/Status.Trans.V2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export function TransformerV2({ Components, Events }: { Components: StatusEntity
Title: event.title,
Start: dayjs(event.start_date).toDate(),
Type: type,
Status: type === EventType.Maintenance ? EventStatus.Modified : EventStatus.Analysing,
Status: type === EventType.Maintenance ? EventStatus.Planned : EventStatus.Analysing,
Histories: new Set(),
RegionServices: new Set(),
};
Expand Down Expand Up @@ -186,12 +186,16 @@ export function TransformerV2({ Components, Events }: { Components: StatusEntity
break;

case StatusEnum.Scheduled:
case StatusEnum.Planned:
return EventStatus.Planned;
case StatusEnum.Modified:
return EventStatus.Modified;
case StatusEnum.InProgress:
return EventStatus.InProgress;
case StatusEnum.Completed:
return EventStatus.Completed;
case StatusEnum.Cancelled:
return EventStatus.Cancelled;

case StatusEnum.Changed:
case StatusEnum.ImpactChanged:
Expand Down