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

Some small changes to the dashboard from QA session #12430

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions app/common/src/text/english.json
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@
"startTrial": "Start Trial",
"trialDescription": "Start a $0-day free trial",
"downgradeDescription": "Looking for downgrade options?",
"settings": "Settings",
"cloud": "Cloud",
"local": "Local",
"category": "Category",
Expand Down Expand Up @@ -262,7 +261,7 @@
"logs": "Logs",
"showLogs": "Show Logs",
"executions": "Executions",
"executionsCalendar": "Executions Calendar",
"executionsCalendar": "Scheduler",
"accept": "Accept",
"decline": "Decline",
"clearTrash": "Clear Trash",
Expand Down Expand Up @@ -356,9 +355,11 @@
"newFolder": "New Folder",
"newProject": "New Project",
"uploadFiles": "Import",
"downloadFiles": "Download",
"downloadFiles": "Export",
"newDatalink": "New Datalink",
"newDatalinkOnlyCloud": "New Datalink - only available in the cloud",
"newSecret": "New Secret",
"newSecretOnlyCloud": "New Secret - only available in the cloud",
"newLabel": "New Label",
"newEmptyProject": "New Project",

Expand Down Expand Up @@ -815,7 +816,6 @@
"uploadToCloudShortcut": "Upload to Cloud",
"renameShortcut": "Rename",
"editShortcut": "Edit",
"editDescriptionShortcut": "Edit Description",
"snapshotShortcut": "Snapshot",
"deleteShortcut": "Delete",
"undeleteShortcut": "Restore From Trash",
Expand Down
31 changes: 10 additions & 21 deletions app/gui/integration-test/dashboard/editAssetName.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,6 @@ function locateEditingCross(page: Locator) {
return page.getByLabel(TEXT.cancelEdit)
}

test('edit name (double click)', ({ page }) =>
mockAllAndLogin({ page })
.createFolder()
.driveTable.withRows(async (rows, _, { api }) => {
const row = rows.nth(0)
const nameEl = locateAssetRowName(row)
await nameEl.click()
await nameEl.click()
await locateInput(nameEl).fill(NEW_NAME)
const calls = api.trackCalls()
await locateEditingTick(row).click()
await expect(row).toHaveText(new RegExp('^' + NEW_NAME))
expect(calls.updateDirectory).toMatchObject([{ title: NEW_NAME }])
}))

test('edit name (context menu)', ({ page }) =>
mockAllAndLogin({ page })
.createFolder()
Expand Down Expand Up @@ -83,15 +68,17 @@ test('edit name (keyboard)', ({ page }) =>
expect(calls.updateDirectory).toMatchObject([{ title: NEW_NAME_2 }])
}))

test('cancel editing name (double click)', ({ page }) =>
test('cancel editing name (context menu)', ({ page }) =>
mockAllAndLogin({ page })
.createFolder()
.driveTable.withRows(async (rows, _, { api }) => {
const row = rows.nth(0)
const nameEl = locateAssetRowName(row)
const oldName = (await nameEl.textContent()) ?? ''
await nameEl.click()
await nameEl.click()
await nameEl.click({ button: 'right' })
await locateContextMenu(page)
.getByText(/Rename/)
.click()
await nameEl.getByTestId('input').fill(NEW_NAME)
const calls = api.trackCalls()
await locateEditingCross(row).click()
Expand Down Expand Up @@ -119,15 +106,17 @@ test('cancel editing name (keyboard)', ({ page }) => {
})
})

test('change to blank name (double click)', ({ page }) =>
test('change to blank name (context menu)', ({ page }) =>
mockAllAndLogin({ page })
.createFolder()
.driveTable.withRows(async (rows, _, { api }) => {
const row = rows.nth(0)
const nameEl = locateAssetRowName(row)
const oldName = (await nameEl.textContent()) ?? ''
await nameEl.click()
await nameEl.click()
await nameEl.click({ button: 'right' })
await locateContextMenu(page)
.getByText(/Rename/)
.click()
await nameEl.getByTestId('input').fill('')
await expect(locateEditingTick(row)).toBeVisible()
const calls = api.trackCalls()
Expand Down
1 change: 0 additions & 1 deletion app/gui/src/dashboard/components/MenuEntry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export const ACTION_TO_TEXT_ID: Readonly<
uploadToCloud: 'uploadToCloudShortcut',
rename: 'renameShortcut',
edit: 'editShortcut',
editDescription: 'editDescriptionShortcut',
snapshot: 'snapshotShortcut',
delete: 'deleteShortcut',
undelete: 'undeleteShortcut',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { useGetAssetChildren } from '#/layouts/Drive/assetsTableItemsHooks'
import { useDriveStore, useSetCurrentDirectoryId } from '#/providers/DriveProvider'
import { useText } from '#/providers/TextProvider'
import { isNewTitleUnique, type DirectoryAsset } from '#/services/Backend'
import { isSingleClick } from '#/utilities/event'
import { merger } from '#/utilities/object'
import { twMerge } from '#/utilities/tailwindMerge'
import { isDirectoryNameContainInvalidCharacters } from '#/utilities/validation'
Expand Down Expand Up @@ -61,16 +60,6 @@ export default function DirectoryNameColumn(props: DirectoryNameColumnProps) {
event.stopPropagation()
}
}}
onClick={(event) => {
if (isSingleClick(event) && driveStore.getState().selectedIds.size === 1) {
const [id] = driveStore.getState().selectedIds
if (item.id === id) {
event.stopPropagation()
setIsEditing(true)
return
}
}
}}
>
<Button
icon={FolderIcon}
Expand Down
16 changes: 1 addition & 15 deletions app/gui/src/dashboard/components/dashboard/FileNameColumn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ import EditableSpan from '#/components/EditableSpan'
import SvgMask from '#/components/SvgMask'
import { backendMutationOptions } from '#/hooks/backendHooks'
import { useGetAssetChildren } from '#/layouts/Drive/assetsTableItemsHooks'
import { useDriveStore } from '#/providers/DriveProvider'
import { useText } from '#/providers/TextProvider'
import { BackendType, isNewTitleUnique, type FileAsset } from '#/services/Backend'
import { isSingleClick } from '#/utilities/event'
import { isNewTitleUnique, type FileAsset } from '#/services/Backend'
import { fileIcon } from '#/utilities/fileIcon'
import { merger } from '#/utilities/object'
import { useMutation } from '@tanstack/react-query'
Expand All @@ -25,10 +23,8 @@ export interface FileNameColumnProps extends AssetColumnProps {
export default function FileNameColumn(props: FileNameColumnProps) {
const { item, state, rowState, setRowState, isEditable } = props
const { backend } = state
const isCloud = backend.type === BackendType.remote

const getAssetChildren = useGetAssetChildren()
const driveStore = useDriveStore()
const { getText } = useText()
const updateFileMutation = useMutation(backendMutationOptions(backend, 'updateFile'))

Expand All @@ -51,16 +47,6 @@ export default function FileNameColumn(props: FileNameColumnProps) {
event.stopPropagation()
}
}}
onClick={(event) => {
if (!isCloud && isSingleClick(event) && driveStore.getState().selectedIds.size === 1) {
const [id] = driveStore.getState().selectedIds
if (item.id === id) {
event.stopPropagation()
setIsEditing(true)
return
}
}
}}
>
<SvgMask src={fileIcon()} className="m-name-column-icon size-4" />
<EditableSpan
Expand Down
19 changes: 0 additions & 19 deletions app/gui/src/dashboard/components/dashboard/ProjectIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/** @file An interactive button indicating the status of a project. */
import * as reactQuery from '@tanstack/react-query'

import ArrowUpIcon from '#/assets/arrow_up.svg'
import PlayIcon from '#/assets/play.svg'
import StopIcon from '#/assets/stop.svg'

Expand Down Expand Up @@ -83,7 +82,6 @@ export default function ProjectIcon(props: ProjectIconProps) {

const openProject = projectHooks.useOpenProject()
const closeProject = projectHooks.useCloseProject()
const openProjectTab = projectHooks.useOpenEditor()

const { user } = authProvider.useFullUserSession()
const { getText } = textProvider.useText()
Expand Down Expand Up @@ -163,9 +161,6 @@ export default function ProjectIcon(props: ProjectIconProps) {
const doCloseProject = useEventCallback(() => {
closeProject({ ...item, type: backend.type })
})
const doOpenProjectTab = useEventCallback(() => {
openProjectTab(item.id)
})

const getTooltip = (defaultTooltip: string) =>
disabledTooltip ?? userOpeningProjectTooltip ?? defaultTooltip
Expand Down Expand Up @@ -241,20 +236,6 @@ export default function ProjectIcon(props: ProjectIconProps) {
)}
/>
</div>

{!isOtherUserUsingProject && !isRunningInBackground && (
<ariaComponents.Button
size="large"
variant="icon"
extraClickZone="xsmall"
icon={ArrowUpIcon}
aria-label={getTooltip(getText('openInEditor'))}
isDisabled={isDisabled}
tooltipPlacement="right"
onPress={doOpenProjectTab}
testId="switch-to-project"
/>
)}
</div>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,9 @@ import { backendMutationOptions } from '#/hooks/backendHooks'
import { useOpenProject } from '#/hooks/projectHooks'
import { useGetAssetChildren } from '#/layouts/Drive/assetsTableItemsHooks'
import { useFullUserSession } from '#/providers/AuthProvider'
import { useDriveStore } from '#/providers/DriveProvider'
import { useText } from '#/providers/TextProvider'
import {
BackendType,
IS_OPENING_OR_OPENED,
isNewTitleUnique,
type ProjectAsset,
} from '#/services/Backend'
import { isDoubleClick, isSingleClick } from '#/utilities/event'
import { BackendType, isNewTitleUnique, type ProjectAsset } from '#/services/Backend'
import { isDoubleClick } from '#/utilities/event'
import { merger } from '#/utilities/object'
import { PERMISSION_ACTION_CAN_EXECUTE, tryFindSelfPermission } from '#/utilities/permissions'
import { twMerge } from '#/utilities/tailwindMerge'
Expand All @@ -36,14 +30,12 @@ export default function ProjectNameColumn(props: ProjectNameColumnProps) {
const { getText } = useText()
const getAssetChildren = useGetAssetChildren()

const driveStore = useDriveStore()
const doOpenProject = useOpenProject()
const ownPermission = tryFindSelfPermission(user, item.permissions)
// This is a workaround for a temporary bad state in the backend causing the `projectState` key
// to be absent.
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
const projectState = item.projectState ?? CLOSED_PROJECT_STATE
const isRunning = IS_OPENING_OR_OPENED[projectState.type]
const canExecute =
isEditable &&
(backend.type === BackendType.local ||
Expand Down Expand Up @@ -80,17 +72,6 @@ export default function ProjectNameColumn(props: ProjectNameColumnProps) {
onClick={(event) => {
if (rowState.isEditingName || isOtherUserUsingProject) {
// The project should neither be edited nor opened in these cases.
} else if (
!isRunning &&
isSingleClick(event) &&
driveStore.getState().selectedIds.size === 1
) {
const [id] = driveStore.getState().selectedIds
if (item.id === id) {
event.stopPropagation()
setIsEditing(true)
return
}
} else if (isDoubleClick(event) && canExecute) {
doOpenProject({
id: item.id,
Expand Down
13 changes: 2 additions & 11 deletions app/gui/src/dashboard/components/dashboard/SecretNameColumn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ import { backendMutationOptions } from '#/hooks/backendHooks'
import { useToastAndLog } from '#/hooks/toastAndLogHooks'
import { useGetAssetChildren } from '#/layouts/Drive/assetsTableItemsHooks'
import UpsertSecretModal from '#/modals/UpsertSecretModal'
import { useDriveStore } from '#/providers/DriveProvider'
import { useSetModal } from '#/providers/ModalProvider'
import { useText } from '#/providers/TextProvider'
import { isNewTitleUnique, type SecretAsset } from '#/services/Backend'
import { isDoubleClick, isSingleClick } from '#/utilities/event'
import { isDoubleClick } from '#/utilities/event'
import { merger } from '#/utilities/object'
import { useMutation } from '@tanstack/react-query'

Expand All @@ -28,7 +27,6 @@ export default function SecretNameColumn(props: SecretNameColumnProps) {
const { getText } = useText()
const { setModal } = useSetModal()
const getAssetChildren = useGetAssetChildren()
const driveStore = useDriveStore()

const updateSecretMutation = useMutation(backendMutationOptions(backend, 'updateSecret'))

Expand All @@ -52,14 +50,7 @@ export default function SecretNameColumn(props: SecretNameColumnProps) {
}
}}
onClick={(event) => {
if (isSingleClick(event) && driveStore.getState().selectedIds.size === 1) {
const [id] = driveStore.getState().selectedIds
if (item.id === id) {
event.stopPropagation()
setIsEditing(true)
return
}
} else if (isDoubleClick(event) && isEditable) {
if (isDoubleClick(event) && isEditable) {
event.stopPropagation()
setModal(
<UpsertSecretModal
Expand Down
1 change: 0 additions & 1 deletion app/gui/src/dashboard/configurations/inputBindings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ export const BINDINGS = inputBindings.defineBindings({
rename: { name: 'Rename', bindings: ['Mod+R'], icon: PenIcon },
edit: { name: 'Edit', bindings: ['Mod+E'], icon: PenIcon },
snapshot: { name: 'Snapshot', bindings: ['Mod+S'], icon: CameraIcon },
editDescription: { name: 'Edit Description', bindings: ['Mod+Shift+E'], icon: PenIcon },
delete: {
name: 'Delete',
bindings: ['OsDelete'],
Expand Down
18 changes: 2 additions & 16 deletions app/gui/src/dashboard/layouts/AssetContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,8 @@ export default function AssetContextMenu(props: AssetContextMenuProps) {
!isOtherUserUsingProject &&
(!isCloud ||
asset.type === backendModule.AssetType.project ||
asset.type === backendModule.AssetType.directory) && (
asset.type === backendModule.AssetType.directory ||
asset.type === backendModule.AssetType.secret) && (
<ContextMenuEntry
hidden={hidden}
action="rename"
Expand Down Expand Up @@ -372,21 +373,6 @@ export default function AssetContextMenu(props: AssetContextMenuProps) {
}}
/>
)}
{isCloud && (
<ContextMenuEntry
hidden={hidden}
action="editDescription"
label={getText('editDescriptionShortcut')}
doAction={() => {
setIsAssetPanelTemporarilyVisible(true)
setAssetPanelProps({
backend,
item: asset,
spotlightOn: 'description',
})
}}
/>
)}
{isCloud && (
<ContextMenuEntry
hidden={hidden}
Expand Down
2 changes: 1 addition & 1 deletion app/gui/src/dashboard/layouts/AssetPanel/AssetPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ const InternalAssetPanelTabs = memo(function InternalAssetPanelTabs(
isExpanded={isExpanded}
onPress={expandTab}
isDisabled={isLocal}
isHidden={!enableAsyncExecution}
isHidden={true}
/>
<AssetPanelTabs.Tab
id="executionsCalendar"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ function AssetPropertiesInternal(props: AssetPropertiesInternalProps) {
level={2}
className="h-side-panel-heading py-side-panel-heading-y text-lg leading-snug"
>
{getText('settings')}
{getText('properties')}
</Heading>
<table>
<tbody>
Expand Down
Loading
Loading