Skip to content

Commit

Permalink
feat: [UIE-8372] - database migration event notification (#11590)
Browse files Browse the repository at this point in the history
* feat: [UIE-8372] - database migration event notification

* Added changeset: new Database status for migration event

* Added changeset: Database status display and new event notification for database migration
  • Loading branch information
mpolotsk-akamai authored Feb 3, 2025
1 parent 461f5ef commit 17185cc
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 1 deletion.
5 changes: 5 additions & 0 deletions packages/api-v4/.changeset/pr-11590-added-1738256458071.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/api-v4": Added
---

New database statuses for database_migration event ([#11590](https://github.com/linode/manager/pull/11590))
1 change: 1 addition & 0 deletions packages/api-v4/src/account/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ export const EventActionKeys = [
'database_scale',
'database_update_failed',
'database_update',
'database_migrate',
'database_upgrade',
'disk_create',
'disk_delete',
Expand Down
2 changes: 2 additions & 0 deletions packages/api-v4/src/databases/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export type DatabaseStatus =
| 'active'
| 'degraded'
| 'failed'
| 'migrating'
| 'migrated'
| 'provisioning'
| 'resizing'
| 'restoring'
Expand Down
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-11590-added-1738256866553.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Added
---

Database status display and event notifications for database migration ([#11590](https://github.com/linode/manager/pull/11590))
2 changes: 2 additions & 0 deletions packages/manager/src/factories/databases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export const possibleStatuses: DatabaseStatus[] = [
'active',
'degraded',
'failed',
'migrating',
'migrated',
'provisioning',
'resizing',
'restoring',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export const databaseStatusMap: Record<DatabaseStatus, Status> = {
active: 'active',
degraded: 'inactive',
failed: 'error',
migrated: 'inactive',
migrating: 'other',
provisioning: 'other',
resizing: 'other',
restoring: 'other',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ export const DatabaseRow = ({
const formattedPlan = plan && formatStorageUnits(plan.label);
const actualRegion = regions?.find((r) => r.id === region);
const isLinkInactive =
status === 'suspended' || status === 'suspending' || status === 'resuming';
status === 'suspended' ||
status === 'suspending' ||
status === 'resuming' ||
status === 'migrated';
const { isDatabasesV2GA } = useIsDatabasesEnabled();

const configuration =
Expand Down
14 changes: 14 additions & 0 deletions packages/manager/src/features/Events/factories/database.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,20 @@ export const database: PartialEventMap<'database'> = {
</>
),
},
database_migrate: {
finished: (e) => (
<>
Database <EventLink event={e} to="entity" /> migration{' '}
<strong>completed</strong>.
</>
),
started: (e) => (
<>
Database <EventLink event={e} to="entity" /> migration{' '}
<strong>in progress</strong>.
</>
),
},
database_resize: {
failed: (e) => (
<>
Expand Down
14 changes: 14 additions & 0 deletions packages/manager/src/mocks/serverHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1705,6 +1705,18 @@ export const handlers = [
message: 'Low disk space.',
status: 'notification',
});
const dbMigrationEvents = eventFactory.buildList(1, {
action: 'database_migrate',
entity: { id: 11, label: 'database-11', type: 'database' },
message: 'Database migration started.',
status: 'started',
});
const dbMigrationFinishedEvents = eventFactory.buildList(1, {
action: 'database_migrate',
entity: { id: 11, label: 'database-11', type: 'database' },
message: 'Database migration finished.',
status: 'finished',
});
const oldEvents = eventFactory.buildList(20, {
action: 'account_update',
percent_complete: 100,
Expand Down Expand Up @@ -1745,6 +1757,8 @@ export const handlers = [
return HttpResponse.json(
makeResourcePage([
...events,
...dbMigrationEvents,
...dbMigrationFinishedEvents,
...dbEvents,
...placementGroupAssignedEvent,
...placementGroupCreateEvent,
Expand Down

0 comments on commit 17185cc

Please sign in to comment.