From ddc420a603c7a3a1e09ed176db550765882fff82 Mon Sep 17 00:00:00 2001 From: Noble Mittal Date: Mon, 4 Nov 2024 20:10:41 +0530 Subject: [PATCH] refac: Move error_dialog to common components Signed-off-by: Noble Mittal --- .../createWorkflow => dialog}/ErrorDialog.tsx | 4 +- .../components/routes/SchemaMigrations.tsx | 64 +++++++++++++------ .../CreateSchemaMigration.module.scss | 10 ++- .../CreateSchemaMigration.tsx | 8 +-- .../createWorkflow/CreateMaterialize.tsx | 2 +- .../createWorkflow/CreateMoveTables.tsx | 2 +- .../routes/createWorkflow/CreateReshard.tsx | 2 +- 7 files changed, 60 insertions(+), 32 deletions(-) rename web/vtadmin/src/components/{routes/createWorkflow => dialog}/ErrorDialog.tsx (94%) diff --git a/web/vtadmin/src/components/routes/createWorkflow/ErrorDialog.tsx b/web/vtadmin/src/components/dialog/ErrorDialog.tsx similarity index 94% rename from web/vtadmin/src/components/routes/createWorkflow/ErrorDialog.tsx rename to web/vtadmin/src/components/dialog/ErrorDialog.tsx index 25ac5dedb0b..087876e4cd2 100644 --- a/web/vtadmin/src/components/routes/createWorkflow/ErrorDialog.tsx +++ b/web/vtadmin/src/components/dialog/ErrorDialog.tsx @@ -14,8 +14,8 @@ * limitations under the License. */ import React from 'react'; -import Dialog from '../../dialog/Dialog'; -import { Icon, Icons } from '../../Icon'; +import Dialog from './Dialog'; +import { Icon, Icons } from '../Icon'; export interface ErrorDialogProps { errorTitle?: string; diff --git a/web/vtadmin/src/components/routes/SchemaMigrations.tsx b/web/vtadmin/src/components/routes/SchemaMigrations.tsx index f60b29ef09e..7ad7482be06 100644 --- a/web/vtadmin/src/components/routes/SchemaMigrations.tsx +++ b/web/vtadmin/src/components/routes/SchemaMigrations.tsx @@ -29,8 +29,10 @@ import { formatDateTime } from '../../util/time'; import { ReadOnlyGate } from '../ReadOnlyGate'; import { formatSchemaMigrationStatus } from '../../util/schemaMigrations'; import { Link } from 'react-router-dom'; +import { TabletLink } from '../links/TabletLink'; +import { formatAlias } from '../../util/tablets'; -const COLUMNS = ['UUID', 'Status', 'Shard', 'Started At', 'Added At']; +const COLUMNS = ['UUID', 'Status', 'DDL Action', 'Timestamps', 'Stage', 'Progress']; export const SchemaMigrations = () => { useDocumentTitle('Schema Migrations'); @@ -64,39 +66,59 @@ export const SchemaMigrations = () => { if (!migrationInfo) return <>; - const shard = selectedKeyspace ? `${selectedKeyspace.keyspace?.name}/${migrationInfo.shard}` : '-'; - return (
{migrationInfo.uuid}
-
- -
{formatSchemaMigrationStatus(migrationInfo)}
-
- - {selectedKeyspace ? ( +
+ Tablet{' '} + + {formatAlias(migrationInfo.tablet)} + +
+
+ Shard{' '} - {shard} + {`${migrationInfo.keyspace}/${migrationInfo.shard}`} - ) : ( - '-' - )} +
-
- {formatDateTime(migrationInfo.started_at?.seconds)} -
+
{formatSchemaMigrationStatus(migrationInfo)}
+ {migrationInfo.ddl_action ? migrationInfo.ddl_action : '-'} -
- {formatDateTime(migrationInfo.added_at?.seconds)} -
+ {migrationInfo.added_at && ( +
+ Added + {formatDateTime(migrationInfo.added_at?.seconds)} +
+ )} + {migrationInfo.requested_at && ( +
+ Requested + {formatDateTime(migrationInfo.requested_at?.seconds)} +
+ )} + {migrationInfo.started_at && ( +
+ Started + {formatDateTime(migrationInfo.started_at?.seconds)} +
+ )} + {migrationInfo.completed_at && ( +
+ Completed + {formatDateTime(migrationInfo.completed_at?.seconds)} +
+ )}
+ {migrationInfo.stage ? migrationInfo.stage : '-'} + {migrationInfo.progress ? `${migrationInfo.progress}%` : '-'} ); }); diff --git a/web/vtadmin/src/components/routes/createSchemaMigration/CreateSchemaMigration.module.scss b/web/vtadmin/src/components/routes/createSchemaMigration/CreateSchemaMigration.module.scss index a23f0a5db26..51f5fdca04e 100644 --- a/web/vtadmin/src/components/routes/createSchemaMigration/CreateSchemaMigration.module.scss +++ b/web/vtadmin/src/components/routes/createSchemaMigration/CreateSchemaMigration.module.scss @@ -1,5 +1,5 @@ /** - * Copyright 2021 The Vitess Authors. + * Copyright 2024 The Vitess Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,8 @@ * limitations under the License. */ .sqlInput { - border: solid 1px var(--colorScaffoldingHighlight); + border: solid 2px var(--colorDisabled); + border-radius: 6px; display: block; font-family: var(--fontFamilyMonospace); line-height: var(--lineHeightBody); @@ -22,3 +23,8 @@ resize: vertical; width: 100%; } + +.sqlInput:focus { + border-color: var(--colorPrimary); + outline: none; +} diff --git a/web/vtadmin/src/components/routes/createSchemaMigration/CreateSchemaMigration.tsx b/web/vtadmin/src/components/routes/createSchemaMigration/CreateSchemaMigration.tsx index 50686faef95..03354694d92 100644 --- a/web/vtadmin/src/components/routes/createSchemaMigration/CreateSchemaMigration.tsx +++ b/web/vtadmin/src/components/routes/createSchemaMigration/CreateSchemaMigration.tsx @@ -29,7 +29,7 @@ import { TextInput } from '../../TextInput'; import { success } from '../../Snackbar'; import { FormError } from '../../forms/FormError'; import { vtadmin } from '../../../proto/vtadmin'; -import ErrorDialog from '../createWorkflow/ErrorDialog'; +import ErrorDialog from '../../dialog/ErrorDialog'; interface FormData { clusterID: string; @@ -142,9 +142,9 @@ export const CreateSchemaMigration = () => { Create Schema Migration Request - +
-
+