Merge master.
This commit is contained in:
commit
b8a3210286
|
@ -108,7 +108,7 @@ jobs:
|
||||||
- name: Pull testcontainers images
|
- name: Pull testcontainers images
|
||||||
run: |
|
run: |
|
||||||
docker pull testcontainers/ryuk:0.5.1 &
|
docker pull testcontainers/ryuk:0.5.1 &
|
||||||
docker pull budibase/couchdb:v3.3.3 &
|
docker pull budibase/couchdb:v3.3.3-sqs-v2.1.1 &
|
||||||
docker pull redis &
|
docker pull redis &
|
||||||
|
|
||||||
wait $(jobs -p)
|
wait $(jobs -p)
|
||||||
|
@ -179,7 +179,7 @@ jobs:
|
||||||
docker pull minio/minio &
|
docker pull minio/minio &
|
||||||
docker pull redis &
|
docker pull redis &
|
||||||
docker pull testcontainers/ryuk:0.5.1 &
|
docker pull testcontainers/ryuk:0.5.1 &
|
||||||
docker pull budibase/couchdb:v3.3.3 &
|
docker pull budibase/couchdb:v3.3.3-sqs-v2.1.1 &
|
||||||
|
|
||||||
wait $(jobs -p)
|
wait $(jobs -p)
|
||||||
|
|
||||||
|
|
|
@ -641,7 +641,7 @@ couchdb:
|
||||||
# @ignore
|
# @ignore
|
||||||
repository: budibase/couchdb
|
repository: budibase/couchdb
|
||||||
# @ignore
|
# @ignore
|
||||||
tag: v3.3.3
|
tag: v3.3.3-sqs-v2.1.1
|
||||||
# @ignore
|
# @ignore
|
||||||
pullPolicy: Always
|
pullPolicy: Always
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ export default async function setup() {
|
||||||
await killContainers(containers)
|
await killContainers(containers)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const couchdb = new GenericContainer("budibase/couchdb:v3.3.3")
|
const couchdb = new GenericContainer("budibase/couchdb:v3.3.3-sqs-v2.1.1")
|
||||||
.withExposedPorts(5984, 4984)
|
.withExposedPorts(5984, 4984)
|
||||||
.withEnvironment({
|
.withEnvironment({
|
||||||
COUCHDB_PASSWORD: "budibase",
|
COUCHDB_PASSWORD: "budibase",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
ARG BASEIMG=budibase/couchdb:v3.3.3
|
ARG BASEIMG=budibase/couchdb:v3.3.3-sqs-v2.1.1
|
||||||
FROM node:20-slim as build
|
FROM node:20-slim as build
|
||||||
|
|
||||||
# install node-gyp dependencies
|
# install node-gyp dependencies
|
||||||
|
|
|
@ -102,10 +102,6 @@ export const useAppBuilders = () => {
|
||||||
return useFeature(Feature.APP_BUILDERS)
|
return useFeature(Feature.APP_BUILDERS)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useViewReadonlyColumns = () => {
|
|
||||||
return useFeature(Feature.VIEW_READONLY_COLUMNS)
|
|
||||||
}
|
|
||||||
|
|
||||||
// QUOTAS
|
// QUOTAS
|
||||||
|
|
||||||
export const setAutomationLogsQuota = (value: number) => {
|
export const setAutomationLogsQuota = (value: number) => {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import { viewsV2 } from "stores/builder"
|
import { viewsV2 } from "stores/builder"
|
||||||
import { admin, licensing } from "stores/portal"
|
import { admin } from "stores/portal"
|
||||||
import { Grid } from "@budibase/frontend-core"
|
import { Grid } from "@budibase/frontend-core"
|
||||||
import { API } from "api"
|
import { API } from "api"
|
||||||
import GridCreateEditRowModal from "components/backend/DataTable/modals/grid/GridCreateEditRowModal.svelte"
|
import GridCreateEditRowModal from "components/backend/DataTable/modals/grid/GridCreateEditRowModal.svelte"
|
||||||
|
@ -30,7 +30,6 @@
|
||||||
showAvatars={false}
|
showAvatars={false}
|
||||||
on:updatedatasource={handleGridViewUpdate}
|
on:updatedatasource={handleGridViewUpdate}
|
||||||
isCloud={$admin.cloud}
|
isCloud={$admin.cloud}
|
||||||
allowViewReadonlyColumns={$licensing.isViewReadonlyColumnsEnabled}
|
|
||||||
canSetRelationshipSchemas={isEnabled(FeatureFlag.ENRICHED_RELATIONSHIPS)}
|
canSetRelationshipSchemas={isEnabled(FeatureFlag.ENRICHED_RELATIONSHIPS)}
|
||||||
>
|
>
|
||||||
<svelte:fragment slot="filter">
|
<svelte:fragment slot="filter">
|
||||||
|
|
|
@ -140,10 +140,6 @@ export const createLicensingStore = () => {
|
||||||
Constants.Features.VIEW_PERMISSIONS
|
Constants.Features.VIEW_PERMISSIONS
|
||||||
)
|
)
|
||||||
|
|
||||||
const isViewReadonlyColumnsEnabled = license.features.includes(
|
|
||||||
Constants.Features.VIEW_READONLY_COLUMNS
|
|
||||||
)
|
|
||||||
|
|
||||||
const budibaseAIEnabled = license.features.includes(
|
const budibaseAIEnabled = license.features.includes(
|
||||||
Constants.Features.BUDIBASE_AI
|
Constants.Features.BUDIBASE_AI
|
||||||
)
|
)
|
||||||
|
@ -173,7 +169,6 @@ export const createLicensingStore = () => {
|
||||||
triggerAutomationRunEnabled,
|
triggerAutomationRunEnabled,
|
||||||
isViewPermissionsEnabled,
|
isViewPermissionsEnabled,
|
||||||
perAppBuildersEnabled,
|
perAppBuildersEnabled,
|
||||||
isViewReadonlyColumnsEnabled,
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
|
@ -4,16 +4,13 @@
|
||||||
import ColumnsSettingContent from "./ColumnsSettingContent.svelte"
|
import ColumnsSettingContent from "./ColumnsSettingContent.svelte"
|
||||||
import { FieldPermissions } from "../../../constants"
|
import { FieldPermissions } from "../../../constants"
|
||||||
|
|
||||||
export let allowViewReadonlyColumns = false
|
|
||||||
|
|
||||||
const { columns, datasource } = getContext("grid")
|
const { columns, datasource } = getContext("grid")
|
||||||
|
|
||||||
let open = false
|
let open = false
|
||||||
let anchor
|
let anchor
|
||||||
|
|
||||||
$: anyRestricted = $columns.filter(col => !col.visible || col.readonly).length
|
$: anyRestricted = $columns.filter(col => !col.visible || col.readonly).length
|
||||||
$: text = anyRestricted ? `Columns (${anyRestricted} restricted)` : "Columns"
|
$: text = anyRestricted ? `Columns: (${anyRestricted} restricted)` : "Columns"
|
||||||
|
|
||||||
$: permissions =
|
$: permissions =
|
||||||
$datasource.type === "viewV2"
|
$datasource.type === "viewV2"
|
||||||
? [
|
? [
|
||||||
|
@ -22,9 +19,6 @@
|
||||||
FieldPermissions.HIDDEN,
|
FieldPermissions.HIDDEN,
|
||||||
]
|
]
|
||||||
: [FieldPermissions.WRITABLE, FieldPermissions.HIDDEN]
|
: [FieldPermissions.WRITABLE, FieldPermissions.HIDDEN]
|
||||||
$: disabledPermissions = allowViewReadonlyColumns
|
|
||||||
? []
|
|
||||||
: [FieldPermissions.READONLY]
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div bind:this={anchor}>
|
<div bind:this={anchor}>
|
||||||
|
@ -41,9 +35,5 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Popover bind:open {anchor} align="left">
|
<Popover bind:open {anchor} align="left">
|
||||||
<ColumnsSettingContent
|
<ColumnsSettingContent columns={$columns} {permissions} />
|
||||||
columns={$columns}
|
|
||||||
{permissions}
|
|
||||||
{disabledPermissions}
|
|
||||||
/>
|
|
||||||
</Popover>
|
</Popover>
|
||||||
|
|
|
@ -58,7 +58,6 @@
|
||||||
export let buttons = null
|
export let buttons = null
|
||||||
export let darkMode
|
export let darkMode
|
||||||
export let isCloud = null
|
export let isCloud = null
|
||||||
export let allowViewReadonlyColumns = false
|
|
||||||
export let rowConditions = null
|
export let rowConditions = null
|
||||||
|
|
||||||
// Unique identifier for DOM nodes inside this instance
|
// Unique identifier for DOM nodes inside this instance
|
||||||
|
@ -115,7 +114,6 @@
|
||||||
buttons,
|
buttons,
|
||||||
darkMode,
|
darkMode,
|
||||||
isCloud,
|
isCloud,
|
||||||
allowViewReadonlyColumns,
|
|
||||||
rowConditions,
|
rowConditions,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -157,7 +155,7 @@
|
||||||
<div class="controls-left">
|
<div class="controls-left">
|
||||||
<slot name="filter" />
|
<slot name="filter" />
|
||||||
<SortButton />
|
<SortButton />
|
||||||
<ColumnsSettingButton {allowViewReadonlyColumns} />
|
<ColumnsSettingButton />
|
||||||
<SizeButton />
|
<SizeButton />
|
||||||
<slot name="controls" />
|
<slot name="controls" />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -310,10 +310,6 @@ describe.each([
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("readonly fields", () => {
|
describe("readonly fields", () => {
|
||||||
beforeEach(() => {
|
|
||||||
mocks.licenses.useViewReadonlyColumns()
|
|
||||||
})
|
|
||||||
|
|
||||||
it("readonly fields are persisted", async () => {
|
it("readonly fields are persisted", async () => {
|
||||||
const table = await config.api.table.save(
|
const table = await config.api.table.save(
|
||||||
saveTableRequest({
|
saveTableRequest({
|
||||||
|
@ -437,7 +433,7 @@ describe.each([
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it("readonly fields cannot be used on free license", async () => {
|
it("readonly fields can be used on free license", async () => {
|
||||||
mocks.licenses.useCloudFree()
|
mocks.licenses.useCloudFree()
|
||||||
const table = await config.api.table.save(
|
const table = await config.api.table.save(
|
||||||
saveTableRequest({
|
saveTableRequest({
|
||||||
|
@ -467,11 +463,7 @@ describe.each([
|
||||||
}
|
}
|
||||||
|
|
||||||
await config.api.viewV2.create(newView, {
|
await config.api.viewV2.create(newView, {
|
||||||
status: 400,
|
status: 201,
|
||||||
body: {
|
|
||||||
message: "Readonly fields are not enabled",
|
|
||||||
status: 400,
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -514,7 +506,6 @@ describe.each([
|
||||||
})
|
})
|
||||||
|
|
||||||
it("display fields can be readonly", async () => {
|
it("display fields can be readonly", async () => {
|
||||||
mocks.licenses.useViewReadonlyColumns()
|
|
||||||
const table = await config.api.table.save(
|
const table = await config.api.table.save(
|
||||||
saveTableRequest({
|
saveTableRequest({
|
||||||
schema: {
|
schema: {
|
||||||
|
@ -589,7 +580,6 @@ describe.each([
|
||||||
})
|
})
|
||||||
|
|
||||||
it("can update all fields", async () => {
|
it("can update all fields", async () => {
|
||||||
mocks.licenses.useViewReadonlyColumns()
|
|
||||||
const tableId = table._id!
|
const tableId = table._id!
|
||||||
|
|
||||||
const updatedData: Required<UpdateViewRequest> = {
|
const updatedData: Required<UpdateViewRequest> = {
|
||||||
|
@ -803,71 +793,6 @@ describe.each([
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("cannot update views with readonly on on free license", async () => {
|
|
||||||
mocks.licenses.useViewReadonlyColumns()
|
|
||||||
|
|
||||||
view = await config.api.viewV2.update({
|
|
||||||
...view,
|
|
||||||
schema: {
|
|
||||||
id: { visible: true },
|
|
||||||
Price: {
|
|
||||||
visible: true,
|
|
||||||
readonly: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
mocks.licenses.useCloudFree()
|
|
||||||
await config.api.viewV2.update(view, {
|
|
||||||
status: 400,
|
|
||||||
body: {
|
|
||||||
message: "Readonly fields are not enabled",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
it("can remove readonly config after license downgrade", async () => {
|
|
||||||
mocks.licenses.useViewReadonlyColumns()
|
|
||||||
|
|
||||||
view = await config.api.viewV2.update({
|
|
||||||
...view,
|
|
||||||
schema: {
|
|
||||||
id: { visible: true },
|
|
||||||
Price: {
|
|
||||||
visible: true,
|
|
||||||
readonly: true,
|
|
||||||
},
|
|
||||||
Category: {
|
|
||||||
visible: true,
|
|
||||||
readonly: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
mocks.licenses.useCloudFree()
|
|
||||||
const res = await config.api.viewV2.update({
|
|
||||||
...view,
|
|
||||||
schema: {
|
|
||||||
id: { visible: true },
|
|
||||||
Price: {
|
|
||||||
visible: true,
|
|
||||||
readonly: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
expect(res).toEqual(
|
|
||||||
expect.objectContaining({
|
|
||||||
...view,
|
|
||||||
schema: {
|
|
||||||
id: { visible: true },
|
|
||||||
Price: {
|
|
||||||
visible: true,
|
|
||||||
readonly: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
isInternal &&
|
isInternal &&
|
||||||
it("updating schema will only validate modified field", async () => {
|
it("updating schema will only validate modified field", async () => {
|
||||||
let view = await config.api.viewV2.create({
|
let view = await config.api.viewV2.create({
|
||||||
|
@ -1047,7 +972,6 @@ describe.each([
|
||||||
})
|
})
|
||||||
|
|
||||||
it("should be able to fetch readonly config after downgrades", async () => {
|
it("should be able to fetch readonly config after downgrades", async () => {
|
||||||
mocks.licenses.useViewReadonlyColumns()
|
|
||||||
const res = await config.api.viewV2.create({
|
const res = await config.api.viewV2.create({
|
||||||
name: generator.name(),
|
name: generator.name(),
|
||||||
tableId: table._id!,
|
tableId: table._id!,
|
||||||
|
@ -1113,8 +1037,6 @@ describe.each([
|
||||||
})
|
})
|
||||||
|
|
||||||
it("rejects if field is readonly in any view", async () => {
|
it("rejects if field is readonly in any view", async () => {
|
||||||
mocks.licenses.useViewReadonlyColumns()
|
|
||||||
|
|
||||||
await config.api.viewV2.create({
|
await config.api.viewV2.create({
|
||||||
name: "view a",
|
name: "view a",
|
||||||
tableId: table._id!,
|
tableId: table._id!,
|
||||||
|
@ -1539,7 +1461,6 @@ describe.each([
|
||||||
})
|
})
|
||||||
|
|
||||||
it("can't persist readonly columns", async () => {
|
it("can't persist readonly columns", async () => {
|
||||||
mocks.licenses.useViewReadonlyColumns()
|
|
||||||
const view = await config.api.viewV2.create({
|
const view = await config.api.viewV2.create({
|
||||||
tableId: table._id!,
|
tableId: table._id!,
|
||||||
name: generator.guid(),
|
name: generator.guid(),
|
||||||
|
@ -1608,7 +1529,6 @@ describe.each([
|
||||||
})
|
})
|
||||||
|
|
||||||
it("can't update readonly columns", async () => {
|
it("can't update readonly columns", async () => {
|
||||||
mocks.licenses.useViewReadonlyColumns()
|
|
||||||
const view = await config.api.viewV2.create({
|
const view = await config.api.viewV2.create({
|
||||||
tableId: table._id!,
|
tableId: table._id!,
|
||||||
name: generator.guid(),
|
name: generator.guid(),
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import {
|
import {
|
||||||
BasicViewUIFieldMetadata,
|
|
||||||
FieldType,
|
FieldType,
|
||||||
RelationSchemaField,
|
RelationSchemaField,
|
||||||
RenameColumn,
|
RenameColumn,
|
||||||
|
@ -11,7 +10,6 @@ import {
|
||||||
ViewV2Enriched,
|
ViewV2Enriched,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
import { HTTPError } from "@budibase/backend-core"
|
import { HTTPError } from "@budibase/backend-core"
|
||||||
import { features } from "@budibase/pro"
|
|
||||||
import {
|
import {
|
||||||
helpers,
|
helpers,
|
||||||
PROTECTED_EXTERNAL_COLUMNS,
|
PROTECTED_EXTERNAL_COLUMNS,
|
||||||
|
@ -111,15 +109,8 @@ async function checkReadonlyFields(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (viewFieldSchema.readonly) {
|
if (viewSchema[field].readonly) {
|
||||||
if (
|
if (!viewSchema[field].visible) {
|
||||||
!(await features.isViewReadonlyColumnsEnabled()) &&
|
|
||||||
!(tableFieldSchema as BasicViewUIFieldMetadata).readonly
|
|
||||||
) {
|
|
||||||
throw new HTTPError(`Readonly fields are not enabled`, 400)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!viewFieldSchema.visible) {
|
|
||||||
throw new HTTPError(
|
throw new HTTPError(
|
||||||
`Field "${field}" must be visible if you want to make it readonly`,
|
`Field "${field}" must be visible if you want to make it readonly`,
|
||||||
400
|
400
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
|
|
||||||
yarn build:apps
|
yarn build:apps
|
||||||
version=$(./scripts/getCurrentVersion.sh)
|
version=$(./scripts/getCurrentVersion.sh)
|
||||||
docker build -f hosting/single/Dockerfile -t budibase:sqs --build-arg BUDIBASE_VERSION=$version --build-arg TARGETBUILD=single --build-arg BASEIMG=budibase/couchdb:v3.3.3-sqs .
|
docker build -f hosting/single/Dockerfile -t budibase:sqs --build-arg BUDIBASE_VERSION=$version --build-arg TARGETBUILD=single --build-arg BASEIMG=budibase/couchdb:v3.3.3-sqs-v2.1.1 .
|
||||||
|
|
Loading…
Reference in New Issue