19231: Add smaller page sizes (10 and 20 items) to load faster
[arvados-workbench2.git] / src / store / collections / collection-info-actions.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { Dispatch } from "redux";
6 import { RootState } from "store/store";
7 import { ServiceRepository } from "services/services";
8 import { dialogActions } from 'store/dialog/dialog-actions';
9 import { getNewExtraToken } from "../auth/auth-action";
10 import { CollectionResource } from "models/collection";
11
12 export const COLLECTION_WEBDAV_S3_DIALOG_NAME = 'collectionWebdavS3Dialog';
13
14 export interface WebDavS3InfoDialogData {
15     uuid: string;
16     token: string;
17     downloadUrl: string;
18     collectionsUrl: string;
19     localCluster: string;
20     username: string;
21     activeTab: number;
22     collectionName: string;
23     setActiveTab: (event: any, tabNr: number) => void;
24 }
25
26 export const openWebDavS3InfoDialog = (uuid: string, activeTab?: number) =>
27     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
28         await dispatch<any>(getNewExtraToken(true));
29         dispatch(dialogActions.OPEN_DIALOG({
30             id: COLLECTION_WEBDAV_S3_DIALOG_NAME,
31             data: {
32                 title: 'Open with 3rd party client',
33                 token: getState().auth.extraApiToken || getState().auth.apiToken,
34                 downloadUrl: getState().auth.config.keepWebServiceUrl,
35                 collectionsUrl: getState().auth.config.keepWebInlineServiceUrl,
36                 localCluster: getState().auth.localCluster,
37                 username: getState().auth.user!.username,
38                 activeTab: activeTab || 0,
39                 collectionName: (getState().resources[uuid] as CollectionResource).name,
40                 setActiveTab: (event: any, tabNr: number) => dispatch<any>(openWebDavS3InfoDialog(uuid, tabNr)),
41                 uuid
42             }
43         }));
44     };