File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed
Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change 22/*jshint browser: true*/
33
44define ( [
5+ 'js/DragDrop/DragHelper' ,
56 'js/Constants' ,
67 'js/NodePropertyNames'
78] , function (
9+ DragHelper ,
810 CONSTANTS ,
911 nodePropertyNames
1012) {
@@ -72,6 +74,22 @@ define([
7274 this . _client . completeTransaction ( ) ;
7375 }
7476 } ;
77+
78+ this . _widget . onBackgroundDrop = ( event , dragInfo ) => {
79+ if ( ! this . _currentNodeId ) { // no active node. Cannot add pipeline
80+ return ;
81+ }
82+ const effects = DragHelper . getDragEffects ( dragInfo ) ;
83+ const items = DragHelper . getDragItems ( dragInfo ) ;
84+
85+ if ( effects . includes ( DragHelper . DRAG_EFFECTS . DRAG_CREATE_INSTANCE ) ) {
86+ const parentId = this . _currentNodeId ;
87+ const msg = `Creating ${ items . length } new pipeline(s)` ;
88+ this . _client . startTransaction ( msg ) ;
89+ items . forEach ( baseId => this . _client . createNode ( { parentId, baseId} ) ) ;
90+ this . _client . completeTransaction ( ) ;
91+ }
92+ } ;
7593 } ;
7694
7795 /* * * * * * * * Visualizer content update callbacks * * * * * * * */
Original file line number Diff line number Diff line change 22/*jshint browser: true*/
33
44define ( [
5+ 'js/DragDrop/DropTarget' ,
56 'text!./cards/Pipeline.ejs' ,
67 'text!./cards/Architecture.ejs' ,
78 'underscore' ,
89 'css!./styles/PipelineIndexWidget.css'
910] , function (
11+ DropTarget ,
1012 PipelineHtml ,
1113 ArchitectureHtml ,
1214 _
@@ -34,11 +36,11 @@ define([
3436 this . $backgroundText = null ;
3537 this . updateBackgroundText ( ) ;
3638
37- this . _initializeEventHandlers ( ) ;
39+ this . _initializeEventHandlers ( container ) ;
3840 this . logger . debug ( 'ctor finished' ) ;
3941 } ;
4042
41- PipelineIndexWidget . prototype . _initializeEventHandlers = function ( ) {
43+ PipelineIndexWidget . prototype . _initializeEventHandlers = function ( container ) {
4244 this . $el . on ( 'click' , '.open-pipeline' , this . openPipeline ) ;
4345 this . $el . on ( 'click' , '.preview.card-image' , this . openPipeline ) ;
4446
@@ -60,6 +62,12 @@ define([
6062 }
6163 } ) ;
6264 } ) ;
65+
66+ DropTarget . makeDroppable ( container , {
67+ drop : ( event , dragInfo ) => {
68+ this . onBackgroundDrop ( event , dragInfo ) ;
69+ }
70+ } ) ;
6371 } ;
6472
6573 PipelineIndexWidget . prototype . getEmptyMsg = function ( ) {
You can’t perform that action at this time.
0 commit comments