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>
|
||||
<img src="https://i.imgur.com/Xhdt1YP.png" alt="Budibase" />
|
||||
<p>Made In Budibase</p>
|
||||
<p>Made with Budibase</p>
|
||||
</div>
|
||||
</Link>
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
import { FieldTypes } from "constants"
|
||||
import active from "svelte-spa-router/active"
|
||||
import { RoleUtils } from "@budibase/frontend-core"
|
||||
import MadeInBudibase from "../MadeInBudibase.svelte"
|
||||
import FreeLogo from "../FreeLogo.svelte"
|
||||
import licensing from "../../licensing"
|
||||
|
||||
const sdk = getContext("sdk")
|
||||
|
@ -236,7 +236,7 @@
|
|||
{/if}
|
||||
|
||||
{#if !$builderStore.inBuilder && licensing.logoEnabled() && $environmentStore.cloud}
|
||||
<MadeInBudibase />
|
||||
<FreeLogo />
|
||||
{/if}
|
||||
|
||||
<div class="main-wrapper">
|
||||
|
|
|
@ -20,7 +20,7 @@ router
|
|||
.put(
|
||||
"/api/applications/:appId",
|
||||
authorized(BUILDER),
|
||||
applicationValidator(),
|
||||
applicationValidator({ isCreate: false }),
|
||||
controller.update
|
||||
)
|
||||
.post(
|
||||
|
|
|
@ -210,15 +210,35 @@ exports.automationValidator = (existing = false) => {
|
|||
}).unknown(true))
|
||||
}
|
||||
|
||||
exports.applicationValidator = () => {
|
||||
exports.applicationValidator = (opts = { isCreate: true }) => {
|
||||
// prettier-ignore
|
||||
return joiValidator.body(Joi.object({
|
||||
const base = {
|
||||
_id: 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,
|
||||
template: Joi.object({
|
||||
templateString: OPTIONAL_STRING,
|
||||
})
|
||||
}
|
||||
|
||||
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))
|
||||
}).unknown(true)
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue