diff --git a/packages/backend-core/src/db/conversions.js b/packages/backend-core/src/db/conversions.js index 90c04e9251..5b1a785ecc 100644 --- a/packages/backend-core/src/db/conversions.js +++ b/packages/backend-core/src/db/conversions.js @@ -36,6 +36,7 @@ exports.getDevelopmentAppID = appId => { const rest = split.join(APP_PREFIX) return `${APP_DEV_PREFIX}${rest}` } +exports.getDevAppID = exports.getDevelopmentAppID /** * Convert a development app ID to a deployed app ID. diff --git a/packages/builder/src/pages/builder/portal/_layout.svelte b/packages/builder/src/pages/builder/portal/_layout.svelte index 7a5d289ddd..cf9cd55b19 100644 --- a/packages/builder/src/pages/builder/portal/_layout.svelte +++ b/packages/builder/src/pages/builder/portal/_layout.svelte @@ -56,7 +56,7 @@ { title: "Plugins", href: "/builder/portal/manage/plugins", - badge: "Beta", + badge: "New", }, { diff --git a/packages/builder/src/pages/builder/portal/manage/groups/[groupId].svelte b/packages/builder/src/pages/builder/portal/manage/groups/[groupId].svelte index 23cdbff877..92d270931d 100644 --- a/packages/builder/src/pages/builder/portal/manage/groups/[groupId].svelte +++ b/packages/builder/src/pages/builder/portal/manage/groups/[groupId].svelte @@ -25,6 +25,7 @@ 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 @@ -34,8 +35,7 @@ let prevSearch = undefined let pageInfo = createPaginationStore() let loaded = false - let editModal - let deleteModal + let editModal, deleteModal, appAddModal $: page = $pageInfo.page $: fetchUsers(page, searchTerm) @@ -182,7 +182,14 @@ - Apps +
+ Apps +
+ +
+
{#if groupApps.length} {#each groupApps as app} @@ -203,6 +210,18 @@ {getRoleLabel(app.appId)} + { + groups.actions.removeApp( + groupId, + apps.getProdAppID(app.appId) + ) + e.stopPropagation() + }} + hoverable + size="S" + name="Close" + /> {/each} {:else} @@ -216,6 +235,11 @@ + + + + + + import { Body, ModalContent, Select } from "@budibase/bbui" + import { apps, groups } from "stores/portal" + import { roles } from "stores/backend" + import RoleSelect from "components/common/RoleSelect.svelte" + + export let group + + $: appOptions = $apps.map(app => ({ + label: app.name, + value: app, + })) + $: prodAppId = selectedApp ? apps.getProdAppID(selectedApp.appId) : "" + $: confirmDisabled = + (!selectingRole && !selectedApp) || (selectingRole && !selectedRoleId) + let selectedApp, selectedRoleId + let selectingRole = false + + async function appSelected() { + if (!selectingRole) { + selectingRole = true + await roles.fetchByAppId(prodAppId) + // return false to stop closing modal + return false + } else { + await groups.actions.addApp(group._id, prodAppId, selectedRoleId) + } + } + + + (selectingRole = false)} + disabled={confirmDisabled} +> + {#if !selectingRole} + Select an app to assign roles for members of "{group.name}" +