Skip to content

Commit

Permalink
fix: Repo refresh add noLimit param (#536)
Browse files Browse the repository at this point in the history
  • Loading branch information
dongrui authored and sunnywx committed Nov 8, 2018
1 parent f9fa1f8 commit 2c1d2f1
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 30 deletions.
5 changes: 2 additions & 3 deletions src/pages/Dashboard/Apps/Add/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ import styles from './index.scss';
@observer
export default class AppAdd extends Component {
async componentDidMount() {
const { repoStore, user } = this.props;
const { repoStore } = this.props;

await repoStore.fetchAll({
noLimit: true,
isQueryPublic: user.isDev
noLimit: true
});
}

Expand Down
3 changes: 1 addition & 2 deletions src/pages/Dashboard/Apps/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ export default class Apps extends Component {
}
await repoStore.fetchAll({
status: ['active', 'deleted'],
noLimit: true,
isQueryPublic: user.isDev
noLimit: true
});
await categoryStore.fetchAll();
}
Expand Down
5 changes: 2 additions & 3 deletions src/pages/Dashboard/Overview/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,11 @@ export default class Overview extends React.Component {
await clusterStore.fetchAll({ noLimit: true });
}

//fixme developer user query public repos
if (user.isDev) {
await appStore.fetchAll({ limit: 5 });
await clusterStore.fetchAll({ limit: 5 });
await repoStore.fetchAll({ visibility: ['private'], limit: 1 });
await runtimeStore.fetchAll({ noLimit: true });
await appStore.fetchAll({ limit: 5 });
await clusterStore.fetchAll({ limit: 5 });
}
this.setState({ isLoading: false });
}
Expand Down
8 changes: 1 addition & 7 deletions src/pages/Dashboard/Repos/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,7 @@ export default class Repos extends Component {
window.onscroll = _.throttle(this.handleScroll, 200);

repoStore.appStore = appStore;
await repoStore.fetchAll(
{
noLimit: true,
isQueryPublic: user.isDev
},
appStore
);
await repoStore.fetchAll({ noLimit: true }, appStore);
}

componentWillUnmount() {
Expand Down
17 changes: 2 additions & 15 deletions src/stores/repo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,11 @@ export default class RepoStore extends Store {
if (this.userId) {
defaultParams.owner = this.userId;
}
if (params.isQueryPublic) {
params.visibility = ['private'];
}

this.isLoading = true;
const result = await this.request.get('repos', assign(defaultParams, params));
let repos = get(result, 'repo_set', []);
this.totalCount = get(result, 'total_count', 0);

if (params.isQueryPublic) {
delete params.isQueryPublic;
params.visibility = ['public'];
const pubResult = await this.request.get('repos', assign(defaultParams, params));
const pubRepos = get(pubResult, 'repo_set', []);
repos = [...pubRepos, ...repos];
}

this.repos = orderBy(repos, ['visibility', 'status_time'], ['desc', 'desc']);

if (appStore) {
Expand All @@ -88,7 +76,7 @@ export default class RepoStore extends Store {
onSearch = async word => {
this.searchWord = word;
this.currentPage = 1;
await this.fetchAll({}, this.appStore);
await this.fetchAll({ noLimit: true }, this.appStore);
};

@action
Expand All @@ -98,7 +86,7 @@ export default class RepoStore extends Store {

@action
onRefresh = async () => {
await this.fetchAll({}, this.appStore);
await this.fetchAll({ noLimit: true }, this.appStore);
};

@action
Expand Down Expand Up @@ -215,7 +203,6 @@ export default class RepoStore extends Store {

this.repos = [];
this.repoDetail = {};

};

@action
Expand Down

0 comments on commit 2c1d2f1

Please sign in to comment.