Merge pull request #14069 from Budibase/feature/automation-grouping
Automation grouping
This commit is contained in:
commit
d94d7b478e
|
@ -30,6 +30,16 @@
|
||||||
return lowerA > lowerB ? 1 : -1
|
return lowerA > lowerB ? 1 : -1
|
||||||
})
|
})
|
||||||
|
|
||||||
|
$: groupedAutomations = filteredAutomations.reduce((acc, auto) => {
|
||||||
|
acc[auto.definition.trigger.event] ??= {
|
||||||
|
icon: auto.definition.trigger.icon,
|
||||||
|
name: (auto.definition.trigger?.name || "").toUpperCase(),
|
||||||
|
entries: [],
|
||||||
|
}
|
||||||
|
acc[auto.definition.trigger.event].entries.push(auto)
|
||||||
|
return acc
|
||||||
|
}, {})
|
||||||
|
|
||||||
$: showNoResults = searchString && !filteredAutomations.length
|
$: showNoResults = searchString && !filteredAutomations.length
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
|
@ -55,16 +65,25 @@
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="side-bar-nav">
|
<div class="side-bar-nav">
|
||||||
{#each filteredAutomations as automation}
|
{#each Object.values(groupedAutomations || {}) as triggerGroup}
|
||||||
<NavItem
|
<div class="nav-group">
|
||||||
text={automation.name}
|
<div class="nav-group-header" title={triggerGroup?.name}>
|
||||||
selected={automation._id === selectedAutomationId}
|
{triggerGroup?.name}
|
||||||
on:click={() => selectAutomation(automation._id)}
|
</div>
|
||||||
selectedBy={$userSelectedResourceMap[automation._id]}
|
{#each triggerGroup.entries as automation}
|
||||||
disabled={automation.disabled}
|
<NavItem
|
||||||
>
|
icon={triggerGroup.icon}
|
||||||
<EditAutomationPopover {automation} />
|
iconColor={"var(--spectrum-global-color-gray-900)"}
|
||||||
</NavItem>
|
text={automation.name}
|
||||||
|
selected={automation._id === selectedAutomationId}
|
||||||
|
on:click={() => selectAutomation(automation._id)}
|
||||||
|
selectedBy={$userSelectedResourceMap[automation._id]}
|
||||||
|
disabled={automation.disabled}
|
||||||
|
>
|
||||||
|
<EditAutomationPopover {automation} />
|
||||||
|
</NavItem>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
|
|
||||||
{#if showNoResults}
|
{#if showNoResults}
|
||||||
|
@ -82,6 +101,17 @@
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
.nav-group {
|
||||||
|
padding-top: var(--spacing-l);
|
||||||
|
}
|
||||||
|
.nav-group-header {
|
||||||
|
color: var(--spectrum-global-color-gray-600);
|
||||||
|
padding: 0px calc(var(--spacing-l) + 4px);
|
||||||
|
padding-bottom: var(--spacing-l);
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
.side-bar {
|
.side-bar {
|
||||||
flex: 0 0 260px;
|
flex: 0 0 260px;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -104,7 +134,7 @@
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: var(--spacing-l);
|
gap: var(--spacing-l);
|
||||||
padding: 0 var(--spacing-l);
|
padding: 0 calc(var(--spacing-l) + 4px);
|
||||||
}
|
}
|
||||||
.side-bar-nav {
|
.side-bar-nav {
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
|
|
Loading…
Reference in New Issue