Merge branch 'origin/master' into 14478-log-in-into-clusters
authorDaniel Kos <daniel.kos@contractors.roche.com>
Tue, 18 Dec 2018 09:39:54 +0000 (10:39 +0100)
committerDaniel Kos <daniel.kos@contractors.roche.com>
Tue, 18 Dec 2018 09:39:54 +0000 (10:39 +0100)
Feature #14478

# Conflicts:
# src/common/config.ts
# src/components/text-field/text-field.tsx
# src/routes/route-change-handlers.ts
# src/routes/routes.ts
# src/services/auth-service/auth-service.ts
# src/services/common-service/common-resource-service.ts
# src/services/services.ts
# src/store/auth/auth-action.ts
# src/store/navigation/navigation-action.ts
# src/store/workbench/workbench-actions.ts
# src/validators/validators.tsx
# src/views-components/main-app-bar/account-menu.tsx
# src/views-components/main-content-bar/main-content-bar.tsx
# src/views/workbench/workbench.tsx

Arvados-DCO-1.1-Signed-off-by: Daniel Kos <daniel.kos@contractors.roche.com>

139 files changed:
README.md
public/file-viewers-example.json [new file with mode: 0644]
src/common/config.ts
src/common/formatters.ts
src/common/labels.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/api-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/resource.ts
src/models/user.ts
src/routes/route-change-handlers.ts
src/routes/routes.ts
src/services/ancestors-service/ancestors-service.ts
src/services/api-client-authorization-service/api-client-authorization-service.ts [new file with mode: 0644]
src/services/api/filter-builder.ts
src/services/auth-service/auth-service.ts
src/services/client-authorizations-service/client-authorizations-service.ts [deleted file]
src/services/collection-service/collection-service.ts
src/services/common-service/common-resource-service.ts
src/services/common-service/common-service.ts [new file with mode: 0644]
src/services/favorite-service/favorite-service.ts
src/services/file-viewers-config-service/file-viewers-config-service.ts [new file with mode: 0644]
src/services/groups-service/groups-service.ts
src/services/permission-service/permission-service.ts
src/services/project-service/project-service.ts
src/services/services.ts
src/services/workflow-service/workflow-service.ts
src/store/advanced-tab/advanced-tab.ts
src/store/api-client-authorizations/api-client-authorizations-actions.ts [new file with mode: 0644]
src/store/api-client-authorizations/api-client-authorizations-reducer.ts [new file with mode: 0644]
src/store/auth/auth-action-session.ts
src/store/auth/auth-action.test.ts
src/store/auth/auth-reducer.test.ts
src/store/breadcrumbs/breadcrumbs-actions.ts
src/store/collection-panel/collection-panel-action.ts
src/store/compute-nodes/compute-nodes-actions.ts
src/store/compute-nodes/compute-nodes-middleware-service.ts [new file with mode: 0644]
src/store/compute-nodes/compute-nodes-reducer.ts [deleted file]
src/store/context-menu/context-menu-actions.ts
src/store/data-explorer/data-explorer-middleware-service.ts
src/store/dialog/dialog-actions.ts
src/store/dialog/dialog-reducer.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/link-panel/link-panel-actions.ts [new file with mode: 0644]
src/store/link-panel/link-panel-middleware-service.ts [new file with mode: 0644]
src/store/my-account/my-account-panel-actions.ts [new file with mode: 0644]
src/store/navigation/navigation-action.ts
src/store/process-panel/process-panel-actions.ts
src/store/processes/process-input-actions.ts
src/store/processes/process-update-actions.ts
src/store/project-panel/project-panel-middleware-service.ts
src/store/repositories/repositories-actions.ts
src/store/run-process-panel/run-process-panel-actions.ts
src/store/run-process-panel/run-process-panel-reducer.ts
src/store/search-results-panel/search-results-middleware-service.ts
src/store/shared-with-me-panel/shared-with-me-middleware-service.ts
src/store/store.ts
src/store/trash-panel/trash-panel-action.ts
src/store/users/user-panel-middleware-service.ts [new file with mode: 0644]
src/store/users/users-actions.ts [new file with mode: 0644]
src/store/virtual-machines/virtual-machines-actions.ts
src/store/virtual-machines/virtual-machines-reducer.ts
src/store/workbench/workbench-actions.ts
src/store/workflow-panel/workflow-middleware-service.ts
src/validators/min-length.tsx [new file with mode: 0644]
src/validators/validators.tsx
src/views-components/api-client-authorizations-dialog/attributes-dialog.tsx [new file with mode: 0644]
src/views-components/api-client-authorizations-dialog/help-dialog.tsx [new file with mode: 0644]
src/views-components/api-client-authorizations-dialog/remove-dialog.tsx [new file with mode: 0644]
src/views-components/context-menu/action-sets/api-client-authorization-action-set.ts [new file with mode: 0644]
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/link-action-set.ts [new file with mode: 0644]
src/views-components/context-menu/action-sets/process-action-set.ts
src/views-components/context-menu/action-sets/user-action-set.ts [new file with mode: 0644]
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/data-explorer/renderers.tsx
src/views-components/data-explorer/with-resources.tsx [new file with mode: 0644]
src/views-components/dialog-create/dialog-user-create.tsx [new file with mode: 0644]
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-user-dialog.ts [new file with mode: 0644]
src/views-components/dialog-update/dialog-process-update.tsx
src/views-components/form-fields/collection-form-fields.tsx
src/views-components/form-fields/process-form-fields.tsx
src/views-components/form-fields/user-form-fields.tsx [new file with mode: 0644]
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/links-dialog/attributes-dialog.tsx [new file with mode: 0644]
src/views-components/links-dialog/remove-dialog.tsx [new file with mode: 0644]
src/views-components/main-app-bar/account-menu.tsx
src/views-components/main-app-bar/admin-menu.tsx [new file with mode: 0644]
src/views-components/main-app-bar/help-menu.tsx
src/views-components/main-app-bar/main-app-bar.tsx
src/views-components/main-content-bar/main-content-bar.tsx
src/views-components/sharing-dialog/people-select.tsx
src/views-components/side-panel/side-panel.tsx
src/views-components/user-dialog/attributes-dialog.tsx [new file with mode: 0644]
src/views/api-client-authorization-panel/api-client-authorization-panel-root.tsx [new file with mode: 0644]
src/views/api-client-authorization-panel/api-client-authorization-panel.tsx [new file with mode: 0644]
src/views/collection-panel/collection-panel.tsx
src/views/compute-node-panel/compute-node-panel-root.tsx
src/views/compute-node-panel/compute-node-panel.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/link-panel/link-panel-root.tsx [new file with mode: 0644]
src/views/link-panel/link-panel.tsx [new file with mode: 0644]
src/views/my-account-panel/my-account-panel-root.tsx [new file with mode: 0644]
src/views/my-account-panel/my-account-panel.tsx [new file with mode: 0644]
src/views/process-panel/process-information-card.tsx
src/views/process-panel/process-panel-root.tsx
src/views/process-panel/process-panel.tsx
src/views/repositories-panel/repositories-panel.tsx
src/views/run-process-panel/run-process-first-step.tsx
src/views/run-process-panel/run-process-second-step.tsx
src/views/run-process-panel/workflow-preset-select.tsx [new file with mode: 0644]
src/views/search-results-panel/search-results-panel-view.tsx
src/views/trash-panel/trash-panel.tsx
src/views/user-panel/user-panel.tsx [new file with mode: 0644]
src/views/virtual-machine-panel/virtual-machine-admin-panel.tsx [new file with mode: 0644]
src/views/virtual-machine-panel/virtual-machine-user-panel.tsx [moved from src/views/virtual-machine-panel/virtual-machine-panel.tsx with 53% similarity]
src/views/workbench/workbench.tsx
src/views/workflow-panel/workflow-description-card.tsx

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
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 d801c5fa67b1189278daecb3df0138a7cd4dc5a8..3961d5aa2496fec7fbba912a96738f1bc15b8b5d 100644 (file)
@@ -52,7 +52,7 @@ export interface Config {
     websocketUrl: string;
     workbenchUrl: string;
     vocabularyUrl: string;
-    origin: string;
+    fileViewersConfigUrl: string;
 }
 
 export const fetchConfig = () => {
@@ -64,7 +64,12 @@ export const fetchConfig = () => {
             .get<Config>(getDiscoveryURL(config.API_HOST))
             .then(response => ({
                 // TODO: After tests delete `|| '/vocabulary-example.json'`
-                config: {...response.data, vocabularyUrl: config.VOCABULARY_URL || '/vocabulary-example.json' },
+                // 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,
             })));
 
@@ -114,18 +119,20 @@ export const mockConfig = (config: Partial<Config>): Config => ({
     websocketUrl: '',
     workbenchUrl: '',
     vocabularyUrl: '',
-    origin: '',
+    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: "",
 });
 
 export const DISCOVERY_URL = 'discovery/v1/apis/arvados/v1/rest';
index 5383c66e949f59ee1b2d1258f0d2d1402f485bdb..ae50ee8adda3ace82a380b0714961e3ea4fb4394 100644 (file)
@@ -8,9 +8,9 @@ export const formatDate = (isoDate?: string) => {
     if (isoDate) {
         const date = new Date(isoDate);
         const text = date.toLocaleString();
-        return text === 'Invalid Date' ? "" : text;
+        return text === 'Invalid Date' ? "(none)" : text;
     }
-    return "";
+    return "(none)";
 };
 
 export const formatFileSize = (size?: number) => {
index 0e3131db6a3f8c9621c05e3e4df3770960537b88..c3c4fcd02733ac465bb2a4b27f63503a14bac9ee 100644 (file)
@@ -12,6 +12,12 @@ export const resourceLabel = (type: string) => {
             return "Project";
         case ResourceKind.PROCESS:
             return "Process";
+        case ResourceKind.USER:
+            return "User";
+        case ResourceKind.GROUP:
+            return "Group";
+        case ResourceKind.VIRTUAL_MACHINE:
+            return "Virtual Machine";
         default:
             return "Unknown";
     }
index c5811bb6ea716b44692752c68d7f630d61208e7f..b250c7b8ecd43bfc89171e4a9de373bf0cd22ffa 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();
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 cb979c7bd216b31d7e7d6760c08da9471a159472..b6ca215d56463ec7f7ba3742ae06f5105ffa69ad 100644 (file)
@@ -3,15 +3,16 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import * as React from 'react';
-import { Grid, Paper, Toolbar, StyleRulesCallback, withStyles, WithStyles, TablePagination, IconButton, Tooltip } from '@material-ui/core';
-import { ColumnSelector } from "../column-selector/column-selector";
-import { DataTable, DataColumns } from "../data-table/data-table";
-import { DataColumn, SortDirection } from "../data-table/data-column";
-import { SearchInput } from '../search-input/search-input';
+import { Grid, Paper, Toolbar, StyleRulesCallback, withStyles, WithStyles, TablePagination, IconButton, Tooltip, Button } from '@material-ui/core';
+import { ColumnSelector } from "~/components/column-selector/column-selector";
+import { DataTable, DataColumns } from "~/components/data-table/data-table";
+import { DataColumn, SortDirection } from "~/components/data-table/data-column";
+import { SearchInput } from '~/components/search-input/search-input';
 import { ArvadosTheme } from "~/common/custom-theme";
 import { createTree } from '~/models/tree';
-import { DataTableFilters } from '../data-table-filters/data-table-filters-tree';
+import { DataTableFilters } from '~/components/data-table-filters/data-table-filters-tree';
 import { MoreOptionsIcon } from '~/components/icon/icon';
+import { PaperProps } from '@material-ui/core/Paper';
 
 type CssRules = 'searchBox' | "toolbar" | "footer" | "root" | 'moreOptionsButton';
 
@@ -44,6 +45,11 @@ interface DataExplorerDataProps<T> {
     contextMenuColumn: boolean;
     dataTableDefaultView?: React.ReactNode;
     working?: boolean;
+    hideColumnSelector?: boolean;
+    paperProps?: PaperProps;
+    actions?: React.ReactNode;
+    hideSearchInput?: boolean;
+    paperKey?: string;
 }
 
 interface DataExplorerActionProps<T> {
@@ -74,19 +80,21 @@ export const DataExplorer = withStyles(styles)(
                 columns, onContextMenu, onFiltersChange, onSortToggle, working, extractKey,
                 rowsPerPage, rowsPerPageOptions, onColumnToggle, searchValue, onSearch,
                 items, itemsAvailable, onRowClick, onRowDoubleClick, classes,
-                dataTableDefaultView
+                dataTableDefaultView, hideColumnSelector, actions, paperProps, hideSearchInput,
+                paperKey
             } = this.props;
-            return <Paper className={classes.root}>
+            return <Paper className={classes.root} {...paperProps} key={paperKey}>
                 <Toolbar className={classes.toolbar}>
                     <Grid container justify="space-between" wrap="nowrap" alignItems="center">
-                        <div className={classes.searchBox}>
+                        {!hideSearchInput && <div className={classes.searchBox}>
                             <SearchInput
                                 value={searchValue}
                                 onSearch={onSearch} />
-                        </div>
-                        <ColumnSelector
+                        </div>}
+                        {actions}
+                        {!hideColumnSelector && <ColumnSelector
                             columns={columns}
-                            onColumnToggle={onColumnToggle} />
+                            onColumnToggle={onColumnToggle} />}
                     </Grid>
                 </Toolbar>
                 <DataTable
@@ -99,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 8049686f3d749c56db2bab6a55b99d63c975a65e..2bd16970614aab64c2de5d5306fc90e15e6a5de9 100644 (file)
@@ -7,6 +7,7 @@ import Add from '@material-ui/icons/Add';
 import ArrowBack from '@material-ui/icons/ArrowBack';
 import ArrowDropDown from '@material-ui/icons/ArrowDropDown';
 import BubbleChart from '@material-ui/icons/BubbleChart';
+import Build from '@material-ui/icons/Build';
 import Cached from '@material-ui/icons/Cached';
 import ChevronLeft from '@material-ui/icons/ChevronLeft';
 import CloudUpload from '@material-ui/icons/CloudUpload';
@@ -37,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';
@@ -55,6 +57,7 @@ export type IconType = React.SFC<{ className?: string, style?: object }>;
 
 export const AddIcon: IconType = (props) => <Add {...props} />;
 export const AddFavoriteIcon: IconType = (props) => <StarBorder {...props} />;
+export const AdminMenuIcon: IconType = (props) => <Build {...props} />;
 export const AdvancedIcon: IconType = (props) => <SettingsApplications {...props} />;
 export const AttributesIcon: IconType = (props) => <ListAlt {...props} />;
 export const BackIcon: IconType = (props) => <ArrowBack {...props} />;
@@ -81,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 0ebb46bcaae5ff389f1b705c7214f3ef68aaa5fe..93c4080f0fead0c7330f0a65a6824bdb628da8e1 100644 (file)
@@ -26,13 +26,13 @@ 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, children: React.ReactNode, margin?: Margin, placeholder?: string
+    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}
         className={props.classes.textField}
         label={props.label}
-        disabled={props.meta.submitting}
+        disabled={props.disabled || props.meta.submitting}
         error={props.meta.touched && !!props.meta.error}
         autoComplete='off'
         autoFocus={props.autoFocus}
index aaca125eae9f0b3bd7f73f66686aa7f0b6699cf1..1b7a281d6a81798f4f807ca37a643d332ea74ff0 100644 (file)
@@ -5,31 +5,31 @@
 import * as React from 'react';
 import * as ReactDOM from 'react-dom';
 import { Provider } from "react-redux";
-import { MainPanel } from './views/main-panel/main-panel';
-import './index.css';
+import { MainPanel } from '~/views/main-panel/main-panel';
+import '~/index.css';
 import { Route, Switch } from 'react-router';
 import createBrowserHistory from "history/createBrowserHistory";
 import { History } from "history";
-import { configureStore, RootStore } from './store/store';
+import { configureStore, RootStore } from '~/store/store';
 import { ConnectedRouter } from "react-router-redux";
-import { ApiToken } from "./views-components/api-token/api-token";
-import { initAuth } from "./store/auth/auth-action";
-import { createServices } from "./services/services";
+import { ApiToken } from "~/views-components/api-token/api-token";
+import { initAuth } from "~/store/auth/auth-action";
+import { createServices } from "~/services/services";
 import { MuiThemeProvider } from '@material-ui/core/styles';
-import { CustomTheme } from './common/custom-theme';
-import { fetchConfig } from './common/config';
-import { addMenuActionSet, ContextMenuKind } from './views-components/context-menu/context-menu';
-import { rootProjectActionSet } from "./views-components/context-menu/action-sets/root-project-action-set";
-import { projectActionSet } from "./views-components/context-menu/action-sets/project-action-set";
-import { resourceActionSet } from './views-components/context-menu/action-sets/resource-action-set';
-import { favoriteActionSet } from "./views-components/context-menu/action-sets/favorite-action-set";
-import { collectionFilesActionSet } from './views-components/context-menu/action-sets/collection-files-action-set';
-import { collectionFilesItemActionSet } from './views-components/context-menu/action-sets/collection-files-item-action-set';
-import { collectionFilesNotSelectedActionSet } from './views-components/context-menu/action-sets/collection-files-not-selected-action-set';
-import { collectionActionSet } from './views-components/context-menu/action-sets/collection-action-set';
-import { collectionResourceActionSet } from './views-components/context-menu/action-sets/collection-resource-action-set';
-import { processActionSet } from './views-components/context-menu/action-sets/process-action-set';
-import { loadWorkbench } from './store/workbench/workbench-actions';
+import { CustomTheme } from '~/common/custom-theme';
+import { fetchConfig } from '~/common/config';
+import { addMenuActionSet, ContextMenuKind } from '~/views-components/context-menu/context-menu';
+import { rootProjectActionSet } from "~/views-components/context-menu/action-sets/root-project-action-set";
+import { projectActionSet } from "~/views-components/context-menu/action-sets/project-action-set";
+import { resourceActionSet } from '~/views-components/context-menu/action-sets/resource-action-set';
+import { favoriteActionSet } from "~/views-components/context-menu/action-sets/favorite-action-set";
+import { collectionFilesActionSet } from '~/views-components/context-menu/action-sets/collection-files-action-set';
+import { collectionFilesItemActionSet } from '~/views-components/context-menu/action-sets/collection-files-item-action-set';
+import { collectionFilesNotSelectedActionSet } from '~/views-components/context-menu/action-sets/collection-files-not-selected-action-set';
+import { collectionActionSet } from '~/views-components/context-menu/action-sets/collection-action-set';
+import { collectionResourceActionSet } from '~/views-components/context-menu/action-sets/collection-resource-action-set';
+import { processActionSet } from '~/views-components/context-menu/action-sets/process-action-set';
+import { loadWorkbench } from '~/store/workbench/workbench-actions';
 import { Routes } from '~/routes/routes';
 import { trashActionSet } from "~/views-components/context-menu/action-sets/trash-action-set";
 import { ServiceRepository } from '~/services/services';
@@ -53,7 +53,13 @@ import { sshKeyActionSet } from '~/views-components/context-menu/action-sets/ssh
 import { keepServiceActionSet } from '~/views-components/context-menu/action-sets/keep-service-action-set';
 import { loadVocabulary } from '~/store/vocabulary/vocabulary-actions';
 import { virtualMachineActionSet } from '~/views-components/context-menu/action-sets/virtual-machine-action-set';
+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()}]`);
 
@@ -74,7 +80,12 @@ addMenuActionSet(ContextMenuKind.REPOSITORY, repositoryActionSet);
 addMenuActionSet(ContextMenuKind.SSH_KEY, sshKeyActionSet);
 addMenuActionSet(ContextMenuKind.VIRTUAL_MACHINE, virtualMachineActionSet);
 addMenuActionSet(ContextMenuKind.KEEP_SERVICE, keepServiceActionSet);
+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 }) => {
@@ -96,6 +107,7 @@ fetchConfig()
         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 MainPanelComponent = (props: any) => <MainPanel {...props} />;
diff --git a/src/models/api-client-authorization.ts b/src/models/api-client-authorization.ts
new file mode 100644 (file)
index 0000000..aff50be
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+export interface ApiClientAuthorization {
+    uuid: string;
+    apiToken: string;
+    apiClientId: number;
+    userId: number;
+    createdByIpAddress: string;
+    lastUsedByIpAddress: string;
+    lastUsedAt: string;
+    expiresAt: string;
+    createdAt: string;
+    updatedAt: string;
+    ownerUuid: string;
+    defaultOwnerUuid: string;
+    scopes: string[];
+}
\ No newline at end of file
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 baaff658a205f0cc5427e4a7ff796ebd93b64255..785d531cf7d609fec3af696d16c3fbb9028753a4 100644 (file)
@@ -2,19 +2,23 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import { Resource } from "./resource";
 import { TagProperty } from "~/models/tag";
+import { Resource, ResourceKind } from '~/models/resource';
 
 export interface LinkResource extends Resource {
     headUuid: string;
+    headKind: ResourceKind;
     tailUuid: string;
+    tailKind: string;
     linkClass: string;
     name: string;
     properties: TagProperty;
+    kind: ResourceKind.LINK;
 }
 
 export enum LinkClass {
     STAR = 'star',
     TAG = 'tag',
     PERMISSION = 'permission',
+    PRESET = 'preset',
 }
\ No newline at end of file
index 4d2d92e0155b183763b1445865420ffe84a558bf..31f3eb883f974b26c05b45cd28837fe4f493600c 100644 (file)
@@ -21,10 +21,12 @@ export interface TrashableResource extends Resource {
 }
 
 export enum ResourceKind {
+    API_CLIENT_AUTHORIZATION = "arvados#apiClientAuthorization",
     COLLECTION = "arvados#collection",
     CONTAINER = "arvados#container",
     CONTAINER_REQUEST = "arvados#containerRequest",
     GROUP = "arvados#group",
+    LINK = "arvados#link",
     LOG = "arvados#log",
     NODE = "arvados#node",
     PROCESS = "arvados#containerRequest",
@@ -39,10 +41,12 @@ export enum ResourceKind {
 }
 
 export enum ResourceObjectType {
+    API_CLIENT_AUTHORIZATION = 'gj3su',
     COLLECTION = '4zz18',
     CONTAINER = 'dz642',
     CONTAINER_REQUEST = 'xvhdp',
     GROUP = 'j7d0g',
+    LINK = 'o0j2j',
     LOG = '57u5n',
     REPOSITORY = 's0uqq',
     USER = 'tpzed',
@@ -93,6 +97,10 @@ export const extractUuidKind = (uuid: string = '') => {
             return ResourceKind.KEEP_SERVICE;
         case ResourceObjectType.NODE:
             return ResourceKind.NODE;
+        case ResourceObjectType.API_CLIENT_AUTHORIZATION:
+            return ResourceKind.API_CLIENT_AUTHORIZATION;
+        case ResourceObjectType.LINK:
+            return ResourceKind.LINK;
         default:
             return undefined;
     }
index 9f9c534763ca86ee40190c2361c89b4e81da2f95..a7b8458bf81fb37eb6480d33ea19c6e484b67180 100644 (file)
@@ -4,12 +4,24 @@
 
 import { Resource, ResourceKind } from '~/models/resource';
 
+export type UserPrefs = {
+    profile?: {
+        organization?: string,
+        organization_email?: string,
+        lab?: string,
+        website_url?: string,
+        role?: string
+    }
+};
+
 export interface User {
     email: string;
     firstName: string;
     lastName: string;
     uuid: string;
     ownerUuid: string;
+    identityUrl: string;
+    prefs: UserPrefs;
     isAdmin: boolean;
 }
 
@@ -25,7 +37,7 @@ export interface UserResource extends Resource {
     lastName: string;
     identityUrl: string;
     isAdmin: boolean;
-    prefs: string;
+    prefs: UserPrefs;
     defaultOwnerUuid: string;
     isActive: boolean;
     writableBy: string[];
index 0637a3848b5539008ca69bc6540c1e1c157b739d..bb88f4a1aff5c33173d9526a9d74753f25a53abf 100644 (file)
@@ -7,6 +7,9 @@ import { RootStore } from '~/store/store';
 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);
@@ -26,12 +29,24 @@ const handleLocationChange = (store: RootStore) => ({ pathname }: Location) => {
     const searchResultsMatch = Routes.matchSearchResultsRoute(pathname);
     const sharedWithMeMatch = Routes.matchSharedWithMeRoute(pathname);
     const runProcessMatch = Routes.matchRunProcessRoute(pathname);
-    const virtualMachineMatch = Routes.matchVirtualMachineRoute(pathname);
+    const virtualMachineUserMatch = Routes.matchUserVirtualMachineRoute(pathname);
+    const virtualMachineAdminMatch = Routes.matchAdminVirtualMachineRoute(pathname);
     const workflowMatch = Routes.matchWorkflowRoute(pathname);
-    const sshKeysMatch = Routes.matchSshKeysRoute(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));
@@ -55,11 +70,15 @@ const handleLocationChange = (store: RootStore) => ({ pathname }: Location) => {
         store.dispatch(WorkbenchActions.loadWorkflow);
     } else if (searchResultsMatch) {
         store.dispatch(WorkbenchActions.loadSearchResults);
-    } else if (virtualMachineMatch) {
+    } else if (virtualMachineUserMatch) {
+        store.dispatch(WorkbenchActions.loadVirtualMachines);
+    } else if (virtualMachineAdminMatch) {
         store.dispatch(WorkbenchActions.loadVirtualMachines);
-    } else if(repositoryMatch) {
+    } else if (repositoryMatch) {
         store.dispatch(WorkbenchActions.loadRepositories);
-    } else if (sshKeysMatch) {
+    } else if (sshKeysUserMatch) {
+        store.dispatch(WorkbenchActions.loadSshKeys);
+    } else if (sshKeysAdminMatch) {
         store.dispatch(WorkbenchActions.loadSshKeys);
     } else if (siteManagerMatch) {
         store.dispatch(WorkbenchActions.loadSiteManager);
@@ -67,5 +86,17 @@ const handleLocationChange = (store: RootStore) => ({ pathname }: Location) => {
         store.dispatch(WorkbenchActions.loadKeepServices);
     } else if (computeNodesMatch) {
         store.dispatch(WorkbenchActions.loadComputeNodes);
+    } else if (apiClientAuthorizationsMatch) {
+        store.dispatch(WorkbenchActions.loadApiClientAuthorizations);
+    } else if (myAccountMatch) {
+        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 b5cb0aca460a4e8aa64e717c63cf5f66fb0a5501..b1da949652e60d0046e5487de5aa8f6279243bb2 100644 (file)
@@ -19,13 +19,21 @@ export const Routes = {
     REPOSITORIES: '/repositories',
     SHARED_WITH_ME: '/shared-with-me',
     RUN_PROCESS: '/run-process',
-    VIRTUAL_MACHINES: '/virtual-machines',
+    VIRTUAL_MACHINES_ADMIN: '/virtual-machines-admin',
+    VIRTUAL_MACHINES_USER: '/virtual-machines-user',
     WORKFLOWS: '/workflows',
     SEARCH_RESULTS: '/search-results',
-    SSH_KEYS: `/ssh-keys`,
+    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`
+    COMPUTE_NODES: `/nodes`,
+    USERS: '/users',
+    API_CLIENT_AUTHORIZATIONS: `/api_client_authorizations`,
+    GROUPS: '/groups',
+    GROUP_DETAILS: `/group/:id(${RESOURCE_UUID_PATTERN})`,
+    LINKS: '/links'
 };
 
 export const getResourceUrl = (uuid: string) => {
@@ -46,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;
 }
@@ -83,20 +93,44 @@ export const matchWorkflowRoute = (route: string) =>
 export const matchSearchResultsRoute = (route: string) =>
     matchPath<ResourceRouteParams>(route, { path: Routes.SEARCH_RESULTS });
 
-export const matchVirtualMachineRoute = (route: string) =>
-    matchPath<ResourceRouteParams>(route, { path: Routes.VIRTUAL_MACHINES });
+export const matchUserVirtualMachineRoute = (route: string) =>
+    matchPath<ResourceRouteParams>(route, { path: Routes.VIRTUAL_MACHINES_USER });
+
+export const matchAdminVirtualMachineRoute = (route: string) =>
+    matchPath<ResourceRouteParams>(route, { path: Routes.VIRTUAL_MACHINES_ADMIN });
 
 export const matchRepositoriesRoute = (route: string) =>
     matchPath<ResourceRouteParams>(route, { path: Routes.REPOSITORIES });
 
-export const matchSshKeysRoute = (route: string) =>
-    matchPath(route, { path: Routes.SSH_KEYS });
+export const matchSshKeysUserRoute = (route: string) =>
+    matchPath(route, { path: Routes.SSH_KEYS_USER });
+
+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 });
+
 export const matchKeepServicesRoute = (route: string) =>
     matchPath(route, { path: Routes.KEEP_SERVICES });
 
+export const matchUsersRoute = (route: string) =>
+    matchPath(route, { path: Routes.USERS });
+
 export const matchComputeNodesRoute = (route: string) =>
     matchPath(route, { path: Routes.COMPUTE_NODES });
+
+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 });
index 44e4eef5c944b271eba16c558b43a4d700c4f886..23e7729f7d0324f019de00f529c3dcd4d8022bb9 100644 (file)
@@ -6,7 +6,7 @@ import { GroupsService } from "~/services/groups-service/groups-service";
 import { UserService } from '../user-service/user-service';
 import { GroupResource } from '~/models/group';
 import { UserResource } from '~/models/user';
-import { extractUuidObjectType, ResourceObjectType, TrashableResource } from "~/models/resource";
+import { extractUuidObjectType, ResourceObjectType } from "~/models/resource";
 
 export class AncestorService {
     constructor(
@@ -14,16 +14,25 @@ export class AncestorService {
         private userService: UserService
     ) { }
 
-    async ancestors(uuid: string, rootUuid: string): Promise<Array<UserResource | GroupResource>> {
-        const service = this.getService(extractUuidObjectType(uuid));
+    async ancestors(startUuid: string, endUuid: string): Promise<Array<UserResource | GroupResource>> {
+        return this._ancestors(startUuid, endUuid);
+    }
+
+    private async _ancestors(startUuid: string, endUuid: string, previousUuid = ''): Promise<Array<UserResource | GroupResource>> {
+
+        if (startUuid === previousUuid) {
+            return [];
+        }
+
+        const service = this.getService(extractUuidObjectType(startUuid));
         if (service) {
             try {
-                const resource = await service.get(uuid);
-                if (uuid === rootUuid) {
+                const resource = await service.get(startUuid);
+                if (startUuid === endUuid) {
                     return [resource];
                 } else {
                     return [
-                        ...await this.ancestors(resource.ownerUuid, rootUuid),
+                        ...await this._ancestors(resource.ownerUuid, endUuid, startUuid),
                         resource
                     ];
                 }
diff --git a/src/services/api-client-authorization-service/api-client-authorization-service.ts b/src/services/api-client-authorization-service/api-client-authorization-service.ts
new file mode 100644 (file)
index 0000000..3bf4ae8
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { AxiosInstance } from "axios";
+import { ApiActions } from '~/services/api/api-actions';
+import { ApiClientAuthorization } from '~/models/api-client-authorization';
+import { CommonService } from '~/services/common-service/common-service';
+
+export class ApiClientAuthorizationService extends CommonService<ApiClientAuthorization> {
+    constructor(serverApi: AxiosInstance, actions: ApiActions) {
+        super(serverApi, "api_client_authorizations", actions);
+    }
+} 
\ No newline at end of file
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 1492ef1c9f6d2d55599d75d113f5b4d55415d789..8601e2084def92f70cc82794ae19ad3b24353c5c 100644 (file)
@@ -2,7 +2,7 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import { getUserFullname, User } 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";
@@ -17,6 +17,8 @@ export const USER_LAST_NAME_KEY = 'userLastName';
 export const USER_UUID_KEY = 'userUuid';
 export const USER_OWNER_UUID_KEY = 'userOwnerUuid';
 export const USER_IS_ADMIN = 'isAdmin';
+export const USER_IDENTITY_URL = 'identityUrl';
+export const USER_PREFS = 'prefs';
 
 export interface UserDetailsResponse {
     email: string;
@@ -25,6 +27,8 @@ export interface UserDetailsResponse {
     uuid: string;
     owner_uuid: string;
     is_admin: boolean;
+    identity_url: string;
+    prefs: UserPrefs;
 }
 
 export class AuthService {
@@ -65,9 +69,11 @@ export class AuthService {
         const uuid = this.getUuid();
         const ownerUuid = this.getOwnerUuid();
         const isAdmin = this.getIsAdmin();
+        const identityUrl = localStorage.getItem(USER_IDENTITY_URL);
+        const prefs = JSON.parse(localStorage.getItem(USER_PREFS) || '{"profile": {}}');
 
-        return email && firstName && lastName && uuid && ownerUuid
-            ? { email, firstName, lastName, uuid, ownerUuid, isAdmin }
+        return email && firstName && lastName && uuid && ownerUuid && identityUrl && prefs
+            ? { email, firstName, lastName, uuid, ownerUuid, isAdmin, identityUrl, prefs }
             : undefined;
     }
 
@@ -78,6 +84,8 @@ export class AuthService {
         localStorage.setItem(USER_UUID_KEY, user.uuid);
         localStorage.setItem(USER_OWNER_UUID_KEY, user.ownerUuid);
         localStorage.setItem(USER_IS_ADMIN, JSON.stringify(user.isAdmin));
+        localStorage.setItem(USER_IDENTITY_URL, user.identityUrl);
+        localStorage.setItem(USER_PREFS, JSON.stringify(user.prefs));
     }
 
     public removeUser() {
@@ -87,6 +95,8 @@ export class AuthService {
         localStorage.removeItem(USER_UUID_KEY);
         localStorage.removeItem(USER_OWNER_UUID_KEY);
         localStorage.removeItem(USER_IS_ADMIN);
+        localStorage.removeItem(USER_IDENTITY_URL);
+        localStorage.removeItem(USER_PREFS);
     }
 
     public login() {
@@ -106,13 +116,16 @@ export class AuthService {
             .get<UserDetailsResponse>('/users/current')
             .then(resp => {
                 this.actions.progressFn(reqId, false);
+                const prefs = resp.data.prefs.profile ? resp.data.prefs : { profile: {}};
                 return {
                     email: resp.data.email,
                     firstName: resp.data.first_name,
                     lastName: resp.data.last_name,
                     uuid: resp.data.uuid,
                     ownerUuid: resp.data.owner_uuid,
-                    isAdmin: resp.data.is_admin
+                    isAdmin: resp.data.is_admin,
+                    identityUrl: resp.data.identity_url,
+                    prefs
                 };
             })
             .catch(e => {
diff --git a/src/services/client-authorizations-service/client-authorizations-service.ts b/src/services/client-authorizations-service/client-authorizations-service.ts
deleted file mode 100644 (file)
index 6975d63..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-import { CommonResourceService } from "~/services/common-service/common-resource-service";
-import { AxiosInstance } from "axios";
-import { ApiActions } from "~/services/api/api-actions";
-import { ClientAuthorizationResource } from "~/models/client-authorization";
-
-export class ClientAuthorizationsService extends CommonResourceService<ClientAuthorizationResource> {
-    constructor(serverApi: AxiosInstance, actions: ApiActions) {
-        super(serverApi, "api_client_authorizations", actions);
-    }
-}
-//
-// "{"9tee4":{"user":{"href":"/users/c97qk-tpzed-h733ef2x1ux1xig","kind":"arvados#user","etag":"71xgfqki00pfo7kc5mnnqtef0","uuid":"c97qk-tpzed-h733ef2x1ux1xig","owner_uuid":"9tee4-tpzed-000000000000000","created_at":"2018-11-21T08:19:20.215298180Z","modified_by_client_uuid":null,"modified_by_user_uuid":"9tee4-tpzed-000000000000000","modified_at":"2018-11-21T08:19:20.437345000Z","email":"unodgs@gmail.com","username":"unodgs","full_name":"Daniel Kos","first_name":"Daniel","last_name":"Kos","identity_url":null,"is_active":true,"is_admin":false,"is_invited":true,"prefs":{"profile":{"organization":"Digital Software","organization_email":"unodgs@gmail.com","lab":"","website_url":"","role":"Software Developer"}},"writable_by":["9tee4-tpzed-000000000000000","c97qk-tpzed-h733ef2x1ux1xig","9tee4-j7d0g-000000000000000"]},"baseURL":"https://9tee4.arvadosapi.com/","token":"v2/c97qk-gj3su-5c8sbdggl81a66k/deeb5637ae08f44a7856abdf53a7c037bdcbe7a6","listedHost":true},"4xphq":{"user":{"href":"/users/c97qk-tpzed-h733ef2x1ux1xig","kind":"arvados#user","etag":"7fivqub7mwmf0fhky6dqr27nx","uuid":"c97qk-tpzed-h733ef2x1ux1xig","owner_uuid":"4xphq-tpzed-000000000000000","created_at":"2018-11-21T08:19:23.000623836Z","modified_by_client_uuid":null,"modified_by_user_uuid":"4xphq-tpzed-000000000000000","modified_at":"2018-11-21T08:19:24.615112000Z","email":"unodgs@gmail.com","username":"unodgs2","full_name":"Daniel Kos","first_name":"Daniel","last_name":"Kos","identity_url":null,"is_active":true,"is_admin":false,"is_invited":true,"prefs":{"profile":{"organization":"Digital Software","organization_email":"unodgs@gmail.com","lab":"","website_url":"","role":"Software Developer"}},"writable_by":["4xphq-tpzed-000000000000000","c97qk-tpzed-h733ef2x1ux1xig","4xphq-j7d0g-000000000000000"]},"baseURL":"https://4xphq.arvadosapi.com/","token":"v2/c97qk-gj3su-5c8sbdggl81a66k/988337de59eb9ea3f484df0b92ca6b6502a77985","listedHost":true}}"
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
         };
     }
 
index 077e23dbaa228f6504122db9a7779307a36d570b..471c32fa21020e8b9eb1db9ae248ad3c6aa30f8f 100644 (file)
@@ -3,32 +3,10 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import * as _ from "lodash";
-import { AxiosInstance, AxiosPromise } from "axios";
-import * as uuid from "uuid/v4";
+import { AxiosInstance } from "axios";
+import { Resource } from "src/models/resource";
 import { ApiActions } from "~/services/api/api-actions";
-
-export interface ListArguments {
-    limit?: number;
-    offset?: number;
-    filters?: string;
-    order?: string;
-    select?: string[];
-    distinct?: boolean;
-    count?: string;
-}
-
-export interface ListResults<T> {
-    kind: string;
-    offset: number;
-    limit: number;
-    items: T[];
-    itemsAvailable: number;
-}
-
-export interface Errors {
-    errors: string[];
-    errorToken: string;
-}
+import { CommonService } from "~/services/common-service/common-service";
 
 export enum CommonResourceServiceError {
     UNIQUE_VIOLATION = 'UniqueViolation',
@@ -39,105 +17,12 @@ export enum CommonResourceServiceError {
     NONE = 'None'
 }
 
-export class CommonResourceService<T> {
-
-    static mapResponseKeys = (response: { data: any }) =>
-        CommonResourceService.mapKeys(_.camelCase)(response.data)
-
-    static mapKeys = (mapFn: (key: string) => string) =>
-        (value: any): any => {
-            switch (true) {
-                case _.isPlainObject(value):
-                    return Object
-                        .keys(value)
-                        .map(key => [key, mapFn(key)])
-                        .reduce((newValue, [key, newKey]) => ({
-                            ...newValue,
-                            [newKey]: CommonResourceService.mapKeys(mapFn)(value[key])
-                        }), {});
-                case _.isArray(value):
-                    return value.map(CommonResourceService.mapKeys(mapFn));
-                default:
-                    return value;
-            }
-        }
-
-    static defaultResponse<R>(promise: AxiosPromise<R>, actions: ApiActions, mapKeys = true): Promise<R> {
-        const reqId = uuid();
-        actions.progressFn(reqId, true);
-        return promise
-            .then(data => {
-                actions.progressFn(reqId, false);
-                return data;
-            })
-            .then((response: { data: any }) => {
-                return mapKeys ? CommonResourceService.mapResponseKeys(response) : response.data;
-            })
-            .catch(({ response }) => {
-                actions.progressFn(reqId, false);
-                const errors = CommonResourceService.mapResponseKeys(response) as Errors;
-                actions.errorFn(reqId, errors);
-                throw errors;
-            });
-    }
-
-    protected serverApi: AxiosInstance;
-    protected resourceType: string;
-    protected actions: ApiActions;
+export class CommonResourceService<T extends Resource> extends CommonService<T> {
 
     constructor(serverApi: AxiosInstance, resourceType: string, actions: ApiActions) {
-        this.serverApi = serverApi;
-        this.resourceType = '/' + resourceType + '/';
-        this.actions = actions;
-    }
-
-    create(data?: Partial<T>) {
-        return CommonResourceService.defaultResponse(
-            this.serverApi
-                .post<T>(this.resourceType, data && CommonResourceService.mapKeys(_.snakeCase)(data)),
-            this.actions
-        );
-    }
-
-    delete(uuid: string): Promise<T> {
-        return CommonResourceService.defaultResponse(
-            this.serverApi
-                .delete(this.resourceType + uuid),
-            this.actions
-        );
-    }
-
-    get(uuid: string) {
-        return CommonResourceService.defaultResponse(
-            this.serverApi
-                .get<T>(this.resourceType + uuid),
-            this.actions
-        );
-    }
-
-    list(args: ListArguments = {}): Promise<ListResults<T>> {
-        const { filters, order, ...other } = args;
-        const params = {
-            ...other,
-            filters: filters ? `[${filters}]` : undefined,
-            order: order ? order : undefined
-        };
-        return CommonResourceService.defaultResponse(
-            this.serverApi
-                .get(this.resourceType, {
-                    params: CommonResourceService.mapKeys(_.snakeCase)(params)
-                }),
-            this.actions
-        );
-    }
-
-    update(uuid: string, data: Partial<T>) {
-        return CommonResourceService.defaultResponse(
-            this.serverApi
-                .put<T>(this.resourceType + uuid, data && CommonResourceService.mapKeys(_.snakeCase)(data)),
-            this.actions
-        );
+        super(serverApi, resourceType, actions);
     }
+    
 }
 
 export const getCommonResourceServiceError = (errorResponse: any) => {
diff --git a/src/services/common-service/common-service.ts b/src/services/common-service/common-service.ts
new file mode 100644 (file)
index 0000000..b301a72
--- /dev/null
@@ -0,0 +1,131 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as _ from "lodash";
+import { AxiosInstance, AxiosPromise } from "axios";
+import * as uuid from "uuid/v4";
+import { ApiActions } from "~/services/api/api-actions";
+
+interface Errors {
+    errors: string[];
+    errorToken: string;
+}
+
+export interface ListArguments {
+    limit?: number;
+    offset?: number;
+    filters?: string;
+    order?: string;
+    select?: string[];
+    distinct?: boolean;
+    count?: string;
+}
+
+export interface ListResults<T> {
+    kind: string;
+    offset: number;
+    limit: number;
+    items: T[];
+    itemsAvailable: number;
+}
+
+export class CommonService<T> {
+    protected serverApi: AxiosInstance;
+    protected resourceType: string;
+    protected actions: ApiActions;
+
+    constructor(serverApi: AxiosInstance, resourceType: string, actions: ApiActions) {
+        this.serverApi = serverApi;
+        this.resourceType = '/' + resourceType + '/';
+        this.actions = actions;
+    }
+
+    static mapResponseKeys = (response: { data: any }) =>
+        CommonService.mapKeys(_.camelCase)(response.data)
+
+    static mapKeys = (mapFn: (key: string) => string) =>
+        (value: any): any => {
+            switch (true) {
+                case _.isPlainObject(value):
+                    return Object
+                        .keys(value)
+                        .map(key => [key, mapFn(key)])
+                        .reduce((newValue, [key, newKey]) => ({
+                            ...newValue,
+                            [newKey]: CommonService.mapKeys(mapFn)(value[key])
+                        }), {});
+                case _.isArray(value):
+                    return value.map(CommonService.mapKeys(mapFn));
+                default:
+                    return value;
+            }
+        }
+
+    static defaultResponse<R>(promise: AxiosPromise<R>, actions: ApiActions, mapKeys = true): Promise<R> {
+        const reqId = uuid();
+        actions.progressFn(reqId, true);
+        return promise
+            .then(data => {
+                actions.progressFn(reqId, false);
+                return data;
+            })
+            .then((response: { data: any }) => {
+                return mapKeys ? CommonService.mapResponseKeys(response) : response.data;
+            })
+            .catch(({ response }) => {
+                actions.progressFn(reqId, false);
+                const errors = CommonService.mapResponseKeys(response) as Errors;
+                actions.errorFn(reqId, errors);
+                throw errors;
+            });
+    }
+
+    create(data?: Partial<T>) {
+        return CommonService.defaultResponse(
+            this.serverApi
+                .post<T>(this.resourceType, data && CommonService.mapKeys(_.snakeCase)(data)),
+            this.actions
+        );
+    }
+
+    delete(uuid: string): Promise<T> {
+        return CommonService.defaultResponse(
+            this.serverApi
+                .delete(this.resourceType + uuid),
+            this.actions
+        );
+    }
+
+    get(uuid: string) {
+        return CommonService.defaultResponse(
+            this.serverApi
+                .get<T>(this.resourceType + uuid),
+            this.actions
+        );
+    }
+
+    list(args: ListArguments = {}): Promise<ListResults<T>> {
+        const { filters, order, ...other } = args;
+        const params = {
+            ...other,
+            filters: filters ? `[${filters}]` : undefined,
+            order: order ? order : undefined
+        };
+        return CommonService.defaultResponse(
+            this.serverApi
+                .get(this.resourceType, {
+                    params: CommonService.mapKeys(_.snakeCase)(params)
+                }),
+            this.actions
+        );
+    }
+
+    update(uuid: string, data: Partial<T>) {
+        return CommonService.defaultResponse(
+            this.serverApi
+                .put<T>(this.resourceType + uuid, data && CommonService.mapKeys(_.snakeCase)(data)),
+            this.actions
+        );
+    }
+}
\ No newline at end of file
index 92b0713dbcc6ee2ce8b0eb0939d4cb928710676b..c41b2b992e10aafd33f07353f17087834ecf8a68 100644 (file)
@@ -6,7 +6,7 @@ import { LinkService } from "../link-service/link-service";
 import { GroupsService, GroupContentsResource } from "../groups-service/groups-service";
 import { LinkClass } from "~/models/link";
 import { FilterBuilder, joinFilters } from "~/services/api/filter-builder";
-import { ListResults } from "~/services/common-service/common-resource-service";
+import { ListResults } from '~/services/common-service/common-service';
 
 export interface FavoriteListArguments {
     limit?: number;
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 d1e2eff2791c101ef7fd21b2b52ff6e6fb0ed438..d8b33f601f94c553e79e8be078f0dc2c9c4ee62f 100644 (file)
@@ -3,7 +3,8 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import * as _ from "lodash";
-import { CommonResourceService, ListResults, ListArguments } from '~/services/common-service/common-resource-service';
+import { CommonResourceService } from '~/services/common-service/common-resource-service';
+import { ListResults, ListArguments } from '~/services/common-service/common-service';
 import { AxiosInstance } from "axios";
 import { CollectionResource } from "~/models/collection";
 import { ProjectResource } from "~/models/project";
index 4bb0fe0934eecde90c1d2621745b43477b0dd6db..763844e0663552448cfd0f75ebe0a2ed987e2e04 100644 (file)
@@ -4,8 +4,9 @@
 
 import { LinkService } from "~/services/link-service/link-service";
 import { PermissionResource } from "~/models/permission";
-import { ListArguments, ListResults, CommonResourceService } from '~/services/common-service/common-resource-service';
+import { CommonResourceService } from '~/services/common-service/common-resource-service';
 import { LinkClass } from '../../models/link';
+import { ListArguments, ListResults } from '~/services/common-service/common-service';
 
 export class PermissionService extends LinkService<PermissionResource> {
 
index d60034711ed8402e654c3fa43494c963952a0a4a..5c686aae67fd5db06251071bacbc591b5c5f0f51 100644 (file)
@@ -5,7 +5,7 @@
 import { GroupsService } from "../groups-service/groups-service";
 import { ProjectResource } from "~/models/project";
 import { GroupClass } from "~/models/group";
-import { ListArguments } from "~/services/common-service/common-resource-service";
+import { ListArguments } from "~/services/common-service/common-service";
 import { FilterBuilder, joinFilters } from "~/services/api/filter-builder";
 import { TrashableResourceService } from '~/services/common-service/trashable-resource-service';
 import { snakeCase } from 'lodash';
index 7bb83b0dbf956d8de9b2c127c441cfb2eb3a1cc1..78ea714b93cb272afcf8c6518dfd621ed64d9d9e 100644 (file)
@@ -3,6 +3,7 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import Axios from "axios";
+import { ApiClientAuthorizationService } from '~/services/api-client-authorization-service/api-client-authorization-service';
 import { AuthService } from "./auth-service/auth-service";
 import { GroupsService } from "./groups-service/groups-service";
 import { ProjectService } from "./project-service/project-service";
@@ -29,7 +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 { ClientAuthorizationsService } from "~/services/client-authorizations-service/client-authorizations-service";
+import { FileViewersConfigService } from '~/services/file-viewers-config-service/file-viewers-config-service';
 
 export type ServiceRepository = ReturnType<typeof createServices>;
 
@@ -40,8 +41,8 @@ export const createServices = (config: Config, actions: ApiActions) => {
     const webdavClient = new WebDAV();
     webdavClient.defaults.baseURL = config.keepWebServiceUrl;
 
+    const apiClientAuthorizationService = new ApiClientAuthorizationService(apiClient, actions);
     const authorizedKeysService = new AuthorizedKeysService(apiClient, actions);
-    const clientAuthorizationsService = new ClientAuthorizationsService(apiClient, actions);
     const containerRequestService = new ContainerRequestService(apiClient, actions);
     const containerService = new ContainerService(apiClient, actions);
     const groupsService = new GroupsService(apiClient, actions);
@@ -64,18 +65,20 @@ 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,
         apiClient,
+        apiClientAuthorizationService,
         authService,
         authorizedKeysService,
-        clientAuthorizationsService,
         collectionFilesService,
         collectionService,
         containerRequestService,
         containerService,
         favoriteService,
+        fileViewersConfig,
         groupsService,
         keepService,
         linkService,
index 57ad5fa40fc61394f084dcd8ca778ea7d82aa4b0..de9a1186e345ae406de1da2f1b981a444eb5585f 100644 (file)
@@ -6,9 +6,44 @@ import { AxiosInstance } from "axios";
 import { CommonResourceService } from "~/services/common-service/common-resource-service";
 import { WorkflowResource } from '~/models/workflow';
 import { ApiActions } from '~/services/api/api-actions';
+import { LinkService } from '~/services/link-service/link-service';
+import { FilterBuilder } from '~/services/api/filter-builder';
+import { LinkClass } from '~/models/link';
+import { OrderBuilder } from '~/services/api/order-builder';
 
 export class WorkflowService extends CommonResourceService<WorkflowResource> {
+
+    private linksService = new LinkService(this.serverApi, this.actions);
+
     constructor(serverApi: AxiosInstance, actions: ApiActions) {
         super(serverApi, "workflows", actions);
     }
+
+    async presets(workflowUuid: string) {
+
+        const { items: presetLinks } = await this.linksService.list({
+
+            filters: new FilterBuilder()
+                .addEqual('tailUuid', workflowUuid)
+                .addEqual('linkClass', LinkClass.PRESET)
+                .getFilters()
+
+        });
+
+        const presetUuids = presetLinks.map(link => link.headUuid);
+
+        return this.list({
+
+            filters: new FilterBuilder()
+                .addIn('uuid', presetUuids)
+                .getFilters(),
+
+            order: new OrderBuilder<WorkflowResource>()
+                .addAsc('name')
+                .getOrder(),
+
+        });
+
+    }
+
 }
index 6b20f8b328a2ac555552031d5732834a6912fdc8..0cb1c74038503c5c1f80fc58c36cb07d9f0803e5 100644 (file)
@@ -14,14 +14,15 @@ import { CollectionResource } from '~/models/collection';
 import { ProjectResource } from '~/models/project';
 import { ServiceRepository } from '~/services/services';
 import { FilterBuilder } from '~/services/api/filter-builder';
+import { ListResults } from '~/services/common-service/common-service';
 import { RepositoryResource } from '~/models/repositories';
 import { SshKeyResource } from '~/models/ssh-key';
 import { VirtualMachinesResource } from '~/models/virtual-machines';
 import { UserResource } from '~/models/user';
-import { ListResults } from '~/services/common-service/common-resource-service';
 import { LinkResource } from '~/models/link';
 import { KeepServiceResource } from '~/models/keep-services';
 import { NodeResource } from '~/models/node';
+import { ApiClientAuthorization } from '~/models/api-client-authorization';
 
 export const ADVANCED_TAB_DIALOG = 'advancedTabDialog';
 
@@ -74,7 +75,10 @@ enum ResourcePrefix {
     AUTORIZED_KEYS = 'authorized_keys',
     VIRTUAL_MACHINES = 'virtual_machines',
     KEEP_SERVICES = 'keep_services',
-    COMPUTE_NODES = 'nodes'
+    COMPUTE_NODES = 'nodes',
+    USERS = 'users',
+    API_CLIENT_AUTHORIZATIONS = 'api_client_authorizations',
+    LINKS = 'links'
 }
 
 enum KeepServiceData {
@@ -82,14 +86,29 @@ enum KeepServiceData {
     CREATED_AT = 'created_at'
 }
 
+enum UserData {
+    USER = 'user',
+    USERNAME = 'username'
+}
+
 enum ComputeNodeData {
     COMPUTE_NODE = 'node',
     PROPERTIES = 'properties'
 }
 
-type AdvanceResourceKind = CollectionData | ProcessData | ProjectData | RepositoryData | SshKeyData | VirtualMachineData | KeepServiceData | ComputeNodeData;
+enum ApiClientAuthorizationsData {
+    API_CLIENT_AUTHORIZATION = 'api_client_authorization',
+    DEFAULT_OWNER_UUID = 'default_owner_uuid'
+}
+
+enum LinkData {
+    LINK = 'link',
+    PROPERTIES = 'properties'
+}
+
+type AdvanceResourceKind = CollectionData | ProcessData | ProjectData | RepositoryData | SshKeyData | VirtualMachineData | KeepServiceData | ComputeNodeData | ApiClientAuthorizationsData | UserData | LinkData;
 type AdvanceResourcePrefix = GroupContentsResourcePrefix | ResourcePrefix;
-type AdvanceResponseData = ContainerRequestResource | ProjectResource | CollectionResource | RepositoryResource | SshKeyResource | VirtualMachinesResource | KeepServiceResource | NodeResource | undefined;
+type AdvanceResponseData = ContainerRequestResource | ProjectResource | CollectionResource | RepositoryResource | SshKeyResource | VirtualMachinesResource | KeepServiceResource | NodeResource | ApiClientAuthorization | UserResource | LinkResource | undefined;
 
 export const openAdvancedTabDialog = (uuid: string) =>
     async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
@@ -200,8 +219,30 @@ export const openAdvancedTabDialog = (uuid: string) =>
                 });
                 dispatch<any>(initAdvancedTabDialog(advanceDataKeepService));
                 break;
+            case ResourceKind.USER:
+                const { resources } = getState();
+                const data = getResource<UserResource>(uuid)(resources);
+                const metadata = await services.linkService.list({
+                    filters: new FilterBuilder()
+                        .addEqual('headUuid', uuid)
+                        .getFilters()
+                });
+                const advanceDataUser = advancedTabData({
+                    uuid,
+                    metadata,
+                    user: '',
+                    apiResponseKind: userApiResponse,
+                    data,
+                    resourceKind: UserData.USER,
+                    resourcePrefix: ResourcePrefix.USERS,
+                    resourceKindProperty: UserData.USERNAME,
+                    property: data!.username
+                });
+                dispatch<any>(initAdvancedTabDialog(advanceDataUser));
+                break;
             case ResourceKind.NODE:
-                const dataComputeNode = getState().computeNodes.find(node => node.uuid === uuid);
+                const computeNodeResources = getState().resources;
+                const dataComputeNode = getResource<NodeResource>(uuid)(computeNodeResources);
                 const advanceDataComputeNode = advancedTabData({
                     uuid,
                     metadata: '',
@@ -211,10 +252,41 @@ export const openAdvancedTabDialog = (uuid: string) =>
                     resourceKind: ComputeNodeData.COMPUTE_NODE,
                     resourcePrefix: ResourcePrefix.COMPUTE_NODES,
                     resourceKindProperty: ComputeNodeData.PROPERTIES,
-                    property: dataComputeNode!.properties
+                    property: dataComputeNode ? dataComputeNode.properties : {}
                 });
                 dispatch<any>(initAdvancedTabDialog(advanceDataComputeNode));
                 break;
+            case ResourceKind.API_CLIENT_AUTHORIZATION:
+                const dataApiClientAuthorization = getState().apiClientAuthorizations.find(item => item.uuid === uuid);
+                const advanceDataApiClientAuthorization = advancedTabData({
+                    uuid,
+                    metadata: '',
+                    user: '',
+                    apiResponseKind: apiClientAuthorizationApiResponse,
+                    data: dataApiClientAuthorization,
+                    resourceKind: ApiClientAuthorizationsData.API_CLIENT_AUTHORIZATION,
+                    resourcePrefix: ResourcePrefix.API_CLIENT_AUTHORIZATIONS,
+                    resourceKindProperty: ApiClientAuthorizationsData.DEFAULT_OWNER_UUID,
+                    property: dataApiClientAuthorization!.defaultOwnerUuid
+                });
+                dispatch<any>(initAdvancedTabDialog(advanceDataApiClientAuthorization));
+                break;
+            case ResourceKind.LINK:
+                const linkResources = getState().resources;
+                const dataLink = getResource<LinkResource>(uuid)(linkResources);
+                const advanceDataLink = advancedTabData({
+                    uuid,
+                    metadata: '',
+                    user: '',
+                    apiResponseKind: linkApiResponse,
+                    data: dataLink,
+                    resourceKind: LinkData.LINK,
+                    resourcePrefix: ResourcePrefix.LINKS,
+                    resourceKindProperty: LinkData.PROPERTIES,
+                    property: dataLink!.properties
+                });
+                dispatch<any>(initAdvancedTabDialog(advanceDataLink));
+                break;
             default:
                 dispatch(snackbarActions.OPEN_SNACKBAR({ message: "Could not open advanced tab for this resource.", hideDuration: 2000, kind: SnackbarKind.ERROR }));
         }
@@ -465,6 +537,30 @@ const keepServiceApiResponse = (apiResponse: KeepServiceResource) => {
     return response;
 };
 
+const userApiResponse = (apiResponse: UserResource) => {
+    const {
+        uuid, ownerUuid, createdAt, modifiedAt, modifiedByClientUuid, modifiedByUserUuid,
+        email, firstName, lastName, identityUrl, isActive, isAdmin, prefs, defaultOwnerUuid, username
+    } = apiResponse;
+    const response = `"uuid": "${uuid}",
+"owner_uuid": "${ownerUuid}",
+"created_at": "${createdAt}",
+"modified_by_client_uuid": ${stringify(modifiedByClientUuid)},
+"modified_by_user_uuid": ${stringify(modifiedByUserUuid)},
+"modified_at": ${stringify(modifiedAt)},
+"email": "${email}",
+"first_name": "${firstName}",
+"last_name": "${stringify(lastName)}",
+"identity_url": "${identityUrl}",
+"is_active": "${isActive},
+"is_admin": "${isAdmin},
+"prefs": "${stringifyObject(prefs)},
+"default_owner_uuid": "${defaultOwnerUuid},
+"username": "${username}"`;
+
+    return response;
+};
+
 const computeNodeApiResponse = (apiResponse: NodeResource) => {
     const {
         uuid, slotNumber, hostname, domain, ipAddress, firstPingAt, lastPingAt, jobUuid,
@@ -487,5 +583,49 @@ const computeNodeApiResponse = (apiResponse: NodeResource) => {
 "properties": "${JSON.stringify(properties, null, 4)}",
 "info": "${JSON.stringify(info, null, 4)}"`;
 
+    return response;
+};
+
+const apiClientAuthorizationApiResponse = (apiResponse: ApiClientAuthorization) => {
+    const {
+        uuid, ownerUuid, apiToken, apiClientId, userId, createdByIpAddress, lastUsedByIpAddress,
+        lastUsedAt, expiresAt, defaultOwnerUuid, scopes, updatedAt, createdAt
+    } = apiResponse;
+    const response = `"uuid": "${uuid}",
+"owner_uuid": "${ownerUuid}",
+"api_token": "${stringify(apiToken)}",
+"api_client_id": "${stringify(apiClientId)}",
+"user_id": "${stringify(userId)}",
+"created_by_ip_address": "${stringify(createdByIpAddress)}",
+"last_used_by_ip_address": "${stringify(lastUsedByIpAddress)}",
+"last_used_at": "${stringify(lastUsedAt)}",
+"expires_at": "${stringify(expiresAt)}",
+"created_at": "${stringify(createdAt)}",
+"updated_at": "${stringify(updatedAt)}",
+"default_owner_uuid": "${stringify(defaultOwnerUuid)}",
+"scopes": "${JSON.stringify(scopes, null, 4)}"`;
+
+    return response;
+};
+
+const linkApiResponse = (apiResponse: LinkResource) => {
+    const {
+        uuid, name, headUuid, properties, headKind, tailUuid, tailKind, linkClass,
+        ownerUuid, createdAt, modifiedAt, modifiedByClientUuid, modifiedByUserUuid
+    } = apiResponse;
+    const response = `"uuid": "${uuid}",
+"name": "${name}",
+"head_uuid": "${headUuid}",
+"head_kind": "${headKind}",
+"tail_uuid": "${tailUuid}",
+"tail_kind": "${tailKind}",
+"link_class": "${linkClass}",
+"owner_uuid": "${ownerUuid}",
+"created_at": "${stringify(createdAt)}",
+"modified_at": ${stringify(modifiedAt)},
+"modified_by_client_uuid": ${stringify(modifiedByClientUuid)},
+"modified_by_user_uuid": ${stringify(modifiedByUserUuid)},
+"properties": "${JSON.stringify(properties, null, 4)}"`;
+
     return response;
 };
\ No newline at end of file
diff --git a/src/store/api-client-authorizations/api-client-authorizations-actions.ts b/src/store/api-client-authorizations/api-client-authorizations-actions.ts
new file mode 100644 (file)
index 0000000..8ed8a38
--- /dev/null
@@ -0,0 +1,82 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { Dispatch } from "redux";
+import { unionize, ofType, UnionOf } from "~/common/unionize";
+import { RootState } from '~/store/store';
+import { setBreadcrumbs } from '~/store/breadcrumbs/breadcrumbs-actions';
+import { ServiceRepository } from "~/services/services";
+import { dialogActions } from '~/store/dialog/dialog-actions';
+import { snackbarActions } from '~/store/snackbar/snackbar-actions';
+import { navigateToRootProject } from '~/store/navigation/navigation-action';
+import { ApiClientAuthorization } from '~/models/api-client-authorization';
+
+export const apiClientAuthorizationsActions = unionize({
+    SET_API_CLIENT_AUTHORIZATIONS: ofType<ApiClientAuthorization[]>(),
+    REMOVE_API_CLIENT_AUTHORIZATION: ofType<string>()
+});
+
+export type ApiClientAuthorizationsActions = UnionOf<typeof apiClientAuthorizationsActions>;
+
+export const API_CLIENT_AUTHORIZATION_REMOVE_DIALOG = 'apiClientAuthorizationRemoveDialog';
+export const API_CLIENT_AUTHORIZATION_ATTRIBUTES_DIALOG = 'apiClientAuthorizationAttributesDialog';
+export const API_CLIENT_AUTHORIZATION_HELP_DIALOG = 'apiClientAuthorizationHelpDialog';
+
+export const loadApiClientAuthorizationsPanel = () =>
+    async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
+        const user = getState().auth.user;
+        if (user && user.isAdmin) {
+            try {
+                dispatch(setBreadcrumbs([{ label: 'Api client authorizations' }]));
+                const response = await services.apiClientAuthorizationService.list();
+                dispatch(apiClientAuthorizationsActions.SET_API_CLIENT_AUTHORIZATIONS(response.items));
+            } catch (e) {
+                dispatch(snackbarActions.OPEN_SNACKBAR({ message: "You don't have permissions to view this page", hideDuration: 2000 }));
+                return;
+            }
+        } else {
+            dispatch(navigateToRootProject);
+            dispatch(snackbarActions.OPEN_SNACKBAR({ message: "You don't have permissions to view this page", hideDuration: 2000 }));
+        }
+    };
+
+export const openApiClientAuthorizationAttributesDialog = (uuid: string) =>
+    (dispatch: Dispatch, getState: () => RootState) => {
+        const apiClientAuthorization = getState().apiClientAuthorizations.find(node => node.uuid === uuid);
+        dispatch(dialogActions.OPEN_DIALOG({ id: API_CLIENT_AUTHORIZATION_ATTRIBUTES_DIALOG, data: { apiClientAuthorization } }));
+    };
+
+export const openApiClientAuthorizationRemoveDialog = (uuid: string) =>
+    (dispatch: Dispatch, getState: () => RootState) => {
+        dispatch(dialogActions.OPEN_DIALOG({
+            id: API_CLIENT_AUTHORIZATION_REMOVE_DIALOG,
+            data: {
+                title: 'Remove api client authorization',
+                text: 'Are you sure you want to remove this api client authorization?',
+                confirmButtonLabel: 'Remove',
+                uuid
+            }
+        }));
+    };
+
+export const removeApiClientAuthorization = (uuid: string) =>
+    async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+        dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Removing ...' }));
+        try {
+            await services.apiClientAuthorizationService.delete(uuid);
+            dispatch(apiClientAuthorizationsActions.REMOVE_API_CLIENT_AUTHORIZATION(uuid));
+            dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Api client authorization has been successfully removed.', hideDuration: 2000 }));
+        } catch (e) {
+            return;
+        }
+    };
+
+export const openApiClientAuthorizationsHelpDialog = () =>
+    (dispatch: Dispatch, getState: () => RootState) => {
+        const apiHost = getState().properties.apiHost;
+        const user = getState().auth.user;
+        const email = user ? user.email : '';
+        const apiToken = getState().auth.apiToken;
+        dispatch(dialogActions.OPEN_DIALOG({ id: API_CLIENT_AUTHORIZATION_HELP_DIALOG, data: { apiHost, apiToken, email } }));
+    };
\ No newline at end of file
diff --git a/src/store/api-client-authorizations/api-client-authorizations-reducer.ts b/src/store/api-client-authorizations/api-client-authorizations-reducer.ts
new file mode 100644 (file)
index 0000000..7084dea
--- /dev/null
@@ -0,0 +1,22 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { 
+    apiClientAuthorizationsActions, 
+    ApiClientAuthorizationsActions 
+} from '~/store/api-client-authorizations/api-client-authorizations-actions';
+import { ApiClientAuthorization } from '~/models/api-client-authorization';
+
+export type ApiClientAuthorizationsState = ApiClientAuthorization[];
+
+const initialState: ApiClientAuthorizationsState = [];
+
+export const apiClientAuthorizationsReducer = 
+    (state: ApiClientAuthorizationsState = initialState, action: ApiClientAuthorizationsActions): ApiClientAuthorizationsState =>
+        apiClientAuthorizationsActions.match(action, {
+            SET_API_CLIENT_AUTHORIZATIONS: apiClientAuthorizations => apiClientAuthorizations,
+            REMOVE_API_CLIENT_AUTHORIZATION: (uuid: string) => 
+                state.filter((apiClientAuthorization) => apiClientAuthorization.uuid !== uuid),
+            default: () => state
+        });
\ No newline at end of file
index 4a6f56f92d9b4270f5a0e6065d3cf86aa4afe7e9..83e98e968afbc0b47061a60313cf33b96a06da30 100644 (file)
@@ -91,7 +91,9 @@ const clusterLogin = async (clusterId: string, baseUrl: string, activeSession: S
             uuid: user.uuid,
             ownerUuid: user.owner_uuid,
             email: user.email,
-            isAdmin: user.is_admin
+            isAdmin: user.is_admin,
+            identityUrl: user.identity_url,
+            prefs: user.prefs
         },
         token: saltedToken
     };
index 6d28eb47332c68a814e5e87514b623284a7cea9f..d58c91594e1858d29a562027e03b0e113e1cadec 100644 (file)
@@ -11,7 +11,7 @@ import {
     USER_LAST_NAME_KEY,
     USER_OWNER_UUID_KEY,
     USER_UUID_KEY,
-    USER_IS_ADMIN
+    USER_IS_ADMIN, USER_IDENTITY_URL, USER_PREFS
 } from "~/services/auth-service/auth-service";
 
 import 'jest-localstorage-mock';
@@ -42,6 +42,8 @@ describe('auth-actions', () => {
         localStorage.setItem(USER_FIRST_NAME_KEY, "John");
         localStorage.setItem(USER_LAST_NAME_KEY, "Doe");
         localStorage.setItem(USER_UUID_KEY, "uuid");
+        localStorage.setItem(USER_IDENTITY_URL, "identityUrl");
+        localStorage.setItem(USER_PREFS, JSON.stringify({}));
         localStorage.setItem(USER_OWNER_UUID_KEY, "ownerUuid");
         localStorage.setItem(USER_IS_ADMIN, JSON.stringify("false"));
 
@@ -60,6 +62,8 @@ describe('auth-actions', () => {
                 lastName: "Doe",
                 uuid: "uuid",
                 ownerUuid: "ownerUuid",
+                identityUrl: "identityUrl",
+                prefs: {},
                 isAdmin: false
             }
         });
index a4017db3be7af4b83a69543fdc85d825516ec149..eb7e0c0dac541501782d1929a9a882ae09c98072 100644 (file)
@@ -30,6 +30,8 @@ describe('auth-reducer', () => {
             lastName: "Doe",
             uuid: "uuid",
             ownerUuid: "ownerUuid",
+            identityUrl: "identityUrl",
+            prefs: {},
             isAdmin: false
         };
         const state = reducer(initialState, authActions.INIT({ user, token: "token" }));
@@ -60,6 +62,8 @@ describe('auth-reducer', () => {
             lastName: "Doe",
             uuid: "uuid",
             ownerUuid: "ownerUuid",
+            identityUrl: "identityUrl",
+            prefs: {},
             isAdmin: false
         };
 
@@ -73,6 +77,8 @@ describe('auth-reducer', () => {
                 lastName: "Doe",
                 uuid: "uuid",
                 ownerUuid: "ownerUuid",
+                identityUrl: "identityUrl",
+                prefs: {},
                 isAdmin: false
             }
         });
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));
+
+    };
index 265b5cf8310f3a752ba16302852241ea90fd879b..3b3e34c2b063765a02e2a1b9808ece9ab9aeb75c 100644 (file)
@@ -13,6 +13,8 @@ import { TagProperty } from "~/models/tag";
 import { snackbarActions } from "../snackbar/snackbar-actions";
 import { resourcesActions } from "~/store/resources/resources-actions";
 import { unionize, ofType, UnionOf } from '~/common/unionize';
+import { SnackbarKind } from '~/store/snackbar/snackbar-actions';
+import { navigateTo } from '~/store/navigation/navigation-action';
 
 export const collectionPanelActions = unionize({
     SET_COLLECTION: ofType<CollectionResource>(),
@@ -53,6 +55,16 @@ export const createCollectionTag = (data: TagProperty) =>
         }
     };
 
+export const navigateToProcess = (uuid: string) =>
+    async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
+        try {
+            await services.containerRequestService.get(uuid);
+            dispatch<any>(navigateTo(uuid));
+        } catch {
+            dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'This process does not exists!', hideDuration: 2000, kind: SnackbarKind.ERROR }));
+        }
+    };
+
 export const deleteCollectionTag = (key: string) =>
     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
         const item = getState().collectionPanel.item;
index 659b1e8674c7c63138d76c106c3cc23941665e02..f2f6ad0741e6312f7f5e9cd0683288c13ae74d93 100644 (file)
@@ -3,21 +3,18 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import { Dispatch } from "redux";
-import { unionize, ofType, UnionOf } from "~/common/unionize";
 import { RootState } from '~/store/store';
 import { setBreadcrumbs } from '~/store/breadcrumbs/breadcrumbs-actions';
-import { ServiceRepository } from "~/services/services";
-import { NodeResource } from '~/models/node';
 import { dialogActions } from '~/store/dialog/dialog-actions';
 import { snackbarActions } from '~/store/snackbar/snackbar-actions';
 import { navigateToRootProject } from '~/store/navigation/navigation-action';
+import { bindDataExplorerActions } from '~/store/data-explorer/data-explorer-action';
+import { getResource } from '~/store/resources/resources';
+import { ServiceRepository } from "~/services/services";
+import { NodeResource } from '~/models/node';
 
-export const computeNodesActions = unionize({
-    SET_COMPUTE_NODES: ofType<NodeResource[]>(),
-    REMOVE_COMPUTE_NODE: ofType<string>()
-});
-
-export type ComputeNodesActions = UnionOf<typeof computeNodesActions>;
+export const COMPUTE_NODE_PANEL_ID = "computeNodeId";
+export const computeNodesActions = bindDataExplorerActions(COMPUTE_NODE_PANEL_ID);
 
 export const COMPUTE_NODE_REMOVE_DIALOG = 'computeNodeRemoveDialog';
 export const COMPUTE_NODE_ATTRIBUTES_DIALOG = 'computeNodeAttributesDialog';
@@ -28,8 +25,7 @@ export const loadComputeNodesPanel = () =>
         if (user && user.isAdmin) {
             try {
                 dispatch(setBreadcrumbs([{ label: 'Compute Nodes' }]));
-                const response = await services.nodeService.list();
-                dispatch(computeNodesActions.SET_COMPUTE_NODES(response.items));
+                dispatch(computeNodesActions.REQUEST_ITEMS());
             } catch (e) {
                 return;
             }
@@ -41,7 +37,8 @@ export const loadComputeNodesPanel = () =>
 
 export const openComputeNodeAttributesDialog = (uuid: string) =>
     (dispatch: Dispatch, getState: () => RootState) => {
-        const computeNode = getState().computeNodes.find(node => node.uuid === uuid);
+        const { resources } = getState();
+        const computeNode = getResource<NodeResource>(uuid)(resources);
         dispatch(dialogActions.OPEN_DIALOG({ id: COMPUTE_NODE_ATTRIBUTES_DIALOG, data: { computeNode } }));
     };
 
@@ -63,7 +60,7 @@ export const removeComputeNode = (uuid: string) =>
         dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Removing ...' }));
         try {
             await services.nodeService.delete(uuid);
-            dispatch(computeNodesActions.REMOVE_COMPUTE_NODE(uuid));
+            dispatch(computeNodesActions.REQUEST_ITEMS());
             dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Compute node has been successfully removed.', hideDuration: 2000 }));
         } catch (e) {
             return;
diff --git a/src/store/compute-nodes/compute-nodes-middleware-service.ts b/src/store/compute-nodes/compute-nodes-middleware-service.ts
new file mode 100644 (file)
index 0000000..792da7a
--- /dev/null
@@ -0,0 +1,70 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { ServiceRepository } from '~/services/services';
+import { MiddlewareAPI, Dispatch } from 'redux';
+import { DataExplorerMiddlewareService, dataExplorerToListParams, listResultsToDataExplorerItemsMeta } from '~/store/data-explorer/data-explorer-middleware-service';
+import { RootState } from '~/store/store';
+import { snackbarActions, SnackbarKind } from '~/store/snackbar/snackbar-actions';
+import { DataExplorer, getDataExplorer } from '~/store/data-explorer/data-explorer-reducer';
+import { updateResources } from '~/store/resources/resources-actions';
+import { getSortColumn } from "~/store/data-explorer/data-explorer-reducer";
+import { computeNodesActions } from '~/store/compute-nodes/compute-nodes-actions';
+import { OrderDirection, OrderBuilder } from '~/services/api/order-builder';
+import { ListResults } from '~/services/common-service/common-service';
+import { NodeResource } from '~/models/node';
+import { SortDirection } from '~/components/data-table/data-column';
+import { ComputeNodePanelColumnNames } from '~/views/compute-node-panel/compute-node-panel-root';
+
+export class ComputeNodeMiddlewareService extends DataExplorerMiddlewareService {
+    constructor(private services: ServiceRepository, id: string) {
+        super(id);
+    }
+
+    async requestItems(api: MiddlewareAPI<Dispatch, RootState>) {
+        const state = api.getState();
+        const dataExplorer = getDataExplorer(state.dataExplorer, this.getId());
+        try {
+            const response = await this.services.nodeService.list(getParams(dataExplorer));
+            api.dispatch(updateResources(response.items));
+            api.dispatch(setItems(response));
+        } catch {
+            api.dispatch(couldNotFetchLinks());
+        }
+    }
+}
+
+export const getParams = (dataExplorer: DataExplorer) => ({
+    ...dataExplorerToListParams(dataExplorer),
+    order: getOrder(dataExplorer)
+});
+
+const getOrder = (dataExplorer: DataExplorer) => {
+    const sortColumn = getSortColumn(dataExplorer);
+    const order = new OrderBuilder<NodeResource>();
+    if (sortColumn) {
+        const sortDirection = sortColumn && sortColumn.sortDirection === SortDirection.ASC
+            ? OrderDirection.ASC
+            : OrderDirection.DESC;
+
+        const columnName = sortColumn && sortColumn.name === ComputeNodePanelColumnNames.UUID ? "uuid" : "modifiedAt";
+        return order
+            .addOrder(sortDirection, columnName)
+            .getOrder();
+    } else {
+        return order.getOrder();
+    }
+};
+
+export const setItems = (listResults: ListResults<NodeResource>) =>
+    computeNodesActions.SET_ITEMS({
+        ...listResultsToDataExplorerItemsMeta(listResults),
+        items: listResults.items.map(resource => resource.uuid),
+    });
+
+const couldNotFetchLinks = () =>
+    snackbarActions.OPEN_SNACKBAR({
+        message: 'Could not fetch compute nodes.',
+        kind: SnackbarKind.ERROR
+    });
diff --git a/src/store/compute-nodes/compute-nodes-reducer.ts b/src/store/compute-nodes/compute-nodes-reducer.ts
deleted file mode 100644 (file)
index 44a3780..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright (C) The Arvados Authors. All rights reserved.
-//
-// SPDX-License-Identifier: AGPL-3.0
-
-import { computeNodesActions, ComputeNodesActions } from '~/store/compute-nodes/compute-nodes-actions';
-import { NodeResource } from '~/models/node';
-
-export type ComputeNodesState = NodeResource[];
-
-const initialState: ComputeNodesState = [];
-
-export const computeNodesReducer = (state: ComputeNodesState = initialState, action: ComputeNodesActions): ComputeNodesState =>
-    computeNodesActions.match(action, {
-        SET_COMPUTE_NODES: nodes => nodes,
-        REMOVE_COMPUTE_NODE: (uuid: string) => state.filter((computeNode) => computeNode.uuid !== uuid),
-        default: () => state
-    });
\ No newline at end of file
index 65ddcff2c7f1b360baa0e4ea98587cdb9bbbc179..c43d5685655c8667bc272246bedf6597b41ca7c9 100644 (file)
@@ -17,7 +17,8 @@ import { RepositoryResource } from '~/models/repositories';
 import { SshKeyResource } from '~/models/ssh-key';
 import { VirtualMachinesResource } from '~/models/virtual-machines';
 import { KeepServiceResource } from '~/models/keep-services';
-import { NodeResource } from '~/models/node';
+import { ApiClientAuthorization } from '~/models/api-client-authorization';
+import { ProcessResource } from '~/models/process';
 
 export const contextMenuActions = unionize({
     OPEN_CONTEXT_MENU: ofType<{ position: ContextMenuPosition, resource: ContextMenuResource }>(),
@@ -34,7 +35,7 @@ export type ContextMenuResource = {
     kind: ResourceKind,
     menuKind: ContextMenuKind;
     isTrashed?: boolean;
-    index?: number
+    outputUuid?: string;
 };
 
 export const isKeyboardClick = (event: React.MouseEvent<HTMLElement>) => event.nativeEvent.detail === 0;
@@ -110,17 +111,29 @@ export const openKeepServiceContextMenu = (event: React.MouseEvent<HTMLElement>,
         }));
     };
 
-export const openComputeNodeContextMenu = (event: React.MouseEvent<HTMLElement>, computeNode: NodeResource) =>
+export const openComputeNodeContextMenu = (event: React.MouseEvent<HTMLElement>, resourceUuid: string) =>
     (dispatch: Dispatch) => {
         dispatch<any>(openContextMenu(event, {
             name: '',
-            uuid: computeNode.uuid,
-            ownerUuid: computeNode.ownerUuid,
+            uuid: resourceUuid,
+            ownerUuid: '',
             kind: ResourceKind.NODE,
             menuKind: ContextMenuKind.NODE
         }));
     };
 
+export const openApiClientAuthorizationContextMenu =
+    (event: React.MouseEvent<HTMLElement>, apiClientAuthorization: ApiClientAuthorization) =>
+        (dispatch: Dispatch) => {
+            dispatch<any>(openContextMenu(event, {
+                name: '',
+                uuid: apiClientAuthorization.uuid,
+                ownerUuid: apiClientAuthorization.ownerUuid,
+                kind: ResourceKind.API_CLIENT_AUTHORIZATION,
+                menuKind: ContextMenuKind.API_CLIENT_AUTHORIZATION
+            }));
+        };
+
 export const openRootProjectContextMenu = (event: React.MouseEvent<HTMLElement>, projectUuid: string) =>
     (dispatch: Dispatch, getState: () => RootState) => {
         const res = getResource<UserResource>(projectUuid)(getState().resources);
@@ -165,15 +178,18 @@ export const openSidePanelContextMenu = (event: React.MouseEvent<HTMLElement>, i
 
 export const openProcessContextMenu = (event: React.MouseEvent<HTMLElement>, process: Process) =>
     (dispatch: Dispatch, getState: () => RootState) => {
-        const resource = {
-            uuid: process.containerRequest.uuid,
-            ownerUuid: process.containerRequest.ownerUuid,
-            kind: ResourceKind.PROCESS,
-            name: process.containerRequest.name,
-            description: process.containerRequest.description,
-            menuKind: ContextMenuKind.PROCESS
-        };
-        dispatch<any>(openContextMenu(event, resource));
+        const res = getResource<ProcessResource>(process.containerRequest.uuid)(getState().resources);
+        if (res) {
+            dispatch<any>(openContextMenu(event, {
+                uuid: res.uuid,
+                ownerUuid: res.ownerUuid,
+                kind: ResourceKind.PROCESS,
+                name: res.name,
+                description: res.description,
+                outputUuid: res.outputUuid || '',
+                menuKind: ContextMenuKind.PROCESS
+            }));
+        }
     };
 
 export const resourceKindToContextMenuKind = (uuid: string) => {
@@ -187,6 +203,8 @@ export const resourceKindToContextMenuKind = (uuid: string) => {
             return ContextMenuKind.PROCESS_RESOURCE;
         case ResourceKind.USER:
             return ContextMenuKind.ROOT_PROJECT;
+        case ResourceKind.LINK:
+            return ContextMenuKind.LINK;
         default:
             return;
     }
index 80ab514cb41440b9a3356f62ed6379a4ec08896c..82ba5b4b8e517e9ad6541f228e53213e9ab3f81b 100644 (file)
@@ -6,7 +6,7 @@ import { Dispatch, MiddlewareAPI } from "redux";
 import { RootState } from "../store";
 import { DataColumns } from "~/components/data-table/data-table";
 import { DataExplorer } from './data-explorer-reducer';
-import { ListResults } from '~/services/common-service/common-resource-service';
+import { ListResults } from '~/services/common-service/common-service';
 import { createTree } from "~/models/tree";
 import { DataTableFilters } from "~/components/data-table-filters/data-table-filters-tree";
 
index 22629b692f2bff6dea8c7f78ee97ea18fe0308ca..ce01a50d6919285190974570e254e14841989061 100644 (file)
@@ -6,7 +6,8 @@ import { unionize, ofType, UnionOf } from "~/common/unionize";
 
 export const dialogActions = unionize({
     OPEN_DIALOG: ofType<{ id: string, data: any }>(),
-    CLOSE_DIALOG: ofType<{ id: string }>()
+    CLOSE_DIALOG: ofType<{ id: string }>(),
+    CLOSE_ALL_DIALOGS: ofType<{}>()
 });
 
 export type DialogAction = UnionOf<typeof dialogActions>;
index 48f8ee8a1e6caac149fb07b8c94a10a46a3f2377..30368685064dfe6f9837d7c20d0cc4808b0cbf01 100644 (file)
@@ -6,19 +6,22 @@ import { DialogAction, dialogActions } from "./dialog-actions";
 
 export type DialogState = Record<string, Dialog<any>>;
 
-export interface Dialog <T> {
+export interface Dialog<T> {
     open: boolean;
     data: T;
 }
 
 export const dialogReducer = (state: DialogState = {}, action: DialogAction) =>
+
     dialogActions.match(action, {
         OPEN_DIALOG: ({ id, data }) => ({ ...state, [id]: { open: true, data } }),
-        CLOSE_DIALOG: ({ id }) => ({ 
-            ...state, 
-            [id]: state[id] ? { ...state[id], open: false } : { open: false, data: {} } }),
+        CLOSE_DIALOG: ({ id }) => ({
+            ...state,
+            [id]: state[id] ? { ...state[id], open: false } : { open: false, data: {} }
+        }),
+        CLOSE_ALL_DIALOGS: () => ({ }),
         default: () => state,
     });
 
-export const getDialog = <T>(state: DialogState, id: string) => 
+export const getDialog = <T>(state: DialogState, id: string) =>
     state[id] ? state[id] as Dialog<T> : undefined;
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
+    });
+
diff --git a/src/store/link-panel/link-panel-actions.ts b/src/store/link-panel/link-panel-actions.ts
new file mode 100644 (file)
index 0000000..7cbc507
--- /dev/null
@@ -0,0 +1,57 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { Dispatch } from 'redux';
+import { RootState } from '~/store/store';
+import { ServiceRepository } from '~/services/services';
+import { bindDataExplorerActions } from '~/store/data-explorer/data-explorer-action';
+import { setBreadcrumbs } from '~/store/breadcrumbs/breadcrumbs-actions';
+import { dialogActions } from '~/store/dialog/dialog-actions';
+import { LinkResource } from '~/models/link';
+import { getResource } from '~/store/resources/resources';
+import { snackbarActions } from '~/store/snackbar/snackbar-actions';
+
+export const LINK_PANEL_ID = "linkPanelId";
+export const linkPanelActions = bindDataExplorerActions(LINK_PANEL_ID);
+
+export const LINK_REMOVE_DIALOG = 'linkRemoveDialog';
+export const LINK_ATTRIBUTES_DIALOG = 'linkAttributesDialog';
+
+export const loadLinkPanel = () =>
+    (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+        dispatch(setBreadcrumbs([{ label: 'Links' }]));
+        dispatch(linkPanelActions.REQUEST_ITEMS());
+    };
+
+export const openLinkAttributesDialog = (uuid: string) =>
+    (dispatch: Dispatch, getState: () => RootState) => {
+        const { resources } = getState();
+        const link = getResource<LinkResource>(uuid)(resources);
+        dispatch(dialogActions.OPEN_DIALOG({ id: LINK_ATTRIBUTES_DIALOG, data: { link } }));
+    };
+
+export const openLinkRemoveDialog = (uuid: string) =>
+    (dispatch: Dispatch, getState: () => RootState) => {
+        dispatch(dialogActions.OPEN_DIALOG({
+            id: LINK_REMOVE_DIALOG,
+            data: {
+                title: 'Remove link',
+                text: 'Are you sure you want to remove this link?',
+                confirmButtonLabel: 'Remove',
+                uuid
+            }
+        }));
+    };
+
+export const removeLink = (uuid: string) =>
+    async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+        dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Removing ...' }));
+        try {
+            await services.linkService.delete(uuid);
+            dispatch(linkPanelActions.REQUEST_ITEMS());
+            dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Link has been successfully removed.', hideDuration: 2000 }));
+        } catch (e) {
+            return;
+        }
+    };
\ No newline at end of file
diff --git a/src/store/link-panel/link-panel-middleware-service.ts b/src/store/link-panel/link-panel-middleware-service.ts
new file mode 100644 (file)
index 0000000..b4d342c
--- /dev/null
@@ -0,0 +1,70 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { ServiceRepository } from '~/services/services';
+import { MiddlewareAPI, Dispatch } from 'redux';
+import { DataExplorerMiddlewareService, dataExplorerToListParams, listResultsToDataExplorerItemsMeta } from '~/store/data-explorer/data-explorer-middleware-service';
+import { RootState } from '~/store/store';
+import { snackbarActions, SnackbarKind } from '~/store/snackbar/snackbar-actions';
+import { DataExplorer, getDataExplorer } from '~/store/data-explorer/data-explorer-reducer';
+import { updateResources } from '~/store/resources/resources-actions';
+import { SortDirection } from '~/components/data-table/data-column';
+import { OrderDirection, OrderBuilder } from '~/services/api/order-builder';
+import { ListResults } from '~/services/common-service/common-service';
+import { getSortColumn } from "~/store/data-explorer/data-explorer-reducer";
+import { LinkResource } from '~/models/link';
+import { linkPanelActions } from '~/store/link-panel/link-panel-actions';
+import { LinkPanelColumnNames } from '~/views/link-panel/link-panel-root';
+
+export class LinkMiddlewareService extends DataExplorerMiddlewareService {
+    constructor(private services: ServiceRepository, id: string) {
+        super(id);
+    }
+
+    async requestItems(api: MiddlewareAPI<Dispatch, RootState>) {
+        const state = api.getState();
+        const dataExplorer = getDataExplorer(state.dataExplorer, this.getId());
+        try {
+            const response = await this.services.linkService.list(getParams(dataExplorer));
+            api.dispatch(updateResources(response.items));
+            api.dispatch(setItems(response));
+        } catch {
+            api.dispatch(couldNotFetchLinks());
+        }
+    }
+}
+
+export const getParams = (dataExplorer: DataExplorer) => ({
+    ...dataExplorerToListParams(dataExplorer),
+    order: getOrder(dataExplorer)
+});
+
+const getOrder = (dataExplorer: DataExplorer) => {
+    const sortColumn = getSortColumn(dataExplorer);
+    const order = new OrderBuilder<LinkResource>();
+    if (sortColumn) {
+        const sortDirection = sortColumn && sortColumn.sortDirection === SortDirection.ASC
+            ? OrderDirection.ASC
+            : OrderDirection.DESC;
+
+        const columnName = sortColumn && sortColumn.name === LinkPanelColumnNames.NAME ? "name" : "modifiedAt";
+        return order
+            .addOrder(sortDirection, columnName)
+            .getOrder();
+    } else {
+        return order.getOrder();
+    }
+};
+
+export const setItems = (listResults: ListResults<LinkResource>) =>
+    linkPanelActions.SET_ITEMS({
+        ...listResultsToDataExplorerItemsMeta(listResults),
+        items: listResults.items.map(resource => resource.uuid),
+    });
+
+const couldNotFetchLinks = () =>
+    snackbarActions.OPEN_SNACKBAR({
+        message: 'Could not fetch links.',
+        kind: SnackbarKind.ERROR
+    });
diff --git a/src/store/my-account/my-account-panel-actions.ts b/src/store/my-account/my-account-panel-actions.ts
new file mode 100644 (file)
index 0000000..34bb269
--- /dev/null
@@ -0,0 +1,31 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { Dispatch } from "redux";
+import { RootState } from "~/store/store";
+import { initialize } from "redux-form";
+import { ServiceRepository } from "~/services/services";
+import { setBreadcrumbs } from "~/store/breadcrumbs/breadcrumbs-actions";
+import { authActions } from "~/store/auth/auth-action";
+import { snackbarActions, SnackbarKind } from "~/store/snackbar/snackbar-actions";
+
+export const MY_ACCOUNT_FORM = 'myAccountForm';
+
+export const loadMyAccountPanel = () =>
+    (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
+        dispatch(setBreadcrumbs([{ label: 'User profile'}]));
+    };
+
+export const saveEditedUser = (resource: any) =>
+    async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
+        try {
+            await services.userService.update(resource.uuid, resource);
+            services.authService.saveUser(resource);
+            dispatch(authActions.USER_DETAILS_SUCCESS(resource));
+            dispatch(initialize(MY_ACCOUNT_FORM, resource));
+            dispatch(snackbarActions.OPEN_SNACKBAR({ message: "Profile has been updated.", hideDuration: 2000, kind: SnackbarKind.SUCCESS }));
+        } catch(e) {
+            return;
+        }
+    };
index 8e3929d9501a7ab84b7b16da9012bfb260841c15..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) => {
@@ -21,6 +22,8 @@ export const navigateTo = (uuid: string) =>
             dispatch<any>(navigateToCollection(uuid));
         } else if (kind === ResourceKind.CONTAINER_REQUEST) {
             dispatch<any>(navigateToProcess(uuid));
+        } else if (kind === ResourceKind.VIRTUAL_MACHINE) {
+            dispatch<any>(navigateToAdminVirtualMachines);
         }
         if (uuid === SidePanelTreeCategory.FAVORITES) {
             dispatch<any>(navigateToFavorites);
@@ -30,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);
         }
     };
 
@@ -62,14 +67,30 @@ export const navigateToRunProcess = push(Routes.RUN_PROCESS);
 
 export const navigateToSearchResults = push(Routes.SEARCH_RESULTS);
 
-export const navigateToVirtualMachines = push(Routes.VIRTUAL_MACHINES);
+export const navigateToUserVirtualMachines = push(Routes.VIRTUAL_MACHINES_USER);
+
+export const navigateToAdminVirtualMachines = push(Routes.VIRTUAL_MACHINES_ADMIN);
 
 export const navigateToRepositories = push(Routes.REPOSITORIES);
 
-export const navigateToSshKeys= push(Routes.SSH_KEYS);
+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);
 
 export const navigateToComputeNodes = push(Routes.COMPUTE_NODES);
+
+export const navigateToUsers = push(Routes.USERS);
+
+export const navigateToApiClientAuthorizations = push(Routes.API_CLIENT_AUTHORIZATIONS);
+
+export const navigateToGroups = push(Routes.GROUPS);
+
+export const navigateToGroupDetails = compose(push, getGroupUrl);
+
+export const navigateToLinks = push(Routes.LINKS);
index 832d4d5118749088ca39fae276d0f7cb9e8faa44..2aa914af2ae505c8faaf08ff75b54c50fe17224c 100644 (file)
@@ -6,6 +6,11 @@ import { unionize, ofType, UnionOf } from "~/common/unionize";
 import { loadProcess } from '~/store/processes/processes-actions';
 import { Dispatch } from 'redux';
 import { ProcessStatus } from '~/store/processes/process';
+import { RootState } from '~/store/store';
+import { ServiceRepository } from "~/services/services";
+import { navigateToCollection } from '~/store/navigation/navigation-action';
+import { snackbarActions } from '~/store/snackbar/snackbar-actions';
+import { SnackbarKind } from '../snackbar/snackbar-actions';
 
 export const procesPanelActions = unionize({
     SET_PROCESS_PANEL_FILTERS: ofType<string[]>(),
@@ -22,6 +27,16 @@ export const loadProcessPanel = (uuid: string) =>
         dispatch(initProcessPanelFilters);
     };
 
+export const navigateToOutput = (uuid: string) =>
+    async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
+        try {
+            await services.collectionService.get(uuid);
+            dispatch<any>(navigateToCollection(uuid));
+        } catch {
+            dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'This collection does not exists!', hideDuration: 2000, kind: SnackbarKind.ERROR }));
+        }
+    };
+
 export const initProcessPanelFilters = procesPanelActions.SET_PROCESS_PANEL_FILTERS([
     ProcessStatus.QUEUED,
     ProcessStatus.COMPLETED,
index b67622d3908e394543ae54bd31575048aaa6ad24..b35081c19e656d63288a00a7d8ce937caeb68853 100644 (file)
@@ -5,7 +5,8 @@
 import { dialogActions } from '~/store/dialog/dialog-actions';
 import { RootState } from '~/store/store';
 import { Dispatch } from 'redux';
-import { getProcess, Process } from '~/store/processes/process';
+import { getProcess } from '~/store/processes/process';
+import { snackbarActions } from '~/store/snackbar/snackbar-actions';
 
 export const PROCESS_INPUT_DIALOG_NAME = 'processInputDialog';
 
@@ -13,7 +14,11 @@ export const openProcessInputDialog = (processUuid: string) =>
     (dispatch: Dispatch<any>, getState: () => RootState) => {
         const process = getProcess(processUuid)(getState().resources);
         if (process) {
-            const data: Process = process;
-            dispatch(dialogActions.OPEN_DIALOG({ id: PROCESS_INPUT_DIALOG_NAME, data }));
+            const data: any = process;
+            if (data && data.containerRequest.mounts.varLibCwlWorkflowJson && data.containerRequest.mounts.varLibCwlWorkflowJson.content.graph[1].inputs.length > 0) {
+                dispatch(dialogActions.OPEN_DIALOG({ id: PROCESS_INPUT_DIALOG_NAME, data }));
+            } else {
+                dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'There are no inputs in this process!' }));
+            }
         }
     }; 
\ No newline at end of file
index 372e18829d222745fe487adc395d979fb83557ce..1d6d95bb80cc2a9344efb162297b0bf95fd69c30 100644 (file)
@@ -15,6 +15,7 @@ import { snackbarActions } from '~/store/snackbar/snackbar-actions';
 export interface ProcessUpdateFormDialogData {
     uuid: string;
     name: string;
+    description?: string;
 }
 
 export const PROCESS_UPDATE_FORM_NAME = 'processUpdateFormName';
@@ -34,7 +35,7 @@ export const updateProcess = (resource: ProcessUpdateFormDialogData) =>
     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
         dispatch(startSubmit(PROCESS_UPDATE_FORM_NAME));
         try {
-            const updatedProcess = await services.containerRequestService.update(resource.uuid, { name: resource.name });
+            const updatedProcess = await services.containerRequestService.update(resource.uuid, { name: resource.name, description: resource.description });
             dispatch(projectPanelActions.REQUEST_ITEMS());
             dispatch(dialogActions.CLOSE_DIALOG({ id: PROCESS_UPDATE_FORM_NAME }));
             return updatedProcess;
index 36672e99ac19003ede9f9ade9240d870de496d14..58f158772240019b1b3a9873546cfd7b61e39ed6 100644 (file)
@@ -7,32 +7,32 @@ import {
     dataExplorerToListParams,
     getDataExplorerColumnFilters,
     listResultsToDataExplorerItemsMeta
-} from '../data-explorer/data-explorer-middleware-service';
-import { ProjectPanelColumnNames, ProjectPanelFilter } from "~/views/project-panel/project-panel";
-import { RootState } from "../store";
+} from '~/store/data-explorer/data-explorer-middleware-service';
+import { ProjectPanelColumnNames } from "~/views/project-panel/project-panel";
+import { RootState } from "~/store/store";
 import { DataColumns } from "~/components/data-table/data-table";
 import { ServiceRepository } from "~/services/services";
 import { SortDirection } from "~/components/data-table/data-column";
 import { OrderBuilder, OrderDirection } from "~/services/api/order-builder";
 import { FilterBuilder, joinFilters } from "~/services/api/filter-builder";
 import { GroupContentsResource, GroupContentsResourcePrefix } from "~/services/groups-service/groups-service";
-import { updateFavorites } from "../favorites/favorites-actions";
-import { PROJECT_PANEL_CURRENT_UUID, IS_PROJECT_PANEL_TRASHED, projectPanelActions } from './project-panel-action';
+import { updateFavorites } from "~/store/favorites/favorites-actions";
+import { PROJECT_PANEL_CURRENT_UUID, IS_PROJECT_PANEL_TRASHED, projectPanelActions } from '~/store/project-panel/project-panel-action';
 import { Dispatch, MiddlewareAPI } from "redux";
 import { ProjectResource } from "~/models/project";
 import { updateResources } from "~/store/resources/resources-actions";
 import { getProperty } from "~/store/properties/properties";
-import { snackbarActions, SnackbarKind } from '../snackbar/snackbar-actions';
+import { snackbarActions, SnackbarKind } from '~/store/snackbar/snackbar-actions';
 import { progressIndicatorActions } from '~/store/progress-indicator/progress-indicator-actions.ts';
-import { DataExplorer, getDataExplorer } from '../data-explorer/data-explorer-reducer';
-import { ListResults } from '~/services/common-service/common-resource-service';
-import { loadContainers } from '../processes/processes-actions';
+import { DataExplorer, getDataExplorer } from '~/store/data-explorer/data-explorer-reducer';
+import { ListResults } from '~/services/common-service/common-service';
+import { loadContainers } from '~/store/processes/processes-actions';
 import { ResourceKind } from '~/models/resource';
 import { getResource } from "~/store/resources/resources";
 import { CollectionResource } from "~/models/collection";
 import { resourcesDataActions } from "~/store/resources-data/resources-data-actions";
 import { getSortColumn } from "~/store/data-explorer/data-explorer-reducer";
-import { serializeResourceTypeFilters } from '../resource-type-filters/resource-type-filters';
+import { serializeResourceTypeFilters } from '~/store/resource-type-filters/resource-type-filters';
 
 export class ProjectPanelMiddlewareService extends DataExplorerMiddlewareService {
     constructor(private services: ServiceRepository, id: string) {
index ea64bfc90ee2bb3cd109c1944f8992fdbeb3f087..f2f06e805def51d0843fdecf2d91f39c785779e0 100644 (file)
@@ -91,7 +91,7 @@ export const removeRepository = (uuid: string) =>
 const repositoriesBindedActions = bindDataExplorerActions(REPOSITORIES_PANEL);
 
 export const openRepositoriesPanel = () =>
-    async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+    (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
         dispatch<any>(navigateToRepositories);
     };
 
index f1d2d2fd55aab72f72e03907f9e2460157cb4720..0cbd9cd6823abd18e284e95c9ecc1177b2febb69 100644 (file)
@@ -6,8 +6,8 @@ import { Dispatch } from 'redux';
 import { unionize, ofType, UnionOf } from "~/common/unionize";
 import { ServiceRepository } from "~/services/services";
 import { RootState } from '~/store/store';
-import { WorkflowResource } from '~/models/workflow';
-import { getFormValues } from 'redux-form';
+import { WorkflowResource, getWorkflowInputs, parseWorkflowDefinition } from '~/models/workflow';
+import { getFormValues, initialize } from 'redux-form';
 import { RUN_PROCESS_BASIC_FORM, RunProcessBasicFormData } from '~/views/run-process-panel/run-process-basic-form';
 import { RUN_PROCESS_INPUTS_FORM } from '~/views/run-process-panel/run-process-inputs-form';
 import { WorkflowInputsData } from '~/models/workflow';
@@ -25,6 +25,8 @@ export const runProcessPanelActions = unionize({
     SET_STEP_CHANGED: ofType<boolean>(),
     SET_WORKFLOWS: ofType<WorkflowResource[]>(),
     SET_SELECTED_WORKFLOW: ofType<WorkflowResource>(),
+    SET_WORKFLOW_PRESETS: ofType<WorkflowResource[]>(),
+    SELECT_WORKFLOW_PRESET: ofType<WorkflowResource>(),
     SEARCH_WORKFLOWS: ofType<string>(),
     RESET_RUN_PROCESS_PANEL: ofType<{}>(),
 });
@@ -76,14 +78,33 @@ export const setWorkflow = (workflow: WorkflowResource, isWorkflowChanged = true
         if (isStepChanged && isWorkflowChanged) {
             dispatch(runProcessPanelActions.SET_STEP_CHANGED(false));
             dispatch(runProcessPanelActions.SET_SELECTED_WORKFLOW(workflow));
+            dispatch<any>(loadPresets(workflow.uuid));
         }
         if (!isWorkflowChanged) {
             dispatch(runProcessPanelActions.SET_SELECTED_WORKFLOW(workflow));
+            dispatch<any>(loadPresets(workflow.uuid));
         }
     };
 
+const loadPresets = (workflowUuid: string) =>
+    async (dispatch: Dispatch<any>, _: () => RootState, { workflowService }: ServiceRepository) => {
+        const { items } = await workflowService.presets(workflowUuid);
+        dispatch(runProcessPanelActions.SET_WORKFLOW_PRESETS(items));
+    };
+
+export const selectPreset = (preset: WorkflowResource) =>
+    (dispatch: Dispatch<any>) => {
+        dispatch(runProcessPanelActions.SELECT_WORKFLOW_PRESET(preset));
+        const inputs = getWorkflowInputs(parseWorkflowDefinition(preset)) || [];
+        const values = inputs.reduce((values, input) => ({
+            ...values,
+            [input.id]: input.default,
+        }), {});
+        dispatch(initialize(RUN_PROCESS_INPUTS_FORM, values));
+    };
+
 export const goToStep = (step: number) =>
-    (dispatch: Dispatch, getState: () => RootState) => {
+    (dispatch: Dispatch) => {
         if (step === 1) {
             dispatch(runProcessPanelActions.SET_STEP_CHANGED(true));
         }
index cb272dec7e8c31727ed5ca4bc74d1f718450149f..12c8988bdaccdaba37043631c0f38b49df8c174a 100644 (file)
@@ -12,6 +12,8 @@ interface RunProcessPanel {
     workflows: WorkflowResource[];
     searchWorkflows: WorkflowResource[];
     selectedWorkflow: WorkflowResource | undefined;
+    presets?: WorkflowResource[];
+    selectedPreset?: WorkflowResource;
     inputs: CommandInputParameter[];
 }
 
@@ -33,8 +35,18 @@ export const runProcessPanelReducer = (state = initialState, action: RunProcessP
         SET_SELECTED_WORKFLOW: selectedWorkflow => ({
             ...state,
             selectedWorkflow,
+            presets: undefined,
+            selectedPreset: selectedWorkflow,
             inputs: getWorkflowInputs(parseWorkflowDefinition(selectedWorkflow)) || [],
         }),
+        SET_WORKFLOW_PRESETS: presets => ({
+            ...state,
+            presets,
+        }),
+        SELECT_WORKFLOW_PRESET: selectedPreset => ({
+            ...state,
+            selectedPreset,
+        }),
         SET_WORKFLOWS: workflows => ({ ...state, workflows, searchWorkflows: workflows }),
         SEARCH_WORKFLOWS: term => {
             const termRegex = new RegExp(term, 'i');
index 1bd294f112ed636afa68fd0e7a547a4931df793b..d8b4d7e76f7e6c6616f6b69b1d7779fd9cbd2238 100644 (file)
@@ -13,7 +13,7 @@ import { SortDirection } from '~/components/data-table/data-column';
 import { SearchResultsPanelColumnNames } from '~/views/search-results-panel/search-results-panel-view';
 import { OrderDirection, OrderBuilder } from '~/services/api/order-builder';
 import { GroupContentsResource, GroupContentsResourcePrefix } from "~/services/groups-service/groups-service";
-import { ListResults } from '~/services/common-service/common-resource-service';
+import { ListResults } from '~/services/common-service/common-service';
 import { searchResultsPanelActions } from '~/store/search-results-panel/search-results-panel-actions';
 import { getFilters } from '~/store/search-bar/search-bar-actions';
 import { getSortColumn } from "~/store/data-explorer/data-explorer-reducer";
index c139b429da435b734cfac187543b923d2e0818b2..9e76d46da7a30ef8f0b782b8bf701fbb1e47487e 100644 (file)
@@ -12,7 +12,7 @@ import { updateResources } from '~/store/resources/resources-actions';
 import { loadMissingProcessesInformation, getFilters } from '~/store/project-panel/project-panel-middleware-service';
 import { snackbarActions } from '~/store/snackbar/snackbar-actions';
 import { sharedWithMePanelActions } from './shared-with-me-panel-actions';
-import { ListResults } from '~/services/common-service/common-resource-service';
+import { ListResults } from '~/services/common-service/common-service';
 import { GroupContentsResource, GroupContentsResourcePrefix } from '~/services/groups-service/groups-service';
 import { SortDirection } from '~/components/data-table/data-column';
 import { OrderBuilder, OrderDirection } from '~/services/api/order-builder';
index 321a19b6f25182072d405e29e8b308457b4162df..14a6ba11d7651930b878919fa3f3f5d2bb54205a 100644 (file)
@@ -46,7 +46,17 @@ import { resourcesDataReducer } from "~/store/resources-data/resources-data-redu
 import { virtualMachinesReducer } from "~/store/virtual-machines/virtual-machines-reducer";
 import { repositoriesReducer } from '~/store/repositories/repositories-reducer';
 import { keepServicesReducer } from '~/store/keep-services/keep-services-reducer';
-import { computeNodesReducer } from '~/store/compute-nodes/compute-nodes-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';
+import { ComputeNodeMiddlewareService } from '~/store/compute-nodes/compute-nodes-middleware-service';
 
 const composeEnhancers =
     (process.env.NODE_ENV === 'development' &&
@@ -78,7 +88,22 @@ export function configureStore(history: History, services: ServiceRepository): R
     const workflowPanelMiddleware = dataExplorerMiddleware(
         new WorkflowMiddlewareService(services, WORKFLOW_PANEL_ID)
     );
+    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)
+    );
+    const computeNodeMiddleware = dataExplorerMiddleware(
+        new ComputeNodeMiddlewareService(services, COMPUTE_NODE_PANEL_ID)
+    );
     const middlewares: Middleware[] = [
         routerMiddleware(history),
         thunkMiddleware.withExtraArgument(services),
@@ -87,7 +112,12 @@ export function configureStore(history: History, services: ServiceRepository): R
         trashPanelMiddleware,
         searchResultsPanelMiddleware,
         sharedWithMePanelMiddleware,
-        workflowPanelMiddleware
+        workflowPanelMiddleware,
+        userPanelMiddleware,
+        groupsPanelMiddleware,
+        groupDetailsPanelMiddleware,
+        linkPanelMiddleware,
+        computeNodeMiddleware,
     ];
     const enhancer = composeEnhancers(applyMiddleware(...middlewares));
     return createStore(rootReducer, enhancer);
@@ -119,5 +149,5 @@ const createRootReducer = (services: ServiceRepository) => combineReducers({
     virtualMachines: virtualMachinesReducer,
     repositories: repositoriesReducer,
     keepServices: keepServicesReducer,
-    computeNodes: computeNodesReducer
+    apiClientAuthorizations: apiClientAuthorizationsReducer
 });
index 6be93228be73d438d5b2c8c0f00dd0ba5c46c1ec..e17d9faea5d0e35febddca034fd39b8d950e3afa 100644 (file)
@@ -2,8 +2,7 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import { bindDataExplorerActions } from "../data-explorer/data-explorer-action";
-import { favoritePanelActions } from "~/store/favorite-panel/favorite-panel-action";
+import { bindDataExplorerActions } from "~/store/data-explorer/data-explorer-action";
 
 export const TRASH_PANEL_ID = "trashPanel";
 export const trashPanelActions = bindDataExplorerActions(TRASH_PANEL_ID);
diff --git a/src/store/users/user-panel-middleware-service.ts b/src/store/users/user-panel-middleware-service.ts
new file mode 100644 (file)
index 0000000..bc4bb13
--- /dev/null
@@ -0,0 +1,78 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { ServiceRepository } from '~/services/services';
+import { MiddlewareAPI, Dispatch } from 'redux';
+import { DataExplorerMiddlewareService, dataExplorerToListParams, listResultsToDataExplorerItemsMeta } from '~/store/data-explorer/data-explorer-middleware-service';
+import { RootState } from '~/store/store';
+import { snackbarActions, SnackbarKind } from '~/store/snackbar/snackbar-actions';
+import { DataExplorer, getDataExplorer } from '~/store/data-explorer/data-explorer-reducer';
+import { updateResources } from '~/store/resources/resources-actions';
+import { FilterBuilder } from '~/services/api/filter-builder';
+import { SortDirection } from '~/components/data-table/data-column';
+import { OrderDirection, OrderBuilder } from '~/services/api/order-builder';
+import { ListResults } from '~/services/common-service/common-service';
+import { userBindedActions } from '~/store/users/users-actions';
+import { getSortColumn } from "~/store/data-explorer/data-explorer-reducer";
+import { UserResource } from '~/models/user';
+import { UserPanelColumnNames } from '~/views/user-panel/user-panel';
+
+export class UserMiddlewareService extends DataExplorerMiddlewareService {
+    constructor(private services: ServiceRepository, id: string) {
+        super(id);
+    }
+
+    async requestItems(api: MiddlewareAPI<Dispatch, RootState>) {
+        const state = api.getState();
+        const dataExplorer = getDataExplorer(state.dataExplorer, this.getId());
+        try {
+            const response = await this.services.userService.list(getParams(dataExplorer));
+            api.dispatch(updateResources(response.items));
+            api.dispatch(setItems(response));
+        } catch {
+            api.dispatch(couldNotFetchUsers());
+        }
+    }
+}
+
+export const getParams = (dataExplorer: DataExplorer) => ({
+    ...dataExplorerToListParams(dataExplorer),
+    order: getOrder(dataExplorer),
+    filters: getFilters(dataExplorer)
+});
+
+export const getFilters = (dataExplorer: DataExplorer) => {
+    const filters = new FilterBuilder()
+        .addILike("username", dataExplorer.searchValue)
+        .getFilters();
+    return filters;
+};
+
+export const getOrder = (dataExplorer: DataExplorer) => {
+    const sortColumn = getSortColumn(dataExplorer);
+    const order = new OrderBuilder<UserResource>();
+    if (sortColumn) {
+        const sortDirection = sortColumn && sortColumn.sortDirection === SortDirection.ASC
+            ? OrderDirection.ASC
+            : OrderDirection.DESC;
+        const columnName = sortColumn && sortColumn.name === UserPanelColumnNames.LAST_NAME ? "lastName" : "firstName";
+        return order
+            .addOrder(sortDirection, columnName)
+            .getOrder();
+    } else {
+        return order.getOrder();
+    }
+};
+
+export const setItems = (listResults: ListResults<UserResource>) =>
+    userBindedActions.SET_ITEMS({
+        ...listResultsToDataExplorerItemsMeta(listResults),
+        items: listResults.items.map(resource => resource.uuid),
+    });
+
+const couldNotFetchUsers = () =>
+    snackbarActions.OPEN_SNACKBAR({
+        message: 'Could not fetch users.',
+        kind: SnackbarKind.ERROR
+    });
\ No newline at end of file
diff --git a/src/store/users/users-actions.ts b/src/store/users/users-actions.ts
new file mode 100644 (file)
index 0000000..585a366
--- /dev/null
@@ -0,0 +1,106 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { Dispatch } from "redux";
+import { bindDataExplorerActions } from '~/store/data-explorer/data-explorer-action';
+import { RootState } from '~/store/store';
+import { ServiceRepository } from "~/services/services";
+import { dialogActions } from '~/store/dialog/dialog-actions';
+import { startSubmit, reset } from "redux-form";
+import { snackbarActions, SnackbarKind } from '~/store/snackbar/snackbar-actions';
+import { UserResource } from "~/models/user";
+import { getResource } from '~/store/resources/resources';
+import { navigateToProject, navigateToUsers, navigateToRootProject } from "~/store/navigation/navigation-action";
+
+export const USERS_PANEL_ID = 'usersPanel';
+export const USER_ATTRIBUTES_DIALOG = 'userAttributesDialog';
+export const USER_CREATE_FORM_NAME = 'userCreateFormName';
+
+export interface UserCreateFormDialogData {
+    email: string;
+    identityUrl: string;
+    virtualMachineName: string;
+    groupVirtualMachine: string;
+}
+
+export const openUserAttributes = (uuid: string) =>
+    (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+        const { resources } = getState();
+        const data = getResource<UserResource>(uuid)(resources);
+        dispatch(dialogActions.OPEN_DIALOG({ id: USER_ATTRIBUTES_DIALOG, data }));
+    };
+
+export const openUserCreateDialog = () =>
+    async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+        const userUuid = await services.authService.getUuid();
+        const user = await services.userService.get(userUuid!);
+        const virtualMachines = await services.virtualMachineService.list();
+        dispatch(reset(USER_CREATE_FORM_NAME));
+        dispatch(dialogActions.OPEN_DIALOG({ id: USER_CREATE_FORM_NAME, data: { user, ...virtualMachines } }));
+    };
+
+export const openUserProjects = (uuid: string) =>
+    async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+        dispatch<any>(navigateToProject(uuid));
+    };
+
+
+export const createUser = (user: UserCreateFormDialogData) =>
+    async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+        dispatch(startSubmit(USER_CREATE_FORM_NAME));
+        try {
+            const newUser = await services.userService.create({ ...user });
+            dispatch(dialogActions.CLOSE_DIALOG({ id: USER_CREATE_FORM_NAME }));
+            dispatch(reset(USER_CREATE_FORM_NAME));
+            dispatch(snackbarActions.OPEN_SNACKBAR({ message: "User has been successfully created.", hideDuration: 2000, kind: SnackbarKind.SUCCESS }));
+            dispatch<any>(loadUsersPanel());
+            dispatch(userBindedActions.REQUEST_ITEMS());
+            return newUser;
+        } catch (e) {
+            return;
+        }
+    };
+
+export const openUserPanel = () =>
+    async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+        const user = getState().auth.user;
+        if (user && user.isAdmin) {
+            dispatch<any>(navigateToUsers);
+        } else {
+            dispatch<any>(navigateToRootProject);
+            dispatch(snackbarActions.OPEN_SNACKBAR({ message: "You don't have permissions to view this page", hideDuration: 2000 }));
+        }
+    };
+
+export const toggleIsActive = (uuid: string) =>
+    async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+        const { resources } = getState();
+        const data = getResource<UserResource>(uuid)(resources);
+        const isActive = data!.isActive;
+        const newActivity = await services.userService.update(uuid, { ...data, isActive: !isActive });
+        dispatch<any>(loadUsersPanel());
+        return newActivity;
+    };
+
+export const toggleIsAdmin = (uuid: string) =>
+    async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+        const { resources } = getState();
+        const data = getResource<UserResource>(uuid)(resources);
+        const isAdmin = data!.isAdmin;
+        const newActivity = await services.userService.update(uuid, { ...data, isAdmin: !isAdmin });
+        dispatch<any>(loadUsersPanel());
+        return newActivity;
+    };
+
+export const userBindedActions = bindDataExplorerActions(USERS_PANEL_ID);
+
+export const loadUsersData = () =>
+    async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+        await services.userService.list();
+    };
+
+export const loadUsersPanel = () =>
+    (dispatch: Dispatch) => {
+        dispatch(userBindedActions.REQUEST_ITEMS());
+    };
\ No newline at end of file
index c95277b3a4c412149d4d2f3606a21f0bf3fc699f..1e9825c1cdcbaf917e120b60af685342d6283ddc 100644 (file)
@@ -5,13 +5,13 @@
 import { Dispatch } from "redux";
 import { RootState } from '~/store/store';
 import { ServiceRepository } from "~/services/services";
-import { navigateToVirtualMachines } from "../navigation/navigation-action";
+import { navigateToUserVirtualMachines, navigateToAdminVirtualMachines, navigateToRootProject } from "~/store/navigation/navigation-action";
 import { bindDataExplorerActions } from '~/store/data-explorer/data-explorer-action';
 import { formatDate } from "~/common/formatters";
 import { unionize, ofType, UnionOf } from "~/common/unionize";
 import { VirtualMachineLogins } from '~/models/virtual-machines';
 import { FilterBuilder } from "~/services/api/filter-builder";
-import { ListResults } from "~/services/common-service/common-resource-service";
+import { ListResults } from "~/services/common-service/common-service";
 import { dialogActions } from '~/store/dialog/dialog-actions';
 import { snackbarActions, SnackbarKind } from '~/store/snackbar/snackbar-actions';
 
@@ -28,9 +28,20 @@ export const VIRTUAL_MACHINES_PANEL = 'virtualMachinesPanel';
 export const VIRTUAL_MACHINE_ATTRIBUTES_DIALOG = 'virtualMachineAttributesDialog';
 export const VIRTUAL_MACHINE_REMOVE_DIALOG = 'virtualMachineRemoveDialog';
 
-export const openVirtualMachines = () =>
+export const openUserVirtualMachines = () =>
     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
-        dispatch<any>(navigateToVirtualMachines);
+        dispatch<any>(navigateToUserVirtualMachines);
+    };
+
+export const openAdminVirtualMachines = () =>
+    async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+        const user = getState().auth.user;
+        if (user && user.isAdmin) {
+            dispatch<any>(navigateToAdminVirtualMachines);
+        } else {
+            dispatch<any>(navigateToRootProject);
+            dispatch(snackbarActions.OPEN_SNACKBAR({ message: "You don't have permissions to view this page", hideDuration: 2000 }));
+        }
     };
 
 export const openVirtualMachineAttributes = (uuid: string) =>
@@ -45,7 +56,16 @@ const loadRequestedDate = () =>
         dispatch(virtualMachinesActions.SET_REQUESTED_DATE(date));
     };
 
-export const loadVirtualMachinesData = () =>
+export const loadVirtualMachinesAdminData = () =>
+    async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+        dispatch<any>(loadRequestedDate());
+        const virtualMachines = await services.virtualMachineService.list();
+        dispatch(virtualMachinesActions.SET_VIRTUAL_MACHINES(virtualMachines));
+        const getAllLogins = await services.virtualMachineService.getAllLogins();
+        dispatch(virtualMachinesActions.SET_LOGINS(getAllLogins));
+    };
+
+export const loadVirtualMachinesUserData = () =>
     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
         dispatch<any>(loadRequestedDate());
         const virtualMachines = await services.virtualMachineService.list();
@@ -57,8 +77,6 @@ export const loadVirtualMachinesData = () =>
         });
         dispatch(virtualMachinesActions.SET_VIRTUAL_MACHINES(virtualMachines));
         dispatch(virtualMachinesActions.SET_LINKS(links));
-        const getAllLogins = await services.virtualMachineService.getAllLogins();
-        dispatch(virtualMachinesActions.SET_LOGINS(getAllLogins));
     };
 
 export const saveRequestedDate = () =>
@@ -86,7 +104,7 @@ export const removeVirtualMachine = (uuid: string) =>
         dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Removing ...' }));
         await services.virtualMachineService.delete(uuid);
         dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Removed.', hideDuration: 2000, kind: SnackbarKind.SUCCESS }));
-        dispatch<any>(loadVirtualMachinesData());
+        dispatch<any>(loadVirtualMachinesAdminData());
     };
 
 const virtualMachinesBindedActions = bindDataExplorerActions(VIRTUAL_MACHINES_PANEL);
index 475ad7523896eeb2f63bd96efe92bfa3ce44ea8a..3ee90d57d60a7fbe9280ca89d0027a47a0619917 100644 (file)
@@ -3,7 +3,7 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import { virtualMachinesActions, VirtualMachineActions } from '~/store/virtual-machines/virtual-machines-actions';
-import { ListResults } from '~/services/common-service/common-resource-service';
+import { ListResults } from '~/services/common-service/common-service';
 import { VirtualMachineLogins } from '~/models/virtual-machines';
 
 interface VirtualMachines {
index fdef38c485384478403d841419be4b0b81d2dc4e..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';
@@ -40,6 +40,7 @@ import { loadSharedWithMePanel } from '~/store/shared-with-me-panel/shared-with-
 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-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';
@@ -58,7 +59,17 @@ import { searchResultsPanelColumns } from '~/views/search-results-panel/search-r
 import { loadVirtualMachinesPanel } from '~/store/virtual-machines/virtual-machines-actions';
 import { loadRepositoriesPanel } from '~/store/repositories/repositories-actions';
 import { loadKeepServicesPanel } from '~/store/keep-services/keep-services-actions';
-import { loadComputeNodesPanel } from '~/store/compute-nodes/compute-nodes-actions';
+import { loadUsersPanel, userBindedActions } from '~/store/users/users-actions';
+import { loadLinkPanel, linkPanelActions } from '~/store/link-panel/link-panel-actions';
+import { loadComputeNodesPanel, computeNodesActions } from '~/store/compute-nodes/compute-nodes-actions';
+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';
 
@@ -78,7 +89,6 @@ const handleFirstTimeLoad = (action: any) =>
         }
     };
 
-
 export const loadWorkbench = () =>
     async (dispatch: Dispatch, getState: () => RootState) => {
         dispatch(progressIndicatorActions.START_WORKING(WORKBENCH_LOADING_SCREEN));
@@ -93,6 +103,11 @@ export const loadWorkbench = () =>
                 dispatch(sharedWithMePanelActions.SET_COLUMNS({ columns: projectPanelColumns }));
                 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());
                 if (router.location) {
                     const match = matchRootRoute(router.location.pathname);
@@ -130,7 +145,10 @@ export const loadProject = (uuid: string) =>
             const userUuid = services.authService.getUuid();
             dispatch(setIsProjectPanelTrashed(false));
             if (userUuid) {
-                if (userUuid !== uuid) {
+                if (extractUuidKind(uuid) === ResourceKind.USER && userUuid !== uuid) {
+                    // Load another users home projects
+                    dispatch(finishLoadingProject(uuid));
+                } else if (userUuid !== uuid) {
                     const match = await loadGroupContentsResource({ uuid, userUuid, services });
                     match({
                         OWNED: async project => {
@@ -396,6 +414,11 @@ export const loadSearchResults = handleFirstTimeLoad(
         await dispatch(loadSearchResultsPanel());
     });
 
+export const loadLinks = handleFirstTimeLoad(
+    async (dispatch: Dispatch<any>) => {
+        await dispatch(loadLinkPanel());
+    });
+
 export const loadVirtualMachines = handleFirstTimeLoad(
     async (dispatch: Dispatch<any>) => {
         await dispatch(loadVirtualMachinesPanel());
@@ -414,8 +437,13 @@ export const loadSshKeys = handleFirstTimeLoad(
     });
 
 export const loadSiteManager = handleFirstTimeLoad(
-    async (dispatch: Dispatch<any>) => {
-        await dispatch(loadSiteManagerPanel());
+async (dispatch: Dispatch<any>) => {
+    await dispatch(loadSiteManagerPanel());
+});
+
+export const loadMyAccount = handleFirstTimeLoad(
+    (dispatch: Dispatch<any>) => {
+        dispatch(loadMyAccountPanel());
     });
 
 export const loadKeepServices = handleFirstTimeLoad(
@@ -423,11 +451,36 @@ export const loadKeepServices = handleFirstTimeLoad(
         await dispatch(loadKeepServicesPanel());
     });
 
+export const loadUsers = handleFirstTimeLoad(
+    async (dispatch: Dispatch<any>) => {
+        await dispatch(loadUsersPanel());
+        dispatch(setBreadcrumbs([{ label: 'Users' }]));
+    });
+
 export const loadComputeNodes = handleFirstTimeLoad(
     async (dispatch: Dispatch<any>) => {
         await dispatch(loadComputeNodesPanel());
     });
 
+export const loadApiClientAuthorizations = handleFirstTimeLoad(
+    async (dispatch: Dispatch<any>) => {
+        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;
index fefcb325e24dc8fe406c2b92545309e5e33db11d..6dbcf6ac8df1d5f6e28552b16a6c63451f9fc0c4 100644 (file)
@@ -14,8 +14,8 @@ import { SortDirection } from '~/components/data-table/data-column';
 import { WorkflowPanelColumnNames } from '~/views/workflow-panel/workflow-panel-view';
 import { OrderDirection, OrderBuilder } from '~/services/api/order-builder';
 import { WorkflowResource } from '~/models/workflow';
-import { ListResults } from '~/services/common-service/common-resource-service';
-import { workflowPanelActions } from './workflow-panel-actions';
+import { ListResults } from '~/services/common-service/common-service';
+import { workflowPanelActions } from '~/store/workflow-panel/workflow-panel-actions';
 import { getSortColumn } from "~/store/data-explorer/data-explorer-reducer";
 
 export class WorkflowMiddlewareService extends DataExplorerMiddlewareService {
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 06f46219414317b94ebeb7d25a25810e750d8920..acef9744311ccd82a5d43dcc482eb0250c47cb60 100644 (file)
@@ -22,10 +22,16 @@ export const COPY_FILE_VALIDATION = [require];
 export const MOVE_TO_VALIDATION = [require];
 
 export const PROCESS_NAME_VALIDATION = [require, maxLength(255)];
+export const PROCESS_DESCRIPTION_VALIDATION = [maxLength(255)];
 
 export const REPOSITORY_NAME_VALIDATION = [require, maxLength(255)];
 
+export const USER_EMAIL_VALIDATION = [require, maxLength(255)];
+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];
diff --git a/src/views-components/api-client-authorizations-dialog/attributes-dialog.tsx b/src/views-components/api-client-authorizations-dialog/attributes-dialog.tsx
new file mode 100644 (file)
index 0000000..e7defd6
--- /dev/null
@@ -0,0 +1,78 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from "react";
+import { compose } from 'redux';
+import {
+    withStyles, Dialog, DialogTitle, DialogContent, DialogActions,
+    Button, StyleRulesCallback, WithStyles, Grid
+} from '@material-ui/core';
+import { WithDialogProps, withDialog } from "~/store/dialog/with-dialog";
+import { API_CLIENT_AUTHORIZATION_ATTRIBUTES_DIALOG } from '~/store/api-client-authorizations/api-client-authorizations-actions';
+import { ArvadosTheme } from '~/common/custom-theme';
+import { ApiClientAuthorization } from '~/models/api-client-authorization';
+import { formatDate } from '~/common/formatters';
+
+type CssRules = 'root';
+
+const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
+    root: {
+        fontSize: '0.875rem',
+        '& div:nth-child(odd)': {
+            textAlign: 'right',
+            color: theme.palette.grey["500"]
+        }
+    }
+});
+
+interface AttributesKeepServiceDialogDataProps {
+    apiClientAuthorization: ApiClientAuthorization;
+}
+
+export const AttributesApiClientAuthorizationDialog = compose(
+    withDialog(API_CLIENT_AUTHORIZATION_ATTRIBUTES_DIALOG),
+    withStyles(styles))(
+        ({ open, closeDialog, data, classes }: WithDialogProps<AttributesKeepServiceDialogDataProps> & WithStyles<CssRules>) =>
+            <Dialog open={open} onClose={closeDialog} fullWidth maxWidth='sm'>
+                <DialogTitle>Attributes</DialogTitle>
+                <DialogContent>
+                    {data.apiClientAuthorization && <Grid container direction="row" spacing={16} className={classes.root}>
+                        <Grid item xs={5}>UUID</Grid>
+                        <Grid item xs={7}>{data.apiClientAuthorization.uuid}</Grid>
+                        <Grid item xs={5}>Owner uuid</Grid>
+                        <Grid item xs={7}>{data.apiClientAuthorization.ownerUuid}</Grid>
+                        <Grid item xs={5}>API Client ID</Grid>
+                        <Grid item xs={7}>{data.apiClientAuthorization.apiClientId}</Grid>
+                        <Grid item xs={5}>API Token</Grid>
+                        <Grid item xs={7}>{data.apiClientAuthorization.apiToken}</Grid>
+                        <Grid item xs={5}>Created by IP address</Grid>
+                        <Grid item xs={7}>{data.apiClientAuthorization.createdByIpAddress || '(none)'}</Grid>
+                        <Grid item xs={5}>Default owner</Grid>
+                        <Grid item xs={7}>{data.apiClientAuthorization.defaultOwnerUuid || '(none)'}</Grid>
+                        <Grid item xs={5}>Expires at</Grid>
+                        <Grid item xs={7}>{formatDate(data.apiClientAuthorization.expiresAt) || '(none)'}</Grid>
+                        <Grid item xs={5}>Last used at</Grid>
+                        <Grid item xs={7}>{formatDate(data.apiClientAuthorization.lastUsedAt) || '(none)'}</Grid>
+                        <Grid item xs={5}>Last used by IP address</Grid>
+                        <Grid item xs={7}>{data.apiClientAuthorization.lastUsedByIpAddress || '(none)'}</Grid>
+                        <Grid item xs={5}>Scopes</Grid>
+                        <Grid item xs={7}>{JSON.stringify(data.apiClientAuthorization.scopes || '(none)')}</Grid>
+                        <Grid item xs={5}>User ID</Grid>
+                        <Grid item xs={7}>{data.apiClientAuthorization.userId || '(none)'}</Grid>
+                        <Grid item xs={5}>Created at</Grid>
+                        <Grid item xs={7}>{formatDate(data.apiClientAuthorization.createdAt) || '(none)'}</Grid>
+                        <Grid item xs={5}>Updated at</Grid>
+                        <Grid item xs={7}>{formatDate(data.apiClientAuthorization.updatedAt) || '(none)'}</Grid>
+                    </Grid>}
+                </DialogContent>
+                <DialogActions>
+                    <Button
+                        variant='flat'
+                        color='primary'
+                        onClick={closeDialog}>
+                        Close
+                    </Button>
+                </DialogActions>
+            </Dialog>
+    );
\ No newline at end of file
diff --git a/src/views-components/api-client-authorizations-dialog/help-dialog.tsx b/src/views-components/api-client-authorizations-dialog/help-dialog.tsx
new file mode 100644 (file)
index 0000000..d2802fa
--- /dev/null
@@ -0,0 +1,66 @@
+// 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 } from "@material-ui/core";
+import { WithDialogProps } from "~/store/dialog/with-dialog";
+import { withDialog } from '~/store/dialog/with-dialog';
+import { DefaultCodeSnippet } from '~/components/default-code-snippet/default-code-snippet';
+import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles';
+import { ArvadosTheme } from '~/common/custom-theme';
+import { compose } from "redux";
+import { API_CLIENT_AUTHORIZATION_HELP_DIALOG } from '~/store/api-client-authorizations/api-client-authorizations-actions';
+
+type CssRules = 'codeSnippet';
+
+const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
+    codeSnippet: {
+        borderRadius: theme.spacing.unit * 0.5,
+        border: `1px solid ${theme.palette.grey["400"]}`,
+        '& pre': {
+            fontSize: '0.815rem'
+        }
+    }
+});
+
+interface HelpApiClientAuthorizationDataProps {
+    apiHost: string;
+    apiToken: string;
+    email: string;
+}
+
+export const HelpApiClientAuthorizationDialog = compose(
+    withDialog(API_CLIENT_AUTHORIZATION_HELP_DIALOG),
+    withStyles(styles))(
+        (props: WithDialogProps<HelpApiClientAuthorizationDataProps> & WithStyles<CssRules>) =>
+            <Dialog open={props.open}
+                onClose={props.closeDialog}
+                fullWidth
+                maxWidth='md'>
+                <DialogTitle>HELP:</DialogTitle>
+                <DialogContent>
+                    <DefaultCodeSnippet
+                        className={props.classes.codeSnippet}
+                        lines={[snippetText(props.data)]} />
+                        {/* // lines={snippetText2(props.data)} /> */}
+                </DialogContent>
+                <DialogActions>
+                    <Button
+                        variant='flat'
+                        color='primary'
+                        onClick={props.closeDialog}>
+                        Close
+                </Button>
+                </DialogActions>
+            </Dialog>
+    );
+
+const snippetText = (data: HelpApiClientAuthorizationDataProps) => `### Pasting the following lines at a shell prompt will allow Arvados SDKs
+### to authenticate to your account, ${data.email}
+
+read ARVADOS_API_TOKEN <<EOF
+${data.apiToken}
+EOF
+export ARVADOS_API_TOKEN ARVADOS_API_HOST=${data.apiHost}
+unset ARVADOS_API_HOST_INSECURE`;
diff --git a/src/views-components/api-client-authorizations-dialog/remove-dialog.tsx b/src/views-components/api-client-authorizations-dialog/remove-dialog.tsx
new file mode 100644 (file)
index 0000000..47b6adc
--- /dev/null
@@ -0,0 +1,20 @@
+// 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 { API_CLIENT_AUTHORIZATION_REMOVE_DIALOG, removeApiClientAuthorization } from '~/store/api-client-authorizations/api-client-authorizations-actions';
+
+const mapDispatchToProps = (dispatch: Dispatch, props: WithDialogProps<any>) => ({
+    onConfirm: () => {
+        props.closeDialog();
+        dispatch<any>(removeApiClientAuthorization(props.data.uuid));
+    }
+});
+
+export const RemoveApiClientAuthorizationDialog = compose(
+    withDialog(API_CLIENT_AUTHORIZATION_REMOVE_DIALOG),
+    connect(null, mapDispatchToProps)
+)(ConfirmationDialog);
\ No newline at end of file
diff --git a/src/views-components/context-menu/action-sets/api-client-authorization-action-set.ts b/src/views-components/context-menu/action-sets/api-client-authorization-action-set.ts
new file mode 100644 (file)
index 0000000..b6f089a
--- /dev/null
@@ -0,0 +1,31 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import {
+    openApiClientAuthorizationAttributesDialog,
+    openApiClientAuthorizationRemoveDialog
+} from '~/store/api-client-authorizations/api-client-authorizations-actions';
+import { openAdvancedTabDialog } from '~/store/advanced-tab/advanced-tab';
+import { ContextMenuActionSet } from "~/views-components/context-menu/context-menu-action-set";
+import { AdvancedIcon, RemoveIcon, AttributesIcon } from "~/components/icon/icon";
+
+export const apiClientAuthorizationActionSet: ContextMenuActionSet = [[{
+    name: "Attributes",
+    icon: AttributesIcon,
+    execute: (dispatch, { uuid }) => {
+        dispatch<any>(openApiClientAuthorizationAttributesDialog(uuid));
+    }
+}, {
+    name: "Advanced",
+    icon: AdvancedIcon,
+    execute: (dispatch, { uuid }) => {
+        dispatch<any>(openAdvancedTabDialog(uuid));
+    }
+}, {
+    name: "Remove",
+    icon: RemoveIcon,
+    execute: (dispatch, { uuid }) => {
+        dispatch<any>(openApiClientAuthorizationRemoveDialog(uuid));
+    }
+}]];
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
diff --git a/src/views-components/context-menu/action-sets/link-action-set.ts b/src/views-components/context-menu/action-sets/link-action-set.ts
new file mode 100644 (file)
index 0000000..326741a
--- /dev/null
@@ -0,0 +1,28 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { openLinkAttributesDialog, openLinkRemoveDialog } from '~/store/link-panel/link-panel-actions';
+import { openAdvancedTabDialog } from '~/store/advanced-tab/advanced-tab';
+import { ContextMenuActionSet } from "~/views-components/context-menu/context-menu-action-set";
+import { AdvancedIcon, RemoveIcon, AttributesIcon } from "~/components/icon/icon";
+
+export const linkActionSet: ContextMenuActionSet = [[{
+    name: "Attributes",
+    icon: AttributesIcon,
+    execute: (dispatch, { uuid }) => {
+        dispatch<any>(openLinkAttributesDialog(uuid));
+    }
+}, {
+    name: "Advanced",
+    icon: AdvancedIcon,
+    execute: (dispatch, { uuid }) => {
+        dispatch<any>(openAdvancedTabDialog(uuid));
+    }
+}, {
+    name: "Remove",
+    icon: RemoveIcon,
+    execute: (dispatch, { uuid }) => {
+        dispatch<any>(openLinkRemoveDialog(uuid));
+    }
+}]];
index 2d152543caa248eb9e5b19e1edc35993aab396a4..05242fbc752009b0342137dcdc0ae8d460cad65a 100644 (file)
@@ -15,11 +15,12 @@ import { openMoveProcessDialog } from '~/store/processes/process-move-actions';
 import { openProcessUpdateDialog } from "~/store/processes/process-update-actions";
 import { openCopyProcessDialog } from '~/store/processes/process-copy-actions';
 import { openProcessCommandDialog } from '~/store/processes/process-command-actions';
-import { detailsPanelActions } from '~/store/details-panel/details-panel-action';
 import { openSharingDialog } from "~/store/sharing-dialog/sharing-dialog-actions";
 import { openAdvancedTabDialog } from "~/store/advanced-tab/advanced-tab";
 import { openProcessInputDialog } from "~/store/processes/process-input-actions";
 import { toggleDetailsPanel } from '~/store/details-panel/details-panel-action';
+import { openRemoveProcessDialog } from "~/store/processes/processes-actions";
+import { navigateToOutput } from "~/store/process-panel/process-panel-actions";
 
 export const processActionSet: ContextMenuActionSet = [[
     {
@@ -76,7 +77,9 @@ export const processActionSet: ContextMenuActionSet = [[
         icon: OutputIcon,
         name: "Outputs",
         execute: (dispatch, resource) => {
-            // add code
+            if(resource.outputUuid){
+                dispatch<any>(navigateToOutput(resource.outputUuid));
+            }
         }
     },
     {
@@ -113,12 +116,12 @@ export const processActionSet: ContextMenuActionSet = [[
         execute: (dispatch, resource) => {
             dispatch<any>(openAdvancedTabDialog(resource.uuid));
         }
+    },
+    {
+        name: "Remove",
+        icon: RemoveIcon,
+        execute: (dispatch, resource) => {
+            dispatch<any>(openRemoveProcessDialog(resource.uuid));
+        }
     }
-    // {
-    //     icon: RemoveIcon,
-    //     name: "Remove",
-    //     execute: (dispatch, resource) => {
-    //         // add code
-    //     }
-    // }
 ]];
diff --git a/src/views-components/context-menu/action-sets/user-action-set.ts b/src/views-components/context-menu/action-sets/user-action-set.ts
new file mode 100644 (file)
index 0000000..7b0884e
--- /dev/null
@@ -0,0 +1,35 @@
+// 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, ProjectIcon, AttributesIcon, UserPanelIcon } from "~/components/icon/icon";
+import { openAdvancedTabDialog } from '~/store/advanced-tab/advanced-tab';
+import { openUserAttributes, openUserProjects } from "~/store/users/users-actions";
+
+export const userActionSet: ContextMenuActionSet = [[{
+    name: "Attributes",
+    icon: AttributesIcon,
+    execute: (dispatch, { uuid }) => {
+        dispatch<any>(openUserAttributes(uuid));
+    }
+}, {
+    name: "Project",
+    icon: ProjectIcon,
+    execute: (dispatch, { uuid }) => {
+        dispatch<any>(openUserProjects(uuid));
+    }
+}, {
+    name: "Advanced",
+    icon: AdvancedIcon,
+    execute: (dispatch, { uuid }) => {
+        dispatch<any>(openAdvancedTabDialog(uuid));
+    }
+},
+{
+    name: "Manage",
+    icon: UserPanelIcon,
+    execute: (dispatch, { uuid }) => {
+        dispatch<any>(openAdvancedTabDialog(uuid));
+    }
+}]];
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 3fa1ab30d83d5d994e7b94bbe49b356deee74009..4ce2f5214d5f337d2488f0acb232d6d1ea5f1b0d 100644 (file)
@@ -55,6 +55,7 @@ const getMenuActionSet = (resource?: ContextMenuResource): ContextMenuActionSet
 };
 
 export enum ContextMenuKind {
+    API_CLIENT_AUTHORIZATION = "ApiClientAuthorization",
     ROOT_PROJECT = "RootProject",
     PROJECT = "Project",
     RESOURCE = "Resource",
@@ -73,5 +74,9 @@ export enum ContextMenuKind {
     SSH_KEY = "SshKey",
     VIRTUAL_MACHINE = "VirtualMachine",
     KEEP_SERVICE = "KeepService",
-    NODE = "Node"
+    USER = "User",
+    NODE = "Node",
+    GROUPS = "Group",
+    GROUP_MEMBER = "GroupMember",
+    LINK = "Link",
 }
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 a032b3ed5a22945e952d20767afd924fb931d4bd..ce4d430fd18597a0c4af04925eb31fa9a636dd77 100644 (file)
@@ -3,7 +3,7 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import * as React from 'react';
-import { Grid, Typography, withStyles, Tooltip, IconButton } from '@material-ui/core';
+import { Grid, Typography, withStyles, Tooltip, IconButton, Checkbox, Button } from '@material-ui/core';
 import { FavoriteStar } from '../favorite-star/favorite-star';
 import { ResourceKind, TrashableResource } from '~/models/resource';
 import { ProjectIcon, CollectionIcon, ProcessIcon, DefaultIcon, WorkflowIcon, ShareIcon } from '~/components/icon/icon';
@@ -21,8 +21,13 @@ import { ResourceStatus } from '~/views/workflow-panel/workflow-panel-view';
 import { getUuidPrefix, openRunProcess } from '~/store/workflow-panel/workflow-panel-actions';
 import { getResourceData } from "~/store/resources-data/resources-data";
 import { openSharingDialog } from '~/store/sharing-dialog/sharing-dialog-actions';
+import { UserResource } from '~/models/user';
+import { toggleIsActive, toggleIsAdmin } from '~/store/users/users-actions';
+import { LinkResource } from '~/models/link';
+import { navigateTo } from '~/store/navigation/navigation-action';
+import { withResource, getDataFromResource, withResourceData } from '~/views-components/data-explorer/with-resources';
 
-export const renderName = (item: { name: string; uuid: string, kind: string }) =>
+const renderName = (item: { name: string; uuid: string, kind: string }) =>
     <Grid container alignItems="center" wrap="nowrap" spacing={16}>
         <Grid item>
             {renderIcon(item)}
@@ -45,7 +50,7 @@ export const ResourceName = connect(
         return resource || { name: '', uuid: '', kind: '' };
     })(renderName);
 
-export const renderIcon = (item: { kind: string }) => {
+const renderIcon = (item: { kind: string }) => {
     switch (item.kind) {
         case ResourceKind.PROJECT:
             return <ProjectIcon />;
@@ -60,11 +65,11 @@ export const renderIcon = (item: { kind: string }) => {
     }
 };
 
-export const renderDate = (date?: string) => {
+const renderDate = (date?: string) => {
     return <Typography noWrap style={{ minWidth: '100px' }}>{formatDate(date)}</Typography>;
 };
 
-export const renderWorkflowName = (item: { name: string; uuid: string, kind: string, ownerUuid: string }) =>
+const renderWorkflowName = (item: { name: string; uuid: string, kind: string, ownerUuid: string }) =>
     <Grid container alignItems="center" wrap="nowrap" spacing={16}>
         <Grid item>
             {renderIcon(item)}
@@ -86,7 +91,7 @@ const getPublicUuid = (uuidPrefix: string) => {
     return `${uuidPrefix}-tpzed-anonymouspublic`;
 };
 
-export const resourceShare = (dispatch: Dispatch, uuidPrefix: string, ownerUuid?: string, uuid?: string) => {
+const resourceShare = (dispatch: Dispatch, uuidPrefix: string, ownerUuid?: string, uuid?: string) => {
     const isPublic = ownerUuid === getPublicUuid(uuidPrefix);
     return (
         <div>
@@ -113,7 +118,174 @@ export const ResourceShare = connect(
     })((props: { ownerUuid?: string, uuidPrefix: string, uuid?: string } & DispatchProp<any>) =>
         resourceShare(props.dispatch, props.uuidPrefix, props.ownerUuid, props.uuid));
 
-export const resourceRunProcess = (dispatch: Dispatch, uuid: string) => {
+const renderFirstName = (item: { firstName: string }) => {
+    return <Typography noWrap>{item.firstName}</Typography>;
+};
+
+// User Resources
+export const ResourceFirstName = connect(
+    (state: RootState, props: { uuid: string }) => {
+        const resource = getResource<UserResource>(props.uuid)(state.resources);
+        return resource || { firstName: '' };
+    })(renderFirstName);
+
+const renderLastName = (item: { lastName: string }) =>
+    <Typography noWrap>{item.lastName}</Typography>;
+
+export const ResourceLastName = connect(
+    (state: RootState, props: { uuid: string }) => {
+        const resource = getResource<UserResource>(props.uuid)(state.resources);
+        return resource || { lastName: '' };
+    })(renderLastName);
+
+const renderUuid = (item: { uuid: string }) =>
+    <Typography noWrap>{item.uuid}</Typography>;
+
+export const ResourceUuid = connect(
+    (state: RootState, props: { uuid: string }) => {
+        const resource = getResource<UserResource>(props.uuid)(state.resources);
+        return resource || { uuid: '' };
+    })(renderUuid);
+
+const renderEmail = (item: { email: string }) =>
+    <Typography noWrap>{item.email}</Typography>;
+
+export const ResourceEmail = connect(
+    (state: RootState, props: { uuid: string }) => {
+        const resource = getResource<UserResource>(props.uuid)(state.resources);
+        return resource || { email: '' };
+    })(renderEmail);
+
+const renderIsActive = (props: { uuid: string, isActive: boolean, toggleIsActive: (uuid: string) => void }) =>
+    <Checkbox
+        color="primary"
+        checked={props.isActive}
+        onClick={() => props.toggleIsActive(props.uuid)} />;
+
+export const ResourceIsActive = connect(
+    (state: RootState, props: { uuid: string }) => {
+        const resource = getResource<UserResource>(props.uuid)(state.resources);
+        return resource || { isActive: false };
+    }, { toggleIsActive }
+)(renderIsActive);
+
+const renderIsAdmin = (props: { uuid: string, isAdmin: boolean, toggleIsAdmin: (uuid: string) => void }) =>
+    <Checkbox
+        color="primary"
+        checked={props.isAdmin}
+        onClick={() => props.toggleIsAdmin(props.uuid)} />;
+
+export const ResourceIsAdmin = connect(
+    (state: RootState, props: { uuid: string }) => {
+        const resource = getResource<UserResource>(props.uuid)(state.resources);
+        return resource || { isAdmin: false };
+    }, { toggleIsAdmin }
+)(renderIsAdmin);
+
+const renderUsername = (item: { username: string }) =>
+    <Typography noWrap>{item.username}</Typography>;
+
+export const ResourceUsername = connect(
+    (state: RootState, props: { uuid: string }) => {
+        const resource = getResource<UserResource>(props.uuid)(state.resources);
+        return resource || { username: '' };
+    })(renderUsername);
+
+// Compute Node Resources
+const renderNodeDate = (date: string) =>
+    <Typography noWrap>{formatDate(date)}</Typography>;
+
+const renderNodeData = (data: string) => {
+    return <Typography noWrap>{data}</Typography>;
+};
+
+const renderNodeInfo = (data: string) => {
+    return <Typography>{JSON.stringify(data, null, 4)}</Typography>;
+};
+
+export const ComputeNodeInfo = withResourceData('info', renderNodeInfo);
+
+export const ComputeNodeUuid = withResourceData('uuid', renderNodeData);
+
+export const ComputeNodeDomain = withResourceData('domain', renderNodeData);
+
+export const ComputeNodeFirstPingAt = withResourceData('firstPingAt', renderNodeDate);
+
+export const ComputeNodeHostname = withResourceData('hostname', renderNodeData);
+
+export const ComputeNodeIpAddress = withResourceData('ipAddress', renderNodeData);
+
+export const ComputeNodeJobUuid = withResourceData('jobUuid', renderNodeData);
+
+export const ComputeNodeLastPingAt = withResourceData('lastPingAt', renderNodeDate);
+
+// Links Resources
+const renderLinkName = (item: { name: string }) =>
+    <Typography noWrap>{item.name || '(none)'}</Typography>;
+
+export const ResourceLinkName = connect(
+    (state: RootState, props: { uuid: string }) => {
+        const resource = getResource<LinkResource>(props.uuid)(state.resources);
+        return resource || { name: '' };
+    })(renderLinkName);
+
+const renderLinkClass = (item: { linkClass: string }) =>
+    <Typography noWrap>{item.linkClass}</Typography>;
+
+export const ResourceLinkClass = connect(
+    (state: RootState, props: { uuid: string }) => {
+        const resource = getResource<LinkResource>(props.uuid)(state.resources);
+        return resource || { linkClass: '' };
+    })(renderLinkClass);
+
+const renderLinkTail = (dispatch: Dispatch, item: { uuid: string, tailUuid: string, tailKind: string }) => {
+    const currentLabel = resourceLabel(item.tailKind);
+    const isUnknow = currentLabel === "Unknown";
+    return (<div>
+        { !isUnknow  ? (
+                renderLink(dispatch, item.tailUuid, currentLabel)
+            ) : (
+                <Typography noWrap color="default">
+                    {item.tailUuid}
+                </Typography>
+        )}
+    </div>);
+};
+
+const renderLink = (dispatch: Dispatch, uuid: string, label: string) =>
+    <Typography noWrap color="primary" style={{ 'cursor': 'pointer' }} onClick={() => dispatch<any>(navigateTo(uuid))}>
+        {label}: {uuid}
+    </Typography>;
+
+export const ResourceLinkTail = connect(
+    (state: RootState, props: { uuid: string }) => {
+        const resource = getResource<LinkResource>(props.uuid)(state.resources);
+        return {
+            item: resource || { uuid: '', tailUuid: '', tailKind: ResourceKind.NONE }
+        };
+    })((props: { item: any } & DispatchProp<any>) =>
+        renderLinkTail(props.dispatch, props.item));
+
+const renderLinkHead = (dispatch: Dispatch, item: { uuid: string, headUuid: string, headKind: ResourceKind }) =>
+    renderLink(dispatch, item.headUuid, resourceLabel(item.headKind));
+
+export const ResourceLinkHead = connect(
+    (state: RootState, props: { uuid: string }) => {
+        const resource = getResource<LinkResource>(props.uuid)(state.resources);
+        return {
+            item: resource || { uuid: '', headUuid: '', headKind: ResourceKind.NONE }
+        };
+    })((props: { item: any } & DispatchProp<any>) =>
+        renderLinkHead(props.dispatch, props.item));
+
+export const ResourceLinkUuid = connect(
+    (state: RootState, props: { uuid: string }) => {
+        const resource = getResource<LinkResource>(props.uuid)(state.resources);
+        return resource || { uuid: '' };
+    })(renderUuid);
+
+// Process Resources
+const resourceRunProcess = (dispatch: Dispatch, uuid: string) => {
     return (
         <div>
             {uuid &&
@@ -135,7 +307,7 @@ export const ResourceRunProcess = connect(
     })((props: { uuid: string } & DispatchProp<any>) =>
         resourceRunProcess(props.dispatch, props.uuid));
 
-export const renderWorkflowStatus = (uuidPrefix: string, ownerUuid?: string) => {
+const renderWorkflowStatus = (uuidPrefix: string, ownerUuid?: string) => {
     if (ownerUuid === getPublicUuid(uuidPrefix)) {
         return renderStatus(ResourceStatus.PUBLIC);
     } else {
@@ -185,7 +357,7 @@ export const ResourceFileSize = connect(
         return { fileSize: resource ? resource.fileSize : 0 };
     })((props: { fileSize?: number }) => renderFileSize(props.fileSize));
 
-export const renderOwner = (owner: string) =>
+const renderOwner = (owner: string) =>
     <Typography noWrap color="primary" >
         {owner}
     </Typography>;
@@ -196,7 +368,7 @@ export const ResourceOwner = connect(
         return { owner: resource ? resource.ownerUuid : '' };
     })((props: { owner: string }) => renderOwner(props.owner));
 
-export const renderType = (type: string) =>
+const renderType = (type: string) =>
     <Typography noWrap>
         {resourceLabel(type)}
     </Typography>;
diff --git a/src/views-components/data-explorer/with-resources.tsx b/src/views-components/data-explorer/with-resources.tsx
new file mode 100644 (file)
index 0000000..54c9396
--- /dev/null
@@ -0,0 +1,27 @@
+// 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 { RootState } from '~/store/store';
+import { getResource } from '~/store/resources/resources';
+import { Resource } from '~/models/resource';
+
+interface WithResourceProps {
+    resource?: Resource;
+}
+
+export const withResource = (component: React.ComponentType<WithResourceProps & { uuid: string }>) =>
+    connect<WithResourceProps>(
+        (state: RootState, props: { uuid: string }): WithResourceProps => ({
+            resource: getResource(props.uuid)(state.resources)
+        })
+    )(component);
+
+export const getDataFromResource = (property: string, resource?: Resource) => {
+    return resource && resource[property] ? resource[property] : '(none)';
+};
+
+export const withResourceData = (property: string, render: (data: any) => React.ReactElement<any>) =>
+    withResource(({ resource }) => render(getDataFromResource(property, resource)));
diff --git a/src/views-components/dialog-create/dialog-user-create.tsx b/src/views-components/dialog-create/dialog-user-create.tsx
new file mode 100644 (file)
index 0000000..14365af
--- /dev/null
@@ -0,0 +1,26 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from 'react';
+import { InjectedFormProps } from 'redux-form';
+import { WithDialogProps } from '~/store/dialog/with-dialog';
+import { FormDialog } from '~/components/form-dialog/form-dialog';
+import { UserEmailField, UserIdentityUrlField, UserVirtualMachineField, UserGroupsVirtualMachineField } from '~/views-components/form-fields/user-form-fields';
+
+export type DialogUserProps = WithDialogProps<{}> & InjectedFormProps<any>;
+
+export const UserRepositoryCreate = (props: DialogUserProps) =>
+    <FormDialog
+        dialogTitle='New user'
+        formFields={UserAddFields}
+        submitLabel='ADD NEW USER'
+        {...props}
+    />;
+
+const UserAddFields = (props: DialogUserProps) => <span>
+    <UserEmailField />
+    <UserIdentityUrlField />
+    <UserVirtualMachineField data={props.data}/>
+    <UserGroupsVirtualMachineField />
+</span>;
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} />;
diff --git a/src/views-components/dialog-forms/create-user-dialog.ts b/src/views-components/dialog-forms/create-user-dialog.ts
new file mode 100644 (file)
index 0000000..cb46204
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { compose } from "redux";
+import { reduxForm } from 'redux-form';
+import { withDialog } from "~/store/dialog/with-dialog";
+import { USER_CREATE_FORM_NAME, createUser, UserCreateFormDialogData } from "~/store/users/users-actions";
+import { UserRepositoryCreate } from "~/views-components/dialog-create/dialog-user-create";
+
+export const CreateUserDialog = compose(
+    withDialog(USER_CREATE_FORM_NAME),
+    reduxForm<UserCreateFormDialogData>({
+        form: USER_CREATE_FORM_NAME,
+        onSubmit: (data, dispatch) => {
+            dispatch(createUser(data));
+        }
+    })
+)(UserRepositoryCreate);
\ No newline at end of file
index d5bbce69e783b36873924e792bb4fac44b56952a..8880330c789bf65c3e06d9394ce92e3b181272a9 100644 (file)
@@ -7,7 +7,7 @@ import { InjectedFormProps } from 'redux-form';
 import { WithDialogProps } from '~/store/dialog/with-dialog';
 import { ProcessUpdateFormDialogData } from '~/store/processes/process-update-actions';
 import { FormDialog } from '~/components/form-dialog/form-dialog';
-import { ProcessNameField } from '~/views-components/form-fields/process-form-fields';
+import { ProcessNameField, ProcessDescriptionField } from '~/views-components/form-fields/process-form-fields';
 
 type DialogProcessProps = WithDialogProps<{}> & InjectedFormProps<ProcessUpdateFormDialogData>;
 
@@ -21,4 +21,5 @@ export const DialogProcessUpdate = (props: DialogProcessProps) =>
 
 const ProcessEditFields = () => <span>
     <ProcessNameField />
+    <ProcessDescriptionField />
 </span>;
index 2d2a7c80880b0fef31e428c46150fd504d506f95..c02996d81cb21b148708d0cac1a2a9a398a1ee65 100644 (file)
@@ -3,11 +3,11 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import * as React from "react";
-import { Field, WrappedFieldProps } from "redux-form";
+import { Field } from "redux-form";
 import { TextField } from "~/components/text-field/text-field";
 import { COLLECTION_NAME_VALIDATION, COLLECTION_DESCRIPTION_VALIDATION, COLLECTION_PROJECT_VALIDATION } from "~/validators/validators";
-import { ProjectTreePicker, ProjectTreePickerField } from "~/views-components/project-tree-picker/project-tree-picker";
-import { PickerIdProp } from '../../store/tree-picker/picker-id';
+import { ProjectTreePickerField } from "~/views-components/project-tree-picker/project-tree-picker";
+import { PickerIdProp } from '~/store/tree-picker/picker-id';
 
 export const CollectionNameField = () =>
     <Field
index cf471b67d1f16323abd551f69342782c11e068f0..bdae05315d5d8e5b3fac53a8acbda257de03a7d8 100644 (file)
@@ -3,9 +3,9 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import * as React from "react";
-import { Field, WrappedFieldProps } from "redux-form";
+import { Field } from "redux-form";
 import { TextField } from "~/components/text-field/text-field";
-import { PROCESS_NAME_VALIDATION } from "~/validators/validators";
+import { PROCESS_NAME_VALIDATION, PROCESS_DESCRIPTION_VALIDATION } from "~/validators/validators";
 
 export const ProcessNameField = () =>
     <Field
@@ -13,3 +13,10 @@ export const ProcessNameField = () =>
         component={TextField}
         validate={PROCESS_NAME_VALIDATION}
         label="Process Name" />;
+
+export const ProcessDescriptionField = () =>
+    <Field
+        name='description'
+        component={TextField}
+        validate={PROCESS_DESCRIPTION_VALIDATION}
+        label="Process Description" />;
diff --git a/src/views-components/form-fields/user-form-fields.tsx b/src/views-components/form-fields/user-form-fields.tsx
new file mode 100644 (file)
index 0000000..8563444
--- /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 { Field } from "redux-form";
+import { TextField } from "~/components/text-field/text-field";
+import { USER_EMAIL_VALIDATION, USER_LENGTH_VALIDATION } from "~/validators/validators";
+import { NativeSelectField } from "~/components/select-field/select-field";
+import { InputLabel } from "@material-ui/core";
+import { VirtualMachinesResource } from "~/models/virtual-machines";
+
+export const UserEmailField = () =>
+    <Field
+        name='email'
+        component={TextField}
+        validate={USER_EMAIL_VALIDATION}
+        autoFocus={true}
+        label="Email" />;
+
+export const UserIdentityUrlField = () =>
+    <Field
+        name='identityUrl'
+        component={TextField}
+        validate={USER_LENGTH_VALIDATION}
+        label="Identity URL Prefix" />;
+
+export const UserVirtualMachineField = ({ data }: any) =>
+    <div style={{ marginBottom: '21px' }}>
+        <InputLabel>Virtual Machine</InputLabel>
+        <Field
+            name='virtualMachine'
+            component={NativeSelectField}
+            validate={USER_LENGTH_VALIDATION}
+            items={getVirtualMachinesList(data.items)} />
+    </div>;
+
+export const UserGroupsVirtualMachineField = () =>
+    <Field
+        name='groups'
+        component={TextField}
+        validate={USER_LENGTH_VALIDATION}
+        label="Groups for virtual machine (comma separated list)" />;
+
+const getVirtualMachinesList = (virtualMachines: VirtualMachinesResource[]) => {
+    const mappedVirtualMachines = virtualMachines.map(it => ({ key: it.hostname, value: it.hostname }));
+    return mappedVirtualMachines;
+};
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
diff --git a/src/views-components/links-dialog/attributes-dialog.tsx b/src/views-components/links-dialog/attributes-dialog.tsx
new file mode 100644 (file)
index 0000000..8226c62
--- /dev/null
@@ -0,0 +1,73 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from "react";
+import { compose } from 'redux';
+import { withStyles, Dialog, DialogTitle, DialogContent, DialogActions, Button, StyleRulesCallback, WithStyles, Grid } from '@material-ui/core';
+import { WithDialogProps, withDialog } from "~/store/dialog/with-dialog";
+import { LINK_ATTRIBUTES_DIALOG } from '~/store/link-panel/link-panel-actions';
+import { ArvadosTheme } from '~/common/custom-theme';
+import { LinkResource } from '~/models/link';
+
+type CssRules = 'root';
+
+const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
+    root: {
+        fontSize: '0.875rem',
+        '& div:nth-child(odd)': {
+            textAlign: 'right',
+            color: theme.palette.grey["500"]
+        }
+    }
+});
+
+interface AttributesLinkDialogDataProps {
+    link: LinkResource;
+}
+
+export const AttributesLinkDialog = compose(
+    withDialog(LINK_ATTRIBUTES_DIALOG),
+    withStyles(styles))(
+    ({ open, closeDialog, data, classes }: WithDialogProps<AttributesLinkDialogDataProps> & WithStyles<CssRules>) =>
+            <Dialog open={open}
+                onClose={closeDialog}
+                fullWidth
+                maxWidth='sm'>
+                <DialogTitle>Attributes</DialogTitle>
+                <DialogContent>
+                    {data.link && <Grid container direction="row" spacing={16} className={classes.root}>
+                        <Grid item xs={5}>Uuid</Grid>
+                        <Grid item xs={7}>{data.link.uuid}</Grid>
+                        <Grid item xs={5}>Name</Grid>
+                        <Grid item xs={7}>{data.link.name}</Grid>
+                        <Grid item xs={5}>Head uuid</Grid>
+                        <Grid item xs={7}>{data.link.headUuid}</Grid>
+                        <Grid item xs={5}>Head kind</Grid>
+                        <Grid item xs={7}>{data.link.headKind}</Grid>
+                        <Grid item xs={5}>Tail uuid</Grid>
+                        <Grid item xs={7}>{data.link.tailUuid}</Grid>
+                        <Grid item xs={5}>Link class</Grid>
+                        <Grid item xs={7}>{data.link.linkClass}</Grid>
+                        <Grid item xs={5}>Owner uuid</Grid>
+                        <Grid item xs={7}>{data.link.ownerUuid}</Grid>
+                        <Grid item xs={5}>Created at</Grid>
+                        <Grid item xs={7}>{data.link.createdAt}</Grid>
+                        <Grid item xs={5}>Modified at</Grid>
+                        <Grid item xs={7}>{data.link.modifiedAt}</Grid>
+                        <Grid item xs={5}>Modified by user uuid</Grid>
+                        <Grid item xs={7}>{data.link.modifiedByUserUuid}</Grid>
+                        <Grid item xs={5}>Modified by client uuid</Grid>
+                        <Grid item xs={7}>{data.link.modifiedByClientUuid}</Grid>
+                    </Grid>}
+                </DialogContent>
+                <DialogActions>
+                    <Button
+                        variant='flat'
+                        color='primary'
+                        onClick={closeDialog}>
+                        Close
+                    </Button>
+                </DialogActions>
+            </Dialog>
+    );
\ No newline at end of file
diff --git a/src/views-components/links-dialog/remove-dialog.tsx b/src/views-components/links-dialog/remove-dialog.tsx
new file mode 100644 (file)
index 0000000..22660c6
--- /dev/null
@@ -0,0 +1,20 @@
+// 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 { LINK_REMOVE_DIALOG, removeLink } from '~/store/link-panel/link-panel-actions';
+
+const mapDispatchToProps = (dispatch: Dispatch, props: WithDialogProps<any>) => ({
+    onConfirm: () => {
+        props.closeDialog();
+        dispatch<any>(removeLink(props.data.uuid));
+    }
+});
+
+export const RemoveLinkDialog = compose(
+    withDialog(LINK_REMOVE_DIALOG),
+    connect(null, mapDispatchToProps)
+)(ConfirmationDialog);
\ No newline at end of file
index b71c92cb27e730b34eb19b364433d3b372c1683c..6c1e46c52a37ae819491cf043e6b8c4986ca98fe 100644 (file)
@@ -13,39 +13,39 @@ import { RootState } from "~/store/store";
 import { openCurrentTokenDialog } from '~/store/current-token-dialog/current-token-dialog-actions';
 import { openRepositoriesPanel } from "~/store/repositories/repositories-actions";
 import {
-    navigateToSshKeys,
-    navigateToKeepServices,
-    navigateToComputeNodes,
-    navigateToSiteManager
+    navigateToSiteManager,
+    navigateToSshKeysUser,
+    navigateToMyAccount
 } from '~/store/navigation/navigation-action';
-import { openVirtualMachines } from "~/store/virtual-machines/virtual-machines-actions";
+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>
-                <MenuItem onClick={() => dispatch(openVirtualMachines())}>Virtual Machines</MenuItem>
-                <MenuItem onClick={() => dispatch(openRepositoriesPanel())}>Repositories</MenuItem>
+                <MenuItem onClick={() => dispatch(openUserVirtualMachines())}>Virtual Machines</MenuItem>
+                {!user.isAdmin && <MenuItem onClick={() => dispatch(openRepositoriesPanel())}>Repositories</MenuItem>}
                 <MenuItem onClick={() => dispatch(openCurrentTokenDialog)}>Current token</MenuItem>
-                <MenuItem onClick={() => dispatch(navigateToSshKeys)}>Ssh Keys</MenuItem>
+                <MenuItem onClick={() => dispatch(navigateToSshKeysUser)}>Ssh Keys</MenuItem>
                 <MenuItem onClick={() => dispatch(navigateToSiteManager)}>Site Manager</MenuItem>
-                { user.isAdmin && <MenuItem onClick={() => dispatch(navigateToKeepServices)}>Keep Services</MenuItem> }
-                { user.isAdmin && <MenuItem onClick={() => dispatch(navigateToComputeNodes)}>Compute Nodes</MenuItem> }
-                <MenuItem>My account</MenuItem>
+                <MenuItem onClick={() => dispatch(navigateToMyAccount)}>My account</MenuItem>
                 <MenuItem onClick={() => dispatch(logout())}>Logout</MenuItem>
             </DropdownMenu>
             : null);
diff --git a/src/views-components/main-app-bar/admin-menu.tsx b/src/views-components/main-app-bar/admin-menu.tsx
new file mode 100644 (file)
index 0000000..9b94c06
--- /dev/null
@@ -0,0 +1,46 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from "react";
+import { MenuItem } from "@material-ui/core";
+import { User } from "~/models/user";
+import { DropdownMenu } from "~/components/dropdown-menu/dropdown-menu";
+import { AdminMenuIcon } from "~/components/icon/icon";
+import { DispatchProp, connect } from 'react-redux';
+import { logout } from '~/store/auth/auth-action';
+import { RootState } from "~/store/store";
+import { openRepositoriesPanel } from "~/store/repositories/repositories-actions";
+import * as NavigationAction from '~/store/navigation/navigation-action';
+import { openAdminVirtualMachines } from "~/store/virtual-machines/virtual-machines-actions";
+import { openUserPanel } from "~/store/users/users-actions";
+
+interface AdminMenuProps {
+    user?: User;
+    currentRoute: string;
+}
+
+const mapStateToProps = (state: RootState): AdminMenuProps => ({
+    user: state.auth.user,
+    currentRoute: state.router.location ? state.router.location.pathname : ''
+});
+
+export const AdminMenu = connect(mapStateToProps)(
+    ({ user, dispatch, currentRoute }: AdminMenuProps & DispatchProp<any>) =>
+        user
+            ? <DropdownMenu
+                icon={<AdminMenuIcon />}
+                id="admin-menu"
+                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>
+            </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 b936fb14d3fbc05412bc76178efbf466fa5dc496..8a7e9f2000f0af954275b3ac6717ff6479550ce1 100644 (file)
@@ -11,8 +11,9 @@ import { SearchBar } from "~/views-components/search-bar/search-bar";
 import { Routes } from '~/routes/routes';
 import { NotificationsMenu } from "~/views-components/main-app-bar/notifications-menu";
 import { AccountMenu } from "~/views-components/main-app-bar/account-menu";
-import { HelpMenu } from './help-menu';
+import { HelpMenu } from '~/views-components/main-app-bar/help-menu';
 import { ReactNode } from "react";
+import { AdminMenu } from "~/views-components/main-app-bar/admin-menu";
 
 type CssRules = 'toolbar' | 'link';
 
@@ -65,6 +66,7 @@ export const MainAppBar = withStyles(styles)(
                             ? <>
                                 <NotificationsMenu />
                                 <AccountMenu />
+                                {props.user.isAdmin && <AdminMenu />}
                                 <HelpMenu />
                             </>
                             : <HelpMenu />}
index 8b8f9891264fba26f2039e20c1e3addce80cf009..c0014d005134bc52a706dc4c770baf00ae4907dc 100644 (file)
@@ -18,10 +18,13 @@ interface MainContentBarProps {
 
 const isButtonVisible = ({ router }: RootState) => {
     const pathname = router.location ? router.location.pathname : '';
-    return !Routes.matchWorkflowRoute(pathname) && !Routes.matchVirtualMachineRoute(pathname) &&
-        !Routes.matchRepositoriesRoute(pathname) && !Routes.matchSshKeysRoute(pathname) &&
+    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.matchSiteManagerRoute(pathname);
+        !Routes.matchApiClientAuthorizationsRoute(pathname) && !Routes.matchUsersRoute(pathname) &&
+        !Routes.matchMyAccountRoute(pathname) && !Routes.matchLinksRoute(pathname);
 };
 
 export const MainContentBar = connect((state: RootState) => ({
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>
+    ));
diff --git a/src/views-components/user-dialog/attributes-dialog.tsx b/src/views-components/user-dialog/attributes-dialog.tsx
new file mode 100644 (file)
index 0000000..66a4881
--- /dev/null
@@ -0,0 +1,97 @@
+// 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 { USER_ATTRIBUTES_DIALOG } from "~/store/users/users-actions";
+import { UserResource } from "~/models/user";
+
+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 UserAttributesDataProps {
+    data: UserResource;
+}
+
+type UserAttributesProps = UserAttributesDataProps & WithStyles<CssRules>;
+
+export const UserAttributesDialog = compose(
+    withDialog(USER_ATTRIBUTES_DIALOG),
+    styles)(
+        (props: WithDialogProps<UserAttributesProps> & UserAttributesProps) =>
+            <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 = (user: UserResource, classes: any) => {
+    const { uuid, ownerUuid, createdAt, modifiedAt, modifiedByClientUuid, modifiedByUserUuid, firstName, lastName, href, identityUrl, username } = user;
+    return (
+        <span>
+            <Grid container direction="row">
+                <Grid item xs={5} className={classes.rightContainer}>
+                    {firstName && <Grid item>First name</Grid>}
+                    {lastName && <Grid item>Last 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>}
+                    {href && <Grid item>Href</Grid>}
+                    {identityUrl && <Grid item>Identity url</Grid>}
+                    {username && <Grid item>Username</Grid>}
+                </Grid>
+                <Grid item xs={7} className={classes.leftContainer}>
+                    <Grid item>{firstName}</Grid>
+                    <Grid item>{lastName}</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>{href}</Grid>
+                    <Grid item>{identityUrl}</Grid>
+                    <Grid item>{username}</Grid>
+                </Grid>
+            </Grid>
+        </span>
+    );
+};
diff --git a/src/views/api-client-authorization-panel/api-client-authorization-panel-root.tsx b/src/views/api-client-authorization-panel/api-client-authorization-panel-root.tsx
new file mode 100644 (file)
index 0000000..52921b3
--- /dev/null
@@ -0,0 +1,104 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from 'react';
+import { 
+    StyleRulesCallback, WithStyles, withStyles, Card, CardContent, Grid, 
+    Table, TableHead, TableRow, TableCell, TableBody, Tooltip, IconButton
+} from '@material-ui/core';
+import { ArvadosTheme } from '~/common/custom-theme';
+import { MoreOptionsIcon, HelpIcon } from '~/components/icon/icon';
+import { ApiClientAuthorization } from '~/models/api-client-authorization';
+import { formatDate } from '~/common/formatters';
+
+type CssRules = 'root' | 'tableRow' | 'helpIconGrid' | 'tableGrid';
+
+const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
+    root: {
+        width: '100%',
+        overflow: 'auto'
+    },
+    helpIconGrid: {
+        textAlign: 'right'
+    },
+    tableGrid: {
+        marginTop: theme.spacing.unit
+    },
+    tableRow: {
+        '& td, th': {
+            whiteSpace: 'nowrap'
+        }
+    }
+});
+
+export interface ApiClientAuthorizationPanelRootActionProps {
+    openRowOptions: (event: React.MouseEvent<HTMLElement>, keepService: ApiClientAuthorization) => void;
+    openHelpDialog: () => void;
+}
+
+export interface ApiClientAuthorizationPanelRootDataProps {
+    apiClientAuthorizations: ApiClientAuthorization[];
+    hasApiClientAuthorizations: boolean;
+}
+
+type ApiClientAuthorizationPanelRootProps = ApiClientAuthorizationPanelRootActionProps 
+    & ApiClientAuthorizationPanelRootDataProps & WithStyles<CssRules>;
+
+export const ApiClientAuthorizationPanelRoot = withStyles(styles)(
+    ({ classes, hasApiClientAuthorizations, apiClientAuthorizations, openRowOptions, openHelpDialog }: ApiClientAuthorizationPanelRootProps) =>
+        <Card className={classes.root}>
+            <CardContent>
+                {hasApiClientAuthorizations && <Grid container direction="row" justify="flex-end">
+                    <Grid item xs={12} className={classes.helpIconGrid}>
+                        <Tooltip title="Api token - help">
+                            <IconButton onClick={openHelpDialog}>
+                                <HelpIcon />
+                            </IconButton>
+                        </Tooltip>
+                    </Grid>
+                    <Grid item xs={12}>
+                        <Table>
+                            <TableHead>
+                                <TableRow className={classes.tableRow}>
+                                    <TableCell>UUID</TableCell>
+                                    <TableCell>API Client ID</TableCell>
+                                    <TableCell>API Token</TableCell>
+                                    <TableCell>Created by IP address</TableCell>
+                                    <TableCell>Default owner</TableCell>
+                                    <TableCell>Expires at</TableCell>
+                                    <TableCell>Last used at</TableCell>
+                                    <TableCell>Last used by IP address</TableCell>
+                                    <TableCell>Scopes</TableCell>
+                                    <TableCell>User ID</TableCell>
+                                    <TableCell />
+                                </TableRow>
+                            </TableHead>
+                            <TableBody>
+                                {apiClientAuthorizations.map((apiClientAuthorizatio, index) =>
+                                    <TableRow key={index} className={classes.tableRow}>
+                                        <TableCell>{apiClientAuthorizatio.uuid}</TableCell>
+                                        <TableCell>{apiClientAuthorizatio.apiClientId}</TableCell>
+                                        <TableCell>{apiClientAuthorizatio.apiToken}</TableCell>
+                                        <TableCell>{apiClientAuthorizatio.createdByIpAddress || '(none)'}</TableCell>
+                                        <TableCell>{apiClientAuthorizatio.defaultOwnerUuid || '(none)'}</TableCell>
+                                        <TableCell>{formatDate(apiClientAuthorizatio.expiresAt) || '(none)'}</TableCell>
+                                        <TableCell>{formatDate(apiClientAuthorizatio.lastUsedAt) || '(none)'}</TableCell>
+                                        <TableCell>{apiClientAuthorizatio.lastUsedByIpAddress || '(none)'}</TableCell>
+                                        <TableCell>{JSON.stringify(apiClientAuthorizatio.scopes)}</TableCell>
+                                        <TableCell>{apiClientAuthorizatio.userId}</TableCell>
+                                        <TableCell>
+                                            <Tooltip title="More options" disableFocusListener>
+                                                <IconButton onClick={event => openRowOptions(event, apiClientAuthorizatio)}>
+                                                    <MoreOptionsIcon />
+                                                </IconButton>
+                                            </Tooltip>
+                                        </TableCell>
+                                    </TableRow>)}
+                            </TableBody>
+                        </Table>
+                    </Grid>
+                </Grid>}
+            </CardContent>
+        </Card>
+);
\ No newline at end of file
diff --git a/src/views/api-client-authorization-panel/api-client-authorization-panel.tsx b/src/views/api-client-authorization-panel/api-client-authorization-panel.tsx
new file mode 100644 (file)
index 0000000..75b79ab
--- /dev/null
@@ -0,0 +1,32 @@
+// 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 {
+    ApiClientAuthorizationPanelRoot,
+    ApiClientAuthorizationPanelRootDataProps,
+    ApiClientAuthorizationPanelRootActionProps
+} from '~/views/api-client-authorization-panel/api-client-authorization-panel-root';
+import { openApiClientAuthorizationContextMenu } from '~/store/context-menu/context-menu-actions';
+import { openApiClientAuthorizationsHelpDialog } from '~/store/api-client-authorizations/api-client-authorizations-actions';
+
+const mapStateToProps = (state: RootState): ApiClientAuthorizationPanelRootDataProps => {
+    return {
+        apiClientAuthorizations: state.apiClientAuthorizations,
+        hasApiClientAuthorizations: state.apiClientAuthorizations.length > 0
+    };
+};
+
+const mapDispatchToProps = (dispatch: Dispatch): ApiClientAuthorizationPanelRootActionProps => ({
+    openRowOptions: (event, apiClientAuthorization) => {
+        dispatch<any>(openApiClientAuthorizationContextMenu(event, apiClientAuthorization));
+    },
+    openHelpDialog: () => {
+        dispatch<any>(openApiClientAuthorizationsHelpDialog());
+    }
+});
+
+export const ApiClientAuthorizationPanel = connect(mapStateToProps, mapDispatchToProps)(ApiClientAuthorizationPanelRoot);
\ No newline at end of file
index 26ee18875424f152dc6bb458a44917915c0fafef..41a685f3283667a3fc5d39b60ccf18e6bc7a2c40 100644 (file)
@@ -17,7 +17,7 @@ import { CollectionResource } from '~/models/collection';
 import { CollectionPanelFiles } from '~/views-components/collection-panel-files/collection-panel-files';
 import * as CopyToClipboard from 'react-copy-to-clipboard';
 import { CollectionTagForm } from './collection-tag-form';
-import { deleteCollectionTag } from '~/store/collection-panel/collection-panel-action';
+import { deleteCollectionTag, navigateToProcess } from '~/store/collection-panel/collection-panel-action';
 import { snackbarActions } from '~/store/snackbar/snackbar-actions';
 import { getResource } from '~/store/resources/resources';
 import { openContextMenu } from '~/store/context-menu/context-menu-actions';
@@ -26,7 +26,7 @@ import { formatFileSize } from "~/common/formatters";
 import { getResourceData } from "~/store/resources-data/resources-data";
 import { ResourceData } from "~/store/resources-data/resources-data-reducer";
 
-type CssRules = 'card' | 'iconHeader' | 'tag' | 'copyIcon' | 'label' | 'value';
+type CssRules = 'card' | 'iconHeader' | 'tag' | 'copyIcon' | 'label' | 'value' | 'link';
 
 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     card: {
@@ -52,6 +52,13 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     value: {
         textTransform: 'none',
         fontSize: '0.875rem'
+    },
+    link: {
+        fontSize: '0.875rem',
+        color: theme.palette.primary.main,
+        '&:hover': {
+            cursor: 'pointer'
+        }
     }
 });
 
@@ -63,7 +70,6 @@ interface CollectionPanelDataProps {
 type CollectionPanelProps = CollectionPanelDataProps & DispatchProp
     & WithStyles<CssRules> & RouteComponentProps<{ id: string }>;
 
-
 export const CollectionPanel = withStyles(styles)(
     connect((state: RootState, props: RouteComponentProps<{ id: string }>) => {
         const item = getResource(props.match.params.id)(state.resources);
@@ -72,7 +78,7 @@ export const CollectionPanel = withStyles(styles)(
     })(
         class extends React.Component<CollectionPanelProps> {
             render() {
-                const { classes, item, data } = this.props;
+                const { classes, item, data, dispatch } = this.props;
                 return item
                     ? <>
                         <Card className={classes.card}>
@@ -107,6 +113,9 @@ export const CollectionPanel = withStyles(styles)(
                                             label='Content size' value={data && formatFileSize(data.fileSize)} />
                                         <DetailsAttribute classLabel={classes.label} classValue={classes.value}
                                             label='Owner' value={item && item.ownerUuid} />
+                                        <span onClick={() => dispatch<any>(navigateToProcess(item.properties.container_request  || item.properties.containerRequest))}>
+                                            <DetailsAttribute classLabel={classes.link} label='Link to process' />
+                                        </span>
                                     </Grid>
                                 </Grid>
                             </CardContent>
index be3627b8782748354f00baea1708c6d81b78450c..feaadb5e5b86a92232354759506c185c3a334cca 100644 (file)
 // SPDX-License-Identifier: AGPL-3.0
 
 import * as React from 'react';
+import { ShareMeIcon } from '~/components/icon/icon';
+import { DataExplorer } from '~/views-components/data-explorer/data-explorer';
+import { DataTableDefaultView } from '~/components/data-table-default-view/data-table-default-view';
+import { COMPUTE_NODE_PANEL_ID } from '~/store/compute-nodes/compute-nodes-actions';
+import { DataColumns } from '~/components/data-table/data-table';
+import { SortDirection } from '~/components/data-table/data-column';
+import { createTree } from '~/models/tree';
 import { 
-    StyleRulesCallback, WithStyles, withStyles, Card, CardContent, Grid, Table, 
-    TableHead, TableRow, TableCell, TableBody, Tooltip, IconButton 
-} from '@material-ui/core';
-import { ArvadosTheme } from '~/common/custom-theme';
-import { MoreOptionsIcon } from '~/components/icon/icon';
-import { NodeResource } from '~/models/node';
-import { formatDate } from '~/common/formatters';
+    ComputeNodeUuid, ComputeNodeInfo, ComputeNodeDomain, ComputeNodeHostname, ComputeNodeJobUuid,
+    ComputeNodeFirstPingAt, ComputeNodeLastPingAt, ComputeNodeIpAddress
+} from '~/views-components/data-explorer/renderers';
+import { ResourcesState } from '~/store/resources/resources';
 
-type CssRules = 'root' | 'tableRow';
+export enum ComputeNodePanelColumnNames {
+    INFO = 'Info',
+    UUID = 'UUID',
+    DOMAIN = 'Domain',
+    FIRST_PING_AT = 'First ping at',
+    HOSTNAME = 'Hostname',
+    IP_ADDRESS = 'IP Address',
+    JOB = 'Job',
+    LAST_PING_AT = 'Last ping at'
+}
 
-const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
-    root: {
-        width: '100%',
-        overflow: 'auto'
+export const computeNodePanelColumns: DataColumns<string> = [
+    {
+        name: ComputeNodePanelColumnNames.INFO,
+        selected: true,
+        configurable: true,
+        filters: createTree(),
+        render: uuid => <ComputeNodeInfo uuid={uuid} />
+    },
+    {
+        name: ComputeNodePanelColumnNames.UUID,
+        selected: true,
+        configurable: true,
+        sortDirection: SortDirection.NONE,
+        filters: createTree(),
+        render: uuid => <ComputeNodeUuid uuid={uuid} />
+    },
+    {
+        name: ComputeNodePanelColumnNames.DOMAIN,
+        selected: true,
+        configurable: true,
+        filters: createTree(),
+        render: uuid => <ComputeNodeDomain uuid={uuid} />
+    },
+    {
+        name: ComputeNodePanelColumnNames.FIRST_PING_AT,
+        selected: true,
+        configurable: true,
+        filters: createTree(),
+        render: uuid => <ComputeNodeFirstPingAt uuid={uuid} />
     },
-    tableRow: {
-        '& td, th': {
-            whiteSpace: 'nowrap'
-        }
+    {
+        name: ComputeNodePanelColumnNames.HOSTNAME,
+        selected: true,
+        configurable: true,
+        filters: createTree(),
+        render: uuid => <ComputeNodeHostname uuid={uuid} />
+    },
+    {
+        name: ComputeNodePanelColumnNames.IP_ADDRESS,
+        selected: true,
+        configurable: true,
+        filters: createTree(),
+        render: uuid => <ComputeNodeIpAddress uuid={uuid} />
+    },
+    {
+        name: ComputeNodePanelColumnNames.JOB,
+        selected: true,
+        configurable: true,
+        filters: createTree(),
+        render: uuid => <ComputeNodeJobUuid uuid={uuid} />
+    },
+    {
+        name: ComputeNodePanelColumnNames.LAST_PING_AT,
+        selected: true,
+        configurable: true,
+        filters: createTree(),
+        render: uuid => <ComputeNodeLastPingAt uuid={uuid} />
     }
-});
+];
+
+const DEFAULT_MESSAGE = 'Your compute node list is empty.';
 
 export interface ComputeNodePanelRootActionProps {
-    openRowOptions: (event: React.MouseEvent<HTMLElement>, computeNode: NodeResource) => void;
+    onItemClick: (item: string) => void;
+    onContextMenu: (event: React.MouseEvent<HTMLElement>, item: string) => void;
+    onItemDoubleClick: (item: string) => void;
 }
 
 export interface ComputeNodePanelRootDataProps {
-    computeNodes: NodeResource[];
-    hasComputeNodes: boolean;
+    resources: ResourcesState;
 }
 
-type ComputeNodePanelRootProps = ComputeNodePanelRootActionProps & ComputeNodePanelRootDataProps & WithStyles<CssRules>;
+type ComputeNodePanelRootProps = ComputeNodePanelRootActionProps & ComputeNodePanelRootDataProps;
 
-export const ComputeNodePanelRoot = withStyles(styles)(
-    ({ classes, hasComputeNodes, computeNodes, openRowOptions }: ComputeNodePanelRootProps) =>
-        <Card className={classes.root}>
-            <CardContent>
-                {hasComputeNodes && <Grid container direction="row">
-                    <Grid item xs={12}>
-                        <Table>
-                            <TableHead>
-                                <TableRow className={classes.tableRow}>
-                                    <TableCell>Info</TableCell>
-                                    <TableCell>UUID</TableCell>
-                                    <TableCell>Domain</TableCell>
-                                    <TableCell>First ping at</TableCell>
-                                    <TableCell>Hostname</TableCell>
-                                    <TableCell>IP Address</TableCell>
-                                    <TableCell>Job</TableCell>
-                                    <TableCell>Last ping at</TableCell>
-                                    <TableCell />
-                                </TableRow>
-                            </TableHead>
-                            <TableBody>
-                                {computeNodes.map((computeNode, index) =>
-                                    <TableRow key={index} className={classes.tableRow}>
-                                        <TableCell>{computeNode.uuid}</TableCell>
-                                        <TableCell>{computeNode.uuid}</TableCell>
-                                        <TableCell>{computeNode.domain}</TableCell>
-                                        <TableCell>{formatDate(computeNode.firstPingAt) || '(none)'}</TableCell>
-                                        <TableCell>{computeNode.hostname || '(none)'}</TableCell>
-                                        <TableCell>{computeNode.ipAddress || '(none)'}</TableCell>
-                                        <TableCell>{computeNode.jobUuid || '(none)'}</TableCell>
-                                        <TableCell>{formatDate(computeNode.lastPingAt) || '(none)'}</TableCell>
-                                        <TableCell>
-                                            <Tooltip title="More options" disableFocusListener>
-                                                <IconButton onClick={event => openRowOptions(event, computeNode)}>
-                                                    <MoreOptionsIcon />
-                                                </IconButton>
-                                            </Tooltip>
-                                        </TableCell>
-                                    </TableRow>)}
-                            </TableBody>
-                        </Table>
-                    </Grid>
-                </Grid>}
-            </CardContent>
-        </Card>
-);
\ No newline at end of file
+export const ComputeNodePanelRoot = (props: ComputeNodePanelRootProps) => {
+    return <DataExplorer
+        id={COMPUTE_NODE_PANEL_ID}
+        onRowClick={props.onItemClick}
+        onRowDoubleClick={props.onItemDoubleClick}
+        onContextMenu={props.onContextMenu}
+        contextMenuColumn={true}
+        hideColumnSelector
+        hideSearchInput
+        dataTableDefaultView={
+            <DataTableDefaultView
+                icon={ShareMeIcon}
+                messages={[DEFAULT_MESSAGE]} />
+        } />;
+};
\ No newline at end of file
index a4f22c808959cae960d606910411f1d540c7a11f..a531b2d0cb66320b35b1b20200dea4a33e2bdb56 100644 (file)
@@ -5,7 +5,6 @@
 import { RootState } from '~/store/store';
 import { Dispatch } from 'redux';
 import { connect } from 'react-redux';
-import { } from '~/store/compute-nodes/compute-nodes-actions';
 import {
     ComputeNodePanelRoot,
     ComputeNodePanelRootDataProps,
@@ -15,15 +14,16 @@ import { openComputeNodeContextMenu } from '~/store/context-menu/context-menu-ac
 
 const mapStateToProps = (state: RootState): ComputeNodePanelRootDataProps => {
     return {
-        computeNodes: state.computeNodes,
-        hasComputeNodes: state.computeNodes.length > 0
+        resources: state.resources
     };
 };
 
 const mapDispatchToProps = (dispatch: Dispatch): ComputeNodePanelRootActionProps => ({
-    openRowOptions: (event, computeNode) => {
-        dispatch<any>(openComputeNodeContextMenu(event, computeNode));
-    }
+    onContextMenu: (event, resourceUuid) => {
+        dispatch<any>(openComputeNodeContextMenu(event, resourceUuid));
+    },
+    onItemClick: (resourceUuid: string) => { return; },
+    onItemDoubleClick: uuid => { return; }
 });
 
 export const ComputeNodePanel = connect(mapStateToProps, mapDispatchToProps)(ComputeNodePanelRoot);
\ No newline at end of file
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/link-panel/link-panel-root.tsx b/src/views/link-panel/link-panel-root.tsx
new file mode 100644 (file)
index 0000000..a4c8e01
--- /dev/null
@@ -0,0 +1,92 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from 'react';
+import { LINK_PANEL_ID } from '~/store/link-panel/link-panel-actions';
+import { DataExplorer } from '~/views-components/data-explorer/data-explorer';
+import { SortDirection } from '~/components/data-table/data-column';
+import { DataColumns } from '~/components/data-table/data-table';
+import { DataTableDefaultView } from '~/components/data-table-default-view/data-table-default-view';
+import { ResourcesState } from '~/store/resources/resources';
+import { ShareMeIcon } from '~/components/icon/icon';
+import { createTree } from '~/models/tree';
+import { 
+    ResourceLinkUuid, ResourceLinkHead, ResourceLinkTail, 
+    ResourceLinkClass, ResourceLinkName } 
+from '~/views-components/data-explorer/renderers';
+
+export enum LinkPanelColumnNames {
+    NAME = "Name",
+    LINK_CLASS = "Link Class",
+    TAIL = "Tail",
+    HEAD = 'Head',
+    UUID = "UUID"
+}
+
+export const linkPanelColumns: DataColumns<string> = [
+    {
+        name: LinkPanelColumnNames.NAME,
+        selected: true,
+        configurable: true,
+        sortDirection: SortDirection.NONE,
+        filters: createTree(),
+        render: uuid => <ResourceLinkName uuid={uuid} />
+    },
+    {
+        name: LinkPanelColumnNames.LINK_CLASS,
+        selected: true,
+        configurable: true,
+        filters: createTree(),
+        render: uuid => <ResourceLinkClass uuid={uuid} />
+    },
+    {
+        name: LinkPanelColumnNames.TAIL,
+        selected: true,
+        configurable: true,
+        filters: createTree(),
+        render: uuid => <ResourceLinkTail uuid={uuid} />
+    },
+    {
+        name: LinkPanelColumnNames.HEAD,
+        selected: true,
+        configurable: true,
+        filters: createTree(),
+        render: uuid => <ResourceLinkHead uuid={uuid} />
+    },
+    {
+        name: LinkPanelColumnNames.UUID,
+        selected: true,
+        configurable: true,
+        filters: createTree(),
+        render: uuid => <ResourceLinkUuid uuid={uuid} />
+    }
+];
+
+export interface LinkPanelRootDataProps {
+    resources: ResourcesState;
+}
+
+export interface LinkPanelRootActionProps {
+    onItemClick: (item: string) => void;
+    onContextMenu: (event: React.MouseEvent<HTMLElement>, item: string) => void;
+    onItemDoubleClick: (item: string) => void;
+}
+
+export type LinkPanelRootProps = LinkPanelRootDataProps & LinkPanelRootActionProps;
+
+export const LinkPanelRoot = (props: LinkPanelRootProps) => {
+    return <DataExplorer
+        id={LINK_PANEL_ID}
+        onRowClick={props.onItemClick}
+        onRowDoubleClick={props.onItemDoubleClick}
+        onContextMenu={props.onContextMenu}
+        contextMenuColumn={true} 
+        hideColumnSelector
+        hideSearchInput
+        dataTableDefaultView={
+            <DataTableDefaultView
+                icon={ShareMeIcon}
+                messages={['Your link list is empty.']} />
+        }/>;
+};
\ No newline at end of file
diff --git a/src/views/link-panel/link-panel.tsx b/src/views/link-panel/link-panel.tsx
new file mode 100644 (file)
index 0000000..4bff4ee
--- /dev/null
@@ -0,0 +1,35 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { Dispatch } from "redux";
+import { connect } from "react-redux";
+import { RootState } from '~/store/store';
+import { openContextMenu, resourceKindToContextMenuKind } from '~/store/context-menu/context-menu-actions';
+import { LinkPanelRoot, LinkPanelRootActionProps, LinkPanelRootDataProps } from '~/views/link-panel/link-panel-root';
+import { ResourceKind } from '~/models/resource';
+
+const mapStateToProps = (state: RootState): LinkPanelRootDataProps => {
+    return {
+        resources: state.resources
+    };
+};
+
+const mapDispatchToProps = (dispatch: Dispatch): LinkPanelRootActionProps => ({
+    onContextMenu: (event, resourceUuid) => {
+        const kind = resourceKindToContextMenuKind(resourceUuid);
+        if (kind) {
+            dispatch<any>(openContextMenu(event, {
+                name: '',
+                uuid: resourceUuid,
+                ownerUuid: '',
+                kind: ResourceKind.LINK,
+                menuKind: kind
+            }));
+        }
+    },
+    onItemClick: (resourceUuid: string) => { return; },
+    onItemDoubleClick: uuid => { return; }
+});
+
+export const LinkPanel = connect(mapStateToProps, mapDispatchToProps)(LinkPanelRoot);
\ No newline at end of file
diff --git a/src/views/my-account-panel/my-account-panel-root.tsx b/src/views/my-account-panel/my-account-panel-root.tsx
new file mode 100644 (file)
index 0000000..e6a2763
--- /dev/null
@@ -0,0 +1,161 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from 'react';
+import { Field, InjectedFormProps } from "redux-form";
+import { TextField } from "~/components/text-field/text-field";
+import { NativeSelectField } from "~/components/select-field/select-field";
+import {
+    StyleRulesCallback,
+    WithStyles,
+    withStyles,
+    Card,
+    CardContent,
+    Button,
+    Typography,
+    Grid,
+    InputLabel
+} from '@material-ui/core';
+import { ArvadosTheme } from '~/common/custom-theme';
+import { User } from "~/models/user";
+import { MY_ACCOUNT_VALIDATION} from "~/validators/validators";
+
+type CssRules = 'root' | 'gridItem' | 'label' | 'title' | 'actions';
+
+const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
+    root: {
+        width: '100%',
+        overflow: 'auto'
+    },
+    gridItem: {
+        height: 45,
+        marginBottom: 20
+    },
+    label: {
+        fontSize: '0.675rem'
+    },
+    title: {
+        marginBottom: theme.spacing.unit * 3,
+        color: theme.palette.grey["600"]
+    },
+    actions: {
+        display: 'flex',
+        justifyContent: 'flex-end'
+    }
+});
+
+export interface MyAccountPanelRootActionProps {}
+
+export interface MyAccountPanelRootDataProps {
+    isPristine: boolean;
+    isValid: boolean;
+    initialValues?: User;
+}
+
+const RoleTypes = [
+    {key: 'Bio-informatician', value: 'Bio-informatician'},
+    {key: 'Data Scientist', value: 'Data Scientist'},
+    {key: 'Analyst', value: 'Analyst'},
+    {key: 'Researcher', value: 'Researcher'},
+    {key: 'Software Developer', value: 'Software Developer'},
+    {key: 'System Administrator', value: 'System Administrator'},
+    {key: 'Other', value: 'Other'}
+];
+
+type MyAccountPanelRootProps = InjectedFormProps<MyAccountPanelRootActionProps> & MyAccountPanelRootDataProps & WithStyles<CssRules>;
+
+export const MyAccountPanelRoot = withStyles(styles)(
+    ({ classes, isValid, handleSubmit, reset, isPristine, invalid, submitting }: MyAccountPanelRootProps) => {
+        return <Card className={classes.root}>
+            <CardContent>
+                <Typography variant="title" className={classes.title}>User profile</Typography>
+                <form onSubmit={handleSubmit}>
+                    <Grid container direction="row" spacing={24}>
+                        <Grid item xs={6}>
+                            <Grid item className={classes.gridItem}>
+                                <Field
+                                    label="E-mail"
+                                    name="email"
+                                    component={TextField}
+                                    disabled
+                                />
+                            </Grid>
+                            <Grid item className={classes.gridItem}>
+                                <Field
+                                    label="First name"
+                                    name="firstName"
+                                    component={TextField}
+                                    disabled
+                                />
+                            </Grid>
+                            <Grid item className={classes.gridItem}>
+                                <Field
+                                    label="Identity URL"
+                                    name="identityUrl"
+                                    component={TextField}
+                                    disabled
+                                />
+                            </Grid>
+                            <Grid item className={classes.gridItem}>
+                                <Field
+                                    label="Organization"
+                                    name="prefs.profile.organization"
+                                    component={TextField}
+                                    validate={MY_ACCOUNT_VALIDATION}
+                                    required
+                                />
+                            </Grid>
+                            <Grid item className={classes.gridItem}>
+                                <Field
+                                    label="Website"
+                                    name="prefs.profile.website_url"
+                                    component={TextField}
+                                />
+                            </Grid>
+                            <Grid item className={classes.gridItem}>
+                                <InputLabel className={classes.label} htmlFor="prefs.profile.role">Organization</InputLabel>
+                                <Field
+                                    id="prefs.profile.role"
+                                    name="prefs.profile.role"
+                                    component={NativeSelectField}
+                                    items={RoleTypes}
+                                />
+                            </Grid>
+                        </Grid>
+                        <Grid item xs={6}>
+                            <Grid item className={classes.gridItem} />
+                            <Grid item className={classes.gridItem}>
+                                <Field
+                                    label="Last name"
+                                    name="lastName"
+                                    component={TextField}
+                                    disabled
+                                />
+                            </Grid>
+                            <Grid item className={classes.gridItem} />
+                            <Grid item className={classes.gridItem}>
+                                <Field
+                                    label="E-mail at Organization"
+                                    name="prefs.profile.organization_email"
+                                    component={TextField}
+                                    validate={MY_ACCOUNT_VALIDATION}
+                                    required
+                                />
+                            </Grid>
+                        </Grid>
+                        <Grid item xs={12} className={classes.actions}>
+                            <Button color="primary" onClick={reset} disabled={isPristine}>Discard changes</Button>
+                            <Button
+                                color="primary"
+                                variant="contained"
+                                type="submit"
+                                disabled={isPristine || invalid || submitting}>
+                                    Save changes
+                            </Button>
+                        </Grid>
+                    </Grid>
+                </form>
+            </CardContent>
+        </Card>;}
+);
\ No newline at end of file
diff --git a/src/views/my-account-panel/my-account-panel.tsx b/src/views/my-account-panel/my-account-panel.tsx
new file mode 100644 (file)
index 0000000..5c2c531
--- /dev/null
@@ -0,0 +1,26 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { RootState } from '~/store/store';
+import { compose } from 'redux';
+import { reduxForm, isPristine, isValid } from 'redux-form';
+import { connect } from 'react-redux';
+import { saveEditedUser } from '~/store/my-account/my-account-panel-actions';
+import { MyAccountPanelRoot, MyAccountPanelRootDataProps } from '~/views/my-account-panel/my-account-panel-root';
+import { MY_ACCOUNT_FORM } from "~/store/my-account/my-account-panel-actions";
+
+const mapStateToProps = (state: RootState): MyAccountPanelRootDataProps => ({
+    isPristine: isPristine(MY_ACCOUNT_FORM)(state),
+    isValid: isValid(MY_ACCOUNT_FORM)(state),
+    initialValues: state.auth.user
+});
+
+export const MyAccountPanel = compose(
+    connect(mapStateToProps),
+    reduxForm({
+    form: MY_ACCOUNT_FORM,
+    onSubmit: (data, dispatch) => {
+        dispatch(saveEditedUser(data));
+    }
+}))(MyAccountPanelRoot);
\ No newline at end of file
index e5d15e729d6d32b26f07e934d7a2fbb854c87b5d..7f3e025f8dc7e97a7f1b7616a09d9013949260b1 100644 (file)
@@ -11,7 +11,7 @@ import { ArvadosTheme } from '~/common/custom-theme';
 import { MoreOptionsIcon, ProcessIcon } from '~/components/icon/icon';
 import { DetailsAttribute } from '~/components/details-attribute/details-attribute';
 import { Process } from '~/store/processes/process';
-import { getProcessStatus, getProcessStatusColor } from '../../store/processes/process';
+import { getProcessStatus, getProcessStatusColor } from '~/store/processes/process';
 import { formatDate } from '~/common/formatters';
 
 
@@ -69,12 +69,13 @@ export interface ProcessInformationCardDataProps {
     process: Process;
     onContextMenu: (event: React.MouseEvent<HTMLElement>) => void;
     openProcessInputDialog: (uuid: string) => void;
+    navigateToOutput: (uuid: string) => void;
 }
 
 type ProcessInformationCardProps = ProcessInformationCardDataProps & WithStyles<CssRules, true>;
 
 export const ProcessInformationCard = withStyles(styles, { withTheme: true })(
-    ({ classes, process, onContextMenu, theme, openProcessInputDialog }: ProcessInformationCardProps) =>
+    ({ classes, process, onContextMenu, theme, openProcessInputDialog, navigateToOutput }: ProcessInformationCardProps) =>
         <Card className={classes.card}>
             <CardHeader
                 classes={{
@@ -120,7 +121,9 @@ export const ProcessInformationCard = withStyles(styles, { withTheme: true })(
                             label='Workflow' value='???' />
                     </Grid>
                     <Grid item xs={6}>
-                        <DetailsAttribute classLabel={classes.link} label='Outputs' />
+                        <span onClick={() => navigateToOutput(process.containerRequest.outputUuid!)}>
+                            <DetailsAttribute classLabel={classes.link} label='Outputs' />
+                        </span>
                         <span onClick={() => openProcessInputDialog(process.containerRequest.uuid)}>
                             <DetailsAttribute classLabel={classes.link} label='Inputs' />
                         </span>
index 52c0f4515145120caf1d6f95038323d4f5fdb307..73f71e5e0a139b0fbbe007213b0f1d6705070868 100644 (file)
@@ -23,6 +23,7 @@ export interface ProcessPanelRootActionProps {
     onContextMenu: (event: React.MouseEvent<HTMLElement>, process: Process) => void;
     onToggle: (status: string) => void;
     openProcessInputDialog: (uuid: string) => void;
+    navigateToOutput: (uuid: string) => void;
 }
 
 export type ProcessPanelRootProps = ProcessPanelRootDataProps & ProcessPanelRootActionProps;
@@ -34,7 +35,8 @@ export const ProcessPanelRoot = ({ process, ...props }: ProcessPanelRootProps) =
                 <ProcessInformationCard
                     process={process}
                     onContextMenu={event => props.onContextMenu(event, process)}
-                    openProcessInputDialog={props.openProcessInputDialog} />
+                    openProcessInputDialog={props.openProcessInputDialog}
+                    navigateToOutput={props.navigateToOutput} />
             </Grid>
             <Grid item sm={12} md={5}>
                 <SubprocessesCard
index 8108cd1ef4d0b19a51fc7c530e6880e61b529334..5672469677a3d29c5150a39f955ae71078d8c022 100644 (file)
@@ -11,7 +11,7 @@ import { matchProcessRoute } from '~/routes/routes';
 import { ProcessPanelRootDataProps, ProcessPanelRootActionProps, ProcessPanelRoot } from './process-panel-root';
 import { ProcessPanel as ProcessPanelState} from '~/store/process-panel/process-panel';
 import { groupBy } from 'lodash';
-import { toggleProcessPanelFilter } from '~/store/process-panel/process-panel-actions';
+import { toggleProcessPanelFilter, navigateToOutput } from '~/store/process-panel/process-panel-actions';
 import { openProcessInputDialog } from '~/store/processes/process-input-actions';
 
 const mapStateToProps = ({ router, resources, processPanel }: RootState): ProcessPanelRootDataProps => {
@@ -34,7 +34,8 @@ const mapDispatchToProps = (dispatch: Dispatch): ProcessPanelRootActionProps =>
     onToggle: status => {
         dispatch<any>(toggleProcessPanelFilter(status));
     },
-    openProcessInputDialog: (uuid) => dispatch<any>(openProcessInputDialog(uuid))
+    openProcessInputDialog: (uuid) => dispatch<any>(openProcessInputDialog(uuid)),
+    navigateToOutput: (uuid) => dispatch<any>(navigateToOutput(uuid))
 });
 
 export const ProcessPanel = connect(mapStateToProps, mapDispatchToProps)(ProcessPanelRoot);
index c7016f6298848355be16a206b7c4ce66ac9a029e..62e91b5f1de5e4923abecd46b4494eff377f85ca 100644 (file)
@@ -103,7 +103,7 @@ export const RepositoriesPanel = compose(
                                 <Grid item xs={8}>
                                     <Typography variant="body2">
                                         When you are using an Arvados virtual machine, you should clone the https:// URLs. This will authenticate automatically using your API token. <br />
-                                        In order to clone git repositories using SSH, <Link to={Routes.SSH_KEYS} className={classes.link}>add an SSH key to your account</Link> and clone the git@ URLs.
+                                        In order to clone git repositories using SSH, <Link to={Routes.SSH_KEYS_USER} className={classes.link}>add an SSH key to your account</Link> and clone the git@ URLs.
                                     </Typography>
                                 </Grid>
                                 <Grid item xs={4} className={classes.button}>
index fe93ef85bc098027d7d94dc7dc129d66510e8821..18f5561db37853a228893e829ccf4082aaf873ef 100644 (file)
@@ -3,11 +3,11 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import * as React from 'react';
-import { StyleRulesCallback, withStyles, Grid, Button, WithStyles, List, ListItem, ListItemText, ListItemIcon, Tabs, Tab } from '@material-ui/core';
+import { StyleRulesCallback, withStyles, Grid, Button, WithStyles, List, ListItem, ListItemText, ListItemIcon } from '@material-ui/core';
 import { ArvadosTheme } from '~/common/custom-theme';
 import { WorkflowResource } from '~/models/workflow';
 import { WorkflowIcon } from '~/components/icon/icon';
-import { WorkflowDetailsCard } from '../workflow-panel/workflow-description-card';
+import { WorkflowDetailsCard } from '~/views/workflow-panel/workflow-description-card';
 import { SearchInput } from '~/components/search-input/search-input';
 
 type CssRules = 'root' | 'searchGrid' | 'workflowDetailsGrid' | 'list' | 'listItem' | 'itemSelected' | 'listItemText' | 'listItemIcon';
index 0b8563822e4906be2dc62147cee5a0f7139f1bcf..a7e4a87f172661f1359b3e0aa6b5f751aafca102 100644 (file)
@@ -6,24 +6,39 @@ import * as React from 'react';
 import { Grid, Button } from '@material-ui/core';
 import { RunProcessBasicForm, RUN_PROCESS_BASIC_FORM } from './run-process-basic-form';
 import { RunProcessInputsForm } from '~/views/run-process-panel/run-process-inputs-form';
-import { CommandInputParameter } from '~/models/workflow';
+import { CommandInputParameter, WorkflowResource } from '~/models/workflow';
 import { connect } from 'react-redux';
 import { RootState } from '~/store/store';
 import { isValid } from 'redux-form';
 import { RUN_PROCESS_INPUTS_FORM } from './run-process-inputs-form';
 import { RunProcessAdvancedForm } from './run-process-advanced-form';
 import { createSelector, createStructuredSelector } from 'reselect';
+import { WorkflowPresetSelect } from '~/views/run-process-panel/workflow-preset-select';
+import { selectPreset } from '~/store/run-process-panel/run-process-panel-actions';
 
 export interface RunProcessSecondStepFormDataProps {
     inputs: CommandInputParameter[];
+    workflow?: WorkflowResource;
+    presets?: WorkflowResource[];
+    selectedPreset?: WorkflowResource;
     valid: boolean;
 }
 
 export interface RunProcessSecondStepFormActionProps {
     goBack: () => void;
     runProcess: () => void;
+    onPresetChange: (preset: WorkflowResource) => void;
 }
 
+const selectedWorkflowSelector = (state: RootState) =>
+    state.runProcessPanel.selectedWorkflow;
+
+const presetsSelector = (state: RootState) =>
+    state.runProcessPanel.presets;
+
+const selectedPresetSelector = (state: RootState) =>
+    state.runProcessPanel.selectedPreset;
+
 const inputsSelector = (state: RootState) =>
     state.runProcessPanel.inputs;
 
@@ -33,13 +48,24 @@ const validSelector = (state: RootState) =>
 const mapStateToProps = createStructuredSelector({
     inputs: inputsSelector,
     valid: validSelector,
+    workflow: selectedWorkflowSelector,
+    presets: presetsSelector,
+    selectedPreset: selectedPresetSelector,
 });
 
 export type RunProcessSecondStepFormProps = RunProcessSecondStepFormDataProps & RunProcessSecondStepFormActionProps;
-export const RunProcessSecondStepForm = connect(mapStateToProps)(
-    ({ inputs, valid, goBack, runProcess }: RunProcessSecondStepFormProps) =>
+export const RunProcessSecondStepForm = connect(mapStateToProps, { onPresetChange: selectPreset })(
+    ({ inputs, workflow, selectedPreset, presets, onPresetChange, valid, goBack, runProcess }: RunProcessSecondStepFormProps) =>
         <Grid container spacing={16}>
             <Grid item xs={12}>
+                <Grid container spacing={32}>
+                    <Grid item xs={12} md={6}>
+                        {workflow && selectedPreset && presets &&
+                            < WorkflowPresetSelect
+                                {...{ workflow, selectedPreset, presets, onChange: onPresetChange }} />
+                        }
+                    </Grid>
+                </Grid>
                 <RunProcessBasicForm />
                 <RunProcessInputsForm inputs={inputs} />
                 <RunProcessAdvancedForm />
diff --git a/src/views/run-process-panel/workflow-preset-select.tsx b/src/views/run-process-panel/workflow-preset-select.tsx
new file mode 100644 (file)
index 0000000..2e30356
--- /dev/null
@@ -0,0 +1,68 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from 'react';
+import { Select, FormControl, InputLabel, MenuItem, Tooltip, withStyles, WithStyles } from '@material-ui/core';
+import { WorkflowResource } from '~/models/workflow';
+import { DetailsIcon } from '~/components/icon/icon';
+
+export interface WorkflowPresetSelectProps {
+    workflow: WorkflowResource;
+    selectedPreset: WorkflowResource;
+    presets: WorkflowResource[];
+    onChange: (preset: WorkflowResource) => void;
+}
+
+type CssRules = 'root' | 'icon';
+
+export const WorkflowPresetSelect = withStyles<CssRules>(theme => ({
+    root: {
+        display: 'flex',
+    },
+    icon: {
+        color: theme.palette.text.hint,
+        marginTop: 18,
+        marginLeft: 8,
+    },
+}))(
+    class extends React.Component<WorkflowPresetSelectProps & WithStyles<CssRules>> {
+
+        render() {
+
+            const { selectedPreset, workflow, presets, classes } = this.props;
+
+            return (
+                <div className={classes.root}>
+                    <FormControl fullWidth>
+                        <InputLabel>Preset</InputLabel>
+                        <Select
+                            value={selectedPreset.uuid}
+                            onChange={this.handleChange}>
+                            <MenuItem value={workflow.uuid}>
+                                <em>Default</em>
+                            </MenuItem>
+                            {presets.map(
+                                ({ uuid, name }) => <MenuItem key={uuid} value={uuid}>{name}</MenuItem>
+                            )}
+                        </Select>
+                    </FormControl>
+                    <Tooltip title='List of already defined set of inputs to run a workflow'>
+                        <DetailsIcon className={classes.icon} />
+                    </Tooltip>
+                </div >
+            );
+        }
+
+        handleChange = ({ target }: React.ChangeEvent<HTMLSelectElement>) => {
+
+            const { workflow, presets, onChange } = this.props;
+
+            const selectedPreset = [workflow, ...presets]
+                .find(({ uuid }) => uuid === target.value);
+
+            if (selectedPreset) {
+                onChange(selectedPreset);
+            }
+        }
+    });
index ea658ee72573c1e6554a6053b4e75ae96c474295..7bfc2bfef6caa70aa952f654a8d15423dd234d8a 100644 (file)
@@ -8,7 +8,6 @@ import { DataColumns } from '~/components/data-table/data-table';
 import { DataTableFilterItem } from '~/components/data-table-filters/data-table-filters';
 import { ResourceKind } from '~/models/resource';
 import { ContainerRequestState } from '~/models/container-request';
-import { resourceLabel } from '~/common/labels';
 import { SearchBarAdvanceFormData } from '~/models/search-bar';
 import { SEARCH_RESULTS_PANEL_ID } from '~/store/search-results-panel/search-results-panel-actions';
 import { DataExplorer } from '~/views-components/data-explorer/data-explorer';
@@ -21,8 +20,8 @@ import {
     ResourceType
 } from '~/views-components/data-explorer/renderers';
 import { createTree } from '~/models/tree';
-import { getInitialResourceTypeFilters } from '../../store/resource-type-filters/resource-type-filters';
-// TODO: code clean up
+import { getInitialResourceTypeFilters } from '~/store/resource-type-filters/resource-type-filters';
+
 export enum SearchResultsPanelColumnNames {
     NAME = "Name",
     PROJECT = "Project",
index ae12425e1516a1dde5e05b31624a2537b97c5704..bcc661144fe64f0f0aee9faf0499a7d2c3ff06b4 100644 (file)
@@ -11,7 +11,6 @@ import { RootState } from '~/store/store';
 import { DataTableFilterItem } from '~/components/data-table-filters/data-table-filters';
 import { SortDirection } from '~/components/data-table/data-column';
 import { ResourceKind, TrashableResource } from '~/models/resource';
-import { resourceLabel } from '~/common/labels';
 import { ArvadosTheme } from '~/common/custom-theme';
 import { RestoreFromTrashIcon, TrashIcon } from '~/components/icon/icon';
 import { TRASH_PANEL_ID } from "~/store/trash-panel/trash-panel-action";
@@ -31,11 +30,10 @@ import { loadDetailsPanel } from "~/store/details-panel/details-panel-action";
 import { toggleTrashed } from "~/store/trash/trash-actions";
 import { ContextMenuKind } from "~/views-components/context-menu/context-menu";
 import { Dispatch } from "redux";
-import { PanelDefaultView } from '~/components/panel-default-view/panel-default-view';
 import { DataTableDefaultView } from '~/components/data-table-default-view/data-table-default-view';
 import { createTree } from '~/models/tree';
-import { getInitialResourceTypeFilters } from '../../store/resource-type-filters/resource-type-filters';
-// TODO: code clean up
+import { getInitialResourceTypeFilters } from '~/store/resource-type-filters/resource-type-filters';
+
 type CssRules = "toolbar" | "button";
 
 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
diff --git a/src/views/user-panel/user-panel.tsx b/src/views/user-panel/user-panel.tsx
new file mode 100644 (file)
index 0000000..b152896
--- /dev/null
@@ -0,0 +1,217 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from 'react';
+import { WithStyles, withStyles, Typography, Tabs, Tab, Paper, Button, Grid } from '@material-ui/core';
+import { DataExplorer } from "~/views-components/data-explorer/data-explorer";
+import { connect, DispatchProp } from 'react-redux';
+import { DataColumns } from '~/components/data-table/data-table';
+import { RootState } from '~/store/store';
+import { SortDirection } from '~/components/data-table/data-column';
+import { openContextMenu } from "~/store/context-menu/context-menu-actions";
+import { getResource, ResourcesState } from "~/store/resources/resources";
+import {
+    ResourceFirstName,
+    ResourceLastName,
+    ResourceUuid,
+    ResourceEmail,
+    ResourceIsActive,
+    ResourceIsAdmin,
+    ResourceUsername
+} from "~/views-components/data-explorer/renderers";
+import { navigateTo } from "~/store/navigation/navigation-action";
+import { ContextMenuKind } from "~/views-components/context-menu/context-menu";
+import { DataTableDefaultView } from '~/components/data-table-default-view/data-table-default-view';
+import { createTree } from '~/models/tree';
+import { compose, Dispatch } from 'redux';
+import { UserResource } from '~/models/user';
+import { ShareMeIcon, AddIcon } from '~/components/icon/icon';
+import { USERS_PANEL_ID, openUserCreateDialog } from '~/store/users/users-actions';
+
+type UserPanelRules = "button";
+
+const styles = withStyles<UserPanelRules>(theme => ({
+    button: {
+        marginTop: theme.spacing.unit,
+        marginRight: theme.spacing.unit * 2,
+        textAlign: 'right',
+        alignSelf: 'center'
+    },
+}));
+
+export enum UserPanelColumnNames {
+    FIRST_NAME = "First Name",
+    LAST_NAME = "Last Name",
+    UUID = "Uuid",
+    EMAIL = "Email",
+    ACTIVE = "Active",
+    ADMIN = "Admin",
+    REDIRECT_TO_USER = "Redirect to user",
+    USERNAME = "Username"
+}
+
+export const userPanelColumns: DataColumns<string> = [
+    {
+        name: UserPanelColumnNames.FIRST_NAME,
+        selected: true,
+        configurable: true,
+        sortDirection: SortDirection.NONE,
+        filters: createTree(),
+        render: uuid => <ResourceFirstName uuid={uuid} />
+    },
+    {
+        name: UserPanelColumnNames.LAST_NAME,
+        selected: true,
+        configurable: true,
+        sortDirection: SortDirection.NONE,
+        filters: createTree(),
+        render: uuid => <ResourceLastName uuid={uuid} />
+    },
+    {
+        name: UserPanelColumnNames.UUID,
+        selected: true,
+        configurable: true,
+        sortDirection: SortDirection.NONE,
+        filters: createTree(),
+        render: uuid => <ResourceUuid uuid={uuid} />
+    },
+    {
+        name: UserPanelColumnNames.EMAIL,
+        selected: true,
+        configurable: true,
+        sortDirection: SortDirection.NONE,
+        filters: createTree(),
+        render: uuid => <ResourceEmail uuid={uuid} />
+    },
+    {
+        name: UserPanelColumnNames.ACTIVE,
+        selected: true,
+        configurable: true,
+        sortDirection: SortDirection.NONE,
+        filters: createTree(),
+        render: uuid => <ResourceIsActive uuid={uuid} />
+    },
+    {
+        name: UserPanelColumnNames.ADMIN,
+        selected: true,
+        configurable: false,
+        sortDirection: SortDirection.NONE,
+        filters: createTree(),
+        render: uuid => <ResourceIsAdmin uuid={uuid} />
+    },
+    {
+        name: UserPanelColumnNames.REDIRECT_TO_USER,
+        selected: true,
+        configurable: false,
+        sortDirection: SortDirection.NONE,
+        filters: createTree(),
+        render: () => <Typography noWrap>(none)</Typography>
+    },
+    {
+        name: UserPanelColumnNames.USERNAME,
+        selected: true,
+        configurable: false,
+        sortDirection: SortDirection.NONE,
+        filters: createTree(),
+        render: uuid => <ResourceUsername uuid={uuid} />
+    }
+];
+
+interface UserPanelDataProps {
+    resources: ResourcesState;
+}
+
+interface UserPanelActionProps {
+    openUserCreateDialog: () => void;
+    handleRowDoubleClick: (uuid: string) => void;
+    onContextMenu: (event: React.MouseEvent<HTMLElement>, item: any) => void;
+}
+
+const mapStateToProps = (state: RootState) => {
+    return {
+        resources: state.resources
+    };
+};
+
+const mapDispatchToProps = (dispatch: Dispatch) => ({
+    openUserCreateDialog: () => dispatch<any>(openUserCreateDialog()),
+    handleRowDoubleClick: (uuid: string) => dispatch<any>(navigateTo(uuid)),
+    onContextMenu: (event: React.MouseEvent<HTMLElement>, item: any) => dispatch<any>(openContextMenu(event, item))
+});
+
+type UserPanelProps = UserPanelDataProps & UserPanelActionProps & DispatchProp & WithStyles<UserPanelRules>;
+
+export const UserPanel = compose(
+    styles,
+    connect(mapStateToProps, mapDispatchToProps))(
+        class extends React.Component<UserPanelProps> {
+            state = {
+                value: 0,
+            };
+
+            componentDidMount() {
+                this.setState({ value: 0 });
+            }
+
+            render() {
+                const { value } = this.state;
+                return <Paper>
+                    <Tabs value={value} onChange={this.handleChange} fullWidth>
+                        <Tab label="USERS" />
+                        <Tab label="ACTIVITY" disabled />
+                    </Tabs>
+                    {value === 0 &&
+                        <span>
+                            <DataExplorer
+                                id={USERS_PANEL_ID}
+                                onRowClick={this.handleRowClick}
+                                onRowDoubleClick={this.handleRowDoubleClick}
+                                onContextMenu={this.handleContextMenu}
+                                contextMenuColumn={true}
+                                hideColumnSelector
+                                actions={
+                                    <Grid container justify='flex-end'>
+                                        <Button variant="contained" color="primary" onClick={this.props.openUserCreateDialog}>
+                                            <AddIcon /> NEW USER
+                                        </Button>
+                                    </Grid>
+                                }
+                                paperProps={{
+                                    elevation: 0,
+                                }}
+                                dataTableDefaultView={
+                                    <DataTableDefaultView
+                                        icon={ShareMeIcon}
+                                        messages={['Your user list is empty.']} />
+                                } />
+                        </span>}
+                </Paper>;
+            }
+
+            handleChange = (event: React.MouseEvent<HTMLElement>, value: number) => {
+                this.setState({ value });
+            }
+
+            handleContextMenu = (event: React.MouseEvent<HTMLElement>, resourceUuid: string) => {
+                const resource = getResource<UserResource>(resourceUuid)(this.props.resources);
+                if (resource) {
+                    this.props.onContextMenu(event, {
+                        name: '',
+                        uuid: resource.uuid,
+                        ownerUuid: resource.ownerUuid,
+                        kind: resource.kind,
+                        menuKind: ContextMenuKind.USER
+                    });
+                }
+            }
+
+            handleRowDoubleClick = (uuid: string) => {
+                this.props.handleRowDoubleClick(uuid);
+            }
+
+            handleRowClick = () => {
+                return;
+            }
+        }
+    );
diff --git a/src/views/virtual-machine-panel/virtual-machine-admin-panel.tsx b/src/views/virtual-machine-panel/virtual-machine-admin-panel.tsx
new file mode 100644 (file)
index 0000000..dda2889
--- /dev/null
@@ -0,0 +1,112 @@
+// 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, Card, CardContent, TableBody, TableCell, TableHead, TableRow, Table, Tooltip, IconButton } from '@material-ui/core';
+import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles';
+import { ArvadosTheme } from '~/common/custom-theme';
+import { compose, Dispatch } from 'redux';
+import { loadVirtualMachinesAdminData } from '~/store/virtual-machines/virtual-machines-actions';
+import { RootState } from '~/store/store';
+import { ListResults } from '~/services/common-service/common-service';
+import { MoreOptionsIcon } from '~/components/icon/icon';
+import { VirtualMachineLogins, VirtualMachinesResource } from '~/models/virtual-machines';
+import { openVirtualMachinesContextMenu } from '~/store/context-menu/context-menu-actions';
+
+type CssRules = 'moreOptionsButton' | 'moreOptions';
+
+const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
+    moreOptionsButton: {
+        padding: 0
+    },
+    moreOptions: {
+        textAlign: 'right',
+        '&:last-child': {
+            paddingRight: 0
+        }
+    },
+});
+
+const mapStateToProps = ({ virtualMachines }: RootState) => {
+    return {
+        logins: virtualMachines.logins,
+        ...virtualMachines
+    };
+};
+
+const mapDispatchToProps = (dispatch: Dispatch): Pick<VirtualMachinesPanelActionProps, 'loadVirtualMachinesData' | 'onOptionsMenuOpen'> => ({
+    loadVirtualMachinesData: () => dispatch<any>(loadVirtualMachinesAdminData()),
+    onOptionsMenuOpen: (event, virtualMachine) => {
+        dispatch<any>(openVirtualMachinesContextMenu(event, virtualMachine));
+    },
+});
+
+interface VirtualMachinesPanelDataProps {
+    virtualMachines: ListResults<any>;
+    logins: VirtualMachineLogins;
+}
+
+interface VirtualMachinesPanelActionProps {
+    loadVirtualMachinesData: () => string;
+    onOptionsMenuOpen: (event: React.MouseEvent<HTMLElement>, virtualMachine: VirtualMachinesResource) => void;
+}
+
+type VirtualMachineProps = VirtualMachinesPanelActionProps & VirtualMachinesPanelDataProps & WithStyles<CssRules>;
+
+export const VirtualMachineAdminPanel = compose(
+    withStyles(styles),
+    connect(mapStateToProps, mapDispatchToProps))(
+        class extends React.Component<VirtualMachineProps> {
+            componentDidMount() {
+                this.props.loadVirtualMachinesData();
+            }
+
+            render() {
+                const { virtualMachines } = this.props;
+                return (
+                    <Grid container spacing={16}>
+                        {virtualMachines.itemsAvailable > 0 && <CardContentWithVirtualMachines {...this.props} />}
+                    </Grid>
+                );
+            }
+        }
+    );
+
+const CardContentWithVirtualMachines = (props: VirtualMachineProps) =>
+    <Grid item xs={12}>
+        <Card>
+            <CardContent>
+                {virtualMachinesTable(props)}
+            </CardContent>
+        </Card>
+    </Grid>;
+
+const virtualMachinesTable = (props: VirtualMachineProps) =>
+    <Table>
+        <TableHead>
+            <TableRow>
+                <TableCell>Uuid</TableCell>
+                <TableCell>Host name</TableCell>
+                <TableCell>Logins</TableCell>
+                <TableCell />
+            </TableRow>
+        </TableHead>
+        <TableBody>
+            {props.logins.items.length > 0 && props.virtualMachines.items.map((it, index) =>
+                <TableRow key={index}>
+                    <TableCell>{it.uuid}</TableCell>
+                    <TableCell>{it.hostname}</TableCell>
+                    <TableCell>["{props.logins.items[0].username}"]</TableCell>
+                    <TableCell className={props.classes.moreOptions}>
+                        <Tooltip title="More options" disableFocusListener>
+                            <IconButton onClick={event => props.onOptionsMenuOpen(event, it)} className={props.classes.moreOptionsButton}>
+                                <MoreOptionsIcon />
+                            </IconButton>
+                        </Tooltip>
+                    </TableCell>
+                </TableRow>
+            )}
+        </TableBody>
+    </Table>;
similarity index 53%
rename from src/views/virtual-machine-panel/virtual-machine-panel.tsx
rename to src/views/virtual-machine-panel/virtual-machine-user-panel.tsx
index 5dbd3f0965aa6336d2893fd7faf48ecba75e43e7..fbb1f23f51cb33069167cb763ea76833eed6e4bf 100644 (file)
@@ -4,21 +4,19 @@
 
 import * as React from 'react';
 import { connect } from 'react-redux';
-import { Grid, Typography, Button, Card, CardContent, TableBody, TableCell, TableHead, TableRow, Table, Tooltip, IconButton } from '@material-ui/core';
+import { Grid, Typography, Button, Card, CardContent, TableBody, TableCell, TableHead, TableRow, Table, Tooltip } from '@material-ui/core';
 import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles';
 import { ArvadosTheme } from '~/common/custom-theme';
 import { DefaultCodeSnippet } from '~/components/default-code-snippet/default-code-snippet';
 import { Link } from 'react-router-dom';
 import { compose, Dispatch } from 'redux';
-import { saveRequestedDate, loadVirtualMachinesData } from '~/store/virtual-machines/virtual-machines-actions';
+import { saveRequestedDate, loadVirtualMachinesUserData } from '~/store/virtual-machines/virtual-machines-actions';
 import { RootState } from '~/store/store';
-import { ListResults } from '~/services/common-service/common-resource-service';
-import { HelpIcon, MoreOptionsIcon } from '~/components/icon/icon';
-import { VirtualMachineLogins, VirtualMachinesResource } from '~/models/virtual-machines';
+import { ListResults } from '~/services/common-service/common-service';
+import { HelpIcon } from '~/components/icon/icon';
 import { Routes } from '~/routes/routes';
-import { openVirtualMachinesContextMenu } from '~/store/context-menu/context-menu-actions';
 
-type CssRules = 'button' | 'codeSnippet' | 'link' | 'linkIcon' | 'rightAlign' | 'cardWithoutMachines' | 'icon' | 'moreOptionsButton' | 'moreOptions';
+type CssRules = 'button' | 'codeSnippet' | 'link' | 'linkIcon' | 'rightAlign' | 'cardWithoutMachines' | 'icon';
 
 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     button: {
@@ -56,52 +54,35 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     icon: {
         textAlign: "right",
         marginTop: theme.spacing.unit
-    },
-    moreOptionsButton: {
-        padding: 0
-    },
-    moreOptions: {
-        textAlign: 'right',
-        '&:last-child': {
-            paddingRight: 0
-        }
-    },
+    }
 });
 
-const mapStateToProps = ({ virtualMachines, auth }: RootState) => {
+const mapStateToProps = ({ virtualMachines }: RootState) => {
     return {
         requestedDate: virtualMachines.date,
-        isAdmin: auth.user!.isAdmin,
-        logins: virtualMachines.logins,
         ...virtualMachines
     };
 };
 
-const mapDispatchToProps = (dispatch: Dispatch): Pick<VirtualMachinesPanelActionProps, 'loadVirtualMachinesData' | 'saveRequestedDate' | 'onOptionsMenuOpen'> => ({
+const mapDispatchToProps = (dispatch: Dispatch): Pick<VirtualMachinesPanelActionProps, 'loadVirtualMachinesData' | 'saveRequestedDate'> => ({
     saveRequestedDate: () => dispatch<any>(saveRequestedDate()),
-    loadVirtualMachinesData: () => dispatch<any>(loadVirtualMachinesData()),
-    onOptionsMenuOpen: (event, virtualMachine) => {
-        dispatch<any>(openVirtualMachinesContextMenu(event, virtualMachine));
-    },
+    loadVirtualMachinesData: () => dispatch<any>(loadVirtualMachinesUserData()),
 });
 
 interface VirtualMachinesPanelDataProps {
     requestedDate: string;
     virtualMachines: ListResults<any>;
-    logins: VirtualMachineLogins;
     links: ListResults<any>;
-    isAdmin: boolean;
 }
 
 interface VirtualMachinesPanelActionProps {
     saveRequestedDate: () => void;
     loadVirtualMachinesData: () => string;
-    onOptionsMenuOpen: (event: React.MouseEvent<HTMLElement>, virtualMachine: VirtualMachinesResource) => void;
 }
 
 type VirtualMachineProps = VirtualMachinesPanelActionProps & VirtualMachinesPanelDataProps & WithStyles<CssRules>;
 
-export const VirtualMachinePanel = compose(
+export const VirtualMachineUserPanel = compose(
     withStyles(styles),
     connect(mapStateToProps, mapDispatchToProps))(
         class extends React.Component<VirtualMachineProps> {
@@ -110,19 +91,19 @@ export const VirtualMachinePanel = compose(
             }
 
             render() {
-                const { virtualMachines, links, isAdmin } = this.props;
+                const { virtualMachines, links } = this.props;
                 return (
                     <Grid container spacing={16}>
-                        {!isAdmin && virtualMachines.itemsAvailable > 0 && <CardContentWithNoVirtualMachines {...this.props} />}
+                        {virtualMachines.itemsAvailable === 0 && <CardContentWithoutVirtualMachines {...this.props} />}
                         {virtualMachines.itemsAvailable > 0 && links.itemsAvailable > 0 && <CardContentWithVirtualMachines {...this.props} />}
-                        {!isAdmin && <CardSSHSection {...this.props} />}
+                        {<CardSSHSection {...this.props} />}
                     </Grid>
                 );
             }
         }
     );
 
-const CardContentWithNoVirtualMachines = (props: VirtualMachineProps) =>
+const CardContentWithoutVirtualMachines = (props: VirtualMachineProps) =>
     <Grid item xs={12}>
         <Card>
             <CardContent className={props.classes.cardWithoutMachines}>
@@ -132,13 +113,7 @@ const CardContentWithNoVirtualMachines = (props: VirtualMachineProps) =>
                     </Typography>
                 </Grid>
                 <Grid item xs={6} className={props.classes.rightAlign}>
-                    <Button variant="contained" color="primary" className={props.classes.button} onClick={props.saveRequestedDate}>
-                        SEND REQUEST FOR SHELL ACCESS
-                    </Button>
-                    {props.requestedDate &&
-                        <Typography variant="body1">
-                            A request for shell access was sent on {props.requestedDate}
-                        </Typography>}
+                    {virtualMachineSendRequest(props)}
                 </Grid>
             </CardContent>
         </Card>
@@ -148,32 +123,36 @@ const CardContentWithVirtualMachines = (props: VirtualMachineProps) =>
     <Grid item xs={12}>
         <Card>
             <CardContent>
-                {props.isAdmin ? <span>{adminVirtualMachinesTable(props)}</span>
-                    : <span>
-                        <div className={props.classes.rightAlign}>
-                            <Button variant="contained" color="primary" className={props.classes.button} onClick={props.saveRequestedDate}>
-                                SEND REQUEST FOR SHELL ACCESS
-                                </Button>
-                            {props.requestedDate &&
-                                <Typography variant="body1">
-                                    A request for shell access was sent on {props.requestedDate}
-                                </Typography>}
-                        </div>
-                        <div className={props.classes.icon}>
-                            <a href="https://doc.arvados.org/user/getting_started/vm-login-with-webshell.html" target="_blank" className={props.classes.linkIcon}>
-                                <Tooltip title="Access VM using webshell">
-                                    <HelpIcon />
-                                </Tooltip>
-                            </a>
-                        </div>
-                        {userVirtualMachinesTable(props)}
-                    </span>
-                }
+                <span>
+                    <div className={props.classes.rightAlign}>
+                        {virtualMachineSendRequest(props)}
+                    </div>
+                    <div className={props.classes.icon}>
+                        <a href="https://doc.arvados.org/user/getting_started/vm-login-with-webshell.html" target="_blank" className={props.classes.linkIcon}>
+                            <Tooltip title="Access VM using webshell">
+                                <HelpIcon />
+                            </Tooltip>
+                        </a>
+                    </div>
+                    {virtualMachinesTable(props)}
+                </span>
+
             </CardContent>
         </Card>
     </Grid>;
 
-const userVirtualMachinesTable = (props: VirtualMachineProps) =>
+const virtualMachineSendRequest = (props: VirtualMachineProps) =>
+    <span>
+        <Button variant="contained" color="primary" className={props.classes.button} onClick={props.saveRequestedDate}>
+            SEND REQUEST FOR SHELL ACCESS
+        </Button>
+        {props.requestedDate &&
+            <Typography variant="body1">
+                A request for shell access was sent on {props.requestedDate}
+            </Typography>}
+    </span>;
+
+const virtualMachinesTable = (props: VirtualMachineProps) =>
     <Table>
         <TableHead>
             <TableRow>
@@ -199,34 +178,6 @@ const userVirtualMachinesTable = (props: VirtualMachineProps) =>
         </TableBody>
     </Table>;
 
-const adminVirtualMachinesTable = (props: VirtualMachineProps) =>
-    <Table>
-        <TableHead>
-            <TableRow>
-                <TableCell>Uuid</TableCell>
-                <TableCell>Host name</TableCell>
-                <TableCell>Logins</TableCell>
-                <TableCell />
-            </TableRow>
-        </TableHead>
-        <TableBody>
-            {props.logins.items.length > 0 && props.virtualMachines.items.map((it, index) =>
-                <TableRow key={index}>
-                    <TableCell>{it.uuid}</TableCell>
-                    <TableCell>{it.hostname}</TableCell>
-                    <TableCell>["{props.logins.items[0].username}"]</TableCell>
-                    <TableCell className={props.classes.moreOptions}>
-                        <Tooltip title="More options" disableFocusListener>
-                            <IconButton onClick={event => props.onOptionsMenuOpen(event, it)} className={props.classes.moreOptionsButton}>
-                                <MoreOptionsIcon />
-                            </IconButton>
-                        </Tooltip>
-                    </TableCell>
-                </TableRow>
-            )}
-        </TableBody>
-    </Table>;
-
 const getUsername = (links: ListResults<any>) => {
     return links.items[0].properties.username;
 };
@@ -236,7 +187,7 @@ const CardSSHSection = (props: VirtualMachineProps) =>
         <Card>
             <CardContent>
                 <Typography variant="body2">
-                    In order to access virtual machines using SSH, <Link to={Routes.SSH_KEYS} className={props.classes.link}>add an SSH key to your account</Link> and add a section like this to your SSH configuration file ( ~/.ssh/config):
+                    In order to access virtual machines using SSH, <Link to={Routes.SSH_KEYS_USER} className={props.classes.link}>add an SSH key to your account</Link> and add a section like this to your SSH configuration file ( ~/.ssh/config):
                 </Typography>
                 <DefaultCodeSnippet
                     className={props.classes.codeSnippet}
index af2325bffde022e105d6f0db3b1f7d94242775fd..90b2dad0197215578d8020b1da153d7d38c9e88e 100644 (file)
@@ -46,28 +46,48 @@ 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';
 import { ProcessInputDialog } from '~/views-components/process-input-dialog/process-input-dialog';
-import { VirtualMachinePanel } from '~/views/virtual-machine-panel/virtual-machine-panel';
+import { VirtualMachineUserPanel } from '~/views/virtual-machine-panel/virtual-machine-user-panel';
+import { VirtualMachineAdminPanel } from '~/views/virtual-machine-panel/virtual-machine-admin-panel';
 import { ProjectPropertiesDialog } from '~/views-components/project-properties-dialog/project-properties-dialog';
 import { RepositoriesPanel } from '~/views/repositories-panel/repositories-panel';
 import { KeepServicePanel } from '~/views/keep-service-panel/keep-service-panel';
 import { ComputeNodePanel } from '~/views/compute-node-panel/compute-node-panel';
+import { ApiClientAuthorizationPanel } from '~/views/api-client-authorization-panel/api-client-authorization-panel';
+import { LinkPanel } from '~/views/link-panel/link-panel';
 import { RepositoriesSampleGitDialog } from '~/views-components/repositories-sample-git-dialog/repositories-sample-git-dialog';
 import { RepositoryAttributesDialog } from '~/views-components/repository-attributes-dialog/repository-attributes-dialog';
 import { CreateRepositoryDialog } from '~/views-components/dialog-forms/create-repository-dialog';
 import { RemoveRepositoryDialog } from '~/views-components/repository-remove-dialog/repository-remove-dialog';
 import { CreateSshKeyDialog } from '~/views-components/dialog-forms/create-ssh-key-dialog';
 import { PublicKeyDialog } from '~/views-components/ssh-keys-dialog/public-key-dialog';
+import { RemoveApiClientAuthorizationDialog } from '~/views-components/api-client-authorizations-dialog/remove-dialog';
 import { RemoveComputeNodeDialog } from '~/views-components/compute-nodes-dialog/remove-dialog';
 import { RemoveKeepServiceDialog } from '~/views-components/keep-services-dialog/remove-dialog';
+import { RemoveLinkDialog } from '~/views-components/links-dialog/remove-dialog';
 import { RemoveSshKeyDialog } from '~/views-components/ssh-keys-dialog/remove-dialog';
 import { RemoveVirtualMachineDialog } from '~/views-components/virtual-machines-dialog/remove-dialog';
+import { AttributesApiClientAuthorizationDialog } from '~/views-components/api-client-authorizations-dialog/attributes-dialog';
 import { AttributesComputeNodeDialog } from '~/views-components/compute-nodes-dialog/attributes-dialog';
 import { AttributesKeepServiceDialog } from '~/views-components/keep-services-dialog/attributes-dialog';
+import { AttributesLinkDialog } from '~/views-components/links-dialog/attributes-dialog';
 import { AttributesSshKeyDialog } from '~/views-components/ssh-keys-dialog/attributes-dialog';
 import { VirtualMachineAttributesDialog } from '~/views-components/virtual-machines-dialog/attributes-dialog';
+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';
 
@@ -137,12 +157,20 @@ export const WorkbenchPanel =
                                 <Route path={Routes.RUN_PROCESS} component={RunProcessPanel} />
                                 <Route path={Routes.WORKFLOWS} component={WorkflowPanel} />
                                 <Route path={Routes.SEARCH_RESULTS} component={SearchResultsPanel} />
-                                <Route path={Routes.VIRTUAL_MACHINES} component={VirtualMachinePanel} />
+                                <Route path={Routes.VIRTUAL_MACHINES_USER} component={VirtualMachineUserPanel} />
+                                <Route path={Routes.VIRTUAL_MACHINES_ADMIN} component={VirtualMachineAdminPanel} />
                                 <Route path={Routes.REPOSITORIES} component={RepositoriesPanel} />
-                                <Route path={Routes.SSH_KEYS} component={SshKeyPanel} />
+                                <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>
                     </Grid>
@@ -151,21 +179,29 @@ export const WorkbenchPanel =
             <Grid item>
                 <DetailsPanel />
             </Grid>
+            <AddGroupMembersDialog />
             <AdvancedTabDialog />
+            <AttributesApiClientAuthorizationDialog />
             <AttributesComputeNodeDialog />
             <AttributesKeepServiceDialog />
+            <AttributesLinkDialog />
             <AttributesSshKeyDialog />
             <ChangeWorkflowDialog />
             <ContextMenu />
             <CopyCollectionDialog />
             <CopyProcessDialog />
             <CreateCollectionDialog />
+            <CreateGroupDialog />
             <CreateProjectDialog />
             <CreateRepositoryDialog />
             <CreateSshKeyDialog />
+            <CreateUserDialog />
             <CurrentTokenDialog />
             <FileRemoveDialog />
             <FilesUploadCollectionDialog />
+            <GroupAttributesDialog />
+            <GroupMemberAttributesDialog />
+            <HelpApiClientAuthorizationDialog />
             <MoveCollectionDialog />
             <MoveProcessDialog />
             <MoveProjectDialog />
@@ -175,8 +211,12 @@ export const WorkbenchPanel =
             <ProcessCommandDialog />
             <ProcessInputDialog />
             <ProjectPropertiesDialog />
+            <RemoveApiClientAuthorizationDialog />
             <RemoveComputeNodeDialog />
+            <RemoveGroupDialog />
+            <RemoveGroupMemberDialog />
             <RemoveKeepServiceDialog />
+            <RemoveLinkDialog />
             <RemoveProcessDialog />
             <RemoveRepositoryDialog />
             <RemoveSshKeyDialog />
@@ -190,6 +230,7 @@ export const WorkbenchPanel =
             <UpdateCollectionDialog />
             <UpdateProcessDialog />
             <UpdateProjectDialog />
+            <UserAttributesDialog />
             <VirtualMachineAttributesDialog />
         </Grid>
     );
index 02408b06bb7b6fcb03b76760ccfebbb6055f28eb..936c3485746b001b3fa4d3a52e8f493e209677e8 100644 (file)
@@ -22,7 +22,7 @@ import { DataTableDefaultView } from '~/components/data-table-default-view/data-
 import { WorkflowResource, parseWorkflowDefinition, getWorkflowInputs, getInputLabel, stringifyInputType } from '~/models/workflow';
 import { WorkflowGraph } from "~/views/workflow-panel/workflow-graph";
 
-export type CssRules = 'root' | 'tab' | 'inputTab' | 'graphTab' | 'descriptionTab' | 'inputsTable';
+export type CssRules = 'root' | 'tab' | 'inputTab' | 'graphTab' | 'graphTabWithChosenWorkflow' | 'descriptionTab' | 'inputsTable';
 
 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     root: {
@@ -34,12 +34,12 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     inputTab: {
         overflow: 'auto',
         maxHeight: '300px',
-        marginTop: theme.spacing.unit,
-        '&:last-child': {
-            paddingBottom: theme.spacing.unit / 2,
-        }
+        marginTop: theme.spacing.unit
     },
     graphTab: {
+        marginTop: theme.spacing.unit,
+    },
+    graphTabWithChosenWorkflow: {
         overflow: 'auto',
         height: '450px',
         marginTop: theme.spacing.unit,
@@ -99,7 +99,7 @@ export const WorkflowDetailsCard = withStyles(styles)(
                             messages={['Please select a workflow to see its inputs.']} />
                     }
                 </CardContent>}
-                {value === 2 && <CardContent className={classes.graphTab}>
+                {value === 2 && <CardContent className={workflow ? classes.graphTabWithChosenWorkflow : classes.graphTab}>
                     {workflow
                         ? <WorkflowGraph workflow={workflow} />
                         : <DataTableDefaultView