Skip to content

Commit

Permalink
Change remaining inputs with class form-control from class to angle b…
Browse files Browse the repository at this point in the history
…racket so that .form-control gives the element full-width

dropdown-container.js : click() : comment out sendAction().
dropdown-row.js : click() : call onClick directly instead of via sendAction().
left-panel.js : add to comment.
entry-base.js : setEditing() : comment out sendAction().
mapview.js : add to comment.

In the following .hbs : for {{input with class=form-control, change {{input to <Input, }} to > and append the required closing </Input>, change value=... to @value={{...}}, except =@, prepend @ for Input args enter, type, escape-press;  change actions from () to {{ }}, change those which are just string names of actions to references, which is required.
This enables the element to have class .form-control, and the corresponding CSS gives the input full-width
  auth-input.hbs
  goto-ensembl.hbs
  goto-feature.hbs
  filter-group.hbs
  manage-block.hbs
  sequence-search.hbs
  blast-results.hbs
  data-csv.hbs
  entry-block.hbs
  entry-dataset.hbs
  entry-record.hbs

left-panel.hbs : pass to upload-data datasets : .serverSelected_datasetsBlocks instead of .datasets which is currently mostly empty.

upload-table.js : getDatasetId() : catch error and display message, e.g. newMap is empty string.
  • Loading branch information
Don-Isdale committed Apr 5, 2024
1 parent 272e831 commit 42582e6
Show file tree
Hide file tree
Showing 18 changed files with 100 additions and 64 deletions.
9 changes: 8 additions & 1 deletion frontend/app/components/elem/dropdown-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ export default Component.extend({
tagName: 'span',
// attributes
click: function() {
this.sendAction('onClick');
/** 3828f884 created this component with this function :
* click: function() { this.sendAction('onClick'); },
* here and in siblings button-refresh and dropdown-row, so it may
* have been an unused leftover in this case.
* 48e5ec2d added {{action this.click }} in .hbs to <button .dropdown-toggle>
* which calls this function, but it's not clear that it has a role.
*/
console.log('dropdown-container', 'click');
},
// classes
// classNames: ['btn'],
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/components/elem/dropdown-row.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default Component.extend({
tagName: 'li',
// attributes
click: function() {
this.sendAction('onClick');
this.onClick();
},
// classes
// actions
Expand Down
3 changes: 2 additions & 1 deletion frontend/app/components/panel/left-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export default Component.extend({
* This has the essentials from panel/manage-explorer.js : datasetsBlocks(),
* and can probably replace it; left-panel can pass this value to manage-explorer.
* Exclude copies from secondary servers, as is done in manage-explorer : datasetsBlocks().
* Currently used by just sequence-search.
* Currently used by just sequence-search and upload-data,
* in place of this.datasets, which is from mapview .dataset, which see.
*/
serverSelected_datasetsBlocks : computed(
'apiServers.serverSelected.datasetsBlocks.[]',
Expand Down
6 changes: 5 additions & 1 deletion frontend/app/components/record/entry-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ export default Component.extend({
actions: {
setEditing: function(editing) {
this.set('editing', editing);
this.sendAction('setEditing', editing);
/** included when this function was added in 3127058e, there is
* no action setEditing other than this function, and presumably
* this had no effect :
* this.sendAction('setEditing', editing);
*/
},
enableEdit: function() {
this.send('setEditing', true);
Expand Down
5 changes: 5 additions & 0 deletions frontend/app/controllers/mapview.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ export default Controller.extend(Evented, componentQueryParams.Mixin, {
//----------------------------------------------------------------------------

/** Array of available datasets populated from model
*
* This is currently not yielding useful values, possibly because
* availableMaps are not re-requested in each re-render; a more
* stable alternative is e.g. left-panel :
* serverSelected_datasetsBlocks().
*/
datasets: computed('model', 'model.availableMapsTask', 'model.availableMapsTask.value', function () {
let task = this.get('model.availableMapsTask');
Expand Down
7 changes: 4 additions & 3 deletions frontend/app/templates/components/auth-input.hbs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<div class="form-group">
{{input
<Input
type=@type
value=@value
@value=@value
placeholder=@placeholder
autocomplete=@autocomplete
class='form-control'}}
class='form-control'>
</Input>
</div>
14 changes: 8 additions & 6 deletions frontend/app/templates/components/goto-ensembl.hbs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<div>
{{input
value=this.featureName
<Input
@value={{this.featureName}}
class="form-control"
placeholder="Marker/Gene Name" }}
placeholder="Marker/Gene Name" >
</Input>

<span href="#" data-toggle="tooltip"
style="margin-right: 1em; margin-left: 1em;"
Expand All @@ -11,10 +12,11 @@
</div>

<div style="flex-wrap: wrap;">
{{input
value=this.baseUrl
<Input
@value={{this.baseUrl}}
class="form-control"
placeholder="Url to configure website" }}
placeholder="Url to configure website" >
</Input>

<select onchange={{action (mut this.website) value="target.value"}}>
{{#each this.websites as |websiteChoice|}}
Expand Down
14 changes: 8 additions & 6 deletions frontend/app/templates/components/goto-feature.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
</div>
</div>

{{input
value=this.feature1
<Input
@value={{this.feature1}}
class="form-control"
placeholder="Marker/Gene Name / Location" }}
placeholder="Marker/Gene Name / Location" >
</Input>

<div>
<input type="checkbox"
Expand All @@ -31,11 +32,12 @@
checked="checked"
/>
<label>Interval</label>
{{input
<Input
type=this.hidden
value=this.feature2
@value={{this.feature2}}
class="form-control"
placeholder="Marker/Gene Name / Location" }}
placeholder="Marker/Gene Name / Location" >
</Input>


</div>
Expand Down
7 changes: 4 additions & 3 deletions frontend/app/templates/components/panel/filter-group.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@
</div>

<div class="filter-group-row">
{{input
value=this.data.pattern
<Input
@value={{this.data.pattern}}
class="form-control"
enter=(action this.changed this)
placeholder="string or regular expression" }}
placeholder="string or regular expression" >
</Input>
{{#elem/button-base
click=(action this.changed this)
icon='ok'
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/templates/components/panel/left-panel.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@

<tab.pane @id="left-panel-upload" id="left-panel-upload" @title="Upload">
{{panel/upload-data
datasets=this.datasets
datasets=this.serverSelected_datasetsBlocks
refreshDatasets=this.refreshDatasets
viewDataset=this.viewDataset
active=(bs-eq tab.activeId "left-panel-upload")
Expand Down
22 changes: 12 additions & 10 deletions frontend/app/templates/components/panel/manage-block.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@
{{/if}}
<li href="#" class="list-group-item list-group-item-info">
<div class="input-group">
{{input
enter=(action "addAnnotation")
type="text"
value=this.newAnnotation
<Input
@enter={{this.actions.addAnnotation}}
@type="text"
@value={{this.newAnnotation}}
class="form-control"
placeholder="New annotation..."}}
placeholder="New annotation...">
</Input>
<span class="input-group-btn">
{{elem/button-base
icon="plus"
Expand Down Expand Up @@ -77,12 +78,13 @@
{{#if this.intervalSelected}}
<li href="#" class="list-group-item list-group-item-info">
<div class="input-group">
{{input
enter=(action "addInterval")
type="text"
value=this.newInterval
<Input
@enter={{this.actions.addInterval}}
@type="text"
@value={{this.newInterval}}
class="form-control"
placeholder="New interval..."}}
placeholder="New interval...">
</Input>
<span class="input-group-btn">
{{elem/button-base
icon="plus"
Expand Down
9 changes: 5 additions & 4 deletions frontend/app/templates/components/panel/sequence-search.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,14 @@ AGCTGGGTGTCGTTGATCTTCAGGTCCTTCTGGATGTACAGCGACGCTCC" >
</span>

<div id="new_dataset_options">
{{input
type="text"
value=this.newDatasetName
<Input
@type="text"
@value={{this.newDatasetName }}
class="form-control"
placeholder="New dataset name..."
disabled=this.isProcessing
}}
>
</Input>
</div>

{{/if}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,14 @@
<br>
{{#if (eq this.selectedDataset 'new')}}
<div id="new_dataset_options">
{{input
<Input
type="text"
value=this.newDatasetName
@value={{this.newDatasetName }}
class="form-control"
placeholder="New dataset name..."
disabled=this.isProcessing
}}
>
</Input>

<br>
<label>Parent: </label>
Expand Down
11 changes: 6 additions & 5 deletions frontend/app/templates/components/panel/upload/data-csv.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@
<br>
{{#if (eq this.selectedDataset 'new')}}
<div id="new_dataset_options">
{{input
type="text"
value=this.newDatasetName
<Input
@type="text"
@value={{this.newDatasetName }}
class="form-control"
placeholder="New dataset name..."
disabled=this.isProcessing
}}
@disabled={{this.isProcessing}}
>
</Input>
<br>
<label>Parent: </label>
<select
Expand Down
13 changes: 7 additions & 6 deletions frontend/app/templates/components/record/entry-block.hbs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{{#if this.editing }}
<div class="input-group">
{{input
enter=(action "saveEdit" this.entry)
escape-press=(action "cancelEdit" this.entry)
type="text"
value=this.entry.name
<Input
@enter={{action this.actions.saveEdit this.entry}}
@escape-press={{action this.actions.cancelEdit this.entry}}
@type="text"
@value={{this.entry.name}}
class="form-control"
placeholder="Placeholder"}}
placeholder="Placeholder">
</Input>
<span class="input-group-btn">
{{elem/button-base
icon="ok"
Expand Down
13 changes: 7 additions & 6 deletions frontend/app/templates/components/record/entry-dataset.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
<li class="list-group-item list-group-item-info {{if (compare this.entry.id '===' this.selectedDataset.id) 'list-group-item-warning'}}" {{action "selectDataset" this.entry on="click"}} style="display:flex">
{{#if this.editing }}
<div class="input-group">
{{input
enter=(action "saveEdit" this.entry)
escape-press=(action "cancelEdit" this.entry)
type="text"
value=this.entry.displayName
<Input
@enter={{action this.actions.saveEdit this.entry}}
@escape-press={{action this.actions.cancelEdit this.entry}}
@type="text"
@value={{this.entry.displayName}}
class="form-control"
placeholder="Placeholder"}}
placeholder="Placeholder">
</Input>
<span class="input-group-btn">
{{elem/button-base
icon="ok"
Expand Down
13 changes: 7 additions & 6 deletions frontend/app/templates/components/record/entry-record.hbs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{{#if this.editing }}
<div class="input-group">
{{input
enter=(action "saveEdit" this.entry)
escape-press=(action "cancelEdit" this.entry)
type="text"
value=this.entry.name
<Input
@enter={{action this.actions.saveEdit this.entry}}
@escape-press={{action this.actions.cancelEdit this.entry}}
@type="text"
@value={{this.entry.name}}
class="form-control"
placeholder="Placeholder"}}
placeholder="Placeholder">
</Input>
<span class="input-group-btn">
{{elem/button-base
icon="ok"
Expand Down
7 changes: 6 additions & 1 deletion frontend/app/utils/panel/upload-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default {
/** Returns a selected dataset name OR
* Attempts to create a new dataset with entered name */
getDatasetId() {
const fnName = 'getDatasetId';
var that = this;
let datasets = that.get('datasets');
return new Promise(function(resolve, reject) {
Expand Down Expand Up @@ -61,7 +62,11 @@ export default {
let newDataset = that.get('store').createRecord('Dataset', newDetails);
newDataset.save().then(() => {
resolve(newDataset.id);
});
})
.catch((err) => {
dLog(fnName, newDetails, err);
that.setError(err.message + '\n' + newMap);
});
}
}
});
Expand Down

0 comments on commit 42582e6

Please sign in to comment.