diff --git a/console-ui/src/components/BatchHandle/BatchHandle.js b/console-ui/src/components/BatchHandle/BatchHandle.js index e6bc9057faa..7f840c74745 100644 --- a/console-ui/src/components/BatchHandle/BatchHandle.js +++ b/console-ui/src/components/BatchHandle/BatchHandle.js @@ -80,7 +80,7 @@ class BatchHandle extends React.Component { dataSource.pageSize }`, success: res => { - if (res.code === 200) { + if (res.code === 0) { this.setState({ dataSourceList: res.data.map(obj => ({ diff --git a/console-ui/src/components/CloneDialog/CloneDialog.js b/console-ui/src/components/CloneDialog/CloneDialog.js index 5d7903c05f8..809cf73a91d 100644 --- a/console-ui/src/components/CloneDialog/CloneDialog.js +++ b/console-ui/src/components/CloneDialog/CloneDialog.js @@ -80,7 +80,7 @@ class CloneDialog extends React.Component { type: 'get', url: `/diamond-ops/service/serverId/${serverId}/namespaceInfo`, success: res => { - if (res.code === 200) { + if (res.code === 0) { const dataSource = []; res.data.forEach(value => { if (value.namespace !== payload.tenantFrom.id) { diff --git a/console-ui/src/components/EditorNameSpace/EditorNameSpace.js b/console-ui/src/components/EditorNameSpace/EditorNameSpace.js index 5e1af4a796d..1f96be34380 100644 --- a/console-ui/src/components/EditorNameSpace/EditorNameSpace.js +++ b/console-ui/src/components/EditorNameSpace/EditorNameSpace.js @@ -72,8 +72,9 @@ class EditorNameSpace extends React.Component { this.field.setValues(record); request({ type: 'get', - url: `v1/console/namespaces?show=all&namespaceId=${record.namespace}`, + url: `v3/console/core/namespace?namespaceId=${record.namespace}`, success: res => { + res = res.data; if (res !== null) { this.field.setValue('namespaceDesc', res.namespaceDesc); } else { @@ -101,15 +102,18 @@ class EditorNameSpace extends React.Component { beforeSend: () => { this.openLoading(); }, - url: 'v1/console/namespaces', + url: 'v3/console/core/namespace', contentType: 'application/x-www-form-urlencoded', data: { - namespace: values.namespace, - namespaceShowName: values.namespaceShowName, + namespaceId: values.namespace, + namespaceName: values.namespaceShowName, namespaceDesc: values.namespaceDesc, }, success: res => { - if (res === true) { + // res = res.data; + console.log(3); + if (res.code === 0) { + res = res.data; this.closeDialog(); this.props.getNameSpaces(); this.refreshNameSpace(); // 刷新全局namespace @@ -131,9 +135,10 @@ class EditorNameSpace extends React.Component { setTimeout(() => { request({ type: 'get', - url: 'v1/console/namespaces', + url: 'v3/console/core/namespace', success: res => { - if (res.code === 200) { + console.log(res); + if (res.code === 0) { window.namespaceList = res.data; } }, diff --git a/console-ui/src/components/ImportDialog/ImportDialog.js b/console-ui/src/components/ImportDialog/ImportDialog.js index 0086dd9b2d3..726dde6f5fe 100644 --- a/console-ui/src/components/ImportDialog/ImportDialog.js +++ b/console-ui/src/components/ImportDialog/ImportDialog.js @@ -85,7 +85,7 @@ class ImportDialog extends React.Component { }; formatter = res => { - if (res.code === 200) { + if (res.code === 0) { return { code: '0', retData: res, diff --git a/console-ui/src/components/NameSpaceList/NameSpaceList.js b/console-ui/src/components/NameSpaceList/NameSpaceList.js index 825337cfd53..b7e4d93f936 100644 --- a/console-ui/src/components/NameSpaceList/NameSpaceList.js +++ b/console-ui/src/components/NameSpaceList/NameSpaceList.js @@ -61,7 +61,7 @@ class NameSpaceList extends React.Component { linkKey, }, success: res => { - if (res.code === 200) { + if (res.code === 0) { window[keyName] = res.data; this.setState({ [keyName]: res.data, @@ -111,9 +111,9 @@ class NameSpaceList extends React.Component { } else { request({ type: 'get', - url: 'v1/console/namespaces', + url: 'v3/console/core/namespace/list', success: res => { - if (res.code === 200) { + if (res.code === 0) { this.handleNameSpaces(res.data); } else { Dialog.alert({ diff --git a/console-ui/src/components/NewNameSpace/NewNameSpace.js b/console-ui/src/components/NewNameSpace/NewNameSpace.js index 4f50e0c07d7..40b628e58e5 100644 --- a/console-ui/src/components/NewNameSpace/NewNameSpace.js +++ b/console-ui/src/components/NewNameSpace/NewNameSpace.js @@ -111,13 +111,14 @@ class NewNameSpace extends React.Component { } request({ type: 'get', - url: 'v1/console/namespaces?checkNamespaceIdExist=true', + url: 'v3/console/core/namespace/exist', contentType: 'application/x-www-form-urlencoded', beforeSend: () => this.openLoading(), data: { customNamespaceId, }, success: res => { + res = res.data; this.disabled = false; this.setState({ disabled: false, @@ -130,7 +131,7 @@ class NewNameSpace extends React.Component { } else { request({ type: 'post', - url: 'v1/console/namespaces', + url: 'v3/console/core/namespace', contentType: 'application/x-www-form-urlencoded', beforeSend: () => this.openLoading(), data: { @@ -139,6 +140,7 @@ class NewNameSpace extends React.Component { namespaceDesc: values.namespaceDesc, }, success: res => { + res = res.data; this.disabled = false; this.setState({ disabled: false, @@ -167,9 +169,9 @@ class NewNameSpace extends React.Component { setTimeout(() => { request({ type: 'get', - url: 'v1/console/namespaces', + url: 'v3/console/core/namespace', success: res => { - if (res.code === 200) { + if (res.code === 0) { window.namespaceList = res.data; } }, diff --git a/console-ui/src/pages/ClusterManagement/ClusterNodeList/ClusterNodeList.js b/console-ui/src/pages/ClusterManagement/ClusterNodeList/ClusterNodeList.js index 51092c9fa1a..8e4c74ef1d5 100644 --- a/console-ui/src/pages/ClusterManagement/ClusterNodeList/ClusterNodeList.js +++ b/console-ui/src/pages/ClusterManagement/ClusterNodeList/ClusterNodeList.js @@ -84,7 +84,7 @@ class ClusterNodeList extends React.Component { `keyword=${keyword}`, ]; request({ - url: `v1/core/cluster/nodes?${parameter.join('&')}`, + url: `v3/console/core/cluster/nodes?${parameter.join('&')}`, beforeSend: () => this.openLoading(), success: ({ count = 0, data = [] } = {}) => { this.setState({ @@ -107,9 +107,9 @@ class ClusterNodeList extends React.Component { const accessToken = JSON.parse(localStorage.token || '{}').accessToken; this.openLoading(); axios - .post(`v1/core/cluster/server/leave?accessToken=${accessToken}`, nodes) + .post(`v3/console/core/cluster/server/leave?accessToken=${accessToken}`, nodes) .then(response => { - if (response.data.code === 200) { + if (response.data.code === 0) { Message.success(locale.leaveSucc); } else { const errorMessage = response.data.message || locale.leaveFail; diff --git a/console-ui/src/pages/ConfigurationManagement/ConfigDetail/ConfigCompared.js b/console-ui/src/pages/ConfigurationManagement/ConfigDetail/ConfigCompared.js index 21c97ae2235..bf876e5423b 100644 --- a/console-ui/src/pages/ConfigurationManagement/ConfigDetail/ConfigCompared.js +++ b/console-ui/src/pages/ConfigurationManagement/ConfigDetail/ConfigCompared.js @@ -58,9 +58,9 @@ class ConfigCompared extends React.Component { getNamespaces() { request({ type: 'get', - url: 'v1/console/namespaces', + url: 'v3/console/core/namespace/list', success: res => { - if (res.code === 200) { + if (res.code === 0) { const { namespacesDataSource } = this.state; this.setState({ namespacesDataSource: res.data }); } else { diff --git a/console-ui/src/pages/ConfigurationManagement/ConfigDetail/ConfigDetail.js b/console-ui/src/pages/ConfigurationManagement/ConfigDetail/ConfigDetail.js index 59db9acfa39..3c87212384f 100644 --- a/console-ui/src/pages/ConfigurationManagement/ConfigDetail/ConfigDetail.js +++ b/console-ui/src/pages/ConfigurationManagement/ConfigDetail/ConfigDetail.js @@ -66,7 +66,7 @@ class ConfigDetail extends React.Component { this.group = getParams('group') || 'DEFAULT_GROUP'; this.ips = ''; this.valueMap = {}; // 存储不同版本的数据 - this.tenant = getParams('namespace') || ''; + this.namespaceId = getParams('namespace') || ''; this.searchDataId = getParams('searchDataId') || ''; this.searchGroup = getParams('searchGroup') || ''; this.pageSize = getParams('pageSize'); @@ -147,18 +147,18 @@ class ConfigDetail extends React.Component { const { locale = {} } = this.props; const self = this; this.serverId = getParams('serverId') || 'center'; - this.tenant = getParams('namespace') || ''; + this.namespaceId = getParams('namespace') || ''; this.edasAppName = getParams('edasAppName') || ''; this.inApp = this.edasAppName; - const url = `v1/cs/configs?show=all&dataId=${this.dataId}&group=${this.group}`; + const url = `v3/console/cs/config?&dataId=${this.dataId}&group=${this.group}`; request({ url, beforeSend() { self.openLoading(); }, success(result) { - if (result != null) { - const data = result; + if (result != null && result.code === 0) { + const data = result.data; self.valueMap.normal = data; self.field.setValue('dataId', data.dataId); self.field.setValue('content', data.content); @@ -186,7 +186,7 @@ class ConfigDetail extends React.Component { serverId: this.serverId, group: this.searchGroup, dataId: this.searchDataId, - namespace: this.tenant, + namespace: this.namespaceId, pageNo: this.pageNo, pageSize: this.pageSize, }) @@ -226,7 +226,7 @@ class ConfigDetail extends React.Component { let self = this; const { locale = {} } = this.props; let leftvalue = this.monacoEditor.getValue(); - let url = `v1/cs/history/previous?id=${this.valueMap.normal.id}&dataId=${this.dataId}&group=${this.group}`; + let url = `v3/console/cs/history/previous?id=${this.valueMap.normal.id}&dataId=${this.dataId}&group=${this.group}`; request({ url, beforeSend() { @@ -234,6 +234,7 @@ class ConfigDetail extends React.Component { }, success(result) { if (result != null) { + const result = result.data; let rightvalue = result.content; leftvalue = leftvalue.replace(/\r\n/g, '\n').replace(/\n/g, '\r\n'); rightvalue = rightvalue.replace(/\r\n/g, '\n').replace(/\n/g, '\r\n'); @@ -248,18 +249,19 @@ class ConfigDetail extends React.Component { }); } - openCompare = ([dataId, group, tenant]) => { + openCompare = ([dataId, group, namespaceId]) => { let self = this; const { locale = {} } = this.props; let leftvalue = this.monacoEditor.getValue(); const params = { - show: 'all', + // show: 'all', group, dataId, - tenant, + namespaceId, }; - requestUtils.get('v1/cs/configs', { params }).then(res => { - if (res != null && res !== '') { + requestUtils.get('v3/console/cs/config', { params }).then(res => { + if (res != null && res !== '' && res.code === 0) { + res = res.data; let rightvalue = res.content; leftvalue = leftvalue.replace(/\r\n/g, '\n').replace(/\n/g, '\r\n'); rightvalue = rightvalue.replace(/\r\n/g, '\n').replace(/\n/g, '\r\n'); @@ -319,7 +321,7 @@ class ConfigDetail extends React.Component { )}