import '../styles/EditDescriptorModelProperties.scss'
+const EMPTY_LEAF_PRESENT = '--empty-leaf-set--';
+
function getDescriptorMetaBasicForType(type) {
const basicPropertiesFilter = d => _includes(DESCRIPTOR_MODEL_FIELDS[type], d.name);
return DescriptorModelMetaFactory.getModelMetaForType(type, basicPropertiesFilter) || {properties: []};
export default function EditDescriptorModelProperties(props) {
const container = props.container;
+ const readonly = props.readonly;
+ const isEditable = !readonly; //true
if (!(DescriptorModelFactory.isContainer(container))) {
return
}
CatalogItemsActions.catalogItemDescriptorChanged(this.getRoot());
}
+ if(readonly) {
+ return null;
+ }
return (
<Button className="inline-hint" onClick={onClickAddProperty.bind(container, property, path)} label="Add" src={imgAdd} />
);
}
CatalogItemsActions.catalogItemDescriptorChanged(this.getRoot());
}
+ if(readonly) {
+ return null;
+ }
return (
<Button className="remove-property-action inline-hint" title="Remove" onClick={onClickRemoveProperty.bind(container, property, path)} label="Remove" src={imgRemove}/>
);
onBlur={endEditing}
onMouseDown={startEditing}
onMouseOver={startEditing}
- readOnly={!isEditable}>
+ disabled={!isEditable}>
{options}
</select>
);
onBlur={endEditing}
onMouseDown={startEditing}
onMouseOver={startEditing}
- readOnly={!isEditable}>
+ disabled={!isEditable}>
{options}
</select>
);
key={fieldKey}
id={fieldKey}
className={ClassNames({'-value-not-set': !isValueSet})}
- defaultValue={val && val.toUpperCase()} title={pathToProperty}
+ defaultValue={val && val.toUpperCase()}
+ title={pathToProperty}
+ onChange={onSelectChange}
+ onFocus={onFocus}
+ onBlur={endEditing}
+ onMouseDown={startEditing}
+ onMouseOver={startEditing}
+ disabled={!isEditable}>
+ {options}
+ </select>
+ );
+ }
+
+ if (Property.isLeafEmpty(property)) {
+ // A null value indicates the leaf exists (as opposed to undefined).
+ // We stick in a string when the user actually sets it to simplify things
+ // but the correct thing happens when we serialize to user data
+ let isEmptyLeafPresent = (value === EMPTY_LEAF_PRESENT || value === null);
+ let present = isEmptyLeafPresent ? EMPTY_LEAF_PRESENT : "";
+ const options = [
+ <option key={'true'} value={EMPTY_LEAF_PRESENT}>Enabled</option>,
+ <option key={'false'} value="">Not Enabled</option>
+ ]
+
+ return (
+ <select
+ key={fieldKey}
+ id={fieldKey}
+ className={ClassNames({'-value-not-set': !isEmptyLeafPresent})}
+ defaultValue={present}
+ title={pathToProperty}
onChange={onSelectChange}
onFocus={onFocus}
onBlur={endEditing}
onMouseDown={startEditing}
onMouseOver={startEditing}
- readOnly={!isEditable}>
+ disabled={!isEditable}>
{options}
</select>
);
onMouseOver={startEditing}
onMouseOut={endEditing}
onMouseLeave={endEditing}
- readOnly={!isEditable} />
+ disabled={!isEditable} />
);
}
onMouseOver={startEditing}
onMouseOut={endEditing}
onMouseLeave={endEditing}
- readOnly={!isEditable}
+ disabled={!isEditable}
/>
);
// write the current choice value into the state
let choiceObject = utils.resolvePath(this.model, [name, selected].join('.'));
let isTopCase = false;
- if (!choiceObject) {
+ if (choiceObject) {
isTopCase = true;
choiceObject = utils.resolvePath(this.model, [selected].join('.'));
}
onMouseOver={startEditing}
onMouseOut={endEditing}
onMouseLeave={endEditing}
+ disabled={!isEditable}
>
{options}
</select>