Skip to content

Commit ba63f0d

Browse files
authored
Merge pull request #141 from PRO-Robotech/feature/dev
fix ns col while same table type resource change | labels edit while …
2 parents b06f0da + d523ea7 commit ba63f0d

File tree

5 files changed

+26
-13
lines changed

5 files changed

+26
-13
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"@ant-design/icons": "5.6.0",
2121
"@monaco-editor/react": "4.6.0",
2222
"@originjs/vite-plugin-federation": "1.3.6",
23-
"@prorobotech/openapi-k8s-toolkit": "0.0.1-alpha.132",
23+
"@prorobotech/openapi-k8s-toolkit": "0.0.1-alpha.133",
2424
"@readme/openapi-parser": "4.0.0",
2525
"@reduxjs/toolkit": "2.2.5",
2626
"@tanstack/react-query": "5.62.2",

src/components/molecules/TableApiBuiltin/TableApiBuiltin.tsx

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ export const TableApiBuiltin: FC<TTableApiBuiltinProps> = ({
7373
const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([])
7474
const [selectedRowsData, setSelectedRowsData] = useState<{ name: string; endpoint: string }[]>([])
7575
const [isNamespaced, setIsNamespaced] = useState<boolean>()
76+
const [isNamespacedLoading, setIsNamespacedLoading] = useState<boolean>()
7677

7778
const [height, setHeight] = useState(0)
7879

@@ -99,27 +100,36 @@ export const TableApiBuiltin: FC<TTableApiBuiltinProps> = ({
99100
}, [])
100101

101102
useEffect(() => {
103+
setIsNamespacedLoading(true)
102104
if (resourceType === 'builtin') {
103105
checkIfBuiltInInstanceNamespaceScoped({
104106
typeName,
105107
clusterName: cluster,
106-
}).then(({ isNamespaceScoped }) => {
107-
if (isNamespaceScoped) {
108-
setIsNamespaced(isNamespaceScoped)
109-
}
110108
})
109+
.then(({ isNamespaceScoped }) => {
110+
if (isNamespaceScoped) {
111+
setIsNamespaced(isNamespaceScoped)
112+
} else {
113+
setIsNamespaced(false)
114+
}
115+
})
116+
.finally(() => setIsNamespacedLoading(false))
111117
}
112118
if (resourceType === 'api' && apiGroup && apiVersion) {
113119
checkIfApiInstanceNamespaceScoped({
114120
apiGroup,
115121
apiVersion,
116122
typeName,
117123
clusterName: cluster,
118-
}).then(({ isNamespaceScoped }) => {
119-
if (isNamespaceScoped) {
120-
setIsNamespaced(true)
121-
}
122124
})
125+
.then(({ isNamespaceScoped }) => {
126+
if (isNamespaceScoped) {
127+
setIsNamespaced(true)
128+
} else {
129+
setIsNamespaced(false)
130+
}
131+
})
132+
.finally(() => setIsNamespacedLoading(false))
123133
}
124134
}, [resourceType, cluster, typeName, apiGroup, apiVersion])
125135

@@ -221,6 +231,7 @@ export const TableApiBuiltin: FC<TTableApiBuiltinProps> = ({
221231
baseprefix={inside ? `${baseprefix}/inside` : baseprefix}
222232
dataItems={getDataItems({ resourceType, dataBuiltin, dataApi })}
223233
isNamespaced={isNamespaced}
234+
isNamespacedLoading={isNamespacedLoading}
224235
dataForControls={{
225236
cluster,
226237
syntheticProject: params.syntheticProject,

src/pages/TableApiPage/TableApiPage.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ export const TableApiPage: FC<TTableApiPageProps> = ({ forcedTheme, inside }) =>
8585
apiGroup={apiGroup}
8686
apiVersion={apiVersion}
8787
typeName={typeName}
88+
key={`${apiGroup}-${apiVersion}-${namespace}-${typeName}`}
8889
limit={searchParams.get('limit')}
8990
inside={inside}
9091
customizationIdPrefix={tableCustomizationIdPrefix}

src/pages/TableBuiltinPage/TableBuiltinPage.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export const TableBuiltinPage: FC<TTableBuiltinPageProps> = ({ forcedTheme, insi
6969
<TableApiBuiltin
7070
resourceType="builtin"
7171
apiVersion="v1"
72+
key={`${namespace}-${typeName}`}
7273
namespace={namespace}
7374
typeName={typeName}
7475
limit={searchParams.get('limit')}

0 commit comments

Comments
 (0)