Arvados-DCO-1.1-Signed-off-by: Daniel Kutyła <daniel.kutyla@contractors.roche.com>
# Copyright (C) The Arvados Authors. All rights reserved.
-#
+#
# SPDX-License-Identifier: AGPL-3.0
REACT_APP_ARVADOS_CONFIG_URL=/config.json
}
});
const responseUsers = await this.services.userService.list({
- limit: dataExplorer.rowsPerPage,
- offset: dataExplorer.page * dataExplorer.rowsPerPage,
filters: new FilterBuilder()
.addIn('uuid', userUuids)
- .getFilters()
+ .getFilters(),
+ count: "none"
});
const responseGroups = await this.services.groupsService.list({
- limit: dataExplorer.rowsPerPage,
- offset: dataExplorer.page * dataExplorer.rowsPerPage,
filters: new FilterBuilder()
.addIn('uuid', groupUuids)
- .getFilters()
+ .getFilters(),
+ count: "none"
});
responseUsers.items.map(it => {
api.dispatch<any>(ownerNameActions.SET_OWNER_NAME({
name: it.uuid === userUuid
? 'User: Me'
: `User: ${getUserDisplayName(it)}`,
- uuid: it.uuid }));
+ uuid: it.uuid
+ }));
});
responseGroups.items.map(it => {
api.dispatch<any>(ownerNameActions.SET_OWNER_NAME({ name: `Project: ${it.name}`, uuid: it.uuid }));
export const dataExplorerToListParams = (dataExplorer: DataExplorer) => ({
limit: dataExplorer.rowsPerPage,
- offset: dataExplorer.page * dataExplorer.rowsPerPage,
+ offset: dataExplorer.page * dataExplorer.rowsPerPage
});
export const listResultsToDataExplorerItemsMeta = <R>({ itemsAvailable, offset, limit }: ListResults<R>) => ({
const users = await this.services.userService.list({
filters: new FilterBuilder()
.addIn('uuid', permissions.items.map(item => item.headUuid))
- .getFilters()
+ .getFilters(),
+ count: "none"
});
api.dispatch(GroupDetailsPanelActions.SET_ITEMS({
...listResultsToDataExplorerItemsMeta(permissions),
.addIn('uuid', permissionLinks.map(({ tailUuid }) => tailUuid))
.getFilters();
- const { items: users } = await userService.list({ filters });
- const { items: groups} = await groupsService.list({ filters });
+ const { items: users } = await userService.list({ filters, count: "none" });
+ const { items: groups } = await groupsService.list({ filters, count: "none" });
const getEmail = (tailUuid: string) => {
const user = users.find(({ uuid }) => uuid === tailUuid);
export const loadUsersData = () =>
async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- await services.userService.list();
+ await services.userService.list({ count: "none" });
};
export const loadUsersPanel = () =>
};
export const getPublicUserUuid = (state: RootState) => {
- const prefix = getProperty<string>(UUID_PREFIX_PROPERTY_NAME)(state.properties);
+ const prefix = state.auth.localCluster;
return `${prefix}-tpzed-anonymouspublic`;
};
export const getPublicGroupUuid = (state: RootState) => {
- const prefix = getProperty<string>(UUID_PREFIX_PROPERTY_NAME)(state.properties);
+ const prefix = state.auth.localCluster;
return `${prefix}-j7d0g-anonymouspublic`;
};
//
// SPDX-License-Identifier: AGPL-3.0
-import * as React from "react";
-import { shallow, configure } from "enzyme";
-import * as Adapter from "enzyme-adapter-react-16";
-import * as CopyToClipboard from "react-copy-to-clipboard";
-import { CurrentTokenDialogComponent } from "./current-token-dialog";
+import * as React from 'react';
+import { Button } from '@material-ui/core';
+import { mount, configure } from 'enzyme';
+import * as Adapter from 'enzyme-adapter-react-16';
+import * as CopyToClipboard from 'react-copy-to-clipboard';
+import { CurrentTokenDialogComponent } from './current-token-dialog';
configure({ adapter: new Adapter() });
-describe("<CurrentTokenDialog />", () => {
+jest.mock('toggle-selection', () => () => () => null);
+
+describe('<CurrentTokenDialog />', () => {
let props;
let wrapper;
props = {
classes: {},
data: {
- currentToken: "123123123123",
+ currentToken: '123123123123',
},
+ open: true,
dispatch: jest.fn(),
};
});
- describe("copy to clipboard", () => {
+ describe('copy to clipboard', () => {
beforeEach(() => {
- wrapper = shallow(<CurrentTokenDialogComponent {...props} />);
+ wrapper = mount(<CurrentTokenDialogComponent {...props} />);
});
- it("should copy API TOKEN to the clipboard", () => {
+ it('should copy API TOKEN to the clipboard', () => {
// when
- wrapper.find(CopyToClipboard).props().onCopy();
+ wrapper.find(CopyToClipboard).find(Button).simulate('click');
- // then
+ // and
expect(props.dispatch).toHaveBeenCalledWith({
payload: {
hideDuration: 2000,
kind: 1,
- message: "Token copied to clipboard",
+ message: 'Token copied to clipboard',
},
- type: "OPEN_SNACKBAR",
+ type: 'OPEN_SNACKBAR',
});
});
});
getSnippet = ({ apiHost, currentToken }: CurrentTokenDialogData) =>
`HISTIGNORE=$HISTIGNORE:'export ARVADOS_API_TOKEN=*'
- export ARVADOS_API_TOKEN=${currentToken}
- export ARVADOS_API_HOST=${apiHost}
- unset ARVADOS_API_HOST_INSECURE`
+export ARVADOS_API_TOKEN=${currentToken}
+export ARVADOS_API_HOST=${apiHost}
+unset ARVADOS_API_HOST_INSECURE`
render() {
const { classes, open, closeDialog, ...data } = this.props;
<DialogContent>
<Typography paragraph={true}>
The Arvados API token is a secret key that enables the Arvados SDKs to access Arvados with the proper permissions.
- <Typography component='p'>
- For more information see
- <a href='http://doc.arvados.org/user/reference/api-tokens.html' target='blank' className={classes.link}>
- Getting an API token.
- </a>
- </Typography>
+ <Typography component='span'>
+ For more information see
+ <a href='http://doc.arvados.org/user/reference/api-tokens.html' target='blank' className={classes.link}>
+ Getting an API token.
+ </a>
+ </Typography>
</Typography>
<Typography paragraph={true}>
- Paste the following lines at a shell prompt to set up the necessary environment for Arvados SDKs to authenticate to your klingenc account.
- </Typography>
+ Paste the following lines at a shell prompt to set up the necessary environment for Arvados SDKs to authenticate to your account.
+ </Typography>
<DefaultCodeSnippet lines={[this.getSnippet(data)]} />
- <CopyToClipboard text={data.currentToken} onCopy={() => this.onCopy('Token copied to clipboard')}>
+ <CopyToClipboard text={this.getSnippet(data)} onCopy={() => this.onCopy('Token copied to clipboard')}>
<Button
color="primary"
size="small"
variant="contained"
className={classes.copyButton}
>
- Copy Api Token
+ COPY TO CLIPBOARD
</Button>
</CopyToClipboard>
<Typography >
Arvados
<a href='http://doc.arvados.org/user/reference/api-tokens.html' target='blank' className={classes.link}>virtual machines</a>
do this for you automatically. This setup is needed only when you use the API remotely (e.g., from your own workstation).
- </Typography>
+ </Typography>
</DialogContent>
<DialogActions>
<Button onClick={closeDialog} className={classes.button} color="primary">CLOSE</Button>
}
const getDisplayName = (item: GroupResource & UserResource) => {
- switch(item.kind) {
+ switch (item.kind) {
case ResourceKind.USER:
return getUserDisplayName(item, true);
case ResourceKind.GROUP:
const filterUsers = new FilterBuilder()
.addILike('any', value)
.getFilters();
- const userItems: ListResults<any> = await userService.list({ filters: filterUsers, limit });
+ const userItems: ListResults<any> = await userService.list({ filters: filterUsers, limit, count: "none" });
const filterGroups = new FilterBuilder()
.addNotIn('group_class', [GroupClass.PROJECT])
.addILike('name', value)
.getFilters();
- const groupItems: ListResults<any> = await groupsService.list({ filters: filterGroups, limit });
+ const groupItems: ListResults<any> = await groupsService.list({ filters: filterGroups, limit, count: "none" });
this.setState({
suggestions: this.props.onlyPeople
? userItems.items