Merge branch '14434-display-workflow-name'
authorPawel Kromplewski <pawel.kromplewski@contractors.roche.com>
Tue, 18 Dec 2018 13:25:31 +0000 (14:25 +0100)
committerPawel Kromplewski <pawel.kromplewski@contractors.roche.com>
Tue, 18 Dec 2018 13:25:31 +0000 (14:25 +0100)
refs #14434

Arvados-DCO-1.1-Signed-off-by: Pawel Kromplewski <pawel.kromplewski@contractors.roche.com>

77 files changed:
README.md
package.json
public/file-viewers-example.json [new file with mode: 0644]
src/common/config.ts
src/components/autocomplete/autocomplete.tsx
src/components/context-menu/context-menu.tsx
src/components/data-explorer/data-explorer.tsx
src/components/icon/icon.tsx
src/components/text-field/text-field.tsx
src/index.tsx
src/models/client-authorization.ts [new file with mode: 0644]
src/models/file-viewers-config.ts [new file with mode: 0644]
src/models/link.ts
src/models/session.ts [new file with mode: 0644]
src/routes/route-change-handlers.ts
src/routes/routes.ts
src/services/api/filter-builder.ts
src/services/auth-service/auth-service.ts
src/services/collection-service/collection-service.ts
src/services/file-viewers-config-service/file-viewers-config-service.ts [new file with mode: 0644]
src/services/services.ts
src/store/auth/auth-action-session.ts [new file with mode: 0644]
src/store/auth/auth-action-ssh.ts [new file with mode: 0644]
src/store/auth/auth-action.test.ts [moved from src/store/auth/auth-actions.test.ts with 77% similarity]
src/store/auth/auth-action.ts
src/store/auth/auth-reducer.test.ts
src/store/auth/auth-reducer.ts
src/store/breadcrumbs/breadcrumbs-actions.ts
src/store/file-viewers/file-viewers-actions.ts [new file with mode: 0644]
src/store/file-viewers/file-viewers-selectors.ts [new file with mode: 0644]
src/store/group-details-panel/group-details-panel-actions.ts [new file with mode: 0644]
src/store/group-details-panel/group-details-panel-middleware-service.ts [new file with mode: 0644]
src/store/groups-panel/groups-panel-actions.ts [new file with mode: 0644]
src/store/groups-panel/groups-panel-middleware-service.ts [new file with mode: 0644]
src/store/navigation/navigation-action.ts
src/store/store.ts
src/store/workbench/workbench-actions.ts
src/validators/is-remote-host.tsx [new file with mode: 0644]
src/validators/min-length.tsx [new file with mode: 0644]
src/validators/validators.tsx
src/views-components/api-token/api-token.tsx
src/views-components/context-menu/action-sets/collection-files-item-action-set.ts
src/views-components/context-menu/action-sets/group-action-set.ts [new file with mode: 0644]
src/views-components/context-menu/action-sets/group-member-action-set.ts [new file with mode: 0644]
src/views-components/context-menu/action-sets/ssh-key-action-set.ts
src/views-components/context-menu/actions/file-viewer-actions.tsx [new file with mode: 0644]
src/views-components/context-menu/context-menu.tsx
src/views-components/data-explorer/data-explorer.tsx
src/views-components/dialog-create/dialog-ssh-key-create.tsx
src/views-components/dialog-forms/add-group-member-dialog.tsx [new file with mode: 0644]
src/views-components/dialog-forms/create-group-dialog.tsx [new file with mode: 0644]
src/views-components/dialog-forms/create-ssh-key-dialog.ts
src/views-components/form-fields/search-bar-form-fields.tsx
src/views-components/groups-dialog/attributes-dialog.tsx [new file with mode: 0644]
src/views-components/groups-dialog/member-attributes-dialog.tsx [new file with mode: 0644]
src/views-components/groups-dialog/member-remove-dialog.ts [new file with mode: 0644]
src/views-components/groups-dialog/remove-dialog.ts [new file with mode: 0644]
src/views-components/main-app-bar/account-menu.tsx
src/views-components/main-app-bar/admin-menu.tsx
src/views-components/main-app-bar/help-menu.tsx
src/views-components/main-content-bar/main-content-bar.tsx
src/views-components/rename-file-dialog/rename-file-dialog.tsx
src/views-components/resource-properties-form/property-key-field.tsx
src/views-components/resource-properties-form/property-value-field.tsx
src/views-components/search-bar/search-bar-view.tsx
src/views-components/sharing-dialog/people-select.tsx
src/views-components/side-panel/side-panel.tsx
src/views-components/ssh-keys-dialog/attributes-dialog.tsx
src/views-components/ssh-keys-dialog/public-key-dialog.tsx
src/views-components/ssh-keys-dialog/remove-dialog.tsx
src/views/group-details-panel/group-details-panel.tsx [new file with mode: 0644]
src/views/groups-panel/groups-panel.tsx [new file with mode: 0644]
src/views/site-manager-panel/site-manager-panel-root.tsx [new file with mode: 0644]
src/views/site-manager-panel/site-manager-panel.tsx [new file with mode: 0644]
src/views/ssh-key-panel/ssh-key-panel.tsx
src/views/workbench/workbench.tsx
yarn.lock

index e8d77701107179a6ef88fcfb68cd47d857a321a9..425d1787848e5b9dad4e077eed23b2f73aea47ea 100644 (file)
--- a/README.md
+++ b/README.md
@@ -41,7 +41,8 @@ Currently this configuration schema is supported:
 ```
 {
     "API_HOST": "string",
-    "VOCABULARY_URL": "string"
+    "VOCABULARY_URL": "string",
+    "FILE_VIEWERS_CONFIG_URL": "string",
 }
 ```
 
@@ -49,6 +50,13 @@ Currently this configuration schema is supported:
 Local path, or any URL that allows cross-origin requests. See 
 [Vocabulary JSON file example](public/vocabulary-example.json).
 
+### FILE_VIEWERS_CONFIG_URL
+Local path, or any URL that allows cross-origin requests. See:
+
+[File viewers config file example](public/file-viewers-example.json)
+
+[File viewers config scheme](src/models/file-viewers-config.ts)
+
 ### Licensing
 
 Arvados is Free Software. See COPYING for information about Arvados Free
index 1332630471dccf4c6baf093905c74cd525880bfc..46b3ee4f46d34bdc8bf84d16b4e206249a2f7090 100644 (file)
@@ -7,6 +7,7 @@
     "@material-ui/icons": "3.0.1",
     "@types/debounce": "3.0.0",
     "@types/js-yaml": "3.11.2",
+    "@types/jssha": "0.0.29",
     "@types/lodash": "4.14.116",
     "@types/react-copy-to-clipboard": "4.2.6",
     "@types/react-dnd": "3.0.2",
@@ -21,6 +22,7 @@
     "debounce": "1.2.0",
     "is-image": "2.0.0",
     "js-yaml": "3.12.0",
+    "jssha": "2.3.1",
     "lodash": "4.17.11",
     "react": "16.5.2",
     "react-copy-to-clipboard": "5.0.1",
diff --git a/public/file-viewers-example.json b/public/file-viewers-example.json
new file mode 100644 (file)
index 0000000..27adb70
--- /dev/null
@@ -0,0 +1,25 @@
+[
+    {
+        "name": "File browser",
+        "extensions": [
+            ".txt",
+            ".zip"
+        ],
+        "url": "https://doc.arvados.org",
+        "filePathParam": "filePath",
+        "iconUrl": "https://material.io/tools/icons/static/icons/baseline-next_week-24px.svg"
+    },
+    {
+        "name": "Collection browser",
+        "extensions": [],
+        "collections": true,
+        "url": "https://doc.arvados.org",
+        "filePathParam": "collectionPath"
+    },
+    {
+        "name": "Universal browser",
+        "collections": true,
+        "url": "https://doc.arvados.org",
+        "filePathParam": "filePath"
+    }
+]
\ No newline at end of file
index b7b89bd9e4930100188725b7f117f67abf076587..3961d5aa2496fec7fbba912a96738f1bc15b8b5d 100644 (file)
@@ -35,7 +35,9 @@ export interface Config {
     packageVersion: string;
     parameters: {};
     protocol: string;
-    remoteHosts: string;
+    remoteHosts: {
+        [key: string]: string
+    };
     remoteHostsViaDNS: boolean;
     resources: {};
     revision: string;
@@ -50,6 +52,7 @@ export interface Config {
     websocketUrl: string;
     workbenchUrl: string;
     vocabularyUrl: string;
+    fileViewersConfigUrl: string;
 }
 
 export const fetchConfig = () => {
@@ -59,10 +62,15 @@ export const fetchConfig = () => {
         .catch(() => Promise.resolve(getDefaultConfig()))
         .then(config => Axios
             .get<Config>(getDiscoveryURL(config.API_HOST))
-            .then(response => ({ 
+            .then(response => ({
                 // TODO: After tests delete `|| '/vocabulary-example.json'`
-                config: {...response.data, vocabularyUrl: config.VOCABULARY_URL || '/vocabulary-example.json' }, 
-                apiHost: config.API_HOST, 
+                // TODO: After tests delete `|| '/file-viewers-example.json'`
+                config: {
+                    ...response.data,
+                    vocabularyUrl: config.VOCABULARY_URL || '/vocabulary-example.json',
+                    fileViewersConfigUrl: config.FILE_VIEWERS_CONFIG_URL || '/file-viewers-example.json'
+                },
+                apiHost: config.API_HOST,
             })));
 
 };
@@ -96,7 +104,7 @@ export const mockConfig = (config: Partial<Config>): Config => ({
     packageVersion: '',
     parameters: {},
     protocol: '',
-    remoteHosts: '',
+    remoteHosts: {},
     remoteHostsViaDNS: false,
     resources: {},
     revision: '',
@@ -111,17 +119,21 @@ export const mockConfig = (config: Partial<Config>): Config => ({
     websocketUrl: '',
     workbenchUrl: '',
     vocabularyUrl: '',
+    fileViewersConfigUrl: '',
     ...config
 });
 
 interface ConfigJSON {
     API_HOST: string;
     VOCABULARY_URL: string;
+    FILE_VIEWERS_CONFIG_URL: string;
 }
 
 const getDefaultConfig = (): ConfigJSON => ({
     API_HOST: process.env.REACT_APP_ARVADOS_API_HOST || "",
     VOCABULARY_URL: "",
+    FILE_VIEWERS_CONFIG_URL: "",
 });
 
-const getDiscoveryURL = (apiHost: string) => `${window.location.protocol}//${apiHost}/discovery/v1/apis/arvados/v1/rest`;
+export const DISCOVERY_URL = 'discovery/v1/apis/arvados/v1/rest';
+const getDiscoveryURL = (apiHost: string) => `${window.location.protocol}//${apiHost}/${DISCOVERY_URL}`;
index c5811bb6ea716b44692752c68d7f630d61208e7f..4b19b77115b388e3613c6004013ef6501aded2b6 100644 (file)
@@ -15,6 +15,7 @@ export interface AutocompleteProps<Item, Suggestion> {
     suggestions?: Suggestion[];
     error?: boolean;
     helperText?: string;
+    autofocus?: boolean;
     onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
     onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
     onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
@@ -29,6 +30,7 @@ export interface AutocompleteState {
     suggestionsOpen: boolean;
     selectedSuggestionIndex: number;
 }
+
 export class Autocomplete<Value, Suggestion> extends React.Component<AutocompleteProps<Value, Suggestion>, AutocompleteState> {
 
     state = {
@@ -59,6 +61,7 @@ export class Autocomplete<Value, Suggestion> extends React.Component<Autocomplet
 
     renderInput() {
         return <Input
+            autoFocus={this.props.autofocus}
             inputRef={this.inputRef}
             value={this.props.value}
             startAdornment={this.renderChips()}
@@ -124,7 +127,7 @@ export class Autocomplete<Value, Suggestion> extends React.Component<Autocomplet
         if (event.key === 'Enter') {
             if (this.isSuggestionBoxOpen() && selectedSuggestionIndex < suggestions.length) {
                 // prevent form submissions when selecting a suggestion
-                event.preventDefault(); 
+                event.preventDefault();
                 onSelect(suggestions[selectedSuggestionIndex]);
             } else if (this.props.value.length > 0) {
                 onCreate();
@@ -149,6 +152,16 @@ export class Autocomplete<Value, Suggestion> extends React.Component<Autocomplet
 
     renderChips() {
         const { items, onDelete } = this.props;
+
+        /**
+         * If input startAdornment prop is not undefined, input's label will stay above the input.
+         * If there is not items, we want the label to go back to placeholder position.
+         * That why we return without a value instead of returning a result of a _map_ which is an empty array.
+         */
+        if (items.length === 0) {
+            return;
+        }
+
         return items.map(
             (item, index) =>
                 <Chip
index 4068251bdc04c82487cbf141fbdea910692496a8..98456dad51369c8efd240cb4249cbd734ba85de5 100644 (file)
@@ -53,7 +53,11 @@ export class ContextMenu extends React.PureComponent<ContextMenuProps> {
                                             {item.name}
                                         </ListItemText>}
                                 </ListItem>)}
-                        {groupIndex < items.length - 1 && <Divider />}
+                        {
+                            items[groupIndex + 1] &&
+                            items[groupIndex + 1].length > 0 &&
+                            <Divider />
+                        }
                     </React.Fragment>)}
             </List>
         </Popover>;
index 4175fbc6f23ccc3e18d50a7b70a0dc13808d4fe2..b6ca215d56463ec7f7ba3742ae06f5105ffa69ad 100644 (file)
@@ -49,6 +49,7 @@ interface DataExplorerDataProps<T> {
     paperProps?: PaperProps;
     actions?: React.ReactNode;
     hideSearchInput?: boolean;
+    paperKey?: string;
 }
 
 interface DataExplorerActionProps<T> {
@@ -79,9 +80,10 @@ export const DataExplorer = withStyles(styles)(
                 columns, onContextMenu, onFiltersChange, onSortToggle, working, extractKey,
                 rowsPerPage, rowsPerPageOptions, onColumnToggle, searchValue, onSearch,
                 items, itemsAvailable, onRowClick, onRowDoubleClick, classes,
-                dataTableDefaultView, hideColumnSelector, actions, paperProps, hideSearchInput
+                dataTableDefaultView, hideColumnSelector, actions, paperProps, hideSearchInput,
+                paperKey
             } = this.props;
-            return <Paper className={classes.root} {...paperProps}>
+            return <Paper className={classes.root} {...paperProps} key={paperKey}>
                 <Toolbar className={classes.toolbar}>
                     <Grid container justify="space-between" wrap="nowrap" alignItems="center">
                         {!hideSearchInput && <div className={classes.searchBox}>
@@ -105,8 +107,7 @@ export const DataExplorer = withStyles(styles)(
                     onSortToggle={onSortToggle}
                     extractKey={extractKey}
                     working={working}
-                    defaultView={dataTableDefaultView}
-                />
+                    defaultView={dataTableDefaultView} />
                 <Toolbar className={classes.footer}>
                     <Grid container justify="flex-end">
                         <TablePagination
index c077f7a675ceaf10662c20e885160050fd5d10a9..2bd16970614aab64c2de5d5306fc90e15e6a5de9 100644 (file)
@@ -38,6 +38,7 @@ import MoreVert from '@material-ui/icons/MoreVert';
 import Mail from '@material-ui/icons/Mail';
 import MoveToInbox from '@material-ui/icons/MoveToInbox';
 import Notifications from '@material-ui/icons/Notifications';
+import OpenInNew from '@material-ui/icons/OpenInNew';
 import People from '@material-ui/icons/People';
 import Person from '@material-ui/icons/Person';
 import PersonAdd from '@material-ui/icons/PersonAdd';
@@ -83,6 +84,7 @@ export const MoreOptionsIcon: IconType = (props) => <MoreVert {...props} />;
 export const MoveToIcon: IconType = (props) => <Input {...props} />;
 export const NewProjectIcon: IconType = (props) => <CreateNewFolder {...props} />;
 export const NotificationIcon: IconType = (props) => <Notifications {...props} />;
+export const OpenIcon: IconType = (props) => <OpenInNew {...props} />;
 export const OutputIcon: IconType = (props) => <MoveToInbox {...props} />;
 export const PaginationDownIcon: IconType = (props) => <ArrowDropDown {...props} />;
 export const PaginationLeftArrowIcon: IconType = (props) => <ChevronLeft {...props} />;
index 627e004d8b5bc607f6b92c673df92cbdb226fd57..93c4080f0fead0c7330f0a65a6824bdb628da8e1 100644 (file)
@@ -5,8 +5,15 @@
 import * as React from 'react';
 import { WrappedFieldProps } from 'redux-form';
 import { ArvadosTheme } from '~/common/custom-theme';
-import { TextField as MaterialTextField, StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core';
+import {
+    TextField as MaterialTextField,
+    StyleRulesCallback,
+    WithStyles,
+    withStyles,
+    PropTypes
+} from '@material-ui/core';
 import RichTextEditor from 'react-rte';
+import Margin = PropTypes.Margin;
 
 type CssRules = 'textField';
 
@@ -18,8 +25,8 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
 
 type TextFieldProps = WrappedFieldProps & WithStyles<CssRules>;
 
-export const TextField = withStyles(styles)((props: TextFieldProps & { 
-    label?: string, autoFocus?: boolean, required?: boolean, select?: boolean, disabled?: boolean, children: React.ReactNode
+export const TextField = withStyles(styles)((props: TextFieldProps & {
+    label?: string, autoFocus?: boolean, required?: boolean, select?: boolean, disabled?: boolean, children: React.ReactNode, margin?: Margin, placeholder?: string
 }) =>
     <MaterialTextField
         helperText={props.meta.touched && props.meta.error}
@@ -33,6 +40,8 @@ export const TextField = withStyles(styles)((props: TextFieldProps & {
         required={props.required}
         select={props.select}
         children={props.children}
+        margin={props.margin}
+        placeholder={props.placeholder}
         {...props.input}
     />);
 
@@ -78,4 +87,4 @@ export const DateTextField = withStyles(styles)
             onChange={props.input.onChange}
             value={props.input.value}
         />
-    );
\ No newline at end of file
+    );
index e73f08c46ba8b48d2fab54bd5cbe0de89fb3b753..1561c3ff1d4b6a1b2af0edc968df003def00c84d 100644 (file)
@@ -56,7 +56,10 @@ import { virtualMachineActionSet } from '~/views-components/context-menu/action-
 import { userActionSet } from '~/views-components/context-menu/action-sets/user-action-set';
 import { computeNodeActionSet } from '~/views-components/context-menu/action-sets/compute-node-action-set';
 import { apiClientAuthorizationActionSet } from '~/views-components/context-menu/action-sets/api-client-authorization-action-set';
+import { groupActionSet } from '~/views-components/context-menu/action-sets/group-action-set';
+import { groupMemberActionSet } from '~/views-components/context-menu/action-sets/group-member-action-set';
 import { linkActionSet } from '~/views-components/context-menu/action-sets/link-action-set';
+import { loadFileViewersConfig } from '~/store/file-viewers/file-viewers-actions';
 
 console.log(`Starting arvados [${getBuildInfo()}]`);
 
@@ -81,6 +84,8 @@ addMenuActionSet(ContextMenuKind.USER, userActionSet);
 addMenuActionSet(ContextMenuKind.LINK, linkActionSet);
 addMenuActionSet(ContextMenuKind.NODE, computeNodeActionSet);
 addMenuActionSet(ContextMenuKind.API_CLIENT_AUTHORIZATION, apiClientAuthorizationActionSet);
+addMenuActionSet(ContextMenuKind.GROUPS, groupActionSet);
+addMenuActionSet(ContextMenuKind.GROUP_MEMBER, groupMemberActionSet);
 
 fetchConfig()
     .then(({ config, apiHost }) => {
@@ -97,13 +102,14 @@ fetchConfig()
         const store = configureStore(history, services);
 
         store.subscribe(initListener(history, store, services, config));
-        store.dispatch(initAuth());
+        store.dispatch(initAuth(config));
         store.dispatch(setBuildInfo());
         store.dispatch(setCurrentTokenDialogApiHost(apiHost));
         store.dispatch(setUuidPrefix(config.uuidPrefix));
         store.dispatch(loadVocabulary);
+        store.dispatch(loadFileViewersConfig);
 
-        const TokenComponent = (props: any) => <ApiToken authService={services.authService} {...props} />;
+        const TokenComponent = (props: any) => <ApiToken authService={services.authService} config={config} {...props} />;
         const MainPanelComponent = (props: any) => <MainPanel {...props} />;
 
         const App = () =>
diff --git a/src/models/client-authorization.ts b/src/models/client-authorization.ts
new file mode 100644 (file)
index 0000000..767916e
--- /dev/null
@@ -0,0 +1,12 @@
+export interface ClientAuthorizationResource {
+    uuid: string;
+    apiToken: string;
+    apiClientId: number;
+    userId: number;
+    createdByIpAddress: string;
+    lastUsedByIpAddress: string;
+    lastUsedAt: string;
+    expiresAt: string;
+    ownerUuid: string;
+    scopes: string[];
+}
diff --git a/src/models/file-viewers-config.ts b/src/models/file-viewers-config.ts
new file mode 100644 (file)
index 0000000..e95116b
--- /dev/null
@@ -0,0 +1,47 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+export type FileViewerList = FileViewer[];
+
+export interface FileViewer {
+    /**
+     * Name is used as a label in file's context menu
+     */
+    name: string;
+
+    /**
+     * Limits files for which viewer is enabled
+     * If not given, viewer will be enabled for all files
+     * Viewer is enabled if file name ends with an extension.
+     * 
+     * Example: `['.zip', '.tar.gz', 'bam']`
+     */
+    extensions?: string[];
+
+    /**
+     * Determines whether a viewer is enabled for collections.
+     */
+    collections?: boolean;
+
+    /**
+     * URL that redirects to a viewer 
+     * Example: `https://bam-viewer.com`
+     */
+    url: string;
+
+    /**
+     * Name of a search param that will be used to send file's path to a viewer
+     * Example: 
+     * 
+     * `{ filePathParam: 'filePath' }`
+     * 
+     * `https://bam-viewer.com?filePath=/path/to/file`
+     */
+    filePathParam: string;
+
+    /**
+     * Icon that will display next to a label
+     */
+    iconUrl?: string;
+}
index d931f7f21898b394b2b2efb73349838e533532a8..785d531cf7d609fec3af696d16c3fbb9028753a4 100644 (file)
@@ -2,9 +2,8 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import { Resource } from "./resource";
 import { TagProperty } from "~/models/tag";
-import { ResourceKind } from '~/models/resource';
+import { Resource, ResourceKind } from '~/models/resource';
 
 export interface LinkResource extends Resource {
     headUuid: string;
@@ -14,6 +13,7 @@ export interface LinkResource extends Resource {
     linkClass: string;
     name: string;
     properties: TagProperty;
+    kind: ResourceKind.LINK;
 }
 
 export enum LinkClass {
diff --git a/src/models/session.ts b/src/models/session.ts
new file mode 100644 (file)
index 0000000..9a94296
--- /dev/null
@@ -0,0 +1,21 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+export enum SessionStatus {
+    INVALIDATED,
+    BEING_VALIDATED,
+    VALIDATED
+}
+
+export interface Session {
+    clusterId: string;
+    remoteHost: string;
+    baseUrl: string;
+    username: string;
+    email: string;
+    token: string;
+    loggedIn: boolean;
+    status: SessionStatus;
+    active: boolean;
+}
index 655c806f3a3b0337cc1a89eccae6b7a29ddaa832..bb88f4a1aff5c33173d9526a9d74753f25a53abf 100644 (file)
@@ -8,6 +8,8 @@ import * as Routes from '~/routes/routes';
 import * as WorkbenchActions from '~/store/workbench/workbench-actions';
 import { navigateToRootProject } from '~/store/navigation/navigation-action';
 import { dialogActions } from '~/store/dialog/dialog-actions';
+import { contextMenuActions } from '~/store/context-menu/context-menu-actions';
+import { searchBarActions } from '~/store/search-bar/search-bar-actions';
 
 export const addRouteChangeHandlers = (history: History, store: RootStore) => {
     const handler = handleLocationChange(store);
@@ -32,14 +34,19 @@ const handleLocationChange = (store: RootStore) => ({ pathname }: Location) => {
     const workflowMatch = Routes.matchWorkflowRoute(pathname);
     const sshKeysUserMatch = Routes.matchSshKeysUserRoute(pathname);
     const sshKeysAdminMatch = Routes.matchSshKeysAdminRoute(pathname);
+    const siteManagerMatch = Routes.matchSiteManagerRoute(pathname);
     const keepServicesMatch = Routes.matchKeepServicesRoute(pathname);
     const computeNodesMatch = Routes.matchComputeNodesRoute(pathname);
     const apiClientAuthorizationsMatch = Routes.matchApiClientAuthorizationsRoute(pathname);
     const myAccountMatch = Routes.matchMyAccountRoute(pathname);
     const userMatch = Routes.matchUsersRoute(pathname);
+    const groupsMatch = Routes.matchGroupsRoute(pathname);
+    const groupDetailsMatch = Routes.matchGroupDetailsRoute(pathname);
     const linksMatch = Routes.matchLinksRoute(pathname);
 
     store.dispatch(dialogActions.CLOSE_ALL_DIALOGS());
+    store.dispatch(contextMenuActions.CLOSE_CONTEXT_MENU());
+    store.dispatch(searchBarActions.CLOSE_SEARCH_VIEW());
 
     if (projectMatch) {
         store.dispatch(WorkbenchActions.loadProject(projectMatch.params.id));
@@ -73,6 +80,8 @@ const handleLocationChange = (store: RootStore) => ({ pathname }: Location) => {
         store.dispatch(WorkbenchActions.loadSshKeys);
     } else if (sshKeysAdminMatch) {
         store.dispatch(WorkbenchActions.loadSshKeys);
+    } else if (siteManagerMatch) {
+        store.dispatch(WorkbenchActions.loadSiteManager);
     } else if (keepServicesMatch) {
         store.dispatch(WorkbenchActions.loadKeepServices);
     } else if (computeNodesMatch) {
@@ -83,6 +92,10 @@ const handleLocationChange = (store: RootStore) => ({ pathname }: Location) => {
         store.dispatch(WorkbenchActions.loadMyAccount);
     } else if (userMatch) {
         store.dispatch(WorkbenchActions.loadUsers);
+    } else if (groupsMatch) {
+        store.dispatch(WorkbenchActions.loadGroupsPanel);
+    } else if (groupDetailsMatch) {
+        store.dispatch(WorkbenchActions.loadGroupDetailsPanel(groupDetailsMatch.params.id));
     } else if (linksMatch) {
         store.dispatch(WorkbenchActions.loadLinks);
     }
index 05f6663fe3c2bbb8021423249e5e045263ab3be7..b1da949652e60d0046e5487de5aa8f6279243bb2 100644 (file)
@@ -25,11 +25,14 @@ export const Routes = {
     SEARCH_RESULTS: '/search-results',
     SSH_KEYS_ADMIN: `/ssh-keys-admin`,
     SSH_KEYS_USER: `/ssh-keys-user`,
+    SITE_MANAGER: `/site-manager`,
     MY_ACCOUNT: '/my-account',
     KEEP_SERVICES: `/keep-services`,
     COMPUTE_NODES: `/nodes`,
     USERS: '/users',
     API_CLIENT_AUTHORIZATIONS: `/api_client_authorizations`,
+    GROUPS: '/groups',
+    GROUP_DETAILS: `/group/:id(${RESOURCE_UUID_PATTERN})`,
     LINKS: '/links'
 };
 
@@ -51,6 +54,8 @@ export const getProcessUrl = (uuid: string) => `/processes/${uuid}`;
 
 export const getProcessLogUrl = (uuid: string) => `/process-logs/${uuid}`;
 
+export const getGroupUrl = (uuid: string) => `/group/${uuid}`;
+
 export interface ResourceRouteParams {
     id: string;
 }
@@ -103,6 +108,9 @@ export const matchSshKeysUserRoute = (route: string) =>
 export const matchSshKeysAdminRoute = (route: string) =>
     matchPath(route, { path: Routes.SSH_KEYS_ADMIN });
 
+export const matchSiteManagerRoute = (route: string) =>
+    matchPath(route, { path: Routes.SITE_MANAGER });
+
 export const matchMyAccountRoute = (route: string) =>
     matchPath(route, { path: Routes.MY_ACCOUNT });
 
@@ -118,5 +126,11 @@ export const matchComputeNodesRoute = (route: string) =>
 export const matchApiClientAuthorizationsRoute = (route: string) =>
     matchPath(route, { path: Routes.API_CLIENT_AUTHORIZATIONS });
 
+export const matchGroupsRoute = (route: string) =>
+    matchPath(route, { path: Routes.GROUPS });
+
+export const matchGroupDetailsRoute = (route: string) =>
+    matchPath<ResourceRouteParams>(route, { path: Routes.GROUP_DETAILS });
+    
 export const matchLinksRoute = (route: string) =>
-    matchPath(route, { path: Routes.LINKS });
\ No newline at end of file
+    matchPath(route, { path: Routes.LINKS });
index 08746c81b9ee1d91736b4e9e09eb79b820bd916f..4b3db9fa2b92bb976a577a7e0eb2ee8de4161ab5 100644 (file)
@@ -11,8 +11,8 @@ export function joinFilters(filters0?: string, filters1?: string) {
 export class FilterBuilder {
     constructor(private filters = "") { }
 
-    public addEqual(field: string, value?: string | boolean, resourcePrefix?: string) {
-        return this.addCondition(field, "=", value, "", "", resourcePrefix );
+    public addEqual(field: string, value?: string | boolean | null, resourcePrefix?: string) {
+        return this.addCondition(field, "=", value, "", "", resourcePrefix);
     }
 
     public addLike(field: string, value?: string, resourcePrefix?: string) {
@@ -59,13 +59,13 @@ export class FilterBuilder {
         return this.filters;
     }
 
-    private addCondition(field: string, cond: string, value?: string | string[] | boolean, prefix: string = "", postfix: string = "", resourcePrefix?: string) {
-        if (value) {
+    private addCondition(field: string, cond: string, value?: string | string[] | boolean | null, prefix: string = "", postfix: string = "", resourcePrefix?: string) {
+        if (value !== undefined) {
             if (typeof value === "string") {
                 value = `"${prefix}${value}${postfix}"`;
             } else if (Array.isArray(value)) {
                 value = `["${value.join(`","`)}"]`;
-            } else {
+            } else if (value !== null) {
                 value = value ? "true" : "false";
             }
 
index 22c9dcd6ae3e36e495f25a9e152f9a489506efdc..8601e2084def92f70cc82794ae19ad3b24353c5c 100644 (file)
@@ -2,10 +2,13 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import { User, UserPrefs } from "~/models/user";
+import { getUserFullname, User, UserPrefs } from "~/models/user";
 import { AxiosInstance } from "axios";
 import { ApiActions } from "~/services/api/api-actions";
 import * as uuid from "uuid/v4";
+import { Session, SessionStatus } from "~/models/session";
+import { Config } from "~/common/config";
+import { uniqBy } from "lodash";
 
 export const API_TOKEN_KEY = 'apiToken';
 export const USER_EMAIL_KEY = 'userEmail';
@@ -137,4 +140,53 @@ export class AuthService {
         const uuidParts = uuid ? uuid.split('-') : [];
         return uuidParts.length > 1 ? `${uuidParts[0]}-${uuidParts[1]}` : undefined;
     }
+
+    public getSessions(): Session[] {
+        try {
+            const sessions = JSON.parse(localStorage.getItem("sessions") || '');
+            return sessions;
+        } catch {
+            return [];
+        }
+    }
+
+    public saveSessions(sessions: Session[]) {
+        localStorage.setItem("sessions", JSON.stringify(sessions));
+    }
+
+    public buildSessions(cfg: Config, user?: User) {
+        const currentSession = {
+            clusterId: cfg.uuidPrefix,
+            remoteHost: cfg.rootUrl,
+            baseUrl: cfg.baseUrl,
+            username: getUserFullname(user),
+            email: user ? user.email : '',
+            token: this.getApiToken(),
+            loggedIn: true,
+            active: true,
+            status: SessionStatus.VALIDATED
+        } as Session;
+        const localSessions = this.getSessions();
+        const cfgSessions = Object.keys(cfg.remoteHosts).map(clusterId => {
+            const remoteHost = cfg.remoteHosts[clusterId];
+            return {
+                clusterId,
+                remoteHost,
+                baseUrl: '',
+                username: '',
+                email: '',
+                token: '',
+                loggedIn: false,
+                active: false,
+                status: SessionStatus.INVALIDATED
+            } as Session;
+        });
+        const sessions = [currentSession]
+            .concat(localSessions)
+            .concat(cfgSessions);
+
+        const uniqSessions = uniqBy(sessions, 'clusterId');
+
+        return uniqSessions;
+    }
 }
index b0d5cb1445db854e8d88d43e10c95a6b59e80569..f0f25a2d7ac0e82a49eb8bfae34474121e414f5e 100644 (file)
@@ -56,7 +56,7 @@ export class CollectionService extends TrashableResourceService<CollectionResour
             : this.webdavClient.defaults.baseURL;
         return {
             ...file,
-            url: baseUrl + file.url + '?api_token=' + this.authService.getApiToken()
+            url: baseUrl + file.url
         };
     }
 
diff --git a/src/services/file-viewers-config-service/file-viewers-config-service.ts b/src/services/file-viewers-config-service/file-viewers-config-service.ts
new file mode 100644 (file)
index 0000000..4029225
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import Axios from 'axios';
+import { FileViewerList } from '~/models/file-viewers-config';
+
+export class FileViewersConfigService {
+    constructor(
+        private url: string
+    ) { }
+
+    get() {
+        return Axios
+            .get<FileViewerList>(this.url)
+            .then(response => response.data);
+    }
+}
index 59fe2d4704ee194e6a5f0cf684c09b3629342ada..78ea714b93cb272afcf8c6518dfd621ed64d9d9e 100644 (file)
@@ -30,6 +30,7 @@ import { RepositoriesService } from '~/services/repositories-service/repositorie
 import { AuthorizedKeysService } from '~/services/authorized-keys-service/authorized-keys-service';
 import { VocabularyService } from '~/services/vocabulary-service/vocabulary-service';
 import { NodeService } from '~/services/node-service/node-service';
+import { FileViewersConfigService } from '~/services/file-viewers-config-service/file-viewers-config-service';
 
 export type ServiceRepository = ReturnType<typeof createServices>;
 
@@ -64,6 +65,7 @@ export const createServices = (config: Config, actions: ApiActions) => {
     const tagService = new TagService(linkService);
     const searchService = new SearchService();
     const vocabularyService = new VocabularyService(config.vocabularyUrl);
+    const fileViewersConfig = new FileViewersConfigService(config.fileViewersConfigUrl);
 
     return {
         ancestorsService,
@@ -76,6 +78,7 @@ export const createServices = (config: Config, actions: ApiActions) => {
         containerRequestService,
         containerService,
         favoriteService,
+        fileViewersConfig,
         groupsService,
         keepService,
         linkService,
diff --git a/src/store/auth/auth-action-session.ts b/src/store/auth/auth-action-session.ts
new file mode 100644 (file)
index 0000000..e5e2e57
--- /dev/null
@@ -0,0 +1,215 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { Dispatch } from "redux";
+import { setBreadcrumbs } from "~/store/breadcrumbs/breadcrumbs-actions";
+import { RootState } from "~/store/store";
+import { ServiceRepository } from "~/services/services";
+import Axios from "axios";
+import { getUserFullname, User } from "~/models/user";
+import { authActions } from "~/store/auth/auth-action";
+import { Config, DISCOVERY_URL } from "~/common/config";
+import { Session, SessionStatus } from "~/models/session";
+import { progressIndicatorActions } from "~/store/progress-indicator/progress-indicator-actions";
+import { AuthService, UserDetailsResponse } from "~/services/auth-service/auth-service";
+import * as jsSHA from "jssha";
+
+const getRemoteHostBaseUrl = async (remoteHost: string): Promise<string | null> => {
+    let url = remoteHost;
+    if (url.indexOf('://') < 0) {
+        url = 'https://' + url;
+    }
+    const origin = new URL(url).origin;
+    let baseUrl: string | null = null;
+
+    try {
+        const resp = await Axios.get<Config>(`${origin}/${DISCOVERY_URL}`);
+        baseUrl = resp.data.baseUrl;
+    } catch (err) {
+        try {
+            const resp = await Axios.get<any>(`${origin}/status.json`);
+            baseUrl = resp.data.apiBaseURL;
+        } catch (err) {
+        }
+    }
+
+    if (baseUrl && baseUrl[baseUrl.length - 1] === '/') {
+        baseUrl = baseUrl.substr(0, baseUrl.length - 1);
+    }
+
+    return baseUrl;
+};
+
+const getUserDetails = async (baseUrl: string, token: string): Promise<UserDetailsResponse> => {
+    const resp = await Axios.get<UserDetailsResponse>(`${baseUrl}/users/current`, {
+        headers: {
+            Authorization: `OAuth2 ${token}`
+        }
+    });
+    return resp.data;
+};
+
+const getTokenUuid = async (baseUrl: string, token: string): Promise<string> => {
+    if (token.startsWith("v2/")) {
+        const uuid = token.split("/")[1];
+        return Promise.resolve(uuid);
+    }
+
+    const resp = await Axios.get(`${baseUrl}/api_client_authorizations`, {
+        headers: {
+            Authorization: `OAuth2 ${token}`
+        },
+        data: {
+            filters: JSON.stringify([['api_token', '=', token]])
+        }
+    });
+
+    return resp.data.items[0].uuid;
+};
+
+const getSaltedToken = (clusterId: string, tokenUuid: string, token: string) => {
+    const shaObj = new jsSHA("SHA-1", "TEXT");
+    let secret = token;
+    if (token.startsWith("v2/")) {
+        secret = token.split("/")[2];
+    }
+    shaObj.setHMACKey(secret, "TEXT");
+    shaObj.update(clusterId);
+    const hmac = shaObj.getHMAC("HEX");
+    return `v2/${tokenUuid}/${hmac}`;
+};
+
+const clusterLogin = async (clusterId: string, baseUrl: string, activeSession: Session): Promise<{user: User, token: string}> => {
+    const tokenUuid = await getTokenUuid(activeSession.baseUrl, activeSession.token);
+    const saltedToken = getSaltedToken(clusterId, tokenUuid, activeSession.token);
+    const user = await getUserDetails(baseUrl, saltedToken);
+    return {
+        user: {
+            firstName: user.first_name,
+            lastName: user.last_name,
+            uuid: user.uuid,
+            ownerUuid: user.owner_uuid,
+            email: user.email,
+            isAdmin: user.is_admin,
+            identityUrl: user.identity_url,
+            prefs: user.prefs
+        },
+        token: saltedToken
+    };
+};
+
+const getActiveSession = (sessions: Session[]): Session | undefined => sessions.find(s => s.active);
+
+export const validateCluster = async (remoteHost: string, clusterId: string, activeSession: Session): Promise<{ user: User; token: string, baseUrl: string }> => {
+    const baseUrl = await getRemoteHostBaseUrl(remoteHost);
+    if (!baseUrl) {
+        return Promise.reject(`Could not find base url for ${remoteHost}`);
+    }
+    const { user, token } = await clusterLogin(clusterId, baseUrl, activeSession);
+    return { baseUrl, user, token };
+};
+
+export const validateSession = (session: Session, activeSession: Session) =>
+    async (dispatch: Dispatch): Promise<Session> => {
+        dispatch(authActions.UPDATE_SESSION({ ...session, status: SessionStatus.BEING_VALIDATED }));
+        session.loggedIn = false;
+        try {
+            const { baseUrl, user, token } = await validateCluster(session.remoteHost, session.clusterId, activeSession);
+            session.baseUrl = baseUrl;
+            session.token = token;
+            session.email = user.email;
+            session.username = getUserFullname(user);
+            session.loggedIn = true;
+        } catch {
+            session.loggedIn = false;
+        } finally {
+            session.status = SessionStatus.VALIDATED;
+            dispatch(authActions.UPDATE_SESSION(session));
+        }
+        return session;
+    };
+
+export const validateSessions = () =>
+    async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
+        const sessions = getState().auth.sessions;
+        const activeSession = getActiveSession(sessions);
+        if (activeSession) {
+            dispatch(progressIndicatorActions.START_WORKING("sessionsValidation"));
+            for (const session of sessions) {
+                if (session.status === SessionStatus.INVALIDATED) {
+                    await dispatch(validateSession(session, activeSession));
+                }
+            }
+            services.authService.saveSessions(sessions);
+            dispatch(progressIndicatorActions.STOP_WORKING("sessionsValidation"));
+        }
+    };
+
+export const addSession = (remoteHost: string) =>
+    async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
+        const sessions = getState().auth.sessions;
+        const activeSession = getActiveSession(sessions);
+        if (activeSession) {
+            const clusterId = remoteHost.match(/^(\w+)\./)![1];
+            if (sessions.find(s => s.clusterId === clusterId)) {
+                return Promise.reject("Cluster already exists");
+            }
+            try {
+                const { baseUrl, user, token } = await validateCluster(remoteHost, clusterId, activeSession);
+                const session = {
+                    loggedIn: true,
+                    status: SessionStatus.VALIDATED,
+                    active: false,
+                    email: user.email,
+                    username: getUserFullname(user),
+                    remoteHost,
+                    baseUrl,
+                    clusterId,
+                    token
+                };
+
+                dispatch(authActions.ADD_SESSION(session));
+                services.authService.saveSessions(getState().auth.sessions);
+
+                return session;
+            } catch (e) {
+            }
+        }
+        return Promise.reject("Could not validate cluster");
+    };
+
+export const toggleSession = (session: Session) =>
+    async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+        let s = { ...session };
+
+        if (session.loggedIn) {
+            s.loggedIn = false;
+        } else {
+            const sessions = getState().auth.sessions;
+            const activeSession = getActiveSession(sessions);
+            if (activeSession) {
+                s = await dispatch<any>(validateSession(s, activeSession)) as Session;
+            }
+        }
+
+        dispatch(authActions.UPDATE_SESSION(s));
+        services.authService.saveSessions(getState().auth.sessions);
+    };
+
+export const initSessions = (authService: AuthService, config: Config, user: User) =>
+    (dispatch: Dispatch<any>) => {
+        const sessions = authService.buildSessions(config, user);
+        authService.saveSessions(sessions);
+        dispatch(authActions.SET_SESSIONS(sessions));
+    };
+
+export const loadSiteManagerPanel = () =>
+    async (dispatch: Dispatch<any>) => {
+        try {
+            dispatch(setBreadcrumbs([{ label: 'Site Manager'}]));
+            dispatch(validateSessions());
+        } catch (e) {
+            return;
+        }
+    };
diff --git a/src/store/auth/auth-action-ssh.ts b/src/store/auth/auth-action-ssh.ts
new file mode 100644 (file)
index 0000000..2c3a272
--- /dev/null
@@ -0,0 +1,102 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { dialogActions } from "~/store/dialog/dialog-actions";
+import { Dispatch } from "redux";
+import { RootState } from "~/store/store";
+import { ServiceRepository } from "~/services/services";
+import { snackbarActions } from "~/store/snackbar/snackbar-actions";
+import { FormErrors, reset, startSubmit, stopSubmit } from "redux-form";
+import { KeyType } from "~/models/ssh-key";
+import {
+    AuthorizedKeysServiceError,
+    getAuthorizedKeysServiceError
+} from "~/services/authorized-keys-service/authorized-keys-service";
+import { setBreadcrumbs } from "~/store/breadcrumbs/breadcrumbs-actions";
+import {
+    authActions,
+} from "~/store/auth/auth-action";
+
+export const SSH_KEY_CREATE_FORM_NAME = 'sshKeyCreateFormName';
+export const SSH_KEY_PUBLIC_KEY_DIALOG = 'sshKeyPublicKeyDialog';
+export const SSH_KEY_REMOVE_DIALOG = 'sshKeyRemoveDialog';
+export const SSH_KEY_ATTRIBUTES_DIALOG = 'sshKeyAttributesDialog';
+
+export interface SshKeyCreateFormDialogData {
+    publicKey: string;
+    name: string;
+}
+
+export const openSshKeyCreateDialog = () => dialogActions.OPEN_DIALOG({ id: SSH_KEY_CREATE_FORM_NAME, data: {} });
+
+export const openPublicKeyDialog = (name: string, publicKey: string) =>
+    dialogActions.OPEN_DIALOG({ id: SSH_KEY_PUBLIC_KEY_DIALOG, data: { name, publicKey } });
+
+export const openSshKeyAttributesDialog = (uuid: string) =>
+    (dispatch: Dispatch, getState: () => RootState) => {
+        const sshKey = getState().auth.sshKeys.find(it => it.uuid === uuid);
+        dispatch(dialogActions.OPEN_DIALOG({ id: SSH_KEY_ATTRIBUTES_DIALOG, data: { sshKey } }));
+    };
+
+export const openSshKeyRemoveDialog = (uuid: string) =>
+    (dispatch: Dispatch, getState: () => RootState) => {
+        dispatch(dialogActions.OPEN_DIALOG({
+            id: SSH_KEY_REMOVE_DIALOG,
+            data: {
+                title: 'Remove public key',
+                text: 'Are you sure you want to remove this public key?',
+                confirmButtonLabel: 'Remove',
+                uuid
+            }
+        }));
+    };
+
+export const removeSshKey = (uuid: string) =>
+    async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+        dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Removing ...' }));
+        await services.authorizedKeysService.delete(uuid);
+        dispatch(authActions.REMOVE_SSH_KEY(uuid));
+        dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Public Key has been successfully removed.', hideDuration: 2000 }));
+    };
+
+export const createSshKey = (data: SshKeyCreateFormDialogData) =>
+    async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+        const userUuid = getState().auth.user!.uuid;
+        const { name, publicKey } = data;
+        dispatch(startSubmit(SSH_KEY_CREATE_FORM_NAME));
+        try {
+            const newSshKey = await services.authorizedKeysService.create({
+                name,
+                publicKey,
+                keyType: KeyType.SSH,
+                authorizedUserUuid: userUuid
+            });
+            dispatch(authActions.ADD_SSH_KEY(newSshKey));
+            dispatch(dialogActions.CLOSE_DIALOG({ id: SSH_KEY_CREATE_FORM_NAME }));
+            dispatch(reset(SSH_KEY_CREATE_FORM_NAME));
+            dispatch(snackbarActions.OPEN_SNACKBAR({
+                message: "Public key has been successfully created.",
+                hideDuration: 2000
+            }));
+        } catch (e) {
+            const error = getAuthorizedKeysServiceError(e);
+            if (error === AuthorizedKeysServiceError.UNIQUE_PUBLIC_KEY) {
+                dispatch(stopSubmit(SSH_KEY_CREATE_FORM_NAME, { publicKey: 'Public key already exists.' } as FormErrors));
+            } else if (error === AuthorizedKeysServiceError.INVALID_PUBLIC_KEY) {
+                dispatch(stopSubmit(SSH_KEY_CREATE_FORM_NAME, { publicKey: 'Public key is invalid' } as FormErrors));
+            }
+        }
+    };
+
+export const loadSshKeysPanel = () =>
+    async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
+        try {
+            dispatch(setBreadcrumbs([{ label: 'SSH Keys'}]));
+            const response = await services.authorizedKeysService.list();
+            dispatch(authActions.SET_SSH_KEYS(response.items));
+        } catch (e) {
+            return;
+        }
+    };
+
similarity index 77%
rename from src/store/auth/auth-actions.test.ts
rename to src/store/auth/auth-action.test.ts
index ed2237953932570d27921c21c0c774e0f0932b89..e5775a493d07f38623c22141744d9b949f0fef96 100644 (file)
@@ -18,7 +18,7 @@ import 'jest-localstorage-mock';
 import { createServices } from "~/services/services";
 import { configureStore, RootStore } from "../store";
 import createBrowserHistory from "history/createBrowserHistory";
-import { mockConfig } from '~/common/config';
+import { Config, mockConfig } from '~/common/config';
 import { ApiActions } from "~/services/api/api-actions";
 
 describe('auth-actions', () => {
@@ -47,11 +47,36 @@ describe('auth-actions', () => {
         localStorage.setItem(USER_OWNER_UUID_KEY, "ownerUuid");
         localStorage.setItem(USER_IS_ADMIN, JSON.stringify("false"));
 
-        store.dispatch(initAuth());
+        const config: any = {
+            remoteHosts: { "xc59": "xc59.api.arvados.com" }
+        };
+
+        store.dispatch(initAuth(config));
 
         expect(store.getState().auth).toEqual({
             apiToken: "token",
             sshKeys: [],
+            sessions: [{
+                "active": true,
+                "baseUrl": undefined,
+                "clusterId": undefined,
+                "email": "test@test.com",
+                "loggedIn": true,
+                "remoteHost": undefined,
+                "status": 2,
+                "token": "token",
+                "username": "John Doe"
+            }, {
+                "active": false,
+                "baseUrl": "",
+                "clusterId": "xc59",
+                "email": "",
+                "loggedIn": false,
+                "remoteHost": "xc59.api.arvados.com",
+                "status": 0,
+                "token": "",
+                "username": ""
+            }],
             user: {
                 email: "test@test.com",
                 firstName: "John",
index d72a3ece7a829270e902b6c9790b59feda51a22d..6c54a5c9cf86ad0530188785546f19965b37b281 100644 (file)
@@ -4,17 +4,14 @@
 
 import { ofType, unionize, UnionOf } from '~/common/unionize';
 import { Dispatch } from "redux";
-import { reset, stopSubmit, startSubmit, FormErrors } from 'redux-form';
 import { AxiosInstance } from "axios";
 import { RootState } from "../store";
-import { snackbarActions } from '~/store/snackbar/snackbar-actions';
-import { dialogActions } from '~/store/dialog/dialog-actions';
-import { setBreadcrumbs } from '~/store/breadcrumbs/breadcrumbs-actions';
 import { ServiceRepository } from "~/services/services";
-import { getAuthorizedKeysServiceError, AuthorizedKeysServiceError } from '~/services/authorized-keys-service/authorized-keys-service';
-import { KeyType, SshKeyResource } from '~/models/ssh-key';
+import { SshKeyResource } from '~/models/ssh-key';
 import { User } from "~/models/user";
-import * as Routes from '~/routes/routes';
+import { Session } from "~/models/session";
+import { Config } from '~/common/config';
+import { initSessions } from "~/store/auth/auth-action-session";
 
 export const authActions = unionize({
     SAVE_API_TOKEN: ofType<string>(),
@@ -25,19 +22,13 @@ export const authActions = unionize({
     USER_DETAILS_SUCCESS: ofType<User>(),
     SET_SSH_KEYS: ofType<SshKeyResource[]>(),
     ADD_SSH_KEY: ofType<SshKeyResource>(),
-    REMOVE_SSH_KEY: ofType<string>()
+    REMOVE_SSH_KEY: ofType<string>(),
+    SET_SESSIONS: ofType<Session[]>(),
+    ADD_SESSION: ofType<Session>(),
+    REMOVE_SESSION: ofType<string>(),
+    UPDATE_SESSION: ofType<Session>()
 });
 
-export const SSH_KEY_CREATE_FORM_NAME = 'sshKeyCreateFormName';
-export const SSH_KEY_PUBLIC_KEY_DIALOG = 'sshKeyPublicKeyDialog';
-export const SSH_KEY_REMOVE_DIALOG = 'sshKeyRemoveDialog';
-export const SSH_KEY_ATTRIBUTES_DIALOG = 'sshKeyAttributesDialog';
-
-export interface SshKeyCreateFormDialogData {
-    publicKey: string;
-    name: string;
-}
-
 function setAuthorizationHeader(services: ServiceRepository, token: string) {
     services.apiClient.defaults.headers.common = {
         Authorization: `OAuth2 ${token}`
@@ -51,7 +42,7 @@ function removeAuthorizationHeader(client: AxiosInstance) {
     delete client.defaults.headers.common.Authorization;
 }
 
-export const initAuth = () => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+export const initAuth = (config: Config) => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
     const user = services.authService.getUser();
     const token = services.authService.getApiToken();
     if (token) {
@@ -59,6 +50,7 @@ export const initAuth = () => (dispatch: Dispatch, getState: () => RootState, se
     }
     if (token && user) {
         dispatch(authActions.INIT({ user, token }));
+        dispatch<any>(initSessions(services.authService, config, user));
     }
 };
 
@@ -90,80 +82,4 @@ export const getUserDetails = () => (dispatch: Dispatch, getState: () => RootSta
     });
 };
 
-export const openSshKeyCreateDialog = () => dialogActions.OPEN_DIALOG({ id: SSH_KEY_CREATE_FORM_NAME, data: {} });
-
-export const openPublicKeyDialog = (name: string, publicKey: string) =>
-    dialogActions.OPEN_DIALOG({ id: SSH_KEY_PUBLIC_KEY_DIALOG, data: { name, publicKey } });
-
-export const openSshKeyAttributesDialog = (uuid: string) =>
-    (dispatch: Dispatch, getState: () => RootState) => {
-        const sshKey = getState().auth.sshKeys.find(it => it.uuid === uuid);
-        dispatch(dialogActions.OPEN_DIALOG({ id: SSH_KEY_ATTRIBUTES_DIALOG, data: { sshKey } }));
-    };
-
-export const openSshKeyRemoveDialog = (uuid: string) =>
-    (dispatch: Dispatch, getState: () => RootState) => {
-        dispatch(dialogActions.OPEN_DIALOG({
-            id: SSH_KEY_REMOVE_DIALOG,
-            data: {
-                title: 'Remove public key',
-                text: 'Are you sure you want to remove this public key?',
-                confirmButtonLabel: 'Remove',
-                uuid
-            }
-        }));
-    };
-
-export const removeSshKey = (uuid: string) =>
-    async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
-        dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Removing ...' }));
-        await services.authorizedKeysService.delete(uuid);
-        dispatch(authActions.REMOVE_SSH_KEY(uuid));
-        dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Public Key has been successfully removed.', hideDuration: 2000 }));
-    };
-
-export const createSshKey = (data: SshKeyCreateFormDialogData) =>
-    async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
-        const userUuid = getState().auth.user!.uuid;
-        const { name, publicKey } = data;
-        dispatch(startSubmit(SSH_KEY_CREATE_FORM_NAME));
-        try {
-            const newSshKey = await services.authorizedKeysService.create({
-                name,
-                publicKey,
-                keyType: KeyType.SSH,
-                authorizedUserUuid: userUuid
-            });
-            dispatch(authActions.ADD_SSH_KEY(newSshKey));
-            dispatch(dialogActions.CLOSE_DIALOG({ id: SSH_KEY_CREATE_FORM_NAME }));
-            dispatch(reset(SSH_KEY_CREATE_FORM_NAME));
-            dispatch(snackbarActions.OPEN_SNACKBAR({
-                message: "Public key has been successfully created.",
-                hideDuration: 2000
-            }));
-        } catch (e) {
-            const error = getAuthorizedKeysServiceError(e);
-            if (error === AuthorizedKeysServiceError.UNIQUE_PUBLIC_KEY) {
-                dispatch(stopSubmit(SSH_KEY_CREATE_FORM_NAME, { publicKey: 'Public key already exists.' } as FormErrors));
-            } else if (error === AuthorizedKeysServiceError.INVALID_PUBLIC_KEY) {
-                dispatch(stopSubmit(SSH_KEY_CREATE_FORM_NAME, { publicKey: 'Public key is invalid' } as FormErrors));
-            }
-        }
-    };
-
-export const loadSshKeysPanel = () =>
-    async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
-        try {
-            const userUuid = getState().auth.user!.uuid;
-            const { router } = getState();
-            const pathname = router.location ? router.location.pathname : '';
-            dispatch(setBreadcrumbs([{ label: 'SSH Keys' }]));
-            const response = await services.authorizedKeysService.list();
-            const userSshKeys = response.items.find(it => it.ownerUuid === userUuid);
-            return Routes.matchSshKeysAdminRoute(pathname) ? dispatch(authActions.SET_SSH_KEYS(response.items)) : dispatch(authActions.SET_SSH_KEYS([userSshKeys!]));
-        } catch (e) {
-            return;
-        }
-    };
-
 export type AuthAction = UnionOf<typeof authActions>;
index eb7e0c0dac541501782d1929a9a882ae09c98072..773f9f82dbd737b2e7f0d3fa843b5be4779d6d57 100644 (file)
@@ -38,7 +38,8 @@ describe('auth-reducer', () => {
         expect(state).toEqual({
             apiToken: "token",
             user,
-            sshKeys: []
+            sshKeys: [],
+            sessions: []
         });
     });
 
@@ -49,7 +50,8 @@ describe('auth-reducer', () => {
         expect(state).toEqual({
             apiToken: "token",
             user: undefined,
-            sshKeys: []
+            sshKeys: [],
+            sessions: []
         });
     });
 
@@ -71,6 +73,7 @@ describe('auth-reducer', () => {
         expect(state).toEqual({
             apiToken: undefined,
             sshKeys: [],
+            sessions: [],
             user: {
                 email: "test@test.com",
                 firstName: "John",
index a8e4340af52ac35142d9db3c73dce1c78de5fa7a..a2822f100c37b6421b465f3b7a2312d2c5b00362 100644 (file)
@@ -6,17 +6,20 @@ import { authActions, AuthAction } from "./auth-action";
 import { User } from "~/models/user";
 import { ServiceRepository } from "~/services/services";
 import { SshKeyResource } from '~/models/ssh-key';
+import { Session } from "~/models/session";
 
 export interface AuthState {
     user?: User;
     apiToken?: string;
     sshKeys: SshKeyResource[];
+    sessions: Session[];
 }
 
 const initialState: AuthState = {
     user: undefined,
     apiToken: undefined,
-    sshKeys: []
+    sshKeys: [],
+    sessions: []
 };
 
 export const authReducer = (services: ServiceRepository) => (state = initialState, action: AuthAction) => {
@@ -45,6 +48,26 @@ export const authReducer = (services: ServiceRepository) => (state = initialStat
         REMOVE_SSH_KEY: (uuid: string) => {
             return { ...state, sshKeys: state.sshKeys.filter((sshKey) => sshKey.uuid !== uuid )};
         },
+        SET_SESSIONS: (sessions: Session[]) => {
+            return { ...state, sessions };
+        },
+        ADD_SESSION: (session: Session) => {
+            return { ...state, sessions: state.sessions.concat(session) };
+        },
+        REMOVE_SESSION: (clusterId: string) => {
+            return {
+                ...state,
+                sessions: state.sessions.filter(
+                    session => session.clusterId !== clusterId
+                )};
+        },
+        UPDATE_SESSION: (session: Session) => {
+            return {
+                ...state,
+                sessions: state.sessions.map(
+                    s => s.clusterId === session.clusterId ? session : s
+                )};
+        },
         default: () => state
     });
 };
index 8b1eb2b0cc0f0be28b9c68059ecb4528327aa71b..71de5ce425e44472f8e0bdac832159f4e3510c14 100644 (file)
@@ -14,6 +14,7 @@ import { ServiceRepository } from '~/services/services';
 import { SidePanelTreeCategory, activateSidePanelTreeItem } from '~/store/side-panel-tree/side-panel-tree-actions';
 import { updateResources } from '../resources/resources-actions';
 import { ResourceKind } from '~/models/resource';
+import { GroupResource } from '~/models/group';
 
 export const BREADCRUMBS = 'breadcrumbs';
 
@@ -89,3 +90,22 @@ export const setProcessBreadcrumbs = (processUuid: string) =>
             dispatch<any>(setProjectBreadcrumbs(process.containerRequest.ownerUuid));
         }
     };
+
+export const GROUPS_PANEL_LABEL = 'Groups';
+
+export const setGroupsBreadcrumbs = () =>
+    setBreadcrumbs([{ label: GROUPS_PANEL_LABEL }]);
+
+export const setGroupDetailsBreadcrumbs = (groupUuid: string) =>
+    (dispatch: Dispatch, getState: () => RootState) => {
+
+        const group = getResource<GroupResource>(groupUuid)(getState().resources);
+
+        const breadcrumbs: ResourceBreadcrumb[] = [
+            { label: GROUPS_PANEL_LABEL, uuid: GROUPS_PANEL_LABEL },
+            { label: group ? group.name : groupUuid, uuid: groupUuid },
+        ];
+
+        dispatch(setBreadcrumbs(breadcrumbs));
+
+    };
diff --git a/src/store/file-viewers/file-viewers-actions.ts b/src/store/file-viewers/file-viewers-actions.ts
new file mode 100644 (file)
index 0000000..44bfd2f
--- /dev/null
@@ -0,0 +1,25 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { Dispatch } from 'redux';
+import { ServiceRepository } from '~/services/services';
+import { propertiesActions } from '~/store/properties/properties-actions';
+import { FILE_VIEWERS_PROPERTY_NAME, DEFAULT_FILE_VIEWERS } from '~/store/file-viewers/file-viewers-selectors';
+import { FileViewerList } from '~/models/file-viewers-config';
+
+export const loadFileViewersConfig = async (dispatch: Dispatch, _: {}, { fileViewersConfig }: ServiceRepository) => {
+    
+    let config: FileViewerList;
+    try{
+        config = await fileViewersConfig.get();
+    } catch (e){
+        config = DEFAULT_FILE_VIEWERS;
+    }
+
+    dispatch(propertiesActions.SET_PROPERTY({
+        key: FILE_VIEWERS_PROPERTY_NAME,
+        value: config,
+    }));
+
+};
diff --git a/src/store/file-viewers/file-viewers-selectors.ts b/src/store/file-viewers/file-viewers-selectors.ts
new file mode 100644 (file)
index 0000000..abc9d3d
--- /dev/null
@@ -0,0 +1,12 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { PropertiesState, getProperty } from '~/store/properties/properties';
+import { FileViewerList } from '~/models/file-viewers-config';
+
+export const FILE_VIEWERS_PROPERTY_NAME = 'fileViewers';
+
+export const DEFAULT_FILE_VIEWERS: FileViewerList = [];
+export const getFileViewers = (state: PropertiesState) =>
+    getProperty<FileViewerList>(FILE_VIEWERS_PROPERTY_NAME)(state) || DEFAULT_FILE_VIEWERS;
diff --git a/src/store/group-details-panel/group-details-panel-actions.ts b/src/store/group-details-panel/group-details-panel-actions.ts
new file mode 100644 (file)
index 0000000..4ad0159
--- /dev/null
@@ -0,0 +1,132 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { bindDataExplorerActions } from '~/store/data-explorer/data-explorer-action';
+import { Dispatch } from 'redux';
+import { propertiesActions } from '~/store/properties/properties-actions';
+import { getProperty } from '~/store/properties/properties';
+import { Person } from '~/views-components/sharing-dialog/people-select';
+import { dialogActions } from '~/store/dialog/dialog-actions';
+import { reset, startSubmit } from 'redux-form';
+import { addGroupMember, deleteGroupMember } from '~/store/groups-panel/groups-panel-actions';
+import { getResource } from '~/store/resources/resources';
+import { GroupResource } from '~/models/group';
+import { RootState } from '~/store/store';
+import { ServiceRepository } from '~/services/services';
+import { PermissionResource } from '~/models/permission';
+import { GroupDetailsPanel } from '~/views/group-details-panel/group-details-panel';
+import { snackbarActions, SnackbarKind } from '~/store/snackbar/snackbar-actions';
+import { UserResource, getUserFullname } from '~/models/user';
+
+export const GROUP_DETAILS_PANEL_ID = 'groupDetailsPanel';
+export const ADD_GROUP_MEMBERS_DIALOG = 'addGrupMembers';
+export const ADD_GROUP_MEMBERS_FORM = 'addGrupMembers';
+export const ADD_GROUP_MEMBERS_USERS_FIELD_NAME = 'users';
+export const MEMBER_ATTRIBUTES_DIALOG = 'memberAttributesDialog';
+export const MEMBER_REMOVE_DIALOG = 'memberRemoveDialog';
+
+export const GroupDetailsPanelActions = bindDataExplorerActions(GROUP_DETAILS_PANEL_ID);
+
+export const loadGroupDetailsPanel = (groupUuid: string) =>
+    (dispatch: Dispatch) => {
+        dispatch(propertiesActions.SET_PROPERTY({ key: GROUP_DETAILS_PANEL_ID, value: groupUuid }));
+        dispatch(GroupDetailsPanelActions.REQUEST_ITEMS());
+    };
+
+export const getCurrentGroupDetailsPanelUuid = getProperty<string>(GROUP_DETAILS_PANEL_ID);
+
+export interface AddGroupMembersFormData {
+    [ADD_GROUP_MEMBERS_USERS_FIELD_NAME]: Person[];
+}
+
+export const openAddGroupMembersDialog = () =>
+    (dispatch: Dispatch) => {
+        dispatch(dialogActions.OPEN_DIALOG({ id: ADD_GROUP_MEMBERS_DIALOG, data: {} }));
+        dispatch(reset(ADD_GROUP_MEMBERS_FORM));
+    };
+
+export const addGroupMembers = ({ users }: AddGroupMembersFormData) =>
+
+    async (dispatch: Dispatch, getState: () => RootState, { permissionService }: ServiceRepository) => {
+
+        const groupUuid = getCurrentGroupDetailsPanelUuid(getState().properties);
+
+        if (groupUuid) {
+
+            dispatch(startSubmit(ADD_GROUP_MEMBERS_FORM));
+
+            const group = getResource<GroupResource>(groupUuid)(getState().resources);
+
+            for (const user of users) {
+
+                await addGroupMember({
+                    user,
+                    group: {
+                        uuid: groupUuid,
+                        name: group ? group.name : groupUuid,
+                    },
+                    dispatch,
+                    permissionService,
+                });
+
+            }
+
+            dispatch(dialogActions.CLOSE_DIALOG({ id: ADD_GROUP_MEMBERS_FORM }));
+            dispatch(GroupDetailsPanelActions.REQUEST_ITEMS());
+
+        }
+    };
+
+export const openGroupMemberAttributes = (uuid: string) =>
+    (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+        const { resources } = getState();
+        const data = getResource<PermissionResource>(uuid)(resources);
+        dispatch(dialogActions.OPEN_DIALOG({ id: MEMBER_ATTRIBUTES_DIALOG, data }));
+    };
+
+export const openRemoveGroupMemberDialog = (uuid: string) =>
+    (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+        dispatch(dialogActions.OPEN_DIALOG({
+            id: MEMBER_REMOVE_DIALOG,
+            data: {
+                title: 'Remove member',
+                text: 'Are you sure you want to remove this member from this group?',
+                confirmButtonLabel: 'Remove',
+                uuid
+            }
+        }));
+    };
+
+export const removeGroupMember = (uuid: string) =>
+
+    async (dispatch: Dispatch, getState: () => RootState, { permissionService }: ServiceRepository) => {
+
+        const groupUuid = getCurrentGroupDetailsPanelUuid(getState().properties);
+
+        if (groupUuid) {
+
+            const group = getResource<GroupResource>(groupUuid)(getState().resources);
+            const user = getResource<UserResource>(groupUuid)(getState().resources);
+
+            dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Removing ...' }));
+
+            await deleteGroupMember({
+                user: {
+                    uuid,
+                    name: user ? getUserFullname(user) : uuid,
+                },
+                group: {
+                    uuid: groupUuid,
+                    name: group ? group.name : groupUuid,
+                },
+                permissionService,
+                dispatch,
+            });
+
+            dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Removed.', hideDuration: 2000, kind: SnackbarKind.SUCCESS }));
+            dispatch(GroupDetailsPanelActions.REQUEST_ITEMS());
+
+        }
+
+    };
diff --git a/src/store/group-details-panel/group-details-panel-middleware-service.ts b/src/store/group-details-panel/group-details-panel-middleware-service.ts
new file mode 100644 (file)
index 0000000..bf424c5
--- /dev/null
@@ -0,0 +1,79 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { Dispatch, MiddlewareAPI } from "redux";
+import { DataExplorerMiddlewareService, listResultsToDataExplorerItemsMeta } from "~/store/data-explorer/data-explorer-middleware-service";
+import { RootState } from "~/store/store";
+import { ServiceRepository } from "~/services/services";
+import { snackbarActions, SnackbarKind } from '~/store/snackbar/snackbar-actions';
+import { getDataExplorer } from "~/store/data-explorer/data-explorer-reducer";
+import { FilterBuilder } from '~/services/api/filter-builder';
+import { updateResources } from '~/store/resources/resources-actions';
+import { getCurrentGroupDetailsPanelUuid, GroupDetailsPanelActions } from '~/store/group-details-panel/group-details-panel-actions';
+import { LinkClass } from '~/models/link';
+
+export class GroupDetailsPanelMiddlewareService extends DataExplorerMiddlewareService {
+
+    constructor(private services: ServiceRepository, id: string) {
+        super(id);
+    }
+
+    async requestItems(api: MiddlewareAPI<Dispatch, RootState>) {
+
+        const dataExplorer = getDataExplorer(api.getState().dataExplorer, this.getId());
+        const groupUuid = getCurrentGroupDetailsPanelUuid(api.getState().properties);
+
+        if (!dataExplorer || !groupUuid) {
+
+            api.dispatch(groupsDetailsPanelDataExplorerIsNotSet());
+
+        } else {
+
+            try {
+
+                const permissions = await this.services.permissionService.list({
+
+                    filters: new FilterBuilder()
+                        .addEqual('tailUuid', groupUuid)
+                        .addEqual('linkClass', LinkClass.PERMISSION)
+                        .getFilters()
+
+                });
+
+                api.dispatch(updateResources(permissions.items));
+
+                const users = await this.services.userService.list({
+
+                    filters: new FilterBuilder()
+                        .addIn('uuid', permissions.items.map(item => item.headUuid))
+                        .getFilters()
+
+                });
+
+                api.dispatch(GroupDetailsPanelActions.SET_ITEMS({
+                    ...listResultsToDataExplorerItemsMeta(permissions),
+                    items: users.items.map(item => item.uuid),
+                }));
+
+                api.dispatch(updateResources(users.items));
+
+            } catch (e) {
+
+                api.dispatch(couldNotFetchGroupDetailsContents());
+
+            }
+        }
+    }
+}
+
+const groupsDetailsPanelDataExplorerIsNotSet = () =>
+    snackbarActions.OPEN_SNACKBAR({
+        message: 'Group details panel is not ready.'
+    });
+
+const couldNotFetchGroupDetailsContents = () =>
+    snackbarActions.OPEN_SNACKBAR({
+        message: 'Could not fetch group details.',
+        kind: SnackbarKind.ERROR
+    });
diff --git a/src/store/groups-panel/groups-panel-actions.ts b/src/store/groups-panel/groups-panel-actions.ts
new file mode 100644 (file)
index 0000000..8632098
--- /dev/null
@@ -0,0 +1,225 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { Dispatch } from 'redux';
+import { reset, startSubmit, stopSubmit, FormErrors } from 'redux-form';
+import { bindDataExplorerActions } from "~/store/data-explorer/data-explorer-action";
+import { dialogActions } from '~/store/dialog/dialog-actions';
+import { Person } from '~/views-components/sharing-dialog/people-select';
+import { RootState } from '~/store/store';
+import { ServiceRepository } from '~/services/services';
+import { getResource } from '~/store/resources/resources';
+import { GroupResource } from '~/models/group';
+import { getCommonResourceServiceError, CommonResourceServiceError } from '~/services/common-service/common-resource-service';
+import { snackbarActions, SnackbarKind } from '~/store/snackbar/snackbar-actions';
+import { PermissionLevel, PermissionResource } from '~/models/permission';
+import { PermissionService } from '~/services/permission-service/permission-service';
+import { FilterBuilder } from '~/services/api/filter-builder';
+
+export const GROUPS_PANEL_ID = "groupsPanel";
+export const CREATE_GROUP_DIALOG = "createGroupDialog";
+export const CREATE_GROUP_FORM = "createGroupForm";
+export const CREATE_GROUP_NAME_FIELD_NAME = 'name';
+export const CREATE_GROUP_USERS_FIELD_NAME = 'users';
+export const GROUP_ATTRIBUTES_DIALOG = 'groupAttributesDialog';
+export const GROUP_REMOVE_DIALOG = 'groupRemoveDialog';
+
+export const GroupsPanelActions = bindDataExplorerActions(GROUPS_PANEL_ID);
+
+export const loadGroupsPanel = () => GroupsPanelActions.REQUEST_ITEMS();
+
+export const openCreateGroupDialog = () =>
+    (dispatch: Dispatch) => {
+        dispatch(dialogActions.OPEN_DIALOG({ id: CREATE_GROUP_DIALOG, data: {} }));
+        dispatch(reset(CREATE_GROUP_FORM));
+    };
+
+export const openGroupAttributes = (uuid: string) =>
+    (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+        const { resources } = getState();
+        const data = getResource<GroupResource>(uuid)(resources);
+        dispatch(dialogActions.OPEN_DIALOG({ id: GROUP_ATTRIBUTES_DIALOG, data }));
+    };
+
+export const removeGroup = (uuid: string) =>
+    async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+        dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Removing ...' }));
+        await services.groupsService.delete(uuid);
+        dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Removed.', hideDuration: 2000, kind: SnackbarKind.SUCCESS }));
+        dispatch<any>(loadGroupsPanel());
+    };
+
+export const openRemoveGroupDialog = (uuid: string) =>
+    (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+        dispatch(dialogActions.OPEN_DIALOG({
+            id: GROUP_REMOVE_DIALOG,
+            data: {
+                title: 'Remove group',
+                text: 'Are you sure you want to remove this group?',
+                confirmButtonLabel: 'Remove',
+                uuid
+            }
+        }));
+    };
+
+export interface CreateGroupFormData {
+    [CREATE_GROUP_NAME_FIELD_NAME]: string;
+    [CREATE_GROUP_USERS_FIELD_NAME]?: Person[];
+}
+
+export const createGroup = ({ name, users = [] }: CreateGroupFormData) =>
+    async (dispatch: Dispatch, _: {}, { groupsService, permissionService }: ServiceRepository) => {
+
+        dispatch(startSubmit(CREATE_GROUP_FORM));
+
+        try {
+
+            const newGroup = await groupsService.create({ name });
+
+            for (const user of users) {
+
+                await addGroupMember({
+                    user,
+                    group: newGroup,
+                    dispatch,
+                    permissionService,
+                });
+
+            }
+
+            dispatch(dialogActions.CLOSE_DIALOG({ id: CREATE_GROUP_DIALOG }));
+            dispatch(reset(CREATE_GROUP_FORM));
+            dispatch(loadGroupsPanel());
+            dispatch(snackbarActions.OPEN_SNACKBAR({
+                message: `${newGroup.name} group has been created`,
+                kind: SnackbarKind.SUCCESS
+            }));
+
+            return newGroup;
+
+        } catch (e) {
+
+            const error = getCommonResourceServiceError(e);
+            if (error === CommonResourceServiceError.UNIQUE_VIOLATION) {
+                dispatch(stopSubmit(CREATE_GROUP_FORM, { name: 'Group with the same name already exists.' } as FormErrors));
+            }
+
+            return;
+
+        }
+    };
+
+interface AddGroupMemberArgs {
+    user: { uuid: string, name: string };
+    group: { uuid: string, name: string };
+    dispatch: Dispatch;
+    permissionService: PermissionService;
+}
+
+/**
+ * Group membership is determined by whether the group has can_read permission on an object. 
+ * If a group G can_read an object A, then we say A is a member of G.
+ * 
+ * [Permission model docs](https://doc.arvados.org/api/permission-model.html)
+ */
+export const addGroupMember = async ({ user, group, ...args }: AddGroupMemberArgs) => {
+
+    await createPermission({
+        head: { ...user },
+        tail: { ...group },
+        permissionLevel: PermissionLevel.CAN_READ,
+        ...args,
+    });
+
+};
+
+interface CreatePermissionLinkArgs {
+    head: { uuid: string, name: string };
+    tail: { uuid: string, name: string };
+    permissionLevel: PermissionLevel;
+    dispatch: Dispatch;
+    permissionService: PermissionService;
+}
+
+const createPermission = async ({ head, tail, permissionLevel, dispatch, permissionService }: CreatePermissionLinkArgs) => {
+
+    try {
+
+        await permissionService.create({
+            tailUuid: tail.uuid,
+            headUuid: head.uuid,
+            name: permissionLevel,
+        });
+
+    } catch (e) {
+
+        dispatch(snackbarActions.OPEN_SNACKBAR({
+            message: `Could not add ${tail.name} -> ${head.name} relation`,
+            kind: SnackbarKind.ERROR,
+        }));
+
+    }
+
+};
+
+interface DeleteGroupMemberArgs {
+    user: { uuid: string, name: string };
+    group: { uuid: string, name: string };
+    dispatch: Dispatch;
+    permissionService: PermissionService;
+}
+
+export const deleteGroupMember = async ({ user, group, ...args }: DeleteGroupMemberArgs) => {
+
+    await deletePermission({
+        tail: group,
+        head: user,
+        ...args,
+    });
+
+};
+
+interface DeletePermissionLinkArgs {
+    head: { uuid: string, name: string };
+    tail: { uuid: string, name: string };
+    dispatch: Dispatch;
+    permissionService: PermissionService;
+}
+
+export const deletePermission = async ({ head, tail, dispatch, permissionService }: DeletePermissionLinkArgs) => {
+
+    try {
+
+        const permissionsResponse = await permissionService.list({
+
+            filters: new FilterBuilder()
+                .addEqual('tailUuid', tail.uuid)
+                .addEqual('headUuid', head.uuid)
+                .getFilters()
+
+        });
+
+        const [permission] = permissionsResponse.items;
+
+        if (permission) {
+
+            await permissionService.delete(permission.uuid);
+
+        } else {
+
+            throw new Error('Permission not found');
+
+        }
+
+
+    } catch (e) {
+
+        dispatch(snackbarActions.OPEN_SNACKBAR({
+            message: `Could not delete ${tail.name} -> ${head.name} relation`,
+            kind: SnackbarKind.ERROR,
+        }));
+
+    }
+
+};
\ No newline at end of file
diff --git a/src/store/groups-panel/groups-panel-middleware-service.ts b/src/store/groups-panel/groups-panel-middleware-service.ts
new file mode 100644 (file)
index 0000000..7c70666
--- /dev/null
@@ -0,0 +1,97 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { Dispatch, MiddlewareAPI } from "redux";
+import { DataExplorerMiddlewareService, listResultsToDataExplorerItemsMeta, dataExplorerToListParams } from "~/store/data-explorer/data-explorer-middleware-service";
+import { RootState } from "~/store/store";
+import { ServiceRepository } from "~/services/services";
+import { snackbarActions, SnackbarKind } from '~/store/snackbar/snackbar-actions';
+import { getDataExplorer, DataExplorer, getSortColumn } from "~/store/data-explorer/data-explorer-reducer";
+import { GroupsPanelActions } from '~/store/groups-panel/groups-panel-actions';
+import { FilterBuilder } from '~/services/api/filter-builder';
+import { updateResources } from '~/store/resources/resources-actions';
+import { OrderBuilder, OrderDirection } from '~/services/api/order-builder';
+import { GroupResource, GroupClass } from '~/models/group';
+import { SortDirection } from '~/components/data-table/data-column';
+import { GroupsPanelColumnNames } from '~/views/groups-panel/groups-panel';
+
+export class GroupsPanelMiddlewareService extends DataExplorerMiddlewareService {
+
+    constructor(private services: ServiceRepository, id: string) {
+        super(id);
+    }
+
+    async requestItems(api: MiddlewareAPI<Dispatch, RootState>) {
+
+        const dataExplorer = getDataExplorer(api.getState().dataExplorer, this.getId());
+
+        if (!dataExplorer) {
+
+            api.dispatch(groupsPanelDataExplorerIsNotSet());
+
+        } else {
+
+            try {
+
+                const order = new OrderBuilder<GroupResource>();
+                const sortColumn = getSortColumn(dataExplorer);
+                if (sortColumn) {
+                    const direction =
+                        sortColumn.sortDirection === SortDirection.ASC && sortColumn.name === GroupsPanelColumnNames.GROUP
+                            ? OrderDirection.ASC
+                            : OrderDirection.DESC;
+
+                    order.addOrder(direction, 'name');
+                }
+
+                const filters = new FilterBuilder()
+                    .addNotIn('groupClass', [GroupClass.PROJECT])
+                    .addILike('name', dataExplorer.searchValue)
+                    .getFilters();
+
+                const response = await this.services.groupsService
+                    .list({
+                        ...dataExplorerToListParams(dataExplorer),
+                        filters,
+                        order: order.getOrder(),
+                    });
+
+                api.dispatch(updateResources(response.items));
+
+                api.dispatch(GroupsPanelActions.SET_ITEMS({
+                    ...listResultsToDataExplorerItemsMeta(response),
+                    items: response.items.map(item => item.uuid),
+                }));
+
+                const permissions = await this.services.permissionService.list({
+
+                    filters: new FilterBuilder()
+                        .addIn('tailUuid', response.items.map(item => item.uuid))
+                        .getFilters()
+
+                });
+
+                api.dispatch(updateResources(permissions.items));
+
+
+            } catch (e) {
+
+                api.dispatch(couldNotFetchFavoritesContents());
+
+            }
+        }
+    }
+}
+
+const groupsPanelDataExplorerIsNotSet = () =>
+    snackbarActions.OPEN_SNACKBAR({
+        message: 'Groups panel is not ready.'
+    });
+
+const couldNotFetchFavoritesContents = () =>
+    snackbarActions.OPEN_SNACKBAR({
+        message: 'Could not fetch groups.',
+        kind: SnackbarKind.ERROR
+    });
+
index 92443c02dc1cf90800a50418d167c72f253d92b5..f610eb5e99fd6786f8fe975888256c3e544d27d1 100644 (file)
@@ -8,9 +8,10 @@ import { ResourceKind, extractUuidKind } from '~/models/resource';
 import { getCollectionUrl } from "~/models/collection";
 import { getProjectUrl } from "~/models/project";
 import { SidePanelTreeCategory } from '../side-panel-tree/side-panel-tree-actions';
-import { Routes, getProcessUrl, getProcessLogUrl } from '~/routes/routes';
+import { Routes, getProcessUrl, getProcessLogUrl, getGroupUrl } from '~/routes/routes';
 import { RootState } from '~/store/store';
 import { ServiceRepository } from '~/services/services';
+import { GROUPS_PANEL_LABEL } from '~/store/breadcrumbs/breadcrumbs-actions';
 
 export const navigateTo = (uuid: string) =>
     async (dispatch: Dispatch) => {
@@ -32,6 +33,8 @@ export const navigateTo = (uuid: string) =>
             dispatch(navigateToWorkflows);
         } else if (uuid === SidePanelTreeCategory.TRASH) {
             dispatch(navigateToTrash);
+        } else if (uuid === GROUPS_PANEL_LABEL) {
+            dispatch(navigateToGroups);
         }
     };
 
@@ -74,6 +77,8 @@ export const navigateToSshKeysAdmin= push(Routes.SSH_KEYS_ADMIN);
 
 export const navigateToSshKeysUser= push(Routes.SSH_KEYS_USER);
 
+export const navigateToSiteManager= push(Routes.SITE_MANAGER);
+
 export const navigateToMyAccount = push(Routes.MY_ACCOUNT);
 
 export const navigateToKeepServices = push(Routes.KEEP_SERVICES);
@@ -84,4 +89,8 @@ export const navigateToUsers = push(Routes.USERS);
 
 export const navigateToApiClientAuthorizations = push(Routes.API_CLIENT_AUTHORIZATIONS);
 
-export const navigateToLinks = push(Routes.LINKS);
\ No newline at end of file
+export const navigateToGroups = push(Routes.GROUPS);
+
+export const navigateToGroupDetails = compose(push, getGroupUrl);
+
+export const navigateToLinks = push(Routes.LINKS);
index d196e632d24f8fe3a7f8bc3062d8a7c2bd8cb01f..14a6ba11d7651930b878919fa3f3f5d2bb54205a 100644 (file)
@@ -49,6 +49,10 @@ import { keepServicesReducer } from '~/store/keep-services/keep-services-reducer
 import { UserMiddlewareService } from '~/store/users/user-panel-middleware-service';
 import { USERS_PANEL_ID } from '~/store/users/users-actions';
 import { apiClientAuthorizationsReducer } from '~/store/api-client-authorizations/api-client-authorizations-reducer';
+import { GroupsPanelMiddlewareService } from '~/store/groups-panel/groups-panel-middleware-service';
+import { GROUPS_PANEL_ID } from '~/store/groups-panel/groups-panel-actions';
+import { GroupDetailsPanelMiddlewareService } from '~/store/group-details-panel/group-details-panel-middleware-service';
+import { GROUP_DETAILS_PANEL_ID } from '~/store/group-details-panel/group-details-panel-actions';
 import { LINK_PANEL_ID } from '~/store/link-panel/link-panel-actions';
 import { LinkMiddlewareService } from '~/store/link-panel/link-panel-middleware-service';
 import { COMPUTE_NODE_PANEL_ID } from '~/store/compute-nodes/compute-nodes-actions';
@@ -87,6 +91,13 @@ export function configureStore(history: History, services: ServiceRepository): R
     const userPanelMiddleware = dataExplorerMiddleware(
         new UserMiddlewareService(services, USERS_PANEL_ID)
     );
+    const groupsPanelMiddleware = dataExplorerMiddleware(
+        new GroupsPanelMiddlewareService(services, GROUPS_PANEL_ID)
+    );
+    const groupDetailsPanelMiddleware = dataExplorerMiddleware(
+        new GroupDetailsPanelMiddlewareService(services, GROUP_DETAILS_PANEL_ID)
+    );
+
     const linkPanelMiddleware = dataExplorerMiddleware(
         new LinkMiddlewareService(services, LINK_PANEL_ID)
     );
@@ -103,8 +114,10 @@ export function configureStore(history: History, services: ServiceRepository): R
         sharedWithMePanelMiddleware,
         workflowPanelMiddleware,
         userPanelMiddleware,
+        groupsPanelMiddleware,
+        groupDetailsPanelMiddleware,
         linkPanelMiddleware,
-        computeNodeMiddleware
+        computeNodeMiddleware,
     ];
     const enhancer = composeEnhancers(applyMiddleware(...middlewares));
     return createStore(rootReducer, enhancer);
index e42e6c3ea1a8520f1961e0d5751bf83bb6e22e44..46ab1f59e9825bf712fc9425c27b78b7369d80a3 100644 (file)
@@ -14,7 +14,7 @@ import { favoritePanelActions } from '~/store/favorite-panel/favorite-panel-acti
 import { projectPanelColumns } from '~/views/project-panel/project-panel';
 import { favoritePanelColumns } from '~/views/favorite-panel/favorite-panel';
 import { matchRootRoute } from '~/routes/routes';
-import { setSidePanelBreadcrumbs, setProcessBreadcrumbs, setSharedWithMeBreadcrumbs, setTrashBreadcrumbs, setBreadcrumbs } from '~/store/breadcrumbs/breadcrumbs-actions';
+import { setSidePanelBreadcrumbs, setProcessBreadcrumbs, setSharedWithMeBreadcrumbs, setTrashBreadcrumbs, setBreadcrumbs, setGroupDetailsBreadcrumbs, setGroupsBreadcrumbs } from '~/store/breadcrumbs/breadcrumbs-actions';
 import { navigateToProject } from '~/store/navigation/navigation-action';
 import { MoveToFormDialogData } from '~/store/move-to-dialog/move-to-dialog';
 import { ServiceRepository } from '~/services/services';
@@ -39,8 +39,9 @@ import { sharedWithMePanelActions } from '~/store/shared-with-me-panel/shared-wi
 import { loadSharedWithMePanel } from '~/store/shared-with-me-panel/shared-with-me-panel-actions';
 import { CopyFormDialogData } from '~/store/copy-dialog/copy-dialog';
 import { loadWorkflowPanel, workflowPanelActions } from '~/store/workflow-panel/workflow-panel-actions';
-import { loadSshKeysPanel } from '~/store/auth/auth-action';
+import { loadSshKeysPanel } from '~/store/auth/auth-action-ssh';
 import { loadMyAccountPanel } from '~/store/my-account/my-account-panel-actions';
+import { loadSiteManagerPanel } from '~/store/auth/auth-action-session';
 import { workflowPanelColumns } from '~/views/workflow-panel/workflow-panel-view';
 import { progressIndicatorActions } from '~/store/progress-indicator/progress-indicator-actions';
 import { getProgressIndicator } from '~/store/progress-indicator/progress-indicator-reducer';
@@ -65,6 +66,10 @@ import { linkPanelColumns } from '~/views/link-panel/link-panel-root';
 import { userPanelColumns } from '~/views/user-panel/user-panel';
 import { computeNodePanelColumns } from '~/views/compute-node-panel/compute-node-panel-root';
 import { loadApiClientAuthorizationsPanel } from '~/store/api-client-authorizations/api-client-authorizations-actions';
+import * as groupPanelActions from '~/store/groups-panel/groups-panel-actions';
+import { groupsPanelColumns } from '~/views/groups-panel/groups-panel';
+import * as groupDetailsPanelActions from '~/store/group-details-panel/group-details-panel-actions';
+import { groupDetailsPanelColumns } from '~/views/group-details-panel/group-details-panel';
 
 export const WORKBENCH_LOADING_SCREEN = 'workbenchLoadingScreen';
 
@@ -99,6 +104,8 @@ export const loadWorkbench = () =>
                 dispatch(workflowPanelActions.SET_COLUMNS({ columns: workflowPanelColumns }));
                 dispatch(searchResultsPanelActions.SET_COLUMNS({ columns: searchResultsPanelColumns }));
                 dispatch(userBindedActions.SET_COLUMNS({ columns: userPanelColumns }));
+                dispatch(groupPanelActions.GroupsPanelActions.SET_COLUMNS({ columns: groupsPanelColumns }));
+                dispatch(groupDetailsPanelActions.GroupDetailsPanelActions.SET_COLUMNS({columns: groupDetailsPanelColumns}));
                 dispatch(linkPanelActions.SET_COLUMNS({ columns: linkPanelColumns }));
                 dispatch(computeNodesActions.SET_COLUMNS({ columns: computeNodePanelColumns }));
                 dispatch<any>(initSidePanelTree());
@@ -429,6 +436,11 @@ export const loadSshKeys = handleFirstTimeLoad(
         await dispatch(loadSshKeysPanel());
     });
 
+export const loadSiteManager = handleFirstTimeLoad(
+async (dispatch: Dispatch<any>) => {
+    await dispatch(loadSiteManagerPanel());
+});
+
 export const loadMyAccount = handleFirstTimeLoad(
     (dispatch: Dispatch<any>) => {
         dispatch(loadMyAccountPanel());
@@ -455,6 +467,20 @@ export const loadApiClientAuthorizations = handleFirstTimeLoad(
         await dispatch(loadApiClientAuthorizationsPanel());
     });
 
+export const loadGroupsPanel = handleFirstTimeLoad(
+    (dispatch: Dispatch<any>) => {
+        dispatch(setGroupsBreadcrumbs());
+        dispatch(groupPanelActions.loadGroupsPanel());
+    });
+
+
+export const loadGroupDetailsPanel = (groupUuid: string) =>
+    handleFirstTimeLoad(
+        (dispatch: Dispatch<any>) => {
+            dispatch(setGroupDetailsBreadcrumbs(groupUuid));
+            dispatch(groupDetailsPanelActions.loadGroupDetailsPanel(groupUuid));
+        });
+
 const finishLoadingProject = (project: GroupContentsResource | string) =>
     async (dispatch: Dispatch<any>) => {
         const uuid = typeof project === 'string' ? project : project.uuid;
diff --git a/src/validators/is-remote-host.tsx b/src/validators/is-remote-host.tsx
new file mode 100644 (file)
index 0000000..b5e2231
--- /dev/null
@@ -0,0 +1,10 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+
+const ERROR_MESSAGE = 'Remote host is invalid';
+
+export const isRemoteHost = (value: string) => {
+    return value.match(/\w+\.\w+\.\w+/i) ? undefined : ERROR_MESSAGE;
+};
diff --git a/src/validators/min-length.tsx b/src/validators/min-length.tsx
new file mode 100644 (file)
index 0000000..9b26953
--- /dev/null
@@ -0,0 +1,10 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+export const ERROR_MESSAGE = (minLength: number) => `Min length is ${minLength}`;
+
+export const minLength =
+    (minLength: number, errorMessage = ERROR_MESSAGE) =>
+        (value: { length: number }) =>
+            value && value.length >= minLength ? undefined : errorMessage(minLength);
index 9bc76419ff03fd713311a25c60b7dc0a4d0822ba..acef9744311ccd82a5d43dcc482eb0250c47cb60 100644 (file)
@@ -5,6 +5,7 @@
 import { require } from './require';
 import { maxLength } from './max-length';
 import { isRsaKey } from './is-rsa-key';
+import { isRemoteHost } from "./is-remote-host";
 
 export const TAG_KEY_VALIDATION = [require, maxLength(255)];
 export const TAG_VALUE_VALIDATION = [require, maxLength(255)];
@@ -31,4 +32,6 @@ export const USER_LENGTH_VALIDATION = [maxLength(255)];
 export const SSH_KEY_PUBLIC_VALIDATION = [require, isRsaKey, maxLength(1024)];
 export const SSH_KEY_NAME_VALIDATION = [require, maxLength(255)];
 
+export const SITE_MANAGER_REMOTE_HOST_VALIDATION = [require, isRemoteHost, maxLength(255)];
+
 export const MY_ACCOUNT_VALIDATION = [require];
index 718d35891e1cee22735c523821a8725313abb86c..43c55a92c9addbd8031fd537b5c59528b620e7ca 100644 (file)
@@ -5,13 +5,17 @@
 import { RouteProps } from "react-router";
 import * as React from "react";
 import { connect, DispatchProp } from "react-redux";
-import { getUserDetails, saveApiToken } from "~/store/auth/auth-action";
+import { authActions, getUserDetails, saveApiToken } from "~/store/auth/auth-action";
 import { getUrlParameter } from "~/common/url";
 import { AuthService } from "~/services/auth-service/auth-service";
 import { navigateToRootProject } from "~/store/navigation/navigation-action";
+import { User } from "~/models/user";
+import { Config } from "~/common/config";
+import { initSessions } from "~/store/auth/auth-action-session";
 
 interface ApiTokenProps {
     authService: AuthService;
+    config: Config;
 }
 
 export const ApiToken = connect()(
@@ -20,7 +24,9 @@ export const ApiToken = connect()(
             const search = this.props.location ? this.props.location.search : "";
             const apiToken = getUrlParameter(search, 'api_token');
             this.props.dispatch(saveApiToken(apiToken));
-            this.props.dispatch<any>(getUserDetails()).finally(() => {
+            this.props.dispatch<any>(getUserDetails()).then((user: User) => {
+                this.props.dispatch(initSessions(this.props.authService, this.props.config, user));
+            }).finally(() => {
                 this.props.dispatch(navigateToRootProject);
             });
         }
index b55648917329723d6cec917b8e73b53725695673..94f702e822913dda057fa6869925222bd3b7e5ae 100644 (file)
@@ -6,6 +6,7 @@ import { ContextMenuActionSet } from "../context-menu-action-set";
 import { RenameIcon, RemoveIcon } from "~/components/icon/icon";
 import { DownloadCollectionFileAction } from "../actions/download-collection-file-action";
 import { openFileRemoveDialog, openRenameFileDialog } from '~/store/collection-panel/collection-panel-files/collection-panel-files-actions';
+import { FileViewerActions } from '~/views-components/context-menu/actions/file-viewer-actions';
 
 
 export const collectionFilesItemActionSet: ContextMenuActionSet = [[{
@@ -23,4 +24,7 @@ export const collectionFilesItemActionSet: ContextMenuActionSet = [[{
     execute: (dispatch, resource) => {
         dispatch<any>(openFileRemoveDialog(resource.uuid));
     }
+}], [{
+    component: FileViewerActions,
+    execute: () => { return; },
 }]];
diff --git a/src/views-components/context-menu/action-sets/group-action-set.ts b/src/views-components/context-menu/action-sets/group-action-set.ts
new file mode 100644 (file)
index 0000000..8d718a3
--- /dev/null
@@ -0,0 +1,28 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { ContextMenuActionSet } from "~/views-components/context-menu/context-menu-action-set";
+import { AdvancedIcon, RemoveIcon, AttributesIcon } from "~/components/icon/icon";
+import { openAdvancedTabDialog } from "~/store/advanced-tab/advanced-tab";
+import { openGroupAttributes, openRemoveGroupDialog } from "~/store/groups-panel/groups-panel-actions";
+
+export const groupActionSet: ContextMenuActionSet = [[{
+    name: "Attributes",
+    icon: AttributesIcon,
+    execute: (dispatch, { uuid }) => {
+        dispatch<any>(openGroupAttributes(uuid));
+    }
+}, {
+    name: "Advanced",
+    icon: AdvancedIcon,
+    execute: (dispatch, resource) => {
+        dispatch<any>(openAdvancedTabDialog(resource.uuid));
+    }
+}, {
+    name: "Remove",
+    icon: RemoveIcon,
+    execute: (dispatch, { uuid }) => {
+        dispatch<any>(openRemoveGroupDialog(uuid));
+    }
+}]];
\ No newline at end of file
diff --git a/src/views-components/context-menu/action-sets/group-member-action-set.ts b/src/views-components/context-menu/action-sets/group-member-action-set.ts
new file mode 100644 (file)
index 0000000..a8b3dd1
--- /dev/null
@@ -0,0 +1,28 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { ContextMenuActionSet } from "~/views-components/context-menu/context-menu-action-set";
+import { AdvancedIcon, RemoveIcon, AttributesIcon } from "~/components/icon/icon";
+import { openAdvancedTabDialog } from "~/store/advanced-tab/advanced-tab";
+import { openGroupMemberAttributes, openRemoveGroupMemberDialog } from '~/store/group-details-panel/group-details-panel-actions';
+
+export const groupMemberActionSet: ContextMenuActionSet = [[{
+    name: "Attributes",
+    icon: AttributesIcon,
+    execute: (dispatch, { uuid }) => {
+        dispatch<any>(openGroupMemberAttributes(uuid));
+    }
+}, {
+    name: "Advanced",
+    icon: AdvancedIcon,
+    execute: (dispatch, resource) => {
+        dispatch<any>(openAdvancedTabDialog(resource.uuid));
+    }
+}, {
+    name: "Remove",
+    icon: RemoveIcon,
+    execute: (dispatch, { uuid }) => {
+        dispatch<any>(openRemoveGroupMemberDialog(uuid));
+    }
+}]];
\ No newline at end of file
index 0ce0c43118549b9107a17f8e9c3bf515b53f50a3..c2885185eabac9432c357c0d50a021d569179059 100644 (file)
@@ -4,7 +4,7 @@
 
 import { ContextMenuActionSet } from "~/views-components/context-menu/context-menu-action-set";
 import { AdvancedIcon, RemoveIcon, AttributesIcon } from "~/components/icon/icon";
-import { openSshKeyRemoveDialog, openSshKeyAttributesDialog } from '~/store/auth/auth-action';
+import { openSshKeyRemoveDialog, openSshKeyAttributesDialog } from '~/store/auth/auth-action-ssh';
 import { openAdvancedTabDialog } from '~/store/advanced-tab/advanced-tab';
 
 export const sshKeyActionSet: ContextMenuActionSet = [[{
diff --git a/src/views-components/context-menu/actions/file-viewer-actions.tsx b/src/views-components/context-menu/actions/file-viewer-actions.tsx
new file mode 100644 (file)
index 0000000..961e182
--- /dev/null
@@ -0,0 +1,81 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from "react";
+import { ListItemText, ListItem, ListItemIcon, Icon } from "@material-ui/core";
+import { RootState } from '~/store/store';
+import { getNodeValue } from '~/models/tree';
+import { CollectionDirectory, CollectionFile, CollectionFileType } from '~/models/collection-file';
+import { FileViewerList, FileViewer } from '~/models/file-viewers-config';
+import { getFileViewers } from '~/store/file-viewers/file-viewers-selectors';
+import { connect } from 'react-redux';
+import { OpenIcon } from '~/components/icon/icon';
+
+interface FileViewerActionProps {
+    fileUrl: string;
+    viewers: FileViewerList;
+}
+
+const mapStateToProps = (state: RootState): FileViewerActionProps => {
+    const { resource } = state.contextMenu;
+    if (resource) {
+        const file = getNodeValue(resource.uuid)(state.collectionPanelFiles);
+        if (file) {
+            const fileViewers = getFileViewers(state.properties);
+            return {
+                fileUrl: file.url,
+                viewers: fileViewers.filter(enabledViewers(file)),
+            };
+        }
+    }
+    return {
+        fileUrl: '',
+        viewers: [],
+    };
+};
+
+const enabledViewers = (file: CollectionFile | CollectionDirectory) =>
+    ({ extensions, collections }: FileViewer) => {
+        if (collections && file.type === CollectionFileType.DIRECTORY) {
+            return true;
+        } else if (extensions) {
+            return extensions.some(extension => file.name.endsWith(extension));
+        } else {
+            return true;
+        }
+    };
+
+const fillViewerUrl = (fileUrl: string, { url, filePathParam }: FileViewer) => {
+    const viewerUrl = new URL(url);
+    viewerUrl.searchParams.append(filePathParam, fileUrl);
+    return viewerUrl.href;
+};
+
+export const FileViewerActions = connect(mapStateToProps)(
+    ({ fileUrl, viewers, onClick }: FileViewerActionProps & { onClick: () => void }) =>
+        <>
+            {viewers.map(viewer =>
+                <ListItem
+                    button
+                    component='a'
+                    key={viewer.name}
+                    style={{ textDecoration: 'none' }}
+                    href={fillViewerUrl(fileUrl, viewer)}
+                    onClick={onClick}
+                    target='_blank'>
+                    <ListItemIcon>
+                        {
+                            viewer.iconUrl
+                                ? <Icon>
+                                    <img src={viewer.iconUrl} />
+                                </Icon>
+                                : <OpenIcon />
+                        }
+                    </ListItemIcon>
+                    <ListItemText>
+                        {viewer.name}
+                    </ListItemText>
+                </ListItem>
+            )}
+        </>);
index a9200ebb363df15541e6da5abe641c8200d98309..4ce2f5214d5f337d2488f0acb232d6d1ea5f1b0d 100644 (file)
@@ -75,6 +75,8 @@ export enum ContextMenuKind {
     VIRTUAL_MACHINE = "VirtualMachine",
     KEEP_SERVICE = "KeepService",
     USER = "User",
+    NODE = "Node",
+    GROUPS = "Group",
+    GROUP_MEMBER = "GroupMember",
     LINK = "Link",
-    NODE = "Node"
 }
index 710d202dfe25997c66dcde62f44ead0d9e469b10..8cddf3ba1a5eea67880519a292a46d5146c58e5f 100644 (file)
@@ -23,7 +23,8 @@ interface Props {
 const mapStateToProps = (state: RootState, { id }: Props) => {
     const progress = state.progressIndicator.find(p => p.id === id);
     const working = progress && progress.working;
-    return { ...getDataExplorer(state.dataExplorer, id), working };
+    const currentRoute = state.router.location ? state.router.location.pathname : '';
+    return { ...getDataExplorer(state.dataExplorer, id), working, paperKey: currentRoute };
 };
 
 const mapDispatchToProps = () => {
index b7c9b1fbe6e19bba50db582618c1455c75813cf0..aed1cd245dd26b0f3a5ad647758c196e34238271 100644 (file)
@@ -7,7 +7,7 @@ import { InjectedFormProps } from 'redux-form';
 import { WithDialogProps } from '~/store/dialog/with-dialog';
 import { FormDialog } from '~/components/form-dialog/form-dialog';
 import { SshKeyPublicField, SshKeyNameField } from '~/views-components/form-fields/ssh-key-form-fields';
-import { SshKeyCreateFormDialogData } from '~/store/auth/auth-action';
+import { SshKeyCreateFormDialogData } from '~/store/auth/auth-action-ssh';
 
 type DialogSshKeyProps = WithDialogProps<{}> & InjectedFormProps<SshKeyCreateFormDialogData>;
 
diff --git a/src/views-components/dialog-forms/add-group-member-dialog.tsx b/src/views-components/dialog-forms/add-group-member-dialog.tsx
new file mode 100644 (file)
index 0000000..f4a5c2c
--- /dev/null
@@ -0,0 +1,48 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from 'react';
+import { compose } from "redux";
+import { reduxForm, InjectedFormProps, WrappedFieldArrayProps, FieldArray } from 'redux-form';
+import { withDialog, WithDialogProps } from "~/store/dialog/with-dialog";
+import { FormDialog } from '~/components/form-dialog/form-dialog';
+import { PeopleSelect, Person } from '~/views-components/sharing-dialog/people-select';
+import { ADD_GROUP_MEMBERS_DIALOG, ADD_GROUP_MEMBERS_FORM, AddGroupMembersFormData, ADD_GROUP_MEMBERS_USERS_FIELD_NAME, addGroupMembers } from '~/store/group-details-panel/group-details-panel-actions';
+import { minLength } from '~/validators/min-length';
+
+export const AddGroupMembersDialog = compose(
+    withDialog(ADD_GROUP_MEMBERS_DIALOG),
+    reduxForm<AddGroupMembersFormData>({
+        form: ADD_GROUP_MEMBERS_FORM,
+        onSubmit: (data, dispatch) => {
+            dispatch(addGroupMembers(data));
+        },
+    })
+)(
+    (props: AddGroupMembersDialogProps) =>
+        <FormDialog
+            dialogTitle='Add users'
+            formFields={UsersField}
+            submitLabel='Add'
+            {...props}
+        />
+);
+
+type AddGroupMembersDialogProps = WithDialogProps<{}> & InjectedFormProps<AddGroupMembersFormData>;
+
+const UsersField = () =>
+    <FieldArray
+        name={ADD_GROUP_MEMBERS_USERS_FIELD_NAME}
+        component={UsersSelect}
+        validate={UsersFieldValidation} />;
+
+const UsersFieldValidation = [minLength(1, () => 'Select at least one user')];
+
+const UsersSelect = ({ fields }: WrappedFieldArrayProps<Person>) =>
+    <PeopleSelect
+        autofocus
+        label='Enter email adresses '
+        items={fields.getAll() || []}
+        onSelect={fields.push}
+        onDelete={fields.remove} />;
diff --git a/src/views-components/dialog-forms/create-group-dialog.tsx b/src/views-components/dialog-forms/create-group-dialog.tsx
new file mode 100644 (file)
index 0000000..554ad79
--- /dev/null
@@ -0,0 +1,62 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from 'react';
+import { compose } from "redux";
+import { reduxForm, InjectedFormProps, Field, WrappedFieldArrayProps, FieldArray } from 'redux-form';
+import { withDialog, WithDialogProps } from "~/store/dialog/with-dialog";
+import { FormDialog } from '~/components/form-dialog/form-dialog';
+import { CREATE_GROUP_DIALOG, CREATE_GROUP_FORM, createGroup, CreateGroupFormData, CREATE_GROUP_NAME_FIELD_NAME, CREATE_GROUP_USERS_FIELD_NAME } from '~/store/groups-panel/groups-panel-actions';
+import { TextField } from '~/components/text-field/text-field';
+import { maxLength } from '~/validators/max-length';
+import { require } from '~/validators/require';
+import { PeopleSelect, Person } from '~/views-components/sharing-dialog/people-select';
+
+export const CreateGroupDialog = compose(
+    withDialog(CREATE_GROUP_DIALOG),
+    reduxForm<CreateGroupFormData>({
+        form: CREATE_GROUP_FORM,
+        onSubmit: (data, dispatch) => {
+            dispatch(createGroup(data));
+        }
+    })
+)(
+    (props: CreateGroupDialogComponentProps) =>
+        <FormDialog
+            dialogTitle='Create a group'
+            formFields={CreateGroupFormFields}
+            submitLabel='Create'
+            {...props}
+        />
+);
+
+type CreateGroupDialogComponentProps = WithDialogProps<{}> & InjectedFormProps<CreateGroupFormData>;
+
+const CreateGroupFormFields = () =>
+    <>
+        <GroupNameField />
+        <UsersField />
+    </>;
+
+const GroupNameField = () =>
+    <Field
+        name={CREATE_GROUP_NAME_FIELD_NAME}
+        component={TextField}
+        validate={GROUP_NAME_VALIDATION}
+        label="Name"
+        autoFocus={true} />;
+
+const GROUP_NAME_VALIDATION = [require, maxLength(255)];
+
+const UsersField = () =>
+    <FieldArray
+        name={CREATE_GROUP_USERS_FIELD_NAME}
+        component={UsersSelect} />;
+
+const UsersSelect = ({ fields }: WrappedFieldArrayProps<Person>) =>
+    <PeopleSelect
+        label='Enter email adresses '
+        items={fields.getAll() || []}
+        onSelect={fields.push}
+        onDelete={fields.remove} />;
index e96524338dd626bd333b3f3d6afd93dc91e85335..6472c3ae57a5c8743db8c7bbc7da2dc466d6fe9d 100644 (file)
@@ -5,7 +5,11 @@
 import { compose } from "redux";
 import { reduxForm } from 'redux-form';
 import { withDialog } from "~/store/dialog/with-dialog";
-import { SSH_KEY_CREATE_FORM_NAME, createSshKey, SshKeyCreateFormDialogData } from '~/store/auth/auth-action';
+import {
+    SSH_KEY_CREATE_FORM_NAME,
+    createSshKey,
+    SshKeyCreateFormDialogData
+} from '~/store/auth/auth-action-ssh';
 import { DialogSshKeyCreate } from '~/views-components/dialog-create/dialog-ssh-key-create';
 
 export const CreateSshKeyDialog = compose(
@@ -16,4 +20,4 @@ export const CreateSshKeyDialog = compose(
             dispatch(createSshKey(data));
         }
     })
-)(DialogSshKeyCreate);
\ No newline at end of file
+)(DialogSshKeyCreate);
index da0b12b55311fc045819c8f5d4b7641f0c6df045..85abbe19f3f266769bb70b9f1da0e03d847399f1 100644 (file)
@@ -3,7 +3,7 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import * as React from "react";
-import { Field, WrappedFieldProps, FieldArray } from 'redux-form';
+import { Field, WrappedFieldProps, FieldArray, formValues } from 'redux-form';
 import { TextField, DateTextField } from "~/components/text-field/text-field";
 import { CheckboxField } from '~/components/checkbox-field/checkbox-field';
 import { NativeSelectField } from '~/components/select-field/select-field';
@@ -14,6 +14,10 @@ import { SEARCH_BAR_ADVANCE_FORM_PICKER_ID } from '~/store/search-bar/search-bar
 import { SearchBarAdvancedPropertiesView } from '~/views-components/search-bar/search-bar-advanced-properties-view';
 import { TreeItem } from "~/components/tree/tree";
 import { ProjectsTreePickerItem } from "~/views-components/projects-tree-picker/generic-projects-tree-picker";
+import { PropertyKeyInput } from '~/views-components/resource-properties-form/property-key-field';
+import { PropertyValueInput, PropertyValueFieldProps } from '~/views-components/resource-properties-form/property-value-field';
+import { VocabularyProp, connectVocabulary } from '~/views-components/resource-properties-form/property-field-common';
+import { compose } from 'redux';
 
 export const SearchBarTypeField = () =>
     <Field
@@ -50,7 +54,7 @@ const ProjectsPicker = (props: WrappedFieldProps) =>
                 (_: any, { id }: TreeItem<ProjectsTreePickerItem>) => {
                     props.input.onChange(id);
                 }
-            }/>
+            } />
     </div>;
 
 export const SearchBarTrashField = () =>
@@ -74,17 +78,22 @@ export const SearchBarPropertiesField = () =>
         name="properties"
         component={SearchBarAdvancedPropertiesView} />;
 
-export const SearchBarKeyField = () =>
-    <Field
-        name='key'
-        component={TextField}
-        label="Key" />;
+export const SearchBarKeyField = connectVocabulary(
+    ({ vocabulary }: VocabularyProp) =>
+        <Field
+            name='key'
+            component={PropertyKeyInput}
+            vocabulary={vocabulary} />);
 
-export const SearchBarValueField = () =>
-    <Field
-        name='value'
-        component={TextField}
-        label="Value" />;
+export const SearchBarValueField = compose(
+    connectVocabulary,
+    formValues({ propertyKey: 'key' })
+)(
+    (props: PropertyValueFieldProps) =>
+        <Field
+            name='value'
+            component={PropertyValueInput}
+            {...props} />);
 
 export const SearchBarSaveSearchField = () =>
     <Field
diff --git a/src/views-components/groups-dialog/attributes-dialog.tsx b/src/views-components/groups-dialog/attributes-dialog.tsx
new file mode 100644 (file)
index 0000000..f6ab8c1
--- /dev/null
@@ -0,0 +1,101 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from "react";
+import { Dialog, DialogTitle, DialogContent, DialogActions, Button, Typography, Grid } from "@material-ui/core";
+import { WithDialogProps } from "~/store/dialog/with-dialog";
+import { withDialog } from '~/store/dialog/with-dialog';
+import { WithStyles, withStyles } from '@material-ui/core/styles';
+import { ArvadosTheme } from '~/common/custom-theme';
+import { compose } from "redux";
+import { GroupResource } from "~/models/group";
+import { GROUP_ATTRIBUTES_DIALOG } from "~/store/groups-panel/groups-panel-actions";
+
+type CssRules = 'rightContainer' | 'leftContainer' | 'spacing';
+
+const styles = withStyles<CssRules>((theme: ArvadosTheme) => ({
+    rightContainer: {
+        textAlign: 'right',
+        paddingRight: theme.spacing.unit * 2,
+        color: theme.palette.grey["500"]
+    },
+    leftContainer: {
+        textAlign: 'left',
+        paddingLeft: theme.spacing.unit * 2
+    },
+    spacing: {
+        paddingTop: theme.spacing.unit * 2
+    },
+}));
+
+interface GroupAttributesDataProps {
+    data: GroupResource;
+}
+
+type GroupAttributesProps = GroupAttributesDataProps & WithStyles<CssRules>;
+
+export const GroupAttributesDialog = compose(
+    withDialog(GROUP_ATTRIBUTES_DIALOG),
+    styles)(
+        (props: WithDialogProps<GroupAttributesProps> & GroupAttributesProps) =>
+            <Dialog open={props.open}
+                onClose={props.closeDialog}
+                fullWidth
+                maxWidth="sm">
+                <DialogTitle>Attributes</DialogTitle>
+                <DialogContent>
+                    <Typography variant="body2" className={props.classes.spacing}>
+                        {props.data && attributes(props.data, props.classes)}
+                    </Typography>
+                </DialogContent>
+                <DialogActions>
+                    <Button
+                        variant='flat'
+                        color='primary'
+                        onClick={props.closeDialog}>
+                        Close
+                </Button>
+                </DialogActions>
+            </Dialog>
+    );
+
+const attributes = (group: GroupResource, classes: any) => {
+    const { uuid, ownerUuid, createdAt, modifiedAt, modifiedByClientUuid, modifiedByUserUuid, name, deleteAt, description, etag, href, isTrashed, trashAt} = group;
+    return (
+        <span>
+            <Grid container direction="row">
+                <Grid item xs={5} className={classes.rightContainer}>
+                    {name && <Grid item>Name</Grid>}
+                    {ownerUuid && <Grid item>Owner uuid</Grid>}
+                    {createdAt && <Grid item>Created at</Grid>}
+                    {modifiedAt && <Grid item>Modified at</Grid>}
+                    {modifiedByUserUuid && <Grid item>Modified by user uuid</Grid>}
+                    {modifiedByClientUuid && <Grid item>Modified by client uuid</Grid>}
+                    {uuid && <Grid item>uuid</Grid>}
+                    {deleteAt && <Grid item>Delete at</Grid>}
+                    {description && <Grid item>Description</Grid>}
+                    {etag && <Grid item>Etag</Grid>}
+                    {href && <Grid item>Href</Grid>}
+                    {isTrashed && <Grid item>Is trashed</Grid>}
+                    {trashAt && <Grid item>Trashed at</Grid>}
+                </Grid>
+                <Grid item xs={7} className={classes.leftContainer}>
+                    <Grid item>{name}</Grid>
+                    <Grid item>{ownerUuid}</Grid>
+                    <Grid item>{createdAt}</Grid>
+                    <Grid item>{modifiedAt}</Grid>
+                    <Grid item>{modifiedByUserUuid}</Grid>
+                    <Grid item>{modifiedByClientUuid}</Grid>
+                    <Grid item>{uuid}</Grid>
+                    <Grid item>{deleteAt}</Grid>
+                    <Grid item>{description}</Grid>
+                    <Grid item>{etag}</Grid>
+                    <Grid item>{href}</Grid>
+                    <Grid item>{isTrashed}</Grid>
+                    <Grid item>{trashAt}</Grid>
+                </Grid>
+            </Grid>
+        </span>
+    );
+};
diff --git a/src/views-components/groups-dialog/member-attributes-dialog.tsx b/src/views-components/groups-dialog/member-attributes-dialog.tsx
new file mode 100644 (file)
index 0000000..7aa8653
--- /dev/null
@@ -0,0 +1,95 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from "react";
+import { Dialog, DialogTitle, DialogContent, DialogActions, Button, Typography, Grid } from "@material-ui/core";
+import { WithDialogProps } from "~/store/dialog/with-dialog";
+import { withDialog } from '~/store/dialog/with-dialog';
+import { WithStyles, withStyles } from '@material-ui/core/styles';
+import { ArvadosTheme } from '~/common/custom-theme';
+import { compose } from "redux";
+import { PermissionResource } from "~/models/permission";
+import { MEMBER_ATTRIBUTES_DIALOG } from '~/store/group-details-panel/group-details-panel-actions';
+
+type CssRules = 'rightContainer' | 'leftContainer' | 'spacing';
+
+const styles = withStyles<CssRules>((theme: ArvadosTheme) => ({
+    rightContainer: {
+        textAlign: 'right',
+        paddingRight: theme.spacing.unit * 2,
+        color: theme.palette.grey["500"]
+    },
+    leftContainer: {
+        textAlign: 'left',
+        paddingLeft: theme.spacing.unit * 2
+    },
+    spacing: {
+        paddingTop: theme.spacing.unit * 2
+    },
+}));
+
+interface GroupAttributesDataProps {
+    data: PermissionResource;
+}
+
+type GroupAttributesProps = GroupAttributesDataProps & WithStyles<CssRules>;
+
+export const GroupMemberAttributesDialog = compose(
+    withDialog(MEMBER_ATTRIBUTES_DIALOG),
+    styles)(
+        (props: WithDialogProps<GroupAttributesProps> & GroupAttributesProps) =>
+            <Dialog open={props.open}
+                onClose={props.closeDialog}
+                fullWidth
+                maxWidth="sm">
+                <DialogTitle>Attributes</DialogTitle>
+                <DialogContent>
+                    <Typography variant="body2" className={props.classes.spacing}>
+                        {props.data && attributes(props.data, props.classes)}
+                    </Typography>
+                </DialogContent>
+                <DialogActions>
+                    <Button
+                        variant='flat'
+                        color='primary'
+                        onClick={props.closeDialog}>
+                        Close
+                </Button>
+                </DialogActions>
+            </Dialog>
+    );
+
+const attributes = (memberGroup: PermissionResource, classes: any) => {
+    const { uuid, ownerUuid, createdAt, modifiedAt, modifiedByClientUuid, modifiedByUserUuid, name, etag, href, linkClass } = memberGroup;
+    return (
+        <span>
+            <Grid container direction="row">
+                <Grid item xs={5} className={classes.rightContainer}>
+                    {name && <Grid item>Name</Grid>}
+                    {ownerUuid && <Grid item>Owner uuid</Grid>}
+                    {createdAt && <Grid item>Created at</Grid>}
+                    {modifiedAt && <Grid item>Modified at</Grid>}
+                    {modifiedByUserUuid && <Grid item>Modified by user uuid</Grid>}
+                    {modifiedByClientUuid && <Grid item>Modified by client uuid</Grid>}
+                    {uuid && <Grid item>uuid</Grid>}
+                    {linkClass && <Grid item>Link Class</Grid>}
+                    {etag && <Grid item>Etag</Grid>}
+                    {href && <Grid item>Href</Grid>}
+                </Grid>
+                <Grid item xs={7} className={classes.leftContainer}>
+                    <Grid item>{name}</Grid>
+                    <Grid item>{ownerUuid}</Grid>
+                    <Grid item>{createdAt}</Grid>
+                    <Grid item>{modifiedAt}</Grid>
+                    <Grid item>{modifiedByUserUuid}</Grid>
+                    <Grid item>{modifiedByClientUuid}</Grid>
+                    <Grid item>{uuid}</Grid>
+                    <Grid item>{linkClass}</Grid>
+                    <Grid item>{etag}</Grid>
+                    <Grid item>{href}</Grid>
+                </Grid>
+            </Grid>
+        </span>
+    );
+};
diff --git a/src/views-components/groups-dialog/member-remove-dialog.ts b/src/views-components/groups-dialog/member-remove-dialog.ts
new file mode 100644 (file)
index 0000000..bb5c3a2
--- /dev/null
@@ -0,0 +1,21 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { Dispatch, compose } from 'redux';
+import { connect } from "react-redux";
+import { ConfirmationDialog } from "~/components/confirmation-dialog/confirmation-dialog";
+import { withDialog, WithDialogProps } from "~/store/dialog/with-dialog";
+import { removeGroupMember, MEMBER_REMOVE_DIALOG } from '~/store/group-details-panel/group-details-panel-actions';
+
+const mapDispatchToProps = (dispatch: Dispatch, props: WithDialogProps<any>) => ({
+    onConfirm: () => {
+        props.closeDialog();
+        dispatch<any>(removeGroupMember(props.data.uuid));
+    }
+});
+
+export const RemoveGroupMemberDialog = compose(
+    withDialog(MEMBER_REMOVE_DIALOG),
+    connect(null, mapDispatchToProps)
+)(ConfirmationDialog);
\ No newline at end of file
diff --git a/src/views-components/groups-dialog/remove-dialog.ts b/src/views-components/groups-dialog/remove-dialog.ts
new file mode 100644 (file)
index 0000000..8220198
--- /dev/null
@@ -0,0 +1,21 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { Dispatch, compose } from 'redux';
+import { connect } from "react-redux";
+import { ConfirmationDialog } from "~/components/confirmation-dialog/confirmation-dialog";
+import { withDialog, WithDialogProps } from "~/store/dialog/with-dialog";
+import { removeGroup, GROUP_REMOVE_DIALOG } from '~/store/groups-panel/groups-panel-actions';
+
+const mapDispatchToProps = (dispatch: Dispatch, props: WithDialogProps<any>) => ({
+    onConfirm: () => {
+        props.closeDialog();
+        dispatch<any>(removeGroup(props.data.uuid));
+    }
+});
+
+export const RemoveGroupDialog = compose(
+    withDialog(GROUP_REMOVE_DIALOG),
+    connect(null, mapDispatchToProps)
+)(ConfirmationDialog);
\ No newline at end of file
index 1609aafa0849a277432f343dbe39e788de788bf7..6c1e46c52a37ae819491cf043e6b8c4986ca98fe 100644 (file)
@@ -12,24 +12,31 @@ import { logout } from '~/store/auth/auth-action';
 import { RootState } from "~/store/store";
 import { openCurrentTokenDialog } from '~/store/current-token-dialog/current-token-dialog-actions';
 import { openRepositoriesPanel } from "~/store/repositories/repositories-actions";
-import { navigateToSshKeysUser, navigateToMyAccount } from '~/store/navigation/navigation-action';
+import {
+    navigateToSiteManager,
+    navigateToSshKeysUser,
+    navigateToMyAccount
+} from '~/store/navigation/navigation-action';
 import { openUserVirtualMachines } from "~/store/virtual-machines/virtual-machines-actions";
 
 interface AccountMenuProps {
     user?: User;
+    currentRoute: string;
 }
 
 const mapStateToProps = (state: RootState): AccountMenuProps => ({
-    user: state.auth.user
+    user: state.auth.user,
+    currentRoute: state.router.location ? state.router.location.pathname : ''
 });
 
 export const AccountMenu = connect(mapStateToProps)(
-    ({ user, dispatch }: AccountMenuProps & DispatchProp<any>) =>
+    ({ user, dispatch, currentRoute }: AccountMenuProps & DispatchProp<any>) =>
         user
             ? <DropdownMenu
                 icon={<UserPanelIcon />}
                 id="account-menu"
-                title="Account Management">
+                title="Account Management"
+                key={currentRoute}>
                 <MenuItem>
                     {getUserFullname(user)}
                 </MenuItem>
@@ -37,6 +44,7 @@ export const AccountMenu = connect(mapStateToProps)(
                 {!user.isAdmin && <MenuItem onClick={() => dispatch(openRepositoriesPanel())}>Repositories</MenuItem>}
                 <MenuItem onClick={() => dispatch(openCurrentTokenDialog)}>Current token</MenuItem>
                 <MenuItem onClick={() => dispatch(navigateToSshKeysUser)}>Ssh Keys</MenuItem>
+                <MenuItem onClick={() => dispatch(navigateToSiteManager)}>Site Manager</MenuItem>
                 <MenuItem onClick={() => dispatch(navigateToMyAccount)}>My account</MenuItem>
                 <MenuItem onClick={() => dispatch(logout())}>Logout</MenuItem>
             </DropdownMenu>
index 88aafbae61ef3c821d90b513389a772c4b0e41da..9b94c064ed919dc3ed28755456ca729fb4508a27 100644 (file)
@@ -17,27 +17,30 @@ import { openUserPanel } from "~/store/users/users-actions";
 
 interface AdminMenuProps {
     user?: User;
+    currentRoute: string;
 }
 
 const mapStateToProps = (state: RootState): AdminMenuProps => ({
-    user: state.auth.user
+    user: state.auth.user,
+    currentRoute: state.router.location ? state.router.location.pathname : ''
 });
 
 export const AdminMenu = connect(mapStateToProps)(
-    ({ user, dispatch }: AdminMenuProps & DispatchProp<any>) =>
+    ({ user, dispatch, currentRoute }: AdminMenuProps & DispatchProp<any>) =>
         user
             ? <DropdownMenu
                 icon={<AdminMenuIcon />}
                 id="admin-menu"
-                title="Admin Panel">
+                title="Admin Panel"
+                key={currentRoute}>
                 <MenuItem onClick={() => dispatch(openRepositoriesPanel())}>Repositories</MenuItem>
                 <MenuItem onClick={() => dispatch(openAdminVirtualMachines())}>Virtual Machines</MenuItem>
                 <MenuItem onClick={() => dispatch(NavigationAction.navigateToSshKeysAdmin)}>Ssh Keys</MenuItem>
                 <MenuItem onClick={() => dispatch(NavigationAction.navigateToApiClientAuthorizations)}>Api Tokens</MenuItem>
                 <MenuItem onClick={() => dispatch(openUserPanel())}>Users</MenuItem>
+                <MenuItem onClick={() => dispatch(NavigationAction.navigateToGroups)}>Groups</MenuItem>}
                 <MenuItem onClick={() => dispatch(NavigationAction.navigateToComputeNodes)}>Compute Nodes</MenuItem>
                 <MenuItem onClick={() => dispatch(NavigationAction.navigateToKeepServices)}>Keep Services</MenuItem>
                 <MenuItem onClick={() => dispatch(NavigationAction.navigateToLinks)}>Links</MenuItem>
-                <MenuItem onClick={() => dispatch(logout())}>Logout</MenuItem>
             </DropdownMenu>
             : null);
index 26604228fc21ac9fbfb79ba21a96a8372324655c..94da69e7c62311d94d4e324462cd7a73d3e02ac5 100644 (file)
@@ -3,11 +3,14 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import * as React from "react";
-import { MenuItem, Typography, ListSubheader } from "@material-ui/core";
+import { MenuItem, Typography } from "@material-ui/core";
 import { DropdownMenu } from "~/components/dropdown-menu/dropdown-menu";
 import { ImportContactsIcon, HelpIcon } from "~/components/icon/icon";
 import { ArvadosTheme } from '~/common/custom-theme';
 import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles';
+import { RootState } from "~/store/store";
+import { compose } from "redux";
+import { connect } from "react-redux";
 
 type CssRules = 'link' | 'icon' | 'title' | 'linkTitle';
 
@@ -52,22 +55,33 @@ const links = [
     },
 ];
 
-export const HelpMenu = withStyles(styles)(
-    ({ classes }: WithStyles<CssRules>) =>
-        <DropdownMenu
-            icon={<HelpIcon />}
-            id="help-menu"
-            title="Help">
-            <MenuItem disabled>Help</MenuItem>
-            {
-                links.map(link =>
-                    <MenuItem key={link.title}>
-                        <a href={link.link} target="_blank" className={classes.link}>
-                            <ImportContactsIcon className={classes.icon} />
-                            <Typography variant="body1" className={classes.linkTitle}>{link.title}</Typography>
-                        </a>
-                    </MenuItem>
-                )
-            }
-        </DropdownMenu>
-);
+interface HelpMenuProps {
+    currentRoute: string;
+}
+
+const mapStateToProps = ({ router }: RootState) => ({
+    currentRoute: router.location ? router.location.pathname : '',
+});
+
+export const HelpMenu = compose(
+    connect(mapStateToProps),
+    withStyles(styles))(
+        ({ classes, currentRoute }: HelpMenuProps & WithStyles<CssRules>) =>
+            <DropdownMenu
+                icon={<HelpIcon />}
+                id="help-menu"
+                title="Help"
+                key={currentRoute}>
+                <MenuItem disabled>Help</MenuItem>
+                {
+                    links.map(link =>
+                        <MenuItem key={link.title}>
+                            <a href={link.link} target="_blank" className={classes.link}>
+                                <ImportContactsIcon className={classes.icon} />
+                                <Typography variant="body1" className={classes.linkTitle}>{link.title}</Typography>
+                            </a>
+                        </MenuItem>
+                    )
+                }
+            </DropdownMenu>
+    );
index 3806b5245a75b0e58acfe4d6c4aba4247acdb434..c0014d005134bc52a706dc4c770baf00ae4907dc 100644 (file)
@@ -21,6 +21,7 @@ const isButtonVisible = ({ router }: RootState) => {
     return !Routes.matchWorkflowRoute(pathname) && !Routes.matchUserVirtualMachineRoute(pathname) &&
         !Routes.matchAdminVirtualMachineRoute(pathname) && !Routes.matchRepositoriesRoute(pathname) &&
         !Routes.matchSshKeysAdminRoute(pathname) && !Routes.matchSshKeysUserRoute(pathname) &&
+        !Routes.matchSiteManagerRoute(pathname) &&
         !Routes.matchKeepServicesRoute(pathname) && !Routes.matchComputeNodesRoute(pathname) &&
         !Routes.matchApiClientAuthorizationsRoute(pathname) && !Routes.matchUsersRoute(pathname) &&
         !Routes.matchMyAccountRoute(pathname) && !Routes.matchLinksRoute(pathname);
index 9e276ade09e71e6b9e42c485b8b6e89be73c8d57..1a806511523b6e0bc3fabeb1322a72ba615e3fcf 100644 (file)
@@ -37,5 +37,5 @@ const RenameDialogFormFields = (props: WithDialogProps<RenameFileDialogData>) =>
         component={TextField}
         autoFocus={true}
     />
-    <WarningCollection text="Renaming a file will change content adress." />
+    <WarningCollection text="Renaming a file will change content address." />
 </>;
index e6708a394fd91445a7afbe6aba972b722c4638b2..3fb2d377aeff56574a06a919f2f33e3aea5f142e 100644 (file)
@@ -20,7 +20,7 @@ export const PropertyKeyField = connectVocabulary(
             vocabulary={vocabulary}
             validate={getValidation(vocabulary)} />);
 
-const PropertyKeyInput = ({ vocabulary, ...props }: WrappedFieldProps & VocabularyProp) =>
+export const PropertyKeyInput = ({ vocabulary, ...props }: WrappedFieldProps & VocabularyProp) =>
     <Autocomplete
         label='Key'
         suggestions={getSuggestions(props.input.value, vocabulary)}
index db2db3f7ece5e63ed7656f2f3a417996b3238dad..13dcfeb544278acf62db0b41aca9c113333043d3 100644 (file)
@@ -15,7 +15,7 @@ interface PropertyKeyProp {
     propertyKey: string;
 }
 
-type PropertyValueFieldProps = VocabularyProp & PropertyKeyProp;
+export type PropertyValueFieldProps = VocabularyProp & PropertyKeyProp;
 
 export const PROPERTY_VALUE_FIELD_NAME = 'value';
 
@@ -30,7 +30,7 @@ export const PropertyValueField = compose(
             validate={getValidation(props)}
             {...props} />);
 
-const PropertyValueInput = ({ vocabulary, propertyKey, ...props }: WrappedFieldProps & PropertyValueFieldProps) =>
+export const PropertyValueInput = ({ vocabulary, propertyKey, ...props }: WrappedFieldProps & PropertyValueFieldProps) =>
     <Autocomplete
         label='Value'
         suggestions={getSuggestions(props.input.value, propertyKey, vocabulary)}
index 51ea3fa14793fe9ff3fe19b939b867c3db52a497..09b75bbf65893a7c811a75f563eebc8ffcd9f8c4 100644 (file)
@@ -11,7 +11,7 @@ import {
     WithStyles,
     Tooltip,
     InputAdornment, Input,
-    ClickAwayListener
+    Popover,
 } from '@material-ui/core';
 import SearchIcon from '@material-ui/icons/Search';
 import ArrowDropDownIcon from '@material-ui/icons/ArrowDropDown';
@@ -144,49 +144,98 @@ const handleDropdownClick = (e: React.MouseEvent, props: SearchBarViewProps) =>
 };
 
 export const SearchBarView = withStyles(styles)(
-    (props : SearchBarViewProps) => {
-        const { classes, isPopoverOpen } = props;
-        return (
-            <ClickAwayListener onClickAway={props.closeView}>
-                <Paper className={isPopoverOpen ? classes.containerSearchViewOpened : classes.container} >
-                    <form onSubmit={props.onSubmit}>
-                        <Input
-                            className={classes.input}
-                            onChange={props.onChange}
-                            placeholder="Search"
-                            value={props.searchValue}
-                            fullWidth={true}
-                            disableUnderline={true}
-                            onClick={e => handleInputClick(e, props)}
-                            onKeyDown={e => handleKeyDown(e, props)}
-                            startAdornment={
-                                <InputAdornment position="start">
-                                    <Tooltip title='Search'>
-                                        <IconButton type="submit">
-                                            <SearchIcon />
-                                        </IconButton>
-                                    </Tooltip>
-                                </InputAdornment>
-                            }
-                            endAdornment={
-                                <InputAdornment position="end">
-                                    <Tooltip title='Advanced search'>
-                                        <IconButton onClick={e => handleDropdownClick(e, props)}>
-                                            <ArrowDropDownIcon />
-                                        </IconButton>
-                                    </Tooltip>
-                                </InputAdornment>
-                            } />
-                    </form>
-                    <div className={classes.view}>
-                        {isPopoverOpen && getView({...props})}
+    class SearchBarView extends React.Component<SearchBarViewProps> {
+
+        viewAnchorRef = React.createRef<HTMLDivElement>();
+
+        render() {
+            const { children, ...props } = this.props;
+            const { classes, isPopoverOpen } = props;
+            return (
+                <Paper
+                    className={isPopoverOpen ? classes.containerSearchViewOpened : classes.container}>
+                    <div ref={this.viewAnchorRef}>
+                        <form onSubmit={props.onSubmit}>
+                            <SearchInput {...props} />
+                        </form>
                     </div>
+                    <SearchViewContainer
+                        {...props}
+                        width={this.getViewWidth()}
+                        anchorEl={this.viewAnchorRef.current}>
+                        {
+                            getView({ ...props })
+                        }
+                    </SearchViewContainer>
                 </Paper >
-            </ClickAwayListener>
-        );
+            );
+        }
+
+        getViewWidth() {
+            const { current } = this.viewAnchorRef;
+            return current ? current.offsetWidth : 0;
+        }
     }
+
 );
 
+const SearchInput = (props: SearchBarViewProps) => {
+    const { classes } = props;
+    return <Input
+        className={classes.input}
+        onChange={props.onChange}
+        placeholder="Search"
+        value={props.searchValue}
+        fullWidth={true}
+        disableUnderline={true}
+        onClick={e => handleInputClick(e, props)}
+        onKeyDown={e => handleKeyDown(e, props)}
+        startAdornment={
+            <InputAdornment position="start">
+                <Tooltip title='Search'>
+                    <IconButton type="submit">
+                        <SearchIcon />
+                    </IconButton>
+                </Tooltip>
+            </InputAdornment>
+        }
+        endAdornment={
+            <InputAdornment position="end">
+                <Tooltip title='Advanced search'>
+                    <IconButton onClick={e => handleDropdownClick(e, props)}>
+                        <ArrowDropDownIcon />
+                    </IconButton>
+                </Tooltip>
+            </InputAdornment>
+        } />;
+};
+
+const SearchViewContainer = (props: SearchBarViewProps & { width: number, anchorEl: HTMLElement | null, children: React.ReactNode }) =>
+    <Popover
+        PaperProps={{
+            style: {
+                width: props.width,
+                borderRadius: '0 0 4px 4px',
+            }
+        }}
+        anchorEl={props.anchorEl}
+        anchorOrigin={{
+            vertical: 'bottom',
+            horizontal: 'center',
+        }}
+        transformOrigin={{
+            vertical: 'top',
+            horizontal: 'center',
+        }}
+        disableAutoFocus
+        open={props.isPopoverOpen}
+        onClose={props.closeView}>
+        {
+            props.children
+        }
+    </Popover>;
+
+
 const getView = (props: SearchBarViewProps) => {
     switch (props.currentView) {
         case SearchView.AUTOCOMPLETE:
index 2aada00e8ae7c75aee8266ccdcf7c3267c89fca3..f62e6f55ac0d5a27986c8d719051174d9cc88843 100644 (file)
@@ -17,9 +17,12 @@ export interface Person {
     email: string;
     uuid: string;
 }
+
 export interface PeopleSelectProps {
 
     items: Person[];
+    label?: string;
+    autofocus?: boolean;
 
     onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
     onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
@@ -43,12 +46,16 @@ export const PeopleSelect = connect()(
         };
 
         render() {
+
+            const { label = 'Invite people' } = this.props;
+
             return (
                 <Autocomplete
-                    label='Invite people'
+                    label={label}
                     value={this.state.value}
                     items={this.props.items}
                     suggestions={this.state.suggestions}
+                    autofocus={this.props.autofocus}
                     onChange={this.handleChange}
                     onCreate={this.handleCreate}
                     onSelect={this.handleSelect}
index 12e82dfb102f9ade1df6cd928a19c1957b7ebe3b..62d9dc3532e2efc48605b261e99ddffaa20d7133 100644 (file)
@@ -8,7 +8,7 @@ import { ArvadosTheme } from '~/common/custom-theme';
 import { SidePanelTree, SidePanelTreeProps } from '~/views-components/side-panel-tree/side-panel-tree';
 import { compose, Dispatch } from 'redux';
 import { connect } from 'react-redux';
-import { navigateFromSidePanel } from '../../store/side-panel/side-panel-action';
+import { navigateFromSidePanel } from '~/store/side-panel/side-panel-action';
 import { Grid } from '@material-ui/core';
 import { SidePanelButton } from '~/views-components/side-panel-button/side-panel-button';
 import { RootState } from '~/store/store';
@@ -33,14 +33,15 @@ const mapDispatchToProps = (dispatch: Dispatch): SidePanelTreeProps => ({
     }
 });
 
-const mapStateToProps = (state: RootState) => ({
+const mapStateToProps = ({ router }: RootState) => ({
+    currentRoute: router.location ? router.location.pathname : '',
 });
 
 export const SidePanel = withStyles(styles)(
     connect(mapStateToProps, mapDispatchToProps)(
-    ({ classes, ...props }: WithStyles<CssRules> & SidePanelTreeProps) =>
-    <Grid item xs>
-        <SidePanelButton />
-        <SidePanelTree {...props} />
-    </Grid>
-));
+        ({ classes, ...props }: WithStyles<CssRules> & SidePanelTreeProps & { currentRoute: string }) =>
+            <Grid item xs>
+                <SidePanelButton key={props.currentRoute} />
+                <SidePanelTree {...props} />
+            </Grid>
+    ));
index ce896dcc767091eb022f352889f3eb84a2d2b47f..0c164dbd26061e26c81aed12342ab97a1f2120bf 100644 (file)
@@ -4,9 +4,9 @@
 
 import * as React from "react";
 import { compose } from 'redux';
-import { withStyles, Dialog, DialogTitle, DialogContent, DialogActions, Button, StyleRulesCallback, WithStyles, Typography, Grid } from '@material-ui/core';
+import { withStyles, Dialog, DialogTitle, DialogContent, DialogActions, Button, StyleRulesCallback, WithStyles, Grid } from '@material-ui/core';
 import { WithDialogProps, withDialog } from "~/store/dialog/with-dialog";
-import { SSH_KEY_ATTRIBUTES_DIALOG } from '~/store/auth/auth-action';
+import { SSH_KEY_ATTRIBUTES_DIALOG } from '~/store/auth/auth-action-ssh';
 import { ArvadosTheme } from '~/common/custom-theme';
 import { SshKeyResource } from "~/models/ssh-key";
 
@@ -66,4 +66,4 @@ export const AttributesSshKeyDialog = compose(
                     </Button>
                 </DialogActions>
             </Dialog>
-    );
\ No newline at end of file
+    );
index 77c6cfdea9574bfdb66c2e47962f0ebed3c685e7..11ec159501a41f85928e97c6bfafde2993b6df3d 100644 (file)
@@ -6,7 +6,7 @@ import * as React from "react";
 import { compose } from 'redux';
 import { withStyles, Dialog, DialogTitle, DialogContent, DialogActions, Button, StyleRulesCallback, WithStyles } from '@material-ui/core';
 import { WithDialogProps, withDialog } from "~/store/dialog/with-dialog";
-import { SSH_KEY_PUBLIC_KEY_DIALOG } from '~/store/auth/auth-action';
+import { SSH_KEY_PUBLIC_KEY_DIALOG } from '~/store/auth/auth-action-ssh';
 import { ArvadosTheme } from '~/common/custom-theme';
 import { DefaultCodeSnippet } from '~/components/default-code-snippet/default-code-snippet';
 
@@ -52,4 +52,4 @@ export const PublicKeyDialog = compose(
                     </Button>
                 </DialogActions>
             </Dialog>
-    );
\ No newline at end of file
+    );
index 8077f21b0c7a156bdea265f4bf4f39b5c066f930..916e918c36a2475824d78a7663d40ed37e041cd5 100644 (file)
@@ -5,7 +5,7 @@ import { Dispatch, compose } from 'redux';
 import { connect } from "react-redux";
 import { ConfirmationDialog } from "~/components/confirmation-dialog/confirmation-dialog";
 import { withDialog, WithDialogProps } from "~/store/dialog/with-dialog";
-import { SSH_KEY_REMOVE_DIALOG, removeSshKey } from '~/store/auth/auth-action';
+import { SSH_KEY_REMOVE_DIALOG, removeSshKey } from '~/store/auth/auth-action-ssh';
 
 const mapDispatchToProps = (dispatch: Dispatch, props: WithDialogProps<any>) => ({
     onConfirm: () => {
@@ -17,4 +17,4 @@ const mapDispatchToProps = (dispatch: Dispatch, props: WithDialogProps<any>) =>
 export const RemoveSshKeyDialog = compose(
     withDialog(SSH_KEY_REMOVE_DIALOG),
     connect(null, mapDispatchToProps)
-)(ConfirmationDialog);
\ No newline at end of file
+)(ConfirmationDialog);
diff --git a/src/views/group-details-panel/group-details-panel.tsx b/src/views/group-details-panel/group-details-panel.tsx
new file mode 100644 (file)
index 0000000..f81c240
--- /dev/null
@@ -0,0 +1,126 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from 'react';
+import { connect } from 'react-redux';
+
+import { DataExplorer } from "~/views-components/data-explorer/data-explorer";
+import { DataColumns } from '~/components/data-table/data-table';
+import { ResourceUuid, ResourceFirstName, ResourceLastName, ResourceEmail, ResourceUsername } from '~/views-components/data-explorer/renderers';
+import { createTree } from '~/models/tree';
+import { noop } from 'lodash/fp';
+import { RootState } from '~/store/store';
+import { GROUP_DETAILS_PANEL_ID, openAddGroupMembersDialog } from '~/store/group-details-panel/group-details-panel-actions';
+import { openContextMenu } from '~/store/context-menu/context-menu-actions';
+import { ResourcesState, getResource } from '~/store/resources/resources';
+import { ContextMenuKind } from '~/views-components/context-menu/context-menu';
+import { PermissionResource } from '~/models/permission';
+import { Grid, Button } from '@material-ui/core';
+import { AddIcon } from '~/components/icon/icon';
+
+export enum GroupDetailsPanelColumnNames {
+    FIRST_NAME = "First name",
+    LAST_NAME = "Last name",
+    UUID = "UUID",
+    EMAIL = "Email",
+    USERNAME = "Username",
+}
+
+export const groupDetailsPanelColumns: DataColumns<string> = [
+    {
+        name: GroupDetailsPanelColumnNames.FIRST_NAME,
+        selected: true,
+        configurable: true,
+        filters: createTree(),
+        render: uuid => <ResourceFirstName uuid={uuid} />
+    },
+    {
+        name: GroupDetailsPanelColumnNames.LAST_NAME,
+        selected: true,
+        configurable: true,
+        filters: createTree(),
+        render: uuid => <ResourceLastName uuid={uuid} />
+    },
+    {
+        name: GroupDetailsPanelColumnNames.UUID,
+        selected: true,
+        configurable: true,
+        filters: createTree(),
+        render: uuid => <ResourceUuid uuid={uuid} />
+    },
+    {
+        name: GroupDetailsPanelColumnNames.EMAIL,
+        selected: true,
+        configurable: true,
+        filters: createTree(),
+        render: uuid => <ResourceEmail uuid={uuid} />
+    },
+    {
+        name: GroupDetailsPanelColumnNames.USERNAME,
+        selected: true,
+        configurable: true,
+        filters: createTree(),
+        render: uuid => <ResourceUsername uuid={uuid} />
+    },
+];
+
+const mapStateToProps = (state: RootState) => {
+    return {
+        resources: state.resources
+    };
+};
+
+const mapDispatchToProps = {
+    onContextMenu: openContextMenu,
+    onAddUser: openAddGroupMembersDialog,
+};
+
+export interface GroupDetailsPanelProps {
+    onContextMenu: (event: React.MouseEvent<HTMLElement>, item: any) => void;
+    onAddUser: () => void;
+    resources: ResourcesState;
+}
+
+export const GroupDetailsPanel = connect(
+    mapStateToProps, mapDispatchToProps
+)(
+    class GroupDetailsPanel extends React.Component<GroupDetailsPanelProps> {
+
+        render() {
+            return (
+                <DataExplorer
+                    id={GROUP_DETAILS_PANEL_ID}
+                    onRowClick={noop}
+                    onRowDoubleClick={noop}
+                    onContextMenu={this.handleContextMenu}
+                    contextMenuColumn={true}
+                    hideColumnSelector
+                    hideSearchInput
+                    actions={
+                        <Grid container justify='flex-end'>
+                            <Button
+                                variant="contained"
+                                color="primary"
+                                onClick={this.props.onAddUser}>
+                                <AddIcon /> Add user
+                        </Button>
+                        </Grid>
+                    } />
+            );
+        }
+
+        handleContextMenu = (event: React.MouseEvent<HTMLElement>, resourceUuid: string) => {
+            const resource = getResource<PermissionResource>(resourceUuid)(this.props.resources);
+            if (resource) {
+                this.props.onContextMenu(event, {
+                    name: '',
+                    uuid: resource.uuid,
+                    ownerUuid: resource.ownerUuid,
+                    kind: resource.kind,
+                    menuKind: ContextMenuKind.GROUP_MEMBER
+                });
+            }
+        }
+    });
+
diff --git a/src/views/groups-panel/groups-panel.tsx b/src/views/groups-panel/groups-panel.tsx
new file mode 100644 (file)
index 0000000..f50a344
--- /dev/null
@@ -0,0 +1,133 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from 'react';
+import { connect } from 'react-redux';
+import { Grid, Button, Typography } from "@material-ui/core";
+import { DataExplorer } from "~/views-components/data-explorer/data-explorer";
+import { DataColumns } from '~/components/data-table/data-table';
+import { SortDirection } from '~/components/data-table/data-column';
+import { ResourceOwner } from '~/views-components/data-explorer/renderers';
+import { AddIcon } from '~/components/icon/icon';
+import { ResourceName } from '~/views-components/data-explorer/renderers';
+import { createTree } from '~/models/tree';
+import { GROUPS_PANEL_ID, openCreateGroupDialog } from '~/store/groups-panel/groups-panel-actions';
+import { noop } from 'lodash/fp';
+import { ContextMenuKind } from '~/views-components/context-menu/context-menu';
+import { getResource, ResourcesState, filterResources } from '~/store/resources/resources';
+import { GroupResource } from '~/models/group';
+import { RootState } from '~/store/store';
+import { openContextMenu } from '~/store/context-menu/context-menu-actions';
+import { ResourceKind } from '~/models/resource';
+import { LinkClass, LinkResource } from '~/models/link';
+import { navigateToGroupDetails } from '~/store/navigation/navigation-action';
+
+export enum GroupsPanelColumnNames {
+    GROUP = "Name",
+    OWNER = "Owner",
+    MEMBERS = "Members",
+}
+
+export const groupsPanelColumns: DataColumns<string> = [
+    {
+        name: GroupsPanelColumnNames.GROUP,
+        selected: true,
+        configurable: true,
+        sortDirection: SortDirection.ASC,
+        filters: createTree(),
+        render: uuid => <ResourceName uuid={uuid} />
+    },
+    {
+        name: GroupsPanelColumnNames.OWNER,
+        selected: true,
+        configurable: true,
+        filters: createTree(),
+        render: uuid => <ResourceOwner uuid={uuid} />,
+    },
+    {
+        name: GroupsPanelColumnNames.MEMBERS,
+        selected: true,
+        configurable: true,
+        filters: createTree(),
+        render: uuid => <GroupMembersCount uuid={uuid} />,
+    },
+];
+
+const mapStateToProps = (state: RootState) => {
+    return {
+        resources: state.resources
+    };
+};
+
+const mapDispatchToProps = {
+    onContextMenu: openContextMenu,
+    onRowDoubleClick: (uuid: string) =>
+        navigateToGroupDetails(uuid),
+    onNewGroup: openCreateGroupDialog,
+};
+
+export interface GroupsPanelProps {
+    onNewGroup: () => void;
+    onContextMenu: (event: React.MouseEvent<HTMLElement>, item: any) => void;
+    onRowDoubleClick: (item: string) => void;
+    resources: ResourcesState;
+}
+
+export const GroupsPanel = connect(
+    mapStateToProps, mapDispatchToProps
+)(
+    class GroupsPanel extends React.Component<GroupsPanelProps> {
+
+        render() {
+            return (
+                <DataExplorer
+                    id={GROUPS_PANEL_ID}
+                    onRowClick={noop}
+                    onRowDoubleClick={this.props.onRowDoubleClick}
+                    onContextMenu={this.handleContextMenu}
+                    contextMenuColumn={true}
+                    hideColumnSelector
+                    actions={
+                        <Grid container justify='flex-end'>
+                            <Button
+                                variant="contained"
+                                color="primary"
+                                onClick={this.props.onNewGroup}>
+                                <AddIcon /> New group
+                        </Button>
+                        </Grid>
+                    } />
+            );
+        }
+
+        handleContextMenu = (event: React.MouseEvent<HTMLElement>, resourceUuid: string) => {
+            const resource = getResource<GroupResource>(resourceUuid)(this.props.resources);
+            if (resource) {
+                this.props.onContextMenu(event, {
+                    name: '',
+                    uuid: resource.uuid,
+                    ownerUuid: resource.ownerUuid,
+                    kind: resource.kind,
+                    menuKind: ContextMenuKind.GROUPS
+                });
+            }
+        }
+    });
+
+
+const GroupMembersCount = connect(
+    (state: RootState, props: { uuid: string }) => {
+
+        const permissions = filterResources((resource: LinkResource) =>
+            resource.kind === ResourceKind.LINK &&
+            resource.linkClass === LinkClass.PERMISSION &&
+            resource.tailUuid === props.uuid
+        )(state.resources);
+
+        return {
+            children: permissions.length,
+        };
+
+    }
+)(Typography);
diff --git a/src/views/site-manager-panel/site-manager-panel-root.tsx b/src/views/site-manager-panel/site-manager-panel-root.tsx
new file mode 100644 (file)
index 0000000..2b6d3c9
--- /dev/null
@@ -0,0 +1,183 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from 'react';
+import {
+    Card,
+    CardContent,
+    CircularProgress,
+    Grid,
+    StyleRulesCallback,
+    Table,
+    TableBody,
+    TableCell,
+    TableHead,
+    TableRow,
+    Typography,
+    WithStyles,
+    withStyles
+} from '@material-ui/core';
+import { ArvadosTheme } from '~/common/custom-theme';
+import { Session, SessionStatus } from "~/models/session";
+import Button from "@material-ui/core/Button";
+import { compose, Dispatch } from "redux";
+import { Field, FormErrors, InjectedFormProps, reduxForm, reset, stopSubmit } from "redux-form";
+import { TextField } from "~/components/text-field/text-field";
+import { addSession } from "~/store/auth/auth-action-session";
+import { SITE_MANAGER_REMOTE_HOST_VALIDATION } from "~/validators/validators";
+
+type CssRules = 'root' | 'link' | 'buttonContainer' | 'table' | 'tableRow' |
+    'remoteSiteInfo' | 'buttonAdd' | 'buttonLoggedIn' | 'buttonLoggedOut' |
+    'statusCell';
+
+const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
+    root: {
+       width: '100%',
+       overflow: 'auto'
+    },
+    link: {
+        color: theme.palette.primary.main,
+        textDecoration: 'none',
+        margin: '0px 4px'
+    },
+    buttonContainer: {
+        textAlign: 'right'
+    },
+    table: {
+        marginTop: theme.spacing.unit
+    },
+    tableRow: {
+        '& td, th': {
+            whiteSpace: 'nowrap'
+        }
+    },
+    statusCell: {
+        minWidth: 160
+    },
+    remoteSiteInfo: {
+        marginTop: 20
+    },
+    buttonAdd: {
+        marginLeft: 10,
+        marginTop: theme.spacing.unit * 3
+    },
+    buttonLoggedIn: {
+        minHeight: theme.spacing.unit,
+        padding: 5,
+        color: '#fff',
+        backgroundColor: '#009966',
+        '&:hover': {
+            backgroundColor: '#008450',
+        }
+    },
+    buttonLoggedOut: {
+        minHeight: theme.spacing.unit,
+        padding: 5,
+        color: '#000',
+        backgroundColor: '#FFC414',
+        '&:hover': {
+            backgroundColor: '#eaaf14',
+        }
+    }
+});
+
+export interface SiteManagerPanelRootActionProps {
+    toggleSession: (session: Session) => void;
+}
+
+export interface SiteManagerPanelRootDataProps {
+    sessions: Session[];
+}
+
+type SiteManagerPanelRootProps = SiteManagerPanelRootDataProps & SiteManagerPanelRootActionProps & WithStyles<CssRules> & InjectedFormProps;
+const SITE_MANAGER_FORM_NAME = 'siteManagerForm';
+
+const submitSession = (remoteHost: string) =>
+    (dispatch: Dispatch) => {
+        dispatch<any>(addSession(remoteHost)).then(() => {
+            dispatch(reset(SITE_MANAGER_FORM_NAME));
+        }).catch((e: any) => {
+            const errors = {
+                remoteHost: e
+            } as FormErrors;
+            dispatch(stopSubmit(SITE_MANAGER_FORM_NAME, errors));
+        });
+    };
+
+export const SiteManagerPanelRoot = compose(
+    reduxForm<{remoteHost: string}>({
+        form: SITE_MANAGER_FORM_NAME,
+        touchOnBlur: false,
+        onSubmit: (data, dispatch) => {
+            dispatch(submitSession(data.remoteHost));
+        }
+    }),
+    withStyles(styles))
+    (({ classes, sessions, handleSubmit, toggleSession }: SiteManagerPanelRootProps) =>
+        <Card className={classes.root}>
+            <CardContent>
+                <Grid container direction="row">
+                    <Grid item xs={12}>
+                        <Typography variant='body1' paragraph={true} >
+                            You can log in to multiple Arvados sites here, then use the multi-site search page to search collections and projects on all sites at once.
+                        </Typography>
+                    </Grid>
+                </Grid>
+                <Grid item xs={12}>
+                    {sessions.length > 0 && <Table className={classes.table}>
+                        <TableHead>
+                            <TableRow className={classes.tableRow}>
+                                <TableCell>Cluster ID</TableCell>
+                                <TableCell>Username</TableCell>
+                                <TableCell>Email</TableCell>
+                                <TableCell>Status</TableCell>
+                            </TableRow>
+                        </TableHead>
+                        <TableBody>
+                            {sessions.map((session, index) => {
+                                const validating = session.status === SessionStatus.BEING_VALIDATED;
+                                return <TableRow key={index} className={classes.tableRow}>
+                                    <TableCell>{session.clusterId}</TableCell>
+                                    <TableCell>{validating ? <CircularProgress size={20}/> : session.username}</TableCell>
+                                    <TableCell>{validating ? <CircularProgress size={20}/> : session.email}</TableCell>
+                                    <TableCell className={classes.statusCell}>
+                                        <Button fullWidth
+                                            disabled={validating || session.status === SessionStatus.INVALIDATED || session.active}
+                                            className={session.loggedIn ? classes.buttonLoggedIn : classes.buttonLoggedOut}
+                                            onClick={() => toggleSession(session)}>
+                                            {validating ? "Validating" : (session.loggedIn ? "Logged in" : "Logged out")}
+                                        </Button>
+                                    </TableCell>
+                                </TableRow>;
+                            })}
+                        </TableBody>
+                    </Table>}
+                </Grid>
+                <form onSubmit={handleSubmit}>
+                    <Grid container direction="row">
+                        <Grid item xs={12}>
+                            <Typography variant='body1' paragraph={true} className={classes.remoteSiteInfo}>
+                                To add a remote Arvados site, paste the remote site's host here (see "ARVADOS_API_HOST" on the "current token" page).
+                            </Typography>
+                        </Grid>
+                        <Grid item xs={8}>
+                            <Field
+                                name='remoteHost'
+                                validate={SITE_MANAGER_REMOTE_HOST_VALIDATION}
+                                component={TextField}
+                                placeholder="zzzz.arvadosapi.com"
+                                margin="normal"
+                                label="New cluster"
+                                autoFocus/>
+                        </Grid>
+                        <Grid item xs={3}>
+                            <Button type="submit" variant="contained" color="primary"
+                                className={classes.buttonAdd}>
+                                {"ADD"}</Button>
+                        </Grid>
+                    </Grid>
+                </form>
+            </CardContent>
+        </Card>
+    );
diff --git a/src/views/site-manager-panel/site-manager-panel.tsx b/src/views/site-manager-panel/site-manager-panel.tsx
new file mode 100644 (file)
index 0000000..4532e85
--- /dev/null
@@ -0,0 +1,27 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { RootState } from '~/store/store';
+import { Dispatch } from 'redux';
+import { connect } from 'react-redux';
+import {
+    SiteManagerPanelRoot, SiteManagerPanelRootActionProps,
+    SiteManagerPanelRootDataProps
+} from "~/views/site-manager-panel/site-manager-panel-root";
+import { Session } from "~/models/session";
+import { toggleSession } from "~/store/auth/auth-action-session";
+
+const mapStateToProps = (state: RootState): SiteManagerPanelRootDataProps => {
+    return {
+        sessions: state.auth.sessions
+    };
+};
+
+const mapDispatchToProps = (dispatch: Dispatch): SiteManagerPanelRootActionProps => ({
+    toggleSession: (session: Session) => {
+        dispatch<any>(toggleSession(session));
+    }
+});
+
+export const SiteManagerPanel = connect(mapStateToProps, mapDispatchToProps)(SiteManagerPanelRoot);
index 4e800296d076fb3f368ac9d98959d3d00520a18b..6575a9cc179aad9c8318303dfcc5faade6766379 100644 (file)
@@ -5,7 +5,7 @@
 import { RootState } from '~/store/store';
 import { Dispatch } from 'redux';
 import { connect } from 'react-redux';
-import { openSshKeyCreateDialog, openPublicKeyDialog } from '~/store/auth/auth-action';
+import { openSshKeyCreateDialog, openPublicKeyDialog } from '~/store/auth/auth-action-ssh';
 import { openSshKeyContextMenu } from '~/store/context-menu/context-menu-actions';
 import { SshKeyPanelRoot, SshKeyPanelRootDataProps, SshKeyPanelRootActionProps } from '~/views/ssh-key-panel/ssh-key-panel-root';
 
@@ -28,4 +28,4 @@ const mapDispatchToProps = (dispatch: Dispatch): SshKeyPanelRootActionProps => (
     }
 });
 
-export const SshKeyPanel = connect(mapStateToProps, mapDispatchToProps)(SshKeyPanelRoot);
\ No newline at end of file
+export const SshKeyPanel = connect(mapStateToProps, mapDispatchToProps)(SshKeyPanelRoot);
index 025540e22ed89c6bab5ecd1a9dee6ddc11281a94..90b2dad0197215578d8020b1da153d7d38c9e88e 100644 (file)
@@ -45,6 +45,7 @@ import SplitterLayout from 'react-splitter-layout';
 import { WorkflowPanel } from '~/views/workflow-panel/workflow-panel';
 import { SearchResultsPanel } from '~/views/search-results-panel/search-results-panel';
 import { SshKeyPanel } from '~/views/ssh-key-panel/ssh-key-panel';
+import { SiteManagerPanel } from "~/views/site-manager-panel/site-manager-panel";
 import { MyAccountPanel } from '~/views/my-account-panel/my-account-panel';
 import { SharingDialog } from '~/views-components/sharing-dialog/sharing-dialog';
 import { AdvancedTabDialog } from '~/views-components/advanced-tab-dialog/advanced-tab-dialog';
@@ -79,6 +80,14 @@ import { UserPanel } from '~/views/user-panel/user-panel';
 import { UserAttributesDialog } from '~/views-components/user-dialog/attributes-dialog';
 import { CreateUserDialog } from '~/views-components/dialog-forms/create-user-dialog';
 import { HelpApiClientAuthorizationDialog } from '~/views-components/api-client-authorizations-dialog/help-dialog';
+import { GroupsPanel } from '~/views/groups-panel/groups-panel';
+import { CreateGroupDialog } from '~/views-components/dialog-forms/create-group-dialog';
+import { RemoveGroupDialog } from '~/views-components/groups-dialog/remove-dialog';
+import { GroupAttributesDialog } from '~/views-components/groups-dialog/attributes-dialog';
+import { GroupDetailsPanel } from '~/views/group-details-panel/group-details-panel';
+import { RemoveGroupMemberDialog } from '~/views-components/groups-dialog/member-remove-dialog';
+import { GroupMemberAttributesDialog } from '~/views-components/groups-dialog/member-attributes-dialog';
+import { AddGroupMembersDialog } from '~/views-components/dialog-forms/add-group-member-dialog';
 
 type CssRules = 'root' | 'container' | 'splitter' | 'asidePanel' | 'contentWrapper' | 'content';
 
@@ -153,11 +162,14 @@ export const WorkbenchPanel =
                                 <Route path={Routes.REPOSITORIES} component={RepositoriesPanel} />
                                 <Route path={Routes.SSH_KEYS_USER} component={SshKeyPanel} />
                                 <Route path={Routes.SSH_KEYS_ADMIN} component={SshKeyPanel} />
+                                <Route path={Routes.SITE_MANAGER} component={SiteManagerPanel} />
                                 <Route path={Routes.KEEP_SERVICES} component={KeepServicePanel} />
                                 <Route path={Routes.USERS} component={UserPanel} />
                                 <Route path={Routes.COMPUTE_NODES} component={ComputeNodePanel} />
                                 <Route path={Routes.API_CLIENT_AUTHORIZATIONS} component={ApiClientAuthorizationPanel} />
                                 <Route path={Routes.MY_ACCOUNT} component={MyAccountPanel} />
+                                <Route path={Routes.GROUPS} component={GroupsPanel} />
+                                <Route path={Routes.GROUP_DETAILS} component={GroupDetailsPanel} />
                                 <Route path={Routes.LINKS} component={LinkPanel} />
                             </Switch>
                         </Grid>
@@ -167,6 +179,7 @@ export const WorkbenchPanel =
             <Grid item>
                 <DetailsPanel />
             </Grid>
+            <AddGroupMembersDialog />
             <AdvancedTabDialog />
             <AttributesApiClientAuthorizationDialog />
             <AttributesComputeNodeDialog />
@@ -178,6 +191,7 @@ export const WorkbenchPanel =
             <CopyCollectionDialog />
             <CopyProcessDialog />
             <CreateCollectionDialog />
+            <CreateGroupDialog />
             <CreateProjectDialog />
             <CreateRepositoryDialog />
             <CreateSshKeyDialog />
@@ -185,6 +199,8 @@ export const WorkbenchPanel =
             <CurrentTokenDialog />
             <FileRemoveDialog />
             <FilesUploadCollectionDialog />
+            <GroupAttributesDialog />
+            <GroupMemberAttributesDialog />
             <HelpApiClientAuthorizationDialog />
             <MoveCollectionDialog />
             <MoveProcessDialog />
@@ -197,6 +213,8 @@ export const WorkbenchPanel =
             <ProjectPropertiesDialog />
             <RemoveApiClientAuthorizationDialog />
             <RemoveComputeNodeDialog />
+            <RemoveGroupDialog />
+            <RemoveGroupMemberDialog />
             <RemoveKeepServiceDialog />
             <RemoveLinkDialog />
             <RemoveProcessDialog />
@@ -215,4 +233,4 @@ export const WorkbenchPanel =
             <UserAttributesDialog />
             <VirtualMachineAttributesDialog />
         </Grid>
-    );
\ No newline at end of file
+    );
index d3d6396d479953c17c56aa7ebbfca727d5cc2661..b642d71aed7c27c2110ba48c69f88c85f0811210 100644 (file)
--- a/yarn.lock
+++ b/yarn.lock
     csstype "^2.0.0"
     indefinite-observable "^1.0.1"
 
+"@types/jssha@0.0.29":
+  version "0.0.29"
+  resolved "https://registry.yarnpkg.com/@types/jssha/-/jssha-0.0.29.tgz#95e83dba98787ff796d2d5f37a1925abf41bc9cb"
+  integrity sha1-leg9uph4f/eW0tXzehklq/Qbycs=
+
 "@types/lodash@4.14.116":
   version "4.14.116"
   resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.116.tgz#5ccf215653e3e8c786a58390751033a9adca0eb9"
@@ -5540,6 +5545,11 @@ jss@^9.3.3:
     symbol-observable "^1.1.0"
     warning "^3.0.0"
 
+jssha@2.3.1:
+  version "2.3.1"
+  resolved "https://registry.yarnpkg.com/jssha/-/jssha-2.3.1.tgz#147b2125369035ca4b2f7d210dc539f009b3de9a"
+  integrity sha1-FHshJTaQNcpLL30hDcU58Amz3po=
+
 keycode@^2.1.9:
   version "2.2.0"
   resolved "https://registry.yarnpkg.com/keycode/-/keycode-2.2.0.tgz#3d0af56dc7b8b8e5cba8d0a97f107204eec22b04"