Skip to content

Commit

Permalink
fix: selectedRow for a table is set on table actions
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenfiszel committed May 10, 2024
1 parent 251e6c3 commit 447e2d7
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 103 deletions.
9 changes: 4 additions & 5 deletions backend/windmill-common/src/ee.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::ee::LicensePlan::Community;
use serde::{Deserialize, Serialize};
use serde::Deserialize;
use std::sync::Arc;
use tokio::sync::RwLock;

Expand All @@ -20,9 +20,8 @@ pub async fn get_license_plan() -> LicensePlan {
return Community;
}

#[derive(Serialize, Deserialize)]
#[derive(Deserialize)]
#[serde(untagged)]
pub enum CriticalErrorChannel {}

pub async fn trigger_critical_error_channels(_msg: String) {
// Implementation is not open source
}
pub async fn trigger_critical_error_channels(_error_message: String) {}
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@
if (iterContext && listInputs) {
listInputs.set(id, inputOutput)
}
console.log('success', r)
}}
refreshOnStart={resolvedConfig.triggerOnAppLoad}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,10 @@
row,
render: true,
wrapActions: resolvedConfig.wrapActions,
selectRow: () => {
toggleRow(p)
p.node.setSelected(true)
},
onSet: (id, value) => {
if (!inputs[id]) {
inputs[id] = { [rowIndex]: value }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@
row,
render,
wrapActions: resolvedConfig.wrapActions,
selectRow: () => {
toggleRow(p)
p.node.setSelected(true)
},
onSet: (id, value) => {
if (!inputs[id]) {
inputs[id] = { [rowIndex]: value }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
export let onSet: (id: string, value: any) => void
export let onRemove: (id: string) => void
export let wrapActions: boolean | undefined = undefined
export let selectRow: () => void
const dispatch = createEventDispatcher()
const { selectedComponent, hoverStore, mode, connectingInput } =
Expand Down Expand Up @@ -51,7 +52,8 @@
$hoverStore = undefined
}
}}
on:pointerdown|stopPropagation={() => {
on:pointerdown|stopPropagation={(e) => {
selectRow()
$selectedComponent = [action.id]
}}
class={twMerge(
Expand Down Expand Up @@ -135,6 +137,7 @@
noWFull
preclickAction={async () => {
dispatch('toggleRow')
selectRow()
}}
id={action.id}
customCss={action.customCss}
Expand All @@ -159,6 +162,7 @@
onToggle={action.onToggle}
preclickAction={async () => {
dispatch('toggleRow')
selectRow()
}}
verticalAlignment="center"
{controls}
Expand All @@ -178,6 +182,7 @@
onSelect={action.onSelect}
preclickAction={async () => {
dispatch('toggleRow')
selectRow()
}}
{controls}
/>
Expand All @@ -190,6 +195,7 @@
{render}
preclickAction={async () => {
dispatch('toggleRow')
selectRow()
}}
noWFull
id={action.id}
Expand All @@ -213,6 +219,7 @@
onToggle={action.onToggle}
preclickAction={async () => {
dispatch('toggleRow')
selectRow()
}}
/>
{:else if action.type == 'selectcomponent'}
Expand All @@ -230,6 +237,7 @@
onSelect={action.onSelect}
preclickAction={async () => {
dispatch('toggleRow')
selectRow()
}}
/>
</div>
Expand Down
193 changes: 98 additions & 95 deletions frontend/src/routes/(root)/(logged)/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -263,128 +263,131 @@
<div>
{#if !menuHidden}
{#if !$userStore?.operator}
<div
class={classNames(
'relative md:hidden',
menuOpen ? 'z-40' : 'pointer-events-none',
devOnly ? 'hidden' : ''
)}
role="dialog"
aria-modal="true"
>
{#if innerWidth < 768}
<div
class={classNames(
'fixed inset-0 dark:bg-[#1e232e] bg-[#202125] dark:bg-opacity-75 bg-opacity-75 transition-opacity ease-linear duration-300 z-40 !dark',

menuOpen ? 'opacity-100' : 'opacity-0'
'relative',
menuOpen ? 'z-40' : 'pointer-events-none',
devOnly ? 'hidden' : ''
)}
/>

<div class="fixed inset-0 flex z-40">
role="dialog"
aria-modal="true"
>
<div
class={classNames(
'relative flex-1 flex flex-col max-w-min w-full bg-surface transition ease-in-out duration-300 transform',
menuOpen ? 'translate-x-0' : '-translate-x-full'
'fixed inset-0 dark:bg-[#1e232e] bg-[#202125] dark:bg-opacity-75 bg-opacity-75 transition-opacity ease-linear duration-300 z-40 !dark',

menuOpen ? 'opacity-100' : 'opacity-0'
)}
>
/>

<div class="fixed inset-0 flex z-40">
<div
class={classNames(
'absolute top-0 right-0 -mr-12 pt-2 ease-in-out duration-300',
menuOpen ? 'opacity-100' : 'opacity-0'
'relative flex-1 flex flex-col max-w-min w-full bg-surface transition ease-in-out duration-300 transform',
menuOpen ? 'translate-x-0' : '-translate-x-full'
)}
>
<button
type="button"
on:click={() => {
menuOpen = !menuOpen
}}
class="ml-1 flex items-center justify-center h-8 w-8 rounded-full focus:outline-none focus:ring-2 focus:ring-inset focus:ring-white border border-white"
>
<svg
class="h-6 w-6 text-white"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
aria-hidden="true"
>
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
<div class="dark:bg-[#1e232e] bg-[#202125] h-full !dark">
<div
class="flex gap-x-2 flex-shrink-0 p-4 font-semibold text-gray-200 w-10"
class:w-40={!isCollapsed}
class={classNames(
'absolute top-0 right-0 -mr-12 pt-2 ease-in-out duration-300',
menuOpen ? 'opacity-100' : 'opacity-0'
)}
>
<WindmillIcon white={true} height="20px" width="20px" />
{#if !isCollapsed}Windmill{/if}
<button
type="button"
on:click={() => {
menuOpen = !menuOpen
}}
class="ml-1 flex items-center justify-center h-8 w-8 rounded-full focus:outline-none focus:ring-2 focus:ring-inset focus:ring-white border border-white"
>
<svg
class="h-6 w-6 text-white"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
aria-hidden="true"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M6 18L18 6M6 6l12 12"
/>
</svg>
</button>
</div>

<div class="px-2 py-4 space-y-2 border-y border-gray-500">
<WorkspaceMenu />
<FavoriteMenu {favoriteLinks} />
<div class="dark:bg-[#1e232e] bg-[#202125] h-full !dark">
<div class="flex gap-x-2 flex-shrink-0 p-4 font-semibold text-gray-200 w-40">
<WindmillIcon white={true} height="20px" width="20px" />
Windmill
</div>

<div class="px-2 py-4 space-y-2 border-y border-gray-500">
<WorkspaceMenu />
<FavoriteMenu {favoriteLinks} />
</div>

<SidebarContent isCollapsed={false} />
</div>

<SidebarContent {isCollapsed} />
</div>
</div>
</div>
</div>

<div
id="sidebar"
class={classNames(
'hidden md:flex md:flex-col md:fixed md:inset-y-0 transition-all ease-in-out duration-200 shadow-md z-40 ',
isCollapsed ? 'md:w-12' : 'md:w-40',
devOnly ? '!hidden' : ''
)}
>
{:else}
<div
class="flex-1 flex flex-col min-h-0 h-screen shadow-lg dark:bg-[#1e232e] bg-[#202125] !dark"
id="sidebar"
class={classNames(
'flex flex-col fixed inset-y-0 transition-all ease-in-out duration-200 shadow-md z-40 ',
isCollapsed ? 'md:w-12' : 'md:w-40',
devOnly ? '!hidden' : ''
)}
>
<button
on:click={() => {
goto('/')
}}
<div
class="flex-1 flex flex-col min-h-0 h-screen shadow-lg dark:bg-[#1e232e] bg-[#202125] !dark"
>
<div
class="flex-row flex-shrink-0 px-3.5 py-3.5 text-opacity-70 h-12 flex items-center gap-1.5"
class:w-40={!isCollapsed}
>
<div class:mr-1={!isCollapsed}>
<WindmillIcon white={true} height="20px" width="20px" />
</div>
{#if !isCollapsed}
<div class="text-sm mt-0.5 text-white"> Windmill </div>
{/if}
</div>
</button>
<div class="px-2 py-4 space-y-2 border-y border-gray-700">
<WorkspaceMenu {isCollapsed} />
<FavoriteMenu {favoriteLinks} {isCollapsed} />
</div>

<SidebarContent {isCollapsed} />

<div class="flex-shrink-0 flex px-4 pb-3.5">
<button
on:click={() => {
isCollapsed = !isCollapsed
goto('/')
}}
>
<ArrowLeft
size={16}
class={classNames(
'flex-shrink-0 h-4 w-4 transition-all ease-in-out duration-200 text-white',
isCollapsed ? 'rotate-180' : 'rotate-0'
)}
/>
<div
class="flex-row flex-shrink-0 px-3.5 py-3.5 text-opacity-70 h-12 flex items-center gap-1.5"
class:w-40={!isCollapsed}
>
<div class:mr-1={!isCollapsed}>
<WindmillIcon white={true} height="20px" width="20px" />
</div>
{#if !isCollapsed}
<div class="text-sm mt-0.5 text-white"> Windmill </div>
{/if}
</div>
</button>
<div class="px-2 py-4 space-y-2 border-y border-gray-700">
<WorkspaceMenu {isCollapsed} />
<FavoriteMenu {favoriteLinks} {isCollapsed} />
</div>

<SidebarContent {isCollapsed} />

<div class="flex-shrink-0 flex px-4 pb-3.5">
<button
on:click={() => {
isCollapsed = !isCollapsed
}}
>
<ArrowLeft
size={16}
class={classNames(
'flex-shrink-0 h-4 w-4 transition-all ease-in-out duration-200 text-white',
isCollapsed ? 'rotate-180' : 'rotate-0'
)}
/>
</button>
</div>
</div>
</div>
</div>
{/if}
{:else}
<div class="absolute top-2 left-2 z5000">
<OperatorMenu {favoriteLinks} />
Expand Down

0 comments on commit 447e2d7

Please sign in to comment.