Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions lib/public/components/Filters/RunsFilter/environmentId.js

This file was deleted.

30 changes: 0 additions & 30 deletions lib/public/components/Filters/RunsFilter/nDetectors.js

This file was deleted.

36 changes: 0 additions & 36 deletions lib/public/components/Filters/RunsFilter/nEpns.js

This file was deleted.

30 changes: 0 additions & 30 deletions lib/public/components/Filters/RunsFilter/nFlps.js

This file was deleted.

30 changes: 0 additions & 30 deletions lib/public/components/Filters/RunsFilter/odcTopologyFullName.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
* or submit itself to any jurisdiction.
*/

import { checkboxes } from '../common/filters/checkboxFilter.js';
import { expandedSelectionFilter } from '../common/filters/checkboxFilter.js';

/**
* Renders a list of checkboxes that lets the user look for runs with specific definition
*
* @param {RunDefinitionFilterModel} runDefinitionFilterModel run definition filter model
* @return {Component} the filter
*/
export const runDefinitionFilter = (runDefinitionFilterModel) => checkboxes(
export const runDefinitionFilter = (runDefinitionFilterModel) => expandedSelectionFilter(

Check warning on line 22 in lib/public/components/Filters/RunsFilter/runDefinitionFilter.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/Filters/RunsFilter/runDefinitionFilter.js#L22

Added line #L22 was not covered by tests
runDefinitionFilterModel.selectionModel,
{ selector: 'run-definition' },
);
29 changes: 0 additions & 29 deletions lib/public/components/Filters/RunsFilter/runQuality.js

This file was deleted.

2 changes: 1 addition & 1 deletion lib/public/components/Filters/common/FilterModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@
*/
_addSubmodel(subModel) {
subModel.bubbleTo(this);
subModel?.visualChange$.bubbleTo(this._visualChange$);
subModel.visualChange$?.bubbleTo(this._visualChange$);

Check warning on line 81 in lib/public/components/Filters/common/FilterModel.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/Filters/common/FilterModel.js#L81

Added line #L81 was not covered by tests
}
}
2 changes: 1 addition & 1 deletion lib/public/components/Filters/common/TagFilterModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class TagFilterModel extends FilterModel {
* Constructor
*
* @param {ObservableData<RemoteData<Tag[], ApiError>>} tags$ observable remote data of tags list
* @param {SelectionOption} [operators] optionally the list of available operators for the filter
* @param {SelectionOption[]} [operators] optionally the list of available operators for the filter
* @constructor
*/
constructor(tags$, operators) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* or submit itself to any jurisdiction.
*/

import { SelectionDropdownModel } from '../../../common/selection/dropdown/SelectionDropdownModel.js';
import { SelectionModel } from '../../../common/selection/SelectionModel.js';

const numericalComparisonOptions = Object.freeze([
{ value: '<' },
Expand All @@ -24,7 +24,7 @@ const numericalComparisonOptions = Object.freeze([
/**
* Model storing state of a selection of comparison operator
*/
export class ComparisonSelectionModel extends SelectionDropdownModel {
export class ComparisonSelectionModel extends SelectionModel {
/**
* Constructor
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,6 @@
const { useOperatorAsNormalizationKey, scale = 1, integer = false } = options || {};
this._useOperatorAsNormalizationKey = Boolean(useOperatorAsNormalizationKey);

this._operatorSelectionModel = new ComparisonSelectionModel();
this._operatorSelectionModel.visualChange$.bubbleTo(this._visualChange$);
this._operatorSelectionModel.observe(() => {
if (!this._operandInputModel.isEmpty) {
this.notify();
}
});

this._operandInputModel = new ProcessedTextInputModel({
parse: (raw) => {
const number = integer ? parseInt(raw, 10) : parseFloat(raw);
Expand All @@ -48,8 +40,10 @@
return number * scale;
},
});
this._operandInputModel.visualChange$.bubbleTo(this._visualChange$);
this._operandInputModel.bubbleTo(this);
this._addSubmodel(this._operandInputModel);

Check warning on line 43 in lib/public/components/Filters/common/filters/NumericalComparisonFilterModel.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/Filters/common/filters/NumericalComparisonFilterModel.js#L43

Added line #L43 was not covered by tests

this._operatorSelectionModel = new ComparisonSelectionModel();
this._operatorSelectionModel.observe(() => this._operandInputModel.raw ? this.notify() : this._visualChange$.notify());

Check warning on line 46 in lib/public/components/Filters/common/filters/NumericalComparisonFilterModel.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/Filters/common/filters/NumericalComparisonFilterModel.js#L45-L46

Added lines #L45 - L46 were not covered by tests
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* granted to it by virtue of its status as an Intergovernmental Organization
* or submit itself to any jurisdiction.
*/

import { FilterModel } from '../FilterModel.js';
import { SelectionModel } from '../../../common/selection/SelectionModel.js';

Expand Down
21 changes: 5 additions & 16 deletions lib/public/components/Filters/common/filters/checkboxFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*/

import { h } from '/js/src/index.js';
import { selectionOptions } from '../../../common/selection/selectionOptions.js';

/**
* A general component for generating checkboxes.
Expand Down Expand Up @@ -47,19 +48,7 @@
* @param {string} [additionalProperties.selector] input identifiers prefix
* @return {Component} filter component
*/
export const checkboxes = (selectionModel, additionalProperties = {}) => {
const { selector = 'checkboxes' } = additionalProperties;

return h('.flex-row.flex-wrap', selectionModel.options.map((option) => h('.form-check.flex-grow', [
h('input.form-check-input', {
id: `${selector}-checkbox-${option.value}`,
type: 'checkbox',
checked: selectionModel.isSelected(option),
onchange: () => selectionModel.isSelected(option) ? selectionModel.deselect(option) : selectionModel.select(option),
...additionalProperties,
}),
h('label.form-check-label', {
for: `${selector}-checkbox-${option.value}`,
}, option.label || option.value),
])));
};
export const expandedSelectionFilter = (selectionModel, additionalProperties = {}) => h(

Check warning on line 51 in lib/public/components/Filters/common/filters/checkboxFilter.js

View check run for this annotation

Codecov / codecov/patch

lib/public/components/Filters/common/filters/checkboxFilter.js#L51

Added line #L51 was not covered by tests
'.flex-row.flex-wrap.gc4',
selectionOptions(selectionModel, { selectorPrefix: additionalProperties.selector }),
);
Loading
Loading