Skip to content

Commit

Permalink
fix: Add remove tip for app template
Browse files Browse the repository at this point in the history
Signed-off-by: leoliu <leoliu@yunify.com>
  • Loading branch information
leoliu committed Aug 10, 2020
1 parent 8ed527e commit 8a0074c
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 4 deletions.
31 changes: 30 additions & 1 deletion src/actions/openpitrix.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with KubeSphere Console. If not, see <https://www.gnu.org/licenses/>.
*/

import React from 'react'
import { Modal, Notify } from 'components/Base'

import RepoAppModal from 'projects/components/Modals/RepoApp'
Expand Down Expand Up @@ -199,4 +199,33 @@ export default {
})
},
},
'openpitrix.template.delete': {
on({ store, detail, versions, success, ...props }) {
const type = t('App Templates')
const resource = detail.name
let desc = t.html('DELETE_CONFIRM_TIP', { type, resource })
if (versions.length) {
desc = (
<span>
{desc}
<span>{t('DELETE_APP_TEMPLATE_TIP')}</span>
</span>
)
}
const modal = Modal.open({
onOk: async () => {
await store.delete(detail)
Modal.close(modal)
Notify.success({ content: `${t('Deleted Successfully')}!` })
success && success()
},
store,
desc,
type,
resource,
modal: DeleteModal,
...props,
})
},
},
}
3 changes: 3 additions & 0 deletions src/locales/en/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,4 +255,7 @@ export default {

HELM_APP_SCHEMA_FORM_TIP:
'The app configuration can be displayed in a form. You can modify the default app configuration through either the form or YAML editor. Note: app data stored in different patterns are independent of each other.',

DELETE_APP_TEMPLATE_TIP:
'Before deleting an application template, you need to delete all versions.',
}
3 changes: 3 additions & 0 deletions src/locales/es/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,4 +263,7 @@ export default {

HELM_APP_SCHEMA_FORM_TIP:
'The app configuration can be displayed in a form. You can modify the default app configuration through either the form or YAML editor. Note: app data stored in different patterns are independent of each other.',

DELETE_APP_TEMPLATE_TIP:
'Before deleting an application template, you need to delete all versions.',
}
2 changes: 2 additions & 0 deletions src/locales/tc/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,4 +223,6 @@ export default {

HELM_APP_SCHEMA_FORM_TIP:
'此應用支持表單模式,可選擇通過表單或 YAML 編輯器來修改預設應用配置。注意:不同模式之間數據獨立。',

DELETE_APP_TEMPLATE_TIP: '删除应用模板前,需要先删除所有版本。',
}
2 changes: 2 additions & 0 deletions src/locales/zh/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,4 +222,6 @@ export default {

HELM_APP_SCHEMA_FORM_TIP:
'此应用支持表单模式,可选择通过表单或 YAML 编辑器来修改默认应用配置。注意:不同模式之间数据独立。',

DELETE_APP_TEMPLATE_TIP: '删除应用模板前,需要先删除所有版本。',
}
5 changes: 2 additions & 3 deletions src/pages/workspaces/containers/Apps/Detail/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,9 @@ export default class RoleDetail extends React.Component {
text: t('Delete'),
action: 'manage',
onClick: () =>
this.trigger('resource.delete', {
store: this.store,
type: t('App Templates'),
this.trigger('openpitrix.template.delete', {
detail,
versions: this.versionStore.list.data,
success: () => this.routing.push(this.listUrl),
}),
},
Expand Down

0 comments on commit 8a0074c

Please sign in to comment.