--- /dev/null
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { bindDataExplorerActions } from "../data-explorer/data-explorer-action";
+import { FavoritePanelMiddlewareService } from "./favorite-panel-middleware-service";
+
+export const favoritePanelActions = bindDataExplorerActions(FavoritePanelMiddlewareService.getInstance());
// SPDX-License-Identifier: AGPL-3.0
import { DataExplorerMiddlewareService } from "../data-explorer/data-explorer-middleware-service";
-import { FAVORITE_PANEL_ID, columns, FavoritePanelFilter, FavoritePanelColumnNames } from "../../views/favorite-panel/favorite-panel";
+import { columns, FavoritePanelFilter, FavoritePanelColumnNames } from "../../views/favorite-panel/favorite-panel";
import { getDataExplorer } from "../data-explorer/data-explorer-reducer";
import { RootState } from "../store";
import { DataColumns } from "../../components/data-table/data-table";
import { SortDirection } from "../../components/data-table/data-column";
import { FilterBuilder } from "../../common/api/filter-builder";
import { LinkResource } from "../../models/link";
-import { dataExplorerActions } from "../data-explorer/data-explorer-action";
import { checkPresenceInFavorites } from "../favorites/favorites-actions";
+import { favoritePanelActions } from "./favorite-panel-action";
export class FavoritePanelMiddlewareService extends DataExplorerMiddlewareService {
}
get Id() {
- return FAVORITE_PANEL_ID;
+ return "favoritePanel";
}
get Columns() {
requestItems() {
const state = this.api.getState() as RootState;
- const dataExplorer = getDataExplorer(state.dataExplorer, FAVORITE_PANEL_ID);
+ const dataExplorer = getDataExplorer(state.dataExplorer, this.Id);
const columns = dataExplorer.columns as DataColumns<FavoritePanelItem, FavoritePanelFilter>;
const sortColumn = dataExplorer.columns.find(({ sortDirection }) => Boolean(sortDirection && sortDirection !== "none"));
const typeFilters = getColumnFilters(columns, FavoritePanelColumnNames.TYPE);
.addILike("name", dataExplorer.searchValue)
})
.then(response => {
- this.api.dispatch(dataExplorerActions.SET_ITEMS({
- id: FAVORITE_PANEL_ID,
+ this.api.dispatch(favoritePanelActions.SET_ITEMS({
items: response.items.map(resourceToDataItem),
itemsAvailable: response.itemsAvailable,
page: Math.floor(response.offset / response.limit),
this.api.dispatch<any>(checkPresenceInFavorites(response.items.map(item => item.uuid)));
});
} else {
- this.api.dispatch(dataExplorerActions.SET_ITEMS({
- id: FAVORITE_PANEL_ID,
+ this.api.dispatch(favoritePanelActions.SET_ITEMS({
items: [],
itemsAvailable: 0,
page: 0,
import { push } from "react-router-redux";
import { TreeItemStatus } from "../../components/tree/tree";
import { findTreeItem } from "../project/project-reducer";
-import { dataExplorerActions } from "../data-explorer/data-explorer-action";
-import { PROJECT_PANEL_ID } from "../../views/project-panel/project-panel";
import { RootState } from "../store";
import { Resource, ResourceKind } from "../../models/resource";
+import { projectPanelActions } from "../project-panel/project-panel-action";
export const getResourceUrl = <T extends Resource>(resource: T): string => {
switch (resource.kind) {
if (itemMode === ItemMode.OPEN || itemMode === ItemMode.BOTH) {
dispatch(projectActions.TOGGLE_PROJECT_TREE_ITEM_OPEN(treeItem.data.uuid));
}
- dispatch(dataExplorerActions.RESET_PAGINATION({id: PROJECT_PANEL_ID}));
- dispatch(dataExplorerActions.REQUEST_ITEMS({id: PROJECT_PANEL_ID}));
+ dispatch(projectPanelActions.RESET_PAGINATION());
+ dispatch(projectPanelActions.REQUEST_ITEMS());
}));
}
--- /dev/null
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { bindDataExplorerActions } from "../data-explorer/data-explorer-action";
+import { ProjectPanelMiddlewareService } from "./project-panel-middleware-service";
+
+export const projectPanelActions = bindDataExplorerActions(ProjectPanelMiddlewareService.getInstance());
// SPDX-License-Identifier: AGPL-3.0
import { DataExplorerMiddlewareService } from "../data-explorer/data-explorer-middleware-service";
-import { PROJECT_PANEL_ID, columns, ProjectPanelColumnNames, ProjectPanelFilter } from "../../views/project-panel/project-panel";
+import { columns, ProjectPanelColumnNames, ProjectPanelFilter } from "../../views/project-panel/project-panel";
import { getDataExplorer } from "../data-explorer/data-explorer-reducer";
import { RootState } from "../store";
import { DataColumns } from "../../components/data-table/data-table";
import { FilterBuilder } from "../../common/api/filter-builder";
import { ProcessResource } from "../../models/process";
import { GroupContentsResourcePrefix, GroupContentsResource } from "../../services/groups-service/groups-service";
-import { dataExplorerActions } from "../data-explorer/data-explorer-action";
import { checkPresenceInFavorites } from "../favorites/favorites-actions";
+import { projectPanelActions } from "./project-panel-action";
export class ProjectPanelMiddlewareService extends DataExplorerMiddlewareService {
}
get Id() {
- return PROJECT_PANEL_ID;
+ return "projectPanel";
}
get Columns() {
requestItems() {
const state = this.api.getState() as RootState;
- const dataExplorer = getDataExplorer(state.dataExplorer, PROJECT_PANEL_ID);
+ const dataExplorer = getDataExplorer(state.dataExplorer, this.Id);
const columns = dataExplorer.columns as DataColumns<ProjectPanelItem, ProjectPanelFilter>;
const typeFilters = getColumnFilters(columns, ProjectPanelColumnNames.TYPE);
const statusFilters = getColumnFilters(columns, ProjectPanelColumnNames.STATUS);
.concat(getSearchFilter(dataExplorer.searchValue))
})
.then(response => {
- this.api.dispatch(dataExplorerActions.SET_ITEMS({
- id: PROJECT_PANEL_ID,
+ this.api.dispatch(projectPanelActions.SET_ITEMS({
items: response.items.map(resourceToDataItem),
itemsAvailable: response.itemsAvailable,
page: Math.floor(response.offset / response.limit),
this.api.dispatch<any>(checkPresenceInFavorites(response.items.map(item => item.uuid)));
});
} else {
- this.api.dispatch(dataExplorerActions.SET_ITEMS({
- id: PROJECT_PANEL_ID,
+ this.api.dispatch(projectPanelActions.SET_ITEMS({
items: [],
itemsAvailable: 0,
page: 0,
import { sidePanelActions, SidePanelAction } from './side-panel-action';
import { SidePanelItem } from '../../components/side-panel/side-panel';
import { ProjectsIcon, ShareMeIcon, WorkflowIcon, RecentIcon, FavoriteIcon, TrashIcon } from "../../components/icon/icon";
-import { dataExplorerActions } from "../data-explorer/data-explorer-action";
import { Dispatch } from "redux";
-import { FAVORITE_PANEL_ID } from "../../views/favorite-panel/favorite-panel";
import { push } from "react-router-redux";
+import { favoritePanelActions } from "../favorite-panel/favorite-panel-action";
export type SidePanelState = SidePanelItem[];
active: false,
activeAction: (dispatch: Dispatch) => {
dispatch(push("/favorites"));
- dispatch(dataExplorerActions.RESET_PAGINATION({id: FAVORITE_PANEL_ID}));
- dispatch(dataExplorerActions.REQUEST_ITEMS({id: FAVORITE_PANEL_ID}));
+ dispatch(favoritePanelActions.RESET_PAGINATION());
+ dispatch(favoritePanelActions.REQUEST_ITEMS());
}
},
{
import { ContextMenuActionSet } from "../context-menu-action-set";
import { ToggleFavoriteAction } from "./favorite-action";
import { toggleFavorite } from "../../../store/favorites/favorites-actions";
-import { dataExplorerActions } from "../../../store/data-explorer/data-explorer-action";
-import { FAVORITE_PANEL_ID } from "../../../views/favorite-panel/favorite-panel";
+import { favoritePanelActions } from "../../../store/favorite-panel/favorite-panel-action";
export const favoriteActionSet: ContextMenuActionSet = [[{
component: ToggleFavoriteAction,
execute: (dispatch, resource) => {
dispatch<any>(toggleFavorite(resource)).then(() => {
- dispatch<any>(dataExplorerActions.REQUEST_ITEMS({ id : FAVORITE_PANEL_ID }));
+ dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
});
}
}]];
import { NewProjectIcon } from "../../../components/icon/icon";
import { ToggleFavoriteAction } from "./favorite-action";
import { toggleFavorite } from "../../../store/favorites/favorites-actions";
-import { dataExplorerActions } from "../../../store/data-explorer/data-explorer-action";
-import { FAVORITE_PANEL_ID } from "../../../views/favorite-panel/favorite-panel";
+import { favoritePanelActions } from "../../../store/favorite-panel/favorite-panel-action";
export const projectActionSet: ContextMenuActionSet = [[{
icon: NewProjectIcon,
component: ToggleFavoriteAction,
execute: (dispatch, resource) => {
dispatch<any>(toggleFavorite(resource)).then(() => {
- dispatch<any>(dataExplorerActions.REQUEST_ITEMS({ id : FAVORITE_PANEL_ID }));
+ dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
});
}
}]];
import { RootState } from "../../store/store";
import { DialogProjectCreate } from "../dialog-create/dialog-project-create";
import { projectActions, createProject, getProjectList } from "../../store/project/project-action";
-import { dataExplorerActions } from "../../store/data-explorer/data-explorer-action";
-import { PROJECT_PANEL_ID } from "../../views/project-panel/project-panel";
+import { projectPanelActions } from "../../store/project-panel/project-panel-action";
const mapStateToProps = (state: RootState) => ({
open: state.projects.creator.opened
(dispatch: Dispatch, getState: () => RootState) => {
const { ownerUuid } = getState().projects.creator;
return dispatch<any>(createProject(data)).then(() => {
- dispatch(dataExplorerActions.REQUEST_ITEMS({ id: PROJECT_PANEL_ID }));
+ dispatch(projectPanelActions.REQUEST_ITEMS());
dispatch<any>(getProjectList(ownerUuid));
});
};
import { resourceLabel } from '../../common/labels';
import { ArvadosTheme } from '../../common/custom-theme';
import { renderName, renderStatus, renderType, renderOwner, renderFileSize, renderDate } from '../../views-components/data-explorer/renderers';
+import { FavoritePanelMiddlewareService } from '../../store/favorite-panel/favorite-panel-middleware-service';
type CssRules = "toolbar" | "button";
}
];
-export const FAVORITE_PANEL_ID = "favoritePanel";
-
interface FavoritePanelDataProps {
currentItemId: string;
}
class extends React.Component<FavoritePanelProps> {
render() {
return <DataExplorer
- id={FAVORITE_PANEL_ID}
+ id={FavoritePanelMiddlewareService.getInstance().Id}
onRowClick={this.props.onItemClick}
onRowDoubleClick={this.props.onItemDoubleClick}
onContextMenu={this.props.onContextMenu}
import { resourceLabel } from '../../common/labels';
import { ArvadosTheme } from '../../common/custom-theme';
import { renderName, renderStatus, renderType, renderOwner, renderFileSize, renderDate } from '../../views-components/data-explorer/renderers';
+import { ProjectPanelMiddlewareService } from '../../store/project-panel/project-panel-middleware-service';
type CssRules = "toolbar" | "button";
}
];
-export const PROJECT_PANEL_ID = "projectPanel";
-
interface ProjectPanelDataProps {
currentItemId: string;
}
</Button>
</div>
<DataExplorer
- id={PROJECT_PANEL_ID}
+ id={ProjectPanelMiddlewareService.getInstance().Id}
onRowClick={this.props.onItemClick}
onRowDoubleClick={this.props.onItemDoubleClick}
onContextMenu={this.props.onContextMenu}
import { detailsPanelActions, loadDetails } from "../../store/details-panel/details-panel-action";
import { contextMenuActions } from "../../store/context-menu/context-menu-actions";
-import { sidePanelData, SidePanelIdentifiers } from '../../store/side-panel/side-panel-reducer';
+import { SidePanelIdentifiers } from '../../store/side-panel/side-panel-reducer';
import { ProjectResource } from '../../models/project';
import { ResourceKind } from '../../models/resource';
import { ContextMenu, ContextMenuKind } from "../../views-components/context-menu/context-menu";
-import { FavoritePanel, FAVORITE_PANEL_ID } from "../favorite-panel/favorite-panel";
+import { FavoritePanel } from "../favorite-panel/favorite-panel";
import { CurrentTokenDialog } from '../../views-components/current-token-dialog/current-token-dialog';
-import { dataExplorerActions } from '../../store/data-explorer/data-explorer-action';
import { Snackbar } from '../../views-components/snackbar/snackbar';
+import { favoritePanelActions } from '../../store/favorite-panel/favorite-panel-action';
const drawerWidth = 240;
const appBarHeight = 100;
{...props} />
renderFavoritePanel = (props: RouteComponentProps<{ id: string }>) => <FavoritePanel
- onItemRouteChange={() => this.props.dispatch<any>(dataExplorerActions.REQUEST_ITEMS({ id: FAVORITE_PANEL_ID }))}
+ onItemRouteChange={() => this.props.dispatch<any>(favoritePanelActions.REQUEST_ITEMS())}
onContextMenu={(event, item) => {
const kind = item.kind === ResourceKind.PROJECT ? ContextMenuKind.PROJECT : ContextMenuKind.RESOURCE;
this.openContextMenu(event, {