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

Implementa y habilita copia de sitios de actividad

Permite copiar las definiciones de datos de un sitio perteneciente a una
actividad.
Se habilita para actividades de tipo FT.

Fix #28.
parent 739d4e04
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ define([
			} else {
				var cleanValue = null;

				if (typeof item[prop] === "object") {
				if (typeof item[prop] === "object" && item[prop] !== null) {
					if (item[prop] instanceof Array) {
						cleanValue = [];
					} else {
+10 −0
Original line number Diff line number Diff line
@@ -27,6 +27,11 @@ define([

		_setDataLoadedByStationManagementConfigurations: function() {

			var copyPath = lang.replace(this.addPath, {
				activityId: this.pathVariableId,
				uuid: 'new'
			}) + '?copy-source={uuid}';

			this.browserConfig = this._merge([{
				rowConfig: {
					buttonsConfig: {
@@ -48,6 +53,11 @@ define([
								title: "edit",
								option: "default",
								href: this.editPath
							},{
								icon: "fa-copy",
								btnId: "copy",
								title: "copy",
								href: copyPath
							},{
								icon: "fa-upload",
								btnId: "load",
+15 −4
Original line number Diff line number Diff line
@@ -122,8 +122,13 @@ define([
			if (this.pathVariableId && Number.isInteger(parseInt(this.pathVariableId, 10))) {
				this._emitGet(this.pathVariableId);
			} else if(this.pathVariableId && (this.pathVariableId === "new")) {
				var copySource = this.queryParameters ? this.queryParameters['copy-source'] : null;
				if (copySource) {
					this._emitGet(copySource);
				} else {
					this._emitShowForm();
			} else if (this.pathVariableId && Object.keys(this.pathVariableId).length > 1) {
				}
			} else if (this.pathVariableId && Object.keys(this.pathVariableId).length) {
				this._pathVariableIdIsObject();
			} else {
				this._goTo404();
@@ -172,10 +177,16 @@ define([

		_pathVariableIdIsObject: function() {

			this.target = lang.replace(this.target, this.pathVariableId);
			// TODO borrar este seteo, que cambia el target para siempre (efecinquitis) y creo que no es necesario
			//this.target = lang.replace(this.target, this.pathVariableId);

			if (this.pathVariableId.id === "new") {
				var copySource = this.queryParameters ? this.queryParameters['copy-source'] : null;
				if (copySource !== null) {
					this._emitGet(copySource);
				} else {
					this._emitShowForm();
				}
			} else {
				this._emitGet(this.pathVariableId[this.idProperty]);
			}
+1 −0
Original line number Diff line number Diff line
@@ -284,6 +284,7 @@ define([
				activityData: this.activityData,
				activityCategory: this.activityCategory,
				pathVariableId: this.pathVariableId,
				queryParameters: this.queryParameters,
				editorConfig: {
					_additionalData: {
						activityCategory: this.activityCategory,
+7 −2
Original line number Diff line number Diff line
@@ -31,7 +31,13 @@ define([

			this.config = {
				idPropertySave: 'uuid',
				replaceTarget: redmicConfig.services.activityTimeSeriesStations
				replaceTarget: redmicConfig.services.activityTimeSeriesStations,
				propsToClean: [
					"id", "uuid", "geometry.coordinates", "properties.site.name", "properties.site.code",
					"properties.site.description", "properties.site.dashboard",
					"properties.measurements.{i}.dataDefinition.id", "properties.measurements.{i}.dataDefinition.path",
					"properties.measurements.{i}.parameter.path"
				]
			};

			lang.mixin(this, this.config, args);
@@ -91,7 +97,6 @@ define([
								required: false
							}
						},

						formConfig: {
							template: "components/viewCustomization/parameter/views/templates/FC"
						}