Skip to content

Commit

Permalink
- Allow renaming secret in context menu.
Browse files Browse the repository at this point in the history
- Remove single click rename start.
- Hide executions tab.
- Rename Execution calendar to Scheduler.
  • Loading branch information
jdunkerley committed Mar 6, 2025
1 parent 878036c commit 9a6c6ed
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 56 deletions.
2 changes: 1 addition & 1 deletion app/common/src/text/english.json
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@
"logs": "Logs",
"showLogs": "Show Logs",
"executions": "Executions",
"executionsCalendar": "Executions Calendar",
"executionsCalendar": "Scheduler",
"accept": "Accept",
"decline": "Decline",
"clearTrash": "Clear Trash",
Expand Down
11 changes: 0 additions & 11 deletions app/gui/src/dashboard/components/dashboard/DirectoryNameColumn.tsx
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
17 changes: 1 addition & 16 deletions app/gui/src/dashboard/components/dashboard/ProjectNameColumn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ 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 { 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 +34,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 +76,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
3 changes: 2 additions & 1 deletion 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
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

0 comments on commit 9a6c6ed

Please sign in to comment.