@@ -888,78 +888,10 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
888888 // this one is different since it groups all new buttons in one new button
889889 this . __addTIPPlusButton ( ) ;
890890 break ;
891- default :
892- this . __addPlusButtons ( ) ;
893- break ;
894891 }
895892 }
896893 } ,
897894
898- __addPlusButtons : function ( ) {
899- const plusButtonConfig = osparc . store . Products . getInstance ( ) . getNewStudiesUiConfig ( ) ;
900- if ( plusButtonConfig ) {
901- plusButtonConfig [ "resources" ] . forEach ( newStudyData => {
902- if ( newStudyData [ "resourceType" ] === "study" ) {
903- this . __addEmptyStudyPlusButton ( newStudyData ) ;
904- } else if ( newStudyData [ "resourceType" ] === "service" ) {
905- this . __addNewStudyFromServiceButton ( newStudyData ) ;
906- }
907- } ) ;
908- }
909- } ,
910-
911- __addEmptyStudyPlusButton : function ( newStudyData ) {
912- const mode = this . _resourcesContainer . getMode ( ) ;
913- const defTitle = this . tr ( "Empty" ) + " " + osparc . product . Utils . getStudyAlias ( {
914- firstUpperCase : true
915- } ) ;
916- const title = newStudyData [ "title" ] || defTitle ;
917- const desc = newStudyData [ "description" ] || this . tr ( "Start with an empty study" ) ;
918- const newEmptyStudyBtn = ( mode === "grid" ) ? new osparc . dashboard . GridButtonNew ( title , desc ) : new osparc . dashboard . ListButtonNew ( title , desc ) ;
919- newEmptyStudyBtn . setCardKey ( "new-study" ) ;
920- newEmptyStudyBtn . subscribeToFilterGroup ( "searchBarFilter" ) ;
921- osparc . utils . Utils . setIdToWidget ( newEmptyStudyBtn , newStudyData [ "idToWidget" ] ) ;
922- newEmptyStudyBtn . addListener ( "tap" , ( ) => this . __newEmptyStudyBtnClicked ( newStudyData [ "newStudyLabel" ] ) ) ;
923- this . _resourcesContainer . addNonResourceCard ( newEmptyStudyBtn ) ;
924- } ,
925-
926- __addNewStudyFromServiceButton : function ( newStudyData ) {
927- if ( "expectedKey" in newStudyData ) {
928- const key = newStudyData [ "expectedKey" ] ;
929- const latestMetadata = osparc . store . Services . getLatest ( key ) ;
930- if ( ! latestMetadata ) {
931- return ;
932- }
933- const title = newStudyData . title + " " + osparc . service . Utils . extractVersionDisplay ( latestMetadata ) ;
934- const desc = newStudyData . description ;
935- const mode = this . _resourcesContainer . getMode ( ) ;
936- const newStudyFromServiceButton = ( mode === "grid" ) ? new osparc . dashboard . GridButtonNew ( title , desc ) : new osparc . dashboard . ListButtonNew ( title , desc ) ;
937- newStudyFromServiceButton . setCardKey ( "new-" + key ) ;
938- if ( newStudyData [ "idToWidget" ] ) {
939- osparc . utils . Utils . setIdToWidget ( newStudyFromServiceButton , newStudyData [ "idToWidget" ] ) ;
940- }
941- newStudyFromServiceButton . addListener ( "tap" , ( ) => this . __newStudyFromServiceBtnClicked ( latestMetadata [ "key" ] , latestMetadata [ "version" ] , newStudyData . newStudyLabel ) ) ;
942- this . _resourcesContainer . addNonResourceCard ( newStudyFromServiceButton ) ;
943- } else if ( "myMostUsed" in newStudyData ) {
944- const excludeFrontend = true ;
945- const excludeDeprecated = true
946- osparc . store . Services . getServicesLatestList ( excludeFrontend , excludeDeprecated )
947- . then ( servicesList => {
948- osparc . service . Utils . sortObjectsBasedOn ( servicesList , {
949- "sort" : "hits" ,
950- "order" : "down"
951- } ) ;
952- for ( let i = 0 ; i < newStudyData [ "myMostUsed" ] ; i ++ ) {
953- const latestMetadata = servicesList [ i ] ;
954- const mode = this . _resourcesContainer . getMode ( ) ;
955- const newStudyFromServiceButton = ( mode === "grid" ) ? new osparc . dashboard . GridButtonNew ( latestMetadata [ "name" ] ) : new osparc . dashboard . ListButtonNew ( latestMetadata [ "name" ] ) ;
956- newStudyFromServiceButton . addListener ( "tap" , ( ) => this . __newStudyFromServiceBtnClicked ( latestMetadata [ "key" ] , latestMetadata [ "version" ] , latestMetadata [ "name" ] ) ) ;
957- this . _resourcesContainer . addNonResourceCard ( newStudyFromServiceButton ) ;
958- }
959- } ) ;
960- }
961- } ,
962-
963895 __addTIPPlusButton : function ( ) {
964896 const mode = this . _resourcesContainer . getMode ( ) ;
965897 const title = this . tr ( "New Plan" ) ;
0 commit comments