Module: Labimotion::Workflow
- Extended by:
- ActiveSupport::Concern
- Included in:
- Element, ElementKlass, ElementKlassesRevision
- Defined in:
- lib/labimotion/models/concerns/workflow.rb
Overview
Segmentable concern
Instance Method Summary collapse
Instance Method Details
#split_workflow(properties) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/labimotion/models/concerns/workflow.rb', line 6 def split_workflow(properties) return if properties['flow'].nil? if properties['flow'].present? properties['flowObject'] = {} elements = properties['flow']['elements'] || {} properties['flowObject']['nodes'] = elements.select { |obj| obj['source'].nil? } properties['flowObject']['edges'] = elements.select { |obj| obj['source'] && obj['source'] != obj['target'] }.map do |obj| obj['markerEnd'] = { 'type': 'arrowclosed' } obj end properties['flowObject']['viewport'] = { "x": properties['flow']['position'][0] || 0, "y": properties['flow']['position'][1] || 0, "zoom": properties['flow']['zoom'] || 1 } properties.delete('flow') end properties end |