Commit ff6821fa authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Amplía vista de dashboard

Añade panel de mapa para localizar el sitio.
Simplifica y renombra filtro de fechas para windRose.
Añade datos de acceso para estación meteo.
Recupera filtro por defecto de últimas 24 horas.
parent f3deb38d
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ define([
	, 'redmic/modules/base/_Store'
	, 'redmic/modules/chart/layer/ChartLayer/WindRoseChartImpl'
	, 'redmic/modules/chart/layer/ChartLayer/_ObtainableValue'
	, 'redmic/modules/chart/Toolbar/DataFilterImpl'
	, 'redmic/modules/chart/Toolbar/DateFilterImpl'
	, 'redmic/modules/chart/Toolbar/GridManagementImpl'
	, 'redmic/modules/chart/Toolbar/SliderSelectorImpl'
], function (
@@ -25,7 +25,7 @@ define([
	, _Store
	, WindRoseChartImpl
	, _ObtainableValue
	, DataFilterImpl
	, DateFilterImpl
	, GridManagementImpl
	, SliderSelectorImpl
){
@@ -98,7 +98,7 @@ define([

			this.gridManagement = new GridManagementImpl(this.gridManagementConfig);

			this.dataFilter = new DataFilterImpl({
			this.dataFilter = new DateFilterImpl({
				parentChannel: this.getChannel()
			});
		},
@@ -267,7 +267,7 @@ define([
			if (!this._startDate || !this._endDate) {
				var currentDate = moment();
				this._endDate = currentDate.toISOString();
				this._startDate = currentDate.subtract(1, 'hours').toISOString();
				this._startDate = currentDate.subtract(1, 'days').toISOString();
			}

			this._queryObj = {
+1 −1
Original line number Diff line number Diff line
@@ -1163,7 +1163,7 @@ define({

	, "windrose": "Rosa de los vientos"
	, "sliderSelector": "Selector desplazable"
	, "dataFilter": "Filtro de datos"
	, "dateFilter": "Filtro por fecha"

	// Para capas que no se pueden cambiar las keys
	, "descript_1": "Descripción"
+1 −1
Original line number Diff line number Diff line
@@ -1168,7 +1168,7 @@ define({

		, "windrose": "Wind rose"
		, "sliderSelector": "Slider selector"
		, "dataFilter": "Data filter"
		, "dateFilter": "Date filter"

		//Para capas que no se pueden cambiar las keys
		, "descript_1": "Description"
+79 −6
Original line number Diff line number Diff line
@@ -12,7 +12,12 @@ define([
	, "redmic/modules/chart/ChartsContainer/_LegendBar"
	, "redmic/modules/chart/ChartsContainer/_RadialAxisWithGridDrawing"
	, "redmic/modules/layout/templateDisplayer/TemplateDisplayer"
	, "redmic/modules/map/layer/GeoJsonLayerImpl"
	, "redmic/modules/map/LeafletImpl"
	, "redmic/modules/map/Map"
	, "redmic/modules/map/_PlaceNamesButton"
	, "templates/RealTimeInfo"
	, "templates/SitePopup"
	, "templates/SurveyStationDashboard"
], function(
	_Main
@@ -28,7 +33,12 @@ define([
	, _LegendBar
	, _RadialAxisWithGridDrawing
	, TemplateDisplayer
	, GeoJsonLayerImpl
	, LeafletImpl
	, Map
	, _PlaceNamesButton
	, RealTimeInfo
	, SitePopupTemplate
	, SurveyStationDashboardTemplate
){
	return declare([Layout, Controller, _Main, _AddBasicTitle], {
@@ -60,6 +70,19 @@ define([
								}
							}
						}]
					},
					'27bad38e-ee75-4fdc-82c9-dfe3d421e677': {
						panels: [{
							type: 'windRose',
							query: {
								terms: {
									dataDefinition: {
										direction: [15],
										speed: [18]
									}
								}
							}
						}]
					}
				}
			};
@@ -74,7 +97,7 @@ define([
			this.widgetConfigs = this._merge([{
				info: {
					width: 2,
					height: 3,
					height: 5,
					type: TemplateDisplayer,
					props: {
						title: this.i18n.info,
@@ -86,7 +109,7 @@ define([
				},
				dashboard: {
					width: 4,
					height: 6,
					height: 5,
					type: TemplateDisplayer,
					props: {
						title: this.i18n.dashboard,
@@ -95,8 +118,8 @@ define([
					}
				},
				windrose: {
					width: 6,
					height: 6,
					width: 3,
					height: 5,
					type: MultiWindRoseChartWithToolbar,
					props: {
						title: this.i18n.windrose,
@@ -105,8 +128,15 @@ define([
							_RadialAxisWithGridDrawing,
							_InfoOnMouseOver,
							_LegendBar
						],
						domainLevels: this.domainLevels
						]
					}
				},
				location: {
					width: 3,
					height: 5,
					type: [LeafletImpl, Map, _PlaceNamesButton],
					props: {
						title: this.i18n.location
					}
				}
			}, this.widgetConfigs || {}]);
@@ -154,6 +184,8 @@ define([
				return;
			}

			this._manageGeometryData(itemData);

			var siteData = itemData.properties.site;

			siteData && this._manageSiteData(siteData);
@@ -171,6 +203,47 @@ define([
			});
		},

		_manageGeometryData: function(data) {

			if (!this.mapLayer) {
				this.mapLayer = new GeoJsonLayerImpl({
					parentChannel: this.getChannel(),
					mapChannel: this._widgets.location.getChannel(),
					onEachFeature: lang.hitch(this, this.onEachFeature)
				});

				this._publish(this._widgets.location.getChannel('ADD_LAYER'), {
					layer: this.mapLayer
				});
			} else {
				this._publish(this.mapLayer.getChannel('CLEAR'));
			}

			this._publish(this.mapLayer.getChannel('ADD_DATA'), {
				data: data
			});
			this._publish(this._widgets.location.getChannel('SET_CENTER'), {
				center: data.geometry.coordinates.reverse()
			});
		},

		onEachFeature: function(feature, layer) {

			var geoJsonData = {
				type: feature.type,
				geometry: feature.geometry,
				properties: {
					name: feature.properties.site.name,
					code: feature.properties.site.code
				}
			};

			layer.bindPopup(SitePopupTemplate({
				feature: geoJsonData,
				i18n: this.i18n
			}));
		},

		_manageSiteData: function(data) {

			this.title = data.name + ' (' + data.code + ')';
+16 −15
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@ define([
	, "RWidgets/Utilities"
	, "redmic/modules/base/_ShowInTooltip"
	, "redmic/modules/base/_ShowOnEvt"
	, "redmic/modules/form/input/DateRangeTextBoxImpl"
	, "redmic/modules/form/input/DateRangeComplexImpl"
	, "put-selector/put"
	, "./Toolbar"
], function(
@@ -15,19 +15,19 @@ define([
	, Utilities
	, _ShowInTooltip
	, _ShowOnEvt
	, DateRangeTextBoxImpl
	, DateRangeComplexImpl
	, put
	, Toolbar
){
	return declare(Toolbar, {
		//	summary:
		//		Herramienta para aplicar filtros en las peticiones de datos.
		//		Herramienta para aplicar filtro por fecha en las peticiones de datos.

		constructor: function(args) {

			this.config = {
				ownChannel: 'dataFilter',
				iconClass: 'fa-filter',
				ownChannel: 'dateFilter',
				iconClass: 'fa-calendar',
				_closeOnValueSetTimeout: 800
			};

@@ -38,25 +38,26 @@ define([

		_setConfigurations: function() {

			this.dateRangeTextBoxConfig = this._merge([{
			this.dateRangeComplexConfig = this._merge([{
				parentChannel: this.getChannel(),
				orient: ['below-alt'],
				classTooltip: 'tooltipButtonMenu',
				filterChannel: this.queryChannel
			}, this.dateRangeTextBoxConfig || {}]);
			}, this.dateRangeComplexConfig || {}]);
		},

		_initialize: function() {

			this.dateRangeTextBox = new declare([DateRangeTextBoxImpl, _ShowOnEvt])
				.extend(_ShowInTooltip)(this.dateRangeTextBoxConfig);
			var definition = declare([DateRangeComplexImpl, _ShowOnEvt]).extend(_ShowInTooltip);

			this.dateRangeComplex = new definition(this.dateRangeComplexConfig);
		},

		_defineDataFilterSubscriptions: function() {

			this.subscriptionsConfig.push({
				channel : this.dateRangeTextBox.getChannel('VALUE_CHANGED'),
				callback: '_subDateRangeTextBoxValueChanged'
				channel : this.dateRangeComplex.getChannel('VALUE_CHANGED'),
				callback: '_subDateRangeValueChanged'
			});
		},

@@ -65,11 +66,11 @@ define([
			this.inherited(arguments);

			var classNames = '.icon.' + this._getIconClassNames(),
				title = this.title || this.i18n.dataFilter;
				title = this.title || this.i18n.dateFilter;

			this.sourceNode = put(this.domNode, 'i' + classNames + '[title=' + title + ']');

			this._publish(this.dateRangeTextBox.getChannel('ADD_EVT'), {
			this._publish(this.dateRangeComplex.getChannel('ADD_EVT'), {
				sourceNode: this.sourceNode
			});
		},
@@ -81,9 +82,9 @@ define([
			return iconClassPrefix + '.' + this.iconClass;
		},

		_subDateRangeTextBoxValueChanged: function(res) {
		_subDateRangeValueChanged: function(res) {

			setTimeout(lang.hitch(this, this._publish, this.dateRangeTextBox.getChannel('HIDE')),
			setTimeout(lang.hitch(this, this._publish, this.dateRangeComplex.getChannel('HIDE')),
				this._closeOnValueSetTimeout);

			this._emitEvt('TOOL_ACTUATED', {
Loading