import { openRemoveProcessDialog } from "~/store/processes/processes-actions";
import { toggleDetailsPanel } from '~/store/details-panel/details-panel-action';
import { TogglePublicFavoriteAction } from "~/views-components/context-menu/actions/public-favorite-action";
+import { togglePublicFavorite } from "~/store/public-favorites/public-favorites-actions";
+import { publicFavoritePanelActions } from "~/store/public-favorites-panel/public-favorites-action";
export const processResourceAdminActionSet: ContextMenuActionSet = [[
{
{
component: TogglePublicFavoriteAction,
execute: (dispatch, resource) => {
- dispatch<any>(toggleFavorite(resource)).then(() => {
- dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
+ dispatch<any>(togglePublicFavorite(resource)).then(() => {
+ dispatch<any>(publicFavoritePanelActions.REQUEST_ITEMS());
});
}
},
import { openAdvancedTabDialog } from "~/store/advanced-tab/advanced-tab";
import { toggleDetailsPanel } from '~/store/details-panel/details-panel-action';
import { TogglePublicFavoriteAction } from "~/views-components/context-menu/actions/public-favorite-action";
+import { togglePublicFavorite } from "~/store/public-favorites/public-favorites-actions";
+import { publicFavoritePanelActions } from "~/store/public-favorites-panel/public-favorites-action";
export const projectAdminActionSet: ContextMenuActionSet = [[
{
{
component: TogglePublicFavoriteAction,
execute: (dispatch, resource) => {
- dispatch<any>(toggleFavorite(resource)).then(() => {
- dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
+ dispatch<any>(togglePublicFavorite(resource)).then(() => {
+ dispatch<any>(publicFavoritePanelActions.REQUEST_ITEMS());
});
}
},
import { toggleIsActive, toggleIsAdmin } from '~/store/users/users-actions';
import { LinkResource } from '~/models/link';
import { navigateTo } from '~/store/navigation/navigation-action';
-import { withResource, getDataFromResource, withResourceData } from '~/views-components/data-explorer/with-resources';
+import { withResourceData } from '~/views-components/data-explorer/with-resources';
+import { PublicFavorite } from '~/views-components/public-favorite-icon/public-favorite-icon';
const renderName = (item: { name: string; uuid: string, kind: string }) =>
<Grid container alignItems="center" wrap="nowrap" spacing={16}>
<FavoriteStar resourceUuid={item.uuid} />
</Typography>
</Grid>
+ <Grid item>
+ <Typography variant="caption">
+ <PublicFavorite resourceUuid={item.uuid} />
+ </Typography>
+ </Grid>
</Grid>;
export const ResourceName = connect(
const currentLabel = resourceLabel(item.tailKind);
const isUnknow = currentLabel === "Unknown";
return (<div>
- { !isUnknow ? (
- renderLink(dispatch, item.tailUuid, currentLabel)
- ) : (
+ {!isUnknow ? (
+ renderLink(dispatch, item.tailUuid, currentLabel)
+ ) : (
<Typography noWrap color="default">
{item.tailUuid}
</Typography>
- )}
+ )}
</div>);
};
--- /dev/null
+// 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.publicFavorites[props.resourceUuid],
+});
+
+export const PublicFavorite = connect(mapStateToProps)(
+ withStyles(styles)((props: { visible: boolean; className?: string; } & WithStyles<CssRules>) =>
+ props.visible ? <FavoriteIcon className={props.className || props.classes.icon} /> : null
+ ));