Skip to content

Commit

Permalink
fix: Fix deploy the app by template not get the detail (#4224)
Browse files Browse the repository at this point in the history
Signed-off-by: harrisonliu5 <[email protected]>
  • Loading branch information
harrisonliu5 authored Oct 23, 2023
1 parent 5dbc288 commit 663ca90
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
20 changes: 12 additions & 8 deletions src/pages/apps/components/Modals/AppDeploy/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
7 changes: 4 additions & 3 deletions src/stores/openpitrix/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`
Expand Down

0 comments on commit 663ca90

Please sign in to comment.