Fixed: Inconsistent labels between UI and CLI/API

main
Boris Sekachev 6 years ago
parent 3f4d6fc8d3
commit 62cd4eccdc

@ -5,7 +5,7 @@
export interface Attribute { export interface Attribute {
id: number; id: number;
name: string; name: string;
type: string; input_type: string;
mutable: boolean; mutable: boolean;
values: string[]; values: string[];
} }

@ -76,7 +76,7 @@ class LabelForm extends React.PureComponent<Props, {}> {
return { return {
name: formValues.attrName[key], name: formValues.attrName[key],
type: formValues.type[key], input_type: formValues.type[key],
mutable: formValues.mutable[key], mutable: formValues.mutable[key],
id: label && index < label.attributes.length id: label && index < label.attributes.length
? label.attributes[index].id : key, ? label.attributes[index].id : key,
@ -136,7 +136,7 @@ class LabelForm extends React.PureComponent<Props, {}> {
private renderAttributeTypeInput(key: number, attr: Attribute | null): JSX.Element { private renderAttributeTypeInput(key: number, attr: Attribute | null): JSX.Element {
const locked = attr ? attr.id >= 0 : false; const locked = attr ? attr.id >= 0 : false;
const type = attr ? attr.type.toUpperCase() : AttributeType.SELECT; const type = attr ? attr.input_type.toUpperCase() : AttributeType.SELECT;
const { form } = this.props; const { form } = this.props;
return ( return (

@ -73,7 +73,7 @@ export default class LabelsEditor
{ {
id: attr.id || idGenerator(), id: attr.id || idGenerator(),
name: attr.name, name: attr.name,
type: attr.input_type, input_type: attr.input_type,
mutable: attr.mutable, mutable: attr.mutable,
values: [...attr.values], values: [...attr.values],
} }
@ -207,7 +207,7 @@ export default class LabelsEditor
{ {
name: attr.name, name: attr.name,
id: attr.id < 0 ? undefined : attr.id, id: attr.id < 0 ? undefined : attr.id,
input_type: attr.type.toLowerCase(), input_type: attr.input_type.toLowerCase(),
default_value: attr.values[0], default_value: attr.values[0],
mutable: attr.mutable, mutable: attr.mutable,
values: [...attr.values], values: [...attr.values],

Loading…
Cancel
Save