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

View File

@ -30,7 +30,9 @@
<div class="popover"> <div class="popover">
<h5>Who Can Access This Data?</h5> <h5>Who Can Access This Data?</h5>
<div class="note"> <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> </div>
<Spacer large /> <Spacer large />
<div class="row"> <div class="row">

View File

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

View File

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