Example #1
0
			constraintFilters.forEach(constraintFilter => {
				const constraintFilterOperatorValue = constraintFilter && constraintFilter.operator ? constraintFilter.operator.value : '';

				if (constraintFilter.field !== null && angular.isObject(constraintFilter.operator)
					&& constraintFilterOperatorValue !== '' && angular.isArray(constraintFilter.values)
					&& constraintFilter.values.length > 0) {
					const constraintParamPart = {};
					constraintParamPart[`fc${counter}`] = constraintFilter.field.sysname;
					constraintParamPart[`fo${counter}`] = constraintFilterOperatorValue;
					const constraintOperatorType = this.getFieldFilterOperatorValueType(constraintFilter.operator);
					if (constraintOperatorType === 'twoValues') {
						constraintParamPart[`fvl${counter}`] = constraintFilter.values[0];
						constraintParamPart[`fvr${counter}`] = constraintFilter.values[1];
					} else if (constraintOperatorType === 'twoDates') {
						constraintParamPart[`fvl${counter}`] = moment(constraintFilter.values[0]).format(this.$izendaSettingsService.getDateFormat().shortDate);
						constraintParamPart[`fvr${counter}`] = moment(constraintFilter.values[1]).format(this.$izendaSettingsService.getDateFormat().shortDate);
					} else if (constraintOperatorType === 'oneDate') {
						constraintParamPart[`fvl${counter}`] = moment(constraintFilter.values[0]).format(this.$izendaSettingsService.getDateFormat().shortDate);
					} else if (constraintOperatorType === 'field') {
						const val = angular.isObject(constraintFilter.values[0])
							? constraintFilter.values[0].sysname
							: '';
						constraintParamPart[`fvl${counter}`] = val;
					} else {
						constraintParamPart[`fvl${counter}`] = constraintFilter.values.join(',');
					}

					angular.extend(queryParams, constraintParamPart);
					counter++;
				}
			});
		vm.isSubtotalExpressionDisabled = function () {
			if (!angular.isObject(vm.field))
				return true;
			if (!vm.isSubtotalsEnabled)
				return true;
			if (!angular.isObject(vm.field.groupBySubtotalFunction))
				return true;
			return vm.field.groupBySubtotalFunction.value !== 'EXPRESSION';
		};
			$scope.$watch('$izendaInstantReportStorageService.getCurrentActiveField()', function (field) {
				vm.field = field;
				vm.expanded = false;
				if (angular.isObject(vm.field)) {
					$izendaInstantReportStorageService.disableEmbeddedDrillDownStyle(vm.field);
				}
			});
    var load = function (file) {
      if (!file || (!angular.isString(file.prefix) || !angular.isString(file.suffix))) {
        throw new Error('Couldn\'t load static file, no prefix or suffix specified!');
      }

      var fileUrl = [
        file.prefix,
        options.key,
        file.suffix
      ].join('');

      if (angular.isObject(options.fileMap) && options.fileMap[fileUrl]) {
        fileUrl = options.fileMap[fileUrl];
      }

      return $http(angular.extend({
        url: fileUrl,
        method: 'GET',
        headers: {'Cache-Control': 'no-cache', 'Pragma': 'no-cache'},
        silentCall: true
      }, options.$http))
        .then(function(result) {
          return result.data;
        }, function () {
          return $q.reject(options.key);
        });
    };
Example #5
0
export function assignPartialDeep<T extends TPartial, TPartial>(
    destination: T, 
    partial: TPartial,
    optionalPropSelector: (key: string, destination: T) => boolean = () => false,
    customizer: (destValue: any, srcValue: any, key: string) => any = () => undefined
 ) {
    const keys = Object.keys(partial);
    for(const key of keys) {
        let srcVal = partial[key];
        if (srcVal === undefined) {
            if (optionalPropSelector(key, destination)){
                destination[key] = srcVal;
            } else {
                // don't assign undefined to destination
            }
            continue;
        }

        const destVal = destination[key];
        const customVal = customizer(destVal, srcVal, key);
        if (customVal !== undefined){
            destination[key] = customVal;
        } else if (ng1.isArray(srcVal)) {
            destination[key] = [...srcVal];
        } else if (!ng1.isObject(srcVal)) {
            destination[key] = srcVal;
        } else {
            destination[key] = assignPartialDeep(destVal, srcVal);
        }
    }
    return destination;
}
		vm.onPivotColumnFieldSelect = function () {
			if (vm.pivotColumn !== null) {
				var sourceField = $izendaInstantReportStorageService.getFieldBySysName(vm.pivotColumn.sysname);

				var groupName = null;
				var oldPivotColumn = $izendaInstantReportPivotService.getPivotColumn();
				if (angular.isObject(oldPivotColumn) && sourceField.sysname === oldPivotColumn.sysname) {
					groupName = oldPivotColumn.groupByFunction.value;
				}

				$izendaInstantReportStorageService.copyFieldObject(sourceField, vm.pivotColumn, true);
				$izendaInstantReportStorageService.resetFieldObject(vm.pivotColumn);
				vm.pivotColumn.isPivotColumn = true;
				$izendaInstantReportPivotService.setPivotColumn(vm.pivotColumn);
				$izendaInstantReportStorageService.initializeField(vm.pivotColumn).then(function () {

					if (groupName !== null) {
						angular.element.each(vm.pivotColumn.groupByFunctionOptions, function () {
							if (this.value === groupName)
								vm.pivotColumn.groupByFunction = this;
						});
					}

					if (vm.cellValues.length === 0) {
						vm.addCellValue();
					}

					vm.updateReportSetValidationAndRefresh();
					$scope.$applyAsync();
				});
			}
		};
Example #7
0
 const removePrototype = (srcVal: any, objVal: any) => {
     if (ng1.isObject(objVal) && !ng1.isArray(objVal)) {
         return _.toPlainObject(objVal);
     } else {
         return objVal;
     }
 };
Example #8
0
 var extractValueToCompare = function (item: any) {
     if (angular.isObject(item) && angular.isString(filterOn)) {
         return item[filterOn];
     } else {
         return item;
     }
 };
		this.$izendaDashboardQueryService.loadDashboardNew(reportFullName, !!updateFromSource).then(dashboardModel => {
			if (!angular.isObject(dashboardModel))
				throw `Failed to load dashboard '${reportFullName}'`;

			// set current rights
			this.$izendaCompatibilityService.setRights(dashboardModel.effectiveRights);
			this.$izendaCompatibilityService.setUsesHiddenColumns(dashboardModel.usesHiddenColumns);

			// update names
			dashboardModel.reportFullName = this.$izendaSettingsService.getReportFullName(dashboardModel.reportName, dashboardModel.reportCategory);
			dashboardModel.tiles.forEach(tile => {
				tile.reportName = this.$izendaUrlService.extractReportName(tile.reportSetName);
				tile.reportCategory = this.$izendaUrlService.extractReportCategory(tile.reportSetName);
			});

			// set legacy filters from response
			this._setFiltersData(dashboardModel.filters);

			// notify that model was changed and report was loaded
			this.model.onNext(dashboardModel, this);

			// show hidden columns warning
			if (this.$izendaCompatibilityService.isUsesHiddenColumns()) {
				this.$izendaUtilUiService.showMessageDialog(
					this.$izendaLocaleService.localeText(
						'js_dashboardUsesHiddenColumns',
						'Dashboard contains tile with report which contains unavailable fields. Please re-save original report or chose another one.'));
			}

			this.isLoaded.onNext(true, this);

		}, error => {
 var urlMatcher = _.find(urlMatchers,function(matcher: any){
      var params = matcher.exec(url);
      if(angular.isObject(params)){
          data.params=params;
          return true;
      }
      return false;
  });