yarn start
```
+## Start project for development inside Docker container
+
+```
+make workbench2-build-image
+# (create public/config.json, see "Run time configuration" below)
+docker run -ti -v$PWD:$PWD -p 3000:3000 -w$PWD workbench2-build /bin/bash
+# (inside docker container)
+yarn install
+yarn start
+```
+
## Run unit tests
```
make unit-tests
## Run tests interactively in container
```
-$ xhost +local:root
-$ ARVADOS_DIR=/path/to/arvados
-$ docker run -ti -v$PWD:$PWD -v$ARVADOS_DIR:/usr/src/arvados -w$PWD --env="DISPLAY" --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" workbench2-build /bin/bash
+xhost +local:root
+ARVADOS_DIR=/path/to/arvados
+docker run -ti -v$PWD:$PWD -v$ARVADOS_DIR:/usr/src/arvados -w$PWD --env="DISPLAY" --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" workbench2-build /bin/bash
(inside container)
-# yarn run cypress install
-# tools/run-integration-tests.sh -i -a /usr/src/arvados
+yarn run cypress install
+tools/run-integration-tests.sh -i -a /usr/src/arvados
```
## Production build
public addExists(value?: string, resourcePrefix?: string) {
return this.addCondition("properties", "exists", value, "", "", resourcePrefix);
}
+ public addDoesNotExist(field: string, resourcePrefix?: string) {
+ return this.addCondition("properties." + field, "exists", false, "", "", resourcePrefix);
+ }
public addFullTextSearch(value: string) {
const terms = value.trim().split(/(\s+)/);
} from '~/views/run-process-panel/run-process-advanced-form';
import { dialogActions } from '~/store/dialog/dialog-actions';
import { setBreadcrumbs } from '~/store/breadcrumbs/breadcrumbs-actions';
-import { matchProjectRoute } from '~/routes/routes';
export const runProcessPanelActions = unionize({
SET_PROCESS_PATHNAME: ofType<string>(),
const inputsForm = getFormValues(RUN_PROCESS_INPUTS_FORM)(state) as WorkflowInputsData;
const userUuid = getUserUuid(getState());
if (!userUuid) { return; }
- const pathname = getState().runProcessPanel.processPathname;
const { processOwnerUuid, selectedWorkflow } = state.runProcessPanel;
- const ownerUUid = !matchProjectRoute(pathname) ? userUuid : processOwnerUuid;
+ const ownerUUid = processOwnerUuid ? processOwnerUuid : userUuid;
if (selectedWorkflow) {
const advancedForm = getFormValues(RUN_PROCESS_ADVANCED_FORM)(state) as RunProcessAdvancedFormData || getWorkflowRunnerSettings(selectedWorkflow);
const newProcessData = {
--- /dev/null
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { API_TOKEN_KEY } from "~/services/auth-service/auth-service";
+
+import 'jest-localstorage-mock';
+import { ServiceRepository, createServices } from "~/services/services";
+import { configureStore, RootStore } from "../store";
+import { createBrowserHistory } from "history";
+import { Config, mockConfig } from '~/common/config';
+import { ApiActions } from "~/services/api/api-actions";
+import { ACCOUNT_LINK_STATUS_KEY } from '~/services/link-account-service/link-account-service';
+import Axios from "axios";
+import MockAdapter from "axios-mock-adapter";
+import { ImportMock } from 'ts-mock-imports';
+import * as servicesModule from "~/services/services";
+import { SessionStatus } from "~/models/session";
+import { openRunProcess } from './workflow-panel-actions';
+import { runProcessPanelActions } from '~/store/run-process-panel/run-process-panel-actions';
+import { initialize } from 'redux-form';
+import { RUN_PROCESS_BASIC_FORM } from '~/views/run-process-panel/run-process-basic-form';
+import { RUN_PROCESS_INPUTS_FORM } from '~/views/run-process-panel/run-process-inputs-form';
+import { ResourceKind } from '~/models/resource';
+import { WorkflowResource } from '~/models/workflow';
+
+describe('workflow-panel-actions', () => {
+ const axiosInst = Axios.create({ headers: {} });
+ const axiosMock = new MockAdapter(axiosInst);
+
+ let store: RootStore;
+ let services: ServiceRepository;
+ const config: any = {};
+ const actions: ApiActions = {
+ progressFn: (id: string, working: boolean) => { },
+ errorFn: (id: string, message: string) => { }
+ };
+ let importMocks: any[];
+
+ beforeEach(() => {
+ axiosMock.reset();
+ services = createServices(mockConfig({}), actions, axiosInst);
+ store = configureStore(createBrowserHistory(), services, config);
+ localStorage.clear();
+ importMocks = [];
+ });
+
+ afterEach(() => {
+ importMocks.map(m => m.restore());
+ });
+
+ it('opens the run process panel', async () => {
+ const wflist: WorkflowResource[] = [{
+ uuid: "zzzzz-7fd4e-0123456789abcde",
+ name: "foo",
+ description: "",
+ definition: "$graph: []",
+ kind: ResourceKind.WORKFLOW,
+ ownerUuid: "",
+ createdAt: "",
+ modifiedByClientUuid: "",
+ modifiedByUserUuid: "",
+ modifiedAt: "",
+ href: "",
+ etag: ""
+ }];
+ axiosMock
+ .onGet("/workflows")
+ .reply(200, {
+ items: wflist
+ }).onGet("/links")
+ .reply(200, {
+ items: []
+ });
+
+ const dispatchMock = jest.fn();
+ const dispatchWrapper = (action: any) => {
+ dispatchMock(action);
+ return store.dispatch(action);
+ };
+
+ await openRunProcess("zzzzz-7fd4e-0123456789abcde", "zzzzz-tpzed-0123456789abcde", "testing", { inputparm: "value" })(dispatchWrapper, store.getState, services);
+ expect(dispatchMock).toHaveBeenCalledWith(runProcessPanelActions.SET_WORKFLOWS(wflist));
+ expect(dispatchMock).toHaveBeenCalledWith(runProcessPanelActions.SET_SELECTED_WORKFLOW(wflist[0]));
+ expect(dispatchMock).toHaveBeenCalledWith(runProcessPanelActions.SET_PROCESS_OWNER_UUID("zzzzz-tpzed-0123456789abcde"));
+ expect(dispatchMock).toHaveBeenCalledWith(initialize(RUN_PROCESS_BASIC_FORM, { name: "testing" }));
+ expect(dispatchMock).toHaveBeenCalledWith(initialize(RUN_PROCESS_INPUTS_FORM, { inputparm: "value" }));
+ });
+});
import { goToStep, runProcessPanelActions, loadPresets, getWorkflowRunnerSettings } from '~/store/run-process-panel/run-process-panel-actions';
import { snackbarActions } from '~/store/snackbar/snackbar-actions';
import { initialize } from 'redux-form';
+import { RUN_PROCESS_BASIC_FORM } from '~/views/run-process-panel/run-process-basic-form';
+import { RUN_PROCESS_INPUTS_FORM } from '~/views/run-process-panel/run-process-inputs-form';
import { RUN_PROCESS_ADVANCED_FORM } from '~/views/run-process-panel/run-process-advanced-form';
export const WORKFLOW_PANEL_ID = "workflowPanel";
return state.properties.uuidPrefix;
};
-export const openRunProcess = (uuid: string) =>
- (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+export const openRunProcess = (workflowUuid: string, ownerUuid?: string, name?: string, inputObj?: { [key: string]: any }) =>
+ async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+ const response = await services.workflowService.list();
+ dispatch(runProcessPanelActions.SET_WORKFLOWS(response.items));
+
const workflows = getState().runProcessPanel.searchWorkflows;
- const workflow = workflows.find(workflow => workflow.uuid === uuid);
+ const workflow = workflows.find(workflow => workflow.uuid === workflowUuid);
if (workflow) {
dispatch<any>(navigateToRunProcess);
dispatch<any>(goToStep(1));
dispatch(runProcessPanelActions.SET_STEP_CHANGED(true));
dispatch(runProcessPanelActions.SET_SELECTED_WORKFLOW(workflow));
dispatch<any>(loadPresets(workflow.uuid));
+
dispatch(initialize(RUN_PROCESS_ADVANCED_FORM, getWorkflowRunnerSettings(workflow)));
+ if (ownerUuid) {
+ dispatch(runProcessPanelActions.SET_PROCESS_OWNER_UUID(ownerUuid));
+ }
+ if (name) {
+ dispatch(initialize(RUN_PROCESS_BASIC_FORM, { name }));
+ }
+ if (inputObj) {
+ dispatch(initialize(RUN_PROCESS_INPUTS_FORM, inputObj));
+ }
} else {
dispatch<any>(snackbarActions.OPEN_SNACKBAR({ message: `You can't run this process` }));
}