diff --git a/src/pages/apps/components/Modals/AppDeploy/index.jsx b/src/pages/apps/components/Modals/AppDeploy/index.jsx index c54b8b1f7db..b8efeb80c51 100644 --- a/src/pages/apps/components/Modals/AppDeploy/index.jsx +++ b/src/pages/apps/components/Modals/AppDeploy/index.jsx @@ -30,7 +30,7 @@ import AppConfig from 'components/Forms/AppDeploy/AppConfig' import VersionStore from 'stores/openpitrix/version' import AppFileStore from 'stores/openpitrix/file' -import { generateId, showNameAndAlias } from 'utils' +import { generateId } from 'utils' import Steps from './Steps' @@ -60,14 +60,18 @@ export default class AppDeploy extends React.Component { constructor(props) { super(props) + const appName = props.app.name + this.state = { currentStep: 0, formData: { app_id: props.app.app_id, - name: `${props.app.name - .slice(0, 7) - .toLowerCase() - .replaceAll(' ', '-')}-${generateId()}`, + name: appName + ? `${appName + ?.slice(0, 7) + .toLowerCase() + .replaceAll(' ', '-')}-${generateId()}` + : '', version_id: props.versionId, namespace: props.namespace, cluster: props.cluster, @@ -165,9 +169,9 @@ export default class AppDeploy extends React.Component { const props = { formData, - cluster: showNameAndAlias(cluster, 'cluster'), - workspace: showNameAndAlias(workspace, 'workspace'), - namespace: showNameAndAlias(namespace, 'project'), + cluster, + workspace, + namespace, versionId, versionStore: this.versionStore, fileStore: this.fileStore, diff --git a/src/stores/openpitrix/base.js b/src/stores/openpitrix/base.js index a347b1ae681..6a744bc6af9 100644 --- a/src/stores/openpitrix/base.js +++ b/src/stores/openpitrix/base.js @@ -83,9 +83,10 @@ export default class Base { } if (app_id) { - const suffix1 = this.resourceName === 'apps' ? '' : this.resourceName - const suffix2 = `${name || suffix1}` === '' ? '' : `/${name || suffix1}` - return `${prefix}/apps/${app_id}${suffix2}` + const suffixName = this.resourceName === 'apps' ? '' : this.resourceName + const suffixPath = + `${name || suffixName}` === '' ? '' : `/${name || suffixName}` + return `${prefix}/apps/${app_id}${suffixPath}` } return `${prefix}/${name || this.resourceName}`