Skip to content

Commit

Permalink
[risk=low][no ticket] Post-release RStudio UI updates (#8413)
Browse files Browse the repository at this point in the history
* compute suspended tooltip: Jupyter Cloud Environment
* New Jupyter Notebook as modal title
* shift open or create right when there's no delete
  • Loading branch information
jmthibault79 authored Mar 5, 2024
1 parent 8ff2795 commit 93c4ecb
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 11 deletions.
4 changes: 2 additions & 2 deletions ui/src/app/components/apps-panel/expanded-app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import {

import { AppBanner } from './app-banner';
import { AppsPanelButton } from './apps-panel-button';
import { NewNotebookButton } from './new-notebook-button';
import { NewJupyterNotebookButton } from './new-jupyter-notebook-button';
import { PauseResumeButton } from './pause-resume-button';
import { RuntimeCost } from './runtime-cost';
import {
Expand Down Expand Up @@ -122,7 +122,7 @@ const JupyterButtonRow = (props: {
<FlexRow>
<SettingsButton onClick={onClickRuntimeConf} />
<PauseRuntimeButton {...{ workspace }} />
<NewNotebookButton {...{ workspace }} />
<NewJupyterNotebookButton {...{ workspace }} />
</FlexRow>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { notebooksApi } from 'app/services/swagger-fetch-clients';

import { AppsPanelButton } from './apps-panel-button';

export const NewNotebookButton = (props: { workspace: Workspace }) => {
export const NewJupyterNotebookButton = (props: { workspace: Workspace }) => {
const { workspace } = props;

const [showModal, setShowModal] = useState(false);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { useState } from 'react';
import { CSSProperties, useState } from 'react';

import {
AppType,
Expand All @@ -24,6 +24,7 @@ export interface CreateGKEAppButtonProps {
onDismiss: () => void;
username: string;
billingStatus: BillingStatus;
style?: CSSProperties;
}

export function CreateGkeAppButton({
Expand All @@ -33,6 +34,7 @@ export function CreateGkeAppButton({
onDismiss,
username,
billingStatus,
style,
}: CreateGKEAppButtonProps) {
const [creatingApp, setCreatingApp] = useState(false);
const createEnabled =
Expand Down Expand Up @@ -83,7 +85,7 @@ export function CreateGkeAppButton({
return (
<TooltipTrigger disabled={createEnabled} content={tooltip}>
{/* tooltip trigger needs a div for some reason */}
<div>
<div {...{ style }}>
<Button
id={`${appTypeString}-cloud-environment-create-button`}
aria-label={`${appTypeString} cloud environment create button`}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react';
import { CSSProperties } from 'react';
import { Dropdown } from 'primereact/dropdown';

import {
Expand Down Expand Up @@ -166,6 +167,20 @@ export const CreateGkeApp = ({
</div>
);

const showDeleteDiskButton = unattachedDiskExists(app, disk);
const showDeleteAppButton = canDeleteApp(app);

// when there is a delete button, FlexRow aligns the open/create button to the right
// for consistency of location when there is no delete button, we shift it to the right with `margin-left: auto`

const shiftOpenOrCreateButtonRight =
!showDeleteDiskButton && !showDeleteAppButton;
const openOrCreateButtonStyle: CSSProperties = shiftOpenOrCreateButtonRight
? {
marginLeft: 'auto',
}
: {};

return (
<FlexColumn
id={`${appTypeToString[appType]}-configuration-panel`}
Expand Down Expand Up @@ -274,13 +289,13 @@ export const CreateGkeApp = ({
gap: '2rem',
}}
>
{unattachedDiskExists(app, disk) && (
{showDeleteDiskButton && (
<DeletePersistentDiskButton
onClick={onClickDeleteUnattachedPersistentDisk}
style={{ flexShrink: 0 }}
/>
)}
{canDeleteApp(app) && (
{showDeleteAppButton && (
<LinkButton
style={{ ...styles.deleteLink, flexShrink: 0 }}
aria-label='Delete Environment'
Expand All @@ -295,13 +310,15 @@ export const CreateGkeApp = ({
<OpenGkeAppButton
{...{ billingStatus, workspace, onClose }}
userApp={app}
style={openOrCreateButtonStyle}
/>
) : (
<CreateGkeAppButton
{...{ billingStatus, createAppRequest, onDismiss }}
existingApp={app}
workspaceNamespace={workspace.namespace}
username={profile.username}
style={openOrCreateButtonStyle}
/>
)}
</FlexRow>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react';
import { CSSProperties } from 'react';

import { BillingStatus, UserAppEnvironment, Workspace } from 'generated/fetch';

Expand All @@ -12,12 +13,14 @@ export interface OpenGkeAppButtonProps {
billingStatus: BillingStatus;
workspace: Workspace;
onClose: () => void;
style?: CSSProperties;
}
export function OpenGkeAppButton({
userApp,
billingStatus,
workspace: { namespace, id },
onClose,
style,
}: OpenGkeAppButtonProps) {
const [navigate] = useNavigation();

Expand All @@ -31,7 +34,7 @@ export function OpenGkeAppButton({
return (
<TooltipTrigger disabled={openEnabled} content={tooltip}>
{/* tooltip trigger needs a div for some reason */}
<div>
<div {...{ style }}>
<Button
id={`${appTypeString}-cloud-environment-open-button`}
aria-label={`${appTypeString} cloud environment open button`}
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/components/help-sidebar-icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ const iconConfig = (props: IconConfigProps): IconConfig => {
showIcon: () => true,
style: { width: '36px' },
tooltip: runtimeTooltip(
'Cloud Analysis Environment',
'Jupyter Cloud Environment',
loadingError,
userSuspended
),
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/pages/analysis/new-jupyter-notebook-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export const NewJupyterNotebookModal = (props: Props) => {
label: 'New Notebook Modal',
}}
>
<ModalTitle>New Notebook</ModalTitle>
<ModalTitle>New Jupyter Notebook</ModalTitle>
<ModalBody>
<div style={headerStyles.formLabel}>Name:</div>
<TextInput
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/pages/appAnalysis/app-selector.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ describe('App Selector', () => {
screen.queryByText('Select an application')
).not.toBeInTheDocument();
// the Jupyter modal is visible
expect(screen.queryByText('New Notebook')).toBeInTheDocument();
expect(screen.queryByText('New Jupyter Notebook')).toBeInTheDocument();
});
});

Expand Down

0 comments on commit 93c4ecb

Please sign in to comment.