Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
jortilles committed Oct 29, 2024
2 parents 98326b5 + 28a7b26 commit 225269a
Show file tree
Hide file tree
Showing 23 changed files with 650,049 additions and 22 deletions.
649,323 changes: 649,323 additions & 0 deletions docs/mapas/ve.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions eda/eda_api/lib/module/dashboard/model/dashboard.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ interface IDashboardConfig {
styles:any;
tag: any;
external?: any;
urls:any;
}

const DashboardSchema = new mongoose.Schema({
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { NextFunction, Request, Response } from 'express';
import { HttpException } from '../global/model/index';


export class FuncionalidadUrlController {


static async checkUrl(req: Request, res: Response, next: NextFunction) {

try {
const response = await req.body
const {url} = response;

// Hacemos un fetch a la url solicitada por el frontend
fetch(url)
.then( r => {
res.status(200).json({
ok: true,
msg: 'Respuesta correcta',
});
})
.catch(error => {
console.error('Error fetching data', error);
res.status(500).json({
ok: false,
msg: 'Error en la petición o en la URL',
});
});

} catch (err) {
return next(new HttpException(501, 'Error in SMPT configuration file'));
}

}

}
10 changes: 10 additions & 0 deletions eda/eda_api/lib/module/funcionalidadUrl/funcionalidadUrl.router.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import * as express from 'express';
import { authGuard } from '../../guards/auth-guard';
import { roleGuard } from '../../guards/role-guard';
import { FuncionalidadUrlController } from './funcionalidadUrl.controller';

const router = express.Router();

router.post('/check', authGuard, roleGuard, FuncionalidadUrlController.checkUrl);

export default router;
5 changes: 4 additions & 1 deletion eda/eda_api/lib/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import AddTableRouter from './module/addtabletomodel/addtable.router';
import DataSourceRouter from './module/datasource/datasource.router';
import UploadsRouter from './module/uploads/uploads.router';
import MailRouter from './module/mail/mail.router';
import DocuRouter from './routes/api/api-docs';
import FuncionalidadUrl from './module/funcionalidadUrl/funcionalidadUrl.router';
import DocuRouter from './routes/api/api-docs'
import ExcelRouter from './module/excel/excel-sheet.router';
import ThirdPartyRouter from './module/thirdParty/thirdParty.router';

Expand All @@ -24,6 +25,8 @@ router.use('/addTable', AddTableRouter );

router.use('/mail', MailRouter);

router.use('/funcionalidadUrl', FuncionalidadUrl);

router.use('/excel-sheets',ExcelRouter);

router.use('/tp', ThirdPartyRouter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export class TableConfig {
sortedColumn : any;
styles : Array<any>;
noRepetitions: boolean;
negativeNumbers: boolean;

constructor(
onlyPercentages: Boolean,
Expand All @@ -22,7 +23,8 @@ export class TableConfig {
sortedSerie :any,
sortedColumn : any,
styles : Array<any>,
noRepetitions: boolean
noRepetitions: boolean,
negativeNumbers: boolean,
) {
this.onlyPercentages = onlyPercentages;
this.resultAsPecentage = resultAsPecentage;
Expand All @@ -35,6 +37,7 @@ export class TableConfig {
this.sortedColumn = sortedColumn;
this.styles = styles;
this.noRepetitions = noRepetitions;
this.negativeNumbers = negativeNumbers;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ export class PanelChartComponent implements OnInit, OnChanges, OnDestroy {
this.componentRef.instance.inject.sortedSerie = config.sortedSerie;
this.componentRef.instance.inject.sortedColumn = config.sortedColumn;
this.componentRef.instance.inject.noRepetitions = config.noRepetitions;
this.componentRef.instance.inject.negativeNumbers = config.negativeNumbers;
this.configUpdated.emit();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export const ChartsConfigUtils = {
sortedSerie: ebp.panelChart.componentRef.instance.inject.sortedSerie,
sortedColumn: ebp.panelChart.componentRef.instance.inject.sortedColumn,
styles : ebp.panelChart.componentRef.instance.inject.styles,
noRepetitions: ebp.panelChart.componentRef.instance.inject.noRepetitions
noRepetitions: ebp.panelChart.componentRef.instance.inject.noRepetitions,
negativeNumbers: ebp.panelChart.componentRef.instance.inject.negativeNumbers
}

} else if (ebp.panelChart.componentRef && ebp.panelChart.props.chartType === 'kpi') {
Expand Down Expand Up @@ -91,7 +92,7 @@ export const ChartsConfigUtils = {

if (['table', 'crosstable'].includes(type)) {

return new TableConfig(false, false, 10, false, false, false, false, null, null, null, false);
return new TableConfig(false, false, 10, false, false, false, false, null, null, null, false, false);

}
else if (['bar', 'line','area', 'pie', 'doughnut','polarArea', 'barline', 'horizontalBar', 'pyramid', 'histogram', 'radar' ].includes(type)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ export const PanelInteractionUtils = {
c.column_name === contentColumn.column_name &&
c.display_name.default === contentColumn.display_name
);
column.format = contentColumn.format; // Agregando el Formato
if (column) {
column.whatif_column = contentColumn.whatif_column || false;
column.whatif = contentColumn.whatif || {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export class TableDialogComponent extends EdaDialogAbstract implements AfterView
public cols: Array<any> = [];
public styles = [];
public noRepetitions : boolean = false;
public negativeNumbers : boolean = false;

/**Strings */
public addTotals: string = $localize`:@@addTotals:Totales`;
Expand All @@ -57,6 +58,9 @@ export class TableDialogComponent extends EdaDialogAbstract implements AfterView
public seeRepetitions: string = $localize`:@@seeRepetitions: ver/ocultar valores repetidos`;
public withRepetitions: string = $localize`:@@seeRepetitions: ver valores repetidos`;
public withNoRepetitions: string = $localize`:@@seeRepetitions: ocultar valores repetidos`;
public withNegativeNumbers: string = $localize`:@@withNegativeNumbers: Con números negativos`;
public withoutNegativeNumbers: string = $localize`:@@withoutNegativeNumbers: Sin números negativos`;
public seeNegativeNumbers: string = $localize`:@@seeNegativeNumbers: Números negativos`;

public tableTitleDialog = $localize`:@@tableTitleDialog:Propiedades de la tabla`;

Expand All @@ -76,7 +80,7 @@ export class TableDialogComponent extends EdaDialogAbstract implements AfterView

setChartProperties() {
this.setCols();
this.styles = this.myPanelChartComponent.componentRef.instance.inject.styles || [];
this.styles = this.myPanelChartComponent.componentRef.instance.inject.styles || []; // si es null regresa vacio
}
onShow(): void {
this.panelChartConfig = this.controller.params.panelChart;
Expand All @@ -91,9 +95,10 @@ export class TableDialogComponent extends EdaDialogAbstract implements AfterView
this.sortedSerie = config.sortedSerie;
this.sortedColumn = config.sortedColumn;
this.noRepetitions = config.noRepetitions;
this.negativeNumbers = config.negativeNumbers;
} else {
this.panelChartConfig.config = new ChartConfig(
new TableConfig(false, false, 5, false, false, false, false, null, null, null, false)
new TableConfig(false, false, 5, false, false, false, false, null, null, null, false, false)
)
}

Expand Down Expand Up @@ -150,7 +155,21 @@ export class TableDialogComponent extends EdaDialogAbstract implements AfterView
this.myPanelChartComponent.componentRef.instance.inject.checkTotals(null);
this.noRepetitions = currentConfig.noRepetitions;


// this.negativeNumbers = !this.negativeNumbers;
// currentConfig.noRepetitions = !currentConfig.negativeNumbers;

this.setItems();
}

private noNegativeNumbers() {

const currentConfig = this.myPanelChartComponent.currentConfig;

currentConfig.negativeNumbers = !currentConfig.negativeNumbers;
this.myPanelChartComponent.componentRef.instance.inject.checkTotals(null);
this.negativeNumbers = currentConfig.negativeNumbers;


this.setItems();
}

Expand Down Expand Up @@ -219,10 +238,10 @@ export class TableDialogComponent extends EdaDialogAbstract implements AfterView
}
}

private setCols() {
private setCols() {

if (this.controller.params.panelChart.chartType === 'table') {

if (this.onlyPercentages) {
this.cols = this.myPanelChartComponent.componentRef.instance.inject.cols.filter(col => col.type === "EdaColumnPercentage");
}
Expand Down Expand Up @@ -257,23 +276,22 @@ export class TableDialogComponent extends EdaDialogAbstract implements AfterView

if (this.onlyPercentages) this.cols = [];
}
this.setItems();
this.setItems(); // Aqui se busca la modificación de colores
}

onClose(event: EdaDialogCloseEvent, response?: any): void {
return this.controller.close(event, response);
}

saveChartConfig() {

const config = (<TableConfig>this.panelChartConfig.config.getConfig());
const rows = config.visibleRows;
const sortedSerie = config.sortedSerie;
const sortedColumn = config.sortedColumn;
const styles = this.styles;

const properties = new TableConfig(this.onlyPercentages, this.resultAsPecentage, rows,
this.col_subtotals, this.col_totals, this.row_totals, this.trend, sortedSerie, sortedColumn, styles, this.noRepetitions);
this.col_subtotals, this.col_totals, this.row_totals, this.trend, sortedSerie, sortedColumn, styles, this.noRepetitions, this.negativeNumbers);

this.onClose(EdaDialogCloseEvent.UPDATE, properties);
}
Expand All @@ -286,7 +304,7 @@ export class TableDialogComponent extends EdaDialogAbstract implements AfterView

if (!_.isEqual(event, EdaDialogCloseEvent.NONE)) {

this.styles = this.styles.filter(style => style.col !== response.col);
this.styles = this.styles.filter(style => style.col !== response.col);

if (!response.noStyle) {
if (this.controller.params.panelChart.chartType === 'table') {
Expand Down Expand Up @@ -364,6 +382,16 @@ export class TableDialogComponent extends EdaDialogAbstract implements AfterView
command: () => this.noRepeat()
}
]
},
{
label: this.seeNegativeNumbers,
icon: "pi pi-list",
items: [
{
label: this.negativeNumbers !== true ? this.withoutNegativeNumbers : this.withNegativeNumbers,
command: () => this.noNegativeNumbers()
}
]
}
]
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@
</ng-container>
<!-- ngSwitch NUMBER -->
<ng-container *ngSwitchCase="'EdaColumnNumber'">
{{ lodash.get(rowData, col.field) | number:'1.0-10':'es' }}
<span [ngStyle]="{'color': getColor(lodash.get(rowData, col.field))}">
{{ lodash.get(rowData, col.field) | number:'1.0-10':'es' }}
</span>
</ng-container>
<!-- ngSwitch NUMBER -->
<ng-container *ngSwitchCase="'EdaColumnDate'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,10 @@ export class EdaTableComponent implements OnInit {
}

public applyStyles(styles: Array<any>) {
//console.log('Los estilos que me llegan son ');
//console.log(styles.toString())

const fields = styles.map(style => style.col);
const limits = {};


//Initialize
fields.forEach(field => {
limits[field] = { min: Infinity, max: -Infinity, rangeValue: 0, ranges: []};
Expand Down Expand Up @@ -292,5 +289,13 @@ export class EdaTableComponent implements OnInit {
return name.replace('%', 'percent').replace(/ /g, '').replace(/[^a-zA-Z0-9-_-\wáéíóúüñÁÉÍÓÚÜÑ ]/g, '').replace('_','');
}

public getColor(valor: number) {

// modificar el true por una variable que se modifica en la edición de valores negativos.

if(valor<0 && this.inject.negativeNumbers) {
return '#FF0000'
}
}

}
5 changes: 3 additions & 2 deletions eda/eda_app/src/app/module/components/eda-table/eda-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export class EdaTable {
public onlyPercentages: boolean = false;
public percentageColumns: Array<any> = [];
public noRepetitions: boolean;
public negativeNumbers: boolean;
public origValues: any[] = [];


Expand Down Expand Up @@ -197,6 +198,7 @@ export class EdaTable {
}

checkTotals(event) {

if (this.withRowTotals) {
this.rowTotals();
} else {
Expand Down Expand Up @@ -224,10 +226,9 @@ export class EdaTable {
event ? this.colSubTotals(event.first / event.rows + 1) : this.colSubTotals(1);
}
if (!this.pivot) {
console.log(' this.noRepeatedRows() DESCOMENTADO');
// console.log(' this.noRepeatedRows() DESCOMENTADO');
this.noRepeatedRows();
}

}

deleteRowTotals() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ <h3 *ngIf="!titleClick" class="eda-title"> {{title}} </h3>
<!-- ============================================================== -->
<save-as-dialog *ngIf="saveasController" [controller]="saveasController"></save-as-dialog>

<!-- ============================================================== -->
<!-- URLS ACTION -->
<!-- ============================================================== -->

<urls-action *ngIf="urlsController" [controller]="urlsController"></urls-action>


<!-- ============================================================== -->
<!-- EDIT STYLES -->
Expand Down Expand Up @@ -232,6 +238,13 @@ <h3 *ngIf="!titleClick" class="eda-title"> {{title}} </h3>
</div>
</div>

<div class="right-sidebar-blocks-options block-options-bg pointer mt-1" (click)="openUrlsConfig();">
<div>
<i class="fa fa-link"></i>
<span i18n="@@opcionUrls" class="ml-2">ACCIÓN PERSONALIZADA</span>
</div>
</div>



</p-sidebar>
Expand Down
Loading

0 comments on commit 225269a

Please sign in to comment.