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} />;
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);
store.dispatch(WorkbenchActions.loadVirtualMachines);
} 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);
REPOSITORIES: '/repositories',
SHARED_WITH_ME: '/shared-with-me',
RUN_PROCESS: '/run-process',
- VIRTUAL_MACHINES_USER: '/virtual-machines-user',
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`,
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 });
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;
}
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);
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, navigateToMyAccount } from '~/store/navigation/navigation-action';
+import { navigateToSshKeysUser, navigateToMyAccount } from '~/store/navigation/navigation-action';
import { openUserVirtualMachines } from "~/store/virtual-machines/virtual-machines-actions";
interface AccountMenuProps {
<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(navigateToMyAccount)}>My account</MenuItem>
<MenuItem onClick={() => dispatch(logout())}>Logout</MenuItem>
</DropdownMenu>
import { MenuItem } from "@material-ui/core";
import { User } from "~/models/user";
import { DropdownMenu } from "~/components/dropdown-menu/dropdown-menu";
-import { ShareMeIcon } from "~/components/icon/icon";
+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 {
- navigateToSshKeys, navigateToKeepServices, navigateToComputeNodes,
+ navigateToSshKeysAdmin, navigateToKeepServices, navigateToComputeNodes,
navigateToApiClientAuthorizations
} from '~/store/navigation/navigation-action';
import { openAdminVirtualMachines } from "~/store/virtual-machines/virtual-machines-actions";
({ user, dispatch }: AdminMenuProps & DispatchProp<any>) =>
user
? <DropdownMenu
- icon={<ShareMeIcon />}
+ icon={<AdminMenuIcon />}
id="admin-menu"
title="Admin Panel">
<MenuItem onClick={() => dispatch(openRepositoriesPanel())}>Repositories</MenuItem>
<MenuItem onClick={() => dispatch(openAdminVirtualMachines())}>Virtual Machines</MenuItem>
- <MenuItem onClick={() => dispatch(navigateToSshKeys)}>Ssh Keys</MenuItem>
+ <MenuItem onClick={() => dispatch(navigateToSshKeysAdmin)}>Ssh Keys</MenuItem>
<MenuItem onClick={() => dispatch(navigateToApiClientAuthorizations)}>Api Tokens</MenuItem>
<MenuItem onClick={() => dispatch(navigateToUsers)}>Users</MenuItem>
<MenuItem onClick={() => dispatch(navigateToComputeNodes)}>Compute Nodes</MenuItem>
const isButtonVisible = ({ router }: RootState) => {
const pathname = router.location ? router.location.pathname : '';
return !Routes.matchWorkflowRoute(pathname) && !Routes.matchUserVirtualMachineRoute(pathname) &&
- !Routes.matchAdminVirtualMachineRoute(pathname) && !Routes.matchRepositoriesRoute(pathname) &&
- !Routes.matchSshKeysRoute(pathname) && !Routes.matchKeepServicesRoute(pathname) &&
- !Routes.matchComputeNodesRoute(pathname) && !Routes.matchApiClientAuthorizationsRoute(pathname) &&
- !Routes.matchUsersRoute(pathname) && !Routes.matchMyAccountRoute(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.matchMyAccountRoute(pathname);
};
export const MainContentBar = connect((state: RootState) => ({
<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}>
<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}
<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} />