diff --git a/src/apis/model/biz/nvr/index.ts b/src/apis/model/biz/nvr/index.ts index 5db1448..7ff1a1f 100644 --- a/src/apis/model/biz/nvr/index.ts +++ b/src/apis/model/biz/nvr/index.ts @@ -1,3 +1,4 @@ export * from './client-channel'; +export * from './media-server-status'; export * from './record-info'; export * from './record-item'; diff --git a/src/apis/model/biz/nvr/media-server-status.ts b/src/apis/model/biz/nvr/media-server-status.ts new file mode 100644 index 0000000..a6fc764 --- /dev/null +++ b/src/apis/model/biz/nvr/media-server-status.ts @@ -0,0 +1,5 @@ +export interface MediaServerStatus { + id: string; + ip: string; + online: boolean; +} diff --git a/src/apis/request/biz/other/index.ts b/src/apis/request/biz/other/index.ts index 7ac828d..0d4f721 100644 --- a/src/apis/request/biz/other/index.ts +++ b/src/apis/request/biz/other/index.ts @@ -1,2 +1,3 @@ export * from './ndm-security-box'; +export * from './ndm-service-available'; export * from './ndm-switch'; diff --git a/src/apis/request/biz/other/ndm-service-available.ts b/src/apis/request/biz/other/ndm-service-available.ts new file mode 100644 index 0000000..75191d1 --- /dev/null +++ b/src/apis/request/biz/other/ndm-service-available.ts @@ -0,0 +1,25 @@ +import { ndmClient, userClient, type MediaServerStatus, type Station } from '@/apis'; + +export const isMediaServerAliveApi = async (options?: { stationCode?: Station['code']; signal?: AbortSignal }) => { + const { stationCode, signal } = options ?? {}; + const client = stationCode ? ndmClient : userClient; + const prefix = stationCode ? `/${stationCode}` : ''; + const endpoint = `${prefix}/api/ndm/ndmServiceAvailable/mediaServer/isAlive`; + const resp = await client.get(endpoint, { signal }); + const [err, data] = resp; + if (err) throw err; + if (!data) throw new Error(`${data}`); + return data; +}; + +export const isSipServerAliveApi = async (options?: { stationCode?: Station['code']; signal?: AbortSignal }) => { + const { stationCode, signal } = options ?? {}; + const client = stationCode ? ndmClient : userClient; + const prefix = stationCode ? `/${stationCode}` : ''; + const endpoint = `${prefix}/api/ndm/ndmServiceAvailable/sipServer/isAlive`; + const resp = await client.get(endpoint, { signal }); + const [err, data] = resp; + if (err) throw err; + if (data === null) throw new Error(`${data}`); + return data; +}; diff --git a/src/components/device/device-card/ndm-server/index.ts b/src/components/device/device-card/ndm-server/index.ts index 5ac4563..67c2711 100644 --- a/src/components/device/device-card/ndm-server/index.ts +++ b/src/components/device/device-card/ndm-server/index.ts @@ -1,6 +1,7 @@ +import ServerAlive from './server-alive.vue'; import ServerCard from './server-card.vue'; import ServerCurrentDiag from './server-current-diag.vue'; import ServerHistoryDiag from './server-history-diag.vue'; import ServerUpdate from './server-update.vue'; -export { ServerCard, ServerCurrentDiag, ServerHistoryDiag, ServerUpdate }; +export { ServerAlive, ServerCard, ServerCurrentDiag, ServerHistoryDiag, ServerUpdate }; diff --git a/src/components/device/device-card/ndm-server/server-alive.vue b/src/components/device/device-card/ndm-server/server-alive.vue new file mode 100644 index 0000000..0840f39 --- /dev/null +++ b/src/components/device/device-card/ndm-server/server-alive.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/src/components/device/device-card/ndm-server/server-current-diag.vue b/src/components/device/device-card/ndm-server/server-current-diag.vue index 0767d56..4b80806 100644 --- a/src/components/device/device-card/ndm-server/server-current-diag.vue +++ b/src/components/device/device-card/ndm-server/server-current-diag.vue @@ -1,6 +1,6 @@