Add --local option to command of a new process
[arvados-workbench2.git] / src / components / chips / chips.tsx
index 8f597de6035c58f05f1b303a45d3227965d3cf86..75ae00f4cfc52bd1a483c73fdd2753dc8ed0be26 100644 (file)
@@ -11,7 +11,10 @@ interface ChipsProps<Value> {
     values: Value[];
     getLabel?: (value: Value) => string;
     filler?: React.ReactNode;
+    deletable?: boolean;
+    orderable?: boolean;
     onChange: (value: Value[]) => void;
+    clickable?: boolean;
 }
 
 type CssRules = 'root';
@@ -75,22 +78,31 @@ export const Chips = withStyles(styles)(
             DragSource(this.type, this.dragSpec, this.dragCollector),
             DropTarget(this.type, this.dropSpec, this.dropCollector),
         )(
-            ({ connectDragSource, connectDropTarget, isOver, value }: DraggableChipProps<Value> & CollectedProps) =>
-                compose(
+            ({ connectDragSource, connectDropTarget, isOver, value }: DraggableChipProps<Value> & CollectedProps) => {
+                const connect = compose(
                     connectDragSource,
                     connectDropTarget,
-                )(
+                );
+
+                const chip =
                     <span>
                         <Chip
                             color={isOver ? 'primary' : 'default'}
-                            onDelete={this.deleteValue(value)}
+                            onDelete={this.props.deletable
+                                ? this.deleteValue(value)
+                                : undefined}
+                            clickable={this.props.clickable}
                             label={this.props.getLabel ?
                                 this.props.getLabel(value)
                                 : typeof value === 'object'
                                     ? JSON.stringify(value)
                                     : value} />
-                    </span>
-                )
+                    </span>;
+
+                return this.props.orderable
+                    ? connect(chip)
+                    : chip;
+            }
         );
 
         deleteValue = (value: Value) => () => {