fix: update create metadata
add json format check when create metadata Change-Id: I82e5db2b29a1499e870003e867f76d85abab4d7c
This commit is contained in:
parent
a0dcb587c5
commit
eedea3eccd
@ -15,6 +15,7 @@
|
|||||||
import { inject, observer } from 'mobx-react';
|
import { inject, observer } from 'mobx-react';
|
||||||
import globalMetadataStore from 'stores/glance/metadata';
|
import globalMetadataStore from 'stores/glance/metadata';
|
||||||
import { ModalAction } from 'containers/Action';
|
import { ModalAction } from 'containers/Action';
|
||||||
|
import { jsonValidator } from 'utils/validate';
|
||||||
|
|
||||||
export class Create extends ModalAction {
|
export class Create extends ModalAction {
|
||||||
static id = 'create';
|
static id = 'create';
|
||||||
@ -42,6 +43,7 @@ export class Create extends ModalAction {
|
|||||||
placeholder: t('Please input metadata'),
|
placeholder: t('Please input metadata'),
|
||||||
required: true,
|
required: true,
|
||||||
rows: 6,
|
rows: 6,
|
||||||
|
validator: jsonValidator,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'options',
|
name: 'options',
|
||||||
@ -64,6 +66,9 @@ export class Create extends ModalAction {
|
|||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log(e, metadata);
|
console.log(e, metadata);
|
||||||
}
|
}
|
||||||
|
if (!body) {
|
||||||
|
body = {};
|
||||||
|
}
|
||||||
const { isPublic = false, isProtected = false } = options;
|
const { isPublic = false, isProtected = false } = options;
|
||||||
body.protected = isProtected || false;
|
body.protected = isProtected || false;
|
||||||
body.visibility = isPublic === true ? 'public' : 'private';
|
body.visibility = isPublic === true ? 'public' : 'private';
|
||||||
|
Loading…
Reference in New Issue
Block a user