@@ -28,7 +28,9 @@ qx.Class.define("osparc.dashboard.StudyThumbnailExplorer", {
28
28
maxHeight : this . self ( ) . LAYOUT_HEIGHT
29
29
} ) ;
30
30
31
- this . __studyData = studyData ;
31
+ const study = this . __study = new osparc . data . model . Study ( studyData ) ;
32
+ // make nodes not movable
33
+ study . setReadOnly ( true ) ;
32
34
33
35
this . __buildLayout ( ) ;
34
36
this . __attachEventHandlers ( ) ;
@@ -42,7 +44,7 @@ qx.Class.define("osparc.dashboard.StudyThumbnailExplorer", {
42
44
} ,
43
45
44
46
members : {
45
- __studyData : null ,
47
+ __study : null ,
46
48
47
49
_createChildControlImpl : function ( id ) {
48
50
let control ;
@@ -64,7 +66,7 @@ qx.Class.define("osparc.dashboard.StudyThumbnailExplorer", {
64
66
} ) ;
65
67
break ;
66
68
}
67
- case "scroll-thumbnails " : {
69
+ case "thumbnail-suggestions " : {
68
70
control = this . __getThumbnailSuggestions ( ) ;
69
71
const thumbnailsLayout = this . getChildControl ( "thumbnails-layout" ) ;
70
72
thumbnailsLayout . add ( control ) ;
@@ -90,49 +92,37 @@ qx.Class.define("osparc.dashboard.StudyThumbnailExplorer", {
90
92
hideRoot : false ,
91
93
simpleNodes : true
92
94
} ) ;
93
- const study = new osparc . data . model . Study ( this . __studyData ) ;
94
95
// Do not show the nodes tree if it's a mononode study
95
- if ( study . isPipelineMononode ( ) ) {
96
+ if ( this . __study . isPipelineMononode ( ) ) {
96
97
nodesTree . exclude ( ) ;
97
98
}
98
- nodesTree . setStudy ( study ) ;
99
99
return nodesTree ;
100
100
} ,
101
101
102
102
__getThumbnailSuggestions : function ( ) {
103
- const study = new osparc . data . model . Study ( this . __studyData ) ;
104
103
const thumbnailSuggestions = new osparc . component . editor . ThumbnailSuggestions ( ) . set ( {
105
104
minHeight : this . self ( ) . THUMBNAIL_SLIDER_HEIGHT ,
106
105
maxHeight : this . self ( ) . THUMBNAIL_SLIDER_HEIGHT
107
106
} ) ;
108
- thumbnailSuggestions . addWorkbenchUIPreviewToSuggestions ( ) ;
109
- thumbnailSuggestions . setStudy ( study ) ;
110
-
111
- const params = {
112
- url : {
113
- studyId : this . __studyData [ "uuid" ]
114
- }
115
- } ;
116
- osparc . data . Resources . fetch ( "studyPreviews" , "getPreviews" , params )
117
- . then ( previewsPerNodes => thumbnailSuggestions . addPreviewsToSuggestions ( previewsPerNodes ) )
118
- . catch ( err => console . error ( err ) ) ;
119
-
120
107
return thumbnailSuggestions ;
121
108
} ,
122
109
123
110
__buildLayout : function ( ) {
124
- this . getChildControl ( "nodes-tree" ) ;
125
- this . getChildControl ( "scroll-thumbnails" ) ;
111
+ // For now, do not show the Nodes Tree
112
+ // this.getChildControl("nodes-tree");
113
+ this . getChildControl ( "thumbnail-suggestions" ) ;
126
114
this . getChildControl ( "thumbnail-viewer-layout" ) ;
127
115
} ,
128
116
129
117
__attachEventHandlers : function ( ) {
118
+ /*
130
119
const nodesTree = this.getChildControl("nodes-tree");
131
- const scrollThumbnails = this . getChildControl ( "scroll-thumbnails" ) ;
132
120
nodesTree.addListener("changeSelectedNode", e => {
133
121
const selectedNodeId = e.getData();
134
122
scrollThumbnails.setSelectedNodeId(selectedNodeId);
135
123
});
124
+ */
125
+ const scrollThumbnails = this . getChildControl ( "thumbnail-suggestions" ) ;
136
126
const thumbnailViewerLayout = this . getChildControl ( "thumbnail-viewer-layout" ) ;
137
127
scrollThumbnails . addListener ( "thumbnailTapped" , e => {
138
128
const thumbnailData = e . getData ( ) ;
@@ -167,12 +157,9 @@ qx.Class.define("osparc.dashboard.StudyThumbnailExplorer", {
167
157
} ,
168
158
169
159
__getWorkbenchUIPreview : function ( ) {
170
- const study = new osparc . data . model . Study ( this . __studyData ) ;
171
- // make nodes not movable
172
- study . setReadOnly ( true ) ;
173
160
const workbenchUIPreview = new osparc . component . workbench . WorkbenchUIPreview ( ) ;
174
- workbenchUIPreview . setStudy ( study ) ;
175
- workbenchUIPreview . loadModel ( study . getWorkbench ( ) ) ;
161
+ workbenchUIPreview . setStudy ( this . __study ) ;
162
+ workbenchUIPreview . loadModel ( this . __study . getWorkbench ( ) ) ;
176
163
workbenchUIPreview . addListener ( "appear" , ( ) => {
177
164
// give it some time to take the bounds
178
165
setTimeout ( ( ) => {
@@ -190,12 +177,40 @@ qx.Class.define("osparc.dashboard.StudyThumbnailExplorer", {
190
177
} ,
191
178
192
179
__initComponents : function ( ) {
193
- const scrollThumbnails = this . getChildControl ( "scroll-thumbnails" ) ;
194
- scrollThumbnails . setSelectedNodeId ( null ) ;
180
+ /*
181
+ const nodesTree = this.getChildControl("nodes-tree");
182
+ nodesTree.setStudy(this.__study);
183
+ */
184
+
185
+ const thumbnailSuggestions = this . getChildControl ( "thumbnail-suggestions" ) ;
186
+ // make it visible only if there are thumbnails
187
+ this . exclude ( ) ;
188
+ thumbnailSuggestions . addListener ( "thumbnailAdded" , ( ) => this . show ( ) ) ;
189
+ if ( this . __showWorkbenchUIPreview ( ) ) {
190
+ thumbnailSuggestions . addWorkbenchUIPreviewToSuggestions ( ) ;
191
+ }
192
+ thumbnailSuggestions . setStudy ( this . __study ) ;
193
+ const params = {
194
+ url : {
195
+ studyId : this . __study . getUuid ( )
196
+ }
197
+ } ;
198
+ osparc . data . Resources . fetch ( "studyPreviews" , "getPreviews" , params )
199
+ . then ( previewsPerNodes => thumbnailSuggestions . addPreviewsToSuggestions ( previewsPerNodes ) )
200
+ . catch ( err => console . error ( err ) ) ;
195
201
196
- const workbenchUIPreview = this . __getWorkbenchUIPreview ( ) ;
197
- const thumbnailViewerLayout = this . getChildControl ( "thumbnail-viewer-layout" ) ;
198
- thumbnailViewerLayout . add ( workbenchUIPreview ) ;
202
+ thumbnailSuggestions . setSelectedNodeId ( null ) ;
203
+
204
+ // Do not add the preview if the study is in App Mode
205
+ if ( this . __showWorkbenchUIPreview ( ) ) {
206
+ const workbenchUIPreview = this . __getWorkbenchUIPreview ( ) ;
207
+ const thumbnailViewerLayout = this . getChildControl ( "thumbnail-viewer-layout" ) ;
208
+ thumbnailViewerLayout . add ( workbenchUIPreview ) ;
209
+ }
210
+ } ,
211
+
212
+ __showWorkbenchUIPreview : function ( ) {
213
+ return ! [ "guided" , "app" ] . includes ( this . __study . getUi ( ) . getMode ( ) ) ;
199
214
}
200
215
}
201
216
} ) ;
0 commit comments