1
0
Fork 0
mirror of synced 2024-06-14 00:14:39 +12:00

Formating.

This commit is contained in:
mike12345567 2021-02-15 19:59:49 +00:00
parent 0b0101da10
commit 7acd429c78
4 changed files with 33 additions and 35 deletions

View file

@ -10,7 +10,12 @@
import { cloneDeep } from "lodash/fp"
import { backendUiStore } from "builderStore"
import { TableNames, UNEDITABLE_USER_FIELDS } from "constants"
import { FIELDS, getAutoColumnInformation, buildAutoColumn, AUTO_COLUMN_SUB_TYPES } from "constants/backend"
import {
FIELDS,
getAutoColumnInformation,
buildAutoColumn,
AUTO_COLUMN_SUB_TYPES,
} from "constants/backend"
import { notifier } from "builderStore/store/notifications"
import ValuesList from "components/common/ValuesList.svelte"
import DatePicker from "components/common/DatePicker.svelte"
@ -45,15 +50,21 @@
UNEDITABLE_USER_FIELDS.includes(field.name)
// used to select what different options can be displayed for column type
$: canBeSearched = field.type !== 'link' &&
field.subtype !== AUTO_COLUMN_SUB_TYPES.CREATED_BY &&
field.subtype !== AUTO_COLUMN_SUB_TYPES.UPDATED_BY
$: canBeDisplay = field.type !== 'link' && field.type !== AUTO_COL
$: canBeRequired = field.type !== 'link' && !uneditable && field.type !== AUTO_COL
$: canBeSearched =
field.type !== "link" &&
field.subtype !== AUTO_COLUMN_SUB_TYPES.CREATED_BY &&
field.subtype !== AUTO_COLUMN_SUB_TYPES.UPDATED_BY
$: canBeDisplay = field.type !== "link" && field.type !== AUTO_COL
$: canBeRequired =
field.type !== "link" && !uneditable && field.type !== AUTO_COL
async function saveColumn() {
if (field.type === AUTO_COL) {
field = buildAutoColumn($backendUiStore.draftTable.name, field.name, field.subtype)
field = buildAutoColumn(
$backendUiStore.draftTable.name,
field.name,
field.subtype
)
}
backendUiStore.update(state => {
backendUiStore.actions.tables.saveField({
@ -78,9 +89,7 @@
}
function handleFieldConstraints(event) {
const definition = fieldDefinitions[
event.target.value.toUpperCase()
]
const definition = fieldDefinitions[event.target.value.toUpperCase()]
if (!definition) {
return
}

View file

@ -30,7 +30,9 @@
<div class="popover">
<h5>Who Can Access This Data?</h5>
<div class="note">
<Label extraSmall grey>Specify the minimum access level role for this data.</Label>
<Label extraSmall grey>
Specify the minimum access level role for this data.
</Label>
</div>
<Spacer large />
<div class="row">

View file

@ -2,12 +2,7 @@
import { goto } from "@sveltech/routify"
import { backendUiStore, store } from "builderStore"
import { notifier } from "builderStore/store/notifications"
import {
Input,
Label,
ModalContent,
Toggle,
} from "@budibase/bbui"
import { Input, Label, ModalContent, Toggle } from "@budibase/bbui"
import TableDataImport from "../TableDataImport.svelte"
import analytics from "analytics"
import screenTemplates from "builderStore/store/screenTemplates"
@ -109,23 +104,13 @@
<Label extraSmall grey>Auto Columns</Label>
<div class="toggles">
<div class="toggle-1">
<Toggle
text="Created by"
bind:checked={autoColumns.createdBy} />
<Toggle
text="Created at"
bind:checked={autoColumns.createdAt} />
<Toggle
text="Auto ID"
bind:checked={autoColumns.autoID} />
<Toggle text="Created by" bind:checked={autoColumns.createdBy} />
<Toggle text="Created at" bind:checked={autoColumns.createdAt} />
<Toggle text="Auto ID" bind:checked={autoColumns.autoID} />
</div>
<div class="toggle-2">
<Toggle
text="Updated by"
bind:checked={autoColumns.updatedBy} />
<Toggle
text="Updated at"
bind:checked={autoColumns.updatedAt} />
<Toggle text="Updated by" bind:checked={autoColumns.updatedBy} />
<Toggle text="Updated at" bind:checked={autoColumns.updatedAt} />
</div>
</div>
</div>

View file

@ -79,7 +79,7 @@ export const FIELDS = {
type: "array",
presence: false,
},
}
},
}
export const AUTO_COLUMN_SUB_TYPES = {
@ -120,14 +120,16 @@ export const Roles = {
export const USER_TABLE_ID = "ta_users"
export function isAutoColumnUserRelationship(subtype) {
return subtype === AUTO_COLUMN_SUB_TYPES.CREATED_BY ||
return (
subtype === AUTO_COLUMN_SUB_TYPES.CREATED_BY ||
subtype === AUTO_COLUMN_SUB_TYPES.UPDATED_BY
)
}
export function getAutoColumnInformation(enabled = true) {
let info = {}
for (let [key, subtype] of Object.entries(AUTO_COLUMN_SUB_TYPES)) {
info[subtype] = {enabled, name: AUTO_COLUMN_DISPLAY_NAMES[key]}
info[subtype] = { enabled, name: AUTO_COLUMN_DISPLAY_NAMES[key] }
}
return info
}