diff --git a/src/App.jsx b/src/App.jsx index d37046ec..fbd48c1b 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -46,8 +46,7 @@ const WrapRoute = ({ component: Comp, ...rest }) => { if (!_.isEmpty(acl)) { acl = [].concat(acl); - - if (!_.some(acl, role => user[`is${_.capitalize(role)}`])) { + if (!_.some(acl, role => user[`is${role}`])) { return ; } } diff --git a/src/config/roles.js b/src/config/roles.js index 7c1d9fc1..daa3fdfe 100644 --- a/src/config/roles.js +++ b/src/config/roles.js @@ -25,10 +25,10 @@ export const roleMap = { // matching user provider's getter // i.e admin => user.isAdmin export const roleTypes = { - admin: 'admin', + admin: 'Admin', isv: 'ISV', - dev: 'dev', - user: 'normal' + dev: 'Dev', + user: 'Normal' }; export default roles; diff --git a/src/locales/zh/apps.json b/src/locales/zh/apps.json index abb40e5c..6947abb5 100644 --- a/src/locales/zh/apps.json +++ b/src/locales/zh/apps.json @@ -77,12 +77,6 @@ "No result for search word": "没有找到与关键字 「{{searchWord}}」 相关的应用", "File": "文件", "Successful upload": "上传成功", - "version_type_vmbased": "VM", - "version_type_helm": "Helm", - "version_type_saas": "SaaS", - "version_type_api": "API", - "version_type_native": "Native", - "version_type_serveless": "Serveless", "Upload configuration file": "上传配置文件", "Chart_yaml_Info": "Yaml文件,用于描述 Chart 的基本信息,包括名称版本等", "LICENSE_Info": "[可选] 文本格式的协议", diff --git a/src/pages/Dashboard/Apps/Card/index.jsx b/src/pages/Dashboard/Apps/Card/index.jsx index f6a6cc77..2bcf63f8 100644 --- a/src/pages/Dashboard/Apps/Card/index.jsx +++ b/src/pages/Dashboard/Apps/Card/index.jsx @@ -3,9 +3,10 @@ import PropTypes from 'prop-types'; import classnames from 'classnames'; import { withRouter } from 'react-router'; -import Status from 'components/Status'; import { Image } from 'components/Base'; +import Status from 'components/Status'; import { getPastTime } from 'src/utils'; +import { getVersionTypesName } from 'config/version-types'; import styles from './index.scss'; @@ -28,7 +29,6 @@ export default class AppCard extends Component { status_time, app_version_types } = data; - const versions = app_version_types.split(','); return (
{description}
{t('Delivery type')}: - {versions.map(type => ( - - {t(`version_type_${type}`)} - - ))} + + {(getVersionTypesName(app_version_types) || []).join(' ')} +
{t('Updated At')}: diff --git a/src/pages/Dashboard/Apps/MyApps/index.jsx b/src/pages/Dashboard/Apps/MyApps/index.jsx index 8f989b16..512877a0 100644 --- a/src/pages/Dashboard/Apps/MyApps/index.jsx +++ b/src/pages/Dashboard/Apps/MyApps/index.jsx @@ -37,7 +37,6 @@ export default class Apps extends Component { appStore.pageSize = 48; appStore.userId = user_id; await appStore.fetchAll(); - await appVersionStore.fetchAll(); this.setState({ pageLoading: false }); diff --git a/src/stores/app/index.js b/src/stores/app/index.js index 7108f543..09bde4d0 100644 --- a/src/stores/app/index.js +++ b/src/stores/app/index.js @@ -6,7 +6,6 @@ import { t } from 'i18next'; import { useTableActions } from 'mixins'; import Store from '../Store'; -const defaultStatus = ['draft', 'active', 'suspended']; const maxsize = 2 * 1024 * 1024; let sequence = 0; // app screenshot for sort @@ -14,6 +13,8 @@ let sequence = 0; // app screenshot for sort class AppStore extends Store { sortKey = 'status_time'; + defaultStatus = ['draft', 'active', 'suspended']; + @observable apps = []; @observable homeApps = [];