Skip to content

Commit

Permalink
fix: Runtime detail page clusters columns
Browse files Browse the repository at this point in the history
  • Loading branch information
dongrui committed Mar 29, 2019
1 parent 6c964f5 commit cd31dba
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
18 changes: 15 additions & 3 deletions src/pages/Dashboard/Clusters/columns/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,19 @@ export default ({
runtimes,
onlyView,
isAgent,
isRuntimeDetail,
t
}) => [
{
title: 'Status',
key: 'status',
render: cl => <Status type={cl.status} transition={cl.transition_status} transMap={transMap} />
render: cl => (
<Status
type={cl.status}
transition={cl.transition_status}
transMap={transMap}
/>
)
},
{
title: isAgent ? 'Agent Name ID' : 'Instance Name ID',
Expand All @@ -43,7 +50,10 @@ export default ({
)
},
{
title: user.isUserPortal ? 'App / Delivery type / Version' : 'Version',
title:
user.isUserPortal || isRuntimeDetail
? 'App / Delivery type / Version'
: 'Version',
key: 'app_id',
render: cl => renderAppTdShow(cl.app_id, cl.version_id)
},
Expand All @@ -67,7 +77,9 @@ export default ({
{
title: 'Creator',
key: 'owner',
render: cl => <TdUser className={styles.creator} users={users} userId={cl.owner} />
render: cl => (
<TdUser className={styles.creator} users={users} userId={cl.owner} />
)
},
{
title: 'Created At',
Expand Down
11 changes: 7 additions & 4 deletions src/pages/Dashboard/Clusters/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default class Clusters extends Component {
runtimeId,
attachUsers: !user.isUserPortal,
attachVersions: cluster_type === CLUSTER_TYPE.instance,
attachApps: !user.isDevPortal,
attachApps: !user.isDevPortal || runtimeId,
with_detail: true,
cluster_type: CLUSTER_TYPE.instance, // default fetch instance
userId: (user.isUserPortal || user.isAdminPortal) && user.user_id
Expand Down Expand Up @@ -214,14 +214,16 @@ export default class Clusters extends Component {
};

renderAppTdShow = (appId, versionId) => {
const { appStore, appVersionStore, user } = this.props;
const {
appStore, appVersionStore, runtimeId, user
} = this.props;
const { apps } = appStore;
const { versions } = appVersionStore;

const app = _.find(apps, { app_id: appId }) || {};
const version = _.find(versions, { version_id: versionId }) || {};

if (user.isUserPortal || user.isAdmin) {
if (user.isUserPortal || user.isAdmin || runtimeId) {
return (
<div className={styles.appTdShow}>
<label className={styles.appImage}>
Expand Down Expand Up @@ -343,7 +345,7 @@ export default class Clusters extends Component {
tableType="Clusters"
columns={columns}
columnsFilter={cols => {
if (user.isUserPortal || user.isAdminPortal) {
if (user.isUserPortal || user.isAdminPortal || runtimeId) {
cols = cols.filter(item => item.key !== 'owner');
}
if (isAgent) {
Expand Down Expand Up @@ -374,6 +376,7 @@ export default class Clusters extends Component {
getDetailLink: this.getDetailLink,
renderAppTdShow: this.renderAppTdShow,
renderHandleMenu: this.renderHandleMenu,
isRuntimeDetail: Boolean(runtimeId),
users,
user,
runtimes,
Expand Down

0 comments on commit cd31dba

Please sign in to comment.