mirror of
https://github.com/enso-org/enso.git
synced 2024-11-22 22:10:15 +03:00
Fix play button on local backend (#7688)
If the user does not have sufficient permissions to open the project, the project no longer shows the play button. However, this does not work on the local backend because the local backend lacks permissions completely. # Important Notes None
This commit is contained in:
parent
c558dec315
commit
b69fa516b7
6
app/ide-desktop/lib/assets/arrow_up.svg
Normal file
6
app/ide-desktop/lib/assets/arrow_up.svg
Normal file
@ -0,0 +1,6 @@
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect width="21" height="21" x="1.5" y="1.5" rx="10.5" stroke="#3e515fe5" stroke-opacity="0.1" stroke-width="3" />
|
||||
<path d="M12 17a1.5 1.5 0 0 1-1.5-1.5V12h3v3.5A1.5 1.5 0 0 1 12 17Z" fill="#3e515fe5" />
|
||||
<path d="M8.943 12a1 1 0 0 1-.814-1.581l3.057-4.28a1 1 0 0 1 1.628 0l3.056 4.28A1 1 0 0 1 15.057 12H8.943Z"
|
||||
fill="#3e515fe5" />
|
||||
</svg>
|
After Width: | Height: | Size: 454 B |
@ -66,14 +66,17 @@ export default function AssetContextMenu(props: AssetContextMenuProps) {
|
||||
permission => permission.user.user_email === organization?.email
|
||||
)
|
||||
const managesThisAsset =
|
||||
backend.type === backendModule.BackendType.local ||
|
||||
self?.permission === backendModule.PermissionAction.own ||
|
||||
self?.permission === backendModule.PermissionAction.admin
|
||||
const isRunningProject =
|
||||
asset.type === backendModule.AssetType.project &&
|
||||
backendModule.DOES_PROJECT_STATE_INDICATE_VM_EXISTS[asset.projectState.type]
|
||||
const canExecute =
|
||||
self?.permission != null && backendModule.PERMISSION_ACTION_CAN_EXECUTE[self.permission]
|
||||
backend.type === backendModule.BackendType.local ||
|
||||
(self?.permission != null && backendModule.PERMISSION_ACTION_CAN_EXECUTE[self.permission])
|
||||
const isOtherUserUsingProject =
|
||||
backend.type !== backendModule.BackendType.local &&
|
||||
backendModule.assetIsProject(asset) &&
|
||||
asset.projectState.opened_by != null &&
|
||||
asset.projectState.opened_by !== organization?.email
|
||||
@ -215,7 +218,7 @@ export default function AssetContextMenu(props: AssetContextMenuProps) {
|
||||
/>
|
||||
)}
|
||||
<ContextMenuSeparator hidden={hidden} />
|
||||
{managesThisAsset && (
|
||||
{managesThisAsset && self != null && (
|
||||
<MenuEntry
|
||||
hidden={hidden}
|
||||
action={shortcuts.KeyboardAction.share}
|
||||
@ -237,15 +240,20 @@ export default function AssetContextMenu(props: AssetContextMenuProps) {
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
<MenuEntry
|
||||
hidden={hidden}
|
||||
disabled
|
||||
action={shortcuts.KeyboardAction.label}
|
||||
doAction={() => {
|
||||
// No backend support yet.
|
||||
}}
|
||||
/>
|
||||
<ContextMenuSeparator hidden={hidden} />
|
||||
{backend.type !== backendModule.BackendType.local && (
|
||||
<MenuEntry
|
||||
hidden={hidden}
|
||||
disabled
|
||||
action={shortcuts.KeyboardAction.label}
|
||||
doAction={() => {
|
||||
// No backend support yet.
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{((managesThisAsset && self != null) ||
|
||||
backend.type !== backendModule.BackendType.local) && (
|
||||
<ContextMenuSeparator hidden={hidden} />
|
||||
)}
|
||||
<MenuEntry
|
||||
hidden={hidden}
|
||||
disabled
|
||||
|
@ -2,6 +2,7 @@
|
||||
import * as React from 'react'
|
||||
import * as toast from 'react-toastify'
|
||||
|
||||
import ArrowUpIcon from 'enso-assets/arrow_up.svg'
|
||||
import PlayIcon from 'enso-assets/play.svg'
|
||||
import StopIcon from 'enso-assets/stop.svg'
|
||||
|
||||
@ -119,7 +120,9 @@ export default function ProjectIcon(props: ProjectIconProps) {
|
||||
React.useState<AbortController | null>(null)
|
||||
const [closeProjectAbortController, setCloseProjectAbortController] =
|
||||
React.useState<AbortController | null>(null)
|
||||
const isOtherUserUsingProject = item.projectState.opened_by !== organization?.email
|
||||
const isOtherUserUsingProject =
|
||||
backend.type !== backendModule.BackendType.local &&
|
||||
item.projectState.opened_by !== organization?.email
|
||||
|
||||
const openProject = React.useCallback(async () => {
|
||||
closeProjectAbortController?.abort()
|
||||
@ -355,7 +358,7 @@ export default function ProjectIcon(props: ProjectIconProps) {
|
||||
)
|
||||
case backendModule.ProjectState.opened:
|
||||
return (
|
||||
<>
|
||||
<div>
|
||||
<button
|
||||
disabled={isOtherUserUsingProject}
|
||||
{...(isOtherUserUsingProject
|
||||
@ -371,9 +374,21 @@ export default function ProjectIcon(props: ProjectIconProps) {
|
||||
<div className="relative h-0">
|
||||
<Spinner size={24} state={spinnerState} />
|
||||
</div>
|
||||
<SvgMask src={StopIcon} />
|
||||
<SvgMask style={ICON_STYLE} src={StopIcon} />
|
||||
</button>
|
||||
</>
|
||||
{!isOtherUserUsingProject && (
|
||||
<button
|
||||
className="w-6 h-6"
|
||||
onClick={clickEvent => {
|
||||
clickEvent.stopPropagation()
|
||||
unsetModal()
|
||||
openIde(true)
|
||||
}}
|
||||
>
|
||||
<SvgMask style={ICON_STYLE} src={ArrowUpIcon} />
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -64,8 +64,9 @@ export default function ProjectNameColumn(props: ProjectNameColumnProps) {
|
||||
null
|
||||
const isRunning = backendModule.DOES_PROJECT_STATE_INDICATE_VM_EXISTS[asset.projectState.type]
|
||||
const canExecute =
|
||||
ownPermission != null &&
|
||||
backendModule.PERMISSION_ACTION_CAN_EXECUTE[ownPermission.permission]
|
||||
backend.type === backendModule.BackendType.local ||
|
||||
(ownPermission != null &&
|
||||
backendModule.PERMISSION_ACTION_CAN_EXECUTE[ownPermission.permission])
|
||||
const isOtherUserUsingProject = asset.projectState.opened_by !== organization?.email
|
||||
|
||||
const doRename = async (newName: string) => {
|
||||
|
Loading…
Reference in New Issue
Block a user