.idea
.vscode
+/public/config.json
# see https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
.pnp.*
});
});
+ it('attempts to use a preexisting name creating or updating a collection', function() {
+ const name = `Test collection ${Math.floor(Math.random() * 999999)}`;
+ cy.createCollection(adminUser.token, {
+ name: name,
+ owner_uuid: activeUser.user.uuid,
+ manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"
+ });
+ cy.loginAs(activeUser);
+ cy.goToPath(`/projects/${activeUser.user.uuid}`);
+ cy.get('[data-cy=breadcrumb-first]').should('contain', 'Projects');
+ cy.get('[data-cy=breadcrumb-last]').should('not.exist');
+ // Attempt to create new collection with a duplicate name
+ cy.get('[data-cy=side-panel-button]').click();
+ cy.get('[data-cy=side-panel-new-collection]').click();
+ cy.get('[data-cy=form-dialog]')
+ .should('contain', 'New collection')
+ .within(() => {
+ cy.get('[data-cy=name-field]').within(() => {
+ cy.get('input').type(name);
+ });
+ cy.get('[data-cy=form-submit-btn]').click();
+ });
+ // Error message should display, allowing editing the name
+ cy.get('[data-cy=form-dialog]').should('exist')
+ .and('contain', 'Collection with the same name already exists')
+ .within(() => {
+ cy.get('[data-cy=name-field]').within(() => {
+ cy.get('input').type(' renamed');
+ });
+ cy.get('[data-cy=form-submit-btn]').click();
+ });
+ cy.get('[data-cy=form-dialog]').should('not.exist');
+ // Attempt to rename the collection with the duplicate name
+ cy.get('[data-cy=collection-panel-options-btn]').click();
+ cy.get('[data-cy=context-menu]').contains('Edit collection').click();
+ cy.get('[data-cy=form-dialog]')
+ .should('contain', 'Edit Collection')
+ .within(() => {
+ cy.get('[data-cy=name-field]').within(() => {
+ cy.get('input')
+ .type('{selectall}{backspace}')
+ .type(name);
+ });
+ cy.get('[data-cy=form-submit-btn]').click();
+ });
+ cy.get('[data-cy=form-dialog]').should('exist')
+ .and('contain', 'Collection with the same name already exists');
+ });
+
it('uses the property editor (from edit dialog) with vocabulary terms', function () {
cy.createCollection(adminUser.token, {
name: `Test collection ${Math.floor(Math.random() * 999999)}`,
// Confirm proper vocabulary labels are displayed on the UI.
cy.get('[data-cy=form-dialog]').should('contain', 'Color: Magenta');
+ // Value field should not complain about being required just after
+ // adding a new property. See #19732
+ cy.get('[data-cy=form-dialog]').should('not.contain', 'This field is required');
+
cy.get('[data-cy=form-submit-btn]').click();
// Confirm that the user was taken to the newly created collection
cy.get('[data-cy=form-dialog]').should('not.exist');
cy.get('[data-cy=breadcrumb-last]').should('contain', subProjName);
});
+ it('attempts to use a preexisting name creating a project', function() {
+ const name = `Test project ${Math.floor(Math.random() * 999999)}`;
+ cy.createGroup(activeUser.token, {
+ name: name,
+ group_class: 'project',
+ });
+ cy.loginAs(activeUser);
+ cy.goToPath(`/projects/${activeUser.user.uuid}`);
+
+ // Attempt to create new collection with a duplicate name
+ cy.get('[data-cy=side-panel-button]').click();
+ cy.get('[data-cy=side-panel-new-project]').click();
+ cy.get('[data-cy=form-dialog]')
+ .should('contain', 'New Project')
+ .within(() => {
+ cy.get('[data-cy=name-field]').within(() => {
+ cy.get('input').type(name);
+ });
+ cy.get('[data-cy=form-submit-btn]').click();
+ });
+ // Error message should display, allowing editing the name
+ cy.get('[data-cy=form-dialog]').should('exist')
+ .and('contain', 'Project with the same name already exists')
+ .within(() => {
+ cy.get('[data-cy=name-field]').within(() => {
+ cy.get('input').type(' renamed');
+ });
+ cy.get('[data-cy=form-submit-btn]').click();
+ });
+ cy.get('[data-cy=form-dialog]').should('not.exist');
+ });
+
it('navigates to the parent project after trashing the one being displayed', function() {
cy.createGroup(activeUser.token, {
name: `Test root project ${Math.floor(Math.random() * 999999)}`,
});
describe('Frozen projects', () => {
- beforeEach(() => {
+ beforeEach(() => {
cy.createGroup(activeUser.token, {
name: `Main project ${Math.floor(Math.random() * 999999)}`,
group_class: 'project',
}).as('mainProject');
-
+
cy.createGroup(adminUser.token, {
name: `Admin project ${Math.floor(Math.random() * 999999)}`,
group_class: 'project',
name: `Main collection ${Math.floor(Math.random() * 999999)}`,
owner_uuid: mainProject.uuid,
manifest_text: "./subdir 37b51d194a7513e45b56f6524f2d51f2+3 0:3:foo\n. 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"
- }).as('mainCollection');
+ }).as('mainCollection');
});
});
cy.get('[data-cy=context-menu]').contains('Unfreeze').click();
cy.get('main').contains(adminProject.name).rightclick();
-
+
cy.get('[data-cy=context-menu]').contains('Freeze').should('exist');
});
});
//
// SPDX-License-Identifier: AGPL-3.0
-import Axios from "axios";
+import Axios from 'axios';
-export const WORKBENCH_CONFIG_URL = process.env.REACT_APP_ARVADOS_CONFIG_URL || "/config.json";
+export const WORKBENCH_CONFIG_URL =
+ process.env.REACT_APP_ARVADOS_CONFIG_URL || '/config.json';
interface WorkbenchConfig {
- API_HOST: string;
- VOCABULARY_URL?: string;
- FILE_VIEWERS_CONFIG_URL?: string;
+ API_HOST: string;
+ VOCABULARY_URL?: string;
+ FILE_VIEWERS_CONFIG_URL?: string;
}
export interface ClusterConfigJSON {
API: {
UnfreezeProjectRequiresAdmin: boolean
+ MaxItemsPerResponse: number
},
ClusterID: string;
RemoteClusters: {
Scheme: string
}
};
- Mail?: {
- SupportEmailAddress: string;
+ Mail?: {
+ SupportEmailAddress: string;
+ };
+ Services: {
+ Controller: {
+ ExternalURL: string;
};
- Services: {
- Controller: {
- ExternalURL: string
- }
- Workbench1: {
- ExternalURL: string
- }
- Workbench2: {
- ExternalURL: string
- }
- Websocket: {
- ExternalURL: string
- }
- WebDAV: {
- ExternalURL: string
- },
- WebDAVDownload: {
- ExternalURL: string
- },
- WebShell: {
- ExternalURL: string
- }
+ Workbench1: {
+ ExternalURL: string;
};
- Workbench: {
- DisableSharingURLsUI: boolean;
- ArvadosDocsite: string;
- FileViewersConfigURL: string;
- WelcomePageHTML: string;
- InactivePageHTML: string;
- SSHHelpPageHTML: string;
- SSHHelpHostSuffix: string;
- SiteName: string;
- IdleTimeout: string;
+ Workbench2: {
+ ExternalURL: string;
};
- Login: {
- LoginCluster: string;
- Google: {
- Enable: boolean;
- }
- LDAP: {
- Enable: boolean;
- }
- OpenIDConnect: {
- Enable: boolean;
- }
- PAM: {
- Enable: boolean;
- }
- SSO: {
- Enable: boolean;
- }
- Test: {
- Enable: boolean;
- }
+ Websocket: {
+ ExternalURL: string;
};
- Collections: {
- ForwardSlashNameSubstitution: string;
- ManagedProperties?: {
- [key: string]: {
- Function: string,
- Value: string,
- Protected?: boolean,
- }
- },
- TrustAllContent: boolean
+ WebDAV: {
+ ExternalURL: string;
};
- Volumes: {
- [key: string]: {
- StorageClasses: {
- [key: string]: boolean;
- }
- }
+ WebDAVDownload: {
+ ExternalURL: string;
+ };
+ WebShell: {
+ ExternalURL: string;
+ };
+ };
+ Workbench: {
+ DisableSharingURLsUI: boolean;
+ ArvadosDocsite: string;
+ FileViewersConfigURL: string;
+ WelcomePageHTML: string;
+ InactivePageHTML: string;
+ SSHHelpPageHTML: string;
+ SSHHelpHostSuffix: string;
+ SiteName: string;
+ IdleTimeout: string;
+ };
+ Login: {
+ LoginCluster: string;
+ Google: {
+ Enable: boolean;
+ };
+ LDAP: {
+ Enable: boolean;
+ };
+ OpenIDConnect: {
+ Enable: boolean;
+ };
+ PAM: {
+ Enable: boolean;
};
+ SSO: {
+ Enable: boolean;
+ };
+ Test: {
+ Enable: boolean;
+ };
+ };
+ Collections: {
+ ForwardSlashNameSubstitution: string;
+ ManagedProperties?: {
+ [key: string]: {
+ Function: string;
+ Value: string;
+ Protected?: boolean;
+ };
+ };
+ TrustAllContent: boolean;
+ };
+ Volumes: {
+ [key: string]: {
+ StorageClasses: {
+ [key: string]: boolean;
+ };
+ };
+ };
}
export class Config {
- baseUrl!: string;
- keepWebServiceUrl!: string;
- keepWebInlineServiceUrl!: string;
- remoteHosts!: {
- [key: string]: string
- };
- rootUrl!: string;
- uuidPrefix!: string;
- websocketUrl!: string;
- workbenchUrl!: string;
- workbench2Url!: string;
- vocabularyUrl!: string;
- fileViewersConfigUrl!: string;
- loginCluster!: string;
- clusterConfig!: ClusterConfigJSON;
- apiRevision!: number;
+ baseUrl!: string;
+ keepWebServiceUrl!: string;
+ keepWebInlineServiceUrl!: string;
+ remoteHosts!: {
+ [key: string]: string;
+ };
+ rootUrl!: string;
+ uuidPrefix!: string;
+ websocketUrl!: string;
+ workbenchUrl!: string;
+ workbench2Url!: string;
+ vocabularyUrl!: string;
+ fileViewersConfigUrl!: string;
+ loginCluster!: string;
+ clusterConfig!: ClusterConfigJSON;
+ apiRevision!: number;
}
export const buildConfig = (clusterConfig: ClusterConfigJSON): Config => {
- const clusterConfigJSON = removeTrailingSlashes(clusterConfig);
- const config = new Config();
- config.rootUrl = clusterConfigJSON.Services.Controller.ExternalURL;
- config.baseUrl = `${config.rootUrl}/${ARVADOS_API_PATH}`;
- config.uuidPrefix = clusterConfigJSON.ClusterID;
- config.websocketUrl = clusterConfigJSON.Services.Websocket.ExternalURL;
- config.workbench2Url = clusterConfigJSON.Services.Workbench2.ExternalURL;
- config.workbenchUrl = clusterConfigJSON.Services.Workbench1.ExternalURL;
- config.keepWebServiceUrl = clusterConfigJSON.Services.WebDAVDownload.ExternalURL;
- config.keepWebInlineServiceUrl = clusterConfigJSON.Services.WebDAV.ExternalURL;
- config.loginCluster = clusterConfigJSON.Login.LoginCluster;
- config.clusterConfig = clusterConfigJSON;
- config.apiRevision = 0;
- mapRemoteHosts(clusterConfigJSON, config);
- return config;
+ const clusterConfigJSON = removeTrailingSlashes(clusterConfig);
+ const config = new Config();
+ config.rootUrl = clusterConfigJSON.Services.Controller.ExternalURL;
+ config.baseUrl = `${config.rootUrl}/${ARVADOS_API_PATH}`;
+ config.uuidPrefix = clusterConfigJSON.ClusterID;
+ config.websocketUrl = clusterConfigJSON.Services.Websocket.ExternalURL;
+ config.workbench2Url = clusterConfigJSON.Services.Workbench2.ExternalURL;
+ config.workbenchUrl = clusterConfigJSON.Services.Workbench1.ExternalURL;
+ config.keepWebServiceUrl =
+ clusterConfigJSON.Services.WebDAVDownload.ExternalURL;
+ config.keepWebInlineServiceUrl =
+ clusterConfigJSON.Services.WebDAV.ExternalURL;
+ config.loginCluster = clusterConfigJSON.Login.LoginCluster;
+ config.clusterConfig = clusterConfigJSON;
+ config.apiRevision = 0;
+ mapRemoteHosts(clusterConfigJSON, config);
+ return config;
};
export const getStorageClasses = (config: Config): string[] => {
- const classes: Set<string> = new Set(['default']);
- const volumes = config.clusterConfig.Volumes;
- Object.keys(volumes).forEach(v => {
- Object.keys(volumes[v].StorageClasses || {}).forEach(sc => {
- if (volumes[v].StorageClasses[sc]) {
- classes.add(sc);
- }
- });
+ const classes: Set<string> = new Set(['default']);
+ const volumes = config.clusterConfig.Volumes;
+ Object.keys(volumes).forEach((v) => {
+ Object.keys(volumes[v].StorageClasses || {}).forEach((sc) => {
+ if (volumes[v].StorageClasses[sc]) {
+ classes.add(sc);
+ }
});
- return Array.from(classes);
+ });
+ return Array.from(classes);
};
const getApiRevision = async (apiUrl: string) => {
- try {
- const dd = (await Axios.get<any>(`${apiUrl}/${DISCOVERY_DOC_PATH}`)).data;
- return parseInt(dd.revision, 10) || 0;
- } catch {
- console.warn("Unable to get API Revision number, defaulting to zero. Some features may not work properly.");
- return 0;
- }
+ try {
+ const dd = (await Axios.get<any>(`${apiUrl}/${DISCOVERY_DOC_PATH}`)).data;
+ return parseInt(dd.revision, 10) || 0;
+ } catch {
+ console.warn(
+ 'Unable to get API Revision number, defaulting to zero. Some features may not work properly.'
+ );
+ return 0;
+ }
};
-const removeTrailingSlashes = (config: ClusterConfigJSON): ClusterConfigJSON => {
- const svcs: any = {};
- Object.keys(config.Services).forEach((s) => {
- svcs[s] = config.Services[s];
- if (svcs[s].hasOwnProperty('ExternalURL')) {
- svcs[s].ExternalURL = svcs[s].ExternalURL.replace(/\/+$/, '');
- }
- });
- return { ...config, Services: svcs };
+const removeTrailingSlashes = (
+ config: ClusterConfigJSON
+): ClusterConfigJSON => {
+ const svcs: any = {};
+ Object.keys(config.Services).forEach((s) => {
+ svcs[s] = config.Services[s];
+ if (svcs[s].hasOwnProperty('ExternalURL')) {
+ svcs[s].ExternalURL = svcs[s].ExternalURL.replace(/\/+$/, '');
+ }
+ });
+ return { ...config, Services: svcs };
};
export const fetchConfig = () => {
- return Axios
- .get<WorkbenchConfig>(WORKBENCH_CONFIG_URL + "?nocache=" + (new Date()).getTime())
- .then(response => response.data)
- .catch(() => {
- console.warn(`There was an exception getting the Workbench config file at ${WORKBENCH_CONFIG_URL}. Using defaults instead.`);
- return Promise.resolve(getDefaultConfig());
- })
- .then(workbenchConfig => {
- if (workbenchConfig.API_HOST === undefined) {
- throw new Error(`Unable to start Workbench. API_HOST is undefined in ${WORKBENCH_CONFIG_URL} or the environment.`);
- }
- return Axios.get<ClusterConfigJSON>(getClusterConfigURL(workbenchConfig.API_HOST)).then(async response => {
- const apiRevision = await getApiRevision(response.data.Services.Controller.ExternalURL.replace(/\/+$/, ''));
- const config = { ...buildConfig(response.data), apiRevision };
- const warnLocalConfig = (varName: string) => console.warn(
- `A value for ${varName} was found in ${WORKBENCH_CONFIG_URL}. To use the Arvados centralized configuration instead, \
-remove the entire ${varName} entry from ${WORKBENCH_CONFIG_URL}`);
+ return Axios.get<WorkbenchConfig>(
+ WORKBENCH_CONFIG_URL + '?nocache=' + new Date().getTime()
+ )
+ .then((response) => response.data)
+ .catch(() => {
+ console.warn(
+ `There was an exception getting the Workbench config file at ${WORKBENCH_CONFIG_URL}. Using defaults instead.`
+ );
+ return Promise.resolve(getDefaultConfig());
+ })
+ .then((workbenchConfig) => {
+ if (workbenchConfig.API_HOST === undefined) {
+ throw new Error(
+ `Unable to start Workbench. API_HOST is undefined in ${WORKBENCH_CONFIG_URL} or the environment.`
+ );
+ }
+ return Axios.get<ClusterConfigJSON>(
+ getClusterConfigURL(workbenchConfig.API_HOST)
+ ).then(async (response) => {
+ const apiRevision = await getApiRevision(
+ response.data.Services.Controller.ExternalURL.replace(/\/+$/, '')
+ );
+ const config = { ...buildConfig(response.data), apiRevision };
+ const warnLocalConfig = (varName: string) =>
+ console.warn(
+ `A value for ${varName} was found in ${WORKBENCH_CONFIG_URL}. To use the Arvados centralized configuration instead, \
+remove the entire ${varName} entry from ${WORKBENCH_CONFIG_URL}`
+ );
- // Check if the workbench config has an entry for vocabulary and file viewer URLs
- // If so, use these values (even if it is an empty string), but print a console warning.
- // Otherwise, use the cluster config.
- let fileViewerConfigUrl;
- if (workbenchConfig.FILE_VIEWERS_CONFIG_URL !== undefined) {
- warnLocalConfig("FILE_VIEWERS_CONFIG_URL");
- fileViewerConfigUrl = workbenchConfig.FILE_VIEWERS_CONFIG_URL;
- }
- else {
- fileViewerConfigUrl = config.clusterConfig.Workbench.FileViewersConfigURL || "/file-viewers-example.json";
- }
- config.fileViewersConfigUrl = fileViewerConfigUrl;
+ // Check if the workbench config has an entry for vocabulary and file viewer URLs
+ // If so, use these values (even if it is an empty string), but print a console warning.
+ // Otherwise, use the cluster config.
+ let fileViewerConfigUrl;
+ if (workbenchConfig.FILE_VIEWERS_CONFIG_URL !== undefined) {
+ warnLocalConfig('FILE_VIEWERS_CONFIG_URL');
+ fileViewerConfigUrl = workbenchConfig.FILE_VIEWERS_CONFIG_URL;
+ } else {
+ fileViewerConfigUrl =
+ config.clusterConfig.Workbench.FileViewersConfigURL ||
+ '/file-viewers-example.json';
+ }
+ config.fileViewersConfigUrl = fileViewerConfigUrl;
- if (workbenchConfig.VOCABULARY_URL !== undefined) {
- console.warn(`A value for VOCABULARY_URL was found in ${WORKBENCH_CONFIG_URL}. It will be ignored as the cluster already provides its own endpoint, you can safely remove it.`)
- }
- config.vocabularyUrl = getVocabularyURL(workbenchConfig.API_HOST);
+ if (workbenchConfig.VOCABULARY_URL !== undefined) {
+ console.warn(
+ `A value for VOCABULARY_URL was found in ${WORKBENCH_CONFIG_URL}. It will be ignored as the cluster already provides its own endpoint, you can safely remove it.`
+ );
+ }
+ config.vocabularyUrl = getVocabularyURL(workbenchConfig.API_HOST);
- return { config, apiHost: workbenchConfig.API_HOST };
- });
- });
+ return { config, apiHost: workbenchConfig.API_HOST };
+ });
+ });
};
// Maps remote cluster hosts and removes the default RemoteCluster entry
-export const mapRemoteHosts = (clusterConfigJSON: ClusterConfigJSON, config: Config) => {
- config.remoteHosts = {};
- Object.keys(clusterConfigJSON.RemoteClusters).forEach(k => { config.remoteHosts[k] = clusterConfigJSON.RemoteClusters[k].Host; });
- delete config.remoteHosts["*"];
+export const mapRemoteHosts = (
+ clusterConfigJSON: ClusterConfigJSON,
+ config: Config
+) => {
+ config.remoteHosts = {};
+ Object.keys(clusterConfigJSON.RemoteClusters).forEach((k) => {
+ config.remoteHosts[k] = clusterConfigJSON.RemoteClusters[k].Host;
+ });
+ delete config.remoteHosts['*'];
};
-export const mockClusterConfigJSON = (config: Partial<ClusterConfigJSON>): ClusterConfigJSON => ({
- API: {
- UnfreezeProjectRequiresAdmin: false,
+export const mockClusterConfigJSON = (
+ config: Partial<ClusterConfigJSON>
+): ClusterConfigJSON => ({
+ API: {
+ UnfreezeProjectRequiresAdmin: false,
+ MaxItemsPerResponse: 1000,
+ },
+ ClusterID: '',
+ RemoteClusters: {},
+ Services: {
+ Controller: { ExternalURL: '' },
+ Workbench1: { ExternalURL: '' },
+ Workbench2: { ExternalURL: '' },
+ Websocket: { ExternalURL: '' },
+ WebDAV: { ExternalURL: '' },
+ WebDAVDownload: { ExternalURL: '' },
+ WebShell: { ExternalURL: '' },
+ },
+ Workbench: {
+ DisableSharingURLsUI: false,
+ ArvadosDocsite: '',
+ FileViewersConfigURL: '',
+ WelcomePageHTML: '',
+ InactivePageHTML: '',
+ SSHHelpPageHTML: '',
+ SSHHelpHostSuffix: '',
+ SiteName: '',
+ IdleTimeout: '0s',
+ },
+ Login: {
+ LoginCluster: '',
+ Google: {
+ Enable: false,
},
- ClusterID: "",
- RemoteClusters: {},
- Services: {
- Controller: { ExternalURL: "" },
- Workbench1: { ExternalURL: "" },
- Workbench2: { ExternalURL: "" },
- Websocket: { ExternalURL: "" },
- WebDAV: { ExternalURL: "" },
- WebDAVDownload: { ExternalURL: "" },
- WebShell: { ExternalURL: "" },
+ LDAP: {
+ Enable: false,
},
- Workbench: {
- DisableSharingURLsUI: false,
- ArvadosDocsite: "",
- FileViewersConfigURL: "",
- WelcomePageHTML: "",
- InactivePageHTML: "",
- SSHHelpPageHTML: "",
- SSHHelpHostSuffix: "",
- SiteName: "",
- IdleTimeout: "0s",
+ OpenIDConnect: {
+ Enable: false,
},
- Login: {
- LoginCluster: "",
- Google: {
- Enable: false,
- },
- LDAP: {
- Enable: false,
- },
- OpenIDConnect: {
- Enable: false,
- },
- PAM: {
- Enable: false,
- },
- SSO: {
- Enable: false,
- },
- Test: {
- Enable: false,
- },
+ PAM: {
+ Enable: false,
},
- Collections: {
- ForwardSlashNameSubstitution: "",
- TrustAllContent: false,
+ SSO: {
+ Enable: false,
},
- Volumes: {},
- ...config
+ Test: {
+ Enable: false,
+ },
+ },
+ Collections: {
+ ForwardSlashNameSubstitution: '',
+ TrustAllContent: false,
+ },
+ Volumes: {},
+ ...config,
});
export const mockConfig = (config: Partial<Config>): Config => ({
- baseUrl: "",
- keepWebServiceUrl: "",
- keepWebInlineServiceUrl: "",
- remoteHosts: {},
- rootUrl: "",
- uuidPrefix: "",
- websocketUrl: "",
- workbenchUrl: "",
- workbench2Url: "",
- vocabularyUrl: "",
- fileViewersConfigUrl: "",
- loginCluster: "",
- clusterConfig: mockClusterConfigJSON({}),
- apiRevision: 0,
- ...config
+ baseUrl: '',
+ keepWebServiceUrl: '',
+ keepWebInlineServiceUrl: '',
+ remoteHosts: {},
+ rootUrl: '',
+ uuidPrefix: '',
+ websocketUrl: '',
+ workbenchUrl: '',
+ workbench2Url: '',
+ vocabularyUrl: '',
+ fileViewersConfigUrl: '',
+ loginCluster: '',
+ clusterConfig: mockClusterConfigJSON({}),
+ apiRevision: 0,
+ ...config,
});
const getDefaultConfig = (): WorkbenchConfig => {
- let apiHost = "";
- const envHost = process.env.REACT_APP_ARVADOS_API_HOST;
- if (envHost !== undefined) {
- console.warn(`Using default API host ${envHost}.`);
- apiHost = envHost;
- }
- else {
- console.warn(`No API host was found in the environment. Workbench may not be able to communicate with Arvados components.`);
- }
- return {
- API_HOST: apiHost,
- VOCABULARY_URL: undefined,
- FILE_VIEWERS_CONFIG_URL: undefined,
- };
+ let apiHost = '';
+ const envHost = process.env.REACT_APP_ARVADOS_API_HOST;
+ if (envHost !== undefined) {
+ console.warn(`Using default API host ${envHost}.`);
+ apiHost = envHost;
+ } else {
+ console.warn(
+ `No API host was found in the environment. Workbench may not be able to communicate with Arvados components.`
+ );
+ }
+ return {
+ API_HOST: apiHost,
+ VOCABULARY_URL: undefined,
+ FILE_VIEWERS_CONFIG_URL: undefined,
+ };
};
-export const ARVADOS_API_PATH = "arvados/v1";
-export const CLUSTER_CONFIG_PATH = "arvados/v1/config";
-export const VOCABULARY_PATH = "arvados/v1/vocabulary";
-export const DISCOVERY_DOC_PATH = "discovery/v1/apis/arvados/v1/rest";
-export const getClusterConfigURL = (apiHost: string) => `https://${apiHost}/${CLUSTER_CONFIG_PATH}?nocache=${(new Date()).getTime()}`;
-export const getVocabularyURL = (apiHost: string) => `https://${apiHost}/${VOCABULARY_PATH}?nocache=${(new Date()).getTime()}`;
+export const ARVADOS_API_PATH = 'arvados/v1';
+export const CLUSTER_CONFIG_PATH = 'arvados/v1/config';
+export const VOCABULARY_PATH = 'arvados/v1/vocabulary';
+export const DISCOVERY_DOC_PATH = 'discovery/v1/apis/arvados/v1/rest';
+export const getClusterConfigURL = (apiHost: string) =>
+ `https://${apiHost}/${CLUSTER_CONFIG_PATH}?nocache=${new Date().getTime()}`;
+export const getVocabularyURL = (apiHost: string) =>
+ `https://${apiHost}/${VOCABULARY_PATH}?nocache=${new Date().getTime()}`;
import teal from '@material-ui/core/colors/teal';
export interface ArvadosThemeOptions extends ThemeOptions {
- customs: any;
+ customs: any;
}
export interface ArvadosTheme extends Theme {
- customs: {
- colors: Colors
- };
+ customs: {
+ colors: Colors;
+ };
}
interface Colors {
- green700: string;
- yellow100: string;
- yellow700: string;
- yellow900: string;
- red100: string;
- red900: string;
- blue500: string;
- grey500: string;
- purple: string;
- orange: string;
+ green700: string;
+ yellow100: string;
+ yellow700: string;
+ yellow900: string;
+ red100: string;
+ red900: string;
+ blue500: string;
+ grey500: string;
+ purple: string;
+ orange: string;
}
const arvadosPurple = '#361336';
-const grey500 = grey["500"];
-const grey600 = grey["600"];
-const grey700 = grey["700"];
-const grey900 = grey["900"];
+const grey500 = grey['500'];
+const grey600 = grey['600'];
+const grey700 = grey['700'];
+const grey900 = grey['900'];
export const themeOptions: ArvadosThemeOptions = {
- typography: {
- useNextVariants: true,
- },
- customs: {
- colors: {
- green700: green["700"],
- yellow100: yellow["100"],
- yellow700: yellow["700"],
- yellow900: yellow["900"],
- red100: red["100"],
- red900: red['900'],
- blue500: blue['500'],
- grey500: grey500,
- purple: arvadosPurple,
- orange: '#f0ad4e',
- }
- },
- overrides: {
- MuiTypography: {
- body1: {
- fontSize: '0.8125rem'
- }
- },
- MuiAppBar: {
- colorPrimary: {
- backgroundColor: arvadosPurple
- }
- },
- MuiTabs: {
- root: {
- color: grey600
- },
- indicator: {
- backgroundColor: arvadosPurple
- }
- },
- MuiTab: {
- root: {
- '&$selected': {
- fontWeight: 700,
- color: arvadosPurple
- }
- }
- },
- MuiList: {
- root: {
- color: grey900
- }
- },
- MuiListItemText: {
- root: {
- padding: 0
- }
- },
- MuiListItemIcon: {
- root: {
- fontSize: '1.25rem'
- }
- },
- MuiCardHeader: {
- avatar: {
- display: 'flex',
- alignItems: 'center'
- },
- title: {
- color: grey700,
- fontSize: '1.25rem'
- }
+ typography: {
+ useNextVariants: true,
+ },
+ customs: {
+ colors: {
+ green700: green['700'],
+ yellow100: yellow['100'],
+ yellow700: yellow['700'],
+ yellow900: yellow['900'],
+ red100: red['100'],
+ red900: red['900'],
+ blue500: blue['500'],
+ grey500: grey500,
+ purple: arvadosPurple,
+ orange: '#f0ad4e',
+ },
+ },
+ overrides: {
+ MuiTypography: {
+ body1: {
+ fontSize: '0.8125rem',
+ },
+ },
+ MuiAppBar: {
+ colorPrimary: {
+ backgroundColor: arvadosPurple,
+ },
+ },
+ MuiTabs: {
+ root: {
+ color: grey600,
+ },
+ indicator: {
+ backgroundColor: arvadosPurple,
+ },
+ },
+ MuiTab: {
+ root: {
+ '&$selected': {
+ fontWeight: 700,
+ color: arvadosPurple,
},
- MuiExpansionPanel: {
- expanded: {
- marginTop: '8px',
- }
+ },
+ },
+ MuiList: {
+ root: {
+ color: grey900,
+ },
+ },
+ MuiListItemText: {
+ root: {
+ padding: 0,
+ },
+ },
+ MuiListItemIcon: {
+ root: {
+ fontSize: '1.25rem',
+ },
+ },
+ MuiCardHeader: {
+ avatar: {
+ display: 'flex',
+ alignItems: 'center',
+ },
+ title: {
+ color: grey700,
+ fontSize: '1.25rem',
+ },
+ },
+ MuiExpansionPanel: {
+ expanded: {
+ marginTop: '8px',
+ },
+ },
+ MuiExpansionPanelDetails: {
+ root: {
+ marginBottom: 0,
+ paddingBottom: '4px',
+ },
+ },
+ MuiExpansionPanelSummary: {
+ content: {
+ '&$expanded': {
+ margin: 0,
},
- MuiExpansionPanelDetails: {
- root: {
- marginBottom: 0,
- paddingBottom: '4px',
- }
+ color: grey700,
+ fontSize: '1.25rem',
+ margin: 0,
+ },
+ expanded: {},
+ },
+ MuiMenuItem: {
+ root: {
+ padding: '8px 16px',
+ },
+ },
+ MuiInput: {
+ root: {
+ fontSize: '0.875rem',
+ },
+ underline: {
+ '&:after': {
+ borderBottomColor: arvadosPurple,
},
- MuiExpansionPanelSummary: {
- content: {
- '&$expanded': {
- margin: 0,
- },
- color: grey700,
- fontSize: '1.25rem',
- margin: 0,
- },
- expanded: {},
+ '&:hover:not($disabled):not($focused):not($error):before': {
+ borderBottom: '1px solid inherit',
},
- MuiMenuItem: {
- root: {
- padding: '8px 16px'
- }
+ },
+ },
+ MuiFormLabel: {
+ root: {
+ fontSize: '0.875rem',
+ '&$focused': {
+ '&$focused:not($error)': {
+ color: arvadosPurple,
+ },
},
- MuiInput: {
- root: {
- fontSize: '0.875rem'
- },
- underline: {
- '&:after': {
- borderBottomColor: arvadosPurple
- },
- '&:hover:not($disabled):not($focused):not($error):before': {
- borderBottom: '1px solid inherit'
- }
- }
+ },
+ },
+ MuiStepIcon: {
+ root: {
+ '&$active': {
+ color: arvadosPurple,
},
- MuiFormLabel: {
- root: {
- fontSize: '0.875rem',
- "&$focused": {
- "&$focused:not($error)": {
- color: arvadosPurple
- }
- }
- }
+ '&$completed': {
+ color: 'inherited',
},
- MuiStepIcon: {
- root: {
- '&$active': {
- color: arvadosPurple
- },
- '&$completed': {
- color: 'inherited'
- },
- }
- }
- },
- mixins: {
- toolbar: {
- minHeight: '48px'
- }
- },
- palette: {
- primary: {
- main: teal.A700,
- dark: teal.A400,
- contrastText: '#fff'
- }
+ },
+ },
+ },
+ mixins: {
+ toolbar: {
+ minHeight: '48px',
+ },
+ },
+ palette: {
+ primary: {
+ main: teal.A700,
+ dark: teal.A400,
+ contrastText: '#fff',
},
+ },
};
-export const CustomTheme = createMuiTheme(themeOptions);
\ No newline at end of file
+export const CustomTheme = createMuiTheme(themeOptions);
//
// SPDX-License-Identifier: AGPL-3.0
-import { PropertyValue } from "models/search-bar";
-import { Vocabulary, getTagKeyLabel, getTagValueLabel } from "models/vocabulary";
+import { PropertyValue } from 'models/search-bar';
+import {
+ Vocabulary,
+ getTagKeyLabel,
+ getTagValueLabel,
+} from 'models/vocabulary';
export const formatDate = (isoDate?: string | null, utc: boolean = false) => {
- if (isoDate) {
- const date = new Date(isoDate);
- let text: string;
- if (utc) {
- text = date.toUTCString();
- }
- else {
- text = date.toLocaleString();
- }
- return text === 'Invalid Date' ? "(none)" : text;
+ if (isoDate) {
+ const date = new Date(isoDate);
+ let text: string;
+ if (utc) {
+ text = date.toUTCString();
+ } else {
+ text = date.toLocaleString();
}
- return "(none)";
+ return text === 'Invalid Date' ? '(none)' : text;
+ }
+ return '-';
};
export const formatFileSize = (size?: number | string) => {
- if (typeof size === "number") {
- if (size === 0) { return "0 B"; }
-
- for (const { base, unit } of FILE_SIZES) {
- if (size >= base) {
- return `${(size / base).toFixed()} ${unit}`;
- }
- }
+ if (typeof size === 'number') {
+ if (size === 0) {
+ return '0 B';
}
- if ((typeof size === "string" && size === '') || size === undefined) {
- return '';
+
+ for (const { base, unit } of FILE_SIZES) {
+ if (size >= base) {
+ return `${(size / base).toFixed()} ${unit}`;
+ }
}
- return "0 B";
+ }
+ if ((typeof size === 'string' && size === '') || size === undefined) {
+ return '-';
+ }
+ return '0 B';
};
export const formatTime = (time: number, seconds?: boolean) => {
- const minutes = Math.floor(time / (1000 * 60) % 60).toFixed(0);
- const hours = Math.floor(time / (1000 * 60 * 60)).toFixed(0);
+ const minutes = Math.floor((time / (1000 * 60)) % 60).toFixed(0);
+ const hours = Math.floor(time / (1000 * 60 * 60)).toFixed(0);
- if (seconds) {
- const seconds = Math.floor(time / (1000) % 60).toFixed(0);
- return hours + "h " + minutes + "m " + seconds + "s";
- }
+ if (seconds) {
+ const seconds = Math.floor((time / 1000) % 60).toFixed(0);
+ return hours + 'h ' + minutes + 'm ' + seconds + 's';
+ }
- return hours + "h " + minutes + "m";
+ return hours + 'h ' + minutes + 'm';
};
export const getTimeDiff = (endTime: string, startTime: string) => {
- return new Date(endTime).getTime() - new Date(startTime).getTime();
+ return new Date(endTime).getTime() - new Date(startTime).getTime();
};
export const formatProgress = (loaded: number, total: number) => {
- const progress = loaded >= 0 && total > 0 ? loaded * 100 / total : 0;
- return `${progress.toFixed(2)}%`;
+ const progress = loaded >= 0 && total > 0 ? (loaded * 100) / total : 0;
+ return `${progress.toFixed(2)}%`;
};
-export function formatUploadSpeed(prevLoaded: number, loaded: number, prevTime: number, currentTime: number) {
- const speed = loaded > prevLoaded && currentTime > prevTime
- ? (loaded - prevLoaded) / (currentTime - prevTime)
- : 0;
+export function formatUploadSpeed(
+ prevLoaded: number,
+ loaded: number,
+ prevTime: number,
+ currentTime: number
+) {
+ const speed =
+ loaded > prevLoaded && currentTime > prevTime
+ ? (loaded - prevLoaded) / (currentTime - prevTime)
+ : 0;
- return `${(speed / 1000).toFixed(2)} MB/s`;
+ return `${(speed / 1000).toFixed(2)} MB/s`;
}
const FILE_SIZES = [
- {
- base: 1099511627776,
- unit: "TB"
- },
- {
- base: 1073741824,
- unit: "GB"
- },
- {
- base: 1048576,
- unit: "MB"
- },
- {
- base: 1024,
- unit: "KB"
- },
- {
- base: 1,
- unit: "B"
- }
+ {
+ base: 1099511627776,
+ unit: 'TB',
+ },
+ {
+ base: 1073741824,
+ unit: 'GB',
+ },
+ {
+ base: 1048576,
+ unit: 'MB',
+ },
+ {
+ base: 1024,
+ unit: 'KB',
+ },
+ {
+ base: 1,
+ unit: 'B',
+ },
];
-export const formatPropertyValue = (pv: PropertyValue, vocabulary?: Vocabulary) => {
- if (vocabulary && pv.keyID && pv.valueID) {
- return `${getTagKeyLabel(pv.keyID, vocabulary)}: ${getTagValueLabel(pv.keyID, pv.valueID!, vocabulary)}`;
- }
- if (pv.key) {
- return pv.value
- ? `${pv.key}: ${pv.value}`
- : pv.key;
- }
- return "";
+export const formatPropertyValue = (
+ pv: PropertyValue,
+ vocabulary?: Vocabulary
+) => {
+ if (vocabulary && pv.keyID && pv.valueID) {
+ return `${getTagKeyLabel(pv.keyID, vocabulary)}: ${getTagValueLabel(
+ pv.keyID,
+ pv.valueID!,
+ vocabulary
+ )}`;
+ }
+ if (pv.key) {
+ return pv.value ? `${pv.key}: ${pv.value}` : pv.key;
+ }
+ return '';
};
export const formatContainerCost = (cost: number): string => {
- const decimalPlaces = 3;
+ const decimalPlaces = 3;
- const factor = Math.pow(10, decimalPlaces);
- const rounded = Math.round(cost*factor)/factor;
- if (cost > 0 && rounded === 0) {
- // Display min value of 0.001
- return `$${1/factor}`;
- } else {
- // Otherwise use rounded value to proper decimal places
- return `$${rounded}`;
- }
+ const factor = Math.pow(10, decimalPlaces);
+ const rounded = Math.round(cost * factor) / factor;
+ if (cost > 0 && rounded === 0) {
+ // Display min value of 0.001
+ return `$${1 / factor}`;
+ } else {
+ // Otherwise use rounded value to proper decimal places
+ return `$${rounded}`;
+ }
};
className?: string;
}
-type CssRules = "checkbox";
+type CssRules = "checkbox" | "listItem" | "listItemText";
const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
checkbox: {
width: 24,
height: 24
+ },
+ listItem: {
+ padding: 0
+ },
+ listItemText: {
+ paddingTop: '0.2rem'
}
});
<ListItem
button
key={index}
+ className={classes.listItem}
onClick={() => onColumnToggle(column)}>
<Checkbox
disableRipple
color="primary"
checked={column.selected}
className={classes.checkbox} />
- <ListItemText>
+ <ListItemText
+ className={classes.listItemText}>
{column.name}
</ListItemText>
</ListItem>
<MenuIcon aria-label="Select columns" />
</IconButton>
</Tooltip>;
+
+
paperKey, fetchMode, currentItemUuid, title,
doHidePanel, doMaximizePanel, doUnMaximizePanel, panelName, panelMaximized, elementPath
} = this.props;
-
return <Paper className={classes.root} {...paperProps} key={paperKey} data-cy={this.props["data-cy"]}>
<Grid container direction="column" wrap="nowrap" className={classes.container}>
<div>
onContextMenu={this.handleRowContextMenu(item)}
onDoubleClick={event => onRowDoubleClick && onRowDoubleClick(event, item)}
selected={item === currentItemUuid}>
- {this.mapVisibleColumns((column, index) => (
- <TableCell key={column.key || index} className={currentRoute === '/workflows' ? classes.tableCellWorkflows : classes.tableCell}>
+ {this.mapVisibleColumns((column, index) => <TableCell key={column.key || index} className={currentRoute === '/workflows' ? classes.tableCellWorkflows : classes.tableCell}>
{column.render(item)}
</TableCell>
- ))}
+ )}
</TableRow>;
}
//
// SPDX-License-Identifier: AGPL-3.0
-import { Resource, ResourceKind, ResourceWithProperties } from "./resource";
-import { MountType } from "models/mount-types";
+import { Resource, ResourceKind, ResourceWithProperties } from './resource';
+import { MountType } from 'models/mount-types';
import { RuntimeConstraints } from './runtime-constraints';
import { SchedulingParameters } from './scheduling-parameters';
export enum ContainerRequestState {
- UNCOMMITTED = "Uncommitted",
- COMMITTED = "Committed",
- FINAL = "Final"
+ UNCOMMITTED = 'Uncommitted',
+ COMMITTED = 'Committed',
+ FINAL = 'Final',
}
-export interface ContainerRequestResource extends Resource, ResourceWithProperties {
- kind: ResourceKind.CONTAINER_REQUEST;
- name: string;
- description: string;
- state: ContainerRequestState;
- requestingContainerUuid: string | null;
- cumulativeCost: number;
- containerUuid: string | null;
- containerCountMax: number;
- mounts: {[path: string]: MountType};
- runtimeConstraints: RuntimeConstraints;
- schedulingParameters: SchedulingParameters;
- containerImage: string;
- environment: any;
- cwd: string;
- command: string[];
- outputPath: string;
- outputName: string;
- outputTtl: number;
- priority: number | null;
- expiresAt: string;
- useExisting: boolean;
- logUuid: string | null;
- outputUuid: string | null;
- filters: string;
- containerCount: number;
+export interface ContainerRequestResource
+ extends Resource,
+ ResourceWithProperties {
+ command: string[];
+ containerCountMax: number;
+ containerCount: number;
+ containerImage: string;
+ containerUuid: string | null;
+ cumulativeCost: number;
+ cwd: string;
+ description: string;
+ environment: any;
+ expiresAt: string;
+ filters: string;
+ kind: ResourceKind.CONTAINER_REQUEST;
+ logUuid: string | null;
+ mounts: { [path: string]: MountType };
+ name: string;
+ outputName: string;
+ outputPath: string;
+ outputTtl: number;
+ outputUuid: string | null;
+ priority: number | null;
+ requestingContainerUuid: string | null;
+ runtimeConstraints: RuntimeConstraints;
+ schedulingParameters: SchedulingParameters;
+ state: ContainerRequestState;
+ useExisting: boolean;
}
STDERR = 'stderr',
CONTAINER = 'container',
KEEPSTORE = 'keepstore',
+ SNIP = 'snip-line', // This type is for internal use only. See #19851
}
export interface LogResource extends Resource, ResourceWithProperties {
return super.get(uuid, showErrors, selectParam, session);
}
- create(data?: Partial<CollectionResource>) {
- return super.create({ ...data, preserveVersion: true });
+ create(data?: Partial<CollectionResource>, showErrors?: boolean) {
+ return super.create({ ...data, preserveVersion: true }, showErrors);
}
- update(uuid: string, data: Partial<CollectionResource>) {
+ update(uuid: string, data: Partial<CollectionResource>, showErrors?: boolean) {
const select = [...Object.keys(data), 'version', 'modifiedAt'];
- return super.update(uuid, { ...data, preserveVersion: true }, select);
+ return super.update(uuid, { ...data, preserveVersion: true }, showErrors, select);
}
async files(uuid: string) {
]));
}
- create(data?: Partial<T>) {
+ create(data?: Partial<T>, showErrors?: boolean) {
let payload: any;
if (data !== undefined) {
this.readOnlyFields.forEach( field => delete data[field] );
[this.resourceType.slice(0, -1)]: CommonService.mapKeys(snakeCase)(data),
};
}
- return super.create(payload);
+ return super.create(payload, showErrors);
}
- update(uuid: string, data: Partial<T>, select?: string[]) {
+ update(uuid: string, data: Partial<T>, showErrors?: boolean, select?: string[]) {
let payload: any;
if (data !== undefined) {
this.readOnlyFields.forEach( field => delete data[field] );
payload.select = ['uuid', ...select.map(field => snakeCase(field))];
};
}
- return super.update(uuid, payload);
+ return super.update(uuid, payload, showErrors);
}
}
export const getCommonResourceServiceError = (errorResponse: any) => {
- if ('errors' in errorResponse && 'errorToken' in errorResponse) {
+ if ('errors' in errorResponse) {
const error = errorResponse.errors.join('');
switch (true) {
case /UniqueViolation/.test(error):
}
}
- update(uuid: string, data: Partial<T>) {
+ update(uuid: string, data: Partial<T>, showErrors?: boolean) {
this.validateUuid(uuid);
return CommonService.defaultResponse(
this.serverApi
.put<T>(`/${this.resourceType}/${uuid}`, data && CommonService.mapKeys(snakeCase)(data)),
- this.actions
+ this.actions,
+ undefined, // mapKeys
+ showErrors
);
}
}
import { CancelToken } from 'axios';
import { snakeCase, camelCase } from "lodash";
import { CommonResourceService } from 'services/common-service/common-resource-service';
-import { ListResults, ListArguments } from 'services/common-service/common-service';
-import { AxiosInstance, AxiosRequestConfig } from "axios";
-import { CollectionResource } from "models/collection";
-import { ProjectResource } from "models/project";
-import { ProcessResource } from "models/process";
-import { WorkflowResource } from "models/workflow";
-import { TrashableResourceService } from "services/common-service/trashable-resource-service";
-import { ApiActions } from "services/api/api-actions";
-import { GroupResource } from "models/group";
-import { Session } from "models/session";
+import {
+ ListResults,
+ ListArguments,
+} from 'services/common-service/common-service';
+import { AxiosInstance, AxiosRequestConfig } from 'axios';
+import { CollectionResource } from 'models/collection';
+import { ProjectResource } from 'models/project';
+import { ProcessResource } from 'models/process';
+import { WorkflowResource } from 'models/workflow';
+import { TrashableResourceService } from 'services/common-service/trashable-resource-service';
+import { ApiActions } from 'services/api/api-actions';
+import { GroupResource } from 'models/group';
+import { Session } from 'models/session';
export interface ContentsArguments {
- limit?: number;
- offset?: number;
- order?: string;
- filters?: string;
- recursive?: boolean;
- includeTrash?: boolean;
- excludeHomeProject?: boolean;
+ limit?: number;
+ offset?: number;
+ order?: string;
+ filters?: string;
+ recursive?: boolean;
+ includeTrash?: boolean;
+ excludeHomeProject?: boolean;
}
export interface SharedArguments extends ListArguments {
- include?: string;
+ include?: string;
}
export type GroupContentsResource =
- CollectionResource |
- ProjectResource |
- ProcessResource |
- WorkflowResource;
+ | CollectionResource
+ | ProjectResource
+ | ProcessResource
+ | WorkflowResource;
-export class GroupsService<T extends GroupResource = GroupResource> extends TrashableResourceService<T> {
+export class GroupsService<
+ T extends GroupResource = GroupResource
+> extends TrashableResourceService<T> {
+ constructor(serverApi: AxiosInstance, actions: ApiActions) {
+ super(serverApi, 'groups', actions);
+ }
- constructor(serverApi: AxiosInstance, actions: ApiActions) {
- super(serverApi, "groups", actions);
- }
-
- async contents(uuid: string, args: ContentsArguments = {}, session?: Session, cancelToken?: CancelToken): Promise<ListResults<GroupContentsResource>> {
- const { filters, order, ...other } = args;
- const params = {
- ...other,
- filters: filters ? `[${filters}]` : undefined,
- order: order ? order : undefined
- };
- const pathUrl = uuid ? `/${uuid}/contents` : '/contents';
-
- const cfg: AxiosRequestConfig = { params: CommonResourceService.mapKeys(snakeCase)(params) };
- if (session) {
- cfg.baseURL = session.baseUrl;
- cfg.headers = { 'Authorization': 'Bearer ' + session.token };
- }
-
- if (cancelToken) {
- cfg.cancelToken = cancelToken;
- }
+async contents(uuid: string, args: ContentsArguments = {}, session?: Session, cancelToken?: CancelToken): Promise<ListResults<GroupContentsResource>> {
+ const { filters, order, ...other } = args;
+ const params = {
+ ...other,
+ filters: filters ? `[${filters}]` : undefined,
+ order: order ? order : undefined
+ };
+ const pathUrl = uuid ? `/${uuid}/contents` : '/contents';
+ const cfg: AxiosRequestConfig = {
+ params: CommonResourceService.mapKeys(snakeCase)(params),
+ };
- const response = await CommonResourceService.defaultResponse(
- this.serverApi.get(this.resourceType + pathUrl, cfg), this.actions, false
- );
-
- return { ...TrashableResourceService.mapKeys(camelCase)(response), clusterId: session && session.clusterId };
+ if (session) {
+ cfg.baseURL = session.baseUrl;
+ cfg.headers = { Authorization: 'Bearer ' + session.token };
}
- shared(params: SharedArguments = {}): Promise<ListResults<GroupContentsResource>> {
- return CommonResourceService.defaultResponse(
- this.serverApi
- .get(this.resourceType + '/shared', { params }),
- this.actions
- );
+ if (cancelToken) {
+ cfg.cancelToken = cancelToken;
}
+
+ const response = await CommonResourceService.defaultResponse(
+ this.serverApi.get(this.resourceType + pathUrl, cfg),
+ this.actions,
+ false
+ );
+
+ return {
+ ...TrashableResourceService.mapKeys(camelCase)(response),
+ clusterId: session && session.clusterId,
+ };
+ }
+
+ shared(
+ params: SharedArguments = {}
+ ): Promise<ListResults<GroupContentsResource>> {
+ return CommonResourceService.defaultResponse(
+ this.serverApi.get(this.resourceType + '/shared', { params }),
+ this.actions
+ );
+ }
}
export enum GroupContentsResourcePrefix {
- COLLECTION = "collections",
- PROJECT = "groups",
- PROCESS = "container_requests",
- WORKFLOW = "workflows"
+ COLLECTION = 'collections',
+ PROJECT = 'groups',
+ PROCESS = 'container_requests',
+ WORKFLOW = 'workflows',
}
import { FilterBuilder, joinFilters } from "services/api/filter-builder";
export class ProjectService extends GroupsService<ProjectResource> {
- create(data: Partial<ProjectResource>) {
+ create(data: Partial<ProjectResource>, showErrors?: boolean) {
const projectData = { ...data, groupClass: GroupClass.PROJECT };
- return super.create(projectData);
+ return super.create(projectData, showErrors);
}
list(args: ListArguments = {}) {
let newCollection: CollectionResource | undefined;
try {
dispatch(progressIndicatorActions.START_WORKING(COLLECTION_CREATE_FORM_NAME));
- newCollection = await services.collectionService.create(data);
+ newCollection = await services.collectionService.create(data, false);
await dispatch<any>(uploadCollectionFiles(newCollection.uuid));
dispatch(dialogActions.CLOSE_DIALOG({ id: COLLECTION_CREATE_FORM_NAME }));
dispatch(reset(COLLECTION_CREATE_FORM_NAME));
const error = getCommonResourceServiceError(e);
if (error === CommonResourceServiceError.UNIQUE_NAME_VIOLATION) {
dispatch(stopSubmit(COLLECTION_CREATE_FORM_NAME, { name: 'Collection with the same name already exists.' } as FormErrors));
- } else if (error === CommonResourceServiceError.NONE) {
+ } else {
dispatch(stopSubmit(COLLECTION_CREATE_FORM_NAME));
dispatch(dialogActions.CLOSE_DIALOG({ id: COLLECTION_CREATE_FORM_NAME }));
+ const errMsg = e.errors
+ ? e.errors.join('')
+ : 'There was an error while creating the collection';
dispatch(snackbarActions.OPEN_SNACKBAR({
- message: 'Collection has not been created.',
+ message: errMsg,
hideDuration: 2000,
kind: SnackbarKind.ERROR
}));
name: collection.name,
storageClassesDesired: collection.storageClassesDesired,
description: collection.description,
- properties: collection.properties }
+ properties: collection.properties }, false
).then(updatedCollection => {
updatedCollection = {...cachedCollection, ...updatedCollection};
dispatch(collectionPanelActions.SET_COLLECTION(updatedCollection));
dispatch(stopSubmit(COLLECTION_UPDATE_FORM_NAME, { name: 'Collection with the same name already exists.' } as FormErrors));
} else {
dispatch(dialogActions.CLOSE_DIALOG({ id: COLLECTION_UPDATE_FORM_NAME }));
+ const errMsg = e.errors
+ ? e.errors.join('')
+ : 'There was an error while updating the collection';
dispatch(snackbarActions.OPEN_SNACKBAR({
- message: e.errors.join(''),
+ message: errMsg,
hideDuration: 2000,
kind: SnackbarKind.ERROR }));
}
//
// SPDX-License-Identifier: AGPL-3.0
-import { Dispatch, MiddlewareAPI } from "redux";
-import { RootState } from "../store";
-import { DataColumns } from "components/data-table/data-table";
+import { Dispatch, MiddlewareAPI } from 'redux';
+import { RootState } from '../store';
+import { DataColumns } from 'components/data-table/data-table';
import { DataExplorer } from './data-explorer-reducer';
import { ListResults } from 'services/common-service/common-service';
-import { createTree } from "models/tree";
-import { DataTableFilters } from "components/data-table-filters/data-table-filters-tree";
+import { createTree } from 'models/tree';
+import { DataTableFilters } from 'components/data-table-filters/data-table-filters-tree';
export abstract class DataExplorerMiddlewareService {
- protected readonly id: string;
-
- protected constructor(id: string) {
- this.id = id;
- }
-
- public getId() {
- return this.id;
- }
-
- public getColumnFilters<T>(columns: DataColumns<T>, columnName: string): DataTableFilters {
- return getDataExplorerColumnFilters(columns, columnName);
- }
-
- abstract requestItems(api: MiddlewareAPI<Dispatch, RootState>, criteriaChanged?: boolean): Promise<void>;
+ protected readonly id: string;
+
+ protected constructor(id: string) {
+ this.id = id;
+ }
+
+ public getId() {
+ return this.id;
+ }
+
+ public getColumnFilters<T>(
+ columns: DataColumns<T>,
+ columnName: string
+ ): DataTableFilters {
+ return getDataExplorerColumnFilters(columns, columnName);
+ }
+
+ abstract requestItems(
+ api: MiddlewareAPI<Dispatch, RootState>,
+ criteriaChanged?: boolean
+ ): Promise<void>;
}
-export const getDataExplorerColumnFilters = <T>(columns: DataColumns<T>, columnName: string): DataTableFilters => {
- const column = columns.find(c => c.name === columnName);
- return column ? column.filters : createTree();
+export const getDataExplorerColumnFilters = <T>(
+ columns: DataColumns<T>,
+ columnName: string
+): DataTableFilters => {
+ const column = columns.find((c) => c.name === columnName);
+ return column ? column.filters : createTree();
};
export const dataExplorerToListParams = (dataExplorer: DataExplorer) => ({
- limit: dataExplorer.rowsPerPage,
- offset: dataExplorer.page * dataExplorer.rowsPerPage
+ limit: dataExplorer.rowsPerPage,
+ offset: dataExplorer.page * dataExplorer.rowsPerPage,
});
-export const listResultsToDataExplorerItemsMeta = <R>({ itemsAvailable, offset, limit }: ListResults<R>) => ({
- itemsAvailable,
- page: Math.floor(offset / limit),
- rowsPerPage: limit
+export const listResultsToDataExplorerItemsMeta = <R>({
+ itemsAvailable,
+ offset,
+ limit,
+}: ListResults<R>) => ({
+ itemsAvailable,
+ page: Math.floor(offset / limit),
+ rowsPerPage: limit,
});
-
// 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 { Middleware } from "redux";
-import { dataExplorerActions, bindDataExplorerActions, DataTableRequestState } from "./data-explorer-action";
-import { getDataExplorer } from "./data-explorer-reducer";
-import { DataExplorerMiddlewareService } from "./data-explorer-middleware-service";
+import { Middleware } from 'redux';
+import {
+ dataExplorerActions,
+ bindDataExplorerActions,
+ DataTableRequestState,
+} from './data-explorer-action';
+import { getDataExplorer } from './data-explorer-reducer';
+import { DataExplorerMiddlewareService } from './data-explorer-middleware-service';
-export const dataExplorerMiddleware = (service: DataExplorerMiddlewareService): Middleware => api => next => {
+export const dataExplorerMiddleware =
+ (service: DataExplorerMiddlewareService): Middleware =>
+ (api) =>
+ (next) => {
const actions = bindDataExplorerActions(service.getId());
- return action => {
- const handleAction = <T extends { id: string }>(handler: (data: T) => void) =>
- (data: T) => {
- next(action);
- if (data.id === service.getId()) {
- handler(data);
- }
- };
- dataExplorerActions.match(action, {
- SET_PAGE: handleAction(() => {
- api.dispatch(actions.REQUEST_ITEMS(false));
- }),
- SET_ROWS_PER_PAGE: handleAction(() => {
- api.dispatch(actions.REQUEST_ITEMS(true));
- }),
- SET_FILTERS: handleAction(() => {
- api.dispatch(actions.RESET_PAGINATION());
- api.dispatch(actions.REQUEST_ITEMS(true));
- }),
- TOGGLE_SORT: handleAction(() => {
- api.dispatch(actions.REQUEST_ITEMS(true));
- }),
- SET_EXPLORER_SEARCH_VALUE: handleAction(() => {
- api.dispatch(actions.RESET_PAGINATION());
- api.dispatch(actions.REQUEST_ITEMS(true));
- }),
- REQUEST_ITEMS: handleAction(({ criteriaChanged }) => {
- api.dispatch<any>(async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- while (true) {
- let de = getDataExplorer(getState().dataExplorer, service.getId());
- switch (de.requestState) {
- case DataTableRequestState.IDLE:
- // Start a new request.
- try {
- dispatch(actions.SET_REQUEST_STATE({ requestState: DataTableRequestState.PENDING }));
- await service.requestItems(api, criteriaChanged);
- } catch {
- dispatch(actions.SET_REQUEST_STATE({ requestState: DataTableRequestState.NEED_REFRESH }));
- }
- // Now check if the state is still PENDING, if it moved to NEED_REFRESH
- // then we need to reissue requestItems
- de = getDataExplorer(getState().dataExplorer, service.getId());
- const complete = (de.requestState === DataTableRequestState.PENDING);
- dispatch(actions.SET_REQUEST_STATE({ requestState: DataTableRequestState.IDLE }));
- if (complete) {
- return;
- }
- break;
- case DataTableRequestState.PENDING:
- // State is PENDING, move it to NEED_REFRESH so that when the current request finishes it starts a new one.
- dispatch(actions.SET_REQUEST_STATE({ requestState: DataTableRequestState.NEED_REFRESH }));
- return;
- case DataTableRequestState.NEED_REFRESH:
- // Nothing to do right now.
- return;
- }
+ return (action) => {
+ const handleAction =
+ <T extends { id: string }>(handler: (data: T) => void) =>
+ (data: T) => {
+ next(action);
+ if (data.id === service.getId()) {
+ handler(data);
+ }
+ };
+ dataExplorerActions.match(action, {
+ SET_PAGE: handleAction(() => {
+ api.dispatch(actions.REQUEST_ITEMS(false));
+ }),
+ SET_ROWS_PER_PAGE: handleAction(() => {
+ api.dispatch(actions.REQUEST_ITEMS(true));
+ }),
+ SET_FILTERS: handleAction(() => {
+ api.dispatch(actions.RESET_PAGINATION());
+ api.dispatch(actions.REQUEST_ITEMS(true));
+ }),
+ TOGGLE_SORT: handleAction(() => {
+ api.dispatch(actions.REQUEST_ITEMS(true));
+ }),
+ SET_EXPLORER_SEARCH_VALUE: handleAction(() => {
+ api.dispatch(actions.RESET_PAGINATION());
+ api.dispatch(actions.REQUEST_ITEMS(true));
+ }),
+ REQUEST_ITEMS: handleAction(({ criteriaChanged }) => {
+ api.dispatch<any>(
+ async (
+ dispatch: Dispatch,
+ getState: () => RootState,
+ services: ServiceRepository
+ ) => {
+ while (true) {
+ let de = getDataExplorer(
+ getState().dataExplorer,
+ service.getId()
+ );
+ switch (de.requestState) {
+ case DataTableRequestState.IDLE:
+ // Start a new request.
+ try {
+ dispatch(
+ actions.SET_REQUEST_STATE({
+ requestState: DataTableRequestState.PENDING,
+ })
+ );
+ await service.requestItems(api, criteriaChanged);
+ } catch {
+ dispatch(
+ actions.SET_REQUEST_STATE({
+ requestState: DataTableRequestState.NEED_REFRESH,
+ })
+ );
}
- });
- }),
- default: () => next(action)
- });
+ // Now check if the state is still PENDING, if it moved to NEED_REFRESH
+ // then we need to reissue requestItems
+ de = getDataExplorer(
+ getState().dataExplorer,
+ service.getId()
+ );
+ const complete =
+ de.requestState === DataTableRequestState.PENDING;
+ dispatch(
+ actions.SET_REQUEST_STATE({
+ requestState: DataTableRequestState.IDLE,
+ })
+ );
+ if (complete) {
+ return;
+ }
+ break;
+ case DataTableRequestState.PENDING:
+ // State is PENDING, move it to NEED_REFRESH so that when the current request finishes it starts a new one.
+ dispatch(
+ actions.SET_REQUEST_STATE({
+ requestState: DataTableRequestState.NEED_REFRESH,
+ })
+ );
+ return;
+ case DataTableRequestState.NEED_REFRESH:
+ // Nothing to do right now.
+ return;
+ }
+ }
+ }
+ );
+ }),
+ default: () => next(action),
+ });
};
-};
+ };
// SPDX-License-Identifier: AGPL-3.0
import {
- DataColumn,
- resetSortDirection,
- SortDirection,
- toggleSortDirection
-} from "components/data-table/data-column";
-import { DataExplorerAction, dataExplorerActions, DataTableRequestState } from "./data-explorer-action";
-import { DataColumns, DataTableFetchMode } from "components/data-table/data-table";
-import { DataTableFilters } from "components/data-table-filters/data-table-filters-tree";
+ DataColumn,
+ resetSortDirection,
+ SortDirection,
+ toggleSortDirection,
+} from 'components/data-table/data-column';
+import {
+ DataExplorerAction,
+ dataExplorerActions,
+ DataTableRequestState,
+} from './data-explorer-action';
+import {
+ DataColumns,
+ DataTableFetchMode,
+} from 'components/data-table/data-table';
+import { DataTableFilters } from 'components/data-table-filters/data-table-filters-tree';
export interface DataExplorer {
- fetchMode: DataTableFetchMode;
- columns: DataColumns<any>;
- items: any[];
- itemsAvailable: number;
- page: number;
- rowsPerPage: number;
- rowsPerPageOptions: number[];
- searchValue: string;
- working?: boolean;
- requestState: DataTableRequestState;
+ fetchMode: DataTableFetchMode;
+ columns: DataColumns<any>;
+ items: any[];
+ itemsAvailable: number;
+ page: number;
+ rowsPerPage: number;
+ rowsPerPageOptions: number[];
+ searchValue: string;
+ working?: boolean;
+ requestState: DataTableRequestState;
}
export const initialDataExplorer: DataExplorer = {
- fetchMode: DataTableFetchMode.PAGINATED,
- columns: [],
- items: [],
- itemsAvailable: 0,
- page: 0,
- rowsPerPage: 50,
- rowsPerPageOptions: [10, 20, 50, 100, 200, 500],
- searchValue: "",
- requestState: DataTableRequestState.IDLE
+ fetchMode: DataTableFetchMode.PAGINATED,
+ columns: [],
+ items: [],
+ itemsAvailable: 0,
+ page: 0,
+ rowsPerPage: 50,
+ rowsPerPageOptions: [10, 20, 50, 100, 200, 500],
+ searchValue: '',
+ requestState: DataTableRequestState.IDLE,
};
export type DataExplorerState = Record<string, DataExplorer>;
-export const dataExplorerReducer = (state: DataExplorerState = {}, action: DataExplorerAction) =>
- dataExplorerActions.match(action, {
- CLEAR: ({ id }) =>
- update(state, id, explorer => ({ ...explorer, page: 0, itemsAvailable: 0, items: [] })),
-
- RESET_PAGINATION: ({ id }) =>
- update(state, id, explorer => ({ ...explorer, page: 0 })),
-
- SET_FETCH_MODE: ({ id, fetchMode }) =>
- update(state, id, explorer => ({ ...explorer, fetchMode })),
-
- SET_COLUMNS: ({ id, columns }) =>
- update(state, id, setColumns(columns)),
-
- SET_FILTERS: ({ id, columnName, filters }) =>
- update(state, id, mapColumns(setFilters(columnName, filters))),
-
- SET_ITEMS: ({ id, items, itemsAvailable, page, rowsPerPage }) =>
- update(state, id, explorer => ({ ...explorer, items, itemsAvailable, page: page || 0, rowsPerPage })),
-
- APPEND_ITEMS: ({ id, items, itemsAvailable, page, rowsPerPage }) =>
- update(state, id, explorer => ({
- ...explorer,
- items: state[id].items.concat(items),
- itemsAvailable: state[id].itemsAvailable + itemsAvailable,
- page,
- rowsPerPage
- })),
-
- SET_PAGE: ({ id, page }) =>
- update(state, id, explorer => ({ ...explorer, page })),
-
- SET_ROWS_PER_PAGE: ({ id, rowsPerPage }) =>
- update(state, id, explorer => ({ ...explorer, rowsPerPage })),
-
- SET_EXPLORER_SEARCH_VALUE: ({ id, searchValue }) =>
- update(state, id, explorer => ({ ...explorer, searchValue })),
-
- SET_REQUEST_STATE: ({ id, requestState }) =>
- update(state, id, explorer => ({ ...explorer, requestState })),
-
- TOGGLE_SORT: ({ id, columnName }) =>
- update(state, id, mapColumns(toggleSort(columnName))),
-
- TOGGLE_COLUMN: ({ id, columnName }) =>
- update(state, id, mapColumns(toggleColumn(columnName))),
-
- default: () => state
- });
-
-export const getDataExplorer = (state: DataExplorerState, id: string) =>
- state[id] || initialDataExplorer;
-
-export const getSortColumn = (dataExplorer: DataExplorer) => dataExplorer.columns.find((c: any) =>
- !!c.sortDirection && c.sortDirection !== SortDirection.NONE);
-
-const update = (state: DataExplorerState, id: string, updateFn: (dataExplorer: DataExplorer) => DataExplorer) =>
- ({ ...state, [id]: updateFn(getDataExplorer(state, id)) });
+export const dataExplorerReducer = (
+ state: DataExplorerState = {},
+ action: DataExplorerAction
+) => {
+ return dataExplorerActions.match(action, {
+ CLEAR: ({ id }) =>
+ update(state, id, (explorer) => ({
+ ...explorer,
+ page: 0,
+ itemsAvailable: 0,
+ items: [],
+ })),
+
+ RESET_PAGINATION: ({ id }) =>
+ update(state, id, (explorer) => ({ ...explorer, page: 0 })),
+
+ SET_FETCH_MODE: ({ id, fetchMode }) =>
+ update(state, id, (explorer) => ({ ...explorer, fetchMode })),
+
+ SET_COLUMNS: ({ id, columns }) => update(state, id, setColumns(columns)),
+
+ SET_FILTERS: ({ id, columnName, filters }) =>
+ update(state, id, mapColumns(setFilters(columnName, filters))),
+
+ SET_ITEMS: ({ id, items, itemsAvailable, page, rowsPerPage }) =>
+ update(state, id, (explorer) => ({
+ ...explorer,
+ items,
+ itemsAvailable,
+ page: page || 0,
+ rowsPerPage,
+ })),
+
+ APPEND_ITEMS: ({ id, items, itemsAvailable, page, rowsPerPage }) =>
+ update(state, id, (explorer) => ({
+ ...explorer,
+ items: state[id].items.concat(items),
+ itemsAvailable: state[id].itemsAvailable + itemsAvailable,
+ page,
+ rowsPerPage,
+ })),
+
+ SET_PAGE: ({ id, page }) =>
+ update(state, id, (explorer) => ({ ...explorer, page })),
+
+ SET_ROWS_PER_PAGE: ({ id, rowsPerPage }) =>
+ update(state, id, (explorer) => ({ ...explorer, rowsPerPage })),
+
+ SET_EXPLORER_SEARCH_VALUE: ({ id, searchValue }) =>
+ update(state, id, (explorer) => ({ ...explorer, searchValue })),
+
+ SET_REQUEST_STATE: ({ id, requestState }) =>
+ update(state, id, (explorer) => ({ ...explorer, requestState })),
+
+ TOGGLE_SORT: ({ id, columnName }) =>
+ update(state, id, mapColumns(toggleSort(columnName))),
+
+ TOGGLE_COLUMN: ({ id, columnName }) =>
+ update(state, id, mapColumns(toggleColumn(columnName))),
+
+ default: () => state,
+ });
+};
+export const getDataExplorer = (state: DataExplorerState, id: string) => {
+ const returnValue = state[id] || initialDataExplorer;
+ return returnValue;
+};
-const canUpdateColumns = (prevColumns: DataColumns<any>, nextColumns: DataColumns<any>) => {
- if (prevColumns.length !== nextColumns.length) {
- return true;
- }
- for (let i = 0; i < nextColumns.length; i++) {
- const pc = prevColumns[i];
- const nc = nextColumns[i];
- if (pc.key !== nc.key || pc.name !== nc.name) {
- return true;
- }
+export const getSortColumn = (dataExplorer: DataExplorer) =>
+ dataExplorer.columns.find(
+ (c: any) => !!c.sortDirection && c.sortDirection !== SortDirection.NONE
+ );
+
+const update = (
+ state: DataExplorerState,
+ id: string,
+ updateFn: (dataExplorer: DataExplorer) => DataExplorer
+) => ({ ...state, [id]: updateFn(getDataExplorer(state, id)) });
+
+const canUpdateColumns = (
+ prevColumns: DataColumns<any>,
+ nextColumns: DataColumns<any>
+) => {
+ if (prevColumns.length !== nextColumns.length) {
+ return true;
+ }
+ for (let i = 0; i < nextColumns.length; i++) {
+ const pc = prevColumns[i];
+ const nc = nextColumns[i];
+ if (pc.key !== nc.key || pc.name !== nc.name) {
+ return true;
}
- return false;
+ }
+ return false;
};
-const setColumns = (columns: DataColumns<any>) =>
- (dataExplorer: DataExplorer) =>
- ({ ...dataExplorer, columns: canUpdateColumns(dataExplorer.columns, columns) ? columns : dataExplorer.columns });
-
-const mapColumns = (mapFn: (column: DataColumn<any>) => DataColumn<any>) =>
- (dataExplorer: DataExplorer) =>
- ({ ...dataExplorer, columns: dataExplorer.columns.map(mapFn) });
-
-const toggleSort = (columnName: string) =>
- (column: DataColumn<any>) => column.name === columnName
- ? toggleSortDirection(column)
- : resetSortDirection(column);
-
-const toggleColumn = (columnName: string) =>
- (column: DataColumn<any>) => column.name === columnName
- ? { ...column, selected: !column.selected }
- : column;
-
-const setFilters = (columnName: string, filters: DataTableFilters) =>
- (column: DataColumn<any>) => column.name === columnName
- ? { ...column, filters }
- : column;
+const setColumns =
+ (columns: DataColumns<any>) => (dataExplorer: DataExplorer) => ({
+ ...dataExplorer,
+ columns: canUpdateColumns(dataExplorer.columns, columns)
+ ? columns
+ : dataExplorer.columns,
+ });
+
+const mapColumns =
+ (mapFn: (column: DataColumn<any>) => DataColumn<any>) =>
+ (dataExplorer: DataExplorer) => ({
+ ...dataExplorer,
+ columns: dataExplorer.columns.map(mapFn),
+ });
+
+const toggleSort = (columnName: string) => (column: DataColumn<any>) =>
+ column.name === columnName
+ ? toggleSortDirection(column)
+ : resetSortDirection(column);
+
+const toggleColumn = (columnName: string) => (column: DataColumn<any>) =>
+ column.name === columnName
+ ? { ...column, selected: !column.selected }
+ : column;
+
+const setFilters =
+ (columnName: string, filters: DataTableFilters) =>
+ (column: DataColumn<any>) =>
+ column.name === columnName ? { ...column, filters } : column;
import { RootState } from 'store/store';
import { ServiceRepository } from 'services/services';
import { Dispatch } from 'redux';
-import { groupBy } from 'lodash';
+import { groupBy, min, reverse } from 'lodash';
import { LogResource } from 'models/log';
import { LogService } from 'services/log-service/log-service';
import { ResourceEventMessage } from 'websocket/resource-event-message';
async (dispatch: Dispatch, getState: () => RootState, { logService }: ServiceRepository) => {
dispatch(processLogsPanelActions.RESET_PROCESS_LOGS_PANEL());
const process = getProcess(processUuid)(getState().resources);
+ const maxPageSize = getState().auth.config.clusterConfig.API.MaxItemsPerResponse;
if (process && process.container) {
- const logResources = await loadContainerLogs(process.container.uuid, logService);
+ const logResources = await loadContainerLogs(process.container.uuid, logService, maxPageSize);
const initialState = createInitialLogPanelState(logResources);
dispatch(processLogsPanelActions.INIT_PROCESS_LOGS_PANEL(initialState));
}
}
};
-const loadContainerLogs = async (containerUuid: string, logService: LogService) => {
+const loadContainerLogs = async (containerUuid: string, logService: LogService, maxPageSize: number) => {
const requestFilters = new FilterBuilder()
.addEqual('object_uuid', containerUuid)
.addIn('event_type', PROCESS_PANEL_LOG_EVENT_TYPES)
.getFilters();
- const requestOrder = new OrderBuilder<LogResource>()
+ const requestOrderAsc = new OrderBuilder<LogResource>()
.addAsc('eventAt')
.getOrder();
- const requestParams = {
- limit: MAX_AMOUNT_OF_LOGS,
+ const requestOrderDesc = new OrderBuilder<LogResource>()
+ .addDesc('eventAt')
+ .getOrder();
+ const { items, itemsAvailable } = await logService.list({
+ limit: maxPageSize,
filters: requestFilters,
- order: requestOrder,
- };
- const { items } = await logService.list(requestParams);
+ order: requestOrderAsc,
+ });
+
+ // Request additional logs if necessary
+ const remainingLogs = itemsAvailable - items.length;
+ if (remainingLogs > 0) {
+ const { items: itemsLast } = await logService.list({
+ limit: min([maxPageSize, remainingLogs]),
+ filters: requestFilters,
+ order: requestOrderDesc,
+ count: 'none',
+ })
+ if (remainingLogs - itemsLast.length > 0) {
+ const snipLine = {
+ ...items[items.length - 1],
+ eventType: LogEventType.SNIP,
+ properties: {
+ text: `================ 8< ================ 8< ========= Some log(s) were skipped ========= 8< ================ 8< ================`
+ },
+ }
+ return [...items, snipLine, ...reverse(itemsLast)];
+ }
+ return [...items, ...reverse(itemsLast)];
+ }
return items;
};
...grouped,
[key]: logsToLines(groupedLogResources[key])
}), {});
- const filters = [MAIN_FILTER_TYPE, ALL_FILTER_TYPE, ...Object.keys(groupedLogs)];
+ const filters = [
+ MAIN_FILTER_TYPE,
+ ALL_FILTER_TYPE,
+ ...Object.keys(groupedLogs)
+ ].filter(e => e !== LogEventType.SNIP);
const logs = {
[MAIN_FILTER_TYPE]: mainLogs,
[ALL_FILTER_TYPE]: allLogs,
}
};
-const MAX_AMOUNT_OF_LOGS = 10000;
-
const ALL_FILTER_TYPE = 'All logs';
const MAIN_FILTER_TYPE = 'Main logs';
LogEventType.CRUNCH_RUN,
LogEventType.STDERR,
LogEventType.STDOUT,
+ LogEventType.SNIP,
];
const PROCESS_PANEL_LOG_EVENT_TYPES = [
LogEventType.STDOUT,
LogEventType.CONTAINER,
LogEventType.KEEPSTORE,
+ LogEventType.SNIP,
];
import { matchProjectRoute, matchRunProcessRoute } from 'routes/routes';
import { RouterState } from "react-router-redux";
import { GroupClass } from "models/group";
+import { snackbarActions, SnackbarKind } from "store/snackbar/snackbar-actions";
+import { progressIndicatorActions } from "store/progress-indicator/progress-indicator-actions";
export interface ProjectCreateFormDialogData {
ownerUuid: string;
async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
dispatch(startSubmit(PROJECT_CREATE_FORM_NAME));
try {
- const newProject = await services.projectService.create(project);
+ dispatch(progressIndicatorActions.START_WORKING(PROJECT_CREATE_FORM_NAME));
+ const newProject = await services.projectService.create(project, false);
dispatch(dialogActions.CLOSE_DIALOG({ id: PROJECT_CREATE_FORM_NAME }));
dispatch(reset(PROJECT_CREATE_FORM_NAME));
return newProject;
const error = getCommonResourceServiceError(e);
if (error === CommonResourceServiceError.UNIQUE_NAME_VIOLATION) {
dispatch(stopSubmit(PROJECT_CREATE_FORM_NAME, { name: 'Project with the same name already exists.' } as FormErrors));
+ } else {
+ dispatch(stopSubmit(PROJECT_CREATE_FORM_NAME));
+ dispatch(dialogActions.CLOSE_DIALOG({ id: PROJECT_CREATE_FORM_NAME }));
+ const errMsg = e.errors
+ ? e.errors.join('')
+ : 'There was an error while creating the collection';
+ dispatch(snackbarActions.OPEN_SNACKBAR({
+ message: errMsg,
+ hideDuration: 2000,
+ kind: SnackbarKind.ERROR
+ }));
}
return undefined;
+ } finally {
+ dispatch(progressIndicatorActions.STOP_WORKING(PROJECT_CREATE_FORM_NAME));
}
};
import { ProjectProperties } from "./project-create-actions";
import { getResource } from "store/resources/resources";
import { ProjectResource } from "models/project";
+import { snackbarActions, SnackbarKind } from "store/snackbar/snackbar-actions";
export interface ProjectUpdateFormDialogData {
uuid: string;
name: project.name,
description: project.description,
properties: project.properties,
- });
+ },
+ false);
dispatch(projectPanelActions.REQUEST_ITEMS());
dispatch(reset(PROJECT_UPDATE_FORM_NAME));
dispatch(dialogActions.CLOSE_DIALOG({ id: PROJECT_UPDATE_FORM_NAME }));
const error = getCommonResourceServiceError(e);
if (error === CommonResourceServiceError.UNIQUE_NAME_VIOLATION) {
dispatch(stopSubmit(PROJECT_UPDATE_FORM_NAME, { name: 'Project with the same name already exists.' } as FormErrors));
+ } else {
+ dispatch(dialogActions.CLOSE_DIALOG({ id: PROJECT_UPDATE_FORM_NAME }));
+ const errMsg = e.errors
+ ? e.errors.join('')
+ : 'There was an error while updating the project';
+ dispatch(snackbarActions.OPEN_SNACKBAR({
+ message: errMsg,
+ hideDuration: 2000,
+ kind: SnackbarKind.ERROR }));
}
- return ;
+ return;
}
};
// SPDX-License-Identifier: AGPL-3.0
import { Dispatch } from 'redux';
-import { RootState } from "store/store";
-import { getUserUuid } from "common/getuser";
+import { RootState } from 'store/store';
+import { getUserUuid } from 'common/getuser';
import { loadDetailsPanel } from 'store/details-panel/details-panel-action';
import { snackbarActions, SnackbarKind } from 'store/snackbar/snackbar-actions';
-import { favoritePanelActions, loadFavoritePanel } from 'store/favorite-panel/favorite-panel-action';
import {
- getProjectPanelCurrentUuid,
- openProjectPanel,
- projectPanelActions,
- setIsProjectPanelTrashed
+ favoritePanelActions,
+ loadFavoritePanel,
+} from 'store/favorite-panel/favorite-panel-action';
+import {
+ getProjectPanelCurrentUuid,
+ openProjectPanel,
+ projectPanelActions,
+ setIsProjectPanelTrashed,
} from 'store/project-panel/project-panel-action';
import {
- activateSidePanelTreeItem,
- initSidePanelTree,
- loadSidePanelTreeProjects,
- SidePanelTreeCategory
+ activateSidePanelTreeItem,
+ initSidePanelTree,
+ loadSidePanelTreeProjects,
+ SidePanelTreeCategory,
} from 'store/side-panel-tree/side-panel-tree-actions';
import { updateResources } from 'store/resources/resources-actions';
import { projectPanelColumns } from 'views/project-panel/project-panel';
import { favoritePanelColumns } from 'views/favorite-panel/favorite-panel';
import { matchRootRoute } from 'routes/routes';
import {
- setBreadcrumbs,
- setGroupDetailsBreadcrumbs,
- setGroupsBreadcrumbs,
- setProcessBreadcrumbs,
- setSharedWithMeBreadcrumbs,
- setSidePanelBreadcrumbs,
- setTrashBreadcrumbs,
- setUsersBreadcrumbs,
- setMyAccountBreadcrumbs,
- setUserProfileBreadcrumbs,
+ setBreadcrumbs,
+ setGroupDetailsBreadcrumbs,
+ setGroupsBreadcrumbs,
+ setProcessBreadcrumbs,
+ setSharedWithMeBreadcrumbs,
+ setSidePanelBreadcrumbs,
+ setTrashBreadcrumbs,
+ setUsersBreadcrumbs,
+ setMyAccountBreadcrumbs,
+ setUserProfileBreadcrumbs,
} from 'store/breadcrumbs/breadcrumbs-actions';
-import { navigateTo, navigateToRootProject } from 'store/navigation/navigation-action';
+import {
+ navigateTo,
+ navigateToRootProject,
+} from 'store/navigation/navigation-action';
import { MoveToFormDialogData } from 'store/move-to-dialog/move-to-dialog';
import { ServiceRepository } from 'services/services';
import { getResource } from 'store/resources/resources';
import * as processMoveActions from 'store/processes/process-move-actions';
import * as processUpdateActions from 'store/processes/process-update-actions';
import * as processCopyActions from 'store/processes/process-copy-actions';
-import { trashPanelColumns } from "views/trash-panel/trash-panel";
-import { loadTrashPanel, trashPanelActions } from "store/trash-panel/trash-panel-action";
+import { trashPanelColumns } from 'views/trash-panel/trash-panel';
+import {
+ loadTrashPanel,
+ trashPanelActions,
+} from 'store/trash-panel/trash-panel-action';
import { loadProcessPanel } from 'store/process-panel/process-panel-actions';
import {
- loadSharedWithMePanel,
- sharedWithMePanelActions
+ loadSharedWithMePanel,
+ sharedWithMePanelActions,
} from 'store/shared-with-me-panel/shared-with-me-panel-actions';
import { CopyFormDialogData } from 'store/copy-dialog/copy-dialog';
import { workflowPanelActions } from 'store/workflow-panel/workflow-panel-actions';
import { loadSshKeysPanel } from 'store/auth/auth-action-ssh';
-import { loadLinkAccountPanel, linkAccountPanelActions } from 'store/link-account-panel/link-account-panel-actions';
+import {
+ loadLinkAccountPanel,
+ linkAccountPanelActions,
+} from 'store/link-account-panel/link-account-panel-actions';
import { loadSiteManagerPanel } from 'store/auth/auth-action-session';
import { workflowPanelColumns } from 'views/workflow-panel/workflow-panel-view';
import { progressIndicatorActions } from 'store/progress-indicator/progress-indicator-actions';
import { GroupContentsResource } from 'services/groups-service/groups-service';
import { MatchCases, ofType, unionize, UnionOf } from 'common/unionize';
import { loadRunProcessPanel } from 'store/run-process-panel/run-process-panel-actions';
-import { collectionPanelActions, loadCollectionPanel } from "store/collection-panel/collection-panel-action";
-import { CollectionResource } from "models/collection";
import {
- loadSearchResultsPanel,
- searchResultsPanelActions
+ collectionPanelActions,
+ loadCollectionPanel,
+} from 'store/collection-panel/collection-panel-action';
+import { CollectionResource } from 'models/collection';
+import {
+ loadSearchResultsPanel,
+ searchResultsPanelActions,
} from 'store/search-results-panel/search-results-panel-actions';
import { searchResultsPanelColumns } from 'views/search-results-panel/search-results-panel-view';
import { loadVirtualMachinesPanel } from 'store/virtual-machines/virtual-machines-actions';
import { loadKeepServicesPanel } from 'store/keep-services/keep-services-actions';
import { loadUsersPanel, userBindedActions } from 'store/users/users-actions';
import * as userProfilePanelActions from 'store/user-profile/user-profile-actions';
-import { linkPanelActions, loadLinkPanel } from 'store/link-panel/link-panel-actions';
+import {
+ linkPanelActions,
+ loadLinkPanel,
+} 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 { loadApiClientAuthorizationsPanel, apiClientAuthorizationsActions } from 'store/api-client-authorizations/api-client-authorizations-actions';
+import {
+ loadApiClientAuthorizationsPanel,
+ apiClientAuthorizationsActions,
+} from 'store/api-client-authorizations/api-client-authorizations-actions';
import { apiClientAuthorizationPanelColumns } from 'views/api-client-authorization-panel/api-client-authorization-panel-root';
import * as groupPanelActions from 'store/groups-panel/groups-panel-actions';
import { groupsPanelColumns } from 'views/groups-panel/groups-panel';
import * as groupDetailsPanelActions from 'store/group-details-panel/group-details-panel-actions';
-import { groupDetailsMembersPanelColumns, groupDetailsPermissionsPanelColumns } from 'views/group-details-panel/group-details-panel';
-import { DataTableFetchMode } from "components/data-table/data-table";
-import { loadPublicFavoritePanel, publicFavoritePanelActions } from 'store/public-favorites-panel/public-favorites-action';
+import {
+ groupDetailsMembersPanelColumns,
+ groupDetailsPermissionsPanelColumns,
+} from 'views/group-details-panel/group-details-panel';
+import { DataTableFetchMode } from 'components/data-table/data-table';
+import {
+ loadPublicFavoritePanel,
+ publicFavoritePanelActions,
+} from 'store/public-favorites-panel/public-favorites-action';
import { publicFavoritePanelColumns } from 'views/public-favorites-panel/public-favorites-panel';
-import { loadCollectionsContentAddressPanel, collectionsContentAddressActions } from 'store/collections-content-address-panel/collections-content-address-panel-actions';
+import {
+ loadCollectionsContentAddressPanel,
+ collectionsContentAddressActions,
+} from 'store/collections-content-address-panel/collections-content-address-panel-actions';
import { collectionContentAddressPanelColumns } from 'views/collection-content-address-panel/collection-content-address-panel';
import { subprocessPanelActions } from 'store/subprocess-panel/subprocess-panel-actions';
import { subprocessPanelColumns } from 'views/subprocess-panel/subprocess-panel-root';
-import { loadAllProcessesPanel, allProcessesPanelActions } from '../all-processes-panel/all-processes-panel-action';
+import {
+ loadAllProcessesPanel,
+ allProcessesPanelActions,
+} from '../all-processes-panel/all-processes-panel-action';
import { allProcessesPanelColumns } from 'views/all-processes-panel/all-processes-panel';
import { AdminMenuIcon } from 'components/icon/icon';
import { userProfileGroupsColumns } from 'views/user-profile-panel/user-profile-panel-root';
export const WORKBENCH_LOADING_SCREEN = 'workbenchLoadingScreen';
export const isWorkbenchLoading = (state: RootState) => {
- const progress = getProgressIndicator(WORKBENCH_LOADING_SCREEN)(state.progressIndicator);
- return progress ? progress.working : false;
+ const progress = getProgressIndicator(WORKBENCH_LOADING_SCREEN)(
+ state.progressIndicator
+ );
+ return progress ? progress.working : false;
};
-export const handleFirstTimeLoad = (action: any) =>
- async (dispatch: Dispatch<any>, getState: () => RootState) => {
- try {
- await dispatch(action);
- } finally {
- if (isWorkbenchLoading(getState())) {
- dispatch(progressIndicatorActions.STOP_WORKING(WORKBENCH_LOADING_SCREEN));
- }
- }
- };
-
-export const loadWorkbench = () =>
- async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- dispatch(progressIndicatorActions.START_WORKING(WORKBENCH_LOADING_SCREEN));
- const { auth, router } = getState();
- const { user } = auth;
- if (user) {
- dispatch(projectPanelActions.SET_COLUMNS({ columns: projectPanelColumns }));
- dispatch(favoritePanelActions.SET_COLUMNS({ columns: favoritePanelColumns }));
- dispatch(allProcessesPanelActions.SET_COLUMNS({ columns: allProcessesPanelColumns }));
- dispatch(publicFavoritePanelActions.SET_COLUMNS({ columns: publicFavoritePanelColumns }));
- dispatch(trashPanelActions.SET_COLUMNS({ columns: trashPanelColumns }));
- dispatch(sharedWithMePanelActions.SET_COLUMNS({ columns: projectPanelColumns }));
- dispatch(workflowPanelActions.SET_COLUMNS({ columns: workflowPanelColumns }));
- dispatch(searchResultsPanelActions.SET_FETCH_MODE({ fetchMode: DataTableFetchMode.INFINITE }));
- dispatch(searchResultsPanelActions.SET_COLUMNS({ columns: searchResultsPanelColumns }));
- dispatch(userBindedActions.SET_COLUMNS({ columns: userPanelColumns }));
- dispatch(groupPanelActions.GroupsPanelActions.SET_COLUMNS({ columns: groupsPanelColumns }));
- dispatch(groupDetailsPanelActions.GroupMembersPanelActions.SET_COLUMNS({ columns: groupDetailsMembersPanelColumns }));
- dispatch(groupDetailsPanelActions.GroupPermissionsPanelActions.SET_COLUMNS({ columns: groupDetailsPermissionsPanelColumns }));
- dispatch(userProfilePanelActions.UserProfileGroupsActions.SET_COLUMNS({ columns: userProfileGroupsColumns }));
- dispatch(linkPanelActions.SET_COLUMNS({ columns: linkPanelColumns }));
- dispatch(apiClientAuthorizationsActions.SET_COLUMNS({ columns: apiClientAuthorizationPanelColumns }));
- dispatch(collectionsContentAddressActions.SET_COLUMNS({ columns: collectionContentAddressPanelColumns }));
- dispatch(subprocessPanelActions.SET_COLUMNS({ columns: subprocessPanelColumns }));
-
- if (services.linkAccountService.getAccountToLink()) {
- dispatch(linkAccountPanelActions.HAS_SESSION_DATA());
- }
-
- dispatch<any>(initSidePanelTree());
- if (router.location) {
- const match = matchRootRoute(router.location.pathname);
- if (match) {
- dispatch<any>(navigateToRootProject);
- }
- }
- } else {
- dispatch(userIsNotAuthenticated);
+export const handleFirstTimeLoad =
+ (action: any) =>
+ async (dispatch: Dispatch<any>, getState: () => RootState) => {
+ try {
+ await dispatch(action);
+ } finally {
+ if (isWorkbenchLoading(getState())) {
+ dispatch(
+ progressIndicatorActions.STOP_WORKING(WORKBENCH_LOADING_SCREEN)
+ );
+ }
+ }
+ };
+
+export const loadWorkbench =
+ () =>
+ async (
+ dispatch: Dispatch,
+ getState: () => RootState,
+ services: ServiceRepository
+ ) => {
+ dispatch(progressIndicatorActions.START_WORKING(WORKBENCH_LOADING_SCREEN));
+ const { auth, router } = getState();
+ const { user } = auth;
+ if (user) {
+ dispatch(
+ projectPanelActions.SET_COLUMNS({ columns: projectPanelColumns })
+ );
+ dispatch(
+ favoritePanelActions.SET_COLUMNS({ columns: favoritePanelColumns })
+ );
+ dispatch(
+ allProcessesPanelActions.SET_COLUMNS({
+ columns: allProcessesPanelColumns,
+ })
+ );
+ dispatch(
+ publicFavoritePanelActions.SET_COLUMNS({
+ columns: publicFavoritePanelColumns,
+ })
+ );
+ dispatch(trashPanelActions.SET_COLUMNS({ columns: trashPanelColumns }));
+ dispatch(
+ sharedWithMePanelActions.SET_COLUMNS({ columns: projectPanelColumns })
+ );
+ dispatch(
+ workflowPanelActions.SET_COLUMNS({ columns: workflowPanelColumns })
+ );
+ dispatch(
+ searchResultsPanelActions.SET_FETCH_MODE({
+ fetchMode: DataTableFetchMode.INFINITE,
+ })
+ );
+ dispatch(
+ searchResultsPanelActions.SET_COLUMNS({
+ columns: searchResultsPanelColumns,
+ })
+ );
+ dispatch(userBindedActions.SET_COLUMNS({ columns: userPanelColumns }));
+ dispatch(
+ groupPanelActions.GroupsPanelActions.SET_COLUMNS({
+ columns: groupsPanelColumns,
+ })
+ );
+ dispatch(
+ groupDetailsPanelActions.GroupMembersPanelActions.SET_COLUMNS({
+ columns: groupDetailsMembersPanelColumns,
+ })
+ );
+ dispatch(
+ groupDetailsPanelActions.GroupPermissionsPanelActions.SET_COLUMNS({
+ columns: groupDetailsPermissionsPanelColumns,
+ })
+ );
+ dispatch(
+ userProfilePanelActions.UserProfileGroupsActions.SET_COLUMNS({
+ columns: userProfileGroupsColumns,
+ })
+ );
+ dispatch(linkPanelActions.SET_COLUMNS({ columns: linkPanelColumns }));
+ dispatch(
+ apiClientAuthorizationsActions.SET_COLUMNS({
+ columns: apiClientAuthorizationPanelColumns,
+ })
+ );
+ dispatch(
+ collectionsContentAddressActions.SET_COLUMNS({
+ columns: collectionContentAddressPanelColumns,
+ })
+ );
+ dispatch(
+ subprocessPanelActions.SET_COLUMNS({ columns: subprocessPanelColumns })
+ );
+
+ if (services.linkAccountService.getAccountToLink()) {
+ dispatch(linkAccountPanelActions.HAS_SESSION_DATA());
+ }
+
+ dispatch<any>(initSidePanelTree());
+ if (router.location) {
+ const match = matchRootRoute(router.location.pathname);
+ if (match) {
+ dispatch<any>(navigateToRootProject);
}
- };
+ }
+ } else {
+ dispatch(userIsNotAuthenticated);
+ }
+ };
export const loadFavorites = () =>
- handleFirstTimeLoad(
- (dispatch: Dispatch) => {
- dispatch<any>(activateSidePanelTreeItem(SidePanelTreeCategory.FAVORITES));
- dispatch<any>(loadFavoritePanel());
- dispatch<any>(setSidePanelBreadcrumbs(SidePanelTreeCategory.FAVORITES));
- });
+ handleFirstTimeLoad((dispatch: Dispatch) => {
+ dispatch<any>(activateSidePanelTreeItem(SidePanelTreeCategory.FAVORITES));
+ dispatch<any>(loadFavoritePanel());
+ dispatch<any>(setSidePanelBreadcrumbs(SidePanelTreeCategory.FAVORITES));
+ });
export const loadCollectionContentAddress = handleFirstTimeLoad(
- async (dispatch: Dispatch<any>) => {
- await dispatch(loadCollectionsContentAddressPanel());
- });
+ async (dispatch: Dispatch<any>) => {
+ await dispatch(loadCollectionsContentAddressPanel());
+ }
+);
export const loadTrash = () =>
- handleFirstTimeLoad(
- (dispatch: Dispatch) => {
- dispatch<any>(activateSidePanelTreeItem(SidePanelTreeCategory.TRASH));
- dispatch<any>(loadTrashPanel());
- dispatch<any>(setSidePanelBreadcrumbs(SidePanelTreeCategory.TRASH));
- });
+ handleFirstTimeLoad((dispatch: Dispatch) => {
+ dispatch<any>(activateSidePanelTreeItem(SidePanelTreeCategory.TRASH));
+ dispatch<any>(loadTrashPanel());
+ dispatch<any>(setSidePanelBreadcrumbs(SidePanelTreeCategory.TRASH));
+ });
export const loadAllProcesses = () =>
- handleFirstTimeLoad(
- (dispatch: Dispatch) => {
- dispatch<any>(activateSidePanelTreeItem(SidePanelTreeCategory.ALL_PROCESSES));
- dispatch<any>(loadAllProcessesPanel());
- dispatch<any>(setSidePanelBreadcrumbs(SidePanelTreeCategory.ALL_PROCESSES));
- }
+ handleFirstTimeLoad((dispatch: Dispatch) => {
+ dispatch<any>(
+ activateSidePanelTreeItem(SidePanelTreeCategory.ALL_PROCESSES)
);
+ dispatch<any>(loadAllProcessesPanel());
+ dispatch<any>(setSidePanelBreadcrumbs(SidePanelTreeCategory.ALL_PROCESSES));
+ });
export const loadProject = (uuid: string) =>
- handleFirstTimeLoad(
- async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
- const userUuid = getUserUuid(getState());
- dispatch(setIsProjectPanelTrashed(false));
- if (!userUuid) {
- return;
- }
- if (extractUuidKind(uuid) === ResourceKind.USER && userUuid !== uuid) {
- // Load another users home projects
- dispatch(finishLoadingProject(uuid));
- } else if (userUuid !== uuid) {
- await dispatch(finishLoadingProject(uuid));
- const match = await loadGroupContentsResource({ uuid, userUuid, services });
- match({
- OWNED: async () => {
- await dispatch(activateSidePanelTreeItem(uuid));
- dispatch<any>(setSidePanelBreadcrumbs(uuid));
- },
- SHARED: async () => {
- await dispatch(activateSidePanelTreeItem(uuid));
- dispatch<any>(setSharedWithMeBreadcrumbs(uuid));
- },
- TRASHED: async () => {
- await dispatch(activateSidePanelTreeItem(SidePanelTreeCategory.TRASH));
- dispatch<any>(setTrashBreadcrumbs(uuid));
- dispatch(setIsProjectPanelTrashed(true));
- }
- });
- } else {
- await dispatch(finishLoadingProject(userUuid));
- await dispatch(activateSidePanelTreeItem(userUuid));
- dispatch<any>(setSidePanelBreadcrumbs(userUuid));
- }
+ handleFirstTimeLoad(
+ async (
+ dispatch: Dispatch<any>,
+ getState: () => RootState,
+ services: ServiceRepository
+ ) => {
+ const userUuid = getUserUuid(getState());
+ dispatch(setIsProjectPanelTrashed(false));
+ if (!userUuid) {
+ return;
+ }
+ if (extractUuidKind(uuid) === ResourceKind.USER && userUuid !== uuid) {
+ // Load another users home projects
+ dispatch(finishLoadingProject(uuid));
+ } else if (userUuid !== uuid) {
+ await dispatch(finishLoadingProject(uuid));
+ const match = await loadGroupContentsResource({
+ uuid,
+ userUuid,
+ services,
+ });
+ match({
+ OWNED: async () => {
+ await dispatch(activateSidePanelTreeItem(uuid));
+ dispatch<any>(setSidePanelBreadcrumbs(uuid));
+ },
+ SHARED: async () => {
+ await dispatch(activateSidePanelTreeItem(uuid));
+ dispatch<any>(setSharedWithMeBreadcrumbs(uuid));
+ },
+ TRASHED: async () => {
+ await dispatch(
+ activateSidePanelTreeItem(SidePanelTreeCategory.TRASH)
+ );
+ dispatch<any>(setTrashBreadcrumbs(uuid));
+ dispatch(setIsProjectPanelTrashed(true));
+ },
});
+ } else {
+ await dispatch(finishLoadingProject(userUuid));
+ await dispatch(activateSidePanelTreeItem(userUuid));
+ dispatch<any>(setSidePanelBreadcrumbs(userUuid));
+ }
+ }
+ );
-export const createProject = (data: projectCreateActions.ProjectCreateFormDialogData) =>
- async (dispatch: Dispatch) => {
- const newProject = await dispatch<any>(projectCreateActions.createProject(data));
- if (newProject) {
- dispatch(snackbarActions.OPEN_SNACKBAR({
- message: "Project has been successfully created.",
- hideDuration: 2000,
- kind: SnackbarKind.SUCCESS
- }));
- await dispatch<any>(loadSidePanelTreeProjects(newProject.ownerUuid));
- dispatch<any>(navigateTo(newProject.uuid));
- }
- };
-
-export const moveProject = (data: MoveToFormDialogData) =>
- async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- try {
- const oldProject = getResource(data.uuid)(getState().resources);
- const oldOwnerUuid = oldProject ? oldProject.ownerUuid : '';
- const movedProject = await dispatch<any>(projectMoveActions.moveProject(data));
- if (movedProject) {
- dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Project has been moved', hideDuration: 2000, kind: SnackbarKind.SUCCESS }));
- if (oldProject) {
- await dispatch<any>(loadSidePanelTreeProjects(oldProject.ownerUuid));
- }
- dispatch<any>(reloadProjectMatchingUuid([oldOwnerUuid, movedProject.ownerUuid, movedProject.uuid]));
- }
- } catch (e) {
- dispatch(snackbarActions.OPEN_SNACKBAR({ message: e.message, hideDuration: 2000, kind: SnackbarKind.ERROR }));
- }
- };
-
-export const updateProject = (data: projectUpdateActions.ProjectUpdateFormDialogData) =>
- async (dispatch: Dispatch) => {
- const updatedProject = await dispatch<any>(projectUpdateActions.updateProject(data));
- if (updatedProject) {
- dispatch(snackbarActions.OPEN_SNACKBAR({
- message: "Project has been successfully updated.",
- hideDuration: 2000,
- kind: SnackbarKind.SUCCESS
- }));
- await dispatch<any>(loadSidePanelTreeProjects(updatedProject.ownerUuid));
- dispatch<any>(reloadProjectMatchingUuid([updatedProject.ownerUuid, updatedProject.uuid]));
- }
- };
-
-export const updateGroup = (data: projectUpdateActions.ProjectUpdateFormDialogData) =>
- async (dispatch: Dispatch) => {
- const updatedGroup = await dispatch<any>(groupPanelActions.updateGroup(data));
- if (updatedGroup) {
- dispatch(snackbarActions.OPEN_SNACKBAR({
- message: "Group has been successfully updated.",
- hideDuration: 2000,
- kind: SnackbarKind.SUCCESS
- }));
- await dispatch<any>(loadSidePanelTreeProjects(updatedGroup.ownerUuid));
- dispatch<any>(reloadProjectMatchingUuid([updatedGroup.ownerUuid, updatedGroup.uuid]));
+export const createProject =
+ (data: projectCreateActions.ProjectCreateFormDialogData) =>
+ async (dispatch: Dispatch) => {
+ const newProject = await dispatch<any>(
+ projectCreateActions.createProject(data)
+ );
+ if (newProject) {
+ dispatch(
+ snackbarActions.OPEN_SNACKBAR({
+ message: 'Project has been successfully created.',
+ hideDuration: 2000,
+ kind: SnackbarKind.SUCCESS,
+ })
+ );
+ await dispatch<any>(loadSidePanelTreeProjects(newProject.ownerUuid));
+ dispatch<any>(navigateTo(newProject.uuid));
+ }
+ };
+
+export const moveProject =
+ (data: MoveToFormDialogData) =>
+ async (
+ dispatch: Dispatch,
+ getState: () => RootState,
+ services: ServiceRepository
+ ) => {
+ try {
+ const oldProject = getResource(data.uuid)(getState().resources);
+ const oldOwnerUuid = oldProject ? oldProject.ownerUuid : '';
+ const movedProject = await dispatch<any>(
+ projectMoveActions.moveProject(data)
+ );
+ if (movedProject) {
+ dispatch(
+ snackbarActions.OPEN_SNACKBAR({
+ message: 'Project has been moved',
+ hideDuration: 2000,
+ kind: SnackbarKind.SUCCESS,
+ })
+ );
+ if (oldProject) {
+ await dispatch<any>(loadSidePanelTreeProjects(oldProject.ownerUuid));
}
- };
+ dispatch<any>(
+ reloadProjectMatchingUuid([
+ oldOwnerUuid,
+ movedProject.ownerUuid,
+ movedProject.uuid,
+ ])
+ );
+ }
+ } catch (e) {
+ dispatch(
+ snackbarActions.OPEN_SNACKBAR({
+ message: e.message,
+ hideDuration: 2000,
+ kind: SnackbarKind.ERROR,
+ })
+ );
+ }
+ };
+
+export const updateProject =
+ (data: projectUpdateActions.ProjectUpdateFormDialogData) =>
+ async (dispatch: Dispatch) => {
+ const updatedProject = await dispatch<any>(
+ projectUpdateActions.updateProject(data)
+ );
+ if (updatedProject) {
+ dispatch(
+ snackbarActions.OPEN_SNACKBAR({
+ message: 'Project has been successfully updated.',
+ hideDuration: 2000,
+ kind: SnackbarKind.SUCCESS,
+ })
+ );
+ await dispatch<any>(loadSidePanelTreeProjects(updatedProject.ownerUuid));
+ dispatch<any>(
+ reloadProjectMatchingUuid([
+ updatedProject.ownerUuid,
+ updatedProject.uuid,
+ ])
+ );
+ }
+ };
+
+export const updateGroup =
+ (data: projectUpdateActions.ProjectUpdateFormDialogData) =>
+ async (dispatch: Dispatch) => {
+ const updatedGroup = await dispatch<any>(
+ groupPanelActions.updateGroup(data)
+ );
+ if (updatedGroup) {
+ dispatch(
+ snackbarActions.OPEN_SNACKBAR({
+ message: 'Group has been successfully updated.',
+ hideDuration: 2000,
+ kind: SnackbarKind.SUCCESS,
+ })
+ );
+ await dispatch<any>(loadSidePanelTreeProjects(updatedGroup.ownerUuid));
+ dispatch<any>(
+ reloadProjectMatchingUuid([updatedGroup.ownerUuid, updatedGroup.uuid])
+ );
+ }
+ };
export const loadCollection = (uuid: string) =>
- handleFirstTimeLoad(
- async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
- const userUuid = getUserUuid(getState());
- if (userUuid) {
- const match = await loadGroupContentsResource({ uuid, userUuid, services });
- match({
- OWNED: collection => {
- dispatch(collectionPanelActions.SET_COLLECTION(collection as CollectionResource));
- dispatch(updateResources([collection]));
- dispatch(activateSidePanelTreeItem(collection.ownerUuid));
- dispatch(setSidePanelBreadcrumbs(collection.ownerUuid));
- dispatch(loadCollectionPanel(collection.uuid));
- },
- SHARED: collection => {
- dispatch(collectionPanelActions.SET_COLLECTION(collection as CollectionResource));
- dispatch(updateResources([collection]));
- dispatch<any>(setSharedWithMeBreadcrumbs(collection.ownerUuid));
- dispatch(activateSidePanelTreeItem(collection.ownerUuid));
- dispatch(loadCollectionPanel(collection.uuid));
- },
- TRASHED: collection => {
- dispatch(collectionPanelActions.SET_COLLECTION(collection as CollectionResource));
- dispatch(updateResources([collection]));
- dispatch(setTrashBreadcrumbs(''));
- dispatch(activateSidePanelTreeItem(SidePanelTreeCategory.TRASH));
- dispatch(loadCollectionPanel(collection.uuid));
- },
- });
- }
+ handleFirstTimeLoad(
+ async (
+ dispatch: Dispatch<any>,
+ getState: () => RootState,
+ services: ServiceRepository
+ ) => {
+ const userUuid = getUserUuid(getState());
+ if (userUuid) {
+ const match = await loadGroupContentsResource({
+ uuid,
+ userUuid,
+ services,
});
+ match({
+ OWNED: (collection) => {
+ dispatch(
+ collectionPanelActions.SET_COLLECTION(
+ collection as CollectionResource
+ )
+ );
+ dispatch(updateResources([collection]));
+ dispatch(activateSidePanelTreeItem(collection.ownerUuid));
+ dispatch(setSidePanelBreadcrumbs(collection.ownerUuid));
+ dispatch(loadCollectionPanel(collection.uuid));
+ },
+ SHARED: (collection) => {
+ dispatch(
+ collectionPanelActions.SET_COLLECTION(
+ collection as CollectionResource
+ )
+ );
+ dispatch(updateResources([collection]));
+ dispatch<any>(setSharedWithMeBreadcrumbs(collection.ownerUuid));
+ dispatch(activateSidePanelTreeItem(collection.ownerUuid));
+ dispatch(loadCollectionPanel(collection.uuid));
+ },
+ TRASHED: (collection) => {
+ dispatch(
+ collectionPanelActions.SET_COLLECTION(
+ collection as CollectionResource
+ )
+ );
+ dispatch(updateResources([collection]));
+ dispatch(setTrashBreadcrumbs(''));
+ dispatch(activateSidePanelTreeItem(SidePanelTreeCategory.TRASH));
+ dispatch(loadCollectionPanel(collection.uuid));
+ },
+ });
+ }
+ }
+ );
-export const createCollection = (data: collectionCreateActions.CollectionCreateFormDialogData) =>
- async (dispatch: Dispatch) => {
- const collection = await dispatch<any>(collectionCreateActions.createCollection(data));
- if (collection) {
- dispatch(snackbarActions.OPEN_SNACKBAR({
- message: "Collection has been successfully created.",
- hideDuration: 2000,
- kind: SnackbarKind.SUCCESS
- }));
- dispatch<any>(updateResources([collection]));
- dispatch<any>(navigateTo(collection.uuid));
- }
- };
-
-export const copyCollection = (data: CopyFormDialogData) =>
- async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- try {
- const copyToProject = getResource(data.ownerUuid)(getState().resources);
- const collection = await dispatch<any>(collectionCopyActions.copyCollection(data));
- if (copyToProject && collection) {
- dispatch<any>(reloadProjectMatchingUuid([copyToProject.uuid]));
- dispatch(snackbarActions.OPEN_SNACKBAR({
- message: 'Collection has been copied.',
- hideDuration: 3000,
- kind: SnackbarKind.SUCCESS,
- link: collection.ownerUuid
- }));
- }
- } catch (e) {
- dispatch(snackbarActions.OPEN_SNACKBAR({ message: e.message, hideDuration: 2000, kind: SnackbarKind.ERROR }));
- }
- };
-
-export const moveCollection = (data: MoveToFormDialogData) =>
- async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- try {
- const collection = await dispatch<any>(collectionMoveActions.moveCollection(data));
- dispatch<any>(updateResources([collection]));
- dispatch<any>(reloadProjectMatchingUuid([collection.ownerUuid]));
- dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Collection has been moved.', hideDuration: 2000, kind: SnackbarKind.SUCCESS }));
- } catch (e) {
- dispatch(snackbarActions.OPEN_SNACKBAR({ message: e.message, hideDuration: 2000, kind: SnackbarKind.ERROR }));
- }
- };
+export const createCollection =
+ (data: collectionCreateActions.CollectionCreateFormDialogData) =>
+ async (dispatch: Dispatch) => {
+ const collection = await dispatch<any>(
+ collectionCreateActions.createCollection(data)
+ );
+ if (collection) {
+ dispatch(
+ snackbarActions.OPEN_SNACKBAR({
+ message: 'Collection has been successfully created.',
+ hideDuration: 2000,
+ kind: SnackbarKind.SUCCESS,
+ })
+ );
+ dispatch<any>(updateResources([collection]));
+ dispatch<any>(navigateTo(collection.uuid));
+ }
+ };
+
+export const copyCollection =
+ (data: CopyFormDialogData) =>
+ async (
+ dispatch: Dispatch,
+ getState: () => RootState,
+ services: ServiceRepository
+ ) => {
+ try {
+ const copyToProject = getResource(data.ownerUuid)(getState().resources);
+ const collection = await dispatch<any>(
+ collectionCopyActions.copyCollection(data)
+ );
+ if (copyToProject && collection) {
+ dispatch<any>(reloadProjectMatchingUuid([copyToProject.uuid]));
+ dispatch(
+ snackbarActions.OPEN_SNACKBAR({
+ message: 'Collection has been copied.',
+ hideDuration: 3000,
+ kind: SnackbarKind.SUCCESS,
+ link: collection.ownerUuid,
+ })
+ );
+ }
+ } catch (e) {
+ dispatch(
+ snackbarActions.OPEN_SNACKBAR({
+ message: e.message,
+ hideDuration: 2000,
+ kind: SnackbarKind.ERROR,
+ })
+ );
+ }
+ };
+
+export const moveCollection =
+ (data: MoveToFormDialogData) =>
+ async (
+ dispatch: Dispatch,
+ getState: () => RootState,
+ services: ServiceRepository
+ ) => {
+ try {
+ const collection = await dispatch<any>(
+ collectionMoveActions.moveCollection(data)
+ );
+ dispatch<any>(updateResources([collection]));
+ dispatch<any>(reloadProjectMatchingUuid([collection.ownerUuid]));
+ dispatch(
+ snackbarActions.OPEN_SNACKBAR({
+ message: 'Collection has been moved.',
+ hideDuration: 2000,
+ kind: SnackbarKind.SUCCESS,
+ })
+ );
+ } catch (e) {
+ dispatch(
+ snackbarActions.OPEN_SNACKBAR({
+ message: e.message,
+ hideDuration: 2000,
+ kind: SnackbarKind.ERROR,
+ })
+ );
+ }
+ };
export const loadProcess = (uuid: string) =>
- handleFirstTimeLoad(
- async (dispatch: Dispatch, getState: () => RootState) => {
- dispatch<any>(loadProcessPanel(uuid));
- const process = await dispatch<any>(processesActions.loadProcess(uuid));
- await dispatch<any>(activateSidePanelTreeItem(process.containerRequest.ownerUuid));
- dispatch<any>(setProcessBreadcrumbs(uuid));
- dispatch<any>(loadDetailsPanel(uuid));
- });
+ handleFirstTimeLoad(async (dispatch: Dispatch, getState: () => RootState) => {
+ dispatch<any>(loadProcessPanel(uuid));
+ const process = await dispatch<any>(processesActions.loadProcess(uuid));
+ await dispatch<any>(
+ activateSidePanelTreeItem(process.containerRequest.ownerUuid)
+ );
+ dispatch<any>(setProcessBreadcrumbs(uuid));
+ dispatch<any>(loadDetailsPanel(uuid));
+ });
+
+export const updateProcess =
+ (data: processUpdateActions.ProcessUpdateFormDialogData) =>
+ async (dispatch: Dispatch) => {
+ try {
+ const process = await dispatch<any>(
+ processUpdateActions.updateProcess(data)
+ );
+ if (process) {
+ dispatch(
+ snackbarActions.OPEN_SNACKBAR({
+ message: 'Process has been successfully updated.',
+ hideDuration: 2000,
+ kind: SnackbarKind.SUCCESS,
+ })
+ );
+ dispatch<any>(updateResources([process]));
+ dispatch<any>(reloadProjectMatchingUuid([process.ownerUuid]));
+ }
+ } catch (e) {
+ dispatch(
+ snackbarActions.OPEN_SNACKBAR({
+ message: e.message,
+ hideDuration: 2000,
+ kind: SnackbarKind.ERROR,
+ })
+ );
+ }
+ };
-export const updateProcess = (data: processUpdateActions.ProcessUpdateFormDialogData) =>
- async (dispatch: Dispatch) => {
- try {
- const process = await dispatch<any>(processUpdateActions.updateProcess(data));
- if (process) {
- dispatch(snackbarActions.OPEN_SNACKBAR({
- message: "Process has been successfully updated.",
- hideDuration: 2000,
- kind: SnackbarKind.SUCCESS
- }));
- dispatch<any>(updateResources([process]));
- dispatch<any>(reloadProjectMatchingUuid([process.ownerUuid]));
- }
- } catch (e) {
- dispatch(snackbarActions.OPEN_SNACKBAR({ message: e.message, hideDuration: 2000, kind: SnackbarKind.ERROR }));
- }
- };
-
-export const moveProcess = (data: MoveToFormDialogData) =>
- async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- try {
- const process = await dispatch<any>(processMoveActions.moveProcess(data));
- dispatch<any>(updateResources([process]));
- dispatch<any>(reloadProjectMatchingUuid([process.ownerUuid]));
- dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Process has been moved.', hideDuration: 2000, kind: SnackbarKind.SUCCESS }));
- } catch (e) {
- dispatch(snackbarActions.OPEN_SNACKBAR({ message: e.message, hideDuration: 2000, kind: SnackbarKind.ERROR }));
- }
- };
-
-export const copyProcess = (data: CopyFormDialogData) =>
- async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- try {
- const process = await dispatch<any>(processCopyActions.copyProcess(data));
- dispatch<any>(updateResources([process]));
- dispatch<any>(reloadProjectMatchingUuid([process.ownerUuid]));
- dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Process has been copied.', hideDuration: 2000, kind: SnackbarKind.SUCCESS }));
- } catch (e) {
- dispatch(snackbarActions.OPEN_SNACKBAR({ message: e.message, hideDuration: 2000, kind: SnackbarKind.ERROR }));
- }
- };
+export const moveProcess =
+ (data: MoveToFormDialogData) =>
+ async (
+ dispatch: Dispatch,
+ getState: () => RootState,
+ services: ServiceRepository
+ ) => {
+ try {
+ const process = await dispatch<any>(processMoveActions.moveProcess(data));
+ dispatch<any>(updateResources([process]));
+ dispatch<any>(reloadProjectMatchingUuid([process.ownerUuid]));
+ dispatch(
+ snackbarActions.OPEN_SNACKBAR({
+ message: 'Process has been moved.',
+ hideDuration: 2000,
+ kind: SnackbarKind.SUCCESS,
+ })
+ );
+ } catch (e) {
+ dispatch(
+ snackbarActions.OPEN_SNACKBAR({
+ message: e.message,
+ hideDuration: 2000,
+ kind: SnackbarKind.ERROR,
+ })
+ );
+ }
+ };
+
+export const copyProcess =
+ (data: CopyFormDialogData) =>
+ async (
+ dispatch: Dispatch,
+ getState: () => RootState,
+ services: ServiceRepository
+ ) => {
+ try {
+ const process = await dispatch<any>(processCopyActions.copyProcess(data));
+ dispatch<any>(updateResources([process]));
+ dispatch<any>(reloadProjectMatchingUuid([process.ownerUuid]));
+ dispatch(
+ snackbarActions.OPEN_SNACKBAR({
+ message: 'Process has been copied.',
+ hideDuration: 2000,
+ kind: SnackbarKind.SUCCESS,
+ })
+ );
+ } catch (e) {
+ dispatch(
+ snackbarActions.OPEN_SNACKBAR({
+ message: e.message,
+ hideDuration: 2000,
+ kind: SnackbarKind.ERROR,
+ })
+ );
+ }
+ };
export const resourceIsNotLoaded = (uuid: string) =>
- snackbarActions.OPEN_SNACKBAR({
- message: `Resource identified by ${uuid} is not loaded.`,
- kind: SnackbarKind.ERROR
- });
+ snackbarActions.OPEN_SNACKBAR({
+ message: `Resource identified by ${uuid} is not loaded.`,
+ kind: SnackbarKind.ERROR,
+ });
export const userIsNotAuthenticated = snackbarActions.OPEN_SNACKBAR({
- message: 'User is not authenticated',
- kind: SnackbarKind.ERROR
+ message: 'User is not authenticated',
+ kind: SnackbarKind.ERROR,
});
export const couldNotLoadUser = snackbarActions.OPEN_SNACKBAR({
- message: 'Could not load user',
- kind: SnackbarKind.ERROR
+ message: 'Could not load user',
+ kind: SnackbarKind.ERROR,
});
-export const reloadProjectMatchingUuid = (matchingUuids: string[]) =>
- async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- const currentProjectPanelUuid = getProjectPanelCurrentUuid(getState());
- if (currentProjectPanelUuid && matchingUuids.some(uuid => uuid === currentProjectPanelUuid)) {
- dispatch<any>(loadProject(currentProjectPanelUuid));
- }
- };
+export const reloadProjectMatchingUuid =
+ (matchingUuids: string[]) =>
+ async (
+ dispatch: Dispatch,
+ getState: () => RootState,
+ services: ServiceRepository
+ ) => {
+ const currentProjectPanelUuid = getProjectPanelCurrentUuid(getState());
+ if (
+ currentProjectPanelUuid &&
+ matchingUuids.some((uuid) => uuid === currentProjectPanelUuid)
+ ) {
+ dispatch<any>(loadProject(currentProjectPanelUuid));
+ }
+ };
-export const loadSharedWithMe = handleFirstTimeLoad(async (dispatch: Dispatch) => {
+export const loadSharedWithMe = handleFirstTimeLoad(
+ async (dispatch: Dispatch) => {
dispatch<any>(loadSharedWithMePanel());
- await dispatch<any>(activateSidePanelTreeItem(SidePanelTreeCategory.SHARED_WITH_ME));
- await dispatch<any>(setSidePanelBreadcrumbs(SidePanelTreeCategory.SHARED_WITH_ME));
-});
+ await dispatch<any>(
+ activateSidePanelTreeItem(SidePanelTreeCategory.SHARED_WITH_ME)
+ );
+ await dispatch<any>(
+ setSidePanelBreadcrumbs(SidePanelTreeCategory.SHARED_WITH_ME)
+ );
+ }
+);
export const loadRunProcess = handleFirstTimeLoad(
- async (dispatch: Dispatch) => {
- await dispatch<any>(loadRunProcessPanel());
- }
+ async (dispatch: Dispatch) => {
+ await dispatch<any>(loadRunProcessPanel());
+ }
);
export const loadPublicFavorites = () =>
- handleFirstTimeLoad(
- (dispatch: Dispatch) => {
- dispatch<any>(activateSidePanelTreeItem(SidePanelTreeCategory.PUBLIC_FAVORITES));
- dispatch<any>(loadPublicFavoritePanel());
- dispatch<any>(setSidePanelBreadcrumbs(SidePanelTreeCategory.PUBLIC_FAVORITES));
- });
+ handleFirstTimeLoad((dispatch: Dispatch) => {
+ dispatch<any>(
+ activateSidePanelTreeItem(SidePanelTreeCategory.PUBLIC_FAVORITES)
+ );
+ dispatch<any>(loadPublicFavoritePanel());
+ dispatch<any>(
+ setSidePanelBreadcrumbs(SidePanelTreeCategory.PUBLIC_FAVORITES)
+ );
+ });
export const loadSearchResults = handleFirstTimeLoad(
- async (dispatch: Dispatch<any>) => {
- await dispatch(loadSearchResultsPanel());
- });
+ async (dispatch: Dispatch<any>) => {
+ await dispatch(loadSearchResultsPanel());
+ }
+);
export const loadLinks = handleFirstTimeLoad(
- async (dispatch: Dispatch<any>) => {
- await dispatch(loadLinkPanel());
- });
+ async (dispatch: Dispatch<any>) => {
+ await dispatch(loadLinkPanel());
+ }
+);
export const loadVirtualMachines = handleFirstTimeLoad(
- async (dispatch: Dispatch<any>) => {
- await dispatch(loadVirtualMachinesPanel());
- dispatch(setBreadcrumbs([{ label: 'Virtual Machines' }]));
- });
+ async (dispatch: Dispatch<any>) => {
+ await dispatch(loadVirtualMachinesPanel());
+ dispatch(setBreadcrumbs([{ label: 'Virtual Machines' }]));
+ }
+);
export const loadVirtualMachinesAdmin = handleFirstTimeLoad(
- async (dispatch: Dispatch<any>) => {
- await dispatch(loadVirtualMachinesPanel());
- dispatch(setBreadcrumbs([{ label: 'Virtual Machines Admin', icon: AdminMenuIcon }]));
- });
+ async (dispatch: Dispatch<any>) => {
+ await dispatch(loadVirtualMachinesPanel());
+ dispatch(
+ setBreadcrumbs([{ label: 'Virtual Machines Admin', icon: AdminMenuIcon }])
+ );
+ }
+);
export const loadRepositories = handleFirstTimeLoad(
- async (dispatch: Dispatch<any>) => {
- await dispatch(loadRepositoriesPanel());
- dispatch(setBreadcrumbs([{ label: 'Repositories' }]));
- });
+ async (dispatch: Dispatch<any>) => {
+ await dispatch(loadRepositoriesPanel());
+ dispatch(setBreadcrumbs([{ label: 'Repositories' }]));
+ }
+);
export const loadSshKeys = handleFirstTimeLoad(
- async (dispatch: Dispatch<any>) => {
- await dispatch(loadSshKeysPanel());
- });
+ async (dispatch: Dispatch<any>) => {
+ await dispatch(loadSshKeysPanel());
+ }
+);
export const loadSiteManager = handleFirstTimeLoad(
- async (dispatch: Dispatch<any>) => {
- await dispatch(loadSiteManagerPanel());
- });
+ async (dispatch: Dispatch<any>) => {
+ await dispatch(loadSiteManagerPanel());
+ }
+);
export const loadUserProfile = (userUuid?: string) =>
- handleFirstTimeLoad(
- (dispatch: Dispatch<any>) => {
- if (userUuid) {
- dispatch(setUserProfileBreadcrumbs(userUuid));
- dispatch(userProfilePanelActions.loadUserProfilePanel(userUuid));
- } else {
- dispatch(setMyAccountBreadcrumbs());
- dispatch(userProfilePanelActions.loadUserProfilePanel());
- }
- }
- );
+ handleFirstTimeLoad((dispatch: Dispatch<any>) => {
+ if (userUuid) {
+ dispatch(setUserProfileBreadcrumbs(userUuid));
+ dispatch(userProfilePanelActions.loadUserProfilePanel(userUuid));
+ } else {
+ dispatch(setMyAccountBreadcrumbs());
+ dispatch(userProfilePanelActions.loadUserProfilePanel());
+ }
+ });
export const loadLinkAccount = handleFirstTimeLoad(
- (dispatch: Dispatch<any>) => {
- dispatch(loadLinkAccountPanel());
- });
+ (dispatch: Dispatch<any>) => {
+ dispatch(loadLinkAccountPanel());
+ }
+);
export const loadKeepServices = handleFirstTimeLoad(
- async (dispatch: Dispatch<any>) => {
- await dispatch(loadKeepServicesPanel());
- });
+ async (dispatch: Dispatch<any>) => {
+ await dispatch(loadKeepServicesPanel());
+ }
+);
export const loadUsers = handleFirstTimeLoad(
- async (dispatch: Dispatch<any>) => {
- await dispatch(loadUsersPanel());
- dispatch(setUsersBreadcrumbs());
- });
+ async (dispatch: Dispatch<any>) => {
+ await dispatch(loadUsersPanel());
+ dispatch(setUsersBreadcrumbs());
+ }
+);
export const loadApiClientAuthorizations = handleFirstTimeLoad(
- async (dispatch: Dispatch<any>) => {
- await dispatch(loadApiClientAuthorizationsPanel());
- });
+ async (dispatch: Dispatch<any>) => {
+ await dispatch(loadApiClientAuthorizationsPanel());
+ }
+);
export const loadGroupsPanel = handleFirstTimeLoad(
- (dispatch: Dispatch<any>) => {
- dispatch(setGroupsBreadcrumbs());
- dispatch(groupPanelActions.loadGroupsPanel());
- });
-
+ (dispatch: Dispatch<any>) => {
+ dispatch(setGroupsBreadcrumbs());
+ dispatch(groupPanelActions.loadGroupsPanel());
+ }
+);
export const loadGroupDetailsPanel = (groupUuid: string) =>
- handleFirstTimeLoad(
- (dispatch: Dispatch<any>) => {
- dispatch(setGroupDetailsBreadcrumbs(groupUuid));
- dispatch(groupDetailsPanelActions.loadGroupDetailsPanel(groupUuid));
- });
-
-const finishLoadingProject = (project: GroupContentsResource | string) =>
- async (dispatch: Dispatch<any>) => {
- const uuid = typeof project === 'string' ? project : project.uuid;
- dispatch(openProjectPanel(uuid));
- dispatch(loadDetailsPanel(uuid));
- if (typeof project !== 'string') {
- dispatch(updateResources([project]));
- }
- };
+ handleFirstTimeLoad((dispatch: Dispatch<any>) => {
+ dispatch(setGroupDetailsBreadcrumbs(groupUuid));
+ dispatch(groupDetailsPanelActions.loadGroupDetailsPanel(groupUuid));
+ });
+
+const finishLoadingProject =
+ (project: GroupContentsResource | string) =>
+ async (dispatch: Dispatch<any>) => {
+ const uuid = typeof project === 'string' ? project : project.uuid;
+ dispatch(openProjectPanel(uuid));
+ dispatch(loadDetailsPanel(uuid));
+ if (typeof project !== 'string') {
+ dispatch(updateResources([project]));
+ }
+ };
const loadGroupContentsResource = async (params: {
- uuid: string,
- userUuid: string,
- services: ServiceRepository
+ uuid: string;
+ userUuid: string;
+ services: ServiceRepository;
}) => {
- const filters = new FilterBuilder()
- .addEqual('uuid', params.uuid)
- .getFilters();
- const { items } = await params.services.groupsService.contents(params.userUuid, {
- filters,
- recursive: true,
- includeTrash: true,
- });
- const resource = items.shift();
- let handler: GroupContentsHandler;
- if (resource) {
- handler = (resource.kind === ResourceKind.COLLECTION || resource.kind === ResourceKind.PROJECT) && resource.isTrashed
- ? groupContentsHandlers.TRASHED(resource)
- : groupContentsHandlers.OWNED(resource);
+ const filters = new FilterBuilder()
+ .addEqual('uuid', params.uuid)
+ .getFilters();
+ const { items } = await params.services.groupsService.contents(
+ params.userUuid,
+ {
+ filters,
+ recursive: true,
+ includeTrash: true,
+ }
+ );
+ const resource = items.shift();
+ let handler: GroupContentsHandler;
+ if (resource) {
+ handler =
+ (resource.kind === ResourceKind.COLLECTION ||
+ resource.kind === ResourceKind.PROJECT) &&
+ resource.isTrashed
+ ? groupContentsHandlers.TRASHED(resource)
+ : groupContentsHandlers.OWNED(resource);
+ } else {
+ const kind = extractUuidKind(params.uuid);
+ let resource: GroupContentsResource;
+ if (kind === ResourceKind.COLLECTION) {
+ resource = await params.services.collectionService.get(params.uuid);
+ } else if (kind === ResourceKind.PROJECT) {
+ resource = await params.services.projectService.get(params.uuid);
} else {
- const kind = extractUuidKind(params.uuid);
- let resource: GroupContentsResource;
- if (kind === ResourceKind.COLLECTION) {
- resource = await params.services.collectionService.get(params.uuid);
- } else if (kind === ResourceKind.PROJECT) {
- resource = await params.services.projectService.get(params.uuid);
- } else {
- resource = await params.services.containerRequestService.get(params.uuid);
- }
- handler = groupContentsHandlers.SHARED(resource);
+ resource = await params.services.containerRequestService.get(params.uuid);
}
- return (cases: MatchCases<typeof groupContentsHandlersRecord, GroupContentsHandler, void>) =>
- groupContentsHandlers.match(handler, cases);
-
+ handler = groupContentsHandlers.SHARED(resource);
+ }
+ return (
+ cases: MatchCases<
+ typeof groupContentsHandlersRecord,
+ GroupContentsHandler,
+ void
+ >
+ ) => groupContentsHandlers.match(handler, cases);
};
const groupContentsHandlersRecord = {
- TRASHED: ofType<GroupContentsResource>(),
- SHARED: ofType<GroupContentsResource>(),
- OWNED: ofType<GroupContentsResource>(),
+ TRASHED: ofType<GroupContentsResource>(),
+ SHARED: ofType<GroupContentsResource>(),
+ OWNED: ofType<GroupContentsResource>(),
};
const groupContentsHandlers = unionize(groupContentsHandlersRecord);
import { isRemoteHost } from "./is-remote-host";
import { validFilePath, validName, validNameAllowSlash } from "./valid-name";
-export const TAG_KEY_VALIDATION = [require, maxLength(255)];
-export const TAG_VALUE_VALIDATION = [require, maxLength(255)];
+export const TAG_KEY_VALIDATION = [maxLength(255)];
+export const TAG_VALUE_VALIDATION = [maxLength(255)];
export const PROJECT_NAME_VALIDATION = [require, validName, maxLength(255)];
export const PROJECT_NAME_VALIDATION_ALLOW_SLASH = [require, validNameAllowSlash, maxLength(255)];
const currentRoute = state.router.location ? state.router.location.pathname : '';
const currentRefresh = localStorage.getItem(LAST_REFRESH_TIMESTAMP) || '';
const currentItemUuid = currentRoute === '/workflows' ? state.properties.workflowPanelDetailsUuid : state.detailsPanel.resourceUuid;
-
return {
...dataExplorerState,
working: !!progress?.working,
import { VirtualMachinesResource } from 'models/virtual-machines';
import { CopyToClipboardSnackbar } from 'components/copy-to-clipboard-snackbar/copy-to-clipboard-snackbar';
import { ProjectResource } from 'models/project';
+import { ProcessResource } from 'models/process';
-const renderName = (dispatch: Dispatch, item: GroupContentsResource) => {
+const renderName = (dispatch: Dispatch, item: GroupContentsResource) => {
const navFunc = ("groupClass" in item && item.groupClass === GroupClass.ROLE ? navigateToGroupDetails : navigateTo);
return <Grid container alignItems="center" wrap="nowrap" spacing={16}>
<Grid item>
</Grid>;
};
+
const FrozenProject = (props: {item: ProjectResource}) => {
const [fullUsername, setFullusername] = React.useState<any>(null);
const getFullName = React.useCallback(() => {
return resource;
})((resource: GroupContentsResource & DispatchProp<any>) => renderName(resource.dispatch, resource));
+
const renderIcon = (item: GroupContentsResource) => {
switch (item.kind) {
case ResourceKind.PROJECT:
const renderUuid = (item: { uuid: string }) =>
<Typography data-cy="uuid" noWrap>
{item.uuid}
- <CopyToClipboardSnackbar value={item.uuid} />
+ {(item.uuid && <CopyToClipboardSnackbar value={item.uuid} />) || '-' }
+ </Typography>;
+
+const renderUuidCopyIcon = (item: { uuid: string }) =>
+ <Typography data-cy="uuid" noWrap>
+ {(item.uuid && <CopyToClipboardSnackbar value={item.uuid} />) || '-' }
</Typography>;
export const ResourceUuid = connect((state: RootState, props: { uuid: string }) => (
// Links Resources
const renderLinkName = (item: { name: string }) =>
- <Typography noWrap>{item.name || '(none)'}</Typography>;
+ <Typography noWrap>{item.name || '-'}</Typography>;
export const ResourceLinkName = connect(
(state: RootState, props: { uuid: string }) => {
};
})((props: { ownerUuid?: string, uuidPrefix: string }) => renderWorkflowStatus(props.uuidPrefix, props.ownerUuid));
-export const ResourceLastModifiedDate = connect(
+export const ResourceContainerUuid = connect(
(state: RootState, props: { uuid: string }) => {
- const resource = getResource<GroupContentsResource>(props.uuid)(state.resources);
- return { date: resource ? resource.modifiedAt : '' };
- })((props: { date: string }) => renderDate(props.date));
+ const process = getProcess(props.uuid)(state.resources)
+ return { uuid: process?.container?.uuid ? process?.container?.uuid : '' };
+ })((props: { uuid: string }) => renderUuid({ uuid: props.uuid }));
+
+enum ColumnSelection {
+ OUTPUT_UUID = 'outputUuid',
+ LOG_UUID = 'logUuid'
+}
+
+const renderUuidLinkWithCopyIcon = (dispatch: Dispatch, item: ProcessResource, column: string) => {
+ const selectedColumnUuid = item[column]
+ return <Grid container alignItems="center" wrap="nowrap" >
+ <Grid item>
+ {selectedColumnUuid ?
+ <Typography color="primary" style={{ width: 'auto', cursor: 'pointer' }} noWrap
+ onClick={() => dispatch<any>(navigateTo(selectedColumnUuid))}>
+ {selectedColumnUuid}
+ </Typography>
+ : '-' }
+ </Grid>
+ <Grid item>
+ {selectedColumnUuid && renderUuidCopyIcon({ uuid: selectedColumnUuid })}
+ </Grid>
+ </Grid>;
+};
+
+export const ResourceOutputUuid = connect(
+ (state: RootState, props: { uuid: string }) => {
+ const resource = getResource<ProcessResource>(props.uuid)(state.resources);
+ return resource;
+ })((process: ProcessResource & DispatchProp<any>) => renderUuidLinkWithCopyIcon(process.dispatch, process, ColumnSelection.OUTPUT_UUID));
+
+export const ResourceLogUuid = connect(
+ (state: RootState, props: { uuid: string }) => {
+ const resource = getResource<ProcessResource>(props.uuid)(state.resources);
+ return resource;
+ })((process: ProcessResource & DispatchProp<any>) => renderUuidLinkWithCopyIcon(process.dispatch, process, ColumnSelection.LOG_UUID));
+
+export const ResourceParentProcess = connect(
+ (state: RootState, props: { uuid: string }) => {
+ const process = getProcess(props.uuid)(state.resources)
+ return { parentProcess: process?.containerRequest?.requestingContainerUuid || '' };
+ })((props: { parentProcess: string }) => renderUuid({uuid: props.parentProcess}));
+
+export const ResourceModifiedByUserUuid = connect(
+ (state: RootState, props: { uuid: string }) => {
+ const process = getProcess(props.uuid)(state.resources)
+ return { userUuid: process?.containerRequest?.modifiedByUserUuid || '' };
+ })((props: { userUuid: string }) => renderUuid({uuid: props.userUuid}));
-export const ResourceCreatedAtDate = connect(
+ export const ResourceCreatedAtDate = connect(
(state: RootState, props: { uuid: string }) => {
const resource = getResource<GroupContentsResource>(props.uuid)(state.resources);
return { date: resource ? resource.createdAt : '' };
})((props: { date: string }) => renderDate(props.date));
+
+export const ResourceLastModifiedDate = connect(
+ (state: RootState, props: { uuid: string }) => {
+ const resource = getResource<GroupContentsResource>(props.uuid)(state.resources);
+ return { date: resource ? resource.modifiedAt : '' };
+ })((props: { date: string }) => renderDate(props.date));
export const ResourceTrashDate = connect(
(state: RootState, props: { uuid: string }) => {
const renderOwner = (owner: string) =>
<Typography noWrap>
- {owner}
+ {owner || '-'}
</Typography>;
export const ResourceOwner = connect(
return { owner: ownerName ? ownerName!.name : resource!.ownerUuid };
})((props: { owner: string }) => renderOwner(props.owner));
+export const ResourceUUID = connect(
+ (state: RootState, props: { uuid: string }) => {
+ const resource = getResource<CollectionResource>(props.uuid)(state.resources);
+ return { uuid: resource ? resource.uuid : '' };
+ })((props: { uuid: string }) => renderUuid({uuid: props.uuid}));
+
+const renderVersion = (version: number) =>{
+ return <Typography>{version ?? '-'}</Typography>
+}
+
+export const ResourceVersion = connect(
+ (state: RootState, props: { uuid: string }) => {
+ const resource = getResource<CollectionResource>(props.uuid)(state.resources);
+ return { version: resource ? resource.version: '' };
+ })((props: { version: number }) => renderVersion(props.version));
+
+const renderPortableDataHash = (portableDataHash:string | null) =>
+ <Typography noWrap>
+ {portableDataHash ? <>{portableDataHash}
+ <CopyToClipboardSnackbar value={portableDataHash} /></> : '-' }
+ </Typography>
+
+export const ResourcePortableDataHash = connect(
+ (state: RootState, props: { uuid: string }) => {
+ const resource = getResource<CollectionResource>(props.uuid)(state.resources);
+ return { portableDataHash: resource ? resource.portableDataHash : '' };
+ })((props: { portableDataHash: string }) => renderPortableDataHash(props.portableDataHash));
+
+
+const renderFileCount = (fileCount: number) =>{
+ return <Typography>{fileCount ?? '-'}</Typography>
+}
+
+export const ResourceFileCount = connect(
+ (state: RootState, props: { uuid: string }) => {
+ const resource = getResource<CollectionResource>(props.uuid)(state.resources);
+ return { fileCount: resource ? resource.fileCount: '' };
+ })((props: { fileCount: number }) => renderFileCount(props.fileCount));
+
const userFromID =
connect(
(state: RootState, props: { uuid: string }) => {
userFromID
);
+
+
+
+
const _resourceWithName =
withStyles({}, { withTheme: true })
((props: { uuid: string, userFullname: string, dispatch: Dispatch, theme: ArvadosTheme }) => {
const { uuid, userFullname, dispatch, theme } = props;
-
if (userFullname === '') {
dispatch<any>(loadResource(uuid, false));
return <Typography style={{ color: theme.palette.primary.main }} inline noWrap>
export const ResourceWithName = userFromID(_resourceWithName);
+
+
export const UserNameFromID =
compose(userFromID)(
(props: { uuid: string, displayAsText?: string, userFullname: string, dispatch: Dispatch }) => {
}
render() {
- return renderRunTime(this.state.runtime);
+ return this.props.process ? renderRunTime(this.state.runtime) : <Typography>-</Typography>;
}
});
const matchTagValues = ({ vocabulary, propertyKeyId }: PropertyValueFieldProps) =>
(value: string) =>
- getTagValues(propertyKeyId, vocabulary).find(v => v.label === value)
+ getTagValues(propertyKeyId, vocabulary).find(v => !value || v.label === value)
? undefined
: 'Incorrect value';
// SPDX-License-Identifier: AGPL-3.0
import React from 'react';
-import { InjectedFormProps } from 'redux-form';
+import { RootState } from 'store/store';
+import { connect } from 'react-redux';
+import { formValueSelector, InjectedFormProps } from 'redux-form';
import { Grid, withStyles, WithStyles } from '@material-ui/core';
import { PropertyKeyField, PROPERTY_KEY_FIELD_NAME, PROPERTY_KEY_FIELD_ID } from './property-key-field';
import { PropertyValueField, PROPERTY_VALUE_FIELD_NAME, PROPERTY_VALUE_FIELD_ID } from './property-value-field';
import { ProgressButton } from 'components/progress-button/progress-button';
import { GridClassKey } from '@material-ui/core/Grid';
+const AddButton = withStyles(theme => ({
+ root: { marginTop: theme.spacing.unit }
+}))(ProgressButton);
+
+const mapStateToProps = (state: RootState) => {
+ return {
+ applySelector: (selector) => selector(state, 'key', 'value', 'keyID', 'valueID')
+ }
+}
+
+interface ApplySelector {
+ applySelector: (selector) => any;
+}
+
export interface ResourcePropertiesFormData {
uuid: string;
[PROPERTY_KEY_FIELD_NAME]: string;
clearPropertyKeyOnSelect?: boolean;
}
-export type ResourcePropertiesFormProps = {uuid: string; clearPropertyKeyOnSelect?: boolean } & InjectedFormProps<ResourcePropertiesFormData, {uuid: string; }> & WithStyles<GridClassKey>;
+type ResourcePropertiesFormProps = {uuid: string; clearPropertyKeyOnSelect?: boolean } & InjectedFormProps<ResourcePropertiesFormData, {uuid: string;}> & WithStyles<GridClassKey> & ApplySelector;
-export const ResourcePropertiesForm = ({ handleSubmit, change, submitting, invalid, classes, uuid, clearPropertyKeyOnSelect }: ResourcePropertiesFormProps ) => {
+export const ResourcePropertiesForm = connect(mapStateToProps)(({ handleSubmit, change, submitting, invalid, classes, uuid, clearPropertyKeyOnSelect, applySelector, ...props }: ResourcePropertiesFormProps ) => {
change('uuid', uuid); // Sets the uuid field to the uuid of the resource.
+ const propertyValue = applySelector(formValueSelector(props.form));
return <form data-cy='resource-properties-form' onSubmit={handleSubmit}>
<Grid container spacing={16} classes={classes}>
<Grid item xs>
<PropertyValueField />
</Grid>
<Grid item>
- <Button
+ <AddButton
data-cy='property-add-btn'
- disabled={invalid}
+ disabled={invalid || !(propertyValue.key && propertyValue.value)}
loading={submitting}
color='primary'
variant='contained'
type='submit'>
Add
- </Button>
+ </AddButton>
</Grid>
</Grid>
- </form>};
-
-export const Button = withStyles(theme => ({
- root: { marginTop: theme.spacing.unit }
-}))(ProgressButton);
+ </form>}
+);
\ No newline at end of file
root: {
position: 'relative',
backgroundColor: theme.palette.grey["200"],
- '&::after': {
- content: `''`,
- position: 'absolute',
- top: 0,
- left: 0,
- bottom: 0,
- right: 0,
- background: 'url("arvados-logo-big.png") no-repeat center center',
- opacity: 0.2,
- }
+ background: 'url("arvados-logo-big.png") no-repeat center center',
+ backgroundBlendMode: 'soft-light',
},
ontop: {
zIndex: 10
type InactivePanelProps = WithStyles<CssRules> & InactivePanelActionProps & InactivePanelStateProps;
-
export const InactivePanelRoot = ({ classes, startLinking, inactivePageText, isLoginClusterFederation }: InactivePanelProps) =>
<Grid container justify="center" alignItems="center" direction="column" spacing={24}
className={classes.root}
export const ProcessIOCard = withStyles(styles)(connect(null, mapDispatchToProps)(
({ classes, label, params, raw, mounts, outputUuid, doHidePanel, doMaximizePanel, doUnMaximizePanel, panelMaximized, panelName, process, navigateTo }: ProcessIOCardProps) => {
const [mainProcTabState, setMainProcTabState] = useState(0);
+ const [subProcTabState, setSubProcTabState] = useState(0);
const handleMainProcTabChange = (event: React.MouseEvent<HTMLElement>, value: number) => {
setMainProcTabState(value);
}
+ const handleSubProcTabChange = (event: React.MouseEvent<HTMLElement>, value: number) => {
+ setSubProcTabState(value);
+ }
const [showImagePreview, setShowImagePreview] = useState(false);
const hasRaw = !!(raw && Object.keys(raw).length > 0);
const hasParams = !!(params && params.length > 0);
+ // Subprocess
+ const hasInputMounts = !!(label === ProcessIOCardType.INPUT && mounts && mounts.length);
+ const hasOutputCollecton = !!(label === ProcessIOCardType.OUTPUT && outputUuid);
+
return <Card className={classes.card} data-cy="process-io-card">
<CardHeader
className={classes.header}
</>) :
// Subprocess
(<>
- {((mounts && mounts.length) || outputUuid) ?
+ {loading && <Grid container item alignItems='center' justify='center'>
+ <CircularProgress />
+ </Grid>}
+ {!loading && (hasInputMounts || hasOutputCollecton || hasRaw) ?
<>
- <Tabs value={0} variant="fullWidth" className={classes.symmetricTabs}>
- {label === ProcessIOCardType.INPUT && <Tab label="Collections" />}
- {label === ProcessIOCardType.OUTPUT && <Tab label="Collection" />}
+ <Tabs value={subProcTabState} onChange={handleSubProcTabChange} variant="fullWidth" className={classes.symmetricTabs}>
+ {hasInputMounts && <Tab label="Collections" />}
+ {hasOutputCollecton && <Tab label="Collection" />}
+ <Tab label="JSON" />
</Tabs>
<div className={classes.tableWrapper}>
- {label === ProcessIOCardType.INPUT && <ProcessInputMounts mounts={mounts || []} />}
- {label === ProcessIOCardType.OUTPUT && <>
+ {subProcTabState === 0 && hasInputMounts && <ProcessInputMounts mounts={mounts || []} />}
+ {subProcTabState === 0 && hasOutputCollecton && <>
{outputUuid && <Typography className={classes.collectionLink}>
Output Collection: <MuiLink className={classes.keepLink} onClick={() => {navigateTo(outputUuid || "")}}>
{outputUuid}
</MuiLink></Typography>}
<ProcessOutputCollectionFiles isWritable={false} currentItemUuid={outputUuid} />
</>}
+ {(subProcTabState === 1 || (!hasInputMounts && !hasOutputCollecton)) && <div className={classes.tableWrapper}>
+ <ProcessIORaw data={raw} />
+ </div>}
</div>
</> :
<Grid container item alignItems='center' justify='center'>
- <DefaultView messages={["No collection(s) found"]} />
+ <DefaultView messages={["No data to display"]} />
</Grid>
}
</>)
import { SortDirection } from 'components/data-table/data-column';
import { ResourceKind, Resource } from 'models/resource';
import {
+ ResourceName,
+ ProcessStatus as ResourceStatus,
+ ResourceType,
+ ResourceOwnerWithName,
+ ResourcePortableDataHash,
ResourceFileSize,
+ ResourceFileCount,
+ ResourceUUID,
+ ResourceContainerUuid,
+ ContainerRunTime,
+ ResourceOutputUuid,
+ ResourceLogUuid,
+ ResourceParentProcess,
+ ResourceModifiedByUserUuid,
+ ResourceVersion,
+ ResourceCreatedAtDate,
ResourceLastModifiedDate,
- ProcessStatus,
- ResourceType,
- ResourceOwnerWithName
+ ResourceTrashDate,
+ ResourceDeleteDate,
} from 'views-components/data-explorer/renderers';
import { ProjectIcon } from 'components/icon/icon';
-import { ResourceName } from 'views-components/data-explorer/renderers';
import {
ResourcesState,
getResource
STATUS = "Status",
TYPE = "Type",
OWNER = "Owner",
- FILE_SIZE = "File size",
- LAST_MODIFIED = "Last modified"
+ PORTABLE_DATA_HASH = "Portable Data Hash",
+ FILE_SIZE = "File Size",
+ FILE_COUNT = "File Count",
+ UUID = "UUID",
+ CONTAINER_UUID = "Container UUID",
+ RUNTIME = "Runtime",
+ OUTPUT_UUID = "Output UUID",
+ LOG_UUID = "Log UUID",
+ PARENT_PROCESS = 'Parent Process UUID',
+ MODIFIED_BY_USER_UUID = 'Modified by User UUID',
+ VERSION = "Version",
+ CREATED_AT = "Date Created",
+ LAST_MODIFIED = "Last Modified",
+ TRASH_AT = "Trash at",
+ DELETE_AT = "Delete at",
}
export interface ProjectPanelFilter extends DataTableFilterItem {
render: uuid => <ResourceName uuid={uuid} />
},
{
- name: "Status",
+ name: ProjectPanelColumnNames.STATUS,
selected: true,
configurable: true,
mutuallyExclusiveFilters: true,
filters: getInitialProcessStatusFilters(),
- render: uuid => <ProcessStatus uuid={uuid} />,
+ render: uuid => <ResourceStatus uuid={uuid} />,
},
{
name: ProjectPanelColumnNames.TYPE,
filters: createTree(),
render: uuid => <ResourceOwnerWithName uuid={uuid} />
},
+ {
+ name: ProjectPanelColumnNames.PORTABLE_DATA_HASH,
+ selected: false,
+ configurable: true,
+ filters: createTree(),
+ render: uuid => <ResourcePortableDataHash uuid={uuid}/>
+ },
{
name: ProjectPanelColumnNames.FILE_SIZE,
selected: true,
filters: createTree(),
render: uuid => <ResourceFileSize uuid={uuid} />
},
+ {
+ name: ProjectPanelColumnNames.FILE_COUNT,
+ selected: false,
+ configurable: true,
+ filters: createTree(),
+ render: uuid =><ResourceFileCount uuid={uuid}/>
+ },
+ {
+ name: ProjectPanelColumnNames.UUID,
+ selected: false,
+ configurable: true,
+ filters: createTree(),
+ render: uuid => <ResourceUUID uuid={uuid}/>
+ },
+ {
+ name: ProjectPanelColumnNames.CONTAINER_UUID,
+ selected: true,
+ configurable: true,
+ filters: createTree(),
+ render: uuid => <ResourceContainerUuid uuid={uuid}/>
+ },
+ {
+ name: ProjectPanelColumnNames.RUNTIME,
+ selected: false,
+ configurable: true,
+ filters: createTree(),
+ render: uuid => <ContainerRunTime uuid={uuid} />
+ },
+ {
+ name: ProjectPanelColumnNames.OUTPUT_UUID,
+ selected: false,
+ configurable: true,
+ filters: createTree(),
+ render: uuid => <ResourceOutputUuid uuid={uuid}/>
+ },
+ {
+ name: ProjectPanelColumnNames.LOG_UUID,
+ selected: false,
+ configurable: true,
+ filters: createTree(),
+ render: uuid => <ResourceLogUuid uuid={uuid}/>
+ },
+ {
+ name: ProjectPanelColumnNames.PARENT_PROCESS,
+ selected: false,
+ configurable: true,
+ filters: createTree(),
+ render: uuid => <ResourceParentProcess uuid={uuid}/>
+ },
+ {
+ name: ProjectPanelColumnNames.MODIFIED_BY_USER_UUID,
+ selected: false,
+ configurable: true,
+ filters: createTree(),
+ render: uuid => <ResourceModifiedByUserUuid uuid={uuid}/>
+ },
+ {
+ name: ProjectPanelColumnNames.VERSION,
+ selected: false,
+ configurable: true,
+ filters: createTree(),
+ render: uuid =><ResourceVersion uuid={uuid}/>
+ },
+ {
+ name: ProjectPanelColumnNames.CREATED_AT,
+ selected: false,
+ configurable: true,
+ sortDirection: SortDirection.DESC,
+ filters: createTree(),
+ render: uuid =><ResourceCreatedAtDate uuid={uuid}/>
+ },
{
name: ProjectPanelColumnNames.LAST_MODIFIED,
selected: true,
sortDirection: SortDirection.DESC,
filters: createTree(),
render: uuid => <ResourceLastModifiedDate uuid={uuid} />
- }
+ },
+ {
+ name: ProjectPanelColumnNames.TRASH_AT,
+ selected: false,
+ configurable: true,
+ sortDirection: SortDirection.DESC,
+ filters: createTree(),
+ render: uuid => <ResourceTrashDate uuid={uuid} />
+ },
+ {
+ name: ProjectPanelColumnNames.DELETE_AT,
+ selected: false,
+ configurable: true,
+ sortDirection: SortDirection.DESC,
+ filters: createTree(),
+ render: uuid => <ResourceDeleteDate uuid={uuid} />
+ },
+
];
export const PROJECT_PANEL_ID = "projectPanel";