update from RIFT as of 696b75d2fe9fb046261b08c616f1bcf6c0b54a9b third try
[osm/UI.git] / skyquake / plugins / admin / src / components / ChoiceColumn.jsx
1 import React from 'react'
2 import ContainerColumn from './ContainerColumn'
3
4 export default class extends ContainerColumn {
5     constructor(props) {
6         super(props);
7         const element = props.model.getElement(props.path);
8         const selectedCase = element.value ?
9             element.schema.properties.find(c => c.properties && c.properties.some(p => element.value[p.name]))
10             : null;
11         if (selectedCase) {
12             this.state.actions = ['delete'];
13             this.state.properties = selectedCase.properties;
14         } else {
15             this.state.actions = ['create'];
16         }
17     }
18     render() {
19         return super.render();
20     }
21 }
22