Commit 9f30829b authored by Tomas Pettersson's avatar Tomas Pettersson 🏸

bugfixes

parent 1d5c9f10
......@@ -149,12 +149,15 @@
"domain": "NS02"
};
var domainname = "HELCOM";
reqwest({
url: "forcing/config" + STWkit.jsonToQueryString(forcing),
method: 'get',
type: 'json',
success: function (forcing) {
var osproperties = {
"domain" : domainname,
"lang": language,
"langdata": langData
};
......
......@@ -328,11 +328,13 @@ var OSLocation = (function (_super) {
}(OilSpillCard));
var OSPeriod = (function (_super) {
__extends(OSPeriod, _super);
function OSPeriod(id, parentDiv, lang, map) {
function OSPeriod(id, parentDiv, lang, map, domain, forcingmodel) {
var _this = this;
var periodDiv = L.DomUtil.create('div', 'uk-width-1-1 uk-margin-top', parentDiv);
_this = _super.call(this, id, 'Simulation period', parentDiv, periodDiv) || this;
var self = _this;
self.domain = domain;
self.forcingmodel = forcingmodel;
var form = L.DomUtil.create('form', 'uk-form uk-form-stacked', periodDiv);
form.onsubmit = function (e) {
e.preventDefault();
......@@ -436,22 +438,25 @@ var OSPeriod = (function (_super) {
self.updateSlider();
};
UIkit.ready(function () {
reqwest({
url: "availableTimes/ms/HELCOM_NEMO",
method: 'get',
type: 'json',
success: function (data) {
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");
self.slider.update(sliderOpt);
}
});
var startDatePicker = UIkit.datepicker(self.startDateInput, { minDate: self.minDate.format(self.dateFormat), maxDate: self.maxDate.format(self.dateFormat), format: self.dateFormat });
var startTimePicker = UIkit.timepicker(self.startTimeInput, {});
self.defaults();
if (!self.ready) {
reqwest({
url: "availableTimes/ms/" + self.domain + "_" + self.forcingmodel,
method: 'get',
type: 'json',
success: function (data) {
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");
self.slider.update(sliderOpt);
self.ready = true;
}
});
var startDatePicker = UIkit.datepicker(self.startDateInput, { minDate: self.minDate.format(self.dateFormat), maxDate: self.maxDate.format(self.dateFormat), format: self.dateFormat });
var startTimePicker = UIkit.timepicker(self.startTimeInput, {});
self.defaults();
}
});
return _this;
}
......@@ -943,8 +948,11 @@ var L;
if (options.langdata) {
_this.langData = options.langdata;
}
_this.forcingmodel = "NEMO";
if (options.forcing) {
_this.forcing = options.forcing;
if ((_this.forcing.features.length > 0) && (_this.forcing.features[0].properties))
_this.forcingmodel = _this.forcing.features[0].properties.model;
}
return _this;
}
......@@ -1047,7 +1055,7 @@ var L;
self.cardMap[locationid] = new OSLocation(locationid, accordionDiv, self.lang, self.langData, self.map, self.forcing);
self.cardMap[locationid].show();
var periodid = 'osperiodCard';
self.cardMap[periodid] = new OSPeriod(periodid, accordionDiv, self.lang, self.map);
self.cardMap[periodid] = new OSPeriod(periodid, accordionDiv, self.lang, self.map, self.domain, self.forcingmodel);
var oiltypeid = 'osoiltypeCard';
self.cardMap[oiltypeid] = new OSType(oiltypeid, accordionDiv, self.lang, self.map);
var amountid = 'osamountCard';
......
......@@ -328,11 +328,13 @@ var OSLocation = (function (_super) {
}(OilSpillCard));
var OSPeriod = (function (_super) {
__extends(OSPeriod, _super);
function OSPeriod(id, parentDiv, lang, map) {
function OSPeriod(id, parentDiv, lang, map, domain, forcingmodel) {
var _this = this;
var periodDiv = L.DomUtil.create('div', 'uk-width-1-1 uk-margin-top', parentDiv);
_this = _super.call(this, id, 'Simulation period', parentDiv, periodDiv) || this;
var self = _this;
self.domain = domain;
self.forcingmodel = forcingmodel;
var form = L.DomUtil.create('form', 'uk-form uk-form-stacked', periodDiv);
form.onsubmit = function (e) {
e.preventDefault();
......@@ -436,22 +438,25 @@ var OSPeriod = (function (_super) {
self.updateSlider();
};
UIkit.ready(function () {
reqwest({
url: "availableTimes/ms/HELCOM_NEMO",
method: 'get',
type: 'json',
success: function (data) {
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");
self.slider.update(sliderOpt);
}
});
var startDatePicker = UIkit.datepicker(self.startDateInput, { minDate: self.minDate.format(self.dateFormat), maxDate: self.maxDate.format(self.dateFormat), format: self.dateFormat });
var startTimePicker = UIkit.timepicker(self.startTimeInput, {});
self.defaults();
if (!self.ready) {
reqwest({
url: "availableTimes/ms/" + self.domain + "_" + self.forcingmodel,
method: 'get',
type: 'json',
success: function (data) {
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");
self.slider.update(sliderOpt);
self.ready = true;
}
});
var startDatePicker = UIkit.datepicker(self.startDateInput, { minDate: self.minDate.format(self.dateFormat), maxDate: self.maxDate.format(self.dateFormat), format: self.dateFormat });
var startTimePicker = UIkit.timepicker(self.startTimeInput, {});
self.defaults();
}
});
return _this;
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -33,8 +33,11 @@ var L;
if (options.langdata) {
_this.langData = options.langdata;
}
_this.forcingmodel = "NEMO";
if (options.forcing) {
_this.forcing = options.forcing;
if ((_this.forcing.features.length > 0) && (_this.forcing.features[0].properties))
_this.forcingmodel = _this.forcing.features[0].properties.model;
}
return _this;
}
......@@ -137,7 +140,7 @@ var L;
self.cardMap[locationid] = new OSLocation(locationid, accordionDiv, self.lang, self.langData, self.map, self.forcing);
self.cardMap[locationid].show();
var periodid = 'osperiodCard';
self.cardMap[periodid] = new OSPeriod(periodid, accordionDiv, self.lang, self.map);
self.cardMap[periodid] = new OSPeriod(periodid, accordionDiv, self.lang, self.map, self.domain, self.forcingmodel);
var oiltypeid = 'osoiltypeCard';
self.cardMap[oiltypeid] = new OSType(oiltypeid, accordionDiv, self.lang, self.map);
var amountid = 'osamountCard';
......
This diff is collapsed.
......@@ -24,6 +24,7 @@ module L.Control {
private uncertaintyInput: HTMLInputElement;
private startButton: HTMLButtonElement;
private forcing: any;
private forcingmodel: string;
private id: any;
constructor(options) {
......@@ -38,9 +39,12 @@ module L.Control {
if (options.langdata) {
this.langData = options.langdata;
}
this.forcingmodel = "NEMO";
if (options.forcing) {
this.forcing = options.forcing;
}
this.forcing = options.forcing;
if ((this.forcing.features.length > 0) && (this.forcing.features[0].properties))
this.forcingmodel = this.forcing.features[0].properties.model;
}
}
......@@ -146,7 +150,7 @@ module L.Control {
self.cardMap[locationid] = new OSLocation(locationid, accordionDiv, self.lang, self.langData, self.map, self.forcing);
self.cardMap[locationid].show();
var periodid = 'osperiodCard';
self.cardMap[periodid] = new OSPeriod(periodid, accordionDiv, self.lang, self.map);
self.cardMap[periodid] = new OSPeriod(periodid, accordionDiv, self.lang, self.map, self.domain, self.forcingmodel);
var oiltypeid = 'osoiltypeCard';
self.cardMap[oiltypeid] = new OSType(oiltypeid, accordionDiv, self.lang, self.map);
var amountid = 'osamountCard';
......
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