Portal redesign (#9336)
* Update BB logo to black * Update top nav bar and core layout * Add redesign for apps pages * Update user and groups pages * More WIP portal redesign! * Fix top nav colours and fix selected tab not updating * Remove log * Update copy on settings pages * Update and standardise page headers and subtitles, and remove side nav titles * Update font styles to allow for easy customisation * Update button styles to always use newStyles, update auth page styles * Update settings pages to new designs * Update structure for account pages * Add initial rewrite of app overview section * Update config checklist to properly center * Update app overview version and name/url screens * Add tooltip to explain why URL cannot be changed until unpublishing * Update overview automation history tab * Update overview backups page * Rewrite app overview access tab * Update table hover colours * Remove scrolling from tables when not required and stop selects from updating their own state locally * Update table styles to support flexible column widths much better * Fix extremely long strings in breadcrumbs not wrapping * Fix multiple issues with long text overflow * Fix flashing in version settings page * Fix loading bugs in app backups page * Add sidebar for portal and use it for automation history. Fix multiple overflow and scrolling issues * Tidy up * Update user details page to use tables and match designs * Update users detail page * Update user and group details pages with new tables * Fix automation error linking from apps page and improve automation fetching logic in automation history * Move theme and API key into user profile dropdown instead of settings * Move settings before account and show plugins for devs * Convert plugins page to table and update components and modals * Update links when going back from the builder * Update plugin search placeholder * Fix URLs in app overview * Properly handle text overflow in plugins table * Remove getting started checklist * Fix checklist removal and fix profile modal * Update email details page to match new designs * Cleanup * Add licensing and env logic to determine which account links to show * Update upgrade button URL for cloud accounts * Update app list to use a more compact style * Make core page layout responsive and update apps list to be responsive * Update mobile design of apps page * Update more pages to be responsive and add mobile specific components * Refactor main portal page into multiple components * Update multiple pages to be responsive and improve loading experience * Make automation history page responsive * Update backups page to be responsive * Update pickers to use absolutely positioned root popover so that overflow does not matter * Fix some responsive styles * Fix update link in app overview * Improve dropdown logic * Lint * Update click outside handler to handle modals properly * Remove log * Fix mobile menu upgrade button not closing menu * Hide groups page if disabled at tenant level * Centralise menu logic and show full menu on mobile * Update app access assignment and fix backups table * Ensure avatars cannot be squished * Standardise disabled field text colour * Allow developer users to access users, groups and usage pages * Allow readonly access to users and groups for developer users * Remove logs * Improve users page loading experience * Improve responsiveness on apps list page and fix discussions link styles * Update spacing on user and group detail page and fix usage page showing wrong copy * Fix logo override not working * Pin minio version to an old one that supports the fs backend in dev * Shrink upgrade button * Shrink user dropdown * Update assignment modal text * Remove clickable visual styles from plugins * Always show groups section in app access page * Update app overview button styles to include more CTAs * Hide edit and view links in more menu on overview page unless on mobile * Make usage stats responsive and fix layout issues * Add comment to docker-compose config
This commit is contained in:
parent
cc8b34cca4
commit
d92f1a7097
|
@ -6,7 +6,8 @@ services:
|
||||||
minio-service:
|
minio-service:
|
||||||
container_name: budi-minio-dev
|
container_name: budi-minio-dev
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
image: minio/minio
|
# Last version that supports the "fs" backend
|
||||||
|
image: minio/minio:RELEASE.2022-10-24T18-35-07Z
|
||||||
volumes:
|
volumes:
|
||||||
- minio_data:/data
|
- minio_data:/data
|
||||||
ports:
|
ports:
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
const ignoredClasses = [".flatpickr-calendar", ".modal-container"]
|
const ignoredClasses = [".flatpickr-calendar"]
|
||||||
let clickHandlers = []
|
let clickHandlers = []
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle a body click event
|
* Handle a body click event
|
||||||
*/
|
*/
|
||||||
const handleClick = event => {
|
const handleClick = event => {
|
||||||
// Ignore click if needed
|
// Ignore click if this is an ignored class
|
||||||
for (let className of ignoredClasses) {
|
for (let className of ignoredClasses) {
|
||||||
if (event.target.closest(className)) {
|
if (event.target.closest(className)) {
|
||||||
return
|
return
|
||||||
|
@ -14,9 +14,18 @@ const handleClick = event => {
|
||||||
|
|
||||||
// Process handlers
|
// Process handlers
|
||||||
clickHandlers.forEach(handler => {
|
clickHandlers.forEach(handler => {
|
||||||
if (!handler.element.contains(event.target)) {
|
if (handler.element.contains(event.target)) {
|
||||||
handler.callback?.(event)
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ignore clicks for modals, unless the handler is registered from a modal
|
||||||
|
const sourceInModal = handler.element.closest(".spectrum-Modal") != null
|
||||||
|
const clickInModal = event.target.closest(".spectrum-Modal") != null
|
||||||
|
if (clickInModal && !sourceInModal) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
handler.callback?.(event)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
document.documentElement.addEventListener("click", handleClick, true)
|
document.documentElement.addEventListener("click", handleClick, true)
|
||||||
|
|
|
@ -1,75 +1,68 @@
|
||||||
export default function positionDropdown(element, { anchor, align, maxWidth }) {
|
export default function positionDropdown(
|
||||||
let positionSide = "top"
|
element,
|
||||||
let maxHeight = 0
|
{ anchor, align, maxWidth, useAnchorWidth }
|
||||||
let dimensions = getDimensions(anchor)
|
) {
|
||||||
|
const update = () => {
|
||||||
|
const anchorBounds = anchor.getBoundingClientRect()
|
||||||
|
const elementBounds = element.getBoundingClientRect()
|
||||||
|
let styles = {
|
||||||
|
maxHeight: null,
|
||||||
|
minWidth: null,
|
||||||
|
maxWidth,
|
||||||
|
left: null,
|
||||||
|
top: null,
|
||||||
|
}
|
||||||
|
|
||||||
function getDimensions() {
|
// Determine vertical styles
|
||||||
const {
|
if (window.innerHeight - anchorBounds.bottom < 100) {
|
||||||
bottom,
|
styles.top = anchorBounds.top - elementBounds.height - 5
|
||||||
top: spaceAbove,
|
|
||||||
left,
|
|
||||||
width,
|
|
||||||
} = anchor.getBoundingClientRect()
|
|
||||||
const spaceBelow = window.innerHeight - bottom
|
|
||||||
const containerRect = element.getBoundingClientRect()
|
|
||||||
|
|
||||||
let y
|
|
||||||
|
|
||||||
if (spaceAbove > spaceBelow) {
|
|
||||||
positionSide = "bottom"
|
|
||||||
maxHeight = spaceAbove - 20
|
|
||||||
y = window.innerHeight - spaceAbove + 5
|
|
||||||
} else {
|
} else {
|
||||||
positionSide = "top"
|
styles.top = anchorBounds.bottom + 5
|
||||||
y = bottom + 5
|
styles.maxHeight = window.innerHeight - anchorBounds.bottom - 20
|
||||||
maxHeight = spaceBelow - 20
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
// Determine horizontal styles
|
||||||
[positionSide]: y,
|
if (!maxWidth && useAnchorWidth) {
|
||||||
left,
|
styles.maxWidth = anchorBounds.width
|
||||||
width,
|
|
||||||
containerWidth: containerRect.width,
|
|
||||||
}
|
}
|
||||||
|
if (useAnchorWidth) {
|
||||||
|
styles.minWidth = anchorBounds.width
|
||||||
|
}
|
||||||
|
if (align === "right") {
|
||||||
|
styles.left = anchorBounds.left + anchorBounds.width - elementBounds.width
|
||||||
|
} else if (align === "right-side") {
|
||||||
|
styles.left = anchorBounds.left + anchorBounds.width
|
||||||
|
} else {
|
||||||
|
styles.left = anchorBounds.left
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply styles
|
||||||
|
Object.entries(styles).forEach(([style, value]) => {
|
||||||
|
if (value) {
|
||||||
|
element.style[style] = `${value.toFixed(0)}px`
|
||||||
|
} else {
|
||||||
|
element.style[style] = null
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function calcLeftPosition() {
|
// Apply initial styles which don't need to change
|
||||||
let left
|
|
||||||
|
|
||||||
if (align == "right") {
|
|
||||||
left = dimensions.left + dimensions.width - dimensions.containerWidth
|
|
||||||
} else if (align == "right-side") {
|
|
||||||
left = dimensions.left + dimensions.width
|
|
||||||
} else {
|
|
||||||
left = dimensions.left
|
|
||||||
}
|
|
||||||
|
|
||||||
return left
|
|
||||||
}
|
|
||||||
|
|
||||||
element.style.position = "absolute"
|
element.style.position = "absolute"
|
||||||
element.style.zIndex = "9999"
|
element.style.zIndex = "9999"
|
||||||
if (maxWidth) {
|
|
||||||
element.style.maxWidth = `${maxWidth}px`
|
|
||||||
}
|
|
||||||
element.style.minWidth = `${dimensions.width}px`
|
|
||||||
element.style.maxHeight = `${maxHeight.toFixed(0)}px`
|
|
||||||
element.style.transformOrigin = `center ${positionSide}`
|
|
||||||
element.style[positionSide] = `${dimensions[positionSide]}px`
|
|
||||||
element.style.left = `${calcLeftPosition(dimensions).toFixed(0)}px`
|
|
||||||
|
|
||||||
|
// Observe both anchor and element and resize the popover as appropriate
|
||||||
const resizeObserver = new ResizeObserver(entries => {
|
const resizeObserver = new ResizeObserver(entries => {
|
||||||
entries.forEach(() => {
|
entries.forEach(update)
|
||||||
dimensions = getDimensions()
|
|
||||||
element.style[positionSide] = `${dimensions[positionSide]}px`
|
|
||||||
element.style.left = `${calcLeftPosition(dimensions).toFixed(0)}px`
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
resizeObserver.observe(anchor)
|
resizeObserver.observe(anchor)
|
||||||
resizeObserver.observe(element)
|
resizeObserver.observe(element)
|
||||||
|
|
||||||
|
document.addEventListener("scroll", update, true)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
destroy() {
|
destroy() {
|
||||||
resizeObserver.disconnect()
|
resizeObserver.disconnect()
|
||||||
|
document.removeEventListener("scroll", update, true)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,5 +58,6 @@
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
export let active = false
|
export let active = false
|
||||||
export let tooltip = undefined
|
export let tooltip = undefined
|
||||||
export let dataCy
|
export let dataCy
|
||||||
export let newStyles = false
|
export let newStyles = true
|
||||||
|
|
||||||
let showTooltip = false
|
let showTooltip = false
|
||||||
</script>
|
</script>
|
||||||
|
@ -28,6 +28,7 @@
|
||||||
class:spectrum-Button--quiet={quiet}
|
class:spectrum-Button--quiet={quiet}
|
||||||
class:new-styles={newStyles}
|
class:new-styles={newStyles}
|
||||||
class:active
|
class:active
|
||||||
|
class:disabled
|
||||||
class="spectrum-Button spectrum-Button--size{size.toUpperCase()}"
|
class="spectrum-Button spectrum-Button--size{size.toUpperCase()}"
|
||||||
{disabled}
|
{disabled}
|
||||||
data-cy={dataCy}
|
data-cy={dataCy}
|
||||||
|
@ -108,7 +109,10 @@
|
||||||
border-color: transparent;
|
border-color: transparent;
|
||||||
color: var(--spectrum-global-color-gray-900);
|
color: var(--spectrum-global-color-gray-900);
|
||||||
}
|
}
|
||||||
.spectrum-Button--secondary.new-styles:hover {
|
.spectrum-Button--secondary.new-styles:not(.disabled):hover {
|
||||||
background: var(--spectrum-global-color-gray-300);
|
background: var(--spectrum-global-color-gray-300);
|
||||||
}
|
}
|
||||||
|
.spectrum-Button--secondary.new-styles.disabled {
|
||||||
|
color: var(--spectrum-global-color-gray-500);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
.main {
|
.main {
|
||||||
font-family: var(--font-sans);
|
|
||||||
padding: var(--spacing-xl);
|
padding: var(--spacing-xl);
|
||||||
}
|
}
|
||||||
.main :global(textarea) {
|
.main :global(textarea) {
|
||||||
|
|
|
@ -264,7 +264,7 @@
|
||||||
max-height: 100%;
|
max-height: 100%;
|
||||||
}
|
}
|
||||||
:global(.flatpickr-calendar) {
|
:global(.flatpickr-calendar) {
|
||||||
font-family: "Source Sans Pro", sans-serif;
|
font-family: var(--font-sans);
|
||||||
}
|
}
|
||||||
.is-disabled {
|
.is-disabled {
|
||||||
pointer-events: none !important;
|
pointer-events: none !important;
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
import "@spectrum-css/picker/dist/index-vars.css"
|
import "@spectrum-css/picker/dist/index-vars.css"
|
||||||
import "@spectrum-css/popover/dist/index-vars.css"
|
import "@spectrum-css/popover/dist/index-vars.css"
|
||||||
import "@spectrum-css/menu/dist/index-vars.css"
|
import "@spectrum-css/menu/dist/index-vars.css"
|
||||||
import { fly } from "svelte/transition"
|
|
||||||
import { createEventDispatcher } from "svelte"
|
import { createEventDispatcher } from "svelte"
|
||||||
import clickOutside from "../../Actions/click_outside"
|
import clickOutside from "../../Actions/click_outside"
|
||||||
import Search from "./Search.svelte"
|
import Search from "./Search.svelte"
|
||||||
import Icon from "../../Icon/Icon.svelte"
|
import Icon from "../../Icon/Icon.svelte"
|
||||||
import StatusLight from "../../StatusLight/StatusLight.svelte"
|
import StatusLight from "../../StatusLight/StatusLight.svelte"
|
||||||
|
import Popover from "../../Popover/Popover.svelte"
|
||||||
|
|
||||||
export let id = null
|
export let id = null
|
||||||
export let disabled = false
|
export let disabled = false
|
||||||
|
@ -33,7 +33,10 @@
|
||||||
export let sort = false
|
export let sort = false
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
let searchTerm = null
|
let searchTerm = null
|
||||||
|
let button
|
||||||
|
let popover
|
||||||
|
|
||||||
$: sortedOptions = getSortedOptions(options, getOptionLabel, sort)
|
$: sortedOptions = getSortedOptions(options, getOptionLabel, sort)
|
||||||
$: filteredOptions = getFilteredOptions(
|
$: filteredOptions = getFilteredOptions(
|
||||||
|
@ -76,77 +79,117 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div use:clickOutside={() => (open = false)}>
|
<button
|
||||||
<button
|
{id}
|
||||||
{id}
|
class="spectrum-Picker spectrum-Picker--sizeM"
|
||||||
class="spectrum-Picker spectrum-Picker--sizeM"
|
class:spectrum-Picker--quiet={quiet}
|
||||||
class:spectrum-Picker--quiet={quiet}
|
{disabled}
|
||||||
{disabled}
|
class:is-invalid={!!error}
|
||||||
class:is-invalid={!!error}
|
class:is-open={open}
|
||||||
class:is-open={open}
|
aria-haspopup="listbox"
|
||||||
aria-haspopup="listbox"
|
on:click={onClick}
|
||||||
on:click={onClick}
|
use:clickOutside={() => (open = false)}
|
||||||
>
|
bind:this={button}
|
||||||
{#if fieldIcon}
|
>
|
||||||
<span class="option-extra">
|
{#if fieldIcon}
|
||||||
<Icon name={fieldIcon} />
|
<span class="option-extra icon">
|
||||||
</span>
|
<Icon size="S" name={fieldIcon} />
|
||||||
{/if}
|
|
||||||
{#if fieldColour}
|
|
||||||
<span class="option-extra">
|
|
||||||
<StatusLight square color={fieldColour} />
|
|
||||||
</span>
|
|
||||||
{/if}
|
|
||||||
<span
|
|
||||||
class="spectrum-Picker-label"
|
|
||||||
class:is-placeholder={isPlaceholder}
|
|
||||||
class:auto-width={autoWidth}
|
|
||||||
>
|
|
||||||
{fieldText}
|
|
||||||
</span>
|
</span>
|
||||||
{#if error}
|
{/if}
|
||||||
<svg
|
{#if fieldColour}
|
||||||
class="spectrum-Icon spectrum-Icon--sizeM spectrum-Picker-validationIcon"
|
<span class="option-extra">
|
||||||
focusable="false"
|
<StatusLight square color={fieldColour} />
|
||||||
aria-hidden="true"
|
</span>
|
||||||
aria-label="Folder"
|
{/if}
|
||||||
>
|
<span
|
||||||
<use xlink:href="#spectrum-icon-18-Alert" />
|
class="spectrum-Picker-label"
|
||||||
</svg>
|
class:is-placeholder={isPlaceholder}
|
||||||
{/if}
|
class:auto-width={autoWidth}
|
||||||
|
>
|
||||||
|
{fieldText}
|
||||||
|
</span>
|
||||||
|
{#if error}
|
||||||
<svg
|
<svg
|
||||||
class="spectrum-Icon spectrum-UIIcon-ChevronDown100 spectrum-Picker-menuIcon"
|
class="spectrum-Icon spectrum-Icon--sizeM spectrum-Picker-validationIcon"
|
||||||
focusable="false"
|
focusable="false"
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
|
aria-label="Folder"
|
||||||
>
|
>
|
||||||
<use xlink:href="#spectrum-css-icon-Chevron100" />
|
<use xlink:href="#spectrum-icon-18-Alert" />
|
||||||
</svg>
|
</svg>
|
||||||
</button>
|
{/if}
|
||||||
{#if open}
|
<svg
|
||||||
<div
|
class="spectrum-Icon spectrum-UIIcon-ChevronDown100 spectrum-Picker-menuIcon"
|
||||||
transition:fly|local={{ y: -20, duration: 200 }}
|
focusable="false"
|
||||||
class="spectrum-Popover spectrum-Popover--bottom spectrum-Picker-popover is-open"
|
aria-hidden="true"
|
||||||
class:auto-width={autoWidth}
|
>
|
||||||
>
|
<use xlink:href="#spectrum-css-icon-Chevron100" />
|
||||||
{#if autocomplete}
|
</svg>
|
||||||
<Search
|
</button>
|
||||||
value={searchTerm}
|
|
||||||
on:change={event => (searchTerm = event.detail)}
|
<Popover
|
||||||
{disabled}
|
anchor={button}
|
||||||
placeholder="Search"
|
align="left"
|
||||||
/>
|
portalTarget={document.documentElement}
|
||||||
|
bind:this={popover}
|
||||||
|
{open}
|
||||||
|
on:close={() => (open = false)}
|
||||||
|
useAnchorWidth={!autoWidth}
|
||||||
|
maxWidth={autoWidth ? 400 : null}
|
||||||
|
>
|
||||||
|
<div class="popover-content" class:auto-width={autoWidth}>
|
||||||
|
{#if autocomplete}
|
||||||
|
<Search
|
||||||
|
value={searchTerm}
|
||||||
|
on:change={event => (searchTerm = event.detail)}
|
||||||
|
{disabled}
|
||||||
|
placeholder="Search"
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
|
<ul class="spectrum-Menu" role="listbox">
|
||||||
|
{#if placeholderOption}
|
||||||
|
<li
|
||||||
|
class="spectrum-Menu-item placeholder"
|
||||||
|
class:is-selected={isPlaceholder}
|
||||||
|
role="option"
|
||||||
|
aria-selected="true"
|
||||||
|
tabindex="0"
|
||||||
|
on:click={() => onSelectOption(null)}
|
||||||
|
>
|
||||||
|
<span class="spectrum-Menu-itemLabel">{placeholderOption}</span>
|
||||||
|
<svg
|
||||||
|
class="spectrum-Icon spectrum-UIIcon-Checkmark100 spectrum-Menu-checkmark spectrum-Menu-itemIcon"
|
||||||
|
focusable="false"
|
||||||
|
aria-hidden="true"
|
||||||
|
>
|
||||||
|
<use xlink:href="#spectrum-css-icon-Checkmark100" />
|
||||||
|
</svg>
|
||||||
|
</li>
|
||||||
{/if}
|
{/if}
|
||||||
<ul class="spectrum-Menu" role="listbox">
|
{#if filteredOptions.length}
|
||||||
{#if placeholderOption}
|
{#each filteredOptions as option, idx}
|
||||||
<li
|
<li
|
||||||
class="spectrum-Menu-item placeholder"
|
class="spectrum-Menu-item"
|
||||||
class:is-selected={isPlaceholder}
|
class:is-selected={isOptionSelected(getOptionValue(option, idx))}
|
||||||
role="option"
|
role="option"
|
||||||
aria-selected="true"
|
aria-selected="true"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
on:click={() => onSelectOption(null)}
|
on:click={() => onSelectOption(getOptionValue(option, idx))}
|
||||||
|
class:is-disabled={!isOptionEnabled(option)}
|
||||||
>
|
>
|
||||||
<span class="spectrum-Menu-itemLabel">{placeholderOption}</span>
|
{#if getOptionIcon(option, idx)}
|
||||||
|
<span class="option-extra icon">
|
||||||
|
<Icon size="S" name={getOptionIcon(option, idx)} />
|
||||||
|
</span>
|
||||||
|
{/if}
|
||||||
|
{#if getOptionColour(option, idx)}
|
||||||
|
<span class="option-extra">
|
||||||
|
<StatusLight square color={getOptionColour(option, idx)} />
|
||||||
|
</span>
|
||||||
|
{/if}
|
||||||
|
<span class="spectrum-Menu-itemLabel">
|
||||||
|
{getOptionLabel(option, idx)}
|
||||||
|
</span>
|
||||||
<svg
|
<svg
|
||||||
class="spectrum-Icon spectrum-UIIcon-Checkmark100 spectrum-Menu-checkmark spectrum-Menu-itemIcon"
|
class="spectrum-Icon spectrum-UIIcon-Checkmark100 spectrum-Menu-checkmark spectrum-Menu-itemIcon"
|
||||||
focusable="false"
|
focusable="false"
|
||||||
|
@ -155,61 +198,13 @@
|
||||||
<use xlink:href="#spectrum-css-icon-Checkmark100" />
|
<use xlink:href="#spectrum-css-icon-Checkmark100" />
|
||||||
</svg>
|
</svg>
|
||||||
</li>
|
</li>
|
||||||
{/if}
|
{/each}
|
||||||
{#if filteredOptions.length}
|
{/if}
|
||||||
{#each filteredOptions as option, idx}
|
</ul>
|
||||||
<li
|
</div>
|
||||||
class="spectrum-Menu-item"
|
</Popover>
|
||||||
class:is-selected={isOptionSelected(getOptionValue(option, idx))}
|
|
||||||
role="option"
|
|
||||||
aria-selected="true"
|
|
||||||
tabindex="0"
|
|
||||||
on:click={() => onSelectOption(getOptionValue(option, idx))}
|
|
||||||
class:is-disabled={!isOptionEnabled(option)}
|
|
||||||
>
|
|
||||||
{#if getOptionIcon(option, idx)}
|
|
||||||
<span class="option-extra">
|
|
||||||
<Icon name={getOptionIcon(option, idx)} />
|
|
||||||
</span>
|
|
||||||
{/if}
|
|
||||||
{#if getOptionColour(option, idx)}
|
|
||||||
<span class="option-extra">
|
|
||||||
<StatusLight square color={getOptionColour(option, idx)} />
|
|
||||||
</span>
|
|
||||||
{/if}
|
|
||||||
<span class="spectrum-Menu-itemLabel">
|
|
||||||
{getOptionLabel(option, idx)}
|
|
||||||
</span>
|
|
||||||
<svg
|
|
||||||
class="spectrum-Icon spectrum-UIIcon-Checkmark100 spectrum-Menu-checkmark spectrum-Menu-itemIcon"
|
|
||||||
focusable="false"
|
|
||||||
aria-hidden="true"
|
|
||||||
>
|
|
||||||
<use xlink:href="#spectrum-css-icon-Checkmark100" />
|
|
||||||
</svg>
|
|
||||||
</li>
|
|
||||||
{/each}
|
|
||||||
{/if}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.spectrum-Popover {
|
|
||||||
max-height: 240px;
|
|
||||||
z-index: 999;
|
|
||||||
top: 100%;
|
|
||||||
}
|
|
||||||
.spectrum-Popover:not(.auto-width) {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
.spectrum-Popover.auto-width :global(.spectrum-Menu-itemLabel) {
|
|
||||||
max-width: 400px;
|
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
|
||||||
.spectrum-Picker {
|
.spectrum-Picker {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
|
@ -229,9 +224,6 @@
|
||||||
.spectrum-Picker-label.auto-width.is-placeholder {
|
.spectrum-Picker-label.auto-width.is-placeholder {
|
||||||
padding-right: 2px;
|
padding-right: 2px;
|
||||||
}
|
}
|
||||||
.auto-width .spectrum-Menu-item {
|
|
||||||
padding-right: var(--spacing-xl);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Icon and colour alignment */
|
/* Icon and colour alignment */
|
||||||
.spectrum-Menu-checkmark {
|
.spectrum-Menu-checkmark {
|
||||||
|
@ -241,27 +233,48 @@
|
||||||
.option-extra {
|
.option-extra {
|
||||||
padding-right: 8px;
|
padding-right: 8px;
|
||||||
}
|
}
|
||||||
|
.option-extra.icon {
|
||||||
|
margin: 0 -1px;
|
||||||
|
}
|
||||||
|
|
||||||
.spectrum-Popover :global(.spectrum-Search) {
|
/* Popover */
|
||||||
|
.popover-content {
|
||||||
|
display: contents;
|
||||||
|
}
|
||||||
|
.popover-content.auto-width .spectrum-Menu-itemLabel {
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
.popover-content:not(.auto-width) .spectrum-Menu-itemLabel {
|
||||||
|
width: 0;
|
||||||
|
flex: 1 1 auto;
|
||||||
|
}
|
||||||
|
.popover-content.auto-width .spectrum-Menu-item {
|
||||||
|
padding-right: var(--spacing-xl);
|
||||||
|
}
|
||||||
|
.spectrum-Menu-item.is-disabled {
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Search styles inside popover */
|
||||||
|
.popover-content :global(.spectrum-Search) {
|
||||||
margin-top: -1px;
|
margin-top: -1px;
|
||||||
margin-left: -1px;
|
margin-left: -1px;
|
||||||
width: calc(100% + 2px);
|
width: calc(100% + 2px);
|
||||||
}
|
}
|
||||||
.spectrum-Popover :global(.spectrum-Search input) {
|
.popover-content :global(.spectrum-Search input) {
|
||||||
height: auto;
|
height: auto;
|
||||||
border-bottom-left-radius: 0;
|
border-bottom-left-radius: 0;
|
||||||
border-bottom-right-radius: 0;
|
border-bottom-right-radius: 0;
|
||||||
padding-top: var(--spectrum-global-dimension-size-100);
|
padding-top: var(--spectrum-global-dimension-size-100);
|
||||||
padding-bottom: var(--spectrum-global-dimension-size-100);
|
padding-bottom: var(--spectrum-global-dimension-size-100);
|
||||||
}
|
}
|
||||||
.spectrum-Popover :global(.spectrum-Search .spectrum-ClearButton) {
|
.popover-content :global(.spectrum-Search .spectrum-ClearButton) {
|
||||||
right: 1px;
|
right: 1px;
|
||||||
top: 2px;
|
top: 2px;
|
||||||
}
|
}
|
||||||
.spectrum-Popover :global(.spectrum-Search .spectrum-Textfield-icon) {
|
.popover-content :global(.spectrum-Search .spectrum-Textfield-icon) {
|
||||||
top: 9px;
|
top: 9px;
|
||||||
}
|
}
|
||||||
.spectrum-Menu-item.is-disabled {
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -112,8 +112,4 @@
|
||||||
.spectrum-Textfield {
|
.spectrum-Textfield {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
input:disabled {
|
|
||||||
color: var(--spectrum-global-color-gray-600) !important;
|
|
||||||
-webkit-text-fill-color: var(--spectrum-global-color-gray-600) !important;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
.icon {
|
.icon {
|
||||||
width: 28px;
|
width: 28px;
|
||||||
height: 28px;
|
height: 28px;
|
||||||
|
flex: 0 0 28px;
|
||||||
display: grid;
|
display: grid;
|
||||||
place-items: center;
|
place-items: center;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
|
@ -34,6 +35,7 @@
|
||||||
.icon.size--S {
|
.icon.size--S {
|
||||||
width: 22px;
|
width: 22px;
|
||||||
height: 22px;
|
height: 22px;
|
||||||
|
flex: 0 0 22px;
|
||||||
}
|
}
|
||||||
.icon.size--S :global(.spectrum-Icon) {
|
.icon.size--S :global(.spectrum-Icon) {
|
||||||
width: 16px;
|
width: 16px;
|
||||||
|
@ -46,6 +48,7 @@
|
||||||
.icon.size--L {
|
.icon.size--L {
|
||||||
width: 40px;
|
width: 40px;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
|
flex: 0 0 40px;
|
||||||
}
|
}
|
||||||
.icon.size--L :global(.spectrum-Icon) {
|
.icon.size--L :global(.spectrum-Icon) {
|
||||||
width: 28px;
|
width: 28px;
|
||||||
|
|
|
@ -56,5 +56,6 @@
|
||||||
--spectrum-semantic-positive-icon-color: #2d9d78;
|
--spectrum-semantic-positive-icon-color: #2d9d78;
|
||||||
--spectrum-semantic-negative-icon-color: #e34850;
|
--spectrum-semantic-negative-icon-color: #e34850;
|
||||||
min-width: 100px;
|
min-width: 100px;
|
||||||
|
margin: 0;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
label {
|
label {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
color: var(--spectrum-global-color-gray-600);
|
||||||
}
|
}
|
||||||
|
|
||||||
.muted {
|
.muted {
|
||||||
|
|
|
@ -1,32 +1,95 @@
|
||||||
<script>
|
<script>
|
||||||
|
import { setContext } from "svelte"
|
||||||
|
import clickOutside from "../Actions/click_outside"
|
||||||
|
|
||||||
export let wide = false
|
export let wide = false
|
||||||
export let maxWidth = "80ch"
|
export let narrow = false
|
||||||
export let noPadding = false
|
export let noPadding = false
|
||||||
|
|
||||||
|
let sidePanelVisble = false
|
||||||
|
|
||||||
|
setContext("side-panel", {
|
||||||
|
open: () => (sidePanelVisble = true),
|
||||||
|
close: () => (sidePanelVisble = false),
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div style="--max-width: {maxWidth}" class:wide class:noPadding>
|
<div class="page">
|
||||||
<slot />
|
<div class="main">
|
||||||
|
<div class="content" class:wide class:noPadding class:narrow>
|
||||||
|
<slot />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
id="side-panel"
|
||||||
|
class:visible={sidePanelVisble}
|
||||||
|
use:clickOutside={() => {
|
||||||
|
sidePanelVisble = false
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<slot name="side-panel" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
div {
|
.page {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.page,
|
||||||
|
.main {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: flex-start;
|
||||||
|
align-items: stretch;
|
||||||
|
flex: 1 1 auto;
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
.main {
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
.content {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
max-width: var(--max-width);
|
max-width: 1080px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
padding: calc(var(--spacing-xl) * 2);
|
flex: 1 1 auto;
|
||||||
min-height: calc(100% - var(--spacing-xl) * 4);
|
padding: 50px;
|
||||||
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
.content.wide {
|
||||||
.wide {
|
|
||||||
max-width: none;
|
max-width: none;
|
||||||
margin: 0;
|
}
|
||||||
|
.content.narrow {
|
||||||
|
max-width: 840px;
|
||||||
|
}
|
||||||
|
#side-panel {
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
padding: 24px;
|
||||||
|
background: var(--background);
|
||||||
|
border-left: var(--border-light);
|
||||||
|
width: 320px;
|
||||||
|
max-width: calc(100vw - 48px - 48px);
|
||||||
|
overflow: auto;
|
||||||
|
overflow-x: hidden;
|
||||||
|
transform: translateX(100%);
|
||||||
|
transition: transform 130ms ease-out;
|
||||||
|
height: calc(100% - 48px);
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
#side-panel.visible {
|
||||||
|
transform: translateX(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
.noPadding {
|
@media (max-width: 640px) {
|
||||||
padding: 0px;
|
.content {
|
||||||
margin: 0px;
|
padding: 24px;
|
||||||
|
max-width: calc(100vw - 48px) !important;
|
||||||
|
width: calc(100vw - 48px) !important;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -30,9 +30,11 @@
|
||||||
<Label>{subtitle}</Label>
|
<Label>{subtitle}</Label>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<div class="right">
|
{#if $$slots.default}
|
||||||
<slot />
|
<div class="right">
|
||||||
</div>
|
<slot />
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
@ -45,6 +47,7 @@
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
border: 1px solid var(--spectrum-global-color-gray-300);
|
border: 1px solid var(--spectrum-global-color-gray-300);
|
||||||
transition: background 130ms ease-out;
|
transition: background 130ms ease-out;
|
||||||
|
gap: var(--spacing-m);
|
||||||
}
|
}
|
||||||
.list-item:not(:first-child) {
|
.list-item:not(:first-child) {
|
||||||
border-top: none;
|
border-top: none;
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
padding: 40px;
|
padding: 40px;
|
||||||
background-color: var(--purple);
|
background-color: var(--purple);
|
||||||
color: white;
|
color: white;
|
||||||
font-family: var(--font-sans);
|
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
p, span {
|
p, span {
|
||||||
font-family: var(--font-sans);
|
|
||||||
font-size: var(--font-size-s);
|
font-size: var(--font-size-s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,7 @@
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if showCancelButton}
|
{#if showCancelButton}
|
||||||
<Button group secondary newStyles on:click={close}>
|
<Button group secondary on:click={close}>
|
||||||
{cancelText}
|
{cancelText}
|
||||||
</Button>
|
</Button>
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -151,7 +151,8 @@
|
||||||
overflow: visible;
|
overflow: visible;
|
||||||
}
|
}
|
||||||
.spectrum-Dialog-heading {
|
.spectrum-Dialog-heading {
|
||||||
font-family: var(--font-sans);
|
font-family: var(--font-accent);
|
||||||
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
.spectrum-Dialog-heading.noDivider {
|
.spectrum-Dialog-heading.noDivider {
|
||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
|
|
|
@ -42,7 +42,6 @@
|
||||||
<style>
|
<style>
|
||||||
p {
|
p {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-family: var(--font-sans);
|
|
||||||
font-size: var(--font-size-s);
|
font-size: var(--font-size-s);
|
||||||
}
|
}
|
||||||
p.error {
|
p.error {
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
import { createEventDispatcher } from "svelte"
|
import { createEventDispatcher } from "svelte"
|
||||||
import positionDropdown from "../Actions/position_dropdown"
|
import positionDropdown from "../Actions/position_dropdown"
|
||||||
import clickOutside from "../Actions/click_outside"
|
import clickOutside from "../Actions/click_outside"
|
||||||
|
import { fly } from "svelte/transition"
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
|
@ -12,9 +13,10 @@
|
||||||
export let portalTarget
|
export let portalTarget
|
||||||
export let dataCy
|
export let dataCy
|
||||||
export let maxWidth
|
export let maxWidth
|
||||||
|
|
||||||
export let direction = "bottom"
|
export let direction = "bottom"
|
||||||
export let showTip = false
|
export let showTip = false
|
||||||
|
export let open = false
|
||||||
|
export let useAnchorWidth = false
|
||||||
|
|
||||||
let tipSvg =
|
let tipSvg =
|
||||||
'<svg xmlns="http://www.w3.org/svg/2000" width="23" height="12" class="spectrum-Popover-tip" > <path class="spectrum-Popover-tip-triangle" d="M 0.7071067811865476 0 L 11.414213562373096 10.707106781186548 L 22.121320343559645 0" /> </svg>'
|
'<svg xmlns="http://www.w3.org/svg/2000" width="23" height="12" class="spectrum-Popover-tip" > <path class="spectrum-Popover-tip-triangle" d="M 0.7071067811865476 0 L 11.414213562373096 10.707106781186548 L 22.121320343559645 0" /> </svg>'
|
||||||
|
@ -35,13 +37,22 @@
|
||||||
|
|
||||||
const handleOutsideClick = e => {
|
const handleOutsideClick = e => {
|
||||||
if (open) {
|
if (open) {
|
||||||
e.stopPropagation()
|
// Stop propagation if the source is the anchor
|
||||||
|
let node = e.target
|
||||||
|
let fromAnchor = false
|
||||||
|
while (!fromAnchor && node && node.parentNode) {
|
||||||
|
fromAnchor = node === anchor
|
||||||
|
node = node.parentNode
|
||||||
|
}
|
||||||
|
if (fromAnchor) {
|
||||||
|
e.stopPropagation()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hide the popover
|
||||||
hide()
|
hide()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let open = null
|
|
||||||
|
|
||||||
function handleEscape(e) {
|
function handleEscape(e) {
|
||||||
if (open && e.key === "Escape") {
|
if (open && e.key === "Escape") {
|
||||||
hide()
|
hide()
|
||||||
|
@ -53,12 +64,13 @@
|
||||||
<Portal target={portalTarget}>
|
<Portal target={portalTarget}>
|
||||||
<div
|
<div
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
use:positionDropdown={{ anchor, align, maxWidth }}
|
use:positionDropdown={{ anchor, align, maxWidth, useAnchorWidth }}
|
||||||
use:clickOutside={handleOutsideClick}
|
use:clickOutside={handleOutsideClick}
|
||||||
on:keydown={handleEscape}
|
on:keydown={handleEscape}
|
||||||
class={"spectrum-Popover is-open " + (tooltipClasses || "")}
|
class={"spectrum-Popover is-open " + (tooltipClasses || "")}
|
||||||
role="presentation"
|
role="presentation"
|
||||||
data-cy={dataCy}
|
data-cy={dataCy}
|
||||||
|
transition:fly|local={{ y: -20, duration: 200 }}
|
||||||
>
|
>
|
||||||
{#if showTip}
|
{#if showTip}
|
||||||
{@html tipSvg}
|
{@html tipSvg}
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
font-size: var(--font-size-m);
|
font-size: var(--font-size-m);
|
||||||
margin: 0 0 var(--spacing-l) 0;
|
margin: 0 0 var(--spacing-l) 0;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
font-family: var(--font-sans);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-group-column {
|
.input-group-column {
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
<script>
|
<script>
|
||||||
export let value
|
export let value
|
||||||
|
export let schema
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div>{typeof value === "object" ? JSON.stringify(value) : value}</div>
|
<div class:capitalise={schema?.capitalise}>
|
||||||
|
{typeof value === "object" ? JSON.stringify(value) : value}
|
||||||
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
div {
|
div {
|
||||||
|
@ -10,5 +13,10 @@
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
max-width: var(--max-cell-width);
|
max-width: var(--max-cell-width);
|
||||||
|
width: 0;
|
||||||
|
flex: 1 1 auto;
|
||||||
|
}
|
||||||
|
div.capitalise {
|
||||||
|
text-transform: capitalize;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
* template: a HBS or JS binding to use as the value
|
* template: a HBS or JS binding to use as the value
|
||||||
* background: the background color
|
* background: the background color
|
||||||
* color: the text color
|
* color: the text color
|
||||||
|
* borderLeft: show a left border
|
||||||
|
* borderRight: show a right border
|
||||||
*/
|
*/
|
||||||
export let data = []
|
export let data = []
|
||||||
export let schema = {}
|
export let schema = {}
|
||||||
|
@ -31,6 +33,7 @@
|
||||||
export let allowSelectRows
|
export let allowSelectRows
|
||||||
export let allowEditRows = true
|
export let allowEditRows = true
|
||||||
export let allowEditColumns = true
|
export let allowEditColumns = true
|
||||||
|
export let allowClickRows = true
|
||||||
export let selectedRows = []
|
export let selectedRows = []
|
||||||
export let customRenderers = []
|
export let customRenderers = []
|
||||||
export let disableSorting = false
|
export let disableSorting = false
|
||||||
|
@ -270,6 +273,17 @@
|
||||||
if (schema[field].align === "Right") {
|
if (schema[field].align === "Right") {
|
||||||
styles[field] += "justify-content: flex-end; text-align: right;"
|
styles[field] += "justify-content: flex-end; text-align: right;"
|
||||||
}
|
}
|
||||||
|
if (schema[field].borderLeft) {
|
||||||
|
styles[field] +=
|
||||||
|
"border-left: 1px solid var(--spectrum-global-color-gray-200);"
|
||||||
|
}
|
||||||
|
if (schema[field].borderLeft) {
|
||||||
|
styles[field] +=
|
||||||
|
"border-right: 1px solid var(--spectrum-global-color-gray-200);"
|
||||||
|
}
|
||||||
|
if (schema[field].minWidth) {
|
||||||
|
styles[field] += `min-width: ${schema[field].minWidth};`
|
||||||
|
}
|
||||||
})
|
})
|
||||||
return styles
|
return styles
|
||||||
}
|
}
|
||||||
|
@ -290,7 +304,11 @@
|
||||||
</slot>
|
</slot>
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
<div class="spectrum-Table" style={`${heightStyle}${gridStyle}`}>
|
<div
|
||||||
|
class="spectrum-Table"
|
||||||
|
class:no-scroll={!rowCount}
|
||||||
|
style={`${heightStyle}${gridStyle}`}
|
||||||
|
>
|
||||||
{#if fields.length}
|
{#if fields.length}
|
||||||
<div class="spectrum-Table-head">
|
<div class="spectrum-Table-head">
|
||||||
{#if showEditColumn}
|
{#if showEditColumn}
|
||||||
|
@ -356,7 +374,7 @@
|
||||||
{/if}
|
{/if}
|
||||||
{#if sortedRows?.length}
|
{#if sortedRows?.length}
|
||||||
{#each sortedRows as row, idx}
|
{#each sortedRows as row, idx}
|
||||||
<div class="spectrum-Table-row">
|
<div class="spectrum-Table-row" class:clickable={allowClickRows}>
|
||||||
{#if showEditColumn}
|
{#if showEditColumn}
|
||||||
<div
|
<div
|
||||||
class:noBorderCheckbox={!showHeaderBorder}
|
class:noBorderCheckbox={!showHeaderBorder}
|
||||||
|
@ -433,10 +451,10 @@
|
||||||
/* Wrapper */
|
/* Wrapper */
|
||||||
.wrapper {
|
.wrapper {
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 0;
|
|
||||||
--table-bg: var(--spectrum-global-color-gray-50);
|
--table-bg: var(--spectrum-global-color-gray-50);
|
||||||
--table-border: 1px solid var(--spectrum-alias-border-color-mid);
|
--table-border: 1px solid var(--spectrum-alias-border-color-mid);
|
||||||
--cell-padding: var(--spectrum-global-dimension-size-250);
|
--cell-padding: var(--spectrum-global-dimension-size-250);
|
||||||
|
overflow: auto;
|
||||||
}
|
}
|
||||||
.wrapper--quiet {
|
.wrapper--quiet {
|
||||||
--table-bg: var(--spectrum-alias-background-color-transparent);
|
--table-bg: var(--spectrum-alias-background-color-transparent);
|
||||||
|
@ -460,6 +478,9 @@
|
||||||
display: grid;
|
display: grid;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
.spectrum-Table.no-scroll {
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
|
|
||||||
/* Header */
|
/* Header */
|
||||||
.spectrum-Table-head {
|
.spectrum-Table-head {
|
||||||
|
@ -546,12 +567,13 @@
|
||||||
/* Table rows */
|
/* Table rows */
|
||||||
.spectrum-Table-row {
|
.spectrum-Table-row {
|
||||||
display: contents;
|
display: contents;
|
||||||
|
cursor: auto;
|
||||||
}
|
}
|
||||||
.spectrum-Table-row:hover .spectrum-Table-cell {
|
.spectrum-Table-row.clickable {
|
||||||
/*background-color: var(--hover-bg) !important;*/
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
.spectrum-Table-row:hover .spectrum-Table-cell:after {
|
.spectrum-Table-row.clickable:hover .spectrum-Table-cell {
|
||||||
background-color: var(--spectrum-alias-highlight-hover);
|
background-color: var(--spectrum-global-color-gray-100);
|
||||||
}
|
}
|
||||||
.wrapper--quiet .spectrum-Table-row {
|
.wrapper--quiet .spectrum-Table-row {
|
||||||
border-left: none;
|
border-left: none;
|
||||||
|
@ -584,24 +606,13 @@
|
||||||
border-bottom: 1px solid var(--spectrum-alias-border-color-mid);
|
border-bottom: 1px solid var(--spectrum-alias-border-color-mid);
|
||||||
background-color: var(--table-bg);
|
background-color: var(--table-bg);
|
||||||
z-index: auto;
|
z-index: auto;
|
||||||
|
transition: background-color 130ms ease-out;
|
||||||
}
|
}
|
||||||
.spectrum-Table-cell--edit {
|
.spectrum-Table-cell--edit {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
left: 0;
|
left: 0;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
}
|
}
|
||||||
.spectrum-Table-cell:after {
|
|
||||||
content: "";
|
|
||||||
position: absolute;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
background-color: transparent;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
pointer-events: none;
|
|
||||||
transition: background-color
|
|
||||||
var(--spectrum-global-animation-duration-100, 0.13s) ease-in-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Placeholder */
|
/* Placeholder */
|
||||||
.placeholder {
|
.placeholder {
|
||||||
|
|
|
@ -82,7 +82,8 @@
|
||||||
.spectrum-Tabs-item {
|
.spectrum-Tabs-item {
|
||||||
color: var(--spectrum-global-color-gray-600);
|
color: var(--spectrum-global-color-gray-600);
|
||||||
}
|
}
|
||||||
.spectrum-Tabs-item.is-selected {
|
.spectrum-Tabs-item.is-selected,
|
||||||
|
.spectrum-Tabs-item:hover {
|
||||||
color: var(--spectrum-global-color-gray-900);
|
color: var(--spectrum-global-color-gray-900);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.spectrum-Tags-item {
|
.spectrum-Tags-item {
|
||||||
margin-top: 0;
|
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -5,3 +5,13 @@
|
||||||
<div class="spectrum-Tags" role="list" aria-label="list">
|
<div class="spectrum-Tags" role="list" aria-label="list">
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.spectrum-Tags {
|
||||||
|
margin-top: -8px;
|
||||||
|
margin-left: -4px;
|
||||||
|
}
|
||||||
|
.spectrum-Tags :global(.spectrum-Tags-item) {
|
||||||
|
margin: 8px 0 0 4px !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -15,3 +15,9 @@
|
||||||
>
|
>
|
||||||
<slot />
|
<slot />
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
h1 {
|
||||||
|
font-family: var(--font-accent);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -40,12 +40,14 @@
|
||||||
--rounded-medium: 8px;
|
--rounded-medium: 8px;
|
||||||
--rounded-large: 16px;
|
--rounded-large: 16px;
|
||||||
|
|
||||||
--font-sans: Source Sans Pro, -apple-system, BlinkMacSystemFont, Segoe UI, "Inter",
|
--font-sans: "Source Sans Pro", -apple-system, BlinkMacSystemFont, Segoe UI, "Inter",
|
||||||
"Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji",
|
"Helvetica Neue", Arial, "Noto Sans", sans-serif;
|
||||||
"Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
--font-accent: "Source Sans Pro", -apple-system, BlinkMacSystemFont, Segoe UI, "Inter",
|
||||||
|
"Helvetica Neue", Arial, "Noto Sans", sans-serif;
|
||||||
--font-serif: "Georgia", Cambria, Times New Roman, Times, serif;
|
--font-serif: "Georgia", Cambria, Times New Roman, Times, serif;
|
||||||
--font-mono: Menlo, Monaco, Consolas, "Liberation Mono", "Courier New",
|
--font-mono: Menlo, Monaco, Consolas, "Liberation Mono", "Courier New",
|
||||||
monospace;
|
monospace;
|
||||||
|
--spectrum-alias-body-text-font-family: var(--font-sans);
|
||||||
|
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
--font-size-xs: 0.75rem;
|
--font-size-xs: 0.75rem;
|
||||||
|
@ -89,6 +91,8 @@
|
||||||
--border-light-2: 2px var(--grey-3) solid;
|
--border-light-2: 2px var(--grey-3) solid;
|
||||||
--border-blue: 2px var(--blue) solid;
|
--border-blue: 2px var(--blue) solid;
|
||||||
--border-transparent: 2px transparent solid;
|
--border-transparent: 2px transparent solid;
|
||||||
|
|
||||||
|
--spectrum-alias-text-color-disabled: var(--spectrum-global-color-gray-600);
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||||
viewBox="0 0 48 48" style="enable-background:new 0 0 48 48;" xml:space="preserve">
|
viewBox="0 0 48 48" style="enable-background:new 0 0 48 48;" xml:space="preserve">
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.st0{fill:#393C44;}
|
.st0{fill:#000000;}
|
||||||
.st1{fill:#FFFFFF;}
|
.st1{fill:#FFFFFF;}
|
||||||
.st2{fill:#4285F4;}
|
.st2{fill:#4285F4;}
|
||||||
</style>
|
</style>
|
||||||
|
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
|
@ -87,7 +87,7 @@
|
||||||
"shortid": "2.2.15",
|
"shortid": "2.2.15",
|
||||||
"svelte-dnd-action": "^0.9.8",
|
"svelte-dnd-action": "^0.9.8",
|
||||||
"svelte-loading-spinners": "^0.1.1",
|
"svelte-loading-spinners": "^0.1.1",
|
||||||
"svelte-portal": "0.1.0",
|
"svelte-portal": "1.0.0",
|
||||||
"uuid": "8.3.1",
|
"uuid": "8.3.1",
|
||||||
"yup": "0.29.2"
|
"yup": "0.29.2"
|
||||||
},
|
},
|
||||||
|
|
|
@ -11,11 +11,8 @@
|
||||||
|
|
||||||
<div class="banner-container" />
|
<div class="banner-container" />
|
||||||
<BannerDisplay />
|
<BannerDisplay />
|
||||||
|
|
||||||
<NotificationDisplay />
|
<NotificationDisplay />
|
||||||
|
|
||||||
<LicensingOverlays />
|
<LicensingOverlays />
|
||||||
|
|
||||||
<Router {routes} config={{ queryHandler }} />
|
<Router {routes} config={{ queryHandler }} />
|
||||||
<div class="modal-container" />
|
<div class="modal-container" />
|
||||||
<HelpIcon />
|
<HelpIcon />
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
export let loading = false
|
export let loading = false
|
||||||
export let hideAutocolumns
|
export let hideAutocolumns
|
||||||
export let rowCount
|
export let rowCount
|
||||||
export let type
|
|
||||||
export let disableSorting = false
|
export let disableSorting = false
|
||||||
export let customPlaceholder = false
|
export let customPlaceholder = false
|
||||||
|
|
||||||
|
|
|
@ -174,7 +174,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
label {
|
label {
|
||||||
font-family: var(--font-sans);
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
ProgressCircle,
|
ProgressCircle,
|
||||||
Layout,
|
Layout,
|
||||||
Body,
|
Body,
|
||||||
|
Icon,
|
||||||
} from "@budibase/bbui"
|
} from "@budibase/bbui"
|
||||||
import { auth, apps } from "stores/portal"
|
import { auth, apps } from "stores/portal"
|
||||||
import { processStringSync } from "@budibase/string-templates"
|
import { processStringSync } from "@budibase/string-templates"
|
||||||
|
@ -56,85 +57,77 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="lock-status">
|
{#if lockedBy}
|
||||||
{#if lockedBy}
|
<div class="lock-status">
|
||||||
<Button
|
<Icon
|
||||||
quiet
|
name="LockClosed"
|
||||||
secondary
|
hoverable
|
||||||
icon="LockClosed"
|
|
||||||
size={buttonSize}
|
size={buttonSize}
|
||||||
on:click={() => {
|
on:click={e => {
|
||||||
|
e.stopPropagation()
|
||||||
appLockModal.show()
|
appLockModal.show()
|
||||||
}}
|
}}
|
||||||
>
|
/>
|
||||||
<span class="lock-status-text">
|
|
||||||
{lockedByHeading}
|
|
||||||
</span>
|
|
||||||
</Button>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{#key app}
|
|
||||||
<div>
|
|
||||||
<Modal bind:this={appLockModal}>
|
|
||||||
<ModalContent
|
|
||||||
title={lockedByHeading}
|
|
||||||
dataCy={"app-lock-modal"}
|
|
||||||
showConfirmButton={false}
|
|
||||||
showCancelButton={false}
|
|
||||||
>
|
|
||||||
<Layout noPadding>
|
|
||||||
<Body size="S">
|
|
||||||
Apps are locked to prevent work from being lost from overlapping
|
|
||||||
changes between your team.
|
|
||||||
</Body>
|
|
||||||
{#if lockedByYou && getExpiryDuration(app) > 0}
|
|
||||||
<span class="lock-expiry-body">
|
|
||||||
{processStringSync(
|
|
||||||
"This lock will expire in {{ duration time 'millisecond' }} from now. This lock will expire in This lock will expire in ",
|
|
||||||
{
|
|
||||||
time: getExpiryDuration(app),
|
|
||||||
}
|
|
||||||
)}
|
|
||||||
</span>
|
|
||||||
{/if}
|
|
||||||
<div class="lock-modal-actions">
|
|
||||||
<ButtonGroup>
|
|
||||||
<Button
|
|
||||||
secondary
|
|
||||||
quiet={lockedBy && lockedByYou}
|
|
||||||
disabled={processing}
|
|
||||||
on:click={() => {
|
|
||||||
appLockModal.hide()
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<span class="cancel"
|
|
||||||
>{lockedBy && !lockedByYou ? "Done" : "Cancel"}</span
|
|
||||||
>
|
|
||||||
</Button>
|
|
||||||
{#if lockedByYou}
|
|
||||||
<Button
|
|
||||||
secondary
|
|
||||||
disabled={processing}
|
|
||||||
on:click={() => {
|
|
||||||
releaseLock()
|
|
||||||
appLockModal.hide()
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{#if processing}
|
|
||||||
<ProgressCircle overBackground={true} size="S" />
|
|
||||||
{:else}
|
|
||||||
<span class="unlock">Release Lock</span>
|
|
||||||
{/if}
|
|
||||||
</Button>
|
|
||||||
{/if}
|
|
||||||
</ButtonGroup>
|
|
||||||
</div>
|
|
||||||
</Layout>
|
|
||||||
</ModalContent>
|
|
||||||
</Modal>
|
|
||||||
</div>
|
</div>
|
||||||
{/key}
|
{/if}
|
||||||
|
|
||||||
|
<Modal bind:this={appLockModal}>
|
||||||
|
<ModalContent
|
||||||
|
title={lockedByHeading}
|
||||||
|
dataCy={"app-lock-modal"}
|
||||||
|
showConfirmButton={false}
|
||||||
|
showCancelButton={false}
|
||||||
|
>
|
||||||
|
<Layout noPadding>
|
||||||
|
<Body size="S">
|
||||||
|
Apps are locked to prevent work being lost from overlapping changes
|
||||||
|
between your team.
|
||||||
|
</Body>
|
||||||
|
{#if lockedByYou && getExpiryDuration(app) > 0}
|
||||||
|
<span class="lock-expiry-body">
|
||||||
|
{processStringSync(
|
||||||
|
"This lock will expire in {{ duration time 'millisecond' }} from now.",
|
||||||
|
{
|
||||||
|
time: getExpiryDuration(app),
|
||||||
|
}
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
{/if}
|
||||||
|
<div class="lock-modal-actions">
|
||||||
|
<ButtonGroup>
|
||||||
|
<Button
|
||||||
|
secondary
|
||||||
|
quiet={lockedBy && lockedByYou}
|
||||||
|
disabled={processing}
|
||||||
|
on:click={() => {
|
||||||
|
appLockModal.hide()
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<span class="cancel"
|
||||||
|
>{lockedBy && !lockedByYou ? "Done" : "Cancel"}</span
|
||||||
|
>
|
||||||
|
</Button>
|
||||||
|
{#if lockedByYou}
|
||||||
|
<Button
|
||||||
|
cta
|
||||||
|
disabled={processing}
|
||||||
|
on:click={() => {
|
||||||
|
releaseLock()
|
||||||
|
appLockModal.hide()
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{#if processing}
|
||||||
|
<ProgressCircle overBackground={true} size="S" />
|
||||||
|
{:else}
|
||||||
|
<span class="unlock">Release Lock</span>
|
||||||
|
{/if}
|
||||||
|
</Button>
|
||||||
|
{/if}
|
||||||
|
</ButtonGroup>
|
||||||
|
</div>
|
||||||
|
</Layout>
|
||||||
|
</ModalContent>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.lock-modal-actions {
|
.lock-modal-actions {
|
||||||
|
@ -148,8 +141,4 @@
|
||||||
gap: var(--spacing-s);
|
gap: var(--spacing-s);
|
||||||
max-width: 175px;
|
max-width: 175px;
|
||||||
}
|
}
|
||||||
.lock-status-text {
|
|
||||||
font-weight: 400;
|
|
||||||
color: var(--spectrum-global-color-gray-800);
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -135,7 +135,7 @@
|
||||||
div :global(.CodeMirror) {
|
div :global(.CodeMirror) {
|
||||||
height: var(--code-mirror-height);
|
height: var(--code-mirror-height);
|
||||||
min-height: var(--code-mirror-height);
|
min-height: var(--code-mirror-height);
|
||||||
font-family: monospace;
|
font-family: var(--font-mono);
|
||||||
line-height: 1.3;
|
line-height: 1.3;
|
||||||
border: var(--spectrum-alias-border-size-thin) solid;
|
border: var(--spectrum-alias-border-size-thin) solid;
|
||||||
border-color: var(--spectrum-alias-border-color);
|
border-color: var(--spectrum-alias-border-color);
|
||||||
|
|
|
@ -1,64 +0,0 @@
|
||||||
<script>
|
|
||||||
import {
|
|
||||||
ActionMenu,
|
|
||||||
Checkbox,
|
|
||||||
MenuItem,
|
|
||||||
Heading,
|
|
||||||
ProgressCircle,
|
|
||||||
} from "@budibase/bbui"
|
|
||||||
import { admin } from "stores/portal"
|
|
||||||
import { goto } from "@roxi/routify"
|
|
||||||
import { onMount } from "svelte"
|
|
||||||
|
|
||||||
let width = window.innerWidth
|
|
||||||
$: side = width < 500 ? "right" : "left"
|
|
||||||
|
|
||||||
const resizeObserver = new ResizeObserver(entries => {
|
|
||||||
if (entries?.[0]) {
|
|
||||||
width = entries[0].contentRect?.width
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
onMount(() => {
|
|
||||||
const doc = document.documentElement
|
|
||||||
resizeObserver.observe(doc)
|
|
||||||
|
|
||||||
return () => {
|
|
||||||
resizeObserver.unobserve(doc)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<ActionMenu align={side}>
|
|
||||||
<div slot="control" class="icon">
|
|
||||||
<ProgressCircle size="S" value={$admin.onboardingProgress} />
|
|
||||||
</div>
|
|
||||||
<MenuItem disabled>
|
|
||||||
<header class="item">
|
|
||||||
<Heading size="XXS">Get Started Checklist</Heading>
|
|
||||||
<ProgressCircle size="S" value={$admin.onboardingProgress} />
|
|
||||||
</header>
|
|
||||||
</MenuItem>
|
|
||||||
{#each Object.keys($admin.checklist) as checklistItem, idx}
|
|
||||||
<MenuItem>
|
|
||||||
<div
|
|
||||||
class="item"
|
|
||||||
on:click={() => $goto($admin.checklist[checklistItem].link)}
|
|
||||||
>
|
|
||||||
<span>{idx + 1}. {$admin.checklist[checklistItem].label}</span>
|
|
||||||
<Checkbox value={$admin.checklist[checklistItem].checked} />
|
|
||||||
</div>
|
|
||||||
</MenuItem>
|
|
||||||
{/each}
|
|
||||||
</ActionMenu>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.item {
|
|
||||||
display: grid;
|
|
||||||
align-items: center;
|
|
||||||
grid-template-columns: 175px 20px;
|
|
||||||
}
|
|
||||||
.icon {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
</style>
|
|
|
@ -1,47 +1,46 @@
|
||||||
<script>
|
<script>
|
||||||
import { Icon } from "@budibase/bbui"
|
import { Icon, Modal } from "@budibase/bbui"
|
||||||
import ChooseIconModal from "components/start/ChooseIconModal.svelte"
|
import ChooseIconModal from "components/start/ChooseIconModal.svelte"
|
||||||
|
|
||||||
export let name
|
export let name
|
||||||
export let size
|
export let size = "M"
|
||||||
export let app
|
export let app
|
||||||
|
export let color
|
||||||
|
export let autoSave = false
|
||||||
|
|
||||||
let iconModal
|
let modal
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="editable-icon">
|
<div class="editable-icon">
|
||||||
<div
|
<div class="hover" on:click={modal.show}>
|
||||||
class="edit-hover"
|
<Icon name="Edit" {size} color="var(--spectrum-global-color-gray-600)" />
|
||||||
on:click={() => {
|
|
||||||
iconModal.show()
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Icon name={"Edit"} size={"L"} />
|
|
||||||
</div>
|
</div>
|
||||||
<div class="app-icon">
|
<div class="normal">
|
||||||
<Icon {name} {size} />
|
<Icon {name} {size} {color} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<ChooseIconModal {app} bind:this={iconModal} />
|
|
||||||
|
<Modal bind:this={modal}>
|
||||||
|
<ChooseIconModal {name} {color} {app} {autoSave} on:change />
|
||||||
|
</Modal>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.editable-icon:hover .app-icon {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
.editable-icon {
|
.editable-icon {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-start;
|
||||||
}
|
}
|
||||||
.editable-icon:hover .edit-hover {
|
.normal {
|
||||||
opacity: 1;
|
display: block;
|
||||||
}
|
}
|
||||||
.edit-hover {
|
.hover {
|
||||||
color: var(--spectrum-global-color-gray-600);
|
display: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
z-index: 100;
|
}
|
||||||
width: 100%;
|
.editable-icon:hover .normal {
|
||||||
height: 100%;
|
display: none;
|
||||||
position: absolute;
|
}
|
||||||
opacity: 0;
|
.editable-icon:hover .hover {
|
||||||
/* transition: opacity var(--spectrum-global-animation-duration-100) ease; */
|
display: block;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
bottom: var(--spacing-m);
|
bottom: var(--spacing-m);
|
||||||
right: var(--spacing-m);
|
right: var(--spacing-m);
|
||||||
border-radius: 55%;
|
border-radius: 55%;
|
||||||
|
z-index: 99999;
|
||||||
}
|
}
|
||||||
.hidden {
|
.hidden {
|
||||||
display: none;
|
display: none;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
import { Select } from "@budibase/bbui"
|
import { Select } from "@budibase/bbui"
|
||||||
import { roles } from "stores/backend"
|
import { roles } from "stores/backend"
|
||||||
import { Constants, RoleUtils } from "@budibase/frontend-core"
|
import { Constants, RoleUtils } from "@budibase/frontend-core"
|
||||||
|
import { createEventDispatcher } from "svelte"
|
||||||
|
|
||||||
export let value
|
export let value
|
||||||
export let error
|
export let error
|
||||||
|
@ -9,26 +10,62 @@
|
||||||
export let autoWidth = false
|
export let autoWidth = false
|
||||||
export let quiet = false
|
export let quiet = false
|
||||||
export let allowPublic = true
|
export let allowPublic = true
|
||||||
|
export let allowRemove = false
|
||||||
|
|
||||||
$: options = getOptions($roles, allowPublic)
|
const dispatch = createEventDispatcher()
|
||||||
|
const RemoveID = "remove"
|
||||||
|
|
||||||
|
$: options = getOptions($roles, allowPublic, allowRemove)
|
||||||
|
|
||||||
const getOptions = (roles, allowPublic) => {
|
const getOptions = (roles, allowPublic) => {
|
||||||
|
if (allowRemove) {
|
||||||
|
roles = [
|
||||||
|
...roles,
|
||||||
|
{
|
||||||
|
_id: RemoveID,
|
||||||
|
name: "Remove",
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
if (allowPublic) {
|
if (allowPublic) {
|
||||||
return roles
|
return roles
|
||||||
}
|
}
|
||||||
return roles.filter(role => role._id !== Constants.Roles.PUBLIC)
|
return roles.filter(role => role._id !== Constants.Roles.PUBLIC)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getColor = role => {
|
||||||
|
if (allowRemove && role._id === RemoveID) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return RoleUtils.getRoleColour(role._id)
|
||||||
|
}
|
||||||
|
|
||||||
|
const getIcon = role => {
|
||||||
|
if (allowRemove && role._id === RemoveID) {
|
||||||
|
return "Close"
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
const onChange = e => {
|
||||||
|
if (allowRemove && e.detail === RemoveID) {
|
||||||
|
dispatch("remove")
|
||||||
|
} else {
|
||||||
|
dispatch("change", e.detail)
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Select
|
<Select
|
||||||
{autoWidth}
|
{autoWidth}
|
||||||
{quiet}
|
{quiet}
|
||||||
bind:value
|
bind:value
|
||||||
on:change
|
on:change={onChange}
|
||||||
{options}
|
{options}
|
||||||
getOptionLabel={role => role.name}
|
getOptionLabel={role => role.name}
|
||||||
getOptionValue={role => role._id}
|
getOptionValue={role => role._id}
|
||||||
getOptionColour={role => RoleUtils.getRoleColour(role._id)}
|
getOptionColour={getColor}
|
||||||
|
getOptionIcon={getIcon}
|
||||||
{placeholder}
|
{placeholder}
|
||||||
{error}
|
{error}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -1,128 +1,110 @@
|
||||||
<script>
|
<script>
|
||||||
import {
|
import { Layout, Detail, Button, Modal } from "@budibase/bbui"
|
||||||
Layout,
|
|
||||||
Detail,
|
|
||||||
Heading,
|
|
||||||
Button,
|
|
||||||
Modal,
|
|
||||||
ActionGroup,
|
|
||||||
ActionButton,
|
|
||||||
} from "@budibase/bbui"
|
|
||||||
import TemplateCard from "components/common/TemplateCard.svelte"
|
import TemplateCard from "components/common/TemplateCard.svelte"
|
||||||
import CreateAppModal from "components/start/CreateAppModal.svelte"
|
import CreateAppModal from "components/start/CreateAppModal.svelte"
|
||||||
import { licensing } from "stores/portal"
|
import { licensing } from "stores/portal"
|
||||||
|
import { Content, SideNav, SideNavItem } from "components/portal/page"
|
||||||
|
|
||||||
export let templates
|
export let templates
|
||||||
|
|
||||||
let selectedTemplateCategory
|
let selectedCategory
|
||||||
let creationModal
|
let creationModal
|
||||||
let template
|
let template
|
||||||
|
|
||||||
const groupTemplatesByCategory = (templates, categoryFilter) => {
|
$: categories = getCategories(templates)
|
||||||
let grouped = templates.reduce((acc, template) => {
|
$: filteredCategories = getFilteredCategories(categories, selectedCategory)
|
||||||
if (
|
|
||||||
typeof categoryFilter === "string" &&
|
const getCategories = templates => {
|
||||||
[categoryFilter].indexOf(template.category) < 0
|
let categories = {}
|
||||||
) {
|
templates?.forEach(template => {
|
||||||
return acc
|
if (!categories[template.category]) {
|
||||||
|
categories[template.category] = []
|
||||||
}
|
}
|
||||||
|
categories[template.category].push(template)
|
||||||
acc[template.category] = !acc[template.category]
|
})
|
||||||
? []
|
categories = Object.entries(categories).map(
|
||||||
: acc[template.category]
|
([category, categoryTemplates]) => {
|
||||||
acc[template.category].push(template)
|
return {
|
||||||
|
name: category,
|
||||||
return acc
|
templates: categoryTemplates,
|
||||||
}, {})
|
}
|
||||||
return grouped
|
}
|
||||||
|
)
|
||||||
|
categories.sort((a, b) => {
|
||||||
|
return a.name < b.name ? -1 : 1
|
||||||
|
})
|
||||||
|
return categories
|
||||||
}
|
}
|
||||||
|
|
||||||
$: filteredTemplates = groupTemplatesByCategory(
|
const getFilteredCategories = (categories, selectedCategory) => {
|
||||||
templates,
|
if (!selectedCategory) {
|
||||||
selectedTemplateCategory
|
return categories
|
||||||
)
|
}
|
||||||
|
return categories.filter(x => x.name === selectedCategory)
|
||||||
$: filteredTemplateCategories = filteredTemplates
|
}
|
||||||
? Object.keys(filteredTemplates).sort()
|
|
||||||
: []
|
|
||||||
|
|
||||||
$: templateCategories = templates
|
|
||||||
? Object.keys(groupTemplatesByCategory(templates)).sort()
|
|
||||||
: []
|
|
||||||
|
|
||||||
const stopAppCreation = () => {
|
const stopAppCreation = () => {
|
||||||
template = null
|
template = null
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="template-header">
|
<Content>
|
||||||
<Layout noPadding gap="S">
|
<div slot="side-nav">
|
||||||
<Heading size="S">Templates</Heading>
|
<SideNav>
|
||||||
<div class="template-category-filters spectrum-ActionGroup">
|
<SideNavItem
|
||||||
<ActionGroup>
|
on:click={() => (selectedCategory = null)}
|
||||||
<ActionButton
|
text="All"
|
||||||
selected={!selectedTemplateCategory}
|
active={selectedCategory == null}
|
||||||
on:click={() => {
|
/>
|
||||||
selectedTemplateCategory = null
|
{#each categories as category}
|
||||||
}}
|
<SideNavItem
|
||||||
>
|
on:click={() => (selectedCategory = category.name)}
|
||||||
All
|
text={category.name}
|
||||||
</ActionButton>
|
active={selectedCategory === category.name}
|
||||||
{#each templateCategories as templateCategoryKey}
|
/>
|
||||||
<ActionButton
|
{/each}
|
||||||
dataCy={templateCategoryKey}
|
</SideNav>
|
||||||
selected={templateCategoryKey == selectedTemplateCategory}
|
</div>
|
||||||
on:click={() => {
|
<div class="template-categories">
|
||||||
selectedTemplateCategory = templateCategoryKey
|
<Layout gap="XL" noPadding>
|
||||||
}}
|
{#each filteredCategories as category}
|
||||||
>
|
<div class="template-category" data-cy={category.name}>
|
||||||
{templateCategoryKey}
|
<Detail size="M">{category.name}</Detail>
|
||||||
</ActionButton>
|
<div class="template-grid">
|
||||||
{/each}
|
{#each category.templates as templateEntry}
|
||||||
</ActionGroup>
|
<TemplateCard
|
||||||
</div>
|
name={templateEntry.name}
|
||||||
</Layout>
|
imageSrc={templateEntry.image}
|
||||||
</div>
|
backgroundColour={templateEntry.background}
|
||||||
|
icon={templateEntry.icon}
|
||||||
<div class="template-categories">
|
|
||||||
<Layout gap="XL" noPadding>
|
|
||||||
{#each filteredTemplateCategories as templateCategoryKey}
|
|
||||||
<div class="template-category" data-cy={templateCategoryKey}>
|
|
||||||
<Detail size="M">{templateCategoryKey}</Detail>
|
|
||||||
<div class="template-grid">
|
|
||||||
{#each filteredTemplates[templateCategoryKey] as templateEntry}
|
|
||||||
<TemplateCard
|
|
||||||
name={templateEntry.name}
|
|
||||||
imageSrc={templateEntry.image}
|
|
||||||
backgroundColour={templateEntry.background}
|
|
||||||
icon={templateEntry.icon}
|
|
||||||
>
|
|
||||||
{#if !($licensing?.usageMetrics?.apps >= 100)}
|
|
||||||
<Button
|
|
||||||
cta
|
|
||||||
on:click={() => {
|
|
||||||
template = templateEntry
|
|
||||||
creationModal.show()
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Use template
|
|
||||||
</Button>
|
|
||||||
{/if}
|
|
||||||
<a
|
|
||||||
href={templateEntry.url}
|
|
||||||
target="_blank"
|
|
||||||
class="overlay-preview-link spectrum-Button spectrum-Button--sizeM spectrum-Button--secondary"
|
|
||||||
on:click|stopPropagation
|
|
||||||
>
|
>
|
||||||
Details
|
{#if !($licensing?.usageMetrics?.apps >= 100)}
|
||||||
</a>
|
<Button
|
||||||
</TemplateCard>
|
cta
|
||||||
{/each}
|
on:click={() => {
|
||||||
|
template = templateEntry
|
||||||
|
creationModal.show()
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Use template
|
||||||
|
</Button>
|
||||||
|
{/if}
|
||||||
|
<a
|
||||||
|
href={templateEntry.url}
|
||||||
|
target="_blank"
|
||||||
|
class="overlay-preview-link spectrum-Button spectrum-Button--sizeM spectrum-Button--secondary"
|
||||||
|
on:click|stopPropagation
|
||||||
|
>
|
||||||
|
Details
|
||||||
|
</a>
|
||||||
|
</TemplateCard>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{/each}
|
||||||
{/each}
|
</Layout>
|
||||||
</Layout>
|
</div>
|
||||||
</div>
|
</Content>
|
||||||
|
|
||||||
<Modal
|
<Modal
|
||||||
bind:this={creationModal}
|
bind:this={creationModal}
|
||||||
|
|
|
@ -469,7 +469,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.binding__type {
|
.binding__type {
|
||||||
font-family: monospace;
|
font-family: var(--font-mono);
|
||||||
background-color: var(--spectrum-global-color-gray-200);
|
background-color: var(--spectrum-global-color-gray-200);
|
||||||
border-radius: var(--border-radius-s);
|
border-radius: var(--border-radius-s);
|
||||||
padding: 2px 4px;
|
padding: 2px 4px;
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
dummy.select()
|
dummy.select()
|
||||||
document.execCommand("copy")
|
document.execCommand("copy")
|
||||||
document.body.removeChild(dummy)
|
document.body.removeChild(dummy)
|
||||||
notifications.success(`URL copied to clipboard`)
|
notifications.success(`Copied to clipboard`)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -57,15 +57,13 @@
|
||||||
<Button cta on:click={publishModal.show}>Publish</Button>
|
<Button cta on:click={publishModal.show}>Publish</Button>
|
||||||
<Modal bind:this={publishModal}>
|
<Modal bind:this={publishModal}>
|
||||||
<ModalContent
|
<ModalContent
|
||||||
title="Publish to Production"
|
title="Publish to production"
|
||||||
confirmText="Publish"
|
confirmText="Publish"
|
||||||
onConfirm={publishApp}
|
onConfirm={publishApp}
|
||||||
dataCy={"deploy-app-modal"}
|
dataCy={"deploy-app-modal"}
|
||||||
>
|
>
|
||||||
<span
|
The changes you have made will be published to the production version of the
|
||||||
>The changes you have made will be published to the production version of
|
application.
|
||||||
the application.</span
|
|
||||||
>
|
|
||||||
</ModalContent>
|
</ModalContent>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
|
|
|
@ -179,7 +179,7 @@
|
||||||
</ConfirmDialog>
|
</ConfirmDialog>
|
||||||
|
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<Button on:click={previewApp} newStyles secondary>Preview</Button>
|
<Button on:click={previewApp} secondary>Preview</Button>
|
||||||
<DeployModal onOk={completePublish} />
|
<DeployModal onOk={completePublish} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -185,7 +185,7 @@
|
||||||
div :global(.CodeMirror) {
|
div :global(.CodeMirror) {
|
||||||
height: var(--code-mirror-height) !important;
|
height: var(--code-mirror-height) !important;
|
||||||
border-radius: var(--border-radius-s);
|
border-radius: var(--border-radius-s);
|
||||||
font-family: monospace !important;
|
font-family: var(--font-mono);
|
||||||
line-height: 1.3;
|
line-height: 1.3;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,106 +0,0 @@
|
||||||
<script>
|
|
||||||
import { Layout, Icon, ActionButton, InlineAlert } from "@budibase/bbui"
|
|
||||||
import StatusRenderer from "./StatusRenderer.svelte"
|
|
||||||
import DateTimeRenderer from "components/common/renderers/DateTimeRenderer.svelte"
|
|
||||||
import TestDisplay from "components/automation/AutomationBuilder/TestDisplay.svelte"
|
|
||||||
import { goto } from "@roxi/routify"
|
|
||||||
import { automationStore } from "builderStore"
|
|
||||||
|
|
||||||
export let history
|
|
||||||
export let appId
|
|
||||||
export let close
|
|
||||||
const STOPPED_ERROR = "stopped_error"
|
|
||||||
|
|
||||||
$: exists = $automationStore.automations?.find(
|
|
||||||
auto => auto._id === history?.automationId
|
|
||||||
)
|
|
||||||
</script>
|
|
||||||
|
|
||||||
{#if history}
|
|
||||||
<div class="body">
|
|
||||||
<div class="top">
|
|
||||||
<div class="controls">
|
|
||||||
<StatusRenderer value={history.status} />
|
|
||||||
<ActionButton noPadding size="S" icon="Close" quiet on:click={close} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<Layout paddingY="XL" paddingX="XL" gap="S">
|
|
||||||
<div class="icon">
|
|
||||||
<Icon name="Clock" />
|
|
||||||
<DateTimeRenderer value={history.createdAt} />
|
|
||||||
</div>
|
|
||||||
<div class="icon">
|
|
||||||
<Icon name="JourneyVoyager" />
|
|
||||||
<div>{history.automationName}</div>
|
|
||||||
</div>
|
|
||||||
{#if history.status === STOPPED_ERROR}
|
|
||||||
<div class="cron-error">
|
|
||||||
<InlineAlert
|
|
||||||
type="error"
|
|
||||||
header="CRON automation disabled"
|
|
||||||
message="Fix the error and re-publish your app to re-activate."
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
<div>
|
|
||||||
{#if exists}
|
|
||||||
<ActionButton
|
|
||||||
icon="Edit"
|
|
||||||
fullWidth={false}
|
|
||||||
on:click={() =>
|
|
||||||
$goto(`../../../app/${appId}/automate/${history.automationId}`)}
|
|
||||||
>Edit automation</ActionButton
|
|
||||||
>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
</Layout>
|
|
||||||
<div class="bottom">
|
|
||||||
{#key history}
|
|
||||||
<TestDisplay testResults={history} width="100%" />
|
|
||||||
{/key}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{:else}
|
|
||||||
<div>No details found</div>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.body {
|
|
||||||
right: 0;
|
|
||||||
background-color: var(--background);
|
|
||||||
border-left: var(--border-light);
|
|
||||||
width: 420px;
|
|
||||||
height: calc(100vh - 240px);
|
|
||||||
position: fixed;
|
|
||||||
overflow: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.top {
|
|
||||||
padding: var(--spacing-m) 0 var(--spacing-m) 0;
|
|
||||||
border-bottom: var(--border-light);
|
|
||||||
}
|
|
||||||
|
|
||||||
.bottom {
|
|
||||||
border-top: var(--border-light);
|
|
||||||
padding-top: calc(var(--spacing-xl) * 2);
|
|
||||||
padding-bottom: calc(var(--spacing-xl) * 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon {
|
|
||||||
display: flex;
|
|
||||||
gap: var(--spacing-m);
|
|
||||||
}
|
|
||||||
|
|
||||||
.controls {
|
|
||||||
padding: 0 var(--spacing-l) 0 var(--spacing-l);
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 1fr auto;
|
|
||||||
gap: var(--spacing-s);
|
|
||||||
}
|
|
||||||
|
|
||||||
.cron-error {
|
|
||||||
display: flex;
|
|
||||||
width: 100%;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
</style>
|
|
|
@ -1,39 +0,0 @@
|
||||||
<script>
|
|
||||||
import { Icon } from "@budibase/bbui"
|
|
||||||
export let value
|
|
||||||
|
|
||||||
$: isError = !value || value.toLowerCase() === "error"
|
|
||||||
$: isStoppedError = value?.toLowerCase() === "stopped_error"
|
|
||||||
$: isStopped = value?.toLowerCase() === "stopped" || isStoppedError
|
|
||||||
$: status = getStatus(isError, isStopped)
|
|
||||||
|
|
||||||
function getStatus(error, stopped) {
|
|
||||||
if (error) {
|
|
||||||
return { color: "var(--red)", message: "Error", icon: "Alert" }
|
|
||||||
} else if (stopped) {
|
|
||||||
return { color: "var(--yellow)", message: "Stopped", icon: "StopCircle" }
|
|
||||||
} else {
|
|
||||||
return {
|
|
||||||
color: "var(--green)",
|
|
||||||
message: "Success",
|
|
||||||
icon: "CheckmarkCircle",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<div class="cell">
|
|
||||||
<Icon color={status.color} name={status.icon} />
|
|
||||||
<div style={`color: ${status.color};`}>
|
|
||||||
{status.message}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.cell {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
gap: var(--spacing-m);
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
</style>
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
<script>
|
||||||
|
import { Icon } from "@budibase/bbui"
|
||||||
|
|
||||||
|
export let url
|
||||||
|
export let text
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<a href={url}>
|
||||||
|
{text}
|
||||||
|
</a>
|
||||||
|
<Icon name="ChevronRight" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
div {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: flex-start;
|
||||||
|
align-items: center;
|
||||||
|
color: var(--spectrum-global-color-gray-700);
|
||||||
|
gap: var(--spacing-m);
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
div :global(.spectrum-Icon),
|
||||||
|
a {
|
||||||
|
color: inherit;
|
||||||
|
transition: color 130ms ease-out;
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
a:hover {
|
||||||
|
color: var(--spectrum-global-color-gray-900);
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,22 @@
|
||||||
|
<div>
|
||||||
|
<slot />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
div {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: flex-start;
|
||||||
|
align-items: center;
|
||||||
|
gap: var(--spacing-m);
|
||||||
|
}
|
||||||
|
|
||||||
|
div :global(> *:last-child .spectrum-Icon) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
div :global(> *:last-child) {
|
||||||
|
color: var(--spectrum-global-color-gray-900);
|
||||||
|
flex: 1 1 auto;
|
||||||
|
width: 0;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,46 @@
|
||||||
|
<script>
|
||||||
|
export let narrow = false
|
||||||
|
export let showMobileNav = false
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="content">
|
||||||
|
<div class="side-nav" class:show-mobile={showMobileNav}>
|
||||||
|
<slot name="side-nav" />
|
||||||
|
</div>
|
||||||
|
<div class="main" class:narrow>
|
||||||
|
<slot />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: flex-start;
|
||||||
|
align-items: stretch;
|
||||||
|
gap: 40px;
|
||||||
|
}
|
||||||
|
.side-nav {
|
||||||
|
flex: 0 0 200px;
|
||||||
|
}
|
||||||
|
.main {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
}
|
||||||
|
.main.narrow {
|
||||||
|
max-width: 600px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 640px) {
|
||||||
|
.content {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
.side-nav:not(.show-mobile) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.side-nav.show-mobile :global(.side-nav) {
|
||||||
|
border-bottom: var(--border-light);
|
||||||
|
margin: 0 -24px;
|
||||||
|
padding: 0 24px 32px 24px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,52 @@
|
||||||
|
<script>
|
||||||
|
import { Heading } from "@budibase/bbui"
|
||||||
|
|
||||||
|
export let title
|
||||||
|
export let wrap = true
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="header" class:wrap>
|
||||||
|
<slot name="icon" />
|
||||||
|
<Heading size="L">{title}</Heading>
|
||||||
|
<div class="buttons">
|
||||||
|
<slot name="buttons" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.header {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: flex-start;
|
||||||
|
align-items: center;
|
||||||
|
gap: var(--spacing-xl);
|
||||||
|
}
|
||||||
|
.header.wrap {
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
.header :global(.spectrum-Heading) {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
margin-top: -2px;
|
||||||
|
}
|
||||||
|
.header:not(.wrap) :global(.spectrum-Heading) {
|
||||||
|
overflow: hidden;
|
||||||
|
width: 0;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
.buttons {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: flex-start;
|
||||||
|
align-items: center;
|
||||||
|
gap: var(--spacing-xl);
|
||||||
|
}
|
||||||
|
.buttons :global(> div) {
|
||||||
|
display: contents;
|
||||||
|
}
|
||||||
|
@media (max-width: 640px) {
|
||||||
|
.wrap .buttons {
|
||||||
|
margin-bottom: var(--spacing-m);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,26 @@
|
||||||
|
<script>
|
||||||
|
export let title
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="side-nav">
|
||||||
|
{#if title}
|
||||||
|
<div class="title">{title}</div>
|
||||||
|
{/if}
|
||||||
|
<slot />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.side-nav {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: flex-start;
|
||||||
|
align-items: stretch;
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
.title {
|
||||||
|
margin-left: var(--spacing-m);
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--spectrum-global-color-gray-700);
|
||||||
|
margin-bottom: var(--spacing-m);
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,23 @@
|
||||||
|
<script>
|
||||||
|
export let text
|
||||||
|
export let url
|
||||||
|
export let active = false
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<a on:click href={url} class:active>
|
||||||
|
{text}
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
a {
|
||||||
|
padding: var(--spacing-s) var(--spacing-m);
|
||||||
|
color: var(--spectrum-global-color-gray-900);
|
||||||
|
border-radius: 4px;
|
||||||
|
transition: background 130ms ease-out;
|
||||||
|
}
|
||||||
|
.active,
|
||||||
|
a:hover {
|
||||||
|
background-color: var(--spectrum-global-color-gray-200);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,6 @@
|
||||||
|
export { default as Breadcrumb } from "./Breadcrumb.svelte"
|
||||||
|
export { default as Breadcrumbs } from "./Breadcrumbs.svelte"
|
||||||
|
export { default as Header } from "./Header.svelte"
|
||||||
|
export { default as Content } from "./Content.svelte"
|
||||||
|
export { default as SideNavItem } from "./SideNavItem.svelte"
|
||||||
|
export { default as SideNav } from "./SideNav.svelte"
|
|
@ -1,5 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import { ModalContent, Body, notifications } from "@budibase/bbui"
|
import { ModalContent } from "@budibase/bbui"
|
||||||
|
import { Body, notifications } from "@budibase/bbui"
|
||||||
import { auth } from "stores/portal"
|
import { auth } from "stores/portal"
|
||||||
import { onMount } from "svelte"
|
import { onMount } from "svelte"
|
||||||
import CopyInput from "components/common/inputs/CopyInput.svelte"
|
import CopyInput from "components/common/inputs/CopyInput.svelte"
|
||||||
|
@ -27,15 +28,13 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ModalContent
|
<ModalContent
|
||||||
title="Developer information"
|
title="API Key"
|
||||||
showConfirmButton={false}
|
showSecondaryButton
|
||||||
showSecondaryButton={true}
|
secondaryButtonText="Regenerate key"
|
||||||
secondaryButtonText="Re-generate key"
|
|
||||||
secondaryAction={generateAPIKey}
|
secondaryAction={generateAPIKey}
|
||||||
|
showCancelButton={false}
|
||||||
|
confirmText="Close"
|
||||||
>
|
>
|
||||||
<Body size="S">
|
<Body size="S">Your API key for accessing the Budibase public API:</Body>
|
||||||
You can find information about your developer account here, such as the API
|
<CopyInput bind:value={apiKey} />
|
||||||
key used to access the Budibase API.
|
|
||||||
</Body>
|
|
||||||
<CopyInput bind:value={apiKey} label="API key" />
|
|
||||||
</ModalContent>
|
</ModalContent>
|
|
@ -18,11 +18,7 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ModalContent
|
<ModalContent title="My profile" confirmText="Save" onConfirm={updateInfo}>
|
||||||
title="Update user information"
|
|
||||||
confirmText="Update information"
|
|
||||||
onConfirm={updateInfo}
|
|
||||||
>
|
|
||||||
<Body size="S">
|
<Body size="S">
|
||||||
Personalise the platform by adding your first name and last name.
|
Personalise the platform by adding your first name and last name.
|
||||||
</Body>
|
</Body>
|
|
@ -0,0 +1,16 @@
|
||||||
|
<script>
|
||||||
|
import { ModalContent } from "@budibase/bbui"
|
||||||
|
import { Select } from "@budibase/bbui"
|
||||||
|
import { themeStore } from "builderStore"
|
||||||
|
import { Constants } from "@budibase/frontend-core"
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<ModalContent title="Theme">
|
||||||
|
<Select
|
||||||
|
options={Constants.Themes}
|
||||||
|
bind:value={$themeStore.theme}
|
||||||
|
placeholder={null}
|
||||||
|
getOptionLabel={x => x.name}
|
||||||
|
getOptionValue={x => x.class}
|
||||||
|
/>
|
||||||
|
</ModalContent>
|
|
@ -1,85 +1,126 @@
|
||||||
<script>
|
<script>
|
||||||
import { Heading, Button, Icon } from "@budibase/bbui"
|
import { Heading, Body, Button, Icon, notifications } from "@budibase/bbui"
|
||||||
import AppLockModal from "../common/AppLockModal.svelte"
|
import AppLockModal from "../common/AppLockModal.svelte"
|
||||||
import { processStringSync } from "@budibase/string-templates"
|
import { processStringSync } from "@budibase/string-templates"
|
||||||
|
import { goto } from "@roxi/routify"
|
||||||
|
|
||||||
export let app
|
export let app
|
||||||
export let editApp
|
|
||||||
export let appOverview
|
const handleDefaultClick = () => {
|
||||||
|
if (window.innerWidth < 640) {
|
||||||
|
goToOverview()
|
||||||
|
} else {
|
||||||
|
goToBuilder()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const goToBuilder = () => {
|
||||||
|
if (app.lockedOther) {
|
||||||
|
notifications.error(
|
||||||
|
`App locked by ${app.lockedBy.email}. Please allow lock to expire or have them unlock this app.`
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
$goto(`../../app/${app.devId}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
const goToOverview = () => {
|
||||||
|
$goto(`../overview/${app.devId}`)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="title" data-cy={`${app.devId}`}>
|
<div class="app-row" on:click={handleDefaultClick}>
|
||||||
<div>
|
<div class="title" data-cy={`${app.devId}`}>
|
||||||
<div class="app-icon" style="color: {app.icon?.color || ''}">
|
<div class="app-icon">
|
||||||
<Icon size="XL" name={app.icon?.name || "Apps"} />
|
<Icon size="L" name={app.icon?.name || "Apps"} color={app.icon?.color} />
|
||||||
</div>
|
</div>
|
||||||
<div class="name" data-cy="app-name-link" on:click={() => editApp(app)}>
|
<div class="name" data-cy="app-name-link">
|
||||||
<Heading size="XS">
|
<Heading size="S">
|
||||||
{app.name}
|
{app.name}
|
||||||
</Heading>
|
</Heading>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="desktop">
|
<div class="updated">
|
||||||
{#if app.updatedAt}
|
{#if app.updatedAt}
|
||||||
{processStringSync("Updated {{ duration time 'millisecond' }} ago", {
|
{processStringSync("Updated {{ duration time 'millisecond' }} ago", {
|
||||||
time: new Date().getTime() - new Date(app.updatedAt).getTime(),
|
time: new Date().getTime() - new Date(app.updatedAt).getTime(),
|
||||||
})}
|
})}
|
||||||
{:else}
|
|
||||||
Never updated
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
<div class="desktop">
|
|
||||||
<span><AppLockModal {app} buttonSize="M" /></span>
|
|
||||||
</div>
|
|
||||||
<div class="desktop">
|
|
||||||
<div class="app-status">
|
|
||||||
{#if app.deployed}
|
|
||||||
<Icon name="Globe" disabled={false} />
|
|
||||||
Published
|
|
||||||
{:else}
|
{:else}
|
||||||
<Icon name="GlobeStrike" disabled={true} />
|
Never updated
|
||||||
<span class="disabled"> Unpublished </span>
|
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div data-cy={`row_actions_${app.appId}`}>
|
<div class="title app-status" class:deployed={app.deployed}>
|
||||||
<div class="app-row-actions">
|
<Icon size="L" name={app.deployed ? "GlobeCheck" : "GlobeStrike"} />
|
||||||
<Button size="S" secondary newStyles on:click={() => appOverview(app)}>
|
<Body size="S">{app.deployed ? "Published" : "Unpublished"}</Body>
|
||||||
Manage
|
</div>
|
||||||
</Button>
|
|
||||||
<Button
|
<div class="app-row-actions" data-cy={`row_actions_${app.appId}`}>
|
||||||
size="S"
|
<AppLockModal {app} buttonSize="M" />
|
||||||
primary
|
<Button size="S" secondary on:click={goToOverview}>Manage</Button>
|
||||||
newStyles
|
<Button size="S" primary disabled={app.lockedOther} on:click={goToBuilder}>
|
||||||
disabled={app.lockedOther}
|
|
||||||
on:click={() => editApp(app)}
|
|
||||||
>
|
|
||||||
Edit
|
Edit
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
div.title,
|
.app-row {
|
||||||
div.title > div {
|
background: var(--background);
|
||||||
display: flex;
|
padding: 24px 32px;
|
||||||
max-width: 100%;
|
border-radius: 8px;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 35% 25% 15% auto;
|
||||||
|
align-items: center;
|
||||||
|
gap: var(--spacing-m);
|
||||||
|
transition: border 130ms ease-out;
|
||||||
|
border: 1px solid transparent;
|
||||||
}
|
}
|
||||||
|
.app-row:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
border-color: var(--spectrum-global-color-gray-300);
|
||||||
|
}
|
||||||
|
|
||||||
|
.updated {
|
||||||
|
color: var(--spectrum-global-color-gray-700);
|
||||||
|
}
|
||||||
|
|
||||||
|
.title,
|
||||||
|
.name {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
}
|
||||||
|
.name {
|
||||||
|
width: 0;
|
||||||
|
}
|
||||||
|
.title,
|
||||||
|
.app-status {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: flex-start;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title :global(.spectrum-Heading),
|
||||||
|
.title :global(.spectrum-Icon),
|
||||||
|
.title :global(.spectrum-Body) {
|
||||||
|
color: var(--spectrum-global-color-gray-900);
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-status:not(.deployed) :global(.spectrum-Icon),
|
||||||
|
.app-status:not(.deployed) :global(.spectrum-Body) {
|
||||||
|
color: var(--spectrum-global-color-gray-600);
|
||||||
|
}
|
||||||
|
|
||||||
.app-row-actions {
|
.app-row-actions {
|
||||||
grid-gap: var(--spacing-s);
|
gap: var(--spacing-m);
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
.app-status {
|
|
||||||
display: grid;
|
|
||||||
grid-gap: var(--spacing-s);
|
|
||||||
grid-template-columns: 24px 100px;
|
|
||||||
}
|
|
||||||
.app-status span.disabled {
|
|
||||||
opacity: 0.3;
|
|
||||||
}
|
|
||||||
.name {
|
.name {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
@ -88,17 +129,30 @@
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
margin-left: calc(1.5 * var(--spacing-xl));
|
|
||||||
}
|
|
||||||
.title :global(h1:hover) {
|
|
||||||
color: var(--spectrum-global-color-blue-600);
|
|
||||||
cursor: pointer;
|
|
||||||
transition: color 130ms ease;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: 1000px) {
|
||||||
|
.app-row {
|
||||||
|
grid-template-columns: 45% 30% auto;
|
||||||
|
}
|
||||||
|
.updated {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (max-width: 800px) {
|
||||||
|
.app-row {
|
||||||
|
grid-template-columns: 1fr auto;
|
||||||
|
}
|
||||||
|
.app-status {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
@media (max-width: 640px) {
|
@media (max-width: 640px) {
|
||||||
.desktop {
|
.app-row {
|
||||||
display: none !important;
|
padding: 20px;
|
||||||
|
}
|
||||||
|
.app-row-actions {
|
||||||
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,18 +1,20 @@
|
||||||
<script>
|
<script>
|
||||||
import {
|
import {
|
||||||
ModalContent,
|
ModalContent,
|
||||||
Modal,
|
|
||||||
Icon,
|
Icon,
|
||||||
ColorPicker,
|
ColorPicker,
|
||||||
Label,
|
Label,
|
||||||
notifications,
|
notifications,
|
||||||
} from "@budibase/bbui"
|
} from "@budibase/bbui"
|
||||||
import { apps } from "stores/portal"
|
import { apps } from "stores/portal"
|
||||||
|
import { createEventDispatcher } from "svelte"
|
||||||
|
|
||||||
export let app
|
export let app
|
||||||
let modal
|
export let name
|
||||||
$: selectedIcon = app?.icon?.name || "Apps"
|
export let color
|
||||||
$: selectedColor = app?.icon?.color
|
export let autoSave = false
|
||||||
|
|
||||||
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
let iconsList = [
|
let iconsList = [
|
||||||
"Apps",
|
"Apps",
|
||||||
|
@ -40,30 +42,15 @@
|
||||||
"GraphBarHorizontal",
|
"GraphBarHorizontal",
|
||||||
"Demographic",
|
"Demographic",
|
||||||
]
|
]
|
||||||
export const show = () => {
|
|
||||||
modal.show()
|
|
||||||
}
|
|
||||||
export const hide = () => {
|
|
||||||
modal.hide()
|
|
||||||
}
|
|
||||||
|
|
||||||
const onCancel = () => {
|
|
||||||
selectedIcon = ""
|
|
||||||
selectedColor = ""
|
|
||||||
hide()
|
|
||||||
}
|
|
||||||
|
|
||||||
const changeColor = val => {
|
|
||||||
selectedColor = val
|
|
||||||
}
|
|
||||||
|
|
||||||
const save = async () => {
|
const save = async () => {
|
||||||
|
if (!autoSave) {
|
||||||
|
dispatch("change", { color, name })
|
||||||
|
return
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
await apps.update(app.instance._id, {
|
await apps.update(app.instance._id, {
|
||||||
icon: {
|
icon: { name, color },
|
||||||
name: selectedIcon,
|
|
||||||
color: selectedColor,
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
notifications.error("Error updating app")
|
notifications.error("Error updating app")
|
||||||
|
@ -71,41 +58,32 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Modal bind:this={modal} on:hide={onCancel}>
|
<ModalContent title="Edit Icon" confirmText="Save" onConfirm={save}>
|
||||||
<ModalContent
|
<div class="scrollable-icons">
|
||||||
title={"Edit Icon"}
|
<div class="title-spacing">
|
||||||
confirmText={"Save"}
|
<Label>Select an icon</Label>
|
||||||
onConfirm={() => save()}
|
|
||||||
>
|
|
||||||
<div class="scrollable-icons">
|
|
||||||
<div class="title-spacing">
|
|
||||||
<Label>Select an icon</Label>
|
|
||||||
</div>
|
|
||||||
<div class="grid">
|
|
||||||
{#each iconsList as item}
|
|
||||||
<div
|
|
||||||
class="icon-item"
|
|
||||||
class:selected={item === selectedIcon}
|
|
||||||
on:click={() => (selectedIcon = item)}
|
|
||||||
>
|
|
||||||
<Icon name={item} />
|
|
||||||
</div>
|
|
||||||
{/each}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="color-selection">
|
<div class="grid">
|
||||||
<div>
|
{#each iconsList as item}
|
||||||
<Label>Select a color</Label>
|
<div
|
||||||
</div>
|
class="icon-item"
|
||||||
<div class="color-selection-item">
|
class:selected={item === name}
|
||||||
<ColorPicker
|
on:click={() => (name = item)}
|
||||||
bind:value={selectedColor}
|
>
|
||||||
on:change={e => changeColor(e.detail)}
|
<Icon name={item} />
|
||||||
/>
|
</div>
|
||||||
</div>
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
</ModalContent>
|
</div>
|
||||||
</Modal>
|
<div class="color-selection">
|
||||||
|
<div>
|
||||||
|
<Label>Select a color</Label>
|
||||||
|
</div>
|
||||||
|
<div class="color-selection-item">
|
||||||
|
<ColorPicker bind:value={color} on:change={e => (color = e.detail)} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ModalContent>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.scrollable-icons {
|
.scrollable-icons {
|
||||||
|
|
|
@ -138,6 +138,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$goto(`/builder/app/${createdApp.instance._id}`)
|
$goto(`/builder/app/${createdApp.instance._id}`)
|
||||||
|
// apps.load()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
creating = false
|
creating = false
|
||||||
console.error(error)
|
console.error(error)
|
||||||
|
|
|
@ -1,22 +1,29 @@
|
||||||
<script>
|
<script>
|
||||||
import { writable, get as svelteGet } from "svelte/store"
|
import { writable, get as svelteGet } from "svelte/store"
|
||||||
import { notifications, Input, ModalContent, Body } from "@budibase/bbui"
|
import {
|
||||||
|
notifications,
|
||||||
|
Input,
|
||||||
|
ModalContent,
|
||||||
|
Layout,
|
||||||
|
Label,
|
||||||
|
} from "@budibase/bbui"
|
||||||
import { apps } from "stores/portal"
|
import { apps } from "stores/portal"
|
||||||
import { onMount } from "svelte"
|
import { onMount } from "svelte"
|
||||||
import { createValidationStore } from "helpers/validation/yup"
|
import { createValidationStore } from "helpers/validation/yup"
|
||||||
import * as appValidation from "helpers/validation/yup/app"
|
import * as appValidation from "helpers/validation/yup/app"
|
||||||
|
import EditableIcon from "../common/EditableIcon.svelte"
|
||||||
|
|
||||||
export let app
|
export let app
|
||||||
|
|
||||||
const values = writable({ name: "", url: null })
|
const values = writable({
|
||||||
const validation = createValidationStore()
|
name: app.name,
|
||||||
$: validation.check($values)
|
url: app.url,
|
||||||
|
iconName: app.icon?.name,
|
||||||
onMount(async () => {
|
iconColor: app.icon?.color,
|
||||||
$values.name = app.name
|
|
||||||
$values.url = app.url
|
|
||||||
setupValidation()
|
|
||||||
})
|
})
|
||||||
|
const validation = createValidationStore()
|
||||||
|
|
||||||
|
$: validation.check($values)
|
||||||
|
|
||||||
const setupValidation = async () => {
|
const setupValidation = async () => {
|
||||||
const applications = svelteGet(apps)
|
const applications = svelteGet(apps)
|
||||||
|
@ -28,14 +35,14 @@
|
||||||
|
|
||||||
async function updateApp() {
|
async function updateApp() {
|
||||||
try {
|
try {
|
||||||
// Update App
|
await apps.update(app.instance._id, {
|
||||||
const body = {
|
name: $values.name?.trim(),
|
||||||
name: $values.name.trim(),
|
url: $values.url?.trim(),
|
||||||
}
|
icon: {
|
||||||
if ($values.url) {
|
name: $values.iconName,
|
||||||
body.url = $values.url.trim()
|
color: $values.iconColor,
|
||||||
}
|
},
|
||||||
await apps.update(app.instance._id, body)
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
notifications.error("Error updating app")
|
notifications.error("Error updating app")
|
||||||
|
@ -68,15 +75,22 @@
|
||||||
let resolvedUrl = resolveAppUrl(null, appName)
|
let resolvedUrl = resolveAppUrl(null, appName)
|
||||||
tidyUrl(resolvedUrl)
|
tidyUrl(resolvedUrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const updateIcon = e => {
|
||||||
|
const { name, color } = e.detail
|
||||||
|
$values.iconColor = color
|
||||||
|
$values.iconName = name
|
||||||
|
}
|
||||||
|
|
||||||
|
onMount(setupValidation)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ModalContent
|
<ModalContent
|
||||||
title={"Edit app"}
|
title="Edit name and URL"
|
||||||
confirmText={"Save"}
|
confirmText="Save"
|
||||||
onConfirm={updateApp}
|
onConfirm={updateApp}
|
||||||
disabled={!$validation.valid}
|
disabled={!$validation.valid}
|
||||||
>
|
>
|
||||||
<Body size="S">Update the name of your app.</Body>
|
|
||||||
<Input
|
<Input
|
||||||
bind:value={$values.name}
|
bind:value={$values.name}
|
||||||
error={$validation.touched.name && $validation.errors.name}
|
error={$validation.touched.name && $validation.errors.name}
|
||||||
|
@ -84,6 +98,16 @@
|
||||||
on:change={nameToUrl($values.name)}
|
on:change={nameToUrl($values.name)}
|
||||||
label="Name"
|
label="Name"
|
||||||
/>
|
/>
|
||||||
|
<Layout noPadding gap="XS">
|
||||||
|
<Label>Icon</Label>
|
||||||
|
<EditableIcon
|
||||||
|
{app}
|
||||||
|
size="XL"
|
||||||
|
name={$values.iconName}
|
||||||
|
color={$values.iconColor}
|
||||||
|
on:change={updateIcon}
|
||||||
|
/>
|
||||||
|
</Layout>
|
||||||
<Input
|
<Input
|
||||||
bind:value={$values.url}
|
bind:value={$values.url}
|
||||||
error={$validation.touched.url && $validation.errors.url}
|
error={$validation.touched.url && $validation.errors.url}
|
||||||
|
|
|
@ -39,15 +39,21 @@
|
||||||
{#if showWarning}
|
{#if showWarning}
|
||||||
<Icon name="Alert" />
|
<Icon name="Alert" />
|
||||||
{/if}
|
{/if}
|
||||||
<div class="heading header-item">
|
<Heading size="XS" weight="light">
|
||||||
<Heading size="XS" weight="light">{usage.name}</Heading>
|
<span class="nowrap">
|
||||||
</div>
|
{usage.name}
|
||||||
|
</span>
|
||||||
|
</Heading>
|
||||||
</div>
|
</div>
|
||||||
{#if unlimited}
|
<Body size="S">
|
||||||
<Body size="S">{usage.used} / Unlimited</Body>
|
<span class="nowrap">
|
||||||
{:else}
|
{#if unlimited}
|
||||||
<Body size="S">{usage.used} / {usage.total}</Body>
|
{usage.used} / Unlimited
|
||||||
{/if}
|
{:else}
|
||||||
|
{usage.used} / {usage.total}
|
||||||
|
{/if}
|
||||||
|
</span>
|
||||||
|
</Body>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{#if unlimited}
|
{#if unlimited}
|
||||||
|
@ -89,13 +95,14 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
align-items: flex-end;
|
||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
|
gap: var(--spacing-m);
|
||||||
}
|
}
|
||||||
.header-container {
|
.header-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
.heading {
|
.nowrap {
|
||||||
margin-top: 3px;
|
white-space: nowrap;
|
||||||
margin-left: 5px;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
<div class="header-actions">
|
<div class="header-actions">
|
||||||
{#if secondaryDefined}
|
{#if secondaryDefined}
|
||||||
<div>
|
<div>
|
||||||
<Button newStyles secondary on:click={secondaryAction}
|
<Button secondary on:click={secondaryAction}
|
||||||
>{secondaryActionText}</Button
|
>{secondaryActionText}</Button
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -23,7 +23,6 @@ body {
|
||||||
--grey-8: var(--spectrum-global-color-gray-800);
|
--grey-8: var(--spectrum-global-color-gray-800);
|
||||||
--grey-9: var(--spectrum-global-color-gray-900);
|
--grey-9: var(--spectrum-global-color-gray-900);
|
||||||
|
|
||||||
font-family: var(--font-sans);
|
|
||||||
color: var(--ink);
|
color: var(--ink);
|
||||||
background-color: var(--background-alt);
|
background-color: var(--background-alt);
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,32 +105,34 @@
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
on:click={() =>
|
on:click={() =>
|
||||||
$goto(`../../portal/overview/${application}?tab=Access`)}
|
$goto(`../../portal/overview/${application}/access`)}
|
||||||
>
|
>
|
||||||
Access
|
Access
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
on:click={() =>
|
on:click={() =>
|
||||||
$goto(
|
$goto(`../../portal/overview/${application}/automation-history`)}
|
||||||
`../../portal/overview/${application}?tab=${encodeURIComponent(
|
|
||||||
"Automation History"
|
|
||||||
)}`
|
|
||||||
)}
|
|
||||||
>
|
>
|
||||||
Automation history
|
Automation history
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
on:click={() =>
|
on:click={() =>
|
||||||
$goto(`../../portal/overview/${application}?tab=Backups`)}
|
$goto(`../../portal/overview/${application}/backups`)}
|
||||||
>
|
>
|
||||||
Backups
|
Backups
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
|
||||||
<MenuItem
|
<MenuItem
|
||||||
on:click={() =>
|
on:click={() =>
|
||||||
$goto(`../../portal/overview/${application}?tab=Settings`)}
|
$goto(`../../portal/overview/${application}/name-and-url`)}
|
||||||
>
|
>
|
||||||
Settings
|
Name and URL
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem
|
||||||
|
on:click={() =>
|
||||||
|
$goto(`../../portal/overview/${application}/version`)}
|
||||||
|
>
|
||||||
|
Version
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</ActionMenu>
|
</ActionMenu>
|
||||||
<Heading size="XS">{$store.name || "App"}</Heading>
|
<Heading size="XS">{$store.name || "App"}</Heading>
|
||||||
|
|
|
@ -263,6 +263,7 @@
|
||||||
orderMap[component.component]}
|
orderMap[component.component]}
|
||||||
on:click={() => addComponent(component.component)}
|
on:click={() => addComponent(component.component)}
|
||||||
on:mouseover={() => (selectedIndex = null)}
|
on:mouseover={() => (selectedIndex = null)}
|
||||||
|
on:focus
|
||||||
>
|
>
|
||||||
<Icon name={component.icon} />
|
<Icon name={component.icon} />
|
||||||
<Body size="XS">{component.name}</Body>
|
<Body size="XS">{component.name}</Body>
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
class="container"
|
class="container"
|
||||||
on:mouseover={() => (showTooltip = true)}
|
on:mouseover={() => (showTooltip = true)}
|
||||||
on:mouseleave={() => (showTooltip = false)}
|
on:mouseleave={() => (showTooltip = false)}
|
||||||
|
on:focus
|
||||||
style="--color: {color};"
|
style="--color: {color};"
|
||||||
>
|
>
|
||||||
<StatusLight square {color} />
|
<StatusLight square {color} />
|
||||||
|
|
|
@ -172,7 +172,7 @@
|
||||||
{bindings}
|
{bindings}
|
||||||
/>
|
/>
|
||||||
{/each}
|
{/each}
|
||||||
<Button secondary newStyles on:click={() => $goto("../components")}>
|
<Button secondary on:click={() => $goto("../components")}>
|
||||||
View components
|
View components
|
||||||
</Button>
|
</Button>
|
||||||
</Layout>
|
</Layout>
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<Slider min={0} max={3} step={1} value={index} on:change={onChange} />
|
<Slider min={0} max={3} step={1} value={index} on:change={onChange} />
|
||||||
<div class="button" style="--radius: {customTheme.buttonBorderRadius};">
|
<div class="button" style="--radius: {customTheme.buttonBorderRadius};">
|
||||||
<Button primary newStyles>Button</Button>
|
<Button primary>Button</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
import { goto } from "@roxi/routify"
|
import { goto } from "@roxi/routify"
|
||||||
import { AppStatus } from "constants"
|
import { AppStatus } from "constants"
|
||||||
import { gradient } from "actions"
|
import { gradient } from "actions"
|
||||||
import UpdateUserInfoModal from "components/settings/UpdateUserInfoModal.svelte"
|
import ProfileModal from "components/settings/ProfileModal.svelte"
|
||||||
import ChangePasswordModal from "components/settings/ChangePasswordModal.svelte"
|
import ChangePasswordModal from "components/settings/ChangePasswordModal.svelte"
|
||||||
import { processStringSync } from "@budibase/string-templates"
|
import { processStringSync } from "@budibase/string-templates"
|
||||||
import Spaceman from "assets/bb-space-man.svg"
|
import Spaceman from "assets/bb-space-man.svg"
|
||||||
|
@ -89,7 +89,7 @@
|
||||||
|
|
||||||
{#if $auth.user && loaded}
|
{#if $auth.user && loaded}
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<Page>
|
<Page narrow>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<Layout noPadding>
|
<Layout noPadding>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
|
@ -104,7 +104,7 @@
|
||||||
<Icon size="XL" name="ChevronDown" />
|
<Icon size="XL" name="ChevronDown" />
|
||||||
</div>
|
</div>
|
||||||
<MenuItem icon="UserEdit" on:click={() => userInfoModal.show()}>
|
<MenuItem icon="UserEdit" on:click={() => userInfoModal.show()}>
|
||||||
Update user information
|
My profile
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
icon="LockClosed"
|
icon="LockClosed"
|
||||||
|
@ -185,7 +185,7 @@
|
||||||
</Page>
|
</Page>
|
||||||
</div>
|
</div>
|
||||||
<Modal bind:this={userInfoModal}>
|
<Modal bind:this={userInfoModal}>
|
||||||
<UpdateUserInfoModal />
|
<ProfileModal />
|
||||||
</Modal>
|
</Modal>
|
||||||
<Modal bind:this={changePasswordModal}>
|
<Modal bind:this={changePasswordModal}>
|
||||||
<ChangePasswordModal />
|
<ChangePasswordModal />
|
||||||
|
@ -196,6 +196,11 @@
|
||||||
.container {
|
.container {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: flex-start;
|
||||||
|
align-items: center;
|
||||||
|
padding: 80px;
|
||||||
}
|
}
|
||||||
.content {
|
.content {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
<script>
|
||||||
|
import Logo from "assets/bb-emblem.svg"
|
||||||
|
import { goto } from "@roxi/routify"
|
||||||
|
import { organisation } from "stores/portal"
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<img
|
||||||
|
src={$organisation.logoUrl || Logo}
|
||||||
|
alt="Budibase Logo"
|
||||||
|
on:click={() => $goto("./apps")}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
img {
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,101 @@
|
||||||
|
<script>
|
||||||
|
import { Layout } from "@budibase/bbui"
|
||||||
|
import { SideNav, SideNavItem } from "components/portal/page"
|
||||||
|
import { createEventDispatcher } from "svelte"
|
||||||
|
import { isActive } from "@roxi/routify"
|
||||||
|
import UpgradeButton from "./UpgradeButton.svelte"
|
||||||
|
import { fade } from "svelte/transition"
|
||||||
|
import Logo from "./Logo.svelte"
|
||||||
|
import { menu } from "stores/portal"
|
||||||
|
|
||||||
|
export let visible = false
|
||||||
|
|
||||||
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
|
const close = () => dispatch("close")
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if visible}
|
||||||
|
<div
|
||||||
|
class="mobile-nav-underlay"
|
||||||
|
transition:fade={{ duration: 130 }}
|
||||||
|
on:click={close}
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
|
<div class="mobile-nav" class:visible>
|
||||||
|
<Layout noPadding gap="M">
|
||||||
|
<div on:click={close}>
|
||||||
|
<Logo />
|
||||||
|
</div>
|
||||||
|
<SideNav>
|
||||||
|
{#each $menu as { title, href, subPages }}
|
||||||
|
{#if !subPages?.length}
|
||||||
|
<SideNavItem
|
||||||
|
text={title}
|
||||||
|
url={href}
|
||||||
|
active={$isActive(href)}
|
||||||
|
on:click={close}
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
|
{/each}
|
||||||
|
{#each $menu as { title, href, subPages }}
|
||||||
|
{#if subPages?.length}
|
||||||
|
<div class="category">{title}</div>
|
||||||
|
{#each subPages as { title, href }}
|
||||||
|
<SideNavItem
|
||||||
|
text={title}
|
||||||
|
url={href}
|
||||||
|
active={$isActive(href)}
|
||||||
|
on:click={close}
|
||||||
|
/>
|
||||||
|
{/each}
|
||||||
|
{/if}
|
||||||
|
{/each}
|
||||||
|
</SideNav>
|
||||||
|
<div>
|
||||||
|
<UpgradeButton on:click={close} />
|
||||||
|
</div>
|
||||||
|
</Layout>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.mobile-nav {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.category {
|
||||||
|
color: var(--spectrum-global-color-gray-600);
|
||||||
|
font-size: var(--font-size-s);
|
||||||
|
margin-left: var(--spacing-m);
|
||||||
|
margin-top: 24px;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 640px) {
|
||||||
|
.mobile-nav-underlay {
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
z-index: 1;
|
||||||
|
background: rgba(0, 0, 0, 0.5);
|
||||||
|
}
|
||||||
|
.mobile-nav {
|
||||||
|
transform: translateX(-100%);
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
padding: 16px 24px;
|
||||||
|
height: 100%;
|
||||||
|
width: 240px;
|
||||||
|
background: var(--background);
|
||||||
|
z-index: 2;
|
||||||
|
transition: transform 130ms ease-out;
|
||||||
|
}
|
||||||
|
.mobile-nav.visible {
|
||||||
|
transform: translateX(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,26 @@
|
||||||
|
<script>
|
||||||
|
import { Button } from "@budibase/bbui"
|
||||||
|
import { goto } from "@roxi/routify"
|
||||||
|
import { auth, admin } from "stores/portal"
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if $admin.cloud && $auth?.user?.accountPortalAccess}
|
||||||
|
<Button
|
||||||
|
cta
|
||||||
|
on:click
|
||||||
|
on:click={() => {
|
||||||
|
$goto($admin.accountPortalUrl + "/portal/upgrade")
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Upgrade
|
||||||
|
</Button>
|
||||||
|
{:else if !$admin.cloud && $auth.isAdmin}
|
||||||
|
<Button
|
||||||
|
cta
|
||||||
|
size="S"
|
||||||
|
on:click={() => $goto("/builder/portal/account/upgrade")}
|
||||||
|
on:click
|
||||||
|
>
|
||||||
|
Upgrade
|
||||||
|
</Button>
|
||||||
|
{/if}
|
|
@ -0,0 +1,78 @@
|
||||||
|
<script>
|
||||||
|
import { auth } from "stores/portal"
|
||||||
|
import { ActionMenu, Avatar, MenuItem, Icon, Modal } from "@budibase/bbui"
|
||||||
|
import { goto } from "@roxi/routify"
|
||||||
|
import ProfileModal from "components/settings/ProfileModal.svelte"
|
||||||
|
import ChangePasswordModal from "components/settings/ChangePasswordModal.svelte"
|
||||||
|
import ThemeModal from "components/settings/ThemeModal.svelte"
|
||||||
|
import APIKeyModal from "components/settings/APIKeyModal.svelte"
|
||||||
|
|
||||||
|
let themeModal
|
||||||
|
let profileModal
|
||||||
|
let updatePasswordModal
|
||||||
|
let apiKeyModal
|
||||||
|
|
||||||
|
const logout = async () => {
|
||||||
|
try {
|
||||||
|
await auth.logout()
|
||||||
|
} catch (error) {
|
||||||
|
// Swallow error and do nothing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<ActionMenu align="right" dataCy="user-menu">
|
||||||
|
<div slot="control" class="user-dropdown">
|
||||||
|
<Avatar size="M" initials={$auth.initials} url={$auth.user.pictureUrl} />
|
||||||
|
<Icon size="XL" name="ChevronDown" />
|
||||||
|
</div>
|
||||||
|
<MenuItem icon="Moon" on:click={() => themeModal.show()} dataCy="theme">
|
||||||
|
Theme
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem
|
||||||
|
icon="UserEdit"
|
||||||
|
on:click={() => profileModal.show()}
|
||||||
|
dataCy="user-info"
|
||||||
|
>
|
||||||
|
My profile
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem icon="LockClosed" on:click={() => updatePasswordModal.show()}>
|
||||||
|
Update password
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem icon="Key" on:click={() => apiKeyModal.show()} dataCy="api-key">
|
||||||
|
View API key
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem icon="UserDeveloper" on:click={() => $goto("../apps")}>
|
||||||
|
Close developer mode
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem dataCy="user-logout" icon="LogOut" on:click={logout}>
|
||||||
|
Log out
|
||||||
|
</MenuItem>
|
||||||
|
</ActionMenu>
|
||||||
|
|
||||||
|
<Modal bind:this={themeModal}>
|
||||||
|
<ThemeModal />
|
||||||
|
</Modal>
|
||||||
|
<Modal bind:this={profileModal}>
|
||||||
|
<ProfileModal />
|
||||||
|
</Modal>
|
||||||
|
<Modal bind:this={updatePasswordModal}>
|
||||||
|
<ChangePasswordModal />
|
||||||
|
</Modal>
|
||||||
|
<Modal bind:this={apiKeyModal}>
|
||||||
|
<APIKeyModal />
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.user-dropdown {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: flex-end;
|
||||||
|
align-items: center;
|
||||||
|
gap: var(--spacing-s);
|
||||||
|
}
|
||||||
|
.user-dropdown:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
filter: brightness(110%);
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -1,154 +1,27 @@
|
||||||
<script>
|
<script>
|
||||||
import { isActive, redirect, goto } from "@roxi/routify"
|
import { isActive, redirect, goto, url } from "@roxi/routify"
|
||||||
import {
|
import { Icon, notifications, Tabs, Tab } from "@budibase/bbui"
|
||||||
Icon,
|
import { organisation, auth, menu } from "stores/portal"
|
||||||
Avatar,
|
|
||||||
Layout,
|
|
||||||
SideNavigation as Navigation,
|
|
||||||
SideNavigationItem as Item,
|
|
||||||
ActionMenu,
|
|
||||||
MenuItem,
|
|
||||||
Modal,
|
|
||||||
clickOutside,
|
|
||||||
notifications,
|
|
||||||
} from "@budibase/bbui"
|
|
||||||
import ConfigChecklist from "components/common/ConfigChecklist.svelte"
|
|
||||||
import { organisation, auth, admin as adminStore } from "stores/portal"
|
|
||||||
import { onMount } from "svelte"
|
import { onMount } from "svelte"
|
||||||
import UpdateUserInfoModal from "components/settings/UpdateUserInfoModal.svelte"
|
import UpgradeButton from "./_components/UpgradeButton.svelte"
|
||||||
import ChangePasswordModal from "components/settings/ChangePasswordModal.svelte"
|
import MobileMenu from "./_components/MobileMenu.svelte"
|
||||||
import UpdateAPIKeyModal from "components/settings/UpdateAPIKeyModal.svelte"
|
import Logo from "./_components/Logo.svelte"
|
||||||
import Logo from "assets/bb-emblem.svg"
|
import UserDropdown from "./_components/UserDropdown.svelte"
|
||||||
import { isEnabled, TENANT_FEATURE_FLAGS } from "helpers/featureFlags"
|
|
||||||
|
|
||||||
let loaded = false
|
let loaded = false
|
||||||
let userInfoModal
|
|
||||||
let changePasswordModal
|
|
||||||
let apiKeyModal
|
|
||||||
let mobileMenuVisible = false
|
let mobileMenuVisible = false
|
||||||
|
let activeTab = "Apps"
|
||||||
|
|
||||||
$: menu = buildMenu($auth.isAdmin)
|
$: $url(), updateActiveTab($menu)
|
||||||
|
|
||||||
const buildMenu = admin => {
|
const updateActiveTab = menu => {
|
||||||
let menu = [
|
for (let entry of menu) {
|
||||||
{
|
if ($isActive(entry.href)) {
|
||||||
title: "Apps",
|
if (activeTab !== entry.title) {
|
||||||
href: "/builder/portal/apps",
|
activeTab = entry.title
|
||||||
},
|
}
|
||||||
]
|
break
|
||||||
|
|
||||||
if (admin) {
|
|
||||||
menu = menu.concat([
|
|
||||||
{
|
|
||||||
title: "Users",
|
|
||||||
href: "/builder/portal/manage/users",
|
|
||||||
heading: "Manage",
|
|
||||||
},
|
|
||||||
isEnabled(TENANT_FEATURE_FLAGS.USER_GROUPS)
|
|
||||||
? {
|
|
||||||
title: "User Groups",
|
|
||||||
href: "/builder/portal/manage/groups",
|
|
||||||
}
|
|
||||||
: undefined,
|
|
||||||
{ title: "Auth", href: "/builder/portal/manage/auth" },
|
|
||||||
{ title: "Email", href: "/builder/portal/manage/email" },
|
|
||||||
{
|
|
||||||
title: "Plugins",
|
|
||||||
href: "/builder/portal/manage/plugins",
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
title: "Organisation",
|
|
||||||
href: "/builder/portal/settings/organisation",
|
|
||||||
heading: "Settings",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "Theming",
|
|
||||||
href: "/builder/portal/settings/theming",
|
|
||||||
},
|
|
||||||
])
|
|
||||||
|
|
||||||
if (!$adminStore.cloud) {
|
|
||||||
menu = menu.concat([
|
|
||||||
{
|
|
||||||
title: "Update",
|
|
||||||
href: "/builder/portal/settings/update",
|
|
||||||
},
|
|
||||||
])
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
menu = menu.concat([
|
|
||||||
{
|
|
||||||
title: "Theming",
|
|
||||||
href: "/builder/portal/settings/theming",
|
|
||||||
heading: "Settings",
|
|
||||||
},
|
|
||||||
])
|
|
||||||
}
|
|
||||||
|
|
||||||
// add link to account portal if the user has access
|
|
||||||
let accountSectionAdded = false
|
|
||||||
|
|
||||||
// link out to account-portal if account holder in cloud or always in self-host
|
|
||||||
if ($auth?.user?.accountPortalAccess || (!$adminStore.cloud && admin)) {
|
|
||||||
accountSectionAdded = true
|
|
||||||
menu = menu.concat([
|
|
||||||
{
|
|
||||||
title: "Account",
|
|
||||||
href: $adminStore.accountPortalUrl,
|
|
||||||
heading: "Account",
|
|
||||||
},
|
|
||||||
])
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isEnabled(TENANT_FEATURE_FLAGS.LICENSING)) {
|
|
||||||
// always show usage in self-host or cloud if licensing enabled
|
|
||||||
menu = menu.concat([
|
|
||||||
{
|
|
||||||
title: "Usage",
|
|
||||||
href: "/builder/portal/settings/usage",
|
|
||||||
heading: accountSectionAdded ? "" : "Account",
|
|
||||||
},
|
|
||||||
])
|
|
||||||
|
|
||||||
// show the relevant hosting upgrade page
|
|
||||||
if ($adminStore.cloud && $auth?.user?.accountPortalAccess) {
|
|
||||||
menu = menu.concat([
|
|
||||||
{
|
|
||||||
title: "Upgrade",
|
|
||||||
href: $adminStore.accountPortalUrl + "/portal/upgrade",
|
|
||||||
},
|
|
||||||
])
|
|
||||||
} else if (!$adminStore.cloud && admin) {
|
|
||||||
menu = menu.concat({
|
|
||||||
title: "Upgrade",
|
|
||||||
href: "/builder/portal/settings/upgrade",
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// show the billing page to licensed account holders in cloud
|
|
||||||
if (
|
|
||||||
$auth?.user?.accountPortalAccess &&
|
|
||||||
$auth.user.account.stripeCustomerId
|
|
||||||
) {
|
|
||||||
menu = menu.concat([
|
|
||||||
{
|
|
||||||
title: "Billing",
|
|
||||||
href: $adminStore.accountPortalUrl + "/portal/billing",
|
|
||||||
},
|
|
||||||
])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
menu = menu.filter(item => !!item)
|
|
||||||
return menu
|
|
||||||
}
|
|
||||||
|
|
||||||
const logout = async () => {
|
|
||||||
try {
|
|
||||||
await auth.logout()
|
|
||||||
} catch (error) {
|
|
||||||
// Swallow error and do nothing
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,212 +47,102 @@
|
||||||
|
|
||||||
{#if $auth.user && loaded}
|
{#if $auth.user && loaded}
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div
|
<div class="nav">
|
||||||
class="nav"
|
<div class="branding">
|
||||||
class:visible={mobileMenuVisible}
|
<Logo />
|
||||||
use:clickOutside={hideMobileMenu}
|
</div>
|
||||||
>
|
<div class="desktop">
|
||||||
<Layout paddingX="L" paddingY="L">
|
<Tabs selected={activeTab}>
|
||||||
<div class="branding">
|
{#each $menu as { title, href }}
|
||||||
<div class="name" on:click={() => $goto("./apps")}>
|
<Tab {title} on:click={() => $goto(href)} />
|
||||||
<img src={$organisation?.logoUrl || Logo} alt="Logotype" />
|
{/each}
|
||||||
<span>{$organisation?.company || "Budibase"}</span>
|
</Tabs>
|
||||||
</div>
|
</div>
|
||||||
<div class="onboarding">
|
<div class="mobile">
|
||||||
{#if $auth.user?.admin?.global}
|
<Icon hoverable name="ShowMenu" on:click={showMobileMenu} />
|
||||||
<ConfigChecklist />
|
</div>
|
||||||
{/if}
|
<div class="desktop">
|
||||||
</div>
|
<UpgradeButton />
|
||||||
</div>
|
</div>
|
||||||
<div class="menu">
|
<div class="dropdown">
|
||||||
<Navigation>
|
<UserDropdown />
|
||||||
{#each menu as { title, href, heading, badge }}
|
</div>
|
||||||
<Item
|
|
||||||
on:click={hideMobileMenu}
|
|
||||||
selected={$isActive(href)}
|
|
||||||
{href}
|
|
||||||
{badge}
|
|
||||||
{heading}>{title}</Item
|
|
||||||
>
|
|
||||||
{/each}
|
|
||||||
</Navigation>
|
|
||||||
</div>
|
|
||||||
</Layout>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="main">
|
<div class="main">
|
||||||
<div class="toolbar">
|
<slot />
|
||||||
<div class="mobile-toggle">
|
|
||||||
<Icon hoverable name="ShowMenu" on:click={showMobileMenu} />
|
|
||||||
</div>
|
|
||||||
<div class="mobile-logo">
|
|
||||||
<img
|
|
||||||
src={$organisation?.logoUrl || Logo}
|
|
||||||
alt={$organisation?.company || "Budibase"}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="user-dropdown">
|
|
||||||
<ActionMenu align="right" dataCy="user-menu">
|
|
||||||
<div slot="control" class="avatar">
|
|
||||||
<Avatar
|
|
||||||
size="M"
|
|
||||||
initials={$auth.initials}
|
|
||||||
url={$auth.user.pictureUrl}
|
|
||||||
/>
|
|
||||||
<Icon size="XL" name="ChevronDown" />
|
|
||||||
</div>
|
|
||||||
<MenuItem
|
|
||||||
icon="UserEdit"
|
|
||||||
on:click={() => userInfoModal.show()}
|
|
||||||
dataCy={"user-info"}
|
|
||||||
>
|
|
||||||
Update user information
|
|
||||||
</MenuItem>
|
|
||||||
{#if $auth.isBuilder}
|
|
||||||
<MenuItem icon="Key" on:click={() => apiKeyModal.show()}>
|
|
||||||
View API key
|
|
||||||
</MenuItem>
|
|
||||||
{/if}
|
|
||||||
<MenuItem
|
|
||||||
icon="LockClosed"
|
|
||||||
on:click={() => changePasswordModal.show()}
|
|
||||||
>
|
|
||||||
Update password
|
|
||||||
</MenuItem>
|
|
||||||
<MenuItem icon="UserDeveloper" on:click={() => $goto("../apps")}>
|
|
||||||
Close developer mode
|
|
||||||
</MenuItem>
|
|
||||||
<MenuItem dataCy="user-logout" icon="LogOut" on:click={logout}
|
|
||||||
>Log out
|
|
||||||
</MenuItem>
|
|
||||||
</ActionMenu>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="content">
|
|
||||||
<slot />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<MobileMenu visible={mobileMenuVisible} on:close={hideMobileMenu} />
|
||||||
</div>
|
</div>
|
||||||
<Modal bind:this={userInfoModal}>
|
|
||||||
<UpdateUserInfoModal />
|
|
||||||
</Modal>
|
|
||||||
<Modal bind:this={changePasswordModal}>
|
|
||||||
<ChangePasswordModal />
|
|
||||||
</Modal>
|
|
||||||
<Modal bind:this={apiKeyModal}>
|
|
||||||
<UpdateAPIKeyModal />
|
|
||||||
</Modal>
|
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.container {
|
.container {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: column;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
}
|
}
|
||||||
.nav {
|
.nav {
|
||||||
background: var(--background);
|
background: var(--background);
|
||||||
border-right: var(--border-light);
|
display: flex;
|
||||||
overflow: auto;
|
flex-direction: row;
|
||||||
flex: 0 0 auto;
|
justify-content: flex-start;
|
||||||
width: 250px;
|
align-items: center;
|
||||||
|
border-bottom: var(--border-light);
|
||||||
|
padding: 0 24px;
|
||||||
|
gap: 24px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Customise tabs appearance*/
|
||||||
|
.nav :global(.spectrum-Tabs) {
|
||||||
|
margin-bottom: -2px;
|
||||||
|
padding: 7px 0;
|
||||||
|
flex: 1 1 auto;
|
||||||
|
}
|
||||||
|
.nav :global(.spectrum-Tabs-content) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.nav :global(.spectrum-Tabs-itemLabel) {
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.branding {
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
}
|
}
|
||||||
.main {
|
.main {
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
display: grid;
|
|
||||||
grid-template-rows: auto 1fr;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
.branding {
|
|
||||||
display: grid;
|
|
||||||
grid-gap: var(--spacing-s);
|
|
||||||
grid-template-columns: auto auto;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
.name {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: auto auto;
|
|
||||||
grid-gap: var(--spacing-m);
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
.name:hover {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
.avatar {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: auto auto;
|
|
||||||
place-items: center;
|
|
||||||
grid-gap: var(--spacing-xs);
|
|
||||||
}
|
|
||||||
.avatar:hover {
|
|
||||||
cursor: pointer;
|
|
||||||
filter: brightness(110%);
|
|
||||||
}
|
|
||||||
.toolbar {
|
|
||||||
background: var(--background);
|
|
||||||
border-bottom: var(--border-light);
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: space-between;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: stretch;
|
||||||
padding: var(--spacing-m) calc(var(--spacing-xl) * 2);
|
overflow: auto;
|
||||||
}
|
}
|
||||||
.mobile-toggle,
|
.mobile {
|
||||||
.mobile-logo {
|
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
.user-dropdown {
|
.desktop {
|
||||||
flex: 1 1 auto;
|
display: contents;
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
justify-content: flex-end;
|
|
||||||
}
|
|
||||||
img {
|
|
||||||
width: 28px;
|
|
||||||
height: 28px;
|
|
||||||
}
|
|
||||||
span {
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
.content {
|
|
||||||
overflow: auto;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 640px) {
|
@media (max-width: 640px) {
|
||||||
.toolbar {
|
.mobile {
|
||||||
background: var(--background);
|
display: contents;
|
||||||
border-bottom: var(--border-light);
|
}
|
||||||
display: flex;
|
.desktop {
|
||||||
flex-direction: row;
|
display: none;
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
padding: var(--spacing-m) calc(var(--spacing-xl) * 1.5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav {
|
.nav {
|
||||||
|
flex: 0 0 52px;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
.branding {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: -250px;
|
left: 50%;
|
||||||
height: 100%;
|
top: 50%;
|
||||||
transition: left ease-in-out 230ms;
|
transform: translateX(-50%) translateY(-50%);
|
||||||
z-index: 100;
|
|
||||||
}
|
|
||||||
.nav.visible {
|
|
||||||
left: 0;
|
|
||||||
box-shadow: 0 0 80px 20px rgba(0, 0, 0, 0.3);
|
|
||||||
}
|
|
||||||
|
|
||||||
.mobile-toggle,
|
|
||||||
.mobile-logo {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mobile-toggle,
|
|
||||||
.user-dropdown {
|
|
||||||
flex: 0 1 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
<script>
|
||||||
|
import { isActive } from "@roxi/routify"
|
||||||
|
import { Page } from "@budibase/bbui"
|
||||||
|
import { Content, SideNav, SideNavItem } from "components/portal/page"
|
||||||
|
import { menu } from "stores/portal"
|
||||||
|
|
||||||
|
$: pages = $menu.find(x => x.title === "Account").subPages
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Page narrow>
|
||||||
|
<Content>
|
||||||
|
<div slot="side-nav">
|
||||||
|
<SideNav>
|
||||||
|
{#each pages as { title, href }}
|
||||||
|
<SideNavItem text={title} url={href} active={$isActive(href)} />
|
||||||
|
{/each}
|
||||||
|
</SideNav>
|
||||||
|
</div>
|
||||||
|
<slot />
|
||||||
|
</Content>
|
||||||
|
</Page>
|
|
@ -0,0 +1,4 @@
|
||||||
|
<script>
|
||||||
|
import { redirect } from "@roxi/routify"
|
||||||
|
$redirect("./usage")
|
||||||
|
</script>
|
|
@ -8,6 +8,7 @@
|
||||||
Button,
|
Button,
|
||||||
Input,
|
Input,
|
||||||
Label,
|
Label,
|
||||||
|
ButtonGroup,
|
||||||
notifications,
|
notifications,
|
||||||
} from "@budibase/bbui"
|
} from "@budibase/bbui"
|
||||||
import { auth, admin } from "stores/portal"
|
import { auth, admin } from "stores/portal"
|
||||||
|
@ -103,10 +104,10 @@
|
||||||
{#if license.plan.type === "free"}
|
{#if license.plan.type === "free"}
|
||||||
Upgrade your Budibase installation to unlock additional features. To
|
Upgrade your Budibase installation to unlock additional features. To
|
||||||
subscribe to a plan visit your
|
subscribe to a plan visit your
|
||||||
<Link size="L" href={upgradeUrl}>Account</Link>.
|
<Link size="L" href={upgradeUrl}>account</Link>.
|
||||||
{:else}
|
{:else}
|
||||||
To manage your plan visit your
|
To manage your plan visit your
|
||||||
<Link size="L" href={upgradeUrl}>Account</Link>.
|
<Link size="L" href={upgradeUrl}>account</Link>
|
||||||
{/if}
|
{/if}
|
||||||
</Body>
|
</Body>
|
||||||
</Layout>
|
</Layout>
|
||||||
|
@ -127,44 +128,33 @@
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="button-container">
|
<ButtonGroup>
|
||||||
<div class="action-button">
|
<Button cta on:click={activate} disabled={activateDisabled}>
|
||||||
<Button cta on:click={activate} disabled={activateDisabled}
|
Activate
|
||||||
>Activate</Button
|
</Button>
|
||||||
>
|
{#if licenseInfo?.licenseKey}
|
||||||
</div>
|
<Button warning on:click={() => deleteLicenseKeyModal.show()}>
|
||||||
<div class="action-button">
|
Delete
|
||||||
{#if licenseInfo?.licenseKey}
|
</Button>
|
||||||
<Button warning on:click={() => deleteLicenseKeyModal.show()}
|
{/if}
|
||||||
>Delete</Button
|
</ButtonGroup>
|
||||||
>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Layout>
|
</Layout>
|
||||||
<Divider />
|
<Divider />
|
||||||
<Layout gap="L" noPadding>
|
<Layout gap="XS" noPadding>
|
||||||
<Layout gap="S" noPadding>
|
<Heading size="S">Plan</Heading>
|
||||||
<Heading size="S">Plan</Heading>
|
<Layout noPadding gap="XXS">
|
||||||
<Layout noPadding gap="XXS">
|
<Body size="S">You are currently on the {license.plan.type} plan</Body>
|
||||||
<Body size="S">You are currently on the {license.plan.type} plan</Body
|
<Body size="XS">
|
||||||
>
|
{processStringSync("Updated {{ duration time 'millisecond' }} ago", {
|
||||||
<Body size="XS">
|
time:
|
||||||
{processStringSync(
|
new Date().getTime() - new Date(license.refreshedAt).getTime(),
|
||||||
"Updated {{ duration time 'millisecond' }} ago",
|
})}
|
||||||
{
|
</Body>
|
||||||
time:
|
|
||||||
new Date().getTime() -
|
|
||||||
new Date(license.refreshedAt).getTime(),
|
|
||||||
}
|
|
||||||
)}
|
|
||||||
</Body>
|
|
||||||
</Layout>
|
|
||||||
</Layout>
|
</Layout>
|
||||||
<div>
|
|
||||||
<Button secondary on:click={refresh}>Refresh</Button>
|
|
||||||
</div>
|
|
||||||
</Layout>
|
</Layout>
|
||||||
|
<div>
|
||||||
|
<Button secondary on:click={refresh}>Refresh</Button>
|
||||||
|
</div>
|
||||||
</Layout>
|
</Layout>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
@ -179,10 +169,4 @@
|
||||||
grid-gap: var(--spacing-l);
|
grid-gap: var(--spacing-l);
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
.action-button {
|
|
||||||
margin-right: 10px;
|
|
||||||
}
|
|
||||||
.button-container {
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
|
@ -10,9 +10,9 @@
|
||||||
TooltipWrapper,
|
TooltipWrapper,
|
||||||
} from "@budibase/bbui"
|
} from "@budibase/bbui"
|
||||||
import { onMount } from "svelte"
|
import { onMount } from "svelte"
|
||||||
import { admin, auth, licensing } from "../../../../stores/portal"
|
import { admin, auth, licensing } from "stores/portal"
|
||||||
import { Constants } from "@budibase/frontend-core"
|
import { Constants } from "@budibase/frontend-core"
|
||||||
import { DashCard, Usage } from "../../../../components/usage"
|
import { DashCard, Usage } from "components/usage"
|
||||||
|
|
||||||
let staticUsage = []
|
let staticUsage = []
|
||||||
let monthlyUsage = []
|
let monthlyUsage = []
|
||||||
|
@ -32,6 +32,8 @@
|
||||||
$: license = $auth.user?.license
|
$: license = $auth.user?.license
|
||||||
$: accountPortalAccess = $auth?.user?.accountPortalAccess
|
$: accountPortalAccess = $auth?.user?.accountPortalAccess
|
||||||
$: quotaReset = quotaUsage?.quotaReset
|
$: quotaReset = quotaUsage?.quotaReset
|
||||||
|
$: canManagePlan =
|
||||||
|
($admin.cloud && accountPortalAccess) || (!$admin.cloud && $auth.isAdmin)
|
||||||
|
|
||||||
const setMonthlyUsage = () => {
|
const setMonthlyUsage = () => {
|
||||||
monthlyUsage = []
|
monthlyUsage = []
|
||||||
|
@ -180,18 +182,19 @@
|
||||||
<Layout noPadding gap="XS">
|
<Layout noPadding gap="XS">
|
||||||
<Heading>Usage</Heading>
|
<Heading>Usage</Heading>
|
||||||
<Body>
|
<Body>
|
||||||
Get information about your current usage within Budibase.
|
<div>Get information about your current usage within Budibase</div>
|
||||||
{#if accountPortalAccess}
|
|
||||||
To upgrade your plan and usage limits visit your <Link
|
|
||||||
on:click={goToAccountPortal}
|
|
||||||
size="L">Account</Link
|
|
||||||
>
|
|
||||||
{:else}
|
|
||||||
To upgrade your plan and usage limits contact your account holder.
|
|
||||||
{/if}
|
|
||||||
</Body>
|
</Body>
|
||||||
</Layout>
|
</Layout>
|
||||||
<Divider />
|
<Divider />
|
||||||
|
{#if canManagePlan}
|
||||||
|
<Body>
|
||||||
|
To upgrade your plan and usage limits visit your
|
||||||
|
<Link size="L" on:click={goToAccountPortal}>account</Link>.
|
||||||
|
</Body>
|
||||||
|
{:else}
|
||||||
|
<Body>Contact your account holder to upgrade your plan.</Body>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<DashCard
|
<DashCard
|
||||||
description="YOUR CURRENT PLAN"
|
description="YOUR CURRENT PLAN"
|
||||||
title={planTitle()}
|
title={planTitle()}
|
||||||
|
@ -199,58 +202,61 @@
|
||||||
primaryAction={accountPortalAccess ? goToAccountPortal : undefined}
|
primaryAction={accountPortalAccess ? goToAccountPortal : undefined}
|
||||||
{textRows}
|
{textRows}
|
||||||
>
|
>
|
||||||
<Layout gap="S" noPadding>
|
<div class="content">
|
||||||
<Layout gap="S">
|
<div class="column">
|
||||||
<div class="usages">
|
<Layout noPadding>
|
||||||
<Layout noPadding>
|
{#each staticUsage as usage}
|
||||||
{#each staticUsage as usage}
|
<div class="usage">
|
||||||
<div class="usage">
|
<Usage {usage} warnWhenFull={WARN_USAGE.includes(usage.name)} />
|
||||||
|
</div>
|
||||||
|
{/each}
|
||||||
|
</Layout>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if monthlyUsage.length}
|
||||||
|
<div class="column">
|
||||||
|
<Layout noPadding gap="M">
|
||||||
|
<Layout gap="XS" noPadding>
|
||||||
|
<Heading size="S">Monthly limits</Heading>
|
||||||
|
<div class="detail">
|
||||||
|
<TooltipWrapper tooltip={new Date(quotaReset)}>
|
||||||
|
<Detail size="M">
|
||||||
|
Resets in {daysRemainingInMonth} days
|
||||||
|
</Detail>
|
||||||
|
</TooltipWrapper>
|
||||||
|
</div>
|
||||||
|
</Layout>
|
||||||
|
<Layout noPadding gap="M">
|
||||||
|
{#each monthlyUsage as usage}
|
||||||
<Usage
|
<Usage
|
||||||
{usage}
|
{usage}
|
||||||
warnWhenFull={WARN_USAGE.includes(usage.name)}
|
warnWhenFull={WARN_USAGE.includes(usage.name)}
|
||||||
/>
|
/>
|
||||||
</div>
|
{/each}
|
||||||
{/each}
|
</Layout>
|
||||||
</Layout>
|
|
||||||
</div>
|
|
||||||
</Layout>
|
|
||||||
{#if monthlyUsage.length}
|
|
||||||
<div class="monthly-container">
|
|
||||||
<Layout gap="S">
|
|
||||||
<Heading size="S" weight="light">Monthly</Heading>
|
|
||||||
<div class="detail">
|
|
||||||
<TooltipWrapper tooltip={new Date(quotaReset)}>
|
|
||||||
<Detail size="M">Resets in {daysRemainingInMonth} days</Detail
|
|
||||||
>
|
|
||||||
</TooltipWrapper>
|
|
||||||
</div>
|
|
||||||
<div class="usages">
|
|
||||||
<Layout noPadding>
|
|
||||||
{#each monthlyUsage as usage}
|
|
||||||
<div class="usage">
|
|
||||||
<Usage
|
|
||||||
{usage}
|
|
||||||
warnWhenFull={WARN_USAGE.includes(usage.name)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
{/each}
|
|
||||||
</Layout>
|
|
||||||
</div>
|
|
||||||
</Layout>
|
</Layout>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</Layout>
|
</div>
|
||||||
</DashCard>
|
</DashCard>
|
||||||
</Layout>
|
</Layout>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.usages {
|
.content {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: row;
|
||||||
|
justify-content: flex-start;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 40px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
.column {
|
||||||
|
flex: 1 1 0;
|
||||||
}
|
}
|
||||||
.detail :global(.spectrum-Detail) {
|
.detail :global(.spectrum-Detail) {
|
||||||
color: var(--spectrum-global-color-gray-700);
|
color: var(--spectrum-global-color-gray-700);
|
||||||
|
margin-bottom: 5px;
|
||||||
}
|
}
|
||||||
.detail :global(.icon) {
|
.detail :global(.icon) {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
|
@ -1,49 +0,0 @@
|
||||||
<script>
|
|
||||||
import { PickerDropdown } from "@budibase/bbui"
|
|
||||||
import { groups } from "stores/portal"
|
|
||||||
import { createEventDispatcher } from "svelte"
|
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
|
||||||
|
|
||||||
let filter = null
|
|
||||||
$: filteredGroups = !filter
|
|
||||||
? $groups
|
|
||||||
: $groups.filter(group =>
|
|
||||||
group.name?.toLowerCase().includes(filter.toLowerCase())
|
|
||||||
)
|
|
||||||
|
|
||||||
$: optionSections = {
|
|
||||||
groups: {
|
|
||||||
data: filteredGroups,
|
|
||||||
getLabel: group => group.name,
|
|
||||||
getValue: group => group._id,
|
|
||||||
getIcon: group => group.icon,
|
|
||||||
getColour: group => group.color,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
$: onChange = selected => {
|
|
||||||
const { detail } = selected
|
|
||||||
if (!detail || Object.keys(detail).length == 0) {
|
|
||||||
dispatch("change", null)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const groupSelected = $groups.find(x => x._id === detail)
|
|
||||||
const appRoleIds = groupSelected?.roles
|
|
||||||
? Object.keys(groupSelected?.roles)
|
|
||||||
: []
|
|
||||||
dispatch("change", appRoleIds)
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<PickerDropdown
|
|
||||||
autocomplete
|
|
||||||
bind:searchTerm={filter}
|
|
||||||
primaryOptions={optionSections}
|
|
||||||
placeholder={"Filter by access"}
|
|
||||||
on:pickprimary={onChange}
|
|
||||||
on:closed={() => {
|
|
||||||
filter = null
|
|
||||||
}}
|
|
||||||
/>
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
<script>
|
||||||
|
import { notifications } from "@budibase/bbui"
|
||||||
|
import { apps, templates, licensing, groups } from "stores/portal"
|
||||||
|
import { onMount } from "svelte"
|
||||||
|
import { goto } from "@roxi/routify"
|
||||||
|
|
||||||
|
// Don't block loading if we've already hydrated state
|
||||||
|
let loaded = $apps.length > 0
|
||||||
|
|
||||||
|
onMount(async () => {
|
||||||
|
try {
|
||||||
|
// Always load latest
|
||||||
|
await apps.load()
|
||||||
|
await licensing.init()
|
||||||
|
await templates.load()
|
||||||
|
|
||||||
|
if ($licensing.groupsEnabled) {
|
||||||
|
await groups.actions.init()
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($templates?.length === 0) {
|
||||||
|
notifications.error("There was a problem loading quick start templates")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Go to new app page if no apps exists
|
||||||
|
if (!$apps.length) {
|
||||||
|
$goto("./create")
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
notifications.error("Error loading apps and templates")
|
||||||
|
}
|
||||||
|
loaded = true
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if loaded}
|
||||||
|
<slot />
|
||||||
|
{/if}
|
|
@ -1,49 +1,17 @@
|
||||||
<script>
|
<script>
|
||||||
import { goto } from "@roxi/routify"
|
import { url } from "@roxi/routify"
|
||||||
import {
|
import { Layout, Page, Button, Modal } from "@budibase/bbui"
|
||||||
Layout,
|
|
||||||
Page,
|
|
||||||
notifications,
|
|
||||||
Button,
|
|
||||||
Heading,
|
|
||||||
Body,
|
|
||||||
Modal,
|
|
||||||
Divider,
|
|
||||||
ActionButton,
|
|
||||||
} from "@budibase/bbui"
|
|
||||||
import CreateAppModal from "components/start/CreateAppModal.svelte"
|
import CreateAppModal from "components/start/CreateAppModal.svelte"
|
||||||
import TemplateDisplay from "components/common/TemplateDisplay.svelte"
|
import TemplateDisplay from "components/common/TemplateDisplay.svelte"
|
||||||
import AppLimitModal from "components/portal/licensing/AppLimitModal.svelte"
|
import AppLimitModal from "components/portal/licensing/AppLimitModal.svelte"
|
||||||
import { onMount } from "svelte"
|
import { apps, templates, licensing } from "stores/portal"
|
||||||
import { templates, licensing } from "stores/portal"
|
import { Breadcrumbs, Breadcrumb, Header } from "components/portal/page"
|
||||||
|
|
||||||
let loaded = $templates?.length
|
|
||||||
let template
|
let template
|
||||||
let creationModal = false
|
let creationModal = false
|
||||||
let appLimitModal
|
let appLimitModal
|
||||||
let creatingApp = false
|
let creatingApp = false
|
||||||
|
|
||||||
const welcomeBody =
|
|
||||||
"Start from scratch or get a head start with one of our templates"
|
|
||||||
const createAppTitle = "Create new app"
|
|
||||||
const createAppButtonText = "Start from scratch"
|
|
||||||
|
|
||||||
onMount(async () => {
|
|
||||||
try {
|
|
||||||
await templates.load()
|
|
||||||
// always load latest
|
|
||||||
await licensing.init()
|
|
||||||
if ($templates?.length === 0) {
|
|
||||||
notifications.error(
|
|
||||||
"There was a problem loading quick start templates."
|
|
||||||
)
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
notifications.error("Error loading apps and templates")
|
|
||||||
}
|
|
||||||
loaded = true
|
|
||||||
})
|
|
||||||
|
|
||||||
const initiateAppCreation = () => {
|
const initiateAppCreation = () => {
|
||||||
if ($licensing?.usageMetrics?.apps >= 100) {
|
if ($licensing?.usageMetrics?.apps >= 100) {
|
||||||
appLimitModal.show()
|
appLimitModal.show()
|
||||||
|
@ -70,58 +38,33 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Page wide>
|
<Page>
|
||||||
<Layout noPadding gap="XL">
|
<Layout noPadding gap="L">
|
||||||
<span>
|
<Breadcrumbs>
|
||||||
<ActionButton
|
<Breadcrumb url={$url("./")} text="Apps" />
|
||||||
secondary
|
<Breadcrumb text="Create new app" />
|
||||||
icon={"ArrowLeft"}
|
</Breadcrumbs>
|
||||||
on:click={() => {
|
<Header title={$apps.length ? "Create new app" : "Create your first app"}>
|
||||||
$goto("../")
|
<div slot="buttons">
|
||||||
}}
|
<Button
|
||||||
>
|
dataCy="import-app-btn"
|
||||||
Back
|
size="M"
|
||||||
</ActionButton>
|
secondary
|
||||||
</span>
|
on:click={initiateAppImport}
|
||||||
|
>
|
||||||
<div class="title">
|
Import app
|
||||||
<div class="welcome">
|
</Button>
|
||||||
<Layout noPadding gap="XS">
|
<Button
|
||||||
<Heading size="L">{createAppTitle}</Heading>
|
dataCy="create-app-btn"
|
||||||
<Body size="M">
|
size="M"
|
||||||
{welcomeBody}
|
cta
|
||||||
</Body>
|
on:click={initiateAppCreation}
|
||||||
</Layout>
|
>
|
||||||
|
Start from scratch
|
||||||
<div class="buttons">
|
</Button>
|
||||||
<Button
|
|
||||||
dataCy="create-app-btn"
|
|
||||||
size="M"
|
|
||||||
icon="Add"
|
|
||||||
cta
|
|
||||||
on:click={initiateAppCreation}
|
|
||||||
>
|
|
||||||
{createAppButtonText}
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
dataCy="import-app-btn"
|
|
||||||
icon="Import"
|
|
||||||
size="M"
|
|
||||||
quiet
|
|
||||||
secondary
|
|
||||||
on:click={initiateAppImport}
|
|
||||||
>
|
|
||||||
Import app
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</Header>
|
||||||
|
<TemplateDisplay templates={$templates} />
|
||||||
<Divider />
|
|
||||||
|
|
||||||
{#if loaded && $templates?.length}
|
|
||||||
<TemplateDisplay templates={$templates} />
|
|
||||||
{/if}
|
|
||||||
</Layout>
|
</Layout>
|
||||||
</Page>
|
</Page>
|
||||||
|
|
||||||
|
@ -134,31 +77,3 @@
|
||||||
<CreateAppModal {template} />
|
<CreateAppModal {template} />
|
||||||
</Modal>
|
</Modal>
|
||||||
<AppLimitModal bind:this={appLimitModal} />
|
<AppLimitModal bind:this={appLimitModal} />
|
||||||
|
|
||||||
<style>
|
|
||||||
.title .welcome > .buttons {
|
|
||||||
padding-top: 30px;
|
|
||||||
}
|
|
||||||
.title {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
gap: var(--spacing-xl);
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
.buttons {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
justify-content: flex-start;
|
|
||||||
align-items: center;
|
|
||||||
gap: var(--spacing-xl);
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
@media (max-width: 640px) {
|
|
||||||
.buttons {
|
|
||||||
flex-direction: row-reverse;
|
|
||||||
justify-content: flex-end;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
|
@ -9,60 +9,34 @@
|
||||||
notifications,
|
notifications,
|
||||||
Notification,
|
Notification,
|
||||||
Body,
|
Body,
|
||||||
|
Icon,
|
||||||
Search,
|
Search,
|
||||||
} from "@budibase/bbui"
|
} from "@budibase/bbui"
|
||||||
import TemplateDisplay from "components/common/TemplateDisplay.svelte"
|
|
||||||
import Spinner from "components/common/Spinner.svelte"
|
import Spinner from "components/common/Spinner.svelte"
|
||||||
import CreateAppModal from "components/start/CreateAppModal.svelte"
|
import CreateAppModal from "components/start/CreateAppModal.svelte"
|
||||||
import UpdateAppModal from "components/start/UpdateAppModal.svelte"
|
|
||||||
import AppLimitModal from "components/portal/licensing/AppLimitModal.svelte"
|
import AppLimitModal from "components/portal/licensing/AppLimitModal.svelte"
|
||||||
|
|
||||||
import { store, automationStore } from "builderStore"
|
import { store, automationStore } from "builderStore"
|
||||||
import { API } from "api"
|
import { API } from "api"
|
||||||
import { onMount } from "svelte"
|
import { onMount } from "svelte"
|
||||||
import {
|
import { apps, auth, admin, licensing } from "stores/portal"
|
||||||
apps,
|
|
||||||
auth,
|
|
||||||
admin,
|
|
||||||
templates,
|
|
||||||
licensing,
|
|
||||||
groups,
|
|
||||||
} from "stores/portal"
|
|
||||||
import { goto } from "@roxi/routify"
|
import { goto } from "@roxi/routify"
|
||||||
import AppRow from "components/start/AppRow.svelte"
|
import AppRow from "components/start/AppRow.svelte"
|
||||||
import { AppStatus } from "constants"
|
import { AppStatus } from "constants"
|
||||||
import Logo from "assets/bb-space-man.svg"
|
import Logo from "assets/bb-space-man.svg"
|
||||||
import AccessFilter from "./_components/AcessFilter.svelte"
|
|
||||||
|
|
||||||
let sortBy = "name"
|
let sortBy = "name"
|
||||||
let template
|
let template
|
||||||
let selectedApp
|
|
||||||
let creationModal
|
let creationModal
|
||||||
let updatingModal
|
|
||||||
let appLimitModal
|
let appLimitModal
|
||||||
let creatingApp = false
|
let creatingApp = false
|
||||||
let loaded = $apps?.length || $templates?.length
|
|
||||||
let searchTerm = ""
|
let searchTerm = ""
|
||||||
let cloud = $admin.cloud
|
let cloud = $admin.cloud
|
||||||
let creatingFromTemplate = false
|
let creatingFromTemplate = false
|
||||||
let automationErrors
|
let automationErrors
|
||||||
let accessFilterList = null
|
let accessFilterList = null
|
||||||
|
|
||||||
const resolveWelcomeMessage = (auth, apps) => {
|
$: welcomeHeader = `Welcome ${$auth?.user?.firstName || "back"}`
|
||||||
const userWelcome = auth?.user?.firstName
|
|
||||||
? `Welcome ${auth?.user?.firstName}!`
|
|
||||||
: "Welcome back!"
|
|
||||||
return apps?.length ? userWelcome : "Let's create your first app!"
|
|
||||||
}
|
|
||||||
$: welcomeHeader = resolveWelcomeMessage($auth, $apps)
|
|
||||||
$: welcomeBody = $apps?.length
|
|
||||||
? "Manage your apps and get a head start with templates"
|
|
||||||
: "Start from scratch or get a head start with one of our templates"
|
|
||||||
|
|
||||||
$: createAppButtonText = $apps?.length
|
|
||||||
? "Create new app"
|
|
||||||
: "Start from scratch"
|
|
||||||
|
|
||||||
$: enrichedApps = enrichApps($apps, $auth.user, sortBy)
|
$: enrichedApps = enrichApps($apps, $auth.user, sortBy)
|
||||||
$: filteredApps = enrichedApps.filter(
|
$: filteredApps = enrichedApps.filter(
|
||||||
app =>
|
app =>
|
||||||
|
@ -75,8 +49,6 @@
|
||||||
)
|
)
|
||||||
: true)
|
: true)
|
||||||
)
|
)
|
||||||
$: lockedApps = filteredApps.filter(app => app?.lockedYou || app?.lockedOther)
|
|
||||||
$: unlocked = lockedApps?.length === 0
|
|
||||||
$: automationErrors = getAutomationErrors(enrichedApps)
|
$: automationErrors = getAutomationErrors(enrichedApps)
|
||||||
|
|
||||||
const enrichApps = (apps, user, sortBy) => {
|
const enrichApps = (apps, user, sortBy) => {
|
||||||
|
@ -121,10 +93,9 @@
|
||||||
|
|
||||||
const goToAutomationError = appId => {
|
const goToAutomationError = appId => {
|
||||||
const params = new URLSearchParams({
|
const params = new URLSearchParams({
|
||||||
tab: "Automation History",
|
|
||||||
open: "error",
|
open: "error",
|
||||||
})
|
})
|
||||||
$goto(`../overview/${appId}?${params.toString()}`)
|
$goto(`../overview/${appId}/automation-history?${params.toString()}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const errorCount = errors => {
|
const errorCount = errors => {
|
||||||
|
@ -207,24 +178,6 @@
|
||||||
creatingApp = false
|
creatingApp = false
|
||||||
}
|
}
|
||||||
|
|
||||||
const appOverview = app => {
|
|
||||||
$goto(`../overview/${app.devId}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
const editApp = app => {
|
|
||||||
if (app.lockedOther) {
|
|
||||||
notifications.error(
|
|
||||||
`App locked by ${app.lockedBy.email}. Please allow lock to expire or have them unlock this app.`
|
|
||||||
)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
$goto(`../../app/${app.devId}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
const accessFilterAction = accessFilter => {
|
|
||||||
accessFilterList = accessFilter.detail
|
|
||||||
}
|
|
||||||
|
|
||||||
function createAppFromTemplateUrl(templateKey) {
|
function createAppFromTemplateUrl(templateKey) {
|
||||||
// validate the template key just to make sure
|
// validate the template key just to make sure
|
||||||
const templateParts = templateKey.split("/")
|
const templateParts = templateKey.split("/")
|
||||||
|
@ -240,37 +193,21 @@
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
try {
|
try {
|
||||||
await apps.load()
|
|
||||||
await templates.load()
|
|
||||||
// always load latest
|
|
||||||
await licensing.init()
|
|
||||||
|
|
||||||
if ($licensing.groupsEnabled) {
|
|
||||||
await groups.actions.init()
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($templates?.length === 0) {
|
|
||||||
notifications.error(
|
|
||||||
"There was a problem loading quick start templates."
|
|
||||||
)
|
|
||||||
}
|
|
||||||
// If the portal is loaded from an external URL with a template param
|
// If the portal is loaded from an external URL with a template param
|
||||||
const initInfo = await auth.getInitInfo()
|
const initInfo = await auth.getInitInfo()
|
||||||
if (initInfo?.init_template) {
|
if (initInfo?.init_template) {
|
||||||
creatingFromTemplate = true
|
creatingFromTemplate = true
|
||||||
createAppFromTemplateUrl(initInfo.init_template)
|
createAppFromTemplateUrl(initInfo.init_template)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
notifications.error("Error loading apps and templates")
|
notifications.error("Error getting init info")
|
||||||
}
|
}
|
||||||
loaded = true
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Page wide>
|
{#if $apps.length}
|
||||||
<Layout noPadding gap="M">
|
<Page>
|
||||||
{#if loaded}
|
<Layout noPadding gap="L">
|
||||||
{#each Object.keys(automationErrors || {}) as appId}
|
{#each Object.keys(automationErrors || {}) as appId}
|
||||||
<Notification
|
<Notification
|
||||||
wide
|
wide
|
||||||
|
@ -290,42 +227,15 @@
|
||||||
{/each}
|
{/each}
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<div class="welcome">
|
<div class="welcome">
|
||||||
<Layout noPadding gap="XS">
|
<Layout noPadding gap="S">
|
||||||
<Heading size="L">{welcomeHeader}</Heading>
|
<Heading size="L">{welcomeHeader}</Heading>
|
||||||
<Body size="M">
|
<Body size="M">
|
||||||
{welcomeBody}
|
Manage your apps and get a head start with templates
|
||||||
</Body>
|
</Body>
|
||||||
</Layout>
|
</Layout>
|
||||||
{#if !$apps?.length}
|
|
||||||
<div class="buttons">
|
|
||||||
<Button
|
|
||||||
dataCy="create-app-btn"
|
|
||||||
size="M"
|
|
||||||
icon="Add"
|
|
||||||
cta
|
|
||||||
on:click={initiateAppCreation}
|
|
||||||
>
|
|
||||||
{createAppButtonText}
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
dataCy="import-app-btn"
|
|
||||||
icon="Import"
|
|
||||||
size="L"
|
|
||||||
quiet
|
|
||||||
secondary
|
|
||||||
on:click={initiateAppImport}
|
|
||||||
>
|
|
||||||
Import app
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if !$apps?.length && $templates?.length}
|
|
||||||
<TemplateDisplay templates={$templates} />
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if enrichedApps.length}
|
{#if enrichedApps.length}
|
||||||
<Layout noPadding gap="L">
|
<Layout noPadding gap="L">
|
||||||
<div class="title">
|
<div class="title">
|
||||||
|
@ -333,27 +243,23 @@
|
||||||
<Button
|
<Button
|
||||||
dataCy="create-app-btn"
|
dataCy="create-app-btn"
|
||||||
size="M"
|
size="M"
|
||||||
icon="Add"
|
|
||||||
cta
|
cta
|
||||||
on:click={initiateAppCreation}
|
on:click={initiateAppCreation}
|
||||||
>
|
>
|
||||||
{createAppButtonText}
|
Create new app
|
||||||
</Button>
|
</Button>
|
||||||
{#if $apps?.length > 0}
|
{#if $apps?.length > 0}
|
||||||
<Button
|
<Button
|
||||||
icon="Experience"
|
|
||||||
size="M"
|
size="M"
|
||||||
quiet
|
|
||||||
secondary
|
secondary
|
||||||
on:click={$goto("/builder/portal/apps/templates")}
|
on:click={$goto("/builder/portal/apps/templates")}
|
||||||
>
|
>
|
||||||
Templates
|
View templates
|
||||||
</Button>
|
</Button>
|
||||||
{/if}
|
{/if}
|
||||||
{#if !$apps?.length}
|
{#if !$apps?.length}
|
||||||
<Button
|
<Button
|
||||||
dataCy="import-app-btn"
|
dataCy="import-app-btn"
|
||||||
icon="Import"
|
|
||||||
size="L"
|
size="L"
|
||||||
quiet
|
quiet
|
||||||
secondary
|
secondary
|
||||||
|
@ -366,55 +272,45 @@
|
||||||
{#if enrichedApps.length > 1}
|
{#if enrichedApps.length > 1}
|
||||||
<div class="app-actions">
|
<div class="app-actions">
|
||||||
{#if cloud}
|
{#if cloud}
|
||||||
<Button
|
<Icon
|
||||||
size="M"
|
name="Download"
|
||||||
icon="Export"
|
hoverable
|
||||||
quiet
|
|
||||||
secondary
|
|
||||||
on:click={initiateAppsExport}
|
on:click={initiateAppsExport}
|
||||||
>
|
|
||||||
Export apps
|
|
||||||
</Button>
|
|
||||||
{/if}
|
|
||||||
<div class="filter">
|
|
||||||
{#if $licensing.groupsEnabled}
|
|
||||||
<AccessFilter on:change={accessFilterAction} />
|
|
||||||
{/if}
|
|
||||||
<Select
|
|
||||||
quiet
|
|
||||||
autoWidth
|
|
||||||
bind:value={sortBy}
|
|
||||||
placeholder={null}
|
|
||||||
options={[
|
|
||||||
{ label: "Sort by name", value: "name" },
|
|
||||||
{ label: "Sort by recently updated", value: "updated" },
|
|
||||||
{ label: "Sort by status", value: "status" },
|
|
||||||
]}
|
|
||||||
/>
|
/>
|
||||||
<Search placeholder="Search" bind:value={searchTerm} />
|
{/if}
|
||||||
</div>
|
<Select
|
||||||
|
autoWidth
|
||||||
|
bind:value={sortBy}
|
||||||
|
placeholder={null}
|
||||||
|
options={[
|
||||||
|
{ label: "Sort by name", value: "name" },
|
||||||
|
{ label: "Sort by recently updated", value: "updated" },
|
||||||
|
{ label: "Sort by status", value: "status" },
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
<Search placeholder="Search" bind:value={searchTerm} />
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="appTable" class:unlocked>
|
<div class="app-table">
|
||||||
{#each filteredApps as app (app.appId)}
|
{#each filteredApps as app (app.appId)}
|
||||||
<AppRow {app} {editApp} {appOverview} />
|
<AppRow {app} />
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
</Layout>
|
</Layout>
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if creatingFromTemplate}
|
{#if creatingFromTemplate}
|
||||||
<div class="empty-wrapper">
|
<div class="empty-wrapper">
|
||||||
<img class="img-logo img-size" alt="logo" src={Logo} />
|
<img class="img-logo img-size" alt="logo" src={Logo} />
|
||||||
<p>Creating your Budibase app from your selected template...</p>
|
<p>Creating your Budibase app from your selected template...</p>
|
||||||
<Spinner size="10" />
|
<Spinner size="10" />
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</Layout>
|
</Layout>
|
||||||
</Page>
|
</Page>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<Modal
|
<Modal
|
||||||
bind:this={creationModal}
|
bind:this={creationModal}
|
||||||
|
@ -425,25 +321,9 @@
|
||||||
<CreateAppModal {template} />
|
<CreateAppModal {template} />
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
<Modal bind:this={updatingModal} padding={false} width="600px">
|
|
||||||
<UpdateAppModal app={selectedApp} />
|
|
||||||
</Modal>
|
|
||||||
|
|
||||||
<AppLimitModal bind:this={appLimitModal} />
|
<AppLimitModal bind:this={appLimitModal} />
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.appTable {
|
|
||||||
border-top: var(--border-light);
|
|
||||||
}
|
|
||||||
.app-actions {
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
.app-actions :global(> button) {
|
|
||||||
margin-right: 10px;
|
|
||||||
}
|
|
||||||
.title .welcome > .buttons {
|
|
||||||
padding-top: var(--spacing-l);
|
|
||||||
}
|
|
||||||
.title {
|
.title {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
@ -460,46 +340,27 @@
|
||||||
gap: var(--spacing-xl);
|
gap: var(--spacing-xl);
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
@media (max-width: 1000px) {
|
.app-actions {
|
||||||
.img-logo {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.filter {
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: var(--spacing-xl);
|
gap: var(--spacing-xl);
|
||||||
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
.appTable {
|
.app-actions :global(.spectrum-Textfield) {
|
||||||
display: grid;
|
max-width: 180px;
|
||||||
grid-template-rows: auto;
|
|
||||||
grid-template-columns: 1fr 1fr 1fr 1fr auto;
|
|
||||||
align-items: center;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.appTable.unlocked {
|
.app-table {
|
||||||
grid-template-columns: 1fr 1fr auto 1fr auto;
|
display: flex;
|
||||||
}
|
flex-direction: column;
|
||||||
|
justify-content: flex-start;
|
||||||
.appTable :global(> div) {
|
align-items: stretch;
|
||||||
height: 70px;
|
gap: var(--spacing-xl);
|
||||||
display: grid;
|
|
||||||
align-items: center;
|
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
|
||||||
.appTable :global(> div) {
|
|
||||||
border-bottom: var(--border-light);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 640px) {
|
|
||||||
.appTable {
|
|
||||||
grid-template-columns: 1fr auto !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.empty-wrapper {
|
.empty-wrapper {
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
@ -512,4 +373,26 @@
|
||||||
width: 160px;
|
width: 160px;
|
||||||
height: 160px;
|
height: 160px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: 1000px) {
|
||||||
|
.img-logo {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (max-width: 640px) {
|
||||||
|
.app-actions {
|
||||||
|
margin-top: var(--spacing-xl);
|
||||||
|
margin-bottom: calc(-1 * var(--spacing-m));
|
||||||
|
}
|
||||||
|
.app-actions :global(.spectrum-Textfield) {
|
||||||
|
max-width: none;
|
||||||
|
}
|
||||||
|
/* Hide download apps icon */
|
||||||
|
.app-actions :global(> .spectrum-Icon) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.app-actions > :global(*) {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,42 +1,18 @@
|
||||||
<script>
|
<script>
|
||||||
import { goto } from "@roxi/routify"
|
import { url } from "@roxi/routify"
|
||||||
import { Layout, Page, notifications, ActionButton } from "@budibase/bbui"
|
import { Layout, Page } from "@budibase/bbui"
|
||||||
import TemplateDisplay from "components/common/TemplateDisplay.svelte"
|
import TemplateDisplay from "components/common/TemplateDisplay.svelte"
|
||||||
import { onMount } from "svelte"
|
|
||||||
import { templates } from "stores/portal"
|
import { templates } from "stores/portal"
|
||||||
|
import { Breadcrumbs, Breadcrumb, Header } from "components/portal/page"
|
||||||
let loaded = $templates?.length
|
|
||||||
|
|
||||||
onMount(async () => {
|
|
||||||
try {
|
|
||||||
await templates.load()
|
|
||||||
if ($templates?.length === 0) {
|
|
||||||
notifications.error(
|
|
||||||
"There was a problem loading quick start templates."
|
|
||||||
)
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
notifications.error("Error loading apps and templates")
|
|
||||||
}
|
|
||||||
loaded = true
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Page wide>
|
<Page>
|
||||||
<Layout noPadding gap="XL">
|
<Layout noPadding gap="L">
|
||||||
<span>
|
<Breadcrumbs>
|
||||||
<ActionButton
|
<Breadcrumb url={$url("./")} text="Apps" />
|
||||||
secondary
|
<Breadcrumb text="Templates" />
|
||||||
icon={"ArrowLeft"}
|
</Breadcrumbs>
|
||||||
on:click={() => {
|
<Header title="Templates" />
|
||||||
$goto("../")
|
<TemplateDisplay templates={$templates} />
|
||||||
}}
|
|
||||||
>
|
|
||||||
Back
|
|
||||||
</ActionButton>
|
|
||||||
</span>
|
|
||||||
{#if loaded && $templates?.length}
|
|
||||||
<TemplateDisplay templates={$templates} />
|
|
||||||
{/if}
|
|
||||||
</Layout>
|
</Layout>
|
||||||
</Page>
|
</Page>
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
<script>
|
|
||||||
import { Page } from "@budibase/bbui"
|
|
||||||
import { auth } from "stores/portal"
|
|
||||||
import { page, redirect } from "@roxi/routify"
|
|
||||||
|
|
||||||
// Only admins allowed here
|
|
||||||
$: {
|
|
||||||
if (!$auth.isAdmin) {
|
|
||||||
$redirect("../")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$: wide = $page.path.includes("email/:template")
|
|
||||||
</script>
|
|
||||||
|
|
||||||
{#if $auth.isAdmin}
|
|
||||||
<Page maxWidth="90ch" {wide}>
|
|
||||||
<slot />
|
|
||||||
</Page>
|
|
||||||
{/if}
|
|
|
@ -1,15 +0,0 @@
|
||||||
<script>
|
|
||||||
import { Body, Menu, MenuItem, Detail } from "@budibase/bbui"
|
|
||||||
|
|
||||||
export let bindings
|
|
||||||
export let onBindingClick = () => {}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<Menu>
|
|
||||||
{#each bindings as binding}
|
|
||||||
<MenuItem on:click={() => onBindingClick(binding)}>
|
|
||||||
<Detail size="M">{binding.name}</Detail>
|
|
||||||
<Body size="XS">{binding.description}</Body>
|
|
||||||
</MenuItem>
|
|
||||||
{/each}
|
|
||||||
</Menu>
|
|
|
@ -1,264 +0,0 @@
|
||||||
<script>
|
|
||||||
import { goto } from "@roxi/routify"
|
|
||||||
import {
|
|
||||||
ActionButton,
|
|
||||||
Button,
|
|
||||||
Layout,
|
|
||||||
Heading,
|
|
||||||
Icon,
|
|
||||||
Popover,
|
|
||||||
notifications,
|
|
||||||
List,
|
|
||||||
ListItem,
|
|
||||||
StatusLight,
|
|
||||||
Divider,
|
|
||||||
ActionMenu,
|
|
||||||
MenuItem,
|
|
||||||
Modal,
|
|
||||||
} from "@budibase/bbui"
|
|
||||||
import UserGroupPicker from "components/settings/UserGroupPicker.svelte"
|
|
||||||
import { createPaginationStore } from "helpers/pagination"
|
|
||||||
import { users, apps, groups } from "stores/portal"
|
|
||||||
import { onMount } from "svelte"
|
|
||||||
import { RoleUtils } from "@budibase/frontend-core"
|
|
||||||
import { roles } from "stores/backend"
|
|
||||||
import ConfirmDialog from "components/common/ConfirmDialog.svelte"
|
|
||||||
import CreateEditGroupModal from "./_components/CreateEditGroupModal.svelte"
|
|
||||||
import GroupIcon from "./_components/GroupIcon.svelte"
|
|
||||||
import AppAddModal from "./_components/AppAddModal.svelte"
|
|
||||||
|
|
||||||
export let groupId
|
|
||||||
|
|
||||||
let popoverAnchor
|
|
||||||
let popover
|
|
||||||
let searchTerm = ""
|
|
||||||
let prevSearch = undefined
|
|
||||||
let pageInfo = createPaginationStore()
|
|
||||||
let loaded = false
|
|
||||||
let editModal, deleteModal, appAddModal
|
|
||||||
|
|
||||||
$: page = $pageInfo.page
|
|
||||||
$: fetchUsers(page, searchTerm)
|
|
||||||
$: group = $groups.find(x => x._id === groupId)
|
|
||||||
$: filtered = $users.data
|
|
||||||
$: groupApps = $apps.filter(app =>
|
|
||||||
groups.actions.getGroupAppIds(group).includes(apps.getProdAppID(app.devId))
|
|
||||||
)
|
|
||||||
$: {
|
|
||||||
if (loaded && !group?._id) {
|
|
||||||
$goto("./")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function fetchUsers(page, search) {
|
|
||||||
if ($pageInfo.loading) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// need to remove the page if they've started searching
|
|
||||||
if (search && !prevSearch) {
|
|
||||||
pageInfo.reset()
|
|
||||||
page = undefined
|
|
||||||
}
|
|
||||||
prevSearch = search
|
|
||||||
try {
|
|
||||||
pageInfo.loading()
|
|
||||||
await users.search({ page, email: search })
|
|
||||||
pageInfo.fetched($users.hasNextPage, $users.nextPage)
|
|
||||||
} catch (error) {
|
|
||||||
notifications.error("Error getting user list")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const getRoleLabel = appId => {
|
|
||||||
const roleId = group?.roles?.[apps.getProdAppID(appId)]
|
|
||||||
const role = $roles.find(x => x._id === roleId)
|
|
||||||
return role?.name || "Custom role"
|
|
||||||
}
|
|
||||||
|
|
||||||
async function deleteGroup() {
|
|
||||||
try {
|
|
||||||
await groups.actions.delete(group)
|
|
||||||
notifications.success("User group deleted successfully")
|
|
||||||
$goto("./")
|
|
||||||
} catch (error) {
|
|
||||||
notifications.error(`Failed to delete user group`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function saveGroup(group) {
|
|
||||||
try {
|
|
||||||
await groups.actions.save(group)
|
|
||||||
} catch (error) {
|
|
||||||
notifications.error(`Failed to save user group`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onMount(async () => {
|
|
||||||
try {
|
|
||||||
await Promise.all([groups.actions.init(), apps.load(), roles.fetch()])
|
|
||||||
loaded = true
|
|
||||||
} catch (error) {
|
|
||||||
notifications.error("Error fetching user group data")
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
{#if loaded}
|
|
||||||
<Layout noPadding gap="XL">
|
|
||||||
<div>
|
|
||||||
<ActionButton on:click={() => $goto("../groups")} icon="ArrowLeft">
|
|
||||||
Back
|
|
||||||
</ActionButton>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<Layout noPadding gap="M">
|
|
||||||
<div class="header">
|
|
||||||
<div class="title">
|
|
||||||
<GroupIcon {group} size="L" />
|
|
||||||
<div class="text-padding">
|
|
||||||
<Heading>{group?.name}</Heading>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<ActionMenu align="right">
|
|
||||||
<span slot="control">
|
|
||||||
<Icon hoverable name="More" />
|
|
||||||
</span>
|
|
||||||
<MenuItem icon="Refresh" on:click={() => editModal.show()}>
|
|
||||||
Edit
|
|
||||||
</MenuItem>
|
|
||||||
<MenuItem icon="Delete" on:click={() => deleteModal.show()}>
|
|
||||||
Delete
|
|
||||||
</MenuItem>
|
|
||||||
</ActionMenu>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<Divider />
|
|
||||||
|
|
||||||
<Layout noPadding gap="S">
|
|
||||||
<div class="header">
|
|
||||||
<Heading size="S">Users</Heading>
|
|
||||||
<div bind:this={popoverAnchor}>
|
|
||||||
<Button on:click={popover.show()} icon="UserAdd" cta>
|
|
||||||
Add user
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
<Popover align="right" bind:this={popover} anchor={popoverAnchor}>
|
|
||||||
<UserGroupPicker
|
|
||||||
bind:searchTerm
|
|
||||||
labelKey="email"
|
|
||||||
selected={group.users?.map(user => user._id)}
|
|
||||||
list={$users.data}
|
|
||||||
on:select={e => groups.actions.addUser(groupId, e.detail)}
|
|
||||||
on:deselect={e => groups.actions.removeUser(groupId, e.detail)}
|
|
||||||
/>
|
|
||||||
</Popover>
|
|
||||||
</div>
|
|
||||||
<List>
|
|
||||||
{#if group?.users.length}
|
|
||||||
{#each group.users as user}
|
|
||||||
<ListItem
|
|
||||||
title={user.email}
|
|
||||||
on:click={() => $goto(`../users/${user._id}`)}
|
|
||||||
hoverable
|
|
||||||
>
|
|
||||||
<Icon
|
|
||||||
on:click={e => {
|
|
||||||
groups.actions.removeUser(groupId, user._id)
|
|
||||||
e.stopPropagation()
|
|
||||||
}}
|
|
||||||
hoverable
|
|
||||||
size="S"
|
|
||||||
name="Close"
|
|
||||||
/>
|
|
||||||
</ListItem>
|
|
||||||
{/each}
|
|
||||||
{:else}
|
|
||||||
<ListItem icon="UserGroup" title="This user group has no users" />
|
|
||||||
{/if}
|
|
||||||
</List>
|
|
||||||
</Layout>
|
|
||||||
</Layout>
|
|
||||||
|
|
||||||
<Layout noPadding gap="S">
|
|
||||||
<div class="header">
|
|
||||||
<Heading size="S">Apps</Heading>
|
|
||||||
<div>
|
|
||||||
<Button on:click={appAddModal.show()} icon="ExperienceAdd" cta>
|
|
||||||
Add app
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<List>
|
|
||||||
{#if groupApps.length}
|
|
||||||
{#each groupApps as app}
|
|
||||||
<ListItem
|
|
||||||
title={app.name}
|
|
||||||
icon={app?.icon?.name || "Apps"}
|
|
||||||
iconColor={app?.icon?.color || ""}
|
|
||||||
on:click={() => $goto(`../../overview/${app.devId}`)}
|
|
||||||
hoverable
|
|
||||||
>
|
|
||||||
<div class="title ">
|
|
||||||
<StatusLight
|
|
||||||
square
|
|
||||||
color={RoleUtils.getRoleColour(
|
|
||||||
group.roles[apps.getProdAppID(app.devId)]
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
{getRoleLabel(app.devId)}
|
|
||||||
</StatusLight>
|
|
||||||
</div>
|
|
||||||
<Icon
|
|
||||||
on:click={e => {
|
|
||||||
groups.actions.removeApp(
|
|
||||||
groupId,
|
|
||||||
apps.getProdAppID(app.devId)
|
|
||||||
)
|
|
||||||
e.stopPropagation()
|
|
||||||
}}
|
|
||||||
hoverable
|
|
||||||
size="S"
|
|
||||||
name="Close"
|
|
||||||
/>
|
|
||||||
</ListItem>
|
|
||||||
{/each}
|
|
||||||
{:else}
|
|
||||||
<ListItem icon="Apps" title="This user group has access to no apps" />
|
|
||||||
{/if}
|
|
||||||
</List>
|
|
||||||
</Layout>
|
|
||||||
</Layout>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<Modal bind:this={editModal}>
|
|
||||||
<CreateEditGroupModal {group} {saveGroup} />
|
|
||||||
</Modal>
|
|
||||||
|
|
||||||
<Modal bind:this={appAddModal}>
|
|
||||||
<AppAddModal {group} />
|
|
||||||
</Modal>
|
|
||||||
|
|
||||||
<ConfirmDialog
|
|
||||||
bind:this={deleteModal}
|
|
||||||
title="Delete user group"
|
|
||||||
okText="Delete user group"
|
|
||||||
onOk={deleteGroup}
|
|
||||||
>
|
|
||||||
Are you sure you wish to delete <b>{group?.name}?</b>
|
|
||||||
</ConfirmDialog>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.header {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: flex-end;
|
|
||||||
}
|
|
||||||
.title {
|
|
||||||
display: flex;
|
|
||||||
justify-content: flex-start;
|
|
||||||
align-items: center;
|
|
||||||
gap: var(--spacing-m);
|
|
||||||
}
|
|
||||||
</style>
|
|
|
@ -1,3 +0,0 @@
|
||||||
<div style="float: right;">
|
|
||||||
<slot />
|
|
||||||
</div>
|
|
|
@ -0,0 +1,275 @@
|
||||||
|
<script>
|
||||||
|
import { url, isActive, goto } from "@roxi/routify"
|
||||||
|
import {
|
||||||
|
Page,
|
||||||
|
Layout,
|
||||||
|
Button,
|
||||||
|
Icon,
|
||||||
|
ActionMenu,
|
||||||
|
MenuItem,
|
||||||
|
Helpers,
|
||||||
|
Input,
|
||||||
|
Modal,
|
||||||
|
notifications,
|
||||||
|
} from "@budibase/bbui"
|
||||||
|
import {
|
||||||
|
Content,
|
||||||
|
SideNav,
|
||||||
|
SideNavItem,
|
||||||
|
Breadcrumbs,
|
||||||
|
Breadcrumb,
|
||||||
|
Header,
|
||||||
|
} from "components/portal/page"
|
||||||
|
import { apps, auth, overview } from "stores/portal"
|
||||||
|
import { AppStatus } from "constants"
|
||||||
|
import analytics, { Events, EventSource } from "analytics"
|
||||||
|
import { store } from "builderStore"
|
||||||
|
import AppLockModal from "components/common/AppLockModal.svelte"
|
||||||
|
import EditableIcon from "components/common/EditableIcon.svelte"
|
||||||
|
import { API } from "api"
|
||||||
|
import ConfirmDialog from "components/common/ConfirmDialog.svelte"
|
||||||
|
import ExportAppModal from "components/start/ExportAppModal.svelte"
|
||||||
|
import { syncURLToState } from "helpers/urlStateSync"
|
||||||
|
import * as routify from "@roxi/routify"
|
||||||
|
import { onDestroy } from "svelte"
|
||||||
|
|
||||||
|
// Keep URL and state in sync for selected screen ID
|
||||||
|
const stopSyncing = syncURLToState({
|
||||||
|
urlParam: "appId",
|
||||||
|
stateKey: "selectedAppId",
|
||||||
|
validate: id => $apps.some(app => app.devId === id),
|
||||||
|
fallbackUrl: "../../",
|
||||||
|
store: overview,
|
||||||
|
routify,
|
||||||
|
})
|
||||||
|
|
||||||
|
let exportModal
|
||||||
|
let deletionModal
|
||||||
|
let exportPublishedVersion = false
|
||||||
|
let deletionConfirmationAppName
|
||||||
|
|
||||||
|
$: app = $overview.selectedApp
|
||||||
|
$: appId = $overview.selectedAppId
|
||||||
|
$: initialiseApp(appId)
|
||||||
|
$: isPublished = app?.status === AppStatus.DEPLOYED
|
||||||
|
$: appLocked = !!app?.lockedBy
|
||||||
|
$: lockedByYou = $auth.user.email === app?.lockedBy?.email
|
||||||
|
|
||||||
|
const initialiseApp = async appId => {
|
||||||
|
try {
|
||||||
|
const pkg = await API.fetchAppPackage(appId)
|
||||||
|
await store.actions.initialise(pkg)
|
||||||
|
await API.syncApp(appId)
|
||||||
|
} catch (error) {
|
||||||
|
notifications.error("Error initialising app overview")
|
||||||
|
$goto("../../")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const viewApp = () => {
|
||||||
|
if (isPublished) {
|
||||||
|
analytics.captureEvent(Events.APP_VIEW_PUBLISHED, {
|
||||||
|
appId: $store.appId,
|
||||||
|
eventSource: EventSource.PORTAL,
|
||||||
|
})
|
||||||
|
window.open(`/app${app?.url}`, "_blank")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const editApp = () => {
|
||||||
|
if (appLocked && !lockedByYou) {
|
||||||
|
const identifier = app?.lockedBy?.firstName || app?.lockedBy?.email
|
||||||
|
notifications.warning(
|
||||||
|
`App locked by ${identifier}. Please allow lock to expire or have them unlock this app.`
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
$goto(`../../../app/${app.devId}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
const exportApp = opts => {
|
||||||
|
exportPublishedVersion = !!opts?.published
|
||||||
|
exportModal.show()
|
||||||
|
}
|
||||||
|
|
||||||
|
const copyAppId = async () => {
|
||||||
|
await Helpers.copyToClipboard(app.prodId)
|
||||||
|
notifications.success("App ID copied to clipboard")
|
||||||
|
}
|
||||||
|
|
||||||
|
const deleteApp = async () => {
|
||||||
|
try {
|
||||||
|
await API.deleteApp(app?.devId)
|
||||||
|
notifications.success("App deleted successfully")
|
||||||
|
$goto("../")
|
||||||
|
} catch (err) {
|
||||||
|
notifications.error("Error deleting app")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onDestroy(() => {
|
||||||
|
stopSyncing()
|
||||||
|
store.actions.reset()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#key appId}
|
||||||
|
<Page>
|
||||||
|
<Layout noPadding gap="L">
|
||||||
|
<Breadcrumbs>
|
||||||
|
<Breadcrumb url={$url("../")} text="Apps" />
|
||||||
|
<Breadcrumb text={app?.name} />
|
||||||
|
</Breadcrumbs>
|
||||||
|
<Header title={app?.name} wrap={false}>
|
||||||
|
<div slot="icon">
|
||||||
|
<EditableIcon
|
||||||
|
{app}
|
||||||
|
autoSave
|
||||||
|
size="XL"
|
||||||
|
name={app?.icon?.name || "Apps"}
|
||||||
|
color={app?.icon?.color}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div slot="buttons">
|
||||||
|
<AppLockModal {app} />
|
||||||
|
<span class="desktop">
|
||||||
|
<Button
|
||||||
|
size="M"
|
||||||
|
quiet
|
||||||
|
secondary
|
||||||
|
disabled={!isPublished}
|
||||||
|
on:click={viewApp}
|
||||||
|
dataCy="view-app"
|
||||||
|
>
|
||||||
|
View
|
||||||
|
</Button>
|
||||||
|
</span>
|
||||||
|
<span class="desktop">
|
||||||
|
<Button
|
||||||
|
size="M"
|
||||||
|
cta
|
||||||
|
disabled={appLocked && !lockedByYou}
|
||||||
|
on:click={editApp}
|
||||||
|
>
|
||||||
|
Edit
|
||||||
|
</Button>
|
||||||
|
</span>
|
||||||
|
<ActionMenu align="right" dataCy="app-overview-menu-popover">
|
||||||
|
<span slot="control" class="app-overview-actions-icon">
|
||||||
|
<Icon hoverable name="More" />
|
||||||
|
</span>
|
||||||
|
<span class="mobile">
|
||||||
|
<MenuItem icon="Globe" disabled={!isPublished} on:click={viewApp}>
|
||||||
|
View
|
||||||
|
</MenuItem>
|
||||||
|
</span>
|
||||||
|
<span class="mobile">
|
||||||
|
<MenuItem
|
||||||
|
icon="Edit"
|
||||||
|
disabled={appLocked && !lockedByYou}
|
||||||
|
on:click={editApp}
|
||||||
|
>
|
||||||
|
Edit
|
||||||
|
</MenuItem>
|
||||||
|
</span>
|
||||||
|
<MenuItem
|
||||||
|
on:click={() => exportApp({ published: false })}
|
||||||
|
icon="DownloadFromCloud"
|
||||||
|
>
|
||||||
|
Export latest
|
||||||
|
</MenuItem>
|
||||||
|
{#if isPublished}
|
||||||
|
<MenuItem
|
||||||
|
on:click={() => exportApp({ published: true })}
|
||||||
|
icon="DownloadFromCloudOutline"
|
||||||
|
>
|
||||||
|
Export published
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem on:click={copyAppId} icon="Copy">Copy app ID</MenuItem>
|
||||||
|
{/if}
|
||||||
|
{#if !isPublished}
|
||||||
|
<MenuItem on:click={deletionModal.show} icon="Delete">
|
||||||
|
Delete
|
||||||
|
</MenuItem>
|
||||||
|
{/if}
|
||||||
|
</ActionMenu>
|
||||||
|
</div>
|
||||||
|
</Header>
|
||||||
|
<Content showMobileNav>
|
||||||
|
<SideNav slot="side-nav">
|
||||||
|
<SideNavItem
|
||||||
|
text="Overview"
|
||||||
|
url={$url("./overview")}
|
||||||
|
active={$isActive("./overview")}
|
||||||
|
/>
|
||||||
|
<SideNavItem
|
||||||
|
text="Access"
|
||||||
|
url={$url("./access")}
|
||||||
|
active={$isActive("./access")}
|
||||||
|
/>
|
||||||
|
<SideNavItem
|
||||||
|
text="Automation History"
|
||||||
|
url={$url("./automation-history")}
|
||||||
|
active={$isActive("./automation-history")}
|
||||||
|
/>
|
||||||
|
<SideNavItem
|
||||||
|
text="Backups"
|
||||||
|
url={$url("./backups")}
|
||||||
|
active={$isActive("./backups")}
|
||||||
|
/>
|
||||||
|
<SideNavItem
|
||||||
|
text="Name and URL"
|
||||||
|
url={$url("./name-and-url")}
|
||||||
|
active={$isActive("./name-and-url")}
|
||||||
|
/>
|
||||||
|
<SideNavItem
|
||||||
|
text="Version"
|
||||||
|
url={$url("./version")}
|
||||||
|
active={$isActive("./version")}
|
||||||
|
/>
|
||||||
|
</SideNav>
|
||||||
|
<slot />
|
||||||
|
</Content>
|
||||||
|
</Layout>
|
||||||
|
</Page>
|
||||||
|
|
||||||
|
<Modal bind:this={exportModal} padding={false}>
|
||||||
|
<ExportAppModal {app} published={exportPublishedVersion} />
|
||||||
|
</Modal>
|
||||||
|
<ConfirmDialog
|
||||||
|
bind:this={deletionModal}
|
||||||
|
title="Delete app"
|
||||||
|
okText="Delete"
|
||||||
|
onOk={deleteApp}
|
||||||
|
onCancel={() => (deletionConfirmationAppName = null)}
|
||||||
|
disabled={deletionConfirmationAppName !== app?.name}
|
||||||
|
>
|
||||||
|
Are you sure you want to delete <b>{app?.name}</b>?
|
||||||
|
<br />
|
||||||
|
Please enter the app name below to confirm.
|
||||||
|
<br /><br />
|
||||||
|
<Input
|
||||||
|
bind:value={deletionConfirmationAppName}
|
||||||
|
data-cy="delete-app-confirmation"
|
||||||
|
placeholder={app?.name}
|
||||||
|
/>
|
||||||
|
</ConfirmDialog>
|
||||||
|
{/key}
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.desktop {
|
||||||
|
display: contents;
|
||||||
|
}
|
||||||
|
.mobile {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 640px) {
|
||||||
|
.desktop {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.mobile {
|
||||||
|
display: contents;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -14,6 +14,8 @@
|
||||||
|
|
||||||
export let app
|
export let app
|
||||||
export let appUsers = []
|
export let appUsers = []
|
||||||
|
export let showUsers = false
|
||||||
|
export let showGroups = false
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
const usersFetch = fetchData({
|
const usersFetch = fetchData({
|
||||||
|
@ -41,7 +43,8 @@
|
||||||
$: availableGroups = getAvailableGroups($groups, app.appId, search, data)
|
$: availableGroups = getAvailableGroups($groups, app.appId, search, data)
|
||||||
$: valid = data?.length && !data?.some(x => !x.id?.length || !x.role?.length)
|
$: valid = data?.length && !data?.some(x => !x.id?.length || !x.role?.length)
|
||||||
$: optionSections = {
|
$: optionSections = {
|
||||||
...($licensing.groupsEnabled &&
|
...(showGroups &&
|
||||||
|
$licensing.groupsEnabled &&
|
||||||
availableGroups.length && {
|
availableGroups.length && {
|
||||||
["User groups"]: {
|
["User groups"]: {
|
||||||
data: availableGroups,
|
data: availableGroups,
|
||||||
|
@ -51,13 +54,15 @@
|
||||||
getColour: group => group.color,
|
getColour: group => group.color,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
users: {
|
...(showUsers && {
|
||||||
data: availableUsers,
|
users: {
|
||||||
getLabel: user => user.email,
|
data: availableUsers,
|
||||||
getValue: user => user._id,
|
getLabel: user => user.email,
|
||||||
getIcon: user => user.icon,
|
getValue: user => user._id,
|
||||||
getColour: user => user.color,
|
getIcon: user => user.icon,
|
||||||
},
|
getColour: user => user.color,
|
||||||
|
},
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
|
|
||||||
const addData = async appData => {
|
const addData = async appData => {
|
||||||
|
@ -139,7 +144,7 @@
|
||||||
|
|
||||||
<ModalContent
|
<ModalContent
|
||||||
size="M"
|
size="M"
|
||||||
title="Assign users to your app"
|
title="Assign access to your app"
|
||||||
confirmText="Done"
|
confirmText="Done"
|
||||||
cancelText="Cancel"
|
cancelText="Cancel"
|
||||||
onConfirm={() => addData(data)}
|
onConfirm={() => addData(data)}
|
||||||
|
@ -185,7 +190,7 @@
|
||||||
</Layout>
|
</Layout>
|
||||||
{/if}
|
{/if}
|
||||||
<div>
|
<div>
|
||||||
<ActionButton on:click={addNewInput} icon="Add">Add email</ActionButton>
|
<ActionButton on:click={addNewInput} icon="Add">Add more</ActionButton>
|
||||||
</div>
|
</div>
|
||||||
</ModalContent>
|
</ModalContent>
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
<script>
|
||||||
|
import RoleSelect from "components/common/RoleSelect.svelte"
|
||||||
|
import { getContext } from "svelte"
|
||||||
|
|
||||||
|
const rolesContext = getContext("roles")
|
||||||
|
|
||||||
|
export let value
|
||||||
|
export let row
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<RoleSelect
|
||||||
|
{value}
|
||||||
|
quiet
|
||||||
|
allowRemove
|
||||||
|
allowPublic={false}
|
||||||
|
on:change={e => rolesContext.updateRole(e.detail, row._id)}
|
||||||
|
on:remove={() => rolesContext.removeRole(row._id)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
div {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,271 @@
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
Layout,
|
||||||
|
Heading,
|
||||||
|
Body,
|
||||||
|
Button,
|
||||||
|
Modal,
|
||||||
|
notifications,
|
||||||
|
Pagination,
|
||||||
|
Divider,
|
||||||
|
Table,
|
||||||
|
} from "@budibase/bbui"
|
||||||
|
import { onMount, setContext } from "svelte"
|
||||||
|
import { users, groups, apps, licensing, overview } from "stores/portal"
|
||||||
|
import AssignmentModal from "./_components/AssignmentModal.svelte"
|
||||||
|
import { roles } from "stores/backend"
|
||||||
|
import { API } from "api"
|
||||||
|
import { fetchData } from "@budibase/frontend-core"
|
||||||
|
import EditableRoleRenderer from "./_components/EditableRoleRenderer.svelte"
|
||||||
|
|
||||||
|
const userSchema = {
|
||||||
|
email: {
|
||||||
|
type: "string",
|
||||||
|
width: "1fr",
|
||||||
|
},
|
||||||
|
role: {
|
||||||
|
displayName: "Access",
|
||||||
|
width: "150px",
|
||||||
|
borderLeft: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
const groupSchema = {
|
||||||
|
name: {
|
||||||
|
type: "string",
|
||||||
|
width: "1fr",
|
||||||
|
},
|
||||||
|
role: {
|
||||||
|
displayName: "Access",
|
||||||
|
width: "150px",
|
||||||
|
borderLeft: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
const customRenderers = [
|
||||||
|
{
|
||||||
|
column: "role",
|
||||||
|
component: EditableRoleRenderer,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
let assignmentModal
|
||||||
|
let appGroups
|
||||||
|
let appUsers
|
||||||
|
let showAddUsers = false
|
||||||
|
let showAddGroups = false
|
||||||
|
|
||||||
|
$: app = $overview.selectedApp
|
||||||
|
$: devAppId = app.devId
|
||||||
|
$: prodAppId = apps.getProdAppID(app.devId)
|
||||||
|
$: usersFetch = fetchData({
|
||||||
|
API,
|
||||||
|
datasource: {
|
||||||
|
type: "user",
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
query: {
|
||||||
|
appId: apps.getProdAppID(devAppId),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
$: appUsers = getAppUsers($usersFetch.rows, prodAppId)
|
||||||
|
$: appGroups = getAppGroups($groups, prodAppId)
|
||||||
|
|
||||||
|
const getAppUsers = (users, appId) => {
|
||||||
|
return users.map(user => ({
|
||||||
|
...user,
|
||||||
|
role: user.roles[Object.keys(user.roles).find(x => x === appId)],
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
const getAppGroups = (allGroups, appId) => {
|
||||||
|
return allGroups
|
||||||
|
.filter(group => {
|
||||||
|
if (!group.roles) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return groups.actions.getGroupAppIds(group).includes(appId)
|
||||||
|
})
|
||||||
|
.map(group => ({
|
||||||
|
...group,
|
||||||
|
role: group.roles[
|
||||||
|
groups.actions.getGroupAppIds(group).find(x => x === appId)
|
||||||
|
],
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateRole = async (role, id) => {
|
||||||
|
// Check if this is a user or a group
|
||||||
|
if ($usersFetch.rows.some(user => user._id === id)) {
|
||||||
|
await updateUserRole(role, id)
|
||||||
|
} else {
|
||||||
|
await updateGroupRole(role, id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const removeRole = async id => {
|
||||||
|
// Check if this is a user or a group
|
||||||
|
if ($usersFetch.rows.some(user => user._id === id)) {
|
||||||
|
await removeUserRole(id)
|
||||||
|
} else {
|
||||||
|
await removeGroupRole(id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateUserRole = async (role, userId) => {
|
||||||
|
const user = $usersFetch.rows.find(user => user._id === userId)
|
||||||
|
if (!user) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
user.roles[prodAppId] = role
|
||||||
|
await users.save(user)
|
||||||
|
await usersFetch.refresh()
|
||||||
|
}
|
||||||
|
|
||||||
|
const removeUserRole = async userId => {
|
||||||
|
const user = $usersFetch.rows.find(user => user._id === userId)
|
||||||
|
if (!user) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const filteredRoles = { ...user.roles }
|
||||||
|
delete filteredRoles[prodAppId]
|
||||||
|
await users.save({
|
||||||
|
...user,
|
||||||
|
roles: {
|
||||||
|
...filteredRoles,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
await usersFetch.refresh()
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateGroupRole = async (role, groupId) => {
|
||||||
|
const group = $groups.find(group => group._id === groupId)
|
||||||
|
if (!group) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
await groups.actions.addApp(group._id, prodAppId, role)
|
||||||
|
await usersFetch.refresh()
|
||||||
|
}
|
||||||
|
|
||||||
|
const removeGroupRole = async groupId => {
|
||||||
|
const group = $groups.find(group => group._id === groupId)
|
||||||
|
if (!group) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
await groups.actions.removeApp(group._id, prodAppId)
|
||||||
|
await usersFetch.refresh()
|
||||||
|
}
|
||||||
|
|
||||||
|
const showUsersModal = () => {
|
||||||
|
showAddUsers = true
|
||||||
|
showAddGroups = false
|
||||||
|
assignmentModal.show()
|
||||||
|
}
|
||||||
|
|
||||||
|
const showGroupsModal = () => {
|
||||||
|
showAddUsers = false
|
||||||
|
showAddGroups = true
|
||||||
|
assignmentModal.show()
|
||||||
|
}
|
||||||
|
|
||||||
|
setContext("roles", {
|
||||||
|
updateRole,
|
||||||
|
removeRole,
|
||||||
|
})
|
||||||
|
|
||||||
|
onMount(async () => {
|
||||||
|
try {
|
||||||
|
await roles.fetch()
|
||||||
|
} catch (error) {
|
||||||
|
notifications.error(error)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Layout noPadding>
|
||||||
|
<Layout gap="XS" noPadding>
|
||||||
|
<Heading>Access</Heading>
|
||||||
|
<Body>Assign users to your app and set their access</Body>
|
||||||
|
</Layout>
|
||||||
|
<Divider />
|
||||||
|
<Layout noPadding gap="L">
|
||||||
|
{#if $usersFetch.loaded}
|
||||||
|
<Layout noPadding gap="S">
|
||||||
|
<div class="title">
|
||||||
|
<Heading size="S">Users</Heading>
|
||||||
|
<Button cta on:click={showUsersModal}>Assign user</Button>
|
||||||
|
</div>
|
||||||
|
<Table
|
||||||
|
customPlaceholder
|
||||||
|
data={appUsers}
|
||||||
|
schema={userSchema}
|
||||||
|
allowEditRows={false}
|
||||||
|
{customRenderers}
|
||||||
|
>
|
||||||
|
<div class="placeholder" slot="placeholder">
|
||||||
|
<Heading size="S">You have no users assigned yet</Heading>
|
||||||
|
</div>
|
||||||
|
</Table>
|
||||||
|
<div class="pagination">
|
||||||
|
<Pagination
|
||||||
|
page={$usersFetch.pageNumber + 1}
|
||||||
|
hasPrevPage={$usersFetch.hasPrevPage}
|
||||||
|
hasNextPage={$usersFetch.hasNextPage}
|
||||||
|
goToPrevPage={$usersFetch.loading ? null : usersFetch.prevPage}
|
||||||
|
goToNextPage={$usersFetch.loading ? null : usersFetch.nextPage}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</Layout>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#if $usersFetch.loaded && $licensing.groupsEnabled}
|
||||||
|
<Layout noPadding gap="S">
|
||||||
|
<div class="title">
|
||||||
|
<Heading size="S">Groups</Heading>
|
||||||
|
<Button cta on:click={showGroupsModal}>Assign group</Button>
|
||||||
|
</div>
|
||||||
|
<Table
|
||||||
|
customPlaceholder
|
||||||
|
data={appGroups}
|
||||||
|
schema={groupSchema}
|
||||||
|
allowEditRows={false}
|
||||||
|
{customRenderers}
|
||||||
|
>
|
||||||
|
<div class="placeholder" slot="placeholder">
|
||||||
|
<Heading size="S">You have no groups assigned yet</Heading>
|
||||||
|
</div>
|
||||||
|
</Table>
|
||||||
|
</Layout>
|
||||||
|
{/if}
|
||||||
|
</Layout>
|
||||||
|
</Layout>
|
||||||
|
|
||||||
|
<Modal bind:this={assignmentModal}>
|
||||||
|
<AssignmentModal
|
||||||
|
{app}
|
||||||
|
{appUsers}
|
||||||
|
on:update={usersFetch.refresh}
|
||||||
|
showGroups={showAddGroups}
|
||||||
|
showUsers={showAddUsers}
|
||||||
|
/>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.title {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: flex-end;
|
||||||
|
}
|
||||||
|
.placeholder {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.pagination {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: flex-end;
|
||||||
|
margin-top: calc(-1 * var(--spacing-s));
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,82 @@
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
Layout,
|
||||||
|
Body,
|
||||||
|
Button,
|
||||||
|
InlineAlert,
|
||||||
|
Heading,
|
||||||
|
Icon,
|
||||||
|
} from "@budibase/bbui"
|
||||||
|
import StatusRenderer from "./StatusRenderer.svelte"
|
||||||
|
import DateTimeRenderer from "components/common/renderers/DateTimeRenderer.svelte"
|
||||||
|
import TestDisplay from "components/automation/AutomationBuilder/TestDisplay.svelte"
|
||||||
|
import { goto } from "@roxi/routify"
|
||||||
|
import { automationStore } from "builderStore"
|
||||||
|
|
||||||
|
export let history
|
||||||
|
export let appId
|
||||||
|
export let close
|
||||||
|
const STOPPED_ERROR = "stopped_error"
|
||||||
|
|
||||||
|
$: exists = $automationStore.automations?.find(
|
||||||
|
auto => auto._id === history?.automationId
|
||||||
|
)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if history}
|
||||||
|
<Layout noPadding>
|
||||||
|
<div class="controls">
|
||||||
|
<StatusRenderer value={history.status} />
|
||||||
|
<Icon hoverable name="Close" on:click={close} />
|
||||||
|
</div>
|
||||||
|
<Layout noPadding gap="XS">
|
||||||
|
<Heading>{history.automationName}</Heading>
|
||||||
|
<DateTimeRenderer value={history.createdAt} />
|
||||||
|
</Layout>
|
||||||
|
{#if history.status === STOPPED_ERROR}
|
||||||
|
<div class="cron-error">
|
||||||
|
<InlineAlert
|
||||||
|
type="error"
|
||||||
|
header="CRON automation disabled"
|
||||||
|
message="Fix the error and re-publish your app to re-activate."
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
{#if exists}
|
||||||
|
<div>
|
||||||
|
<Button
|
||||||
|
secondary
|
||||||
|
on:click={() => {
|
||||||
|
$goto(`../../../../app/${appId}/automate/${history.automationId}`)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Edit automation
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
{#key history}
|
||||||
|
<div class="history">
|
||||||
|
<TestDisplay testResults={history} width="100%" />
|
||||||
|
</div>
|
||||||
|
{/key}
|
||||||
|
</Layout>
|
||||||
|
{:else}
|
||||||
|
<Body>No details found</Body>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.controls {
|
||||||
|
display: flex;
|
||||||
|
gap: var(--spacing-s);
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.cron-error {
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.history {
|
||||||
|
margin: 0 -30px;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,27 @@
|
||||||
|
<script>
|
||||||
|
import { Badge } from "@budibase/bbui"
|
||||||
|
export let value
|
||||||
|
|
||||||
|
$: isError = !value || value.toLowerCase() === "error"
|
||||||
|
$: isStoppedError = value?.toLowerCase() === "stopped_error"
|
||||||
|
$: isStopped = value?.toLowerCase() === "stopped" || isStoppedError
|
||||||
|
$: info = getInfo(isError, isStopped)
|
||||||
|
|
||||||
|
const getInfo = (error, stopped) => {
|
||||||
|
if (error) {
|
||||||
|
return { color: "red", message: "Error" }
|
||||||
|
} else if (stopped) {
|
||||||
|
return { color: "yellow", message: "Stopped" }
|
||||||
|
} else {
|
||||||
|
return { color: "green", message: "Success" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Badge
|
||||||
|
green={info.color === "green"}
|
||||||
|
red={info.color === "red"}
|
||||||
|
yellow={info.color === "yellow"}
|
||||||
|
>
|
||||||
|
{info.message}
|
||||||
|
</Badge>
|
|
@ -1,31 +1,41 @@
|
||||||
<script>
|
<script>
|
||||||
import { Layout, Table, Select, Pagination, Button } from "@budibase/bbui"
|
import {
|
||||||
|
Layout,
|
||||||
|
Table,
|
||||||
|
Select,
|
||||||
|
Pagination,
|
||||||
|
Button,
|
||||||
|
Body,
|
||||||
|
Heading,
|
||||||
|
Divider,
|
||||||
|
} from "@budibase/bbui"
|
||||||
import DateTimeRenderer from "components/common/renderers/DateTimeRenderer.svelte"
|
import DateTimeRenderer from "components/common/renderers/DateTimeRenderer.svelte"
|
||||||
import StatusRenderer from "./StatusRenderer.svelte"
|
import StatusRenderer from "./_components/StatusRenderer.svelte"
|
||||||
import HistoryDetailsPanel from "./HistoryDetailsPanel.svelte"
|
import HistoryDetailsPanel from "./_components/HistoryDetailsPanel.svelte"
|
||||||
import { automationStore } from "builderStore"
|
import { automationStore } from "builderStore"
|
||||||
import { createPaginationStore } from "helpers/pagination"
|
import { createPaginationStore } from "helpers/pagination"
|
||||||
import { onMount } from "svelte"
|
import { getContext, onDestroy, onMount } from "svelte"
|
||||||
import dayjs from "dayjs"
|
import dayjs from "dayjs"
|
||||||
import { auth, licensing, admin } from "stores/portal"
|
import { auth, licensing, admin, overview } from "stores/portal"
|
||||||
import { Constants } from "@budibase/frontend-core"
|
import { Constants } from "@budibase/frontend-core"
|
||||||
|
import Portal from "svelte-portal"
|
||||||
|
|
||||||
const ERROR = "error",
|
const ERROR = "error",
|
||||||
SUCCESS = "success",
|
SUCCESS = "success",
|
||||||
STOPPED = "stopped"
|
STOPPED = "stopped"
|
||||||
export let app
|
const sidePanel = getContext("side-panel")
|
||||||
|
|
||||||
$: licensePlan = $auth.user?.license?.plan
|
|
||||||
|
|
||||||
let pageInfo = createPaginationStore()
|
let pageInfo = createPaginationStore()
|
||||||
let runHistory = null
|
let runHistory = null
|
||||||
let showPanel = false
|
|
||||||
let selectedHistory = null
|
let selectedHistory = null
|
||||||
let automationOptions = []
|
let automationOptions = []
|
||||||
let automationId = null
|
let automationId = null
|
||||||
let status = null
|
let status = null
|
||||||
let timeRange = null
|
let timeRange = null
|
||||||
|
let loaded = false
|
||||||
|
|
||||||
|
$: licensePlan = $auth.user?.license?.plan
|
||||||
|
$: app = $overview.selectedApp
|
||||||
$: page = $pageInfo.page
|
$: page = $pageInfo.page
|
||||||
$: fetchLogs(automationId, status, page, timeRange)
|
$: fetchLogs(automationId, status, page, timeRange)
|
||||||
|
|
||||||
|
@ -47,8 +57,8 @@
|
||||||
|
|
||||||
const runHistorySchema = {
|
const runHistorySchema = {
|
||||||
status: { displayName: "Status" },
|
status: { displayName: "Status" },
|
||||||
createdAt: { displayName: "Time" },
|
|
||||||
automationName: { displayName: "Automation" },
|
automationName: { displayName: "Automation" },
|
||||||
|
createdAt: { displayName: "Time" },
|
||||||
}
|
}
|
||||||
|
|
||||||
const customRenderers = [
|
const customRenderers = [
|
||||||
|
@ -56,7 +66,16 @@
|
||||||
{ column: "status", component: StatusRenderer },
|
{ column: "status", component: StatusRenderer },
|
||||||
]
|
]
|
||||||
|
|
||||||
async function fetchLogs(automationId, status, page, timeRange) {
|
async function fetchLogs(
|
||||||
|
automationId,
|
||||||
|
status,
|
||||||
|
page,
|
||||||
|
timeRange,
|
||||||
|
force = false
|
||||||
|
) {
|
||||||
|
if (!force && !loaded) {
|
||||||
|
return
|
||||||
|
}
|
||||||
let startDate = null
|
let startDate = null
|
||||||
if (timeRange) {
|
if (timeRange) {
|
||||||
const [length, units] = timeRange.split("-")
|
const [length, units] = timeRange.split("-")
|
||||||
|
@ -101,35 +120,53 @@
|
||||||
|
|
||||||
function viewDetails({ detail }) {
|
function viewDetails({ detail }) {
|
||||||
selectedHistory = detail
|
selectedHistory = detail
|
||||||
showPanel = true
|
sidePanel.open()
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
await automationStore.actions.fetch()
|
await automationStore.actions.fetch()
|
||||||
const params = new URLSearchParams(window.location.search)
|
const params = new URLSearchParams(window.location.search)
|
||||||
const shouldOpen = params.get("open") === ERROR
|
const shouldOpen = params.get("open") === ERROR
|
||||||
// open with errors, open panel for latest
|
|
||||||
if (shouldOpen) {
|
if (shouldOpen) {
|
||||||
status = ERROR
|
status = ERROR
|
||||||
}
|
}
|
||||||
await automationStore.actions.fetch()
|
|
||||||
await fetchLogs(null, status)
|
|
||||||
if (shouldOpen) {
|
|
||||||
viewDetails({ detail: runHistory[0] })
|
|
||||||
}
|
|
||||||
automationOptions = []
|
automationOptions = []
|
||||||
for (let automation of $automationStore.automations) {
|
for (let automation of $automationStore.automations) {
|
||||||
automationOptions.push({ value: automation._id, label: automation.name })
|
automationOptions.push({ value: automation._id, label: automation.name })
|
||||||
}
|
}
|
||||||
|
await fetchLogs(automationId, status, 0, timeRange, true)
|
||||||
|
// Open the first automation info if one exists
|
||||||
|
if (shouldOpen && runHistory?.[0]) {
|
||||||
|
viewDetails({ detail: runHistory[0] })
|
||||||
|
}
|
||||||
|
loaded = true
|
||||||
|
})
|
||||||
|
|
||||||
|
onDestroy(() => {
|
||||||
|
sidePanel.close()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="root" class:panelOpen={showPanel}>
|
<Layout noPadding>
|
||||||
<Layout noPadding gap="M" alignContent="start">
|
<Layout gap="XS" noPadding>
|
||||||
|
<Heading>Automation History</Heading>
|
||||||
|
<Body>View the automations your app has executed</Body>
|
||||||
|
</Layout>
|
||||||
|
<Divider />
|
||||||
|
|
||||||
|
<div class="controls">
|
||||||
<div class="search">
|
<div class="search">
|
||||||
<div class="select">
|
<div class="select">
|
||||||
<Select
|
<Select
|
||||||
placeholder="All automations"
|
placeholder="All"
|
||||||
|
label="Status"
|
||||||
|
bind:value={status}
|
||||||
|
options={statusOptions}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="select">
|
||||||
|
<Select
|
||||||
|
placeholder="All"
|
||||||
label="Automation"
|
label="Automation"
|
||||||
bind:value={automationId}
|
bind:value={automationId}
|
||||||
options={automationOptions}
|
options={automationOptions}
|
||||||
|
@ -153,107 +190,74 @@
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="select">
|
|
||||||
<Select
|
|
||||||
placeholder="All status"
|
|
||||||
label="Status"
|
|
||||||
bind:value={status}
|
|
||||||
options={statusOptions}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
{#if (licensePlan?.type !== Constants.PlanType.ENTERPRISE && $auth.user.accountPortalAccess) || !$admin.cloud}
|
|
||||||
<div class="pro-upgrade">
|
|
||||||
<div class="pro-copy">Expand your automation log history</div>
|
|
||||||
<Button primary newStyles on:click={$licensing.goToUpgradePage()}>
|
|
||||||
Upgrade
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
</div>
|
</div>
|
||||||
{#if runHistory}
|
{#if (licensePlan?.type !== Constants.PlanType.ENTERPRISE && $auth.user.accountPortalAccess) || !$admin.cloud}
|
||||||
<div>
|
<Button secondary on:click={$licensing.goToUpgradePage()}>
|
||||||
<Table
|
Get more history
|
||||||
on:click={viewDetails}
|
</Button>
|
||||||
schema={runHistorySchema}
|
|
||||||
allowSelectRows={false}
|
|
||||||
allowEditColumns={false}
|
|
||||||
allowEditRows={false}
|
|
||||||
data={runHistory}
|
|
||||||
{customRenderers}
|
|
||||||
placeholderText="No history found"
|
|
||||||
border={false}
|
|
||||||
/>
|
|
||||||
<div class="pagination">
|
|
||||||
<Pagination
|
|
||||||
page={$pageInfo.pageNumber}
|
|
||||||
hasPrevPage={$pageInfo.loading ? false : $pageInfo.hasPrevPage}
|
|
||||||
hasNextPage={$pageInfo.loading ? false : $pageInfo.hasNextPage}
|
|
||||||
goToPrevPage={pageInfo.prevPage}
|
|
||||||
goToNextPage={pageInfo.nextPage}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/if}
|
{/if}
|
||||||
</Layout>
|
</div>
|
||||||
<div class="panel" class:panelShow={showPanel}>
|
|
||||||
|
{#if runHistory}
|
||||||
|
<div>
|
||||||
|
<Table
|
||||||
|
on:click={viewDetails}
|
||||||
|
schema={runHistorySchema}
|
||||||
|
allowSelectRows={false}
|
||||||
|
allowEditColumns={false}
|
||||||
|
allowEditRows={false}
|
||||||
|
data={runHistory}
|
||||||
|
{customRenderers}
|
||||||
|
placeholderText="No history found"
|
||||||
|
border={false}
|
||||||
|
/>
|
||||||
|
<div class="pagination">
|
||||||
|
<Pagination
|
||||||
|
page={$pageInfo.pageNumber}
|
||||||
|
hasPrevPage={$pageInfo.loading ? false : $pageInfo.hasPrevPage}
|
||||||
|
hasNextPage={$pageInfo.loading ? false : $pageInfo.hasNextPage}
|
||||||
|
goToPrevPage={pageInfo.prevPage}
|
||||||
|
goToNextPage={pageInfo.nextPage}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</Layout>
|
||||||
|
|
||||||
|
{#if selectedHistory}
|
||||||
|
<Portal target="#side-panel">
|
||||||
<HistoryDetailsPanel
|
<HistoryDetailsPanel
|
||||||
appId={app.devId}
|
appId={app.devId}
|
||||||
bind:history={selectedHistory}
|
bind:history={selectedHistory}
|
||||||
close={() => {
|
close={sidePanel.close}
|
||||||
showPanel = false
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</Portal>
|
||||||
</div>
|
{/if}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.root {
|
.controls {
|
||||||
display: grid;
|
display: flex;
|
||||||
grid-template-columns: 1fr;
|
flex-direction: row;
|
||||||
height: 100%;
|
gap: var(--spacing-xl);
|
||||||
padding: var(--spectrum-alias-grid-gutter-medium)
|
align-items: flex-end;
|
||||||
var(--spectrum-alias-grid-gutter-large);
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.search {
|
.search {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: var(--spacing-xl);
|
gap: var(--spacing-xl);
|
||||||
width: 100%;
|
align-items: flex-start;
|
||||||
align-items: flex-end;
|
flex: 1 0 auto;
|
||||||
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.select {
|
.select {
|
||||||
flex-basis: 150px;
|
flex: 1 1 0;
|
||||||
|
max-width: 150px;
|
||||||
|
min-width: 80px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pagination {
|
.pagination {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
margin-top: var(--spacing-xl);
|
margin-top: var(--spacing-xl);
|
||||||
}
|
}
|
||||||
|
|
||||||
.panel {
|
|
||||||
display: none;
|
|
||||||
margin-top: calc(-1 * var(--spectrum-alias-grid-gutter-medium));
|
|
||||||
}
|
|
||||||
|
|
||||||
.panelShow {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.panelOpen {
|
|
||||||
grid-template-columns: auto 420px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pro-upgrade {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: flex-end;
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pro-copy {
|
|
||||||
margin-right: var(--spacing-l);
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue