@@ -167,73 +167,138 @@ qx.Class.define("osparc.store.Support", {
167167      return  manualButtons ; 
168168    } , 
169169
170-     addSupportButtonsToMenu : function ( menu )  { 
170+     __getIssueInfos : function ( )  { 
171+       const  issuesInfos  =  [ ] ; 
171172      const  issues  =  osparc . store . VendorInfo . getIssues ( ) ; 
172-       const  supports  =  osparc . store . VendorInfo . getSupports ( ) ; 
173173      issues . forEach ( issueInfo  =>  { 
174-         const  label  =  issueInfo [ "label" ] ; 
175-         const  issueButton  =  new  qx . ui . menu . Button ( label ,  "@FontAwesome5Solid/comments/14" ) ; 
176-         issueButton . getChildControl ( "label" ) . set ( { 
177-           rich : true 
174+         issuesInfos . push ( { 
175+           label : issueInfo [ "label" ] , 
176+           icon : "@FontAwesome5Solid/comments/14" , 
177+           callback : ( )  =>  { 
178+             const  issueConfirmationWindow  =  new  osparc . ui . window . Dialog ( issueInfo [ "label" ]  +  " "  +  qx . locale . Manager . tr ( "Information" ) ,  null , 
179+               qx . locale . Manager . tr ( "To create an issue, you must have an account and be already logged-in." ) 
180+             ) ; 
181+             const  continueBtn  =  new  qx . ui . form . Button ( qx . locale . Manager . tr ( "Continue" ) ,  "@FontAwesome5Solid/external-link-alt/14" ) ; 
182+             continueBtn . addListener ( "execute" ,  ( )  =>  { 
183+               window . open ( issueInfo [ "new_url" ] ) ; 
184+               issueConfirmationWindow . close ( ) ; 
185+             } ,  this ) ; 
186+             const  loginBtn  =  new  qx . ui . form . Button ( qx . locale . Manager . tr ( "Log in in " )  +  label ,  "@FontAwesome5Solid/external-link-alt/14" ) ; 
187+             loginBtn . addListener ( "execute" ,  ( )  =>  window . open ( issueInfo [ "login_url" ] ) ,  this ) ; 
188+             issueConfirmationWindow . addButton ( continueBtn ) ; 
189+             issueConfirmationWindow . addButton ( loginBtn ) ; 
190+             issueConfirmationWindow . addCancelButton ( ) ; 
191+             issueConfirmationWindow . open ( ) ; 
192+           } , 
178193        } ) ; 
179-         issueButton . addListener ( "execute" ,  ( )  =>  { 
180-           const  issueConfirmationWindow  =  new  osparc . ui . window . Dialog ( label  +  " "  +  qx . locale . Manager . tr ( "Information" ) ,  null , 
181-             qx . locale . Manager . tr ( "To create an issue, you must have an account and be already logged-in." ) 
182-           ) ; 
183-           const  contBtn  =  new  qx . ui . form . Button ( qx . locale . Manager . tr ( "Continue" ) ,  "@FontAwesome5Solid/external-link-alt/14" ) ; 
184-           contBtn . addListener ( "execute" ,  ( )  =>  { 
185-             window . open ( issueInfo [ "new_url" ] ) ; 
186-             issueConfirmationWindow . close ( ) ; 
187-           } ,  this ) ; 
188-           const  loginBtn  =  new  qx . ui . form . Button ( qx . locale . Manager . tr ( "Log in in " )  +  label ,  "@FontAwesome5Solid/external-link-alt/14" ) ; 
189-           loginBtn . addListener ( "execute" ,  ( )  =>  window . open ( issueInfo [ "login_url" ] ) ,  this ) ; 
190-           issueConfirmationWindow . addButton ( contBtn ) ; 
191-           issueConfirmationWindow . addButton ( loginBtn ) ; 
192-           issueConfirmationWindow . addCancelButton ( ) ; 
193-           issueConfirmationWindow . open ( ) ; 
194-         } ,  this ) ; 
195-         menu . add ( issueButton ) ; 
196194      } ) ; 
195+       return  issuesInfos ; 
196+     } , 
197197
198-       if  ( issues . length  &&  supports . length )  { 
199-         menu . addSeparator ( ) ; 
200-       } 
201- 
198+     __getSupportInfos : function ( )  { 
199+       const  supportInfos  =  [ ] ; 
200+       const  supports  =  osparc . store . VendorInfo . getSupports ( ) ; 
202201      supports . forEach ( supportInfo  =>  { 
203-         const  supportBtn  =  new  qx . ui . menu . Button ( supportInfo [ "label" ] ) ; 
204-         supportBtn . getChildControl ( "label" ) . set ( { 
205-           rich : true 
206-         } ) ; 
202+         const  label  =  supportInfo [ "label" ] ; 
207203        let  icon  =  null ; 
208-         let  cb  =  null ; 
204+         let  callback  =  null ; 
209205        switch  ( supportInfo [ "kind" ] )  { 
210206          case  "web" :
211207            icon  =  "@FontAwesome5Solid/link/14" ; 
212-             cb  =  ( )  =>  window . open ( supportInfo [ "url" ] ) ; 
208+             callback  =  ( )  =>  window . open ( supportInfo [ "url" ] ) ; 
213209            break ; 
214210          case  "forum" :
215211            icon  =  "@FontAwesome5Solid/comments/14" ; 
216-             cb  =  ( )  =>  window . open ( supportInfo [ "url" ] ) ; 
212+             callback  =  ( )  =>  window . open ( supportInfo [ "url" ] ) ; 
217213            break ; 
218214          case  "email" :
219215            icon  =  "@FontAwesome5Solid/envelope/14" ; 
220-             cb  =  ( )  =>  this . __openSendEmailFeedbackDialog ( supportInfo [ "email" ] ) ; 
216+             callback  =  ( )  =>  this . __openSendEmailFeedbackDialog ( supportInfo [ "email" ] ) ; 
221217            break ; 
222218        } 
223-         supportBtn . setIcon ( icon ) ; 
224-         supportBtn . addListener ( "execute" ,  ( )  =>  cb ( ) ,  this ) ; 
219+         supportInfos . push ( { 
220+           label, 
221+           icon, 
222+           callback, 
223+         } ) ; 
224+       } ) ; 
225+       return  supportInfos ; 
226+     } , 
227+ 
228+     addSupportButtonsToMenu : function ( menu )  { 
229+       const  issuesInfos  =  this . __getIssueInfos ( ) ; 
230+       issuesInfos . forEach ( issueInfo  =>  { 
231+         const  issueButton  =  new  qx . ui . menu . Button ( issueInfo . label ,  issueInfo . icon ) ; 
232+         issueButton . getChildControl ( "label" ) . set ( { 
233+           rich : true 
234+         } ) ; 
235+         issueButton . addListener ( "execute" ,  issueInfo . callback ,  this ) ; 
236+         menu . add ( issueButton ) ; 
237+       } ) ; 
238+ 
239+       const  supportInfos  =  this . __getSupportInfos ( ) ; 
240+       if  ( issuesInfos . length  &&  supportInfos . length )  { 
241+         menu . addSeparator ( ) ; 
242+       } 
243+ 
244+       supportInfos . forEach ( supportInfo  =>  { 
245+         const  supportBtn  =  new  qx . ui . menu . Button ( supportInfo . label ,  supportInfo . icon ) ; 
246+         supportBtn . getChildControl ( "label" ) . set ( { 
247+           rich : true 
248+         } ) ; 
249+         supportBtn . addListener ( "execute" ,  supportInfo . callback ,  this ) ; 
225250        menu . add ( supportBtn ) ; 
226251      } ) ; 
227252    } , 
228253
229-     addReleaseNotesToMenu : function ( menu )  { 
254+     getSupportButtons : function ( )  { 
255+       const  buttons  =  [ ] ; 
256+       const  issuesInfos  =  this . __getIssueInfos ( ) ; 
257+       issuesInfos . forEach ( issueInfo  =>  { 
258+         const  issueButton  =  new  qx . ui . form . Button ( issueInfo . label ,  issueInfo . icon ) ; 
259+         issueButton . getChildControl ( "label" ) . set ( { 
260+           rich : true 
261+         } ) ; 
262+         issueButton . addListener ( "execute" ,  issueInfo . callback ,  this ) ; 
263+         buttons . push ( issueButton ) ; 
264+       } ) ; 
265+ 
266+       const  supportInfos  =  this . __getSupportInfos ( ) ; 
267+       supportInfos . forEach ( supportInfo  =>  { 
268+         const  supportBtn  =  new  qx . ui . form . Button ( supportInfo . label ,  supportInfo . icon ) ; 
269+         supportBtn . getChildControl ( "label" ) . set ( { 
270+           rich : true 
271+         } ) ; 
272+         supportBtn . addListener ( "execute" ,  supportInfo . callback ,  this ) ; 
273+         buttons . push ( supportBtn ) ; 
274+       } ) ; 
275+       return  buttons ; 
276+     } , 
277+ 
278+     __getReleaseInfo : function ( )  { 
230279      const  releaseTag  =  osparc . utils . Utils . getReleaseTag ( ) ; 
231280      const  releaseLink  =  osparc . utils . Utils . getReleaseLink ( ) ; 
232-       const  releaseBtn  =  new  qx . ui . menu . Button ( qx . locale . Manager . tr ( "What's new in" )  +  " "  +  releaseTag ,  "@FontAwesome5Solid/bullhorn/14" ) ; 
233-       releaseBtn . addListener ( "execute" ,  ( )  =>  window . open ( releaseLink ) ,  this ) ; 
281+       return  { 
282+         label : qx . locale . Manager . tr ( "What's new in" )  +  " "  +  releaseTag , 
283+         icon : "@FontAwesome5Solid/bullhorn/14" , 
284+         callback : ( )  =>  {  window . open ( releaseLink ) ;  } , 
285+       } ; 
286+     } , 
287+ 
288+     addReleaseNotesToMenu : function ( menu )  { 
289+       const  releaseInfo  =  this . __getReleaseInfo ( ) ; 
290+       const  releaseBtn  =  new  qx . ui . menu . Button ( releaseInfo . label ,  releaseInfo . icon ) ; 
291+       releaseBtn . addListener ( "execute" ,  releaseInfo . callback ,  this ) ; 
234292      menu . add ( releaseBtn ) ; 
235293    } , 
236294
295+     getReleaseNotesButton : function ( )  { 
296+       const  releaseInfo  =  this . __getReleaseInfo ( ) ; 
297+       const  releaseBtn  =  new  qx . ui . form . Button ( releaseInfo . label ,  releaseInfo . icon ) ; 
298+       releaseBtn . addListener ( "execute" ,  releaseInfo . callback ,  this ) ; 
299+       return  releaseBtn ; 
300+     } , 
301+ 
237302    mailToLink : function ( email ,  subject ,  centered  =  true )  { 
238303      const  color  =  qx . theme . manager . Color . getInstance ( ) . resolve ( "text" ) ; 
239304      let  textLink  =  `<a href="mailto:${ email }  ?subject=${ subject }  " style='color: ${ color }  ' target='_blank'>${ email }  </a>` ; 
0 commit comments