Skip to content

Commit

Permalink
Hide Selected Server in the Search tab when there is only the primary…
Browse files Browse the repository at this point in the history
… server connected

Closes #437.
select-server.hbs : use this. prefix for component attribute .servers, part of framework upgrade #370.
left-panel.js : alias multipleServers because its basis may change; for hiding Panel::SelectedServer.
api-server.js : featuresCountAllTaskInstance() : call to getBlocksTask / getBlocksLimits : change param blockIds from [] to undefined, i.e. default to all blocks;  passing [] was an error in 126a15a which added this function.
api-servers.js : add multipleServersCP(), which enables panel/left-panel.hbs to update whereas using multipleServers does not.
left-panel.hbs : hide Panel::SelectedServer if not multipleServers.
  • Loading branch information
Don-Isdale committed Nov 28, 2024
1 parent 4acddde commit b550d0d
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 4 deletions.
2 changes: 1 addition & 1 deletion frontend/app/components/form/select-server.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<select onchange={{action (action this.selectedServerChangedName) value="target.value" }}>
{{#each-in servers as |apiServerName apiServer| }}
{{#each-in this.servers as |apiServerName apiServer| }}
<option value={{apiServer.tabId}} selected={{eq @selectedValue apiServer}}>{{apiServer.tabId}}</option>

{{/each-in}}
Expand Down
6 changes: 6 additions & 0 deletions frontend/app/components/panel/left-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ export default Component.extend({
attributeBindings: ['style:style'],
view: 'mapview',

/** Determine if the 'Selected Server' <Panel::SelectedServer> should be displayed.
* There is no need to display it if the number of api servers is 1, i.e. only
* connected to the primary pretzel server.
*/
multipleServers : alias('apiServers.multipleServersCP'),

/** Return a list of datasets, with their included blocks, for the currently-selected
* API server tab
*
Expand Down
4 changes: 2 additions & 2 deletions frontend/app/components/service/api-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,8 @@ const ApiServerAttributes = {
// (allInitially ? '' : 'Summary')
let getBlocksTask = blockService.get('getBlocksLimits');

/** Task Instance. param blockIds is [] */
let getBlocksTI = getBlocksTask.apply(blockService, [[]]);
/** Task Instance. param blockIds is undefined, i.e. default to all blocks */
let getBlocksTI = getBlocksTask.apply(blockService, []);

return getBlocksTI;
}),
Expand Down
13 changes: 13 additions & 0 deletions frontend/app/services/api-servers.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export default Service.extend(Evented, {

/** Map of servers, indexed by server .name */
servers : EmberObject.create(),
// @tracked
serversLength : 0,
/** Map from block and dataset ids to their server.
* Block and dataset ids could be mapped separately, but it is unlikely those
Expand Down Expand Up @@ -117,6 +118,18 @@ export default Service.extend(Evented, {
get multipleServers() {
return this.serversLength > 1;
},
/** Identical to .multipleServers() which works OK in templates/group{,s}.hbs
* (perhaps because that is a route), but it doesn't update in panel/left-panel.hbs;
* this updates OK. Possibly this won't be needed after the service and Component
* are converted from classic Ember Components to native classes.
*
* Copied from components/draw/axis-menu.js, which was based on an extract
* from axisTitleBlocksServers_tspan.js
*/
multipleServersCP : computed('serversLength', function () {
return this.get('serversLength') > 1;
}),


/** Add a new ApiServer.
* Store it in this.servers, indexed by .name = .host_safe()
Expand Down
6 changes: 5 additions & 1 deletion frontend/app/templates/components/panel/left-panel.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@
updateFeaturesInBlocks=this.updateFeaturesInBlocks
}}

<Panel::SelectedServer/>
{{!-- There is no need to display SelectedServer if the number of
api servers is 1, i.e. only connected to the primary pretzel server. --}}
{{#if this.multipleServers}}
<Panel::SelectedServer/>
{{/if}}

{{panel/sequence-search
datasets=this.serverSelected_datasetsBlocks
Expand Down

0 comments on commit b550d0d

Please sign in to comment.