Commit 07d0f567 authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Merge branch 'feature-fixTrashCollectionLoading' into 'dev'

Feature fix trash collection loading

See merge request redmic-project/client/web!47
parents 215269ae fcedd9f1
Loading
Loading
Loading
Loading
+28 −75
Original line number Diff line number Diff line
@@ -19,32 +19,11 @@ define([

		constructor: function (args) {
			this.config = {
				previewDataIdProperty: 'idPreviewList',
				tableConfig: {
					columns: []
				},

				/*_relationDataDefault: {
					"date": {
						"columns": ["date"],
						"format": "YYYY-MM-DD HH:mm:ss"
					},
					"vFlag": {
						"columns": ["vFlag"]
					},
					"qFlag": {
						"columns": ["qFlag"]
					},
					"remark": {
						"columns": ["remark"]
					},
					"parameters": {
						"matching": [{
							"columns": ["value"],
							"dataDefinitionId": 63
						}]
					}
				},*/

				_defaultColumns: {
					width: '14',
					align: 'center',
@@ -60,38 +39,18 @@ define([

			this.inherited(arguments);

			/*this.browserConfig = this._merge([{
				buttonsInTopZone: true,
				buttons: {
					"loadRelationData": {
						className: "fa-plus",
						title: this.i18n.loadRelationData
					}
				}
			}, this.browserConfig || {}]);*/

			this.previewDataBrowserConfig = this._merge([{
				parentChannel: this.getChannel(),
				title: this.i18n.previewData,
				target: "viewPrevData",
				noDataMessage: null,
				tableConfig: {},
				pathSeparator: "//",
				idProperty: this.previewDataIdProperty,
				width: 8,
				height: "lg"
			}, this.previewDataBrowserConfig || {}]);
		},

		/*_defineSubscriptions: function() {

			this.inherited(arguments);

			this.subscriptionsConfig.push({
				channel: this.browser.getChildChannel("iconKeypad", "KEYPAD_INPUT"),
				callback: "_subBrowserKeypadInput"
			});
		},*/

		postCreate: function() {

			this.inherited(arguments);
@@ -104,37 +63,6 @@ define([
			}).placeAt(this.topLeftNode);
		},

		/*_subBrowserKeypadInput: function(res) {

			if (res.inputKey === "loadRelationData") {
				this._loadRelationData(this._relationDataDefault);
			}
		},*/

		/*_loadRelationData: function(relationData) {

			this._cleanData();

			this._blockLoadFormTypesInSelector = true;

			for (var key in relationData)
				this._loadItemRelationData(relationData[key], key);

			this._blockLoadFormTypesInSelector = false;
			this._currentValueSelect = null;
			this._loadFormTypesInSelector(true);
		},

		_loadItemRelationData: function(item, key) {

			if (this.formTypeOptions[key]) {
				this._currentValueSelect = key;
				this._formSubmitted({
					data: item
				});
			}
		},*/

		_processLoadedData: function(data) {

			this.tableConfig.columns = [];
@@ -169,12 +97,37 @@ define([
				});

				this._emitEvt("INJECT_DATA", {
					data: this.data.data,
					data: this._buildPreviewData(this.data.data),
					target: "viewPrevData"
				});
			}

			this._publish(this.previewDataBrowser.getChannel("SHOW"));
		},

		_buildPreviewData: function(data) {

			var items = [];

			for (var i = 0; i < data.length; i++) {
				var item = data[i],
					itemKeys = Object.keys(item),
					itemValues = Object.values(item),
					itemObj = {};

				itemObj[this.previewDataIdProperty] = i;

				for (var j = 0; j < itemKeys.length; j++) {
					var itemKey = itemKeys[j],
						itemValue = itemValues[j];

					itemObj[itemKey] = itemValue;
				}

				items.push(itemObj);
			}

			return items;
		}
	});
});
+7 −1
Original line number Diff line number Diff line
@@ -31,7 +31,13 @@ define([

			this.config = {
				idPropertySave: "uuid",
				replaceTarget: redmicConfig.services.activityObjectCollectingSeriesStations
				replaceTarget: redmicConfig.services.activityObjectCollectingSeriesStations,
				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);
+2 −2
Original line number Diff line number Diff line
@@ -162,12 +162,12 @@ define([

		postCreate: function() {

			this._createContainer();
			this._createBrowserContainer();

			this.inherited(arguments);
		},

		_createContainer: function() {
		_createBrowserContainer: function() {

			this.contentListNode = put(this._getNodeBaseList(), "div." + this.listContentClass);
			this.rowsContainerNode = put(this.contentListNode, "div." + this.rowsContainerClass);
+9 −9
Original line number Diff line number Diff line
@@ -59,7 +59,8 @@ define([
			aspect.before(this, "_configRow", lang.hitch(this, this._configHierarchicalRow));

			aspect.before(this, "_addData", lang.hitch(this, this._addBeforeData));
			aspect.after(this, "_addData", lang.hitch(this, this._addAfterData));
			aspect.after(this, "_addData", lang.hitch(this, this._showPendingParents));
			aspect.after(this, "_addItem", lang.hitch(this, this._showPendingParents));

			aspect.before(this, "_removeRow", lang.hitch(this, this._removeHierarchicalRow));
		},
@@ -187,11 +188,6 @@ define([
			this._proccesNewData(response);
		},

		_addAfterData: function(response) {

			this._showPendingParents();
		},

		_parserIndexData: function(response) {

			var data = response.data;
@@ -293,11 +289,15 @@ define([
			instance && this._publish(instance.getChannel('SHOW'), obj);
		},

		_showPendingParents: function(item) {
		_showPendingParents: function() {

			if (!this._pendingParentsToShow) {
				return;
			}

			var count = (this._pendingParentsToShow.length - 1);
			var pendingParents = this._pendingParentsToShow.length - 1;

			for (var i = count; i >= 0; i--) {
			for (var i = pendingParents; i >= 0; i--) {
				this._showPendingParent(this._pendingParentsToShow[i]);
			}
		},
+2 −2
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ define([
			aspect.before(this, "_mixEventsAndActions", lang.hitch(this, this._mixNoDataTemplateEventsAndActions));
			aspect.after(this, "_defineSubscriptions", lang.hitch(this, this._defineNoDataTemplateSubscriptions));
			aspect.after(this, "_definePublications", lang.hitch(this, this._defineNoDataTemplatePublications));
			aspect.after(this, "_createContainer", lang.hitch(this, this._createNoDataTemplateContainer));
			aspect.after(this, "_createBrowserContainer", lang.hitch(this, this._createNoDataTemplateBrowserContainer));

			aspect.before(this, "_dataAvailable", lang.hitch(this, this._clearNoDataFound));
			aspect.before(this, "_itemAvailable", lang.hitch(this, this._clearNoDataFound));
@@ -78,7 +78,7 @@ define([
			});
		},

		_createNoDataTemplateContainer: function() {
		_createNoDataTemplateBrowserContainer: function() {

			this._checkNoDataFound();
		},
Loading