1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
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";
12 export const COLLECTION_WEBDAV_S3_DIALOG_NAME = 'collectionWebdavS3Dialog';
14 export interface WebDavS3InfoDialogData {
18 collectionsUrl: string;
22 collectionName: string;
23 setActiveTab: (event: any, tabNr: number) => void;
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,
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)),