diff --git a/dashboard/config/config.js b/dashboard/config/config.js index e89bb9571..1ff7d29a9 100644 --- a/dashboard/config/config.js +++ b/dashboard/config/config.js @@ -42,12 +42,6 @@ export default defineConfig({ path: `/ApplicationList`, component: './ApplicationList', }, - { - name: 'ApplicationList.ApplicationListDetail', - hideInMenu: true, - path: '/ApplicationList/ApplicationListDetail', - component: './ApplicationList/ApplicationListDetail', - }, { name: 'ApplicationList.WorkloadDetail', icon: 'smile', @@ -62,12 +56,6 @@ export default defineConfig({ component: './Traits/Detail', hideInMenu: true, }, - { - name: 'ApplicationList.CreateApplication', - hideInMenu: true, - path: '/ApplicationList/CreateApplication', - component: './ApplicationList/CreateApplication', - }, { name: 'ApplicationList.Components', hideInMenu: true, diff --git a/dashboard/config/proxy.js b/dashboard/config/proxy.js index f12014d4c..94f836beb 100644 --- a/dashboard/config/proxy.js +++ b/dashboard/config/proxy.js @@ -8,7 +8,7 @@ export default { dev: { '/api': { - target: 'http://30.11.171.29:38081/', + target: 'http://30.11.171.39:38081/', changeOrigin: true, }, }, diff --git a/dashboard/src/components/Trait/index.jsx b/dashboard/src/components/Trait/index.jsx index 2ae22e855..332ed6e23 100644 --- a/dashboard/src/components/Trait/index.jsx +++ b/dashboard/src/components/Trait/index.jsx @@ -30,6 +30,7 @@ class Trait extends React.Component { this.state = { visible: false, selectValue: null, + compList: [], }; } @@ -37,6 +38,19 @@ class Trait extends React.Component { this.getInitialData(); } + shouldComponentUpdate(nextProps) { + if (nextProps.currentEnv === this.props.currentEnv) { + return true; + } + this.props.dispatch({ + type: 'applist/getList', + payload: { + url: `/api/envs/${nextProps.currentEnv}/apps/`, + }, + }); + return true; + } + getInitialData = async () => { if (this.props.currentEnv) { await this.props.dispatch({ @@ -71,7 +85,12 @@ class Trait extends React.Component { }; const submitData = this.formRefStep2.current.getFieldValue(); Object.keys(submitData).forEach((currentKey) => { - if (currentKey !== 'name' && currentKey !== 'appName' && submitData[currentKey]) { + if ( + currentKey !== 'name' && + currentKey !== 'appName' && + currentKey !== 'compName' && + submitData[currentKey] + ) { submitObj.flags.push({ name: currentKey, value: submitData[currentKey].toString(), @@ -79,13 +98,14 @@ class Trait extends React.Component { } }); const { currentEnv: envName } = this.props; - const { appName } = submitData; - if (envName && appName) { + const { appName, compName } = submitData; + if (envName && appName && compName) { const res = await this.props.dispatch({ type: 'trait/attachOneTraits', payload: { envName, appName, + compName, params: submitObj, }, }); @@ -96,11 +116,8 @@ class Trait extends React.Component { message.success(res); const { history } = this.props.propsObj; history.push({ - pathname: '/ApplicationList/ApplicationListDetail', - state: { - appName, - envName, - }, + pathname: `/ApplicationList/${appName}/Components`, + state: { appName, envName }, }); } } @@ -113,10 +130,30 @@ class Trait extends React.Component { }); }; - onChange = (value) => { + onChange = async (value) => { this.setState({ selectValue: value, + compList: [], }); + const res = await this.props.dispatch({ + type: 'applist/getAppDetail', + payload: { + envName: this.props.currentEnv, + appName: value, + }, + }); + if (res) { + const compData = _.get(res, 'components', []); + const compList = []; + compData.forEach((item) => { + compList.push({ + compName: item.name, + }); + }); + this.setState({ + compList, + }); + } }; onSearch = () => {}; @@ -131,7 +168,11 @@ class Trait extends React.Component { } }); } - const appList = _.get(this.props, 'returnObj', []); + let appList = _.get(this.props, 'returnObj', []); + if (!appList) { + appList = []; + } + const { compList = [] } = this.state; return (
Properties:
domain
- -{_.get(spec, 'rules[0].host', '')}
- -service
- -- {_.get( - spec, - 'rules[0].http.paths[0].backend.serviceName', - '', - )} -
- -port
- -- {_.get( - spec, - 'rules[0].http.paths[0].backend.servicePort', - '', - )} -
- -{currentKey}
- -{spec[currentKey]}
- -{currentKey1}
+ +{backend[currentKey1]}
+ +{currentKey}
+ +{spec[currentKey]}
+ +- Name:{step1InitialValues.workload_name} + Name:{step1InitialValues.workloadName}
{step1InitialValues.workload_type}
+{step1InitialValues.workloadType}
- Name:{step1InitialValues.workload_name} + Name:{step1InitialValues.workloadName}
{step1InitialValues.workload_type}
+{step1InitialValues.workloadType}
apps/v1