File tree Expand file tree Collapse file tree 7 files changed +46
-7
lines changed
services/static-webserver/client/source/class/osparc Expand file tree Collapse file tree 7 files changed +46
-7
lines changed Original file line number Diff line number Diff line change @@ -183,7 +183,9 @@ qx.Class.define("osparc.dashboard.Dashboard", {
183183 let preResourcesLoaded = false ;
184184 const preResourcePromises = [ ] ;
185185 const groupsStore = osparc . store . Groups . getInstance ( ) ;
186- preResourcePromises . push ( groupsStore . fetchGroupsAndMembers ( ) ) ;
186+ groupsStore . fetchGroupMembers ( ) ;
187+ // OM review this
188+ // preResourcePromises.push(groupsStore.fetchGroupsAndMembers());
187189 preResourcePromises . push ( osparc . store . Services . getServicesLatest ( false ) ) ;
188190 Promise . all ( preResourcePromises )
189191 . then ( ( ) => {
Original file line number Diff line number Diff line change @@ -72,6 +72,7 @@ qx.Class.define("osparc.desktop.MainPage", {
7272 preloadPromises . push ( osparc . store . Jobs . getInstance ( ) . fetchJobsLatest ( ) ) ;
7373 preloadPromises . push ( osparc . data . Permissions . getInstance ( ) . fetchPermissions ( ) ) ;
7474 preloadPromises . push ( osparc . data . Permissions . getInstance ( ) . fetchFunctionPermissions ( ) ) ;
75+ preloadPromises . push ( osparc . store . Groups . getInstance ( ) . fetchGroups ( ) ) ;
7576 Promise . all ( preloadPromises )
7677 . then ( ( ) => {
7778 const mainStack = this . __createMainStack ( ) ;
Original file line number Diff line number Diff line change @@ -369,12 +369,15 @@ qx.Class.define("osparc.navigation.NavigationBar", {
369369 position : "top-right" ,
370370 appearance : "menu-wider" ,
371371 } ) ;
372- const menuButton = new qx . ui . form . MenuButton ( null , "@FontAwesome5Regular/question-circle/22 " , menu ) . set ( {
372+ const menuButton = new qx . ui . form . MenuButton ( null , "@FontAwesome5Regular/question-circle/24 " , menu ) . set ( {
373373 backgroundColor : "transparent"
374374 } ) ;
375375
376376 osparc . utils . Utils . setIdToWidget ( menu , "helpNavigationMenu" ) ;
377377
378+ // add support conversations
379+ osparc . store . Support . addSupportConversationsToMenu ( menu ) ;
380+
378381 // quick starts and manuals
379382 osparc . store . Support . addQuickStartToMenu ( menu ) ;
380383 osparc . store . Support . addGuidedToursToMenu ( menu ) ;
Original file line number Diff line number Diff line change @@ -418,8 +418,8 @@ qx.Class.define("osparc.product.Utils", {
418418 return Boolean ( osparc . store . Products . getInstance ( ) . getGroupedServicesUiConfig ( ) ) ;
419419 } ,
420420
421- isSupportCenterEnabled : function ( ) {
422- return Boolean ( osparc . store . Products . getInstance ( ) . getSupportCenterGroupId ( ) ) ;
421+ isSupportEnabled : function ( ) {
422+ return Boolean ( osparc . store . Products . getInstance ( ) . getSupportGroupId ( ) ) ;
423423 } ,
424424 }
425425} ) ;
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ qx.Class.define("osparc.store.Groups", {
6666 members : {
6767 groupsCached : null ,
6868
69- __fetchGroups : function ( ) {
69+ fetchGroups : function ( ) {
7070 if ( osparc . auth . Data . getInstance ( ) . isGuest ( ) ) {
7171 return new Promise ( resolve => {
7272 resolve ( [ ] ) ;
@@ -116,9 +116,20 @@ qx.Class.define("osparc.store.Groups", {
116116 } ) ;
117117 } ,
118118
119+ fetchGroupMembers : function ( ) {
120+ // reset Users
121+ const usersStore = osparc . store . Users . getInstance ( ) ;
122+ usersStore . resetUsers ( ) ;
123+ const orgs = this . getOrganizations ( ) ;
124+ const promises = Object . keys ( orgs ) . map ( orgId => this . __fetchGroupMembers ( orgId ) ) ;
125+ Promise . all ( promises )
126+ . then ( ( ) => resolve ( ) )
127+ . catch ( err => console . error ( err ) ) ;
128+ } ,
129+
119130 fetchGroupsAndMembers : function ( ) {
120131 return new Promise ( resolve => {
121- this . __fetchGroups ( )
132+ this . fetchGroups ( )
122133 . then ( orgs => {
123134 // reset Users
124135 const usersStore = osparc . store . Users . getInstance ( ) ;
Original file line number Diff line number Diff line change @@ -126,8 +126,15 @@ qx.Class.define("osparc.store.Products", {
126126 return this . __uiConfig [ "groupedServices" ] ;
127127 } ,
128128
129- getSupportCenterGroupId : function ( ) {
129+ getSupportGroupId : function ( ) {
130130 return 23 ;
131131 } ,
132+
133+ amIASupportUser : function ( ) {
134+ const supportGroupId = this . getSupportGroupId ( ) ;
135+ const groupsStore = osparc . store . Groups . getInstance ( ) ;
136+ const myGroupIds = groupsStore . getOrganizationIds ( ) ;
137+ return ( supportGroupId && myGroupIds . includes ( supportGroupId ) ) ;
138+ } ,
132139 }
133140} ) ;
Original file line number Diff line number Diff line change @@ -19,6 +19,21 @@ qx.Class.define("osparc.store.Support", {
1919 return osparc . store . VendorInfo . getInstance ( ) . getManuals ( ) ;
2020 } ,
2121
22+ addSupportConversationsToMenu : function ( menu ) {
23+ if ( osparc . product . Utils . isSupportEnabled ( ) ) {
24+ const supportCenterButton = new qx . ui . menu . Button ( ) . set ( {
25+ label : qx . locale . Manager . tr ( "Ask a Question" ) ,
26+ icon : "@FontAwesome5Regular/question-circle/16" ,
27+ } ) ;
28+ if ( osparc . store . Products . getInstance ( ) . amIASupportUser ( ) ) {
29+ supportCenterButton . set ( {
30+ label : qx . locale . Manager . tr ( "Support Center" ) ,
31+ } ) ;
32+ }
33+ menu . add ( supportCenterButton ) ;
34+ }
35+ } ,
36+
2237 addQuickStartToMenu : function ( menu ) {
2338 const quickStart = osparc . product . quickStart . Utils . getQuickStart ( ) ;
2439 if ( quickStart ) {
You can’t perform that action at this time.
0 commit comments