diff --git a/api/src/main/resources/workbench-api.yaml b/api/src/main/resources/workbench-api.yaml index 8543e031c86..196212a259e 100644 --- a/api/src/main/resources/workbench-api.yaml +++ b/api/src/main/resources/workbench-api.yaml @@ -7219,7 +7219,7 @@ components: $ref: '#/components/schemas/WorkspaceResponse' Workspace: required: - - name + - displayName type: object properties: etag: diff --git a/ui/src/app/components/breadcrumb.spec.tsx b/ui/src/app/components/breadcrumb.spec.tsx index d2e4e78fdd9..0be442f9998 100644 --- a/ui/src/app/components/breadcrumb.spec.tsx +++ b/ui/src/app/components/breadcrumb.spec.tsx @@ -42,7 +42,7 @@ describe('getTrail', () => { ); expect(trail.map((item) => item.label)).toEqual([ 'Workspaces', - workspaceDataStub.name, + workspaceDataStub.displayName, cohortReviewStubs[0].cohortName, `Participant ${pid}`, ]); @@ -93,7 +93,7 @@ describe('getTrail', () => { expect(trail.map((item) => item.label)).toEqual([ 'Workspaces', - workspaceDataStub.name, + workspaceDataStub.displayName, analysisTabDisplay, nbName, ]); @@ -118,7 +118,7 @@ describe('getTrail', () => { expect(trail.map((item) => item.label)).toEqual([ 'Workspaces', - workspaceDataStub.name, + workspaceDataStub.displayName, analysisTabDisplay, nbName, ]); @@ -146,7 +146,7 @@ describe('getTrail', () => { expect(trailLabels).not.toContain(nbName); expect(trailLabels).toEqual([ 'Workspaces', - workspaceDataStub.name, + workspaceDataStub.displayName, analysisTabDisplay, UIAppType.RSTUDIO, ]); diff --git a/ui/src/app/components/breadcrumb.tsx b/ui/src/app/components/breadcrumb.tsx index 814cdfc7b7e..8743c6fe876 100644 --- a/ui/src/app/components/breadcrumb.tsx +++ b/ui/src/app/components/breadcrumb.tsx @@ -89,6 +89,7 @@ export const getTrail = ( case BreadcrumbType.Workspaces: return [new BreadcrumbData('Workspaces', '/workspaces')]; case BreadcrumbType.Workspace: + case BreadcrumbType.Data: return [ ...getTrail( BreadcrumbType.Workspaces, @@ -99,7 +100,7 @@ export const getTrail = ( params ), new BreadcrumbData( - workspace ? workspace.name : '...', + workspace?.displayName ?? '...', dataTabPath(ns, terraName) ), ]; @@ -276,21 +277,6 @@ export const getTrail = ( ), new BreadcrumbData('Dataset', `${dataTabPath(ns, terraName)}/datasets`), ]; - case BreadcrumbType.Data: - return [ - ...getTrail( - BreadcrumbType.Workspaces, - workspace, - cohort, - cohortReview, - conceptSet, - params - ), - new BreadcrumbData( - workspace ? workspace.name : '...', - `${dataTabPath(ns, terraName)}` - ), - ]; default: return []; } diff --git a/ui/src/app/components/copy-modal.spec.tsx b/ui/src/app/components/copy-modal.spec.tsx index bd889186a57..542598fc3ea 100644 --- a/ui/src/app/components/copy-modal.spec.tsx +++ b/ui/src/app/components/copy-modal.spec.tsx @@ -38,7 +38,7 @@ import { CopyModal, CopyModalProps } from './copy-modal'; interface TestWorkspace { namespace: string; - name: string; + displayName: string; terraName: string; cdrVersionId: string; accessTierShortName: string; @@ -55,7 +55,7 @@ const openWorkspaceSelection = async () => { const selectWorkspace = async (workspace: TestWorkspace) => { await openWorkspaceSelection(); - const selectedOption = screen.queryByText(workspace.name); + const selectedOption = screen.queryByText(workspace.displayName); expect(selectedOption).toBeInTheDocument(); return userEvent.click(selectedOption); }; @@ -92,42 +92,42 @@ describe(CopyModal.name, () => { const workspaces: TestWorkspace[] = [ { namespace: defaultNamespace, - name: 'Freerider', + displayName: 'Freerider', terraName: 'freerider', cdrVersionId: CdrVersionsStubVariables.DEFAULT_WORKSPACE_CDR_VERSION_ID, accessTierShortName: AccessTierShortNames.Registered, }, { namespace: defaultNamespace, - name: 'Dawn Wall', + displayName: 'Dawn Wall', terraName: 'dawn wall', cdrVersionId: CdrVersionsStubVariables.DEFAULT_WORKSPACE_CDR_VERSION_ID, accessTierShortName: AccessTierShortNames.Registered, }, { namespace: defaultNamespace, - name: 'Zodiac', + displayName: 'Zodiac', terraName: 'zodiac', cdrVersionId: CdrVersionsStubVariables.DEFAULT_WORKSPACE_CDR_VERSION_ID, accessTierShortName: AccessTierShortNames.Registered, }, { namespace: defaultNamespace, - name: 'The Nose', + displayName: 'The Nose', terraName: 'the nose', cdrVersionId: CdrVersionsStubVariables.DEFAULT_WORKSPACE_CDR_VERSION_ID, accessTierShortName: AccessTierShortNames.Registered, }, { namespace: altNamespace, - name: 'Sesame Street', + displayName: 'Sesame Street', terraName: 'sesame-street', cdrVersionId: CdrVersionsStubVariables.ALT_WORKSPACE_CDR_VERSION_ID, accessTierShortName: AccessTierShortNames.Registered, }, { namespace: controlledNamespace, - name: 'A tightly controlled workspace', + displayName: 'A tightly controlled workspace', terraName: 'controlled-ws-1', cdrVersionId: CdrVersionsStubVariables.CONTROLLED_TIER_CDR_VERSION_ID, accessTierShortName: AccessTierShortNames.Controlled, @@ -214,10 +214,10 @@ describe(CopyModal.name, () => { }); it('should populate select options with writeable Workspaces from getWorkspaces()', async () => { - const currentWsOption = ownerWorkspace.name + ' (current workspace)'; - const writerWsOption = writerWorkspace.name; - const writerAltCdrWsOption = altCdrWorkspace.name; - const writerControlledCdrWsOption = controlledCdrWorkspace.name; + const currentWsOption = ownerWorkspace.displayName + ' (current workspace)'; + const writerWsOption = writerWorkspace.displayName; + const writerAltCdrWsOption = altCdrWorkspace.displayName; + const writerControlledCdrWsOption = controlledCdrWorkspace.displayName; const expectedOptions = [ currentWsOption, @@ -252,10 +252,11 @@ describe(CopyModal.name, () => { // this is ugly and fragile, but I haven't been able to do better yet - const currentWsOption = altCdrWorkspace.name + ' (current workspace)'; - const controlledCdrWriterWsOption = controlledCdrWorkspace.name; - const otherCdrOwnerWsOption = ownerWorkspace.name; - const otherCdrWriterWsOption = writerWorkspace.name; + const currentWsOption = + altCdrWorkspace.displayName + ' (current workspace)'; + const controlledCdrWriterWsOption = controlledCdrWorkspace.displayName; + const otherCdrOwnerWsOption = ownerWorkspace.displayName; + const otherCdrWriterWsOption = writerWorkspace.displayName; const optionAncestor = screen.queryByText(currentWsOption).parentNode.parentNode.parentNode; diff --git a/ui/src/app/components/copy-modal.tsx b/ui/src/app/components/copy-modal.tsx index d486e19fd8e..0855ef4be79 100644 --- a/ui/src/app/components/copy-modal.tsx +++ b/ui/src/app/components/copy-modal.tsx @@ -214,8 +214,8 @@ const CopyModal = withCdrVersions()( options: workspacesByCdr[versionId].map((workspace) => ({ value: workspace, label: this.isDestinationSameWorkspace(workspace) - ? `${workspace.name} (current workspace)` - : workspace.name, + ? `${workspace.displayName} (current workspace)` + : workspace.displayName, })), })); } @@ -512,8 +512,8 @@ const CopyModal = withCdrVersions()( {' '} Successfully copied {fromResourceName} to - {this.state.destination.name} . Do you - want to view the copied {toDisplay(resourceType)}? + {this.state.destination.displayName} . Do + you want to view the copied {toDisplay(resourceType)}? ); } diff --git a/ui/src/app/components/help-sidebar.tsx b/ui/src/app/components/help-sidebar.tsx index a74eaf5453a..34852530d54 100644 --- a/ui/src/app/components/help-sidebar.tsx +++ b/ui/src/app/components/help-sidebar.tsx @@ -302,7 +302,7 @@ export const HelpSidebar = fp.flow( deleteWorkspace = withErrorModal( { title: 'Error Deleting Workspace', - message: `Could not delete workspace '${this.props.workspace.name}'.`, + message: `Could not delete workspace '${this.props.workspace.displayName}'.`, showBugReportLink: true, onDismiss: () => { this.setState({ currentModal: CurrentModal.None }); @@ -922,7 +922,7 @@ export const HelpSidebar = fp.flow( this.setState({ currentModal: CurrentModal.None }) } receiveDelete={() => this.deleteWorkspace()} - workspaceName={this.props.workspace.name} + workspaceName={this.props.workspace.displayName} /> ), ], diff --git a/ui/src/app/components/resources/resource-list.tsx b/ui/src/app/components/resources/resource-list.tsx index ff4a3432b63..9f7c4f21ddb 100644 --- a/ui/src/app/components/resources/resource-list.tsx +++ b/ui/src/app/components/resources/resource-list.tsx @@ -67,7 +67,7 @@ interface NavProps { const WorkspaceNavigation = (props: NavProps) => { const { - workspace: { name, namespace, terraName }, + workspace: { displayName, namespace, terraName }, resource, style, } = props; @@ -77,7 +77,7 @@ const WorkspaceNavigation = (props: NavProps) => { return ( - {name} + {displayName} ); diff --git a/ui/src/app/pages/admin/admin-notebook-view.tsx b/ui/src/app/pages/admin/admin-notebook-view.tsx index ef3ee891db0..6d0b512af74 100644 --- a/ui/src/app/pages/admin/admin-notebook-view.tsx +++ b/ui/src/app/pages/admin/admin-notebook-view.tsx @@ -92,7 +92,7 @@ const AdminNotebookViewComponent = (props: Props) => { workspaceAdminApi() .getWorkspaceAdminView(workspaceNamespace) .then((workspaceAdminView) => - setWorkspaceName(workspaceAdminView.workspace.name) + setWorkspaceName(workspaceAdminView.workspace.displayName) ); }, []); diff --git a/ui/src/app/pages/admin/workspace/basic-information.tsx b/ui/src/app/pages/admin/workspace/basic-information.tsx index b1cd074263c..db8fa92b36d 100644 --- a/ui/src/app/pages/admin/workspace/basic-information.tsx +++ b/ui/src/app/pages/admin/workspace/basic-information.tsx @@ -29,7 +29,7 @@ export const BasicInformation = ({ {workspace.billingStatus} - {workspace.name} + {workspace.displayName} {workspace.terraName} diff --git a/ui/src/app/pages/admin/workspace/cloud-environments-table.tsx b/ui/src/app/pages/admin/workspace/cloud-environments-table.tsx index 9d62beb1656..dfb67bfcb9f 100644 --- a/ui/src/app/pages/admin/workspace/cloud-environments-table.tsx +++ b/ui/src/app/pages/admin/workspace/cloud-environments-table.tsx @@ -142,7 +142,7 @@ export const CloudEnvironmentsTable = ({ emptyMessage='No active cloud environments exist for this workspace.' > - + // displayName? diff --git a/ui/src/app/pages/analysis/new-jupyter-notebook-modal.spec.tsx b/ui/src/app/pages/analysis/new-jupyter-notebook-modal.spec.tsx index 4d673da2d2b..78e1b857418 100644 --- a/ui/src/app/pages/analysis/new-jupyter-notebook-modal.spec.tsx +++ b/ui/src/app/pages/analysis/new-jupyter-notebook-modal.spec.tsx @@ -11,7 +11,7 @@ describe('NewNotebookModal', () => { const { getByTestId } = render( {}} - workspace={{ name: 'a' }} + workspace={{ displayName: 'a' }} existingNameList={['123.ipynb']} /> ); diff --git a/ui/src/app/pages/data/tanagra-dev/tanagra-resource-list.tsx b/ui/src/app/pages/data/tanagra-dev/tanagra-resource-list.tsx index b43eadd0560..5c997e6be37 100644 --- a/ui/src/app/pages/data/tanagra-dev/tanagra-resource-list.tsx +++ b/ui/src/app/pages/data/tanagra-dev/tanagra-resource-list.tsx @@ -76,7 +76,7 @@ interface NavProps { const WorkspaceNavigation = (props: NavProps) => { const { - workspace: { name, namespace, terraName }, + workspace: { namespace, displayName, terraName }, style, } = props; const url = dataTabPath(namespace, terraName); @@ -84,7 +84,7 @@ const WorkspaceNavigation = (props: NavProps) => { return ( - {name} + {displayName} ); diff --git a/ui/src/app/pages/runtimes-list.tsx b/ui/src/app/pages/runtimes-list.tsx index 3d7dbb55f8f..d0ca178758d 100644 --- a/ui/src/app/pages/runtimes-list.tsx +++ b/ui/src/app/pages/runtimes-list.tsx @@ -103,7 +103,7 @@ const css = display: none !important }`; -const stringToSlug = (s) => s.toLowerCase().replace(/\s+/g, ''); +const stringToSlug = (s: string) => s.toLowerCase().replace(/\s+/g, ''); interface RuntimesListProps extends WithSpinnerOverlayProps, @@ -139,8 +139,12 @@ export const RuntimesList = fp.flow( nav: { // called from, for example: // https://github.com/DataBiosphere/terra-ui/blob/4333c7b94d6ce10a6fe079361e98c2b6cc71f83a/src/pages/Environments.js#L420 - getLink: (_, { namespace, name }) => - analysisTabPath(namespace, stringToSlug(name)), + getLink: (_, { namespace, name, terraName }) => + analysisTabPath( + namespace, + // TODO why: this backup is necessary for Cloud Environments but not Disks + terraName ?? stringToSlug(name) + ), }, }} /> diff --git a/ui/src/app/pages/workspace/featured-workspaces.spec.tsx b/ui/src/app/pages/workspace/featured-workspaces.spec.tsx index 2ae8014b2b2..34e49353529 100644 --- a/ui/src/app/pages/workspace/featured-workspaces.spec.tsx +++ b/ui/src/app/pages/workspace/featured-workspaces.spec.tsx @@ -91,7 +91,7 @@ describe('Featured Workspace List', () => { }); expect( screen.queryByText( - WorkspaceStubVariables.DEFAULT_WORKSPACE_NAME + + WorkspaceStubVariables.DEFAULT_WORKSPACE_DISPLAY_NAME + featuredCategory[index] ) ).toBeInTheDocument(); diff --git a/ui/src/app/pages/workspace/featured-workspaces.tsx b/ui/src/app/pages/workspace/featured-workspaces.tsx index 3702ff094d1..6b82ad8b23f 100644 --- a/ui/src/app/pages/workspace/featured-workspaces.tsx +++ b/ui/src/app/pages/workspace/featured-workspaces.tsx @@ -193,7 +193,9 @@ export const FeaturedWorkspaces = (props) => { ); setWorkspaceList( workspacesReceived.items - .sort((a, b) => a.workspace.name.localeCompare(b.workspace.name)) + .sort((a, b) => + a.workspace.displayName.localeCompare(b.workspace.displayName) + ) .map((w) => new WorkspacePermissions(w)) ); setPendingWorkspaceRequests(false); @@ -290,7 +292,7 @@ export const FeaturedWorkspaces = (props) => { return ( getAllPublishedWorkspaces()} diff --git a/ui/src/app/pages/workspace/workspace-about.spec.tsx b/ui/src/app/pages/workspace/workspace-about.spec.tsx index fef7944e9cb..905d38b88ad 100644 --- a/ui/src/app/pages/workspace/workspace-about.spec.tsx +++ b/ui/src/app/pages/workspace/workspace-about.spec.tsx @@ -122,7 +122,9 @@ describe('WorkspaceAbout', () => { name: /share/i, }) ); - screen.getByText('Share ' + WorkspaceStubVariables.DEFAULT_WORKSPACE_NAME); + screen.getByText( + 'Share ' + WorkspaceStubVariables.DEFAULT_WORKSPACE_DISPLAY_NAME + ); }); test.each([ diff --git a/ui/src/app/pages/workspace/workspace-card.tsx b/ui/src/app/pages/workspace/workspace-card.tsx index 88201d836f2..457b856a037 100644 --- a/ui/src/app/pages/workspace/workspace-card.tsx +++ b/ui/src/app/pages/workspace/workspace-card.tsx @@ -111,7 +111,7 @@ export const WorkspaceCard = fp.flow(withNavigation)( deleteWorkspace = withErrorModal( { title: 'Error Deleting Workspace', - message: `Could not delete workspace '${this.props.workspace.name}'.`, + message: `Could not delete workspace '${this.props.workspace.displayName}'.`, showBugReportLink: true, onDismiss: () => { this.setState({ confirmDeleting: false }); @@ -144,10 +144,10 @@ export const WorkspaceCard = fp.flow(withNavigation)( trackWorkspaceNavigation() { const { - workspace: { name, featuredCategory }, + workspace: { displayName, featuredCategory }, } = this.props; !!featuredCategory - ? AnalyticsTracker.Workspaces.NavigateToFeatured(name) + ? AnalyticsTracker.Workspaces.NavigateToFeatured(displayName) : triggerEvent(EVENT_CATEGORY, 'navigate', 'Click on workspace name'); } @@ -176,7 +176,7 @@ export const WorkspaceCard = fp.flow(withNavigation)( onDuplicate={() => { !!workspace.featuredCategory ? AnalyticsTracker.Workspaces.DuplicateFeatured( - workspace.name + workspace.displayName ) : AnalyticsTracker.Workspaces.OpenDuplicatePage( 'Card' @@ -262,7 +262,7 @@ export const WorkspaceCard = fp.flow(withNavigation)( } data-test-id='workspace-card-name' > - {workspace.name} + {workspace.displayName} @@ -353,7 +353,7 @@ export const WorkspaceCard = fp.flow(withNavigation)( AnalyticsTracker.Workspaces.Delete(); this.deleteWorkspace(); }} - workspaceName={workspace.name} + workspaceName={workspace.displayName} /> )} {showShareModal && ( diff --git a/ui/src/app/pages/workspace/workspace-edit.spec.tsx b/ui/src/app/pages/workspace/workspace-edit.spec.tsx index c7732456764..a34fd220f7b 100644 --- a/ui/src/app/pages/workspace/workspace-edit.spec.tsx +++ b/ui/src/app/pages/workspace/workspace-edit.spec.tsx @@ -192,7 +192,7 @@ describe(WorkspaceEdit.name, () => { it('displays workspaces duplicate page', async () => { workspaceEditMode = WorkspaceEditMode.Duplicate; renderComponent(); - await screen.findByText(`Duplicate workspace "${workspace.name}"`); + await screen.findByText(`Duplicate workspace "${workspace.displayName}"`); // Ensure the 'drug development' checkbox is checked when duplicating. const drugDevelopmentCheckbox: HTMLInputElement = screen.getByTestId( @@ -484,7 +484,7 @@ describe(WorkspaceEdit.name, () => { const cdrUpgradeMessage = screen.getByTestId( 'cdr-version-upgrade' ).textContent; - expect(cdrUpgradeMessage).toContain(altCdrWorkspace.name); + expect(cdrUpgradeMessage).toContain(altCdrWorkspace.displayName); expect(cdrUpgradeMessage).toContain(expectedUpgradeMessage); }); }); @@ -657,19 +657,21 @@ describe(WorkspaceEdit.name, () => { workspaceEditMode = WorkspaceEditMode.Duplicate; renderComponent(); - userEvent.click(await screen.findByTestId('review-request-btn-false')); + await userEvent.click( + await screen.findByTestId('review-request-btn-false') + ); const numBefore = workspacesApi.workspaceOperations.length; - userEvent.click( - await screen.findByRole('button', { - name: /Duplicate Workspace/i, - }) + await userEvent.click( + await screen.findByRole('button', { name: /Duplicate Workspace/i }) ); const confirmSaveButton = await screen.findByRole('button', { name: 'Confirm', }); + // multiple clicks + await user.click(confirmSaveButton); await user.click(confirmSaveButton); await user.click(confirmSaveButton); @@ -1089,7 +1091,7 @@ describe(WorkspaceEdit.name, () => { ).toBeInTheDocument(); }); - it('Should trim workspace name', async () => { + it('Should trim workspace name appropriately', async () => { renderComponent(); const workspaceNameTextBox = await screen.findByTestId('workspace-name'); await userEvent.type( diff --git a/ui/src/app/pages/workspace/workspace-edit.tsx b/ui/src/app/pages/workspace/workspace-edit.tsx index 17768279313..a8e3b10bf33 100644 --- a/ui/src/app/pages/workspace/workspace-edit.tsx +++ b/ui/src/app/pages/workspace/workspace-edit.tsx @@ -285,7 +285,7 @@ const CdrVersionUpgrade = (props: UpgradeProps) => { return (
- {`You're duplicating the workspace "${srcWorkspace.name}" to upgrade from`}{' '} + {`You're duplicating the workspace "${srcWorkspace.displayName}" to upgrade from`}{' '} {fromCdrVersion} to {toCdrVersion}.
@@ -593,6 +593,7 @@ export const WorkspaceEdit = fp.flow( createWorkspace(): Workspace { return { name: '', + displayName: '', accessTierShortName: DEFAULT_ACCESS_TIER, cdrVersionId: '', researchPurpose: { @@ -652,9 +653,10 @@ export const WorkspaceEdit = fp.flow( } if (this.isMode(WorkspaceEditMode.Duplicate)) { - // This is the only field which is not automatically handled/differentiated + // name/displayName is the only field which is not automatically handled/differentiated // on the API level. workspace.name = 'Duplicate of ' + workspace.name; + workspace.displayName = 'Duplicate of ' + workspace.displayName; // unselect to prevent unneeded re-review workspace.researchPurpose.reviewRequested = undefined; } @@ -974,9 +976,9 @@ export const WorkspaceEdit = fp.flow( case WorkspaceEditMode.Create: return 'Create a new workspace'; case WorkspaceEditMode.Edit: - return 'Edit workspace "' + workspace.name + '"'; + return 'Edit workspace "' + workspace.displayName + '"'; case WorkspaceEditMode.Duplicate: - return 'Duplicate workspace "' + workspace.name + '"'; + return 'Duplicate workspace "' + workspace.displayName + '"'; } } @@ -1283,6 +1285,7 @@ export const WorkspaceEdit = fp.flow( populationChecked, workspace: { name, + displayName, billingAccountName, researchPurpose: { anticipatedFindings, @@ -1303,6 +1306,7 @@ export const WorkspaceEdit = fp.flow( } = this.state; const values: object = { name, + displayName, billingAccountName, anticipatedFindings, intendedStudy, @@ -1337,7 +1341,8 @@ export const WorkspaceEdit = fp.flow( // surfaced directly. Currently these constraints are entirely separate // from the user facing error strings we render. const constraints: object = { - name: requiredStringWithMaxLength(80, 'Name'), + // name is not included, in order to avoid duplicate error messages + displayName: requiredStringWithMaxLength(80, 'Name'), // The prefix for these lengthMessages require HTML formatting // The prefix string is omitted here and included in the React template below billingAccountName: { presence: true }, @@ -1415,6 +1420,11 @@ export const WorkspaceEdit = fp.flow( ); } + setWorkspaceName(name: string) { + this.setState(fp.set(['workspace', 'name'], name)); + this.setState(fp.set(['workspace', 'displayName'], name)); + } + render() { const params = parseQueryParams(this.props.location.search); const highlightBilling = !!params.get('highlightBilling'); @@ -1422,6 +1432,7 @@ export const WorkspaceEdit = fp.flow( const { workspace: { name, + displayName, billingAccountName, cdrVersionId, accessTierShortName, @@ -1512,12 +1523,12 @@ export const WorkspaceEdit = fp.flow( style={styles.textInput} autoFocus placeholder='Workspace Name' - value={name} - onBlur={(v) => - this.setState(fp.set(['workspace', 'name'], v.trim())) - } - onChange={(v) => - this.setState(fp.set(['workspace', 'name'], v)) + value={displayName} + onBlur={(v: string) => this.setWorkspaceName(v.trim())} + onChange={(v: string) => + // do not trim, because it would prevent inner spaces + // e.g. it would turn "My Workspace" into "MyWorkspace" + this.setWorkspaceName(v) } /> @@ -2282,7 +2293,7 @@ export const WorkspaceEdit = fp.flow( {this.props.workspaceEditMode === WorkspaceEditMode.Create ? 'You already have a workspace named ' + - name + + displayName + ' Please choose another name' : 'Another client has modified this workspace since the beginning of this editing ' + 'session. Please reload to avoid overwriting those changes.'} diff --git a/ui/src/app/pages/workspace/workspace-list.spec.tsx b/ui/src/app/pages/workspace/workspace-list.spec.tsx index 4812f4691cc..f5929450a73 100644 --- a/ui/src/app/pages/workspace/workspace-list.spec.tsx +++ b/ui/src/app/pages/workspace/workspace-list.spec.tsx @@ -23,7 +23,7 @@ import { WorkspacesApiStub } from 'testing/stubs/workspaces-api-stub'; import { WorkspaceList } from './workspace-list'; -describe('WorkspaceList', () => { +describe(WorkspaceList.name, () => { const profile = ProfileStubVariables.PROFILE_STUB; let profileApi: ProfileApiStub; let user; @@ -81,7 +81,7 @@ describe('WorkspaceList', () => { it('displays the correct number of workspaces', async () => { component(); await waitForNoSpinner(); - expect(getCardNames()).toEqual(workspaceStubs.map((w) => w.name)); + expect(getCardNames()).toEqual(workspaceStubs.map((w) => w.displayName)); }); it('has the correct permissions classes', async () => { @@ -122,13 +122,13 @@ describe('WorkspaceList', () => { ); await pickAccessLevel(accessLevelDropdown, 'Reader'); - expect(getCardNames()).toEqual([workspaceRead.name]); + expect(getCardNames()).toEqual([workspaceRead.displayName]); await pickAccessLevel(accessLevelDropdown, 'Owner'); - expect(getCardNames()).toEqual([workspaceOwn.name]); + expect(getCardNames()).toEqual([workspaceOwn.displayName]); await pickAccessLevel(accessLevelDropdown, 'Writer'); - expect(getCardNames()).toEqual([workspaceWrite.name]); + expect(getCardNames()).toEqual([workspaceWrite.displayName]); await pickAccessLevel(accessLevelDropdown, 'All'); expect(getCardNames().length).toEqual(3); diff --git a/ui/src/app/pages/workspace/workspace-list.tsx b/ui/src/app/pages/workspace/workspace-list.tsx index 479a99db37e..9c3567497f6 100644 --- a/ui/src/app/pages/workspace/workspace-list.tsx +++ b/ui/src/app/pages/workspace/workspace-list.tsx @@ -74,7 +74,7 @@ export const WorkspaceList = fp.flow(withUserProfile())( const workspacesReceived = (await workspacesApi().getWorkspaces()) .items; workspacesReceived.sort((a, b) => - a.workspace.name.localeCompare(b.workspace.name) + a.workspace.displayName.localeCompare(b.workspace.displayName) ); this.setState({ workspaceList: workspacesReceived.map( diff --git a/ui/src/app/pages/workspace/workspace-share.spec.tsx b/ui/src/app/pages/workspace/workspace-share.spec.tsx index 233cda33fd7..cf2da2ac2e9 100644 --- a/ui/src/app/pages/workspace/workspace-share.spec.tsx +++ b/ui/src/app/pages/workspace/workspace-share.spec.tsx @@ -78,7 +78,7 @@ describe(WorkspaceShare.name, () => { const tomRiddleDiary: WorkspaceData = { namespace: 'Horcrux', - name: 'The Diary of Tom Marvolo Riddle', + displayName: 'The Diary of Tom Marvolo Riddle', terraName: 'diary', etag: '1', accessLevel: WorkspaceAccessLevel.OWNER, diff --git a/ui/src/app/pages/workspace/workspace-share.tsx b/ui/src/app/pages/workspace/workspace-share.tsx index 44756f15f89..e710613d615 100644 --- a/ui/src/app/pages/workspace/workspace-share.tsx +++ b/ui/src/app/pages/workspace/workspace-share.tsx @@ -438,7 +438,7 @@ export const WorkspaceShare = fp.flow(withUserProfile())( }} >
- +
triggerEvent(AnalyticsCategory.WORKSPACES, 'Duplicate'), - DuplicateFeatured: (name) => + DuplicateFeatured: (displayName: string) => triggerEvent( AnalyticsCategory.FEATURED_WORKSPACES, 'Click', - `Featured Workspace - Tile - Duplicate - ${name}` + `Featured Workspace - Tile - Duplicate - ${displayName}` ), - NavigateToFeatured: (name) => + NavigateToFeatured: (displayName: string) => triggerEvent( AnalyticsCategory.FEATURED_WORKSPACES, 'Click', - `Featured Workspace - Tile - ${name}` + `Featured Workspace - Tile - ${displayName}` ), OpenEditPage: (suffix = '') => triggerEvent( diff --git a/ui/src/app/utils/cdr-versions.spec.tsx b/ui/src/app/utils/cdr-versions.spec.tsx index dbfc01b2607..bb201da2fcc 100644 --- a/ui/src/app/utils/cdr-versions.spec.tsx +++ b/ui/src/app/utils/cdr-versions.spec.tsx @@ -16,7 +16,7 @@ import { import { WorkspaceStubVariables } from 'testing/stubs/workspaces'; const stubWorkspace: Workspace = { - name: WorkspaceStubVariables.DEFAULT_WORKSPACE_NAME, + displayName: WorkspaceStubVariables.DEFAULT_WORKSPACE_DISPLAY_NAME, terraName: WorkspaceStubVariables.DEFAULT_WORKSPACE_TERRA_NAME, namespace: WorkspaceStubVariables.DEFAULT_WORKSPACE_NS, }; diff --git a/ui/src/testing/stubs/cohorts-api-stub.ts b/ui/src/testing/stubs/cohorts-api-stub.ts index c5aeab88dbf..a3bcfe93486 100644 --- a/ui/src/testing/stubs/cohorts-api-stub.ts +++ b/ui/src/testing/stubs/cohorts-api-stub.ts @@ -82,7 +82,7 @@ export class CohortsApiStub extends CohortsApi { super(undefined); const stubWorkspace: Workspace = { - name: WorkspaceStubVariables.DEFAULT_WORKSPACE_NAME, + displayName: WorkspaceStubVariables.DEFAULT_WORKSPACE_DISPLAY_NAME, terraName: WorkspaceStubVariables.DEFAULT_WORKSPACE_TERRA_NAME, namespace: WorkspaceStubVariables.DEFAULT_WORKSPACE_NS, }; diff --git a/ui/src/testing/stubs/workspaces-api-stub.ts b/ui/src/testing/stubs/workspaces-api-stub.ts index 70c0050fd72..30a6ba13c85 100644 --- a/ui/src/testing/stubs/workspaces-api-stub.ts +++ b/ui/src/testing/stubs/workspaces-api-stub.ts @@ -278,8 +278,8 @@ export class WorkspacesApiStub extends WorkspacesApi { return new Promise((resolve) => { const workspace: WorkspaceData = { namespace: workspaceNamespace, + displayName: WorkspaceStubVariables.DEFAULT_WORKSPACE_DISPLAY_NAME, terraName, - name: WorkspaceStubVariables.DEFAULT_WORKSPACE_NAME, accessLevel: WorkspaceAccessLevel.OWNER, cdrVersionId: CdrVersionsStubVariables.DEFAULT_WORKSPACE_CDR_VERSION_ID, }; diff --git a/ui/src/testing/stubs/workspaces.tsx b/ui/src/testing/stubs/workspaces.tsx index 7a1dd13d766..592ec251148 100644 --- a/ui/src/testing/stubs/workspaces.tsx +++ b/ui/src/testing/stubs/workspaces.tsx @@ -13,8 +13,8 @@ import { CdrVersionsStubVariables } from './cdr-versions-api-stub'; export class WorkspaceStubVariables { static DEFAULT_WORKSPACE_NS = 'defaultNamespace'; - static DEFAULT_WORKSPACE_NAME = 'defaultWorkspace'; - static DEFAULT_WORKSPACE_TERRA_NAME = 'one'; + static DEFAULT_WORKSPACE_DISPLAY_NAME = 'Default Workspace'; + static DEFAULT_WORKSPACE_TERRA_NAME = 'defaultworkspace'; static DEFAULT_WORKSPACE_PERMISSION = WorkspaceAccessLevel.OWNER; static DEFAULT_GOOGLE_PROJECT_ID = 'terra-vpc-sc-test'; static DEFAULT_GOOGLE_BUCKET_NAME = 'fc-secure-bucket'; @@ -22,7 +22,7 @@ export class WorkspaceStubVariables { export function buildWorkspaceStub(suffix = ''): Workspace { return { - name: WorkspaceStubVariables.DEFAULT_WORKSPACE_NAME + suffix, + displayName: WorkspaceStubVariables.DEFAULT_WORKSPACE_DISPLAY_NAME + suffix, terraName: WorkspaceStubVariables.DEFAULT_WORKSPACE_TERRA_NAME + suffix, googleProject: WorkspaceStubVariables.DEFAULT_GOOGLE_PROJECT_ID + suffix, googleBucketName: