Skip to content

Commit

Permalink
feat: Add new review pages for admin and ISV (#591)
Browse files Browse the repository at this point in the history
  • Loading branch information
dongrui authored Dec 20, 2018
1 parent 879a69e commit aa5f664
Show file tree
Hide file tree
Showing 24 changed files with 1,215 additions and 138 deletions.
55 changes: 55 additions & 0 deletions src/components/AppName/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';
import classnames from 'classnames';
import { translate } from 'react-i18next';

import { Image } from 'components/Base';
import styles from './index.scss';

@translate()
export default class AppName extends React.Component {
static propTypes = {
className: PropTypes.string,
icon: PropTypes.string,
linkUrl: PropTypes.string,
name: PropTypes.string,
type: PropTypes.string,
versionName: PropTypes.string
};

render() {
const {
className, icon, name, linkUrl, type, versionName
} = this.props;

return (
<div className={classnames(styles.appName, className)}>
<span className={styles.image}>
<Image src={icon} iconLetter={name} iconSize={40} />
</span>

<span className={styles.info}>
{linkUrl ? (
<Link to={linkUrl} title={name} className={styles.name}>
{name}
</Link>
) : (
<div title={name} className={styles.name}>
{name}
</div>
)}

{Boolean(type || versionName) && (
<div className={styles.description}>
<span className={styles.type}>{type}</span>
&nbsp;/&nbsp;<span className={styles.versionName}>
{versionName}
</span>
</div>
)}
</span>
</div>
);
}
}
48 changes: 48 additions & 0 deletions src/components/AppName/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
@import '~scss/vars';

.appName {
display: inline-block;
.image {
display: inline-block;
float: left;
margin-right: 8px;
width: 40px;
height: 40px;
line-height: 40px;

img {
max-width: 100%;
max-height: 100%;
vertical-align: middle;
}
}

.info {
display: inline-block;
line-height: 20px;
font-size: 12px;

.name {
width: 120px;
color: $N500;
font-weight: 500;
width: 130px;
@include textCut;
}

a:hover {
color: $link-hover;
}

.description {
.type {
color: $N300;
font-weight: 500;
}

.versionName {
color: $N300;
}
}
}
}
24 changes: 17 additions & 7 deletions src/components/DetailTabs/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import { noop } from 'lodash';
import _, { noop } from 'lodash';
import { translate } from 'react-i18next';

import styles from './index.scss';
Expand All @@ -28,8 +28,11 @@ export default class DetailTabs extends Component {
constructor(props) {
super(props);

const curTabValue = _.isObject(props.tabs[0])
? props.tabs[0].value
: props.tabs[0];
this.state = {
curTab: props.defaultTab || props.tabs[0]
curTab: props.defaultTab || curTabValue
};
}

Expand All @@ -48,7 +51,11 @@ export default class DetailTabs extends Component {
}

handleChange = tab => {
this.setState({ curTab: tab });
const tabValue = _.isObject(tab) ? tab.value : tab;

if (!tab.isDisabled) {
this.setState({ curTab: tabValue });
}
};

render() {
Expand All @@ -65,13 +72,16 @@ export default class DetailTabs extends Component {
className
)}
>
{tabs.map((tab, idx) => (
{tabs.map(tab => (
<label
className={classnames({ [styles.active]: tab === curTab })}
key={idx}
className={classnames({
[styles.active]: (tab.value || tab) === curTab,
[styles.disabled]: tab.isDisabled
})}
key={tab.value || tab}
onClick={() => this.handleChange(tab)}
>
{t(tab)}
{t(tab.name || tab)}
</label>
))}
</div>
Expand Down
6 changes: 6 additions & 0 deletions src/components/DetailTabs/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
color: $P75;
border-bottom: 1px solid $P75;
}

&.disabled {
color: $N100;
opacity: 0.5;
cursor: not-allowed;
}
}
}

Expand Down
6 changes: 4 additions & 2 deletions src/components/Layout/SideNav/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@ const keys = [
'categories',
'category',
'user',
'create'
'create',
'provider'
];
const changeKey = {
review: 'app',
cluster: 'repo',
runtime: 'repo',
categories: 'app',
category: 'app'
category: 'app',
applications: 'provider'
};

@translate()
Expand Down
21 changes: 17 additions & 4 deletions src/components/Layout/SideNav/navMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const subNavMap = {
title: 'Store',
links: [
{ name: 'All Apps', link: '/dashboard/apps', active: '/app' },
{ name: 'App Reviews', link: '/dashboard/reviews', active: 'review' },
{ name: 'App Reviews', link: '/dashboard/app-reviews', active: 'review' },
{ name: 'Categroies', link: '/dashboard/categories', active: 'categor' }
/* { name: 'Appearance', link: '#', active: 'appearance' } */
]
Expand All @@ -30,6 +30,19 @@ export const subNavMap = {
{ name: 'All Clusters', link: '/dashboard/clusters', active: 'cluster' }
/* { name: 'Service Status', link: '#', active: 'service' } */
]
},
provider: {
title: 'App service provider',
links: [
{ name: '全部服务商', link: '/dashboard/providers', active: 'providers' },
{
name: '入驻申请',
link: '/dashboard/applications',
active: 'applications'
},
{ name: '合约', link: '#', active: '#' },
{ name: '保证金', link: '#', active: '#' }
]
}
};

Expand All @@ -48,10 +61,10 @@ export const getNavs = {
title: 'App Store'
},
{
link: '/dashboard/repos',
link: '/dashboard/providers',
iconName: 'shield',
active: 'repo',
title: 'App service provider ISV'
active: 'provider',
title: 'App service provider'
},
{
link: '#',
Expand Down
12 changes: 7 additions & 5 deletions src/locales/zh/apps.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,19 +151,21 @@
"APP_DELIVERY_MODES_EXPLAIN": "每个应用可支持多种交付方式,每种交付方式的版本是相互独立的。",
"Not added": "未添加",
"optional": "可选",
"fileConfig": "配置文件",
"setPrice": "定价",
"updateLog": "更新日志",
"Config File": "配置文件",
"Set Price": "定价",
"Update Log": "更新日志",

"Test Runtime": "测试环境",
"Instance Name ID": "实例名称 ID",
"Create Time": "创建时间",

"App Info": "应用信息",
"Base Info": "基本信息",
"Instructions": "使用说明",
"Terms of service": "服务条款",
"Select file": "选择文件",

"Preview": "预览"

"Preview": "预览",
"Processed": "已处理",
"Unprocessed": "未处理"
}
2 changes: 1 addition & 1 deletion src/locales/zh/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@

"QingCloud App Center": "QingCloud 应用中心",
"My dashboard": "我的工作台",
"App service provider ISV": "应用服务商ISV",
"App service provider": "应用服务商",
"Work list": "工单",
"Financial Center": "财务中心",
"Message and monitoring": "消息与监控",
Expand Down
Empty file.
Loading

0 comments on commit aa5f664

Please sign in to comment.