Merge pull request #7788 from Budibase/update-app-name
Ignore empty name validation on app update and change free logo text
This commit is contained in:
commit
080f46b828
4 changed files with 29 additions and 9 deletions
|
@ -8,7 +8,7 @@
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<img src="https://i.imgur.com/Xhdt1YP.png" alt="Budibase" />
|
<img src="https://i.imgur.com/Xhdt1YP.png" alt="Budibase" />
|
||||||
<p>Made In Budibase</p>
|
<p>Made with Budibase</p>
|
||||||
</div>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import { FieldTypes } from "constants"
|
import { FieldTypes } from "constants"
|
||||||
import active from "svelte-spa-router/active"
|
import active from "svelte-spa-router/active"
|
||||||
import { RoleUtils } from "@budibase/frontend-core"
|
import { RoleUtils } from "@budibase/frontend-core"
|
||||||
import MadeInBudibase from "../MadeInBudibase.svelte"
|
import FreeLogo from "../FreeLogo.svelte"
|
||||||
import licensing from "../../licensing"
|
import licensing from "../../licensing"
|
||||||
|
|
||||||
const sdk = getContext("sdk")
|
const sdk = getContext("sdk")
|
||||||
|
@ -236,7 +236,7 @@
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if !$builderStore.inBuilder && licensing.logoEnabled() && $environmentStore.cloud}
|
{#if !$builderStore.inBuilder && licensing.logoEnabled() && $environmentStore.cloud}
|
||||||
<MadeInBudibase />
|
<FreeLogo />
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<div class="main-wrapper">
|
<div class="main-wrapper">
|
||||||
|
|
|
@ -20,7 +20,7 @@ router
|
||||||
.put(
|
.put(
|
||||||
"/api/applications/:appId",
|
"/api/applications/:appId",
|
||||||
authorized(BUILDER),
|
authorized(BUILDER),
|
||||||
applicationValidator(),
|
applicationValidator({ isCreate: false }),
|
||||||
controller.update
|
controller.update
|
||||||
)
|
)
|
||||||
.post(
|
.post(
|
||||||
|
|
|
@ -210,15 +210,35 @@ exports.automationValidator = (existing = false) => {
|
||||||
}).unknown(true))
|
}).unknown(true))
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.applicationValidator = () => {
|
exports.applicationValidator = (opts = { isCreate: true }) => {
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
return joiValidator.body(Joi.object({
|
const base = {
|
||||||
_id: OPTIONAL_STRING,
|
_id: OPTIONAL_STRING,
|
||||||
_rev: OPTIONAL_STRING,
|
_rev: OPTIONAL_STRING,
|
||||||
name: Joi.string().pattern(new RegExp(APP_NAME_REGEX)).required().error(new Error('App name must be letters, numbers and spaces only')),
|
|
||||||
url: OPTIONAL_STRING,
|
url: OPTIONAL_STRING,
|
||||||
template: Joi.object({
|
template: Joi.object({
|
||||||
templateString: OPTIONAL_STRING,
|
templateString: OPTIONAL_STRING,
|
||||||
}).unknown(true),
|
})
|
||||||
}).unknown(true))
|
}
|
||||||
|
|
||||||
|
const appNameValidator = Joi.string()
|
||||||
|
.pattern(new RegExp(APP_NAME_REGEX))
|
||||||
|
.error(new Error("App name must be letters, numbers and spaces only"))
|
||||||
|
if (opts.isCreate) {
|
||||||
|
base.name = appNameValidator.required()
|
||||||
|
} else {
|
||||||
|
base.name = appNameValidator.optional()
|
||||||
|
}
|
||||||
|
|
||||||
|
return joiValidator.body(
|
||||||
|
Joi.object({
|
||||||
|
_id: OPTIONAL_STRING,
|
||||||
|
_rev: OPTIONAL_STRING,
|
||||||
|
name: appNameValidator,
|
||||||
|
url: OPTIONAL_STRING,
|
||||||
|
template: Joi.object({
|
||||||
|
templateString: OPTIONAL_STRING,
|
||||||
|
}).unknown(true),
|
||||||
|
}).unknown(true)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue