* runs on svelte 5 * Line component from svelte-chartjs * Replaced all svelte-chartjs occurrences with custom wrapper * Fix props mistake * Fix illegal table structures * self-closing-tags fix * aria labels * Fixed trivial warnings and errors * @tanstack/svelte-table fix * upgrade to vite 6 * svelte-kit sync before running svelte-check * Remove on:clear which is actually on:removeAll and already handled by on:change * fix worker tags not displaying in Autoscaling * Try to fix svelte-kit sync not working during CI * remove warnings * Fix add flow page crashing * access worldStore before assignment fix * fix infinite recursions in App Editor * Replaced JSON.stringify with proper deepEqual * component mount api changed (no longer classes) * fix ci errors * Fix infinite loops in background runnable panel * factored effect on deep equal logic in onObjChange * fix "Add" not working in AgGrid Table * Replaced legacy component.$set api * Fix multiselect infinite value reaction * Fix flow input fields resetting when opening their edit tab * fix date input resetting when typing year * Remove !p-0 affecting subgrid dotted borders * fix missing debounceTemplate causing hundreds of updates * Fix AgGrid action refreshes and disppearing * resolve getItems generating random ids every rerun * fix cannot access items before init * fix sort lambda arguments being undefined * Revert "Remove !p-0 affecting subgrid dotted borders" This reverts commit c62809bb45d682a48376b071680645ed4e1c601b. * fix input not updating in decision tree editor * Update frontend/src/lib/components/schema/EditableSchemaWrapper.svelte Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> * Re-added padding affecting subgrid dotted borders (#5479) * remove !p-0 in preset components * removed extra padding on accordion tabs subgrid * Fix non-reactive SchemaForm * dirty fix for the oneOf bug * Fix warnings and update svelte-exmarkdown for svelte 5 * fix dnd not working * don't mount component like objects --------- Co-authored-by: Diego Imbert <diegoimbert@protonmail.com> Co-authored-by: Diego Imbert <70353967+diegoimbert@users.noreply.github.com> Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
165 lines
5.1 KiB
Svelte
165 lines
5.1 KiB
Svelte
<script lang="ts">
|
|
import { Button } from '$lib/components/common'
|
|
import ToggleButtonGroup from '$lib/components/common/toggleButton-v2/ToggleButtonGroup.svelte'
|
|
import ToggleButton from '$lib/components/common/toggleButton-v2/ToggleButton.svelte'
|
|
import DataTable from '$lib/components/table/DataTable.svelte'
|
|
import Section from '$lib/components/Section.svelte'
|
|
import Head from '$lib/components/table/Head.svelte'
|
|
import Cell from '$lib/components/table/Cell.svelte'
|
|
import { WorkspaceService } from '$lib/gen'
|
|
import { workspaceStore } from '$lib/stores'
|
|
import { sendUserToast } from '$lib/toast'
|
|
import { SaveIcon, EyeIcon, EyeOffIcon } from 'lucide-svelte'
|
|
|
|
let operatorWorkspaceSettings = {
|
|
runs: true,
|
|
schedules: true,
|
|
resources: true,
|
|
variables: true,
|
|
triggers: true,
|
|
audit_logs: true,
|
|
groups: true,
|
|
folders: true,
|
|
workers: true
|
|
}
|
|
|
|
let originalSettings = { ...operatorWorkspaceSettings }
|
|
let isChanged = false
|
|
let currentWorkspace: string | null = null
|
|
|
|
async function saveSettings() {
|
|
try {
|
|
await WorkspaceService.updateOperatorSettings({
|
|
workspace: $workspaceStore!,
|
|
requestBody: operatorWorkspaceSettings
|
|
})
|
|
originalSettings = { ...operatorWorkspaceSettings }
|
|
isChanged = false
|
|
sendUserToast('Operator settings saved successfully!', false)
|
|
} catch (error) {
|
|
console.error('Error updating operator settings:', error)
|
|
sendUserToast('Failed to save operator settings.', true)
|
|
}
|
|
}
|
|
|
|
const descriptions = {
|
|
runs: { title: 'Runs', description: 'View runs' },
|
|
schedules: { title: 'Schedules', description: 'View schedules' },
|
|
resources: { title: 'Resources', description: 'View resources' },
|
|
variables: { title: 'Variables', description: 'View variables' },
|
|
triggers: { title: 'Triggers', description: 'View all triggers (HTTP, Websocket, Kafka)' },
|
|
audit_logs: { title: 'Audit Logs', description: 'View audit logs' },
|
|
groups: { title: 'Groups', description: 'View groups and group members' },
|
|
folders: { title: 'Folders', description: 'View folders' },
|
|
workers: { title: 'Workers', description: 'View workers and worker groups' }
|
|
}
|
|
|
|
$: if ($workspaceStore && $workspaceStore !== currentWorkspace) {
|
|
;(async () => {
|
|
currentWorkspace = $workspaceStore
|
|
const settings = await WorkspaceService.getSettings({
|
|
workspace: $workspaceStore
|
|
})
|
|
if (settings.operator_settings !== null) {
|
|
operatorWorkspaceSettings = settings.operator_settings ?? operatorWorkspaceSettings
|
|
originalSettings = { ...operatorWorkspaceSettings }
|
|
}
|
|
})()
|
|
}
|
|
|
|
$: isChanged = JSON.stringify(operatorWorkspaceSettings) !== JSON.stringify(originalSettings)
|
|
|
|
$: enableAllState = (() => {
|
|
const values = Object.values(operatorWorkspaceSettings)
|
|
if (values.every((v) => v === true)) return 'true'
|
|
if (values.every((v) => v === false)) return 'false'
|
|
return undefined
|
|
})()
|
|
|
|
function toggleAllSettings(event) {
|
|
const newValue = event.detail === true
|
|
Object.keys(operatorWorkspaceSettings).forEach((key) => {
|
|
operatorWorkspaceSettings[key] = newValue
|
|
})
|
|
operatorWorkspaceSettings = { ...operatorWorkspaceSettings }
|
|
}
|
|
</script>
|
|
|
|
<div class="mt-6">
|
|
<Section
|
|
label="Operator Settings"
|
|
collapsable={true}
|
|
tooltip="Configure the operator visibility settings for your workspace. Toggle the settings you want to enable."
|
|
>
|
|
<div class="flex flex-col gap-4 my-4">
|
|
<div class="flex flex-col gap-1">
|
|
<div class="text-tertiary text-xs">
|
|
Configure the operator visibility settings for your workspace. Toggle the settings you
|
|
want to enable.
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex justify-end mb-2">
|
|
<div class="flex justify-end"></div>
|
|
</div>
|
|
|
|
<div class="flex flex-col">
|
|
<DataTable tableFixed={true} size="xs">
|
|
<Head>
|
|
<tr>
|
|
<Cell head first>Section</Cell>
|
|
<Cell head>Description</Cell>
|
|
<Cell head last>
|
|
<ToggleButtonGroup
|
|
bind:selected={enableAllState}
|
|
on:selected={toggleAllSettings}
|
|
let:item
|
|
>
|
|
<ToggleButton
|
|
icon={EyeIcon}
|
|
small={true}
|
|
value={'true'}
|
|
label="Enable All"
|
|
{item}
|
|
/>
|
|
<ToggleButton
|
|
icon={EyeOffIcon}
|
|
small={true}
|
|
value={'false'}
|
|
label="Disable All"
|
|
{item}
|
|
/>
|
|
</ToggleButtonGroup>
|
|
</Cell>
|
|
</tr>
|
|
</Head>
|
|
<tbody class="divide-y bg-surface">
|
|
{#each Object.entries(descriptions) as [key, { title, description }]}
|
|
<tr>
|
|
<Cell first>{title}</Cell>
|
|
<Cell>{description}</Cell>
|
|
<Cell last class="pl-8">
|
|
<ToggleButtonGroup
|
|
selected={operatorWorkspaceSettings[key] ? 'on' : 'off'}
|
|
on:selected={({ detail }) => (operatorWorkspaceSettings[key] = detail === 'on')}
|
|
let:item
|
|
>
|
|
<ToggleButton icon={EyeIcon} small={true} value={'on'} label="On" {item} />
|
|
<ToggleButton icon={EyeOffIcon} small={true} value={'off'} label="Off" {item} />
|
|
</ToggleButtonGroup>
|
|
</Cell>
|
|
</tr>
|
|
{/each}
|
|
</tbody>
|
|
</DataTable>
|
|
</div>
|
|
|
|
<div class="flex justify-end mt-4">
|
|
<Button on:click={saveSettings} startIcon={{ icon: SaveIcon }} disabled={!isChanged}>
|
|
Save
|
|
</Button>
|
|
</div>
|
|
</Section>
|
|
</div>
|