Update all backend buttons to be action buttons. Add missing ActionMenu conversion to views
This commit is contained in:
parent
bdd9eb2ff3
commit
56cebe156b
|
@ -41,14 +41,12 @@
|
||||||
class="spectrum-ActionButton spectrum-ActionButton--size{size}"
|
class="spectrum-ActionButton spectrum-ActionButton--size{size}"
|
||||||
{disabled}
|
{disabled}
|
||||||
on:longPress
|
on:longPress
|
||||||
on:click|preventDefault
|
on:click|preventDefault>
|
||||||
>
|
|
||||||
{#if longPressable}
|
{#if longPressable}
|
||||||
<svg
|
<svg
|
||||||
class="spectrum-Icon spectrum-UIIcon-CornerTriangle100 spectrum-ActionButton-hold"
|
class="spectrum-Icon spectrum-UIIcon-CornerTriangle100 spectrum-ActionButton-hold"
|
||||||
focusable="false"
|
focusable="false"
|
||||||
aria-hidden="true"
|
aria-hidden="true">
|
||||||
>
|
|
||||||
<use xlink:href="#spectrum-css-icon-CornerTriangle100" />
|
<use xlink:href="#spectrum-css-icon-CornerTriangle100" />
|
||||||
</svg>
|
</svg>
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -57,8 +55,7 @@
|
||||||
class="spectrum-Icon spectrum-Icon--size{size}"
|
class="spectrum-Icon spectrum-Icon--size{size}"
|
||||||
focusable="false"
|
focusable="false"
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
aria-label={icon}
|
aria-label={icon}>
|
||||||
>
|
|
||||||
<use xlink:href="#spectrum-icon-18-{icon}" />
|
<use xlink:href="#spectrum-icon-18-{icon}" />
|
||||||
</svg>
|
</svg>
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -66,9 +63,3 @@
|
||||||
<span class="spectrum-ActionButton-label"><slot /></span>
|
<span class="spectrum-ActionButton-label"><slot /></span>
|
||||||
{/if}
|
{/if}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<style>
|
|
||||||
span {
|
|
||||||
text-transform: capitalize;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
<CreateColumnButton />
|
<CreateColumnButton />
|
||||||
{#if schema && Object.keys(schema).length > 0}
|
{#if schema && Object.keys(schema).length > 0}
|
||||||
<CreateRowButton
|
<CreateRowButton
|
||||||
title={isUsersTable ? 'Create New User' : 'Create New Row'}
|
title={isUsersTable ? 'Create user' : 'Create row'}
|
||||||
modalContentComponent={isUsersTable ? CreateEditUser : CreateEditRow} />
|
modalContentComponent={isUsersTable ? CreateEditUser : CreateEditRow} />
|
||||||
<CreateViewButton />
|
<CreateViewButton />
|
||||||
<ManageAccessButton resourceId={$tables.selected?._id} />
|
<ManageAccessButton resourceId={$tables.selected?._id} />
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script>
|
<script>
|
||||||
import { Modal, Button } from "@budibase/bbui"
|
import { Modal, ActionButton } from "@budibase/bbui"
|
||||||
import CalculateModal from "../modals/CalculateModal.svelte"
|
import CalculateModal from "../modals/CalculateModal.svelte"
|
||||||
|
|
||||||
export let view = {}
|
export let view = {}
|
||||||
|
@ -7,15 +7,14 @@
|
||||||
let modal
|
let modal
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Button
|
<ActionButton
|
||||||
icon="Calculator"
|
icon="Calculator"
|
||||||
primary
|
|
||||||
size="S"
|
size="S"
|
||||||
quiet
|
quiet
|
||||||
on:click={modal.show}
|
on:click={modal.show}
|
||||||
active={view.field && view.calculation}>
|
active={view.field && view.calculation}>
|
||||||
Calculate
|
Calculate
|
||||||
</Button>
|
</ActionButton>
|
||||||
<Modal bind:this={modal}>
|
<Modal bind:this={modal}>
|
||||||
<CalculateModal {view} />
|
<CalculateModal {view} />
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
<script>
|
<script>
|
||||||
import { Button, Icon, Modal, ModalContent } from "@budibase/bbui"
|
import { ActionButton, Modal } from "@budibase/bbui"
|
||||||
import CreateEditColumn from "../modals/CreateEditColumn.svelte"
|
import CreateEditColumn from "../modals/CreateEditColumn.svelte"
|
||||||
|
|
||||||
let modal
|
let modal
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Button icon="AddCircle" primary size="S" quiet on:click={modal.show}>
|
<ActionButton icon="TableColumnAddRight" quiet size="S" on:click={modal.show}>
|
||||||
Create New Column
|
Create column
|
||||||
</Button>
|
</ActionButton>
|
||||||
<Modal bind:this={modal}>
|
<Modal bind:this={modal}>
|
||||||
<CreateEditColumn />
|
<CreateEditColumn />
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
<script>
|
<script>
|
||||||
import { Button, Icon, Modal } from "@budibase/bbui"
|
import { ActionButton, Modal } from "@budibase/bbui"
|
||||||
import CreateEditRow from "../modals/CreateEditRow.svelte"
|
import CreateEditRow from "../modals/CreateEditRow.svelte"
|
||||||
|
|
||||||
export let modalContentComponent = CreateEditRow
|
export let modalContentComponent = CreateEditRow
|
||||||
export let title = "Create New Row"
|
export let title = "Create row"
|
||||||
|
|
||||||
let modal
|
let modal
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Button icon="Add" primary size="S" quiet on:click={modal.show}>
|
<ActionButton icon="TableRowAddBottom" size="S" quiet on:click={modal.show}>
|
||||||
{title}
|
{title}
|
||||||
</Button>
|
</ActionButton>
|
||||||
<Modal bind:this={modal}>
|
<Modal bind:this={modal}>
|
||||||
<svelte:component this={modalContentComponent} />
|
<svelte:component this={modalContentComponent} />
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
<script>
|
<script>
|
||||||
import { Modal, Button } from "@budibase/bbui"
|
import { Modal, ActionButton } from "@budibase/bbui"
|
||||||
import CreateViewModal from "../modals/CreateViewModal.svelte"
|
import CreateViewModal from "../modals/CreateViewModal.svelte"
|
||||||
|
|
||||||
let modal
|
let modal
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Button icon="CollectionAdd" primary size="S" quiet on:click={modal.show}>
|
<ActionButton icon="CollectionAdd" size="S" quiet on:click={modal.show}>
|
||||||
Create New View
|
Create view
|
||||||
</Button>
|
</ActionButton>
|
||||||
<Modal bind:this={modal}>
|
<Modal bind:this={modal}>
|
||||||
<CreateViewModal />
|
<CreateViewModal />
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script>
|
<script>
|
||||||
import { Button, Modal } from "@budibase/bbui"
|
import { ActionButton, Modal } from "@budibase/bbui"
|
||||||
import ExportModal from "../modals/ExportModal.svelte"
|
import ExportModal from "../modals/ExportModal.svelte"
|
||||||
|
|
||||||
export let view
|
export let view
|
||||||
|
@ -7,9 +7,9 @@
|
||||||
let modal
|
let modal
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Button icon="Download" primary size="S" quiet on:click={modal.show}>
|
<ActionButton icon="Download" size="S" quiet on:click={modal.show}>
|
||||||
Export
|
Export
|
||||||
</Button>
|
</ActionButton>
|
||||||
<Modal bind:this={modal}>
|
<Modal bind:this={modal}>
|
||||||
<ExportModal {view} />
|
<ExportModal {view} />
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script>
|
<script>
|
||||||
import { Button, Modal } from "@budibase/bbui"
|
import { ActionButton, Modal } from "@budibase/bbui"
|
||||||
import FilterModal from "../modals/FilterModal.svelte"
|
import FilterModal from "../modals/FilterModal.svelte"
|
||||||
|
|
||||||
export let view = {}
|
export let view = {}
|
||||||
|
@ -7,15 +7,14 @@
|
||||||
let modal
|
let modal
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Button
|
<ActionButton
|
||||||
icon="Filter"
|
icon="Filter"
|
||||||
primary
|
|
||||||
size="S"
|
size="S"
|
||||||
quiet
|
quiet
|
||||||
on:click={modal.show}
|
on:click={modal.show}
|
||||||
active={view.filters?.length}>
|
active={view.filters?.length}>
|
||||||
Filter
|
Filter
|
||||||
</Button>
|
</ActionButton>
|
||||||
<Modal bind:this={modal}>
|
<Modal bind:this={modal}>
|
||||||
<FilterModal {view} />
|
<FilterModal {view} />
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
|
@ -1,28 +1,13 @@
|
||||||
<script>
|
<script>
|
||||||
import { Button } from "@budibase/bbui"
|
import { ActionButton } from "@budibase/bbui"
|
||||||
|
|
||||||
export let hideAutocolumns
|
export let hideAutocolumns
|
||||||
|
|
||||||
let anchor
|
|
||||||
let dropdown
|
|
||||||
|
|
||||||
function hideOrUnhide() {
|
function hideOrUnhide() {
|
||||||
hideAutocolumns = !hideAutocolumns
|
hideAutocolumns = !hideAutocolumns
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div bind:this={anchor}>
|
<ActionButton icon="MagicWand" primary size="S" quiet on:click={hideOrUnhide}>
|
||||||
<Button icon="MagicWand" primary size="S" quiet on:click={hideOrUnhide}>
|
{#if hideAutocolumns}Show auto columns{:else}Hide auto columns{/if}
|
||||||
{#if hideAutocolumns}
|
</ActionButton>
|
||||||
Show Auto Columns
|
|
||||||
{:else}
|
|
||||||
Hide Auto Columns
|
|
||||||
{/if}
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
i {
|
|
||||||
margin-right: 4px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script>
|
<script>
|
||||||
import { Button, Modal } from "@budibase/bbui"
|
import { ActionButton, Modal } from "@budibase/bbui"
|
||||||
import { permissions } from "stores/backend"
|
import { permissions } from "stores/backend"
|
||||||
import ManageAccessModal from "../modals/ManageAccessModal.svelte"
|
import ManageAccessModal from "../modals/ManageAccessModal.svelte"
|
||||||
|
|
||||||
|
@ -14,9 +14,9 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Button icon="LockClosed" primary size="S" quiet on:click={openDropdown}>
|
<ActionButton icon="LockClosed" size="S" quiet on:click={openDropdown}>
|
||||||
Manage Access
|
Manage access
|
||||||
</Button>
|
</ActionButton>
|
||||||
<Modal bind:this={modal}>
|
<Modal bind:this={modal}>
|
||||||
<ManageAccessModal
|
<ManageAccessModal
|
||||||
{resourceId}
|
{resourceId}
|
||||||
|
|
|
@ -34,11 +34,10 @@
|
||||||
{#each $tables.list as table, idx}
|
{#each $tables.list as table, idx}
|
||||||
<NavItem
|
<NavItem
|
||||||
border={idx > 0}
|
border={idx > 0}
|
||||||
icon={table._id === TableNames.USERS ? "UserGroup" : "Table"}
|
icon={table._id === TableNames.USERS ? 'UserGroup' : 'Table'}
|
||||||
text={table.name}
|
text={table.name}
|
||||||
selected={selectedView === `all_${table._id}`}
|
selected={selectedView === `all_${table._id}`}
|
||||||
on:click={() => selectTable(table)}
|
on:click={() => selectTable(table)}>
|
||||||
>
|
|
||||||
{#if table._id !== TableNames.USERS}
|
{#if table._id !== TableNames.USERS}
|
||||||
<EditTablePopover {table} />
|
<EditTablePopover {table} />
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -46,14 +45,12 @@
|
||||||
{#each Object.keys(table.views || {}) as viewName, idx (idx)}
|
{#each Object.keys(table.views || {}) as viewName, idx (idx)}
|
||||||
<NavItem
|
<NavItem
|
||||||
indentLevel={1}
|
indentLevel={1}
|
||||||
icon="ri-eye-line"
|
icon="Remove"
|
||||||
text={viewName}
|
text={viewName}
|
||||||
selected={selectedView === viewName}
|
selected={selectedView === viewName}
|
||||||
on:click={() => onClickView(table, viewName)}
|
on:click={() => onClickView(table, viewName)}>
|
||||||
>
|
|
||||||
<EditViewPopover
|
<EditViewPopover
|
||||||
view={{ name: viewName, ...table.views[viewName] }}
|
view={{ name: viewName, ...table.views[viewName] }} />
|
||||||
/>
|
|
||||||
</NavItem>
|
</NavItem>
|
||||||
{/each}
|
{/each}
|
||||||
{/each}
|
{/each}
|
||||||
|
|
|
@ -1,40 +1,30 @@
|
||||||
<script>
|
<script>
|
||||||
import { goto } from "@roxi/routify"
|
import { goto } from "@roxi/routify"
|
||||||
import { views } from "stores/backend"
|
import { views } from "stores/backend"
|
||||||
import { notifications } from "@budibase/bbui"
|
|
||||||
import { Icon, Popover, Button, Input } from "@budibase/bbui"
|
|
||||||
import ConfirmDialog from "components/common/ConfirmDialog.svelte"
|
import ConfirmDialog from "components/common/ConfirmDialog.svelte"
|
||||||
import { DropdownContainer, DropdownItem } from "components/common/Dropdowns"
|
import {
|
||||||
|
notifications,
|
||||||
|
Icon,
|
||||||
|
Input,
|
||||||
|
ActionMenu,
|
||||||
|
MenuItem,
|
||||||
|
Modal,
|
||||||
|
ModalContent,
|
||||||
|
} from "@budibase/bbui"
|
||||||
|
|
||||||
export let view
|
export let view
|
||||||
|
|
||||||
let anchor
|
let editorModal
|
||||||
let dropdown
|
let confirmDeleteDialogue
|
||||||
let editing
|
|
||||||
let originalName = view.name
|
let originalName = view.name
|
||||||
let confirmDeleteDialog
|
let confirmDeleteDialog
|
||||||
|
|
||||||
function showEditor() {
|
|
||||||
editing = true
|
|
||||||
}
|
|
||||||
|
|
||||||
function hideEditor() {
|
|
||||||
dropdown.hide()
|
|
||||||
editing = false
|
|
||||||
}
|
|
||||||
|
|
||||||
function showDelete() {
|
|
||||||
dropdown.hide()
|
|
||||||
confirmDeleteDialog.show()
|
|
||||||
}
|
|
||||||
|
|
||||||
async function save() {
|
async function save() {
|
||||||
await views.save({
|
await views.save({
|
||||||
originalName,
|
originalName,
|
||||||
...view,
|
...view,
|
||||||
})
|
})
|
||||||
notifications.success("View renamed successfully")
|
notifications.success("View renamed successfully")
|
||||||
hideEditor()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function deleteView() {
|
async function deleteView() {
|
||||||
|
@ -46,69 +36,21 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div on:click|stopPropagation>
|
<ActionMenu>
|
||||||
<div bind:this={anchor} class="icon" on:click={dropdown.show}>
|
<div slot="control" class="icon">
|
||||||
<Icon s hoverable name="MoreSmallList" />
|
<Icon s hoverable name="MoreSmallList" />
|
||||||
</div>
|
</div>
|
||||||
<Popover align="left" {anchor} bind:this={dropdown}>
|
<MenuItem icon="Edit" on:click={editorModal.show}>Edit</MenuItem>
|
||||||
{#if editing}
|
<MenuItem icon="Delete" on:click={confirmDeleteDialog.show}>Delete</MenuItem>
|
||||||
<div class="actions">
|
</ActionMenu>
|
||||||
<h5>Edit View</h5>
|
<Modal bind:this={editorModal}>
|
||||||
|
<ModalContent title="Edit View" onConfirm={save} confirmText="Save">
|
||||||
<Input label="View Name" thin bind:value={view.name} />
|
<Input label="View Name" thin bind:value={view.name} />
|
||||||
<footer>
|
</ModalContent>
|
||||||
<Button secondary on:click={hideEditor}>Cancel</Button>
|
</Modal>
|
||||||
<Button primary on:click={save}>Save</Button>
|
|
||||||
</footer>
|
|
||||||
</div>
|
|
||||||
{:else}
|
|
||||||
<DropdownContainer>
|
|
||||||
<DropdownItem
|
|
||||||
icon="ri-edit-line"
|
|
||||||
data-cy="edit-view"
|
|
||||||
title="Edit"
|
|
||||||
on:click={showEditor}
|
|
||||||
/>
|
|
||||||
<DropdownItem
|
|
||||||
icon="ri-delete-bin-line"
|
|
||||||
title="Delete"
|
|
||||||
data-cy="delete-view"
|
|
||||||
on:click={showDelete}
|
|
||||||
/>
|
|
||||||
</DropdownContainer>
|
|
||||||
{/if}
|
|
||||||
</Popover>
|
|
||||||
</div>
|
|
||||||
<ConfirmDialog
|
<ConfirmDialog
|
||||||
bind:this={confirmDeleteDialog}
|
bind:this={confirmDeleteDialog}
|
||||||
body={`Are you sure you wish to delete the view '${view.name}'? Your data will be deleted and this action cannot be undone.`}
|
body={`Are you sure you wish to delete the view '${view.name}'? Your data will be deleted and this action cannot be undone.`}
|
||||||
okText="Delete View"
|
okText="Delete View"
|
||||||
onOk={deleteView}
|
onOk={deleteView}
|
||||||
title="Confirm Deletion"
|
title="Confirm Deletion" />
|
||||||
/>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
div.icon {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
justify-content: flex-end;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.actions {
|
|
||||||
padding: var(--spacing-xl);
|
|
||||||
display: grid;
|
|
||||||
grid-gap: var(--spacing-xl);
|
|
||||||
min-width: 400px;
|
|
||||||
}
|
|
||||||
|
|
||||||
h5 {
|
|
||||||
margin: 0;
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
footer {
|
|
||||||
display: flex;
|
|
||||||
justify-content: flex-end;
|
|
||||||
gap: var(--spacing-m);
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script>
|
<script>
|
||||||
import { Modal, ModalContent } from "@budibase/bbui"
|
import { Modal, ModalContent, Body } from "@budibase/bbui"
|
||||||
|
|
||||||
export let title = ""
|
export let title = ""
|
||||||
export let body = ""
|
export let body = ""
|
||||||
|
@ -20,15 +20,9 @@
|
||||||
|
|
||||||
<Modal bind:this={modal} on:hide={onCancel}>
|
<Modal bind:this={modal} on:hide={onCancel}>
|
||||||
<ModalContent onConfirm={onOk} {title} confirmText={okText} {cancelText} red>
|
<ModalContent onConfirm={onOk} {title} confirmText={okText} {cancelText} red>
|
||||||
<div class="body">
|
<Body size="S">
|
||||||
{body}
|
{body}
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</Body>
|
||||||
</ModalContent>
|
</ModalContent>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
<style>
|
|
||||||
.body {
|
|
||||||
font-size: var(--font-size-s);
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
Loading…
Reference in New Issue