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: {
|
features: {
|
||||||
componentValidation: false,
|
componentValidation: false,
|
||||||
|
disableUserMetadata: false,
|
||||||
},
|
},
|
||||||
errors: [],
|
errors: [],
|
||||||
hasAppPackage: false,
|
hasAppPackage: false,
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
import { TableNames } from "constants"
|
import { TableNames } from "constants"
|
||||||
import { Grid } from "@budibase/frontend-core"
|
import { Grid } from "@budibase/frontend-core"
|
||||||
import { API } from "api"
|
import { API } from "api"
|
||||||
|
import { store } from "builderStore"
|
||||||
import GridAddColumnModal from "components/backend/DataTable/modals/grid/GridCreateColumnModal.svelte"
|
import GridAddColumnModal from "components/backend/DataTable/modals/grid/GridCreateColumnModal.svelte"
|
||||||
import GridCreateEditRowModal from "components/backend/DataTable/modals/grid/GridCreateEditRowModal.svelte"
|
import GridCreateEditRowModal from "components/backend/DataTable/modals/grid/GridCreateEditRowModal.svelte"
|
||||||
import GridEditUserModal from "components/backend/DataTable/modals/grid/GridEditUserModal.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"
|
import GridUsersTableButton from "components/backend/DataTable/modals/grid/GridUsersTableButton.svelte"
|
||||||
|
|
||||||
const userSchemaOverrides = {
|
const userSchemaOverrides = {
|
||||||
firstName: { displayName: "First name" },
|
firstName: { displayName: "First name", disabled: true },
|
||||||
lastName: { displayName: "Last name" },
|
lastName: { displayName: "Last name", disabled: true },
|
||||||
email: { displayName: "Email" },
|
email: { displayName: "Email", disabled: true },
|
||||||
roleId: { displayName: "Role" },
|
roleId: { displayName: "Role", disabled: true },
|
||||||
status: { displayName: "Status" },
|
status: { displayName: "Status", disabled: true },
|
||||||
}
|
}
|
||||||
|
|
||||||
$: id = $tables.selected?._id
|
$: id = $tables.selected?._id
|
||||||
|
@ -60,14 +61,14 @@
|
||||||
datasource={gridDatasource}
|
datasource={gridDatasource}
|
||||||
canAddRows={!isUsersTable}
|
canAddRows={!isUsersTable}
|
||||||
canDeleteRows={!isUsersTable}
|
canDeleteRows={!isUsersTable}
|
||||||
canEditRows={!isUsersTable}
|
canEditRows={!isUsersTable || !$store.features.disableUserMetadata}
|
||||||
canEditColumns={!isUsersTable}
|
canEditColumns={!isUsersTable || !$store.features.disableUserMetadata}
|
||||||
schemaOverrides={isUsersTable ? userSchemaOverrides : null}
|
schemaOverrides={isUsersTable ? userSchemaOverrides : null}
|
||||||
showAvatars={false}
|
showAvatars={false}
|
||||||
on:updatedatasource={handleGridTableUpdate}
|
on:updatedatasource={handleGridTableUpdate}
|
||||||
>
|
>
|
||||||
<svelte:fragment slot="filter">
|
<svelte:fragment slot="filter">
|
||||||
{#if isUsersTable}
|
{#if isUsersTable && $store.features.disableUserMetadata}
|
||||||
<GridUsersTableButton />
|
<GridUsersTableButton />
|
||||||
{/if}
|
{/if}
|
||||||
<GridFilterButton />
|
<GridFilterButton />
|
||||||
|
|
|
@ -289,6 +289,7 @@ async function performAppCreate(ctx: UserCtx) {
|
||||||
},
|
},
|
||||||
features: {
|
features: {
|
||||||
componentValidation: true,
|
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) {
|
if (!existing.features?.componentValidation) {
|
||||||
newApplication.features!.componentValidation = false
|
newApplication.features!.componentValidation = false
|
||||||
}
|
}
|
||||||
|
if (!existing.features?.disableUserMetadata) {
|
||||||
|
newApplication.features!.disableUserMetadata = false
|
||||||
|
}
|
||||||
|
|
||||||
// Migrate navigation settings and screens if required
|
// Migrate navigation settings and screens if required
|
||||||
if (existing) {
|
if (existing) {
|
||||||
|
|
|
@ -66,4 +66,5 @@ export interface AppIcon {
|
||||||
|
|
||||||
export interface AppFeatures {
|
export interface AppFeatures {
|
||||||
componentValidation?: boolean
|
componentValidation?: boolean
|
||||||
|
disableUserMetadata?: boolean
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue