Skip to content

Commit a489391

Browse files
authored
refactor(cluster, api): deprecate the knowledge Open API (#116)
1 parent 8999125 commit a489391

File tree

5 files changed

+11
-236
lines changed

5 files changed

+11
-236
lines changed

apps/main/[3]cluster/[1]instances/components/ClusterTable/index.tsx

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@ import {
66
ClusterInfo,
77
ClusterOperationStatus,
88
ClusterStatus,
9-
KnowledgeOfClusterType,
109
PagedResult,
1110
} from '@/api/model'
1211
import { CopyIconButton } from '@/components/CopyToClipboard'
1312
import { resolveRoute } from '@pages-macro'
14-
import { useQueryKnowledge } from '@/api/hooks/knowledge'
1513
import {
1614
invalidateClusterDetail,
1715
invalidateClustersList,
@@ -33,7 +31,7 @@ import { NameAndID } from '@/components/NameAndID'
3331
loadI18n()
3432

3533
export default function ClusterTable() {
36-
const { columns, isKnowledgeLoading } = useTableColumn()
34+
const { columns } = useTableColumn()
3735

3836
const {
3937
data,
@@ -45,12 +43,10 @@ export default function ClusterTable() {
4543
pagination,
4644
} = useFetchClustersData()
4745

48-
const isLoading = isDataLoading || isKnowledgeLoading
49-
5046
return (
5147
<HeavyTable
5248
headerTitle={null}
53-
loading={isLoading}
49+
loading={isDataLoading}
5450
className={styles.clusterTable}
5551
dataSource={data?.data?.data?.clusters || []}
5652
onSubmit={(filters) => {
@@ -119,7 +115,6 @@ type BootType = 'boot' | 'reboot'
119115

120116
function useTableColumn() {
121117
const { t, i18n } = useI18n()
122-
const { data, isLoading } = useQueryKnowledge()
123118

124119
const queryClient = useQueryClient()
125120
const rebootCluster = useRebootCluster()
@@ -175,30 +170,22 @@ function useTableColumn() {
175170

176171
const columns = useMemo(
177172
// FIXME: Filter not updated in time
178-
() =>
179-
getColumns(
180-
t,
181-
getClusterTypes(data?.data?.data || []),
182-
bootAction,
183-
stopAction
184-
),
185-
[i18n.language, isLoading, bootAction, stopAction]
173+
() => getColumns(t, getClusterTypes(), bootAction, stopAction),
174+
[i18n.language, bootAction, stopAction]
186175
)
187176

188177
return {
189178
columns,
190-
isKnowledgeLoading: isLoading,
191179
}
192180
}
193181

194-
function getClusterTypes(raw: KnowledgeOfClusterType[]) {
195-
const result = {} as ProSchemaValueEnumObj
196-
raw.forEach(
197-
(r) =>
198-
(result[r.clusterType!.code!] = {
199-
text: r.clusterType!.name!,
200-
})
201-
)
182+
function getClusterTypes() {
183+
const result = {
184+
TiDB: {
185+
text: 'TiDB',
186+
},
187+
} as ProSchemaValueEnumObj
188+
202189
return result
203190
}
204191

external/api/swagger.json

Lines changed: 0 additions & 182 deletions
Original file line numberDiff line numberDiff line change
@@ -2470,61 +2470,6 @@
24702470
}
24712471
}
24722472
},
2473-
"/knowledges/": {
2474-
"get": {
2475-
"security": [
2476-
{
2477-
"ApiKeyAuth": []
2478-
}
2479-
],
2480-
"description": "show cluster knowledge",
2481-
"consumes": ["application/json"],
2482-
"produces": ["application/json"],
2483-
"tags": ["knowledge"],
2484-
"summary": "show cluster knowledge",
2485-
"responses": {
2486-
"200": {
2487-
"description": "OK",
2488-
"schema": {
2489-
"allOf": [
2490-
{
2491-
"$ref": "#/definitions/controller.CommonResult"
2492-
},
2493-
{
2494-
"type": "object",
2495-
"properties": {
2496-
"data": {
2497-
"type": "array",
2498-
"items": {
2499-
"$ref": "#/definitions/knowledge.ClusterTypeSpec"
2500-
}
2501-
}
2502-
}
2503-
}
2504-
]
2505-
}
2506-
},
2507-
"401": {
2508-
"description": "Unauthorized",
2509-
"schema": {
2510-
"$ref": "#/definitions/controller.CommonResult"
2511-
}
2512-
},
2513-
"403": {
2514-
"description": "Forbidden",
2515-
"schema": {
2516-
"$ref": "#/definitions/controller.CommonResult"
2517-
}
2518-
},
2519-
"500": {
2520-
"description": "Internal Server Error",
2521-
"schema": {
2522-
"$ref": "#/definitions/controller.CommonResult"
2523-
}
2524-
}
2525-
}
2526-
}
2527-
},
25282473
"/param-groups/": {
25292474
"get": {
25302475
"security": [
@@ -6871,133 +6816,6 @@
68716816
}
68726817
}
68736818
},
6874-
"knowledge.ClusterComponent": {
6875-
"type": "object",
6876-
"properties": {
6877-
"componentName": {
6878-
"type": "string"
6879-
},
6880-
"componentPurpose": {
6881-
"type": "string"
6882-
},
6883-
"componentType": {
6884-
"type": "string"
6885-
}
6886-
}
6887-
},
6888-
"knowledge.ClusterComponentSpec": {
6889-
"type": "object",
6890-
"properties": {
6891-
"clusterComponent": {
6892-
"$ref": "#/definitions/knowledge.ClusterComponent"
6893-
},
6894-
"componentConstraint": {
6895-
"$ref": "#/definitions/knowledge.ComponentConstraint"
6896-
},
6897-
"componentPortConstraint": {
6898-
"$ref": "#/definitions/knowledge.ComponentPortConstraint"
6899-
}
6900-
}
6901-
},
6902-
"knowledge.ClusterType": {
6903-
"type": "object",
6904-
"properties": {
6905-
"code": {
6906-
"type": "string"
6907-
},
6908-
"name": {
6909-
"type": "string"
6910-
}
6911-
}
6912-
},
6913-
"knowledge.ClusterTypeSpec": {
6914-
"type": "object",
6915-
"properties": {
6916-
"clusterType": {
6917-
"$ref": "#/definitions/knowledge.ClusterType"
6918-
},
6919-
"versionSpecs": {
6920-
"type": "array",
6921-
"items": {
6922-
"$ref": "#/definitions/knowledge.ClusterVersionSpec"
6923-
}
6924-
}
6925-
}
6926-
},
6927-
"knowledge.ClusterVersion": {
6928-
"type": "object",
6929-
"properties": {
6930-
"code": {
6931-
"type": "string"
6932-
},
6933-
"name": {
6934-
"type": "string"
6935-
}
6936-
}
6937-
},
6938-
"knowledge.ClusterVersionSpec": {
6939-
"type": "object",
6940-
"properties": {
6941-
"archTypes": {
6942-
"type": "array",
6943-
"items": {
6944-
"type": "string"
6945-
}
6946-
},
6947-
"clusterPortConstraint": {
6948-
"$ref": "#/definitions/knowledge.ComponentPortConstraint"
6949-
},
6950-
"clusterVersion": {
6951-
"$ref": "#/definitions/knowledge.ClusterVersion"
6952-
},
6953-
"componentSpecs": {
6954-
"type": "array",
6955-
"items": {
6956-
"$ref": "#/definitions/knowledge.ClusterComponentSpec"
6957-
}
6958-
}
6959-
}
6960-
},
6961-
"knowledge.ComponentConstraint": {
6962-
"type": "object",
6963-
"properties": {
6964-
"availableSpecCodes": {
6965-
"type": "array",
6966-
"items": {
6967-
"type": "string"
6968-
}
6969-
},
6970-
"componentRequired": {
6971-
"type": "boolean"
6972-
},
6973-
"minZoneQuantity": {
6974-
"type": "integer"
6975-
},
6976-
"parasite": {
6977-
"type": "boolean"
6978-
},
6979-
"suggestedNodeQuantities": {
6980-
"type": "array",
6981-
"items": {
6982-
"type": "integer"
6983-
}
6984-
}
6985-
}
6986-
},
6987-
"knowledge.ComponentPortConstraint": {
6988-
"type": "object",
6989-
"properties": {
6990-
"portCount": {
6991-
"type": "integer"
6992-
},
6993-
"portRangeEnd": {
6994-
"type": "integer"
6995-
},
6996-
"portRangeStart": {
6997-
"type": "integer"
6998-
}
6999-
}
7000-
},
70016819
"message.AddPermissionsForRoleReq": {
70026820
"type": "object",
70036821
"properties": {

src/api/client.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import {
1616
ChangeFeedApi as ClusterDataReplicationApi,
1717
ParameterGroupApi,
1818
Configuration,
19-
KnowledgeApi,
2019
PlatformApi,
2120
ResourceApi,
2221
TaskApi,
@@ -78,7 +77,6 @@ function initApis(basePath: string, axiosInstance: AxiosInstance) {
7877
undefined,
7978
axiosInstance
8079
),
81-
Knowledge: new KnowledgeApi(configuration, undefined, axiosInstance),
8280
Task: new TaskApi(configuration, undefined, axiosInstance),
8381
Logs: new ClusterLogApi(configuration, undefined, axiosInstance),
8482
Transport: new ClusterDataTransportApi(

src/api/hooks/knowledge.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/api/model/index.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,11 @@ import {
99
ControllerResultWithPage,
1010
MessageLoginReq,
1111
MessageLoginResp,
12-
KnowledgeClusterComponent,
13-
KnowledgeClusterComponentSpec,
14-
KnowledgeClusterVersionSpec,
1512
MessageQueryWorkFlowDetailResp,
1613
StructsWorkFlowInfo,
1714
StructsWorkFlowInfoStatusEnum,
1815
StructsWorkFlowNodeInfoStatusEnum,
1916
StructsWorkFlowNodeInfo,
20-
KnowledgeClusterType,
21-
KnowledgeClusterTypeSpec,
22-
KnowledgeClusterVersion,
2317
ClusterPreviewClusterResp,
2418
MessageDataExportReq,
2519
MessageDataImportReq,
@@ -76,10 +70,6 @@ export type ClusterDownstreamKafka = ClusterKafkaDownstream
7670
export type ClusterDownstreamMySQL = ClusterMysqlDownstream
7771
export type ClusterDownstreamTiDB = ClusterTiDBDownstream
7872

79-
export type ClusterType = KnowledgeClusterType
80-
export type ClusterVersion = KnowledgeClusterVersion
81-
export type ClusterComponent = KnowledgeClusterComponent
82-
8373
export type TransportRecord = StructsDataImportExportRecordInfo
8474

8575
export type HostInfo = StructsHostInfo
@@ -92,10 +82,6 @@ export type TaskWorkflowInfo = StructsWorkFlowInfo
9282
export type TaskWorkflowDetailInfo = MessageQueryWorkFlowDetailResp
9383
export type TaskWorkflowSubTaskInfo = StructsWorkFlowNodeInfo
9484

95-
export type KnowledgeOfClusterType = KnowledgeClusterTypeSpec
96-
export type KnowledgeOfClusterVersion = KnowledgeClusterVersionSpec
97-
export type KnowledgeOfClusterComponent = KnowledgeClusterComponentSpec
98-
9985
export type UserLoginRequest = MessageLoginReq
10086

10187
export type RequestBackupCreate = ClusterBackupClusterDataReq

0 commit comments

Comments
 (0)