Skip to content
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
3 changes: 2 additions & 1 deletion web/src/polaris/service/detail/instance/getColumns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import { checkGlobalRegistry, isReadOnly } from '../../utils'
import { disableDeleteTip } from '../../getColumns'
export const SourcePolarisIpKey = 'internal-sync-local-registry-host'
export const getSourcePolairisIp = x => {
const hasSyncGlobal = Object.entries(x.metadata).find(([key]) => key === SourcePolarisIpKey)
// metadata 可能缺失(开源版 server),必须判空
const hasSyncGlobal = Object.entries(x.metadata ?? {}).find(([key]) => key === SourcePolarisIpKey)
return hasSyncGlobal?.[1]
}
export default ({ duck: { creators, selector }, store }: DuckCmpProps<ServiceInstanceDuck>): Column<Instance>[] => [
Expand Down
5 changes: 4 additions & 1 deletion web/src/polaris/service/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ export const showAllLabels = labels => {
}
export const InternalSyncKey = 'internal-sync-from-local-registry'
export const checkGlobalRegistry = x => {
const hasSyncGlobal = Object.entries(x.metadata).find(([key, value]) => key === InternalSyncKey && value === 'true')
// 开源版 polaris-server 不返回 namespace/service 的 metadata 字段,必须判空,否则整页崩溃
const hasSyncGlobal = Object.entries(x.metadata ?? {}).find(
([key, value]) => key === InternalSyncKey && value === 'true',
)
return !!hasSyncGlobal
}