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";
}
hideColumnSelector?: boolean;
paperProps?: PaperProps;
actions?: React.ReactNode;
+ hideSearchInput?: boolean;
}
interface DataExplorerActionProps<T> {
columns, onContextMenu, onFiltersChange, onSortToggle, working, extractKey,
rowsPerPage, rowsPerPageOptions, onColumnToggle, searchValue, onSearch,
items, itemsAvailable, onRowClick, onRowDoubleClick, classes,
- dataTableDefaultView, hideColumnSelector, actions, paperProps,
+ dataTableDefaultView, hideColumnSelector, actions, paperProps, hideSearchInput
} = this.props;
return <Paper className={classes.root} {...paperProps}>
<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>
+ </div>}
{actions}
{!hideColumnSelector && <ColumnSelector
columns={columns}
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';
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} />;
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';
console.log(`Starting arvados [${getBuildInfo()}]`);
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);
//
// SPDX-License-Identifier: AGPL-3.0
-import { Resource, ResourceKind } 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;
STAR = 'star',
TAG = 'tag',
PERMISSION = 'permission',
+ PRESET = 'preset',
}
\ No newline at end of file
CONTAINER = 'dz642',
CONTAINER_REQUEST = 'xvhdp',
GROUP = 'j7d0g',
+ LINK = 'o0j2j',
LOG = '57u5n',
REPOSITORY = 's0uqq',
USER = 'tpzed',
return ResourceKind.NODE;
case ResourceObjectType.API_CLIENT_AUTHORIZATION:
return ResourceKind.API_CLIENT_AUTHORIZATION;
+ case ResourceObjectType.LINK:
+ return ResourceKind.LINK;
default:
return undefined;
}
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';
export const addRouteChangeHandlers = (history: History, store: RootStore) => {
const handler = handleLocationChange(store);
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 keepServicesMatch = Routes.matchKeepServicesRoute(pathname);
const computeNodesMatch = Routes.matchComputeNodesRoute(pathname);
const apiClientAuthorizationsMatch = Routes.matchApiClientAuthorizationsRoute(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());
if (projectMatch) {
store.dispatch(WorkbenchActions.loadProject(projectMatch.params.id));
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 (keepServicesMatch) {
store.dispatch(WorkbenchActions.loadKeepServices);
store.dispatch(WorkbenchActions.loadApiClientAuthorizations);
} else if (myAccountMatch) {
store.dispatch(WorkbenchActions.loadMyAccount);
- }else if (userMatch) {
+ } 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);
}
};
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`,
MY_ACCOUNT: '/my-account',
KEEP_SERVICES: `/keep-services`,
COMPUTE_NODES: `/nodes`,
API_CLIENT_AUTHORIZATIONS: `/api_client_authorizations`,
GROUPS: '/groups',
GROUP_DETAILS: `/group/:id(${RESOURCE_UUID_PATTERN})`,
+ LINKS: '/links'
};
export const getResourceUrl = (uuid: 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 matchMyAccountRoute = (route: string) =>
matchPath(route, { path: Routes.MY_ACCOUNT });
export const matchGroupDetailsRoute = (route: string) =>
matchPath<ResourceRouteParams>(route, { path: Routes.GROUP_DETAILS });
+
+export const matchLinksRoute = (route: string) =>
+ matchPath(route, { path: Routes.LINKS });
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(
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
];
}
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(),
+
+ });
+
+ }
+
}
KEEP_SERVICES = 'keep_services',
COMPUTE_NODES = 'nodes',
USERS = 'users',
- API_CLIENT_AUTHORIZATIONS = 'api_client_authorizations'
+ API_CLIENT_AUTHORIZATIONS = 'api_client_authorizations',
+ LINKS = 'links'
}
enum KeepServiceData {
DEFAULT_OWNER_UUID = 'default_owner_uuid'
}
-type AdvanceResourceKind = CollectionData | ProcessData | ProjectData | RepositoryData | SshKeyData | VirtualMachineData | KeepServiceData | ComputeNodeData | ApiClientAuthorizationsData | UserData;
+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 | ApiClientAuthorization | UserResource | 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) => {
});
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 }));
}
"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
import { getAuthorizedKeysServiceError, AuthorizedKeysServiceError } from '~/services/authorized-keys-service/authorized-keys-service';
import { KeyType, SshKeyResource } from '~/models/ssh-key';
import { User } from "~/models/user";
+import * as Routes from '~/routes/routes';
export const authActions = unionize({
SAVE_API_TOKEN: ofType<string>(),
export const loadSshKeysPanel = () =>
async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
try {
- dispatch(setBreadcrumbs([{ label: 'SSH Keys'}]));
+ const userUuid = getState().auth.user!.uuid;
+ const { router } = getState();
+ const pathname = router.location ? router.location.pathname : '';
+ dispatch(setBreadcrumbs([{ label: 'SSH Keys' }]));
const response = await services.authorizedKeysService.list();
- dispatch(authActions.SET_SSH_KEYS(response.items));
+ const userSshKeys = response.items.find(it => it.ownerUuid === userUuid);
+ return Routes.matchSshKeysAdminRoute(pathname) ? dispatch(authActions.SET_SSH_KEYS(response.items)) : dispatch(authActions.SET_SSH_KEYS([userSshKeys!]));
} catch (e) {
return;
}
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>(),
}
};
+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;
return ContextMenuKind.PROCESS_RESOURCE;
case ResourceKind.USER:
return ContextMenuKind.ROOT_PROJECT;
+ case ResourceKind.LINK:
+ return ContextMenuKind.LINK;
default:
return;
}
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>;
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;
--- /dev/null
+// 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 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 loadLinkPanel = () =>
+ (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+ dispatch(setBreadcrumbs([{ label: 'Links' }]));
+ dispatch(linkPanelActions.REQUEST_ITEMS());
+ };
+
+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
--- /dev/null
+// 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
+ });
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);
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 navigateToMyAccount = push(Routes.MY_ACCOUNT);
export const navigateToGroups = push(Routes.GROUPS);
export const navigateToGroupDetails = compose(push, getGroupUrl);
+
+export const navigateToLinks = push(Routes.LINKS);
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[]>(),
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,
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';
(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
export interface ProcessUpdateFormDialogData {
uuid: string;
name: string;
+ description?: string;
}
export const PROCESS_UPDATE_FORM_NAME = 'processUpdateFormName';
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;
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';
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<{}>(),
});
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));
}
workflows: WorkflowResource[];
searchWorkflows: WorkflowResource[];
selectedWorkflow: WorkflowResource | undefined;
+ presets?: WorkflowResource[];
+ selectedPreset?: WorkflowResource;
inputs: CommandInputParameter[];
}
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');
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';
const composeEnhancers =
(process.env.NODE_ENV === 'development' &&
new GroupDetailsPanelMiddlewareService(services, GROUP_DETAILS_PANEL_ID)
);
+ const linkPanelMiddleware = dataExplorerMiddleware(
+ new LinkMiddlewareService(services, LINK_PANEL_ID)
+ );
const middlewares: Middleware[] = [
routerMiddleware(history),
thunkMiddleware.withExtraArgument(services),
userPanelMiddleware,
groupsPanelMiddleware,
groupDetailsPanelMiddleware,
+ linkPanelMiddleware
];
const enhancer = composeEnhancers(applyMiddleware(...middlewares));
return createStore(rootReducer, enhancer);
import { snackbarActions, SnackbarKind } from '~/store/snackbar/snackbar-actions';
import { UserResource } from "~/models/user";
import { getResource } from '~/store/resources/resources';
-import { navigateToProject } from "~/store/navigation/navigation-action";
+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 = 'repositoryCreateFormName';
+export const USER_CREATE_FORM_NAME = 'userCreateFormName';
export interface UserCreateFormDialogData {
email: string;
dispatch(userBindedActions.REQUEST_ITEMS());
return newUser;
} catch (e) {
- return ;
+ 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 }));
}
};
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";
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) =>
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();
});
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 = () =>
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);
import { loadRepositoriesPanel } from '~/store/repositories/repositories-actions';
import { loadKeepServicesPanel } from '~/store/keep-services/keep-services-actions';
import { loadUsersPanel, userBindedActions } from '~/store/users/users-actions';
+import { loadLinkPanel, linkPanelActions } from '~/store/link-panel/link-panel-actions';
+import { linkPanelColumns } from '~/views/link-panel/link-panel-root';
import { userPanelColumns } from '~/views/user-panel/user-panel';
import { loadComputeNodesPanel } from '~/store/compute-nodes/compute-nodes-actions';
import { loadApiClientAuthorizationsPanel } from '~/store/api-client-authorizations/api-client-authorizations-actions';
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<any>(initSidePanelTree());
if (router.location) {
const match = matchRootRoute(router.location.pathname);
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());
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)];
--- /dev/null
+// 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));
+ }
+}]];
USER = "User",
NODE = "Node",
GROUPS = "Group",
- GROUP_MEMBER = "GroupMember"
+ GROUP_MEMBER = "GroupMember",
+ LINK = "Link",
}
// SPDX-License-Identifier: AGPL-3.0
import * as React from 'react';
-import { Grid, Typography, withStyles, Tooltip, IconButton, Checkbox } 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';
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 { Link } from 'react-router-dom';
const renderName = (item: { name: string; uuid: string, kind: string }) =>
<Grid container alignItems="center" wrap="nowrap" spacing={16}>
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 || { username: '' };
})(renderUsername);
+// 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>
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>;
const ProcessEditFields = () => <span>
<ProcessNameField />
+ <ProcessDescriptionField />
</span>;
import * as React from "react";
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
component={TextField}
validate={PROCESS_NAME_VALIDATION}
label="Process Name" />;
+
+export const ProcessDescriptionField = () =>
+ <Field
+ name='description'
+ component={TextField}
+ validate={PROCESS_DESCRIPTION_VALIDATION}
+ label="Process Description" />;
--- /dev/null
+// 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
--- /dev/null
+// 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
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,
- navigateToApiClientAuthorizations, navigateToMyAccount, navigateToGroups
+import {
+ navigateToKeepServices, navigateToComputeNodes,
+ navigateToApiClientAuthorizations, navigateToGroups
} from '~/store/navigation/navigation-action';
-import { openVirtualMachines } from "~/store/virtual-machines/virtual-machines-actions";
import { navigateToUsers } from '~/store/navigation/navigation-action';
+import { navigateToSshKeysUser, navigateToMyAccount } from '~/store/navigation/navigation-action';
+import { openUserVirtualMachines } from "~/store/virtual-machines/virtual-machines-actions";
interface AccountMenuProps {
user?: User;
<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(navigateToUsers)}>Users</MenuItem>
- { user.isAdmin && <MenuItem onClick={() => dispatch(navigateToGroups)}>Groups</MenuItem> }
- { user.isAdmin && <MenuItem onClick={() => dispatch(navigateToApiClientAuthorizations)}>Api Tokens</MenuItem> }
- { user.isAdmin && <MenuItem onClick={() => dispatch(navigateToKeepServices)}>Keep Services</MenuItem> }
- { user.isAdmin && <MenuItem onClick={() => dispatch(navigateToComputeNodes)}>Compute Nodes</MenuItem> }
+ {user.isAdmin && <MenuItem onClick={() => dispatch(navigateToGroups)}>Groups</MenuItem>}
+ {user.isAdmin && <MenuItem onClick={() => dispatch(navigateToApiClientAuthorizations)}>Api Tokens</MenuItem>}
+ {user.isAdmin && <MenuItem onClick={() => dispatch(navigateToKeepServices)}>Keep Services</MenuItem>}
+ {user.isAdmin && <MenuItem onClick={() => dispatch(navigateToComputeNodes)}>Compute Nodes</MenuItem>}
+ <MenuItem onClick={() => dispatch(navigateToSshKeysUser)}>Ssh Keys</MenuItem>
<MenuItem onClick={() => dispatch(navigateToMyAccount)}>My account</MenuItem>
<MenuItem onClick={() => dispatch(logout())}>Logout</MenuItem>
</DropdownMenu>
--- /dev/null
+// 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;
+}
+
+const mapStateToProps = (state: RootState): AdminMenuProps => ({
+ user: state.auth.user
+});
+
+export const AdminMenu = connect(mapStateToProps)(
+ ({ user, dispatch }: AdminMenuProps & DispatchProp<any>) =>
+ user
+ ? <DropdownMenu
+ icon={<AdminMenuIcon />}
+ id="admin-menu"
+ title="Admin Panel">
+ <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.navigateToComputeNodes)}>Compute Nodes</MenuItem>
+ <MenuItem onClick={() => dispatch(NavigationAction.navigateToKeepServices)}>Keep Services</MenuItem>
+ <MenuItem onClick={() => dispatch(NavigationAction.navigateToLinks)}>Links</MenuItem>
+ <MenuItem onClick={() => dispatch(logout())}>Logout</MenuItem>
+ </DropdownMenu>
+ : null);
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';
? <>
<NotificationsMenu />
<AccountMenu />
+ {props.user.isAdmin && <AdminMenu />}
<HelpMenu />
</>
: <HelpMenu />}
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.matchKeepServicesRoute(pathname) && !Routes.matchComputeNodesRoute(pathname) &&
- !Routes.matchApiClientAuthorizationsRoute(pathname) && !Routes.matchUsersRoute(pathname);
+ !Routes.matchApiClientAuthorizationsRoute(pathname) && !Routes.matchUsersRoute(pathname) &&
+ !Routes.matchMyAccountRoute(pathname) && !Routes.matchLinksRoute(pathname);
};
export const MainContentBar = connect((state: RootState) => ({
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';
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: {
value: {
textTransform: 'none',
fontSize: '0.875rem'
+ },
+ link: {
+ fontSize: '0.875rem',
+ color: theme.palette.primary.main,
+ '&:hover': {
+ cursor: 'pointer'
+ }
}
});
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);
})(
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}>
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>
--- /dev/null
+// 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 LinkPanelDataProps {
+ resources: ResourcesState;
+}
+
+export interface LinkPanelActionProps {
+ onItemClick: (item: string) => void;
+ onContextMenu: (event: React.MouseEvent<HTMLElement>, item: string) => void;
+ onItemDoubleClick: (item: string) => void;
+}
+
+export type LinkPanelProps = LinkPanelDataProps & LinkPanelActionProps;
+
+export const LinkPanelRoot = (props: LinkPanelProps) => {
+ 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
--- /dev/null
+// 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, LinkPanelActionProps } from '~/views/link-panel/link-panel-root';
+import { ResourceKind } from '~/models/resource';
+
+const mapStateToProps = (state: RootState) => {
+ return {
+ resources: state.resources
+ };
+};
+
+const mapDispatchToProps = (dispatch: Dispatch): LinkPanelActionProps => ({
+ 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
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';
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={{
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>
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;
<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
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 => {
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);
<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}>
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;
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 />
--- /dev/null
+// 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);
+ }
+ }
+ });
--- /dev/null
+// 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>;
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-service';
-import { HelpIcon, MoreOptionsIcon } from '~/components/icon/icon';
-import { VirtualMachineLogins, VirtualMachinesResource } from '~/models/virtual-machines';
+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: {
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> {
}
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}>
</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>
<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>
</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;
};
<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}
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 { 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';
<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.KEEP_SERVICES} component={KeepServicePanel} />
<Route path={Routes.USERS} component={UserPanel} />
<Route path={Routes.COMPUTE_NODES} component={ComputeNodePanel} />
<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>
<AttributesApiClientAuthorizationDialog />
<AttributesComputeNodeDialog />
<AttributesKeepServiceDialog />
+ <AttributesLinkDialog />
<AttributesSshKeyDialog />
<ChangeWorkflowDialog />
<ContextMenu />
<RemoveGroupDialog />
<RemoveGroupMemberDialog />
<RemoveKeepServiceDialog />
+ <RemoveLinkDialog />
<RemoveProcessDialog />
<RemoveRepositoryDialog />
<RemoveSshKeyDialog />