Commit 759b1de0 authored by Pettersson Tomas's avatar Pettersson Tomas

added minmax1y

parent f32c6c55
......@@ -438,6 +438,7 @@ var STWkit;
var self = _this;
self.domain = domain;
self.forcingmodel = forcingmodel;
var minmax1y = (options && options.hasOwnProperty('minmax1y')) ? options.minmax1y : false;
var type = (options && options.hasOwnProperty('type')) ? options.type : '';
var subtype = (options && options.hasOwnProperty('subtype')) ? options.subtype : '';
var initials = (options && options.hasOwnProperty('initials')) ? options.initials : '';
......@@ -459,6 +460,10 @@ var STWkit;
self.timeFormat = 'HH:mm';
self.minDate = moment.utc().startOf('hour').subtract(72, 'hours');
self.maxDate = moment.utc().startOf('hour').add(240, 'hours');
if (minmax1y) {
self.minDate = moment.utc().startOf('hour').subtract(1, 'year');
self.maxDate = moment.utc().startOf('hour').add(1, 'year');
}
var fieldset = L.DomUtil.create('fieldset', '', form);
var availableRowDiv = L.DomUtil.create('div', 'uk-form-row', fieldset);
_super.prototype.addLabelDiv.call(_this, availableRowDiv, "Selected period (UTC)", "See more information <a style='color:#faa732;' href='help/classic?domain=" + domain.toLowerCase() + "#" + type + "-" + subtype + "-period' target='_blank'>here</a>");
......@@ -577,8 +582,10 @@ var STWkit;
method: 'get',
type: 'json',
success: function (data) {
self.minDate = moment.utc(data.availableTime.start);
self.maxDate = moment.utc(data.availableTime.stop);
if (!minmax1y) {
self.minDate = moment.utc(data.availableTime.start);
self.maxDate = moment.utc(data.availableTime.stop);
}
var sliderOpt = {};
sliderOpt['min'] = self.minDate.format("X");
sliderOpt['max'] = self.maxDate.format("X");
......@@ -607,6 +614,15 @@ var STWkit;
self.startTimeInput.value = changeCard.obsTimeInput.value;
self.updateFromStartDate();
}
if ((typeof changeCard.to !== 'undefined')) {
if (changeCard.to.isBefore(self.minDate) || changeCard.to.isAfter(self.maxDate))
return;
self.to = changeCard.to.clone();
self.adjustDateToRange();
self.updateSlider();
if (self.ready)
self.validate();
}
};
PeriodCard.prototype.isDateValid = function (date) {
var self = this;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -490,6 +490,7 @@ module STWkit {
self.domain = domain;
self.forcingmodel = forcingmodel;
var minmax1y = (options && options.hasOwnProperty('minmax1y'))?options.minmax1y:false;
var type = (options && options.hasOwnProperty('type'))?options.type:'';
var subtype = (options && options.hasOwnProperty('subtype'))?options.subtype:'';
var initials = (options && options.hasOwnProperty('initials'))?options.initials:'';
......@@ -510,6 +511,10 @@ module STWkit {
self.timeFormat = 'HH:mm';
self.minDate = moment.utc().startOf('hour').subtract(72, 'hours');
self.maxDate = moment.utc().startOf('hour').add(240, 'hours');
if (minmax1y) {
self.minDate = moment.utc().startOf('hour').subtract(1, 'year');
self.maxDate = moment.utc().startOf('hour').add(1, 'year');
}
var fieldset = <HTMLFieldSetElement>L.DomUtil.create('fieldset', '', form);
var availableRowDiv = <HTMLDivElement>L.DomUtil.create('div', 'uk-form-row', fieldset);
super.addLabelDiv(availableRowDiv, "Selected period (UTC)", "See more information <a style='color:#faa732;' href='help/classic?domain="+domain.toLowerCase()+"#"+type+"-"+subtype+"-period' target='_blank'>here</a>");
......@@ -637,8 +642,10 @@ module STWkit {
method: 'get',
type: 'json',
success: function (data) {
self.minDate = moment.utc(data.availableTime.start);
self.maxDate = moment.utc(data.availableTime.stop);
if (!minmax1y) {
self.minDate = moment.utc(data.availableTime.start);
self.maxDate = moment.utc(data.availableTime.stop);
}
var sliderOpt = {};
sliderOpt['min'] = self.minDate.format("X");
sliderOpt['max'] = self.maxDate.format("X");
......@@ -669,6 +676,14 @@ module STWkit {
self.startTimeInput.value = changeCard.obsTimeInput.value;
self.updateFromStartDate();
}
if ((typeof changeCard.to !== 'undefined')) {
if (changeCard.to.isBefore(self.minDate) || changeCard.to.isAfter(self.maxDate)) return;
self.to = changeCard.to.clone();
self.adjustDateToRange();
self.updateSlider();
if (self.ready) self.validate();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment