Skip to content

Commit 0f5cfcd

Browse files
Combine Cromwell Settings and Launch buttons (#7479)
1 parent 80e64db commit 0f5cfcd

File tree

4 files changed

+71
-52
lines changed

4 files changed

+71
-52
lines changed

ui/src/app/components/apps-panel/expanded-app.spec.tsx

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -356,19 +356,6 @@ describe('ExpandedApp', () => {
356356
);
357357
});
358358

359-
it('should not be possible to configure a Cromwell app', async () => {
360-
const wrapper = await component(UIAppType.CROMWELL, {
361-
appName: 'my-app',
362-
googleProject,
363-
status: AppStatus.RUNNING,
364-
});
365-
expect(
366-
wrapper
367-
.find({ 'data-test-id': 'Cromwell-settings-button' })
368-
.prop('disabled')
369-
).toBeTruthy();
370-
});
371-
372359
it('should allow launching RStudio when the RStudio app status is RUNNING', async () => {
373360
const appName = 'my-app';
374361
const wrapper = await component(UIAppType.RSTUDIO, {

ui/src/app/components/apps-panel/expanded-app.tsx

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ const styles = reactStyles({
5151
marginLeft: '1em',
5252
marginBottom: '1em',
5353
padding: '1em',
54-
width: 'fit-content',
5554
},
5655
enabledTrashButton: {
5756
alignSelf: 'center',
@@ -129,34 +128,11 @@ const CromwellButtonRow = (props: {
129128

130129
return (
131130
<FlexRow>
132-
<TooltipTrigger
133-
disabled={false}
134-
content='Support for configuring Cromwell is not yet available'
135-
>
136-
{/* tooltip trigger needs a div for some reason */}
137-
<div>
138-
<SettingsButton
139-
disabled={true}
140-
onClick={() => {}}
141-
data-test-id='Cromwell-settings-button'
142-
/>
143-
</div>
144-
</TooltipTrigger>
131+
<SettingsButton
132+
onClick={() => setSidebarActiveIconStore.next('cromwellConfig')}
133+
data-test-id='Cromwell-settings-button'
134+
/>
145135
<PauseUserAppButton {...{ userApp }} />
146-
<TooltipTrigger
147-
disabled={canCreateApp(userApp)}
148-
content='A Cromwell app exists or is being created'
149-
>
150-
{/* tooltip trigger needs a div for some reason */}
151-
<div>
152-
<AppsPanelButton
153-
disabled={!canCreateApp(userApp)}
154-
onClick={() => setSidebarActiveIconStore.next('cromwellConfig')}
155-
icon={faPlay}
156-
buttonText='Launch'
157-
/>
158-
</div>
159-
</TooltipTrigger>
160136
</FlexRow>
161137
);
162138
};
@@ -304,9 +280,9 @@ export const ExpandedApp = (props: ExpandedAppProps) => {
304280
{appType === UIAppType.JUPYTER ? (
305281
<JupyterButtonRow {...{ workspace, onClickRuntimeConf }} />
306282
) : (
307-
<FlexColumn style={{ alignItems: 'center' }}>
283+
<FlexColumn>
308284
{/* TODO: keep status updated internally */}
309-
<div>
285+
<div style={{ textAlign: 'center' }}>
310286
status: {fromUserAppStatusWithFallback(initialUserAppInfo?.status)}{' '}
311287
(refresh to update)
312288
</div>

ui/src/app/components/help-sidebar.spec.tsx

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { act } from 'react-dom/test-utils';
33

44
import {
55
AppsApi,
6+
AppStatus,
67
CdrVersionsApi,
78
CohortAnnotationDefinitionApi,
89
CohortReviewApi,
@@ -47,7 +48,10 @@ import {
4748
waitForFakeTimersAndUpdate,
4849
waitOneTickAndUpdate,
4950
} from 'testing/react-test-helpers';
50-
import { AppsApiStub } from 'testing/stubs/apps-api-stub';
51+
import {
52+
AppsApiStub,
53+
createListAppsCromwellResponse,
54+
} from 'testing/stubs/apps-api-stub';
5155
import {
5256
CdrVersionsApiStub,
5357
cdrVersionTiersResponse,
@@ -127,6 +131,7 @@ const COMPUTE_SUSPENDED_RESPONSE_STUB = () =>
127131
describe('HelpSidebar', () => {
128132
let dataSetStub: DataSetApiStub;
129133
let runtimeStub: RuntimeApiStub;
134+
let appsStub: AppsApiStub;
130135
let props: {};
131136

132137
const component = async () => {
@@ -186,6 +191,7 @@ describe('HelpSidebar', () => {
186191
props = {};
187192
dataSetStub = new DataSetApiStub();
188193
runtimeStub = new RuntimeApiStub();
194+
appsStub = new AppsApiStub();
189195
registerApiClient(CdrVersionsApi, new CdrVersionsApiStub());
190196
registerApiClient(CohortReviewApi, new CohortReviewServiceStub());
191197
registerApiClient(
@@ -195,7 +201,7 @@ describe('HelpSidebar', () => {
195201
registerApiClient(DataSetApi, dataSetStub);
196202
registerApiClient(RuntimeApi, runtimeStub);
197203
registerApiClient(WorkspacesApi, new WorkspacesApiStub());
198-
registerApiClient(AppsApi, new AppsApiStub());
204+
registerApiClient(AppsApi, appsStub);
199205
registerApiClient(NotebooksApi, new NotebooksApiStub());
200206
currentWorkspaceStore.next(workspaceDataStub);
201207
currentCohortReviewStore.next(cohortReviewStubs[0]);
@@ -614,4 +620,28 @@ describe('HelpSidebar', () => {
614620
expect(wrapper.find(AppsPanel).exists()).toBeFalsy();
615621
expect(wrapper.find(CromwellConfigurationPanel).exists()).toBeTruthy();
616622
});
623+
624+
it('should open the Cromwell config panel after clicking the Cromwell settings button', async () => {
625+
appsStub.listAppsResponse = [
626+
createListAppsCromwellResponse({ status: AppStatus.RUNNING }),
627+
];
628+
629+
const wrapper = await component();
630+
wrapper
631+
.find({ 'data-test-id': 'help-sidebar-icon-apps' })
632+
.simulate('click');
633+
await waitOneTickAndUpdate(wrapper);
634+
635+
expect(wrapper.find(AppsPanel).exists()).toBeTruthy();
636+
expect(wrapper.find(CromwellConfigurationPanel).exists()).toBeFalsy();
637+
638+
wrapper
639+
.find({ 'data-test-id': `Cromwell-expanded` })
640+
.find({ 'data-test-id': 'Cromwell-settings-button' })
641+
.simulate('click');
642+
await waitOneTickAndUpdate(wrapper);
643+
644+
expect(wrapper.find(AppsPanel).exists()).toBeFalsy();
645+
expect(wrapper.find(CromwellConfigurationPanel).exists()).toBeTruthy();
646+
});
617647
});

ui/src/testing/stubs/apps-api-stub.ts

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,57 @@ import {
99

1010
import { stubNotImplementedError } from 'testing/stubs/stub-utils';
1111

12-
const createRStudioListAppsResponseDefaults: UserAppEnvironment = {
13-
googleProject: 'terra-vpc-sc-dev-1234',
14-
appName: 'all-of-us-2-rstudio-1234',
15-
appType: AppType.RSTUDIO,
16-
createdDate: '2023-02-28T21:10:28.723328Z',
12+
const listAppsAppResponseSharedDefaults = {
13+
googleProject: 'terra-vpc-sc-dev-42c21469',
14+
createdDate: '2023-03-13T18:16:49.481854Z',
1715
status: AppStatus.RUNNING,
1816
autopauseThreshold: null,
1917
kubernetesRuntimeConfig: {
2018
numNodes: 1,
2119
machineType: 'n1-standard-4',
2220
autoscalingEnabled: false,
2321
},
22+
dateAccessed: '2023-03-13T18:16:49.481854Z',
23+
errors: [],
24+
};
25+
26+
const createCromwellListAppsResponseDefaults: UserAppEnvironment = {
27+
...listAppsAppResponseSharedDefaults,
28+
appName: 'all-of-us-2-cromwell-1234',
29+
appType: AppType.CROMWELL,
30+
creator: '[email protected]',
31+
proxyUrls: {
32+
'cromwell-service':
33+
'https://leonardo.dsde-dev.broadinstitute.org/proxy/google/v1/apps/terra-vpc-sc-dev-1234/all-of-us-2-cromwell-1234/cromwell-service',
34+
},
35+
diskName: 'all-of-us-pd-2-cromwell-1234',
36+
labels: {
37+
'created-by': '[email protected]',
38+
'aou-app-type': 'cromwell',
39+
},
40+
};
41+
42+
const createRStudioListAppsResponseDefaults: UserAppEnvironment = {
43+
...listAppsAppResponseSharedDefaults,
44+
appName: 'all-of-us-2-rstudio-1234',
45+
appType: AppType.RSTUDIO,
2446
proxyUrls: {
2547
rstudio:
2648
'https://leonardo.dsde-dev.broadinstitute.org/proxy/google/v1/apps/terra-vpc-sc-dev-1234/all-of-us-2-rstudio-1234/rstudio',
2749
},
2850
diskName: 'all-of-us-pd-2-rstudio-1234',
29-
dateAccessed: '2023-02-28T21:10:28.723328Z',
30-
errors: [],
3151
labels: {
3252
'created-by': '[email protected]',
3353
'aou-app-type': 'rstudio',
3454
},
3555
};
3656

57+
export const createListAppsCromwellResponse = (
58+
overrides: Partial<UserAppEnvironment> = {}
59+
): UserAppEnvironment => {
60+
return { ...createCromwellListAppsResponseDefaults, ...overrides };
61+
};
62+
3763
export const createListAppsRStudioResponse = (
3864
overrides: Partial<UserAppEnvironment> = {}
3965
): UserAppEnvironment => {

0 commit comments

Comments
 (0)