@@ -58,13 +58,31 @@ qx.Class.define("osparc.dashboard.NewPlusMenu", {
5858 let control ;
5959 switch ( id ) {
6060 case "new-folder" :
61- control = this . self ( ) . createMenuButton ( this . tr ( "New Folder" ) , osparc . dashboard . CardBase . NEW_ICON + "14" ) ;
61+ control = this . self ( ) . createMenuButton (
62+ this . tr ( "New Folder" ) ,
63+ osparc . dashboard . CardBase . NEW_ICON + "14"
64+ ) ;
6265 osparc . utils . Utils . setIdToWidget ( control , "newFolderButton" ) ;
6366 control . addListener ( "tap" , ( ) => this . __createNewFolder ( ) ) ;
6467 this . add ( control ) ;
6568 break ;
66- case "more-entry" :
67- control = this . self ( ) . createMenuButton ( this . tr ( "More" ) ) ;
69+ case "templates-entry" :
70+ control = this . self ( ) . createMenuButton (
71+ osparc . product . Utils . getTemplateAlias ( {
72+ firstUpperCase : true ,
73+ plural : true
74+ } ) ,
75+ "@FontAwesome5Solid/copy/14"
76+ ) ;
77+ control . addListener ( "tap" , ( ) => this . fireDataEvent ( "changeTab" , "templatesTab" ) ) ;
78+ this . add ( control ) ;
79+ break ;
80+ case "services-entry" :
81+ control = this . self ( ) . createMenuButton (
82+ this . tr ( "Services" ) ,
83+ "@FontAwesome5Solid/cogs/14"
84+ ) ;
85+ control . addListener ( "tap" , ( ) => this . fireDataEvent ( "changeTab" , "servicesTab" ) ) ;
6886 this . add ( control ) ;
6987 break ;
7088 }
@@ -74,27 +92,22 @@ qx.Class.define("osparc.dashboard.NewPlusMenu", {
7492 __addItems : async function ( ) {
7593 this . getChildControl ( "new-folder" ) ;
7694 this . addSeparator ( ) ;
77- await this . __fetchReferencedTemplates ( ) ;
95+ await this . __addNewStudyItems ( ) ;
7896 const permissions = osparc . data . Permissions . getInstance ( ) ;
7997 if ( permissions . canDo ( "dashboard.templates.read" ) || permissions . canDo ( "dashboard.services.read" ) ) {
8098 this . addSeparator ( ) ;
81- const moreMenu = new qx . ui . menu . Menu ( ) ;
82- const moreEntry = this . getChildControl ( "more-entry" ) ;
83- moreEntry . setMenu ( moreMenu ) ;
8499 if ( permissions . canDo ( "dashboard.templates.read" ) ) {
85- const templatesButton = this . self ( ) . createMenuButton ( this . tr ( "Templates" ) ) ;
86- templatesButton . addListener ( "tap" , ( ) => this . fireDataEvent ( "changeTab" , "templatesTab" ) ) ;
87- moreMenu . add ( templatesButton ) ;
100+ const templatesButton = this . getChildControl ( "templates-entry" ) ;
101+ this . add ( templatesButton ) ;
88102 }
89103 if ( permissions . canDo ( "dashboard.services.read" ) ) {
90- const servicesButton = this . self ( ) . createMenuButton ( this . tr ( "Services" ) ) ;
91- servicesButton . addListener ( "tap" , ( ) => this . fireDataEvent ( "changeTab" , "servicesTab" ) ) ;
92- moreMenu . add ( servicesButton ) ;
104+ const servicesButton = this . getChildControl ( "services-entry" ) ;
105+ this . add ( servicesButton ) ;
93106 }
94107 }
95108 } ,
96109
97- __fetchReferencedTemplates : async function ( ) {
110+ __addNewStudyItems : async function ( ) {
98111 await osparc . utils . Utils . fetchJSON ( "/resource/osparc/new_studies.json" )
99112 . then ( newStudiesData => {
100113 const product = osparc . product . Utils . getProductName ( )
@@ -104,15 +117,15 @@ qx.Class.define("osparc.dashboard.NewPlusMenu", {
104117 if ( templates ) {
105118 const referencedTemplates = newStudiesData [ product ] ;
106119 if ( referencedTemplates [ "linkedResource" ] === "templates" ) {
107- this . __addReferencedTemplateButtons ( referencedTemplates , templates ) ;
120+ this . __addFromTemplateButtons ( referencedTemplates , templates ) ;
108121 }
109122 }
110123 } ) ;
111124 }
112125 } ) ;
113126 } ,
114127
115- __addReferencedTemplateButtons : function ( referencedTemplates , templates ) {
128+ __addFromTemplateButtons : function ( referencedTemplates , templates ) {
116129 const displayTemplates = referencedTemplates [ "resources" ] . filter ( referencedTemplate => {
117130 if ( referencedTemplate . showDisabled ) {
118131 return true ;
0 commit comments