[ARVADOS-WORKBENCH2] updated: 1.1.4-362-g2813990
Git user
git at public.curoverse.com
Mon Jul 23 16:16:59 EDT 2018
Summary of changes:
src/store/favorites/favorites-actions.ts | 16 ++++++++++++-
src/store/project/project-action.ts | 5 +++-
.../favorite-star/favorite-star.tsx | 27 ++++++++++++++++++++++
src/views/project-panel/project-panel.tsx | 10 ++++++--
4 files changed, 54 insertions(+), 4 deletions(-)
create mode 100644 src/views-components/favorite-star/favorite-star.tsx
via 28139906b7918ecdd93b6fed894b275bf5a945b5 (commit)
via 4407b22fba72783a428ebbaf165cc579ea4c5a23 (commit)
from 28ded6ac60c1317b5872a22ce827b073f26fa030 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 28139906b7918ecdd93b6fed894b275bf5a945b5
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date: Mon Jul 23 22:16:44 2018 +0200
Create FavoriteStar component
Feature #13784
Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
diff --git a/src/views-components/favorite-star/favorite-star.tsx b/src/views-components/favorite-star/favorite-star.tsx
new file mode 100644
index 0000000..f896e30
--- /dev/null
+++ b/src/views-components/favorite-star/favorite-star.tsx
@@ -0,0 +1,27 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from "react";
+import { FavoriteIcon } from "../../components/icon/icon";
+import { connect } from "react-redux";
+import { RootState } from "../../store/store";
+import { withStyles, StyleRulesCallback, WithStyles } from "@material-ui/core";
+
+type CssRules = "icon";
+
+const styles: StyleRulesCallback<CssRules> = theme => ({
+ icon: {
+ fontSize: "inherit"
+ }
+});
+
+const mapStateToProps = (state: RootState, props: { resourceUuid: string; className?: string; }) => ({
+ ...props,
+ visible: state.favorites[props.resourceUuid],
+});
+
+export const FavoriteStar = connect(mapStateToProps)(
+ withStyles(styles)((props: { visible: boolean; className?: string; } & WithStyles<CssRules>) =>
+ props.visible ? <FavoriteIcon className={props.className || props.classes.icon} /> : null
+ ));
\ No newline at end of file
commit 4407b22fba72783a428ebbaf165cc579ea4c5a23
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date: Mon Jul 23 22:16:20 2018 +0200
Create actions for resolving resource favorite status
Feature #13784
Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
diff --git a/src/store/favorites/favorites-actions.ts b/src/store/favorites/favorites-actions.ts
index 63ea206..d7e14a2 100644
--- a/src/store/favorites/favorites-actions.ts
+++ b/src/store/favorites/favorites-actions.ts
@@ -3,9 +3,23 @@
// SPDX-License-Identifier: AGPL-3.0
import { unionize, ofType, UnionOf } from "unionize";
+import { Dispatch } from "../../../node_modules/redux";
+import { favoriteService } from "../../services/services";
export const favoritesActions = unionize({
+ CHECK_PRESENCE_IN_FAVORITES: ofType<string[]>(),
UPDATE_FAVORITES: ofType<Record<string, boolean>>()
}, { tag: 'type', value: 'payload' });
-export type FavoritesAction = UnionOf<typeof favoritesActions>;
\ No newline at end of file
+export type FavoritesAction = UnionOf<typeof favoritesActions>;
+
+export const checkPresenceInFavorites = (userUuid: string, resourceUuids: string[]) =>
+ (dispatch: Dispatch) => {
+ dispatch(favoritesActions.CHECK_PRESENCE_IN_FAVORITES(resourceUuids));
+ favoriteService
+ .checkPresenceInFavorites(userUuid, resourceUuids)
+ .then(results => {
+ dispatch(favoritesActions.UPDATE_FAVORITES(results));
+ });
+ };
+
diff --git a/src/store/project/project-action.ts b/src/store/project/project-action.ts
index 2a7a5c1..dae245c 100644
--- a/src/store/project/project-action.ts
+++ b/src/store/project/project-action.ts
@@ -8,6 +8,7 @@ import { projectService } from "../../services/services";
import { Dispatch } from "redux";
import { FilterBuilder } from "../../common/api/filter-builder";
import { RootState } from "../store";
+import { checkPresenceInFavorites } from "../favorites/favorites-actions";
export const projectActions = unionize({
OPEN_PROJECT_CREATOR: ofType<{ ownerUuid: string }>(),
@@ -26,7 +27,7 @@ export const projectActions = unionize({
value: 'payload'
});
-export const getProjectList = (parentUuid: string = '') => (dispatch: Dispatch) => {
+export const getProjectList = (parentUuid: string = '') => (dispatch: Dispatch, getState: () => RootState) => {
dispatch(projectActions.PROJECTS_REQUEST(parentUuid));
return projectService.list({
filters: FilterBuilder
@@ -34,6 +35,8 @@ export const getProjectList = (parentUuid: string = '') => (dispatch: Dispatch)
.addEqual("ownerUuid", parentUuid)
}).then(({ items: projects }) => {
dispatch(projectActions.PROJECTS_SUCCESS({ projects, parentItemId: parentUuid }));
+ const { user } = getState().auth;
+ dispatch<any>(checkPresenceInFavorites(user ? user.uuid : "", projects.map(project => project.uuid)));
return projects;
});
};
diff --git a/src/views/project-panel/project-panel.tsx b/src/views/project-panel/project-panel.tsx
index daf22b1..316a9ff 100644
--- a/src/views/project-panel/project-panel.tsx
+++ b/src/views/project-panel/project-panel.tsx
@@ -16,8 +16,9 @@ import { ContainerRequestState } from '../../models/container-request';
import { SortDirection } from '../../components/data-table/data-column';
import { ResourceKind } from '../../models/resource';
import { resourceLabel } from '../../common/labels';
-import { ProjectIcon, CollectionIcon, ProcessIcon, DefaultIcon } from '../../components/icon/icon';
+import { ProjectIcon, CollectionIcon, ProcessIcon, DefaultIcon, FavoriteIcon } from '../../components/icon/icon';
import { ArvadosTheme } from '../../common/custom-theme';
+import { FavoriteStar } from '../../views-components/favorite-star/favorite-star';
type CssRules = "toolbar" | "button";
@@ -41,6 +42,11 @@ const renderName = (item: ProjectPanelItem) =>
{item.name}
</Typography>
</Grid>
+ <Grid item>
+ <Typography variant="caption" style={{fontSize: '8px'}}>
+ <FavoriteStar resourceUuid={item.uuid} />
+ </Typography>
+ </Grid>
</Grid>;
@@ -184,7 +190,7 @@ interface ProjectPanelActionProps {
}
type ProjectPanelProps = ProjectPanelDataProps & ProjectPanelActionProps & DispatchProp
- & WithStyles<CssRules> & RouteComponentProps<{ id: string }>;
+ & WithStyles<CssRules> & RouteComponentProps<{ id: string }>;
export const ProjectPanel = withStyles(styles)(
connect((state: RootState) => ({ currentItemId: state.projects.currentItemId }))(
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list