diff --git a/src/hooks/useCommonConnectionStatus.ts b/src/hooks/useCommonConnectionStatus.ts index cf4cc64e2..31c5854e4 100644 --- a/src/hooks/useCommonConnectionStatus.ts +++ b/src/hooks/useCommonConnectionStatus.ts @@ -2,27 +2,27 @@ import useI18nTl from '@/hooks/useI18nTl' import { ConnectionStatus, NodeStatusClass } from '@/types/enum' export default (): { - getStatusClass: (status: ConnectionStatus) => NodeStatusClass - getStatusLabel: (status: ConnectionStatus) => string + getStatusClass: (status?: ConnectionStatus) => NodeStatusClass + getStatusLabel: (status?: ConnectionStatus) => string } => { const { tl } = useI18nTl('Base') - const getStatusClass = (status: ConnectionStatus) => { + const getStatusClass = (status?: ConnectionStatus) => { const map = { [ConnectionStatus.Connected]: NodeStatusClass.Success, [ConnectionStatus.Disconnected]: NodeStatusClass.Danger, [ConnectionStatus.Connecting]: NodeStatusClass.Warning, } - return map[status] || NodeStatusClass.Danger + return status ? map[status] || NodeStatusClass.Danger : NodeStatusClass.Danger } - const getStatusLabel = (status: ConnectionStatus) => { + const getStatusLabel = (status?: ConnectionStatus) => { const statusLabelMap = { [ConnectionStatus.Connected]: tl('connected'), [ConnectionStatus.Disconnected]: tl('disconnected'), [ConnectionStatus.Connecting]: tl('connecting'), } - return statusLabelMap[status] || tl('disconnected') + return status ? statusLabelMap[status] || tl('disconnected') : tl('disconnected') } return { getStatusClass, diff --git a/src/types/common.d.ts b/src/types/common.d.ts index 782288fcc..41a841d25 100644 --- a/src/types/common.d.ts +++ b/src/types/common.d.ts @@ -41,7 +41,7 @@ export type StatusDetailOfEachNode = Array<{ export interface TargetStatusWithDetail { statusClass: NodeStatusClass statusLabel: string - details: StatusDetailOfEachNode + details?: StatusDetailOfEachNode } export type OptionList = Array<{ diff --git a/src/views/APIKey/APIKey.vue b/src/views/APIKey/APIKey.vue index ee2a4cf17..5ebd7d0d2 100644 --- a/src/views/APIKey/APIKey.vue +++ b/src/views/APIKey/APIKey.vue @@ -18,13 +18,6 @@ - - - - - - -