Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
xsalonx committed Apr 11, 2024
1 parent 2a58963 commit 4dda213
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { DateTimeInputModel } from '../../../common/form/inputs/DateTimeInputMod
/**
* Model for a date time limits filter
*/
export class TimeRangeFilterModel extends FilterModel {
export class TimeRangeInputModel extends FilterModel {
/**
* Constructor
*
Expand All @@ -33,6 +33,7 @@ export class TimeRangeFilterModel extends FilterModel {
* @param {object} [configuration] the inputs configuration
* @param {(boolean|{from: boolean, to: boolean})} [configuration.required] defines if the from/to dates are required (true means both are
* required)
* @property {boolean} [configuration.seconds=false] states if the input has granularity up to seconds (if not, granularity is minutes)
*/
constructor(value, periodLabel, configuration) {
super();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const monthsOptions = ({ onChange }) => {
/**
* Return a time range filter component
*
* @param {TimeRangeFilterModel} timeRangeFilterModel the model of the filter
* @param {TimeRangeInputModel} timeRangeFilterModel the model of the filter
* @return {Component} the resulting component
*/
export const timeRangeFilter = (timeRangeFilterModel) => dropdown(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ import { DateTimeInputComponent } from '../../../common/form/inputs/DateTimeInpu
/**
* Return a time range input component
*
* @param {TimeRangeFilterModel} timeRangeInputModel the model of the time range input
* @param {TimeRangeInputModel} timeRangeInputModel the model of the time range input
* @param {TimeRangeInputComponentOptions} options input options
* @return {Component} time range input component
*/
export const timeRangeInput = (timeRangeInputModel, { seconds, min, max } = {}) => {
Expand Down
4 changes: 2 additions & 2 deletions lib/public/views/QcFlags/Create/QcFlagCreationModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { RemoteData } from '/js/src/index.js';
import { QcFlagTypesSelectionDropdownModel }
from '../../../components/qcFlags/qcFlagTypesSelectionDropdownModel.js';
import { getRemoteData } from '../../../utilities/fetch/getRemoteData.js';
import { TimeRangeFilterModel } from '../../../components/Filters/common/filters/TimeRangeFilterModel.js';
import { TimeRangeInputModel } from '../../../components/Filters/common/filters/TimeRangeInputModel.js';
import { CreationModel } from '../../../models/CreationModel.js';
import { dplDetectorsProvider } from '../../../services/detectors/dplDetectorsProvider.js';

Expand Down Expand Up @@ -119,7 +119,7 @@ export class QcFlagCreationModel extends CreationModel {
Success: (run) => {
const { startTime, endTime } = run;

this._timeRangeModel = new TimeRangeFilterModel(null, null, {
this._timeRangeModel = new TimeRangeInputModel(null, null, {
required: true,
seconds: true,
});
Expand Down
6 changes: 3 additions & 3 deletions lib/public/views/Statistics/StatisticsPageModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { Observable, RemoteData } from '/js/src/index.js';
import { TabbedPanelModel } from '../../components/TabbedPanel/TabbedPanelModel.js';
import { buildUrl } from '../../utilities/fetch/buildUrl.js';
import { RemoteDataSource } from '../../utilities/fetch/RemoteDataSource.js';
import { TimeRangeFilterModel } from '../../components/Filters/common/filters/TimeRangeFilterModel.js';
import { TimeRangeInputModel } from '../../components/Filters/common/filters/TimeRangeInputModel.js';
import { getStartOfDay, getStartOfYear, MILLISECONDS_IN_ONE_DAY } from '../../utilities/dateUtils.js';
import { ObservableData } from '../../utilities/ObservableData.js';

Expand Down Expand Up @@ -43,7 +43,7 @@ export class StatisticsPageModel extends Observable {
from: getStartOfYear().getTime(),
to: new Date(getStartOfDay().getTime() + MILLISECONDS_IN_ONE_DAY).getTime(),
};
this._timeRangeFilterModel = new TimeRangeFilterModel(period, `${new Date(period.from).getUTCFullYear()}`, { required: true });
this._timeRangeFilterModel = new TimeRangeInputModel(period, `${new Date(period.from).getUTCFullYear()}`, { required: true });
this._timeRangeFilterModel.visualChange$.bubbleTo(this);

this._tabbedPanelModel = new StatisticsTabbedPanelModel();
Expand Down Expand Up @@ -84,7 +84,7 @@ export class StatisticsPageModel extends Observable {
/**
* Return the model for time range filter
*
* @return {TimeRangeFilterModel} the time range filter model
* @return {TimeRangeInputModel} the time range filter model
*/
get timeRangeFilterModel() {
return this._timeRangeFilterModel;
Expand Down

0 comments on commit 4dda213

Please sign in to comment.