Skip to content

Commit

Permalink
Apply eslint rules
Browse files Browse the repository at this point in the history
  • Loading branch information
Ehevi committed Sep 13, 2023
1 parent fc59160 commit 6e65e4a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
6 changes: 3 additions & 3 deletions app/public/components/filter/activeFilters.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ import { h } from '/js/src/index.js';
/**
* Component responsible for displaying active filters
* @param {FilterModel} model model repsonsible for filter management for the current model
* @returns {vnode}
* @returns {vnode} active filters chips
*/
export default function activeFilters(model) {
const onClearAll = () => {
model.reset();

Check warning on line 24 in app/public/components/filter/activeFilters.js

View check run for this annotation

Codecov / codecov/patch

app/public/components/filter/activeFilters.js#L23-L24

Added lines #L23 - L24 were not covered by tests
}
};

const onClearFilter = (filter) => {
model.removeFilter(filter.field, filter.value, filter.type);

Check warning on line 28 in app/public/components/filter/activeFilters.js

View check run for this annotation

Codecov / codecov/patch

app/public/components/filter/activeFilters.js#L27-L28

Added lines #L27 - L28 were not covered by tests
}
};

return [

Check warning on line 31 in app/public/components/filter/activeFilters.js

View check run for this annotation

Codecov / codecov/patch

app/public/components/filter/activeFilters.js#L31

Added line #L31 was not covered by tests
h('.flex-wrap.justify-between.items-center',
Expand Down
7 changes: 4 additions & 3 deletions app/public/model/filtering/FilterModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export default class FilterModel extends Observable {
case 'to': {
this._activeFilters[field][type] = [];
this._activeFilters[field][type].push(value);
break;

Check warning on line 42 in app/public/model/filtering/FilterModel.js

View check run for this annotation

Codecov / codecov/patch

app/public/model/filtering/FilterModel.js#L40-L42

Added lines #L40 - L42 were not covered by tests
}
default: break;

Check warning on line 44 in app/public/model/filtering/FilterModel.js

View check run for this annotation

Codecov / codecov/patch

app/public/model/filtering/FilterModel.js#L44

Added line #L44 was not covered by tests
}
Expand All @@ -52,7 +53,7 @@ export default class FilterModel extends Observable {
if (!this._activeFilters.hasOwnProperty(field)) {
this._activeFilters[field] = {

Check warning on line 54 in app/public/model/filtering/FilterModel.js

View check run for this annotation

Codecov / codecov/patch

app/public/model/filtering/FilterModel.js#L53-L54

Added lines #L53 - L54 were not covered by tests
[type]: [],
}
};
}
if (!this._activeFilters[field].hasOwnProperty(type)) {
this.resetFilterValue(field, type);

Check warning on line 59 in app/public/model/filtering/FilterModel.js

View check run for this annotation

Codecov / codecov/patch

app/public/model/filtering/FilterModel.js#L58-L59

Added lines #L58 - L59 were not covered by tests
Expand Down Expand Up @@ -108,10 +109,10 @@ export default class FilterModel extends Observable {
let filterPhrase = '';
for (const [field, typeValues] of Object.entries(this._activeFilters)) {
for (const [type, values] of Object.entries(typeValues)) {
values.forEach((value) => filterPhrase += `${filterPhrase.length ? '&' : ''}filter[${field}]${this.filterTypesMapping(type, value)}`);
values.forEach((value) =>
filterPhrase += `${filterPhrase.length ? '&' : ''}filter[${field}]${this.filterTypesMapping(type, value)}`);

Check warning on line 113 in app/public/model/filtering/FilterModel.js

View check run for this annotation

Codecov / codecov/patch

app/public/model/filtering/FilterModel.js#L109-L113

Added lines #L109 - L113 were not covered by tests
}
}
console.log(filterPhrase);
return filterPhrase;

Check warning on line 116 in app/public/model/filtering/FilterModel.js

View check run for this annotation

Codecov / codecov/patch

app/public/model/filtering/FilterModel.js#L116

Added line #L116 was not covered by tests
}
}
3 changes: 1 addition & 2 deletions app/public/views/periods/PeriodsModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default class PeriodsModel extends Observable {
this._filtering.observe(() => {
this.fetchCurrentPagePeriods();
this.notify();
})
});

this._currentPagePeriods = RemoteData.notAsked();
this._allPeriods = RemoteData.notAsked();
Expand All @@ -76,7 +76,6 @@ export default class PeriodsModel extends Observable {
this._allPeriods = RemoteData.notAsked();

const endpoint = `/api/periods/?${encodeURI(this._filtering.buildFilterPhrase())}`;
console.log(endpoint);
try {
const { items, totalCount } = await getRemoteDataSlice(endpoint);
this._allPeriods = RemoteData.success([...items]);
Expand Down
1 change: 0 additions & 1 deletion app/public/views/periods/overview/periodsContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { RCT } from '../../../config.js';
import title from '../../../components/table/title.js';
import dataActionButtons, { dataActions } from '../../../components/buttons/dataActionButtons.js';
import { anyFiltersActive } from '../../../utils/filtering/filterUtils.js';
import obsoleteActiveFilters from '../../userView/data/table/filtering/obsoleteActiveFilters.js';
import { noDataFound, noMatchingData } from '../../../components/messagePanel/messages.js';
import periodsTableHeader from '../table/periodsTableHeader.js';
import periodsTableRow from '../table/periodsTableRow.js';
Expand Down

0 comments on commit 6e65e4a

Please sign in to comment.