Feature #13747
Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski@contractors.roche.com>
const store = configureStore(history);
store.dispatch(authActions.INIT());
const store = configureStore(history);
store.dispatch(authActions.INIT());
-const rootUuid = authService.getRootUuid();
-store.dispatch<any>(getProjectList(rootUuid));
+store.dispatch<any>(getProjectList(authService.getUuid()));
const App = () =>
<MuiThemeProvider theme={CustomTheme}>
<Provider store={store}>
<ConnectedRouter history={history}>
<div>
const App = () =>
<MuiThemeProvider theme={CustomTheme}>
<Provider store={store}>
<ConnectedRouter history={history}>
<div>
- <Route path="/" component={Workbench}/>
- <Route path="/token" component={ApiToken}/>
+ <Route path="/" component={Workbench} />
+ <Route path="/token" component={ApiToken} />
</div>
</ConnectedRouter>
</Provider>
</MuiThemeProvider>;
ReactDOM.render(
</div>
</ConnectedRouter>
</Provider>
</MuiThemeProvider>;
ReactDOM.render(
document.getElementById('root') as HTMLElement
);
document.getElementById('root') as HTMLElement
);
// SPDX-License-Identifier: AGPL-3.0
import { default as unionize, ofType, UnionOf } from "unionize";
// SPDX-License-Identifier: AGPL-3.0
import { default as unionize, ofType, UnionOf } from "unionize";
-import { Project } from "../../models/project";
-import { groupsService } from "../../services/services";
+import { Project, ProjectResource } from "../../models/project";
+import { projectService } from "../../services/services";
import { Dispatch } from "redux";
import { getResourceKind } from "../../models/resource";
import { Dispatch } from "redux";
import { getResourceKind } from "../../models/resource";
+import FilterBuilder from "../../common/api/filter-builder";
const actions = unionize({
CREATE_PROJECT: ofType<Project>(),
const actions = unionize({
CREATE_PROJECT: ofType<Project>(),
tag: 'type',
value: 'payload'
});
tag: 'type',
value: 'payload'
});
export const getProjectList = (parentUuid: string = '') => (dispatch: Dispatch) => {
export const getProjectList = (parentUuid: string = '') => (dispatch: Dispatch) => {
- dispatch(actions.PROJECTS_REQUEST(parentUuid));
- return groupsService.list().then(listResults => {
- const projects = listResults.items.map(item => ({
- ...item,
- kind: getResourceKind(item.kind)
- }));
- dispatch(actions.PROJECTS_SUCCESS({ projects, parentItemId: parentUuid }));
- return projects;
- });
+ dispatch(actions.PROJECTS_REQUEST(parentUuid));
+ return projectService.list({
+ filters: FilterBuilder
+ .create<ProjectResource>()
+ .addEqual("ownerUuid", parentUuid)
+ }).then(listResults => {
+ const projects = listResults.items.map(item => ({
+ ...item,
+ kind: getResourceKind(item.kind)
+ }));
+ dispatch(actions.PROJECTS_SUCCESS({ projects, parentItemId: parentUuid }));
+ return projects;
+ });
};
export type ProjectAction = UnionOf<typeof actions>;
};
export type ProjectAction = UnionOf<typeof actions>;