Skip to content

Commit

Permalink
fix: Provider interface method modify by new api (#721)
Browse files Browse the repository at this point in the history
* fix: App detail page apps total

* fix: User portal menu show runtimes only for user
  • Loading branch information
dongrui authored Jan 24, 2019
1 parent 045e5cb commit 9f3d33e
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/components/Base/Table/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class Table extends React.Component {
pagination: {},
rowKey: 'key',
rowSelection: {
selectedRowKeys: [],
// selectedRowKeys: [],
onChange: _.noop,
onSelect: _.noop,
onSelectAll: _.noop
Expand Down
3 changes: 2 additions & 1 deletion src/components/Layout/SideNav/navMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,8 @@ export const userMenus = portal => [
{
name: 'Testing env',
link: toRoute(routes.portal.runtimes, { portal }),
iconName: 'image'
iconName: 'image',
userPortalShow: true
},
{
name: 'SSH Keys',
Expand Down
3 changes: 2 additions & 1 deletion src/components/MenuLayer/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ export class MenuLayer extends Component {
if (Array.isArray(item.only) && !item.only.includes(user.role)) {
return null;
}
if (typeof item.only === 'string' && user.role !== item.only) {

if (isUserPortal && item.userPortalShow && user.role !== 'user') {
return null;
}

Expand Down
2 changes: 1 addition & 1 deletion src/pages/AppDetail/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default class AppDetail extends Component {
// todo
// await vendorStore.fetch(appDetail.vendor_id);

await appStore.fetchActiveApps();
await appStore.fetchActiveApps({ status: 'active' });

this.setState({ isLoading: false });
}
Expand Down
39 changes: 16 additions & 23 deletions src/stores/vendor/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { observable, action } from 'mobx';

import _, { assign, get } from 'lodash';
import { t } from 'i18next';
import Store from '../Store';

export default class VendorStore extends Store {
Expand Down Expand Up @@ -64,7 +63,7 @@ export default class VendorStore extends Store {
this.isLoading = true;

const result = await this.request.get(
'vendor_verify_infos',
'app_vendors',
assign(defaultParams, params)
);

Expand All @@ -82,20 +81,18 @@ export default class VendorStore extends Store {
@action
fetch = async (userId = '') => {
this.isLoading = true;
const result = await this.request.get('vendor_verify_infos/user_id=*', {
const result = await this.request.get('app_vendors', {
user_id: userId
});
if (_.get(result, 'user_id')) {
this.vendorDetail = result;
}
this.vendorDetail = get(result, 'vendor_verify_info_set[0]', {});
this.isLoading = false;
};

@action
fetchStatistics = async (params = {}) => {
this.isLoading = true;
const result = await this.request.get(
'DescribeAppVendorStatistics',
'app_vendors/app_vendor_statistics',
params
);

Expand All @@ -107,8 +104,8 @@ export default class VendorStore extends Store {
create = async (userId, params = {}) => {
this.isLoading = true;
const result = await this.request.post(
`vendor_verify_infos/${userId}`,
params
'app_vendors',
_.assign(params, { user_id: userId })
);
this.isLoading = false;
return result;
Expand All @@ -117,36 +114,32 @@ export default class VendorStore extends Store {
@action
applyPass = async userId => {
this.isLoading = true;
const result = await this.request.post(
'vendor_verify_infos/user_id=*/action:pass',
{ user_id: userId }
);
const result = await this.request.post('app_vendors/pass', {
user_id: userId
});
this.isLoading = false;

if (_.get(result, 'user_id')) {
this.fetch(userId);
await this.fetch(userId);
}
};

@action
applyReject = async userId => {
if (!this.rejectMessage) {
return this.error(t('请您填写拒绝原因'));
return this.error('Please input the reason for reject');
}

this.isLoading = true;
const result = await this.request.post(
'vendor_verify_infos/user_id=*/action:reject',
{
user_id: userId,
reject_message: this.rejectMessage
}
);
const result = await this.request.post('app_vendors/reject', {
user_id: userId,
reject_message: this.rejectMessage
});
this.isLoading = false;

if (_.get(result, 'user_id')) {
this.isMessageOpen = false;
this.fetch(userId);
await this.fetch(userId);
}
};

Expand Down

0 comments on commit 9f3d33e

Please sign in to comment.