Skip to content

Commit

Permalink
fix: 修复问题
Browse files Browse the repository at this point in the history
  • Loading branch information
tingfuyeh committed Nov 27, 2024
1 parent 6a9e0ae commit aeb2fa9
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ export default (
header: '状态',
render: x => (x.enable ? <Text theme='success'>已启用</Text> : <Text theme='danger'>未启用</Text>),
},
{
key: 'priority',
header: '优先级',
render: x => x.priority,
},
{
key: 'description',
header: '描述',
Expand Down
2 changes: 1 addition & 1 deletion web/src/polaris/namespace/operation/CreateDuck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export default class CreateDuck extends FormDialog {
form.creators.setValues({
...data,
visibilityMode,
sync_to_global_registry: false,
sync_to_global_registry: data.sync_to_global_registry ?? false,
}),
)
// TODO 表单弹窗逻辑,在弹窗关闭后自动cancel
Expand Down
8 changes: 4 additions & 4 deletions web/src/polaris/service/Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { selectable, expandable, filterable } from 'tea-component/lib/table/addo
import insertCSS from '../common/helpers/insertCSS'
import csvColumns from './csvColumns'
import { enableNearbyString } from './operation/CreateDuck'
import { isReadOnly, showAllLabels } from './utils'
import { checkGlobalRegistry, isReadOnly, showAllLabels } from './utils'
import MetadataSelectPanel from '../common/components/MetadataSelectPanel'
import { replaceTags } from '../configuration/utils'
import { useServerConfig } from '../common/util/serverConfig'
Expand Down Expand Up @@ -199,17 +199,17 @@ export default function ServicePage(props: DuckCmpProps<ServicePageDuck>) {
value: selection,
onChange: handlers.select,
rowSelectable: (rowKey, { record }) =>
!isReadOnly(record.namespace) && record.editable && !record.sync_to_global_registry,
!isReadOnly(record.namespace) && record.editable && !checkGlobalRegistry(record),
render: (element, { record }) => {
if (isReadOnly(record.namespace) || !record.editable || record.sync_to_global_registry) {
if (isReadOnly(record.namespace) || !record.editable || checkGlobalRegistry(record)) {
return (
<Bubble
content={
isReadOnly(record.namespace)
? '该命名空间为只读的'
: !record.editable
? '无权限'
: record.sync_to_global_registry
: checkGlobalRegistry(record)
? disableDeleteTip
: '编辑'
}
Expand Down
2 changes: 1 addition & 1 deletion web/src/polaris/service/detail/instance/Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ export default function ServiceInstancePage(props: DuckCmpProps<ServicePageDuck>
onChange: handlers.select,
rowSelectable: (rowKey, { record }) => !isReadOnly(namespace) && editable && !checkGlobalRegistry(record),
render: (element, { record }) => {
if (isReadOnly(namespace) || !editable || !checkGlobalRegistry(record)) {
if (isReadOnly(namespace) || !editable || checkGlobalRegistry(record)) {
return (
<Bubble
content={
Expand Down
6 changes: 3 additions & 3 deletions web/src/polaris/service/detail/instance/getColumns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { checkGlobalRegistry, isReadOnly } from '../../utils'
import { disableDeleteTip } from '../../getColumns'

export const getSourcePolairisIp = x => {
const hasSyncGlobal = Object.entries(x.metadata).find(([key]) => key === 'MetadataKeySyncLocalRegistryHost')
const hasSyncGlobal = Object.entries(x.metadata).find(([key]) => key === 'internal-sync-local-registry-host')
return hasSyncGlobal?.[1]
}
export default ({ duck: { creators, selector }, store }: DuckCmpProps<ServiceInstanceDuck>): Column<Instance>[] => [
Expand All @@ -30,12 +30,12 @@ export default ({ duck: { creators, selector }, store }: DuckCmpProps<ServiceIns
{
key: 'host',
header: '实例IP',
render: x => <Text overflow>{getSourcePolairisIp(x) || '-'}</Text>,
render: x => <Text overflow>{x.host}</Text>,
},
{
key: 'sourceIp',
header: '来源北极星IP',
render: x => <Text overflow>{x.host}</Text>,
render: x => <Text overflow>{getSourcePolairisIp(x) || '-'}</Text>,
},
{
key: 'port',
Expand Down
2 changes: 2 additions & 0 deletions web/src/polaris/service/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export interface CreateServicesParams {
user_ids?: string[]
group_ids?: string[]
export_to?: string[]
sync_to_global_registry?: boolean
}

export interface ModifyServicesParams {
Expand All @@ -50,6 +51,7 @@ export interface ModifyServicesParams {
remove_user_ids?: string[]
remove_group_ids?: string[]
export_to?: string[]
sync_to_global_registry?: boolean
}
export interface DescribeNamespacesResult {
amount: number
Expand Down
2 changes: 2 additions & 0 deletions web/src/polaris/service/operation/CreateDuck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export default class CreateDuck extends FormDialog {
remove_user_ids: removeUserIds,
remove_group_ids: removeGroupIds,
export_to: values.export_to,
sync_to_global_registry: values.sync_to_global_registry,
},
]),
)
Expand All @@ -122,6 +123,7 @@ export default class CreateDuck extends FormDialog {
user_ids: userIds,
group_ids: groupIds,
export_to: values.export_to,
sync_to_global_registry: values.sync_to_global_registry,
},
]),
)
Expand Down

0 comments on commit aeb2fa9

Please sign in to comment.