Skip to content

Commit

Permalink
fix: Version review and ISV apply review error (#739)
Browse files Browse the repository at this point in the history
  • Loading branch information
dongrui authored and sunnywx committed Jan 25, 2019
1 parent 8c8be46 commit 1a3218f
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 25 deletions.
13 changes: 10 additions & 3 deletions src/locales/en/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"more": "More..",
"Back to link": "← Back to {{link}}",
"greet words": "Hi{{name}}",
"greet words": "Hi,{{name}}",
"role": "role",
"role_admin": "Administrator",
"role_developer": "Developer",
Expand All @@ -21,7 +21,7 @@
"delete_user_desc": "Are you sure delete this user?",
"No search data": "No results for search.",
"operate cluster desc": "Are you sure {{operate}} this Cluster?",
"Create Runtime explain": "Runtime is Cloud provider, It can be AWSGCE, QingCloud,Kubernetes,OpenStack,VMwareVSphere etc. give OpenPitrix permission to access those cloud provider, OpenPitrix willmanage all of them applications.",
"Create Runtime explain": "Runtime is Cloud provider, It can be AWS,GCE, QingCloud,Kubernetes,OpenStack,VMwareVSphere etc. give OpenPitrix permission to access those cloud provider, OpenPitrix willmanage all of them applications.",
"Create Repo explain": "In OpenPitrix, Every application deployed is base package repository, on the other words, If you want to use OpenPitrix for your multi-cloud application manager, you need create repository first. Application manager can store package to http/https server or S3 object storage.",
"Deploy App explain": "OpenPitrix deploy application to any cloud provider, it's very simple, selected application want to deploy ,and then choose runtime (cloud provider), and press the button. it's done.",
"NO_SEARCH_DATA": "No Application Data!",
Expand Down Expand Up @@ -75,7 +75,7 @@
"DELETE_RUNTIME_CONFIRM": "Are you sure to delete this runtime ?",
"TIPS_ADJUST_APP_CATE": "Please adjust category of {{appNames}} these {{appCount}} apps",
"Upload_Package_Error": "Some files have errors, please check",
"APP_TOTAL_DESCRIPTION": "Openpitrix oficial storethere are {{total}} apps",
"APP_TOTAL_DESCRIPTION": "Openpitrix oficial store,there are {{total}} apps",
"APP_SHELF_AND_SELL": "Your application shelf to official store and start selling ~",

"delivery_type_intro_vm": "Combined with OpenPitrix development specifications, applications are packaged into mirrors, and users deploy applications quickly based on mirrors.",
Expand Down Expand Up @@ -167,6 +167,13 @@
"BANK_ACCOUNT_NUMBER_FORMAT_INFO": "Input format error, correct format for 12 to 19 digits",
"VERSION_NO_FORMAT_INFO": "Input format error, correct format for decimal point and digital composition",

"ISV_REVIEW_PASS": "App service provider passed the app version",
"BUSINESS_ADMIN_REVIEW_PASS": "Platform business auditor passed the app version",
"DEVELOP_ADMIN_REVIEW_PASS": "The platform technology auditor has passed the app version",
"ISV_REJECT_PASS": "App service provider rejected the app version",
"BUSINESS_ADMIN_REJECT_PASS": "Platform Business auditor rejected the app version",
"DEVELOP_ADMIN_REJECT_PASS": "Platform technology auditor rejected the app version",

"suspend-app-note-desc": "After the app is off the shelf, users can't buy it from the store. Are you sure offline the app?",
"recover-app-note-desc": "After the app goes on the shelf, the relevant Off-Shelf version will become on the shelf. Are you sure go on the shelf?",
"suspend-version-note-desc": "After the version is off the shelf, the associated app will not display the version. Are you sure offline the version?",
Expand Down
3 changes: 3 additions & 0 deletions src/locales/zh/apps.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@
"ISV_REVIEW_PASS": "应用服务商审核通过了该应用版本",
"BUSINESS_ADMIN_REVIEW_PASS": "平台商务审核通过了该应用版本",
"DEVELOP_ADMIN_REVIEW_PASS": "平台技术审核审核通过了该应用版本",
"ISV_REJECT_PASS": "应用服务商审核拒绝了该应用版本",
"BUSINESS_ADMIN_REJECT_PASS": "平台商务审核拒绝了该应用版本",
"DEVELOP_ADMIN_REJECT_PASS": "平台技术审核审核拒绝了该应用版本",
"APP_TOTAL_DESCRIPTION": "Openpitrix 官方商店,有 {{total}} 款应用。",
"Screenshot": "截图",
"Version No": "版本号",
Expand Down
8 changes: 4 additions & 4 deletions src/pages/Dashboard/Providers/Applications/Detail/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default class Applications extends Component {

renderMessageDialog = () => {
const { vendorStore, match, t } = this.props;
const { providerId } = match.params;
const { applyId } = match.params;
const {
isMessageOpen,
hideModal,
Expand All @@ -55,7 +55,7 @@ export default class Applications extends Component {
title={t('Why refuse this application?')}
isOpen={isMessageOpen}
onCancel={hideModal}
onSubmit={() => applyReject(providerId)}
onSubmit={() => applyReject(applyId)}
>
<div className={styles.rejectMessage}>
<textarea
Expand All @@ -74,7 +74,7 @@ export default class Applications extends Component {
const {
vendorStore, user, match, t
} = this.props;
const { providerId } = match.params;
const { applyId } = match.params;
const { isISV } = user;
const { vendorDetail, applyPass, applyRejectShow } = vendorStore;
const { status } = vendorDetail;
Expand Down Expand Up @@ -128,7 +128,7 @@ export default class Applications extends Component {
<Button type="delete" onClick={applyRejectShow}>
{t('Reject')}
</Button>
<Button type="primary" onClick={() => applyPass(providerId)}>
<Button type="primary" onClick={() => applyPass(applyId)}>
{t('Pass')}
</Button>
</dl>
Expand Down
8 changes: 4 additions & 4 deletions src/pages/Dashboard/Reviews/Detail/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ export default class ReviewDetail extends Component {
appVersionStore.isTipsOpen = true;
} else {
// todo: after username should modify role
await appVersionStore.versionReview(
await appVersionStore.versionReview({
handleType,
version.version_id,
user.username
);
versionId: version.version_id,
role: user.username
});
}
};

Expand Down
35 changes: 29 additions & 6 deletions src/pages/Dashboard/Reviews/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,27 @@ export default class Reviews extends Component {
}
};

handleReview = async item => {
const { appVersionStore, user, history } = this.props;
const isReviewed = item.status.indexOf('in-review') > -1;

if (!isReviewed) {
// todo: after username should modify role
await appVersionStore.versionReview({
handleType: 'review',
versionId: item.version_id,
role: user.username,
noTips: true
});
}

history.push(
toRoute(routes.portal.appReviewDetail, {
reviewId: item.review_id
})
);
};

render() {
const { appVersionStore, appStore, t } = this.props;
const { reviews, isLoading, activeType } = appVersionStore;
Expand Down Expand Up @@ -118,13 +139,15 @@ export default class Reviews extends Component {
className: 'actions',
render: item => (
<div>
<Link to={linkReview(item.review_id)}>
{isUnprocessed ? (
<Button>{t('Start process')}</Button>
) : (
{isUnprocessed ? (
<Button onClick={() => this.handleReview(item)}>
{t('Start process')}
</Button>
) : (
<Link to={linkReview(item.review_id)}>
<span>{t('View detail')}</span>
)}
</Link>
</Link>
)}
</div>
)
}
Expand Down
24 changes: 16 additions & 8 deletions src/stores/app/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,29 +324,37 @@ export default class AppVersionStore extends Store {
* @returns {Promise<*>}
*/
@action
versionReview = async (handleType, versionId, role) => {
versionReview = async (params = {}) => {
const {
handleType, versionId, role, noTips
} = params;

if (handleType === 'reject' && !this.reason) {
return this.error('Please input the reason for reject');
}

const params = { version_id: versionId };
const data = { version_id: versionId };
if (handleType === 'reject') {
params.message = this.reason;
data.message = this.reason;
}

this.isLoading = true;
const result = await this.request.post(
`app_version/action/${role}/${handleType}`,
params
data
);

if (get(result, 'version_id')) {
this.hideModal();
await this.fetch(versionId);
await this.fetchReviewDetail(this.reviewDetail.review_id);
if (!noTips) {
this.hideModal();
await this.fetch(versionId);
await this.fetchReviewDetail(this.reviewDetail.review_id);
}

if (handleType === 'review') {
this.isTipsOpen = true;
this.isTipsOpen = !noTips;
} else if (handleType === 'reject') {
this.success(`${role.toUpperCase()}_REJECT_PASS`);
} else {
this.success(`${role.toUpperCase()}_REVIEW_PASS`);
}
Expand Down

0 comments on commit 1a3218f

Please sign in to comment.