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";
11 export const COLLECTION_WEBDAV_S3_DIALOG_NAME = 'collectionWebdavS3Dialog';
13 export interface WebDavS3InfoDialogData {
17 collectionsUrl: string;
21 setActiveTab: (event: any, tabNr: number) => void;
24 export const openWebDavS3InfoDialog = (uuid: string, activeTab?: number) =>
25 async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
26 await dispatch<any>(getNewExtraToken(true));
27 dispatch(dialogActions.OPEN_DIALOG({
28 id: COLLECTION_WEBDAV_S3_DIALOG_NAME,
30 title: 'Access Collection using WebDAV or S3',
31 token: getState().auth.extraApiToken || getState().auth.apiToken,
32 downloadUrl: getState().auth.config.keepWebServiceUrl,
33 collectionsUrl: getState().auth.config.keepWebInlineServiceUrl,
34 localCluster: getState().auth.localCluster,
35 username: getState().auth.user!.username,
36 activeTab: activeTab || 0,
37 setActiveTab: (event: any, tabNr: number) => dispatch<any>(openWebDavS3InfoDialog(uuid, tabNr)),