Merge pull request #453 from mpcref/patch-1

Generate valid appName on changing name
This commit is contained in:
Mauricio Siu
2024-09-22 19:07:09 -06:00
committed by GitHub
3 changed files with 12 additions and 3 deletions

View File

@@ -145,7 +145,10 @@ export const AddApplication = ({ projectId, projectName }: Props) => {
{...field} {...field}
onChange={(e) => { onChange={(e) => {
const val = e.target.value?.trim() || ""; const val = e.target.value?.trim() || "";
form.setValue("appName", `${slug}-${val}`); form.setValue(
"appName",
`${slug}-${val.toLowerCase().replaceAll(" ", "-")}`,
);
field.onChange(val); field.onChange(val);
}} }}
/> />

View File

@@ -149,7 +149,10 @@ export const AddCompose = ({ projectId, projectName }: Props) => {
{...field} {...field}
onChange={(e) => { onChange={(e) => {
const val = e.target.value?.trim() || ""; const val = e.target.value?.trim() || "";
form.setValue("appName", `${slug}-${val}`); form.setValue(
"appName",
`${slug}-${val.toLowerCase()}`,
);
field.onChange(val); field.onChange(val);
}} }}
/> />

View File

@@ -361,7 +361,10 @@ export const AddDatabase = ({ projectId, projectName }: Props) => {
{...field} {...field}
onChange={(e) => { onChange={(e) => {
const val = e.target.value?.trim() || ""; const val = e.target.value?.trim() || "";
form.setValue("appName", `${slug}-${val}`); form.setValue(
"appName",
`${slug}-${val.toLowerCase()}`,
);
field.onChange(val); field.onChange(val);
}} }}
/> />