1
0
Fork 0
mirror of synced 2024-07-04 22:11:23 +12:00

Merge pull request #13000 from Budibase/cheeks-fixes

Various fixes
This commit is contained in:
Andrew Kingston 2024-02-13 15:55:34 +00:00 committed by GitHub
commit 0d8a01a33c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 28 additions and 12 deletions

View file

@ -11,6 +11,7 @@
$: editing = app.sessions?.length
$: isBuilder = sdk.users.isBuilder($auth.user, app?.devId)
$: unclickable = !isBuilder && !app.deployed
const handleDefaultClick = () => {
if (!isBuilder) {
@ -31,11 +32,17 @@
}
const goToApp = () => {
window.open(`/app/${app.name}`, "_blank")
if (app.deployed && app.url) {
window.open(`/app${app.url}`, "_blank")
}
}
</script>
<div class="app-row" on:click={lockedAction || handleDefaultClick}>
<div
class="app-row"
on:click={lockedAction || handleDefaultClick}
class:unclickable
>
<div class="title">
<div class="app-icon">
<Icon size="L" name={app.icon?.name || "Apps"} color={app.icon?.color} />
@ -74,7 +81,7 @@
Edit
</Button>
</div>
{:else}
{:else if app.deployed}
<!-- this can happen if an app builder has app user access to an app -->
<div class="app-row-actions">
<Button size="S" secondary>View</Button>
@ -94,7 +101,7 @@
transition: border 130ms ease-out;
border: 1px solid transparent;
}
.app-row:hover {
.app-row:not(.unclickable):hover {
cursor: pointer;
border-color: var(--spectrum-global-color-gray-300);
}

View file

@ -113,6 +113,9 @@
// List of context keys which we use inside bindings
let knownContextKeyMap = {}
// Cleanup function to stop observing context changes when unmounting
let unobserve
// Set up initial state for each new component instance
$: initialise(instance)
@ -311,6 +314,11 @@
// Force an initial enrichment of the new settings
enrichComponentSettings(get(context), settingsDefinitionMap)
// Start observing changes in context now that we are initialised
if (!unobserve) {
unobserve = context.actions.observeChanges(handleContextChange)
}
}
// Extracts a map of all context keys which are required by action settings
@ -567,8 +575,8 @@
}
}
// Register an unregister component instance
onMount(() => {
// Register this component instance for external access
if ($appStore.isDevApp) {
if (!componentStore.actions.isComponentRegistered(id)) {
componentStore.actions.registerInstance(id, {
@ -581,16 +589,17 @@
state: store,
})
}
return () => {
if (componentStore.actions.isComponentRegistered(id)) {
componentStore.actions.unregisterInstance(id)
}
}
return () => {
// Unregister component
if (componentStore.actions.isComponentRegistered(id)) {
componentStore.actions.unregisterInstance(id)
}
// Stop observing context changes
unobserve?.()
}
})
// Observe changes to context
onMount(() => context.actions.observeChanges(handleContextChange))
</script>
{#if constructor && initialSettings && (visible || inSelectedPath) && !builderHidden}