Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const enumOptions = isSelect(schema) ? optionsList(schema) : undefined;
const defaultWidget = format || (enumOptions ? 'select' : 'text');
const { widget = defaultWidget, placeholder = '', ...options } = getUiOptions(uiSchema);
const Widget = getWidget(schema, widget, widgets);
const onChangeHandler = value => {
onChange(value, options);
};
return (
);
}
getStateFromProps(props) {
const {schema, formData, registry} = props;
return getDefaultFormState(schema, formData, registry.definitions) || {};
}
this.setState({ AddElement: undefined });
this.doAdd(addTo, formData, newVal);
};
let AddElement = () => (
{
onBlur(formData);
}}
/>
);
this.setState({ AddElement });
}
} else {
let newVal = getDefaultFormState(fieldSchema, {});
this.doAdd(addTo, formData, newVal);
}
});
};
onAddClick = event => {
event.preventDefault();
const {items} = this.state;
const {schema, registry} = this.props;
const {definitions} = registry;
let itemSchema = schema.items;
if (isFixedItems(schema) && allowAdditionalItems(schema)) {
itemSchema = schema.additionalItems;
}
const newItems = items.concat([
getDefaultFormState(itemSchema, undefined, definitions)
]);
this.asyncSetState({
items: newItems,
selectedTabId: newItems.length - 1
});
};
onCosmosPackagesStoreServiceDescriptionSuccess() {
const fullPackage = CosmosPackagesStore.getServiceDetails();
const packageDetails = new UniversePackage(fullPackage.package);
const schema = packageDetails.getConfig();
const frameworkData = getDefaultFormState(
schema,
fullPackage.resolvedOptions,
schema.definitions
);
this.setState({ frameworkData, packageDetails, cosmosError: null });
}
getStateFromProps(props) {
const {schema, formData, registry} = props;
return getDefaultFormState(schema, formData, registry.definitions) || {};
}
getStateFromProps(props) {
const formData = Array.isArray(props.formData) ? props.formData : null;
const { definitions } = this.props.registry;
return {
items: getDefaultFormState(props.schema, formData, definitions) || []
};
}
getStateFromProps(props) {
const { schema, formData, registry } = props;
return getDefaultFormState(schema, formData, registry.definitions) || {};
}
onCosmosPackagesStoreServiceDescriptionSuccess() {
const fullPackage = CosmosPackagesStore.getServiceDetails();
const packageDetails = new UniversePackage(fullPackage.package);
const schema = packageDetails.getConfig();
const formData = getDefaultFormState(
schema,
fullPackage.resolvedOptions,
schema.definitions
);
const defaultConfigWarning = fullPackage.resolvedOptions
? null
: i18nMark(
"This service was initially deployed to a previous version of DC/OS that did not store service configuration settings. The default package values were used to populate the configuration in this form. Carefully verify the default settings are correct, prior to deploying the new configuration."
);
this.setState({
cosmosErrors: null,
packageDetails,
formData,
defaultConfigWarning