Merge pull request #12006 from Budibase/user-metadata-changes
Allow user table changes in existing apps again
This commit is contained in:
commit
3ee5158345
|
@ -64,6 +64,7 @@ const INITIAL_FRONTEND_STATE = {
|
|||
},
|
||||
features: {
|
||||
componentValidation: false,
|
||||
disableUserMetadata: false,
|
||||
},
|
||||
errors: [],
|
||||
hasAppPackage: false,
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
import { TableNames } from "constants"
|
||||
import { Grid } from "@budibase/frontend-core"
|
||||
import { API } from "api"
|
||||
import { store } from "builderStore"
|
||||
import GridAddColumnModal from "components/backend/DataTable/modals/grid/GridCreateColumnModal.svelte"
|
||||
import GridCreateEditRowModal from "components/backend/DataTable/modals/grid/GridCreateEditRowModal.svelte"
|
||||
import GridEditUserModal from "components/backend/DataTable/modals/grid/GridEditUserModal.svelte"
|
||||
|
@ -17,11 +18,11 @@
|
|||
import GridUsersTableButton from "components/backend/DataTable/modals/grid/GridUsersTableButton.svelte"
|
||||
|
||||
const userSchemaOverrides = {
|
||||
firstName: { displayName: "First name" },
|
||||
lastName: { displayName: "Last name" },
|
||||
email: { displayName: "Email" },
|
||||
roleId: { displayName: "Role" },
|
||||
status: { displayName: "Status" },
|
||||
firstName: { displayName: "First name", disabled: true },
|
||||
lastName: { displayName: "Last name", disabled: true },
|
||||
email: { displayName: "Email", disabled: true },
|
||||
roleId: { displayName: "Role", disabled: true },
|
||||
status: { displayName: "Status", disabled: true },
|
||||
}
|
||||
|
||||
$: id = $tables.selected?._id
|
||||
|
@ -60,14 +61,14 @@
|
|||
datasource={gridDatasource}
|
||||
canAddRows={!isUsersTable}
|
||||
canDeleteRows={!isUsersTable}
|
||||
canEditRows={!isUsersTable}
|
||||
canEditColumns={!isUsersTable}
|
||||
canEditRows={!isUsersTable || !$store.features.disableUserMetadata}
|
||||
canEditColumns={!isUsersTable || !$store.features.disableUserMetadata}
|
||||
schemaOverrides={isUsersTable ? userSchemaOverrides : null}
|
||||
showAvatars={false}
|
||||
on:updatedatasource={handleGridTableUpdate}
|
||||
>
|
||||
<svelte:fragment slot="filter">
|
||||
{#if isUsersTable}
|
||||
{#if isUsersTable && $store.features.disableUserMetadata}
|
||||
<GridUsersTableButton />
|
||||
{/if}
|
||||
<GridFilterButton />
|
||||
|
|
|
@ -289,6 +289,7 @@ async function performAppCreate(ctx: UserCtx) {
|
|||
},
|
||||
features: {
|
||||
componentValidation: true,
|
||||
disableUserMetadata: true,
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -310,10 +311,13 @@ async function performAppCreate(ctx: UserCtx) {
|
|||
}
|
||||
})
|
||||
|
||||
// Keep existing validation setting
|
||||
// Keep existing feature flags
|
||||
if (!existing.features?.componentValidation) {
|
||||
newApplication.features!.componentValidation = false
|
||||
}
|
||||
if (!existing.features?.disableUserMetadata) {
|
||||
newApplication.features!.disableUserMetadata = false
|
||||
}
|
||||
|
||||
// Migrate navigation settings and screens if required
|
||||
if (existing) {
|
||||
|
|
|
@ -66,4 +66,5 @@ export interface AppIcon {
|
|||
|
||||
export interface AppFeatures {
|
||||
componentValidation?: boolean
|
||||
disableUserMetadata?: boolean
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue