Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workspace name -> displayName #8787

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/src/main/resources/workbench-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7219,7 +7219,7 @@ components:
$ref: '#/components/schemas/WorkspaceResponse'
Workspace:
required:
- name
- displayName
type: object
properties:
etag:
Expand Down
8 changes: 4 additions & 4 deletions ui/src/app/components/breadcrumb.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('getTrail', () => {
);
expect(trail.map((item) => item.label)).toEqual([
'Workspaces',
workspaceDataStub.name,
workspaceDataStub.displayName,
cohortReviewStubs[0].cohortName,
`Participant ${pid}`,
]);
Expand Down Expand Up @@ -93,7 +93,7 @@ describe('getTrail', () => {

expect(trail.map((item) => item.label)).toEqual([
'Workspaces',
workspaceDataStub.name,
workspaceDataStub.displayName,
analysisTabDisplay,
nbName,
]);
Expand All @@ -118,7 +118,7 @@ describe('getTrail', () => {

expect(trail.map((item) => item.label)).toEqual([
'Workspaces',
workspaceDataStub.name,
workspaceDataStub.displayName,
analysisTabDisplay,
nbName,
]);
Expand Down Expand Up @@ -146,7 +146,7 @@ describe('getTrail', () => {
expect(trailLabels).not.toContain(nbName);
expect(trailLabels).toEqual([
'Workspaces',
workspaceDataStub.name,
workspaceDataStub.displayName,
analysisTabDisplay,
UIAppType.RSTUDIO,
]);
Expand Down
18 changes: 2 additions & 16 deletions ui/src/app/components/breadcrumb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -99,7 +100,7 @@ export const getTrail = (
params
),
new BreadcrumbData(
workspace ? workspace.name : '...',
workspace?.displayName ?? '...',
dataTabPath(ns, terraName)
),
];
Expand Down Expand Up @@ -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 [];
}
Expand Down
33 changes: 17 additions & 16 deletions ui/src/app/components/copy-modal.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { CopyModal, CopyModalProps } from './copy-modal';

interface TestWorkspace {
namespace: string;
name: string;
displayName: string;
terraName: string;
cdrVersionId: string;
accessTierShortName: string;
Expand All @@ -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);
};
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions ui/src/app/components/copy-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})),
}));
}
Expand Down Expand Up @@ -512,8 +512,8 @@ const CopyModal = withCdrVersions()(
{' '}
Successfully copied
<b style={styles.bold}> {fromResourceName} </b> to
<b style={styles.bold}> {this.state.destination.name} </b>. Do you
want to view the copied {toDisplay(resourceType)}?
<b style={styles.bold}> {this.state.destination.displayName} </b>. Do
you want to view the copied {toDisplay(resourceType)}?
</div>
);
}
Expand Down
4 changes: 2 additions & 2 deletions ui/src/app/components/help-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down Expand Up @@ -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}
/>
),
],
Expand Down
4 changes: 2 additions & 2 deletions ui/src/app/components/resources/resource-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ interface NavProps {

const WorkspaceNavigation = (props: NavProps) => {
const {
workspace: { name, namespace, terraName },
workspace: { displayName, namespace, terraName },
resource,
style,
} = props;
Expand All @@ -77,7 +77,7 @@ const WorkspaceNavigation = (props: NavProps) => {
return (
<Clickable>
<Link to={url} style={style} data-test-id='workspace-navigation'>
{name}
{displayName}
</Link>
</Clickable>
);
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/pages/admin/admin-notebook-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const AdminNotebookViewComponent = (props: Props) => {
workspaceAdminApi()
.getWorkspaceAdminView(workspaceNamespace)
.then((workspaceAdminView) =>
setWorkspaceName(workspaceAdminView.workspace.name)
setWorkspaceName(workspaceAdminView.workspace.displayName)
);
}, []);

Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/pages/admin/workspace/basic-information.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const BasicInformation = ({
{workspace.billingStatus}
</WorkspaceInfoField>
<WorkspaceInfoField labelText='Workspace Name'>
{workspace.name}
{workspace.displayName}
</WorkspaceInfoField>
<WorkspaceInfoField labelText='Terra Name'>
{workspace.terraName}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export const CloudEnvironmentsTable = ({
emptyMessage='No active cloud environments exist for this workspace.'
>
<Column field='appType' header='Environment Type' />
<Column field='name' header='Name' />
<Column field='name' header='Name' /> // displayName?
<Column field='creator' header='Creator' />
<Column field='createdTime' header='Created Time' />
<Column field='lastAccessedTime' header='Last Accessed Time' />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('NewNotebookModal', () => {
const { getByTestId } = render(
<NewJupyterNotebookModal
onClose={() => {}}
workspace={{ name: 'a' }}
workspace={{ displayName: 'a' }}
existingNameList={['123.ipynb']}
/>
);
Expand Down
4 changes: 2 additions & 2 deletions ui/src/app/pages/data/tanagra-dev/tanagra-resource-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ interface NavProps {

const WorkspaceNavigation = (props: NavProps) => {
const {
workspace: { name, namespace, terraName },
workspace: { namespace, displayName, terraName },
style,
} = props;
const url = dataTabPath(namespace, terraName);

return (
<Clickable>
<Link to={url} style={style} data-test-id='workspace-navigation'>
{name}
{displayName}
</Link>
</Clickable>
);
Expand Down
10 changes: 7 additions & 3 deletions ui/src/app/pages/runtimes-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
),
},
}}
/>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/pages/workspace/featured-workspaces.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ describe('Featured Workspace List', () => {
});
expect(
screen.queryByText(
WorkspaceStubVariables.DEFAULT_WORKSPACE_NAME +
WorkspaceStubVariables.DEFAULT_WORKSPACE_DISPLAY_NAME +
featuredCategory[index]
)
).toBeInTheDocument();
Expand Down
6 changes: 4 additions & 2 deletions ui/src/app/pages/workspace/featured-workspaces.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -290,7 +292,7 @@ export const FeaturedWorkspaces = (props) => {
return (
<WorkspaceCard
useFeaturedWorkspacePageUi
key={wp.workspace.name}
key={wp.workspace.displayName}
workspace={wp.workspace}
accessLevel={wp.accessLevel}
reload={() => getAllPublishedWorkspaces()}
Expand Down
4 changes: 3 additions & 1 deletion ui/src/app/pages/workspace/workspace-about.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down
Loading