From f844a4e761a7eb62912aada9fc6c3cc50c810b6e Mon Sep 17 00:00:00 2001 From: aTorresJortilles Date: Wed, 14 Feb 2024 12:10:11 +0100 Subject: [PATCH 1/4] =?UTF-8?q?Primera=20instancia=20del=20centrado=20de?= =?UTF-8?q?=20los=20sufijos=20en=20el=20component=20KPI.=20Pendiente=20de?= =?UTF-8?q?=20revisi=C3=B3n!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/eda-kpi/eda-kpi.component.html | 8 +-- .../components/eda-kpi/eda-kpi.component.ts | 62 +++++++++++++------ 2 files changed, 46 insertions(+), 24 deletions(-) diff --git a/eda/eda_app/src/app/module/components/eda-kpi/eda-kpi.component.html b/eda/eda_app/src/app/module/components/eda-kpi/eda-kpi.component.html index 731ac9795..6b266e28a 100644 --- a/eda/eda_app/src/app/module/components/eda-kpi/eda-kpi.component.html +++ b/eda/eda_app/src/app/module/components/eda-kpi/eda-kpi.component.html @@ -1,7 +1,5 @@ -
- -
-
+
+
{{inject.value | number:'1.0-10':'es' }} {{inject.sufix}}
@@ -10,6 +8,4 @@ name=unidades [(ngModel)]="inject.sufix" autofocusOnShow>
-
-
\ No newline at end of file diff --git a/eda/eda_app/src/app/module/components/eda-kpi/eda-kpi.component.ts b/eda/eda_app/src/app/module/components/eda-kpi/eda-kpi.component.ts index cd0866906..97a73505b 100644 --- a/eda/eda_app/src/app/module/components/eda-kpi/eda-kpi.component.ts +++ b/eda/eda_app/src/app/module/components/eda-kpi/eda-kpi.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, Input, EventEmitter, Output, ViewChild, ElementRef } from '@angular/core'; +import { Component, OnInit, Input, EventEmitter, Output, ViewChild, ElementRef, AfterViewInit} from '@angular/core'; import { registerLocaleData } from '@angular/common'; import { EdaKpi } from './eda-kpi'; import es from '@angular/common/locales/es'; @@ -13,6 +13,8 @@ export class EdaKpiComponent implements OnInit { @Output() onNotify: EventEmitter = new EventEmitter(); @ViewChild('kpiContainer') kpiContainer: ElementRef; + @ViewChild('sufixContainer') + sufixContainer: ElementRef; sufixClick: boolean = false; color : string ; @@ -51,36 +53,60 @@ export class EdaKpiComponent implements OnInit { } getStyle():any{ - return {'font-weight': 'bold', 'font-size': this.getFontSize() +'px' , display: 'inline', 'white-space': 'nowrap', color:this.color} + return { 'font-weight': 'bold','font-size': this.getFontSize(), display: 'flex','justify-content':'center',color:this.color} } - + + /** + * This function returns a string with the given font size (in px) based on the panel width and height + * @returns {string} + */ getFontSize():string{ - let result:number = 1; - // By default is the height / 2 - result = this.containerHeight/2; - // But maybe the widht is no enought.... lets check... - if( result*4 > this.containerWidth){ - result = this.containerWidth/4; - } - // But maybe the string lenght is too long... lets check - let strlen = (this.inject.value + this.inject.sufix).length; - if( strlen * result > this.containerWidth*1.5 ){ - result = result / 1.8; - } - // Ok.... we are done... - return result.toFixed().toString(); + let resultSize:number = 1; + + resultSize = this.containerHeight/2; + + let textLongitude = (this.inject.value + this.inject.sufix).length; + let textWidth = textLongitude * resultSize; + + if (textWidth > this.containerWidth) resultSize = this.containerWidth / textLongitude; + + if (resultSize > this.containerHeight) resultSize = this.containerHeight; + + if (textLongitude * resultSize > this.containerWidth * 1.5) resultSize = resultSize / 1.8; + + return resultSize.toFixed().toString() +'px'; } + + + + ngAfterViewInit() { const width = this.kpiContainer.nativeElement.offsetWidth; const height = this.kpiContainer.nativeElement.offsetHeight; + const elementReference = this.sufixContainer.nativeElement; + + console.log("Padre width: ",width); + console.log("Padre height: ",height); - if( width > 0 ){ this.containerHeight = height ; this.containerWidth = width ; + } + if(height < 200){ + elementReference.style.margin = "0 0 10%"; + + } + if(height > width){ + elementReference.style.marginTop = "30%"; } + if(width > height && height > 200){ + elementReference.style.marginTop = ((height/3)).toFixed() + "px"; + elementReference.style.marginBottom = ((height/3)).toFixed() + "px"; + } + + } From 3d9da9ef5c14fae16625d23be107b202b5e71cd8 Mon Sep 17 00:00:00 2001 From: aTorresJortilles Date: Fri, 16 Feb 2024 09:38:51 +0100 Subject: [PATCH 2/4] Fixed logs --- .../src/app/module/components/eda-kpi/eda-kpi.component.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/eda/eda_app/src/app/module/components/eda-kpi/eda-kpi.component.ts b/eda/eda_app/src/app/module/components/eda-kpi/eda-kpi.component.ts index 97a73505b..6682f5b36 100644 --- a/eda/eda_app/src/app/module/components/eda-kpi/eda-kpi.component.ts +++ b/eda/eda_app/src/app/module/components/eda-kpi/eda-kpi.component.ts @@ -86,10 +86,7 @@ export class EdaKpiComponent implements OnInit { const width = this.kpiContainer.nativeElement.offsetWidth; const height = this.kpiContainer.nativeElement.offsetHeight; const elementReference = this.sufixContainer.nativeElement; - - console.log("Padre width: ",width); - console.log("Padre height: ",height); - + if( width > 0 ){ this.containerHeight = height ; this.containerWidth = width ; From ba811581b5ca9cae2e02be40cc7ffcd4f5c045dc Mon Sep 17 00:00:00 2001 From: aTorresJortilles Date: Fri, 16 Feb 2024 12:08:59 +0100 Subject: [PATCH 3/4] =?UTF-8?q?Cambio=20a=20margen=20autom=C3=A1tico=20del?= =?UTF-8?q?=20componente=20KPI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/eda-kpi/eda-kpi.component.html | 2 +- .../components/eda-kpi/eda-kpi.component.ts | 32 +++++++------------ 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/eda/eda_app/src/app/module/components/eda-kpi/eda-kpi.component.html b/eda/eda_app/src/app/module/components/eda-kpi/eda-kpi.component.html index 6b266e28a..4df0e2b8b 100644 --- a/eda/eda_app/src/app/module/components/eda-kpi/eda-kpi.component.html +++ b/eda/eda_app/src/app/module/components/eda-kpi/eda-kpi.component.html @@ -1,6 +1,6 @@
-
+
{{inject.value | number:'1.0-10':'es' }} {{inject.sufix}}
diff --git a/eda/eda_app/src/app/module/components/eda-kpi/eda-kpi.component.ts b/eda/eda_app/src/app/module/components/eda-kpi/eda-kpi.component.ts index 6682f5b36..3db6c1c42 100644 --- a/eda/eda_app/src/app/module/components/eda-kpi/eda-kpi.component.ts +++ b/eda/eda_app/src/app/module/components/eda-kpi/eda-kpi.component.ts @@ -15,7 +15,6 @@ export class EdaKpiComponent implements OnInit { kpiContainer: ElementRef; @ViewChild('sufixContainer') sufixContainer: ElementRef; - sufixClick: boolean = false; color : string ; defaultColor = '#67757c'; @@ -83,27 +82,18 @@ export class EdaKpiComponent implements OnInit { ngAfterViewInit() { - const width = this.kpiContainer.nativeElement.offsetWidth; - const height = this.kpiContainer.nativeElement.offsetHeight; - const elementReference = this.sufixContainer.nativeElement; - - if( width > 0 ){ - this.containerHeight = height ; - this.containerWidth = width ; - } - if(height < 200){ - elementReference.style.margin = "0 0 10%"; - - } - if(height > width){ - elementReference.style.marginTop = "30%"; - } - if(width > height && height > 200){ - elementReference.style.marginTop = ((height/3)).toFixed() + "px"; - elementReference.style.marginBottom = ((height/3)).toFixed() + "px"; - } - + const widthKpiContainer = this.kpiContainer.nativeElement.offsetWidth; + const heightKpiContainer = this.kpiContainer.nativeElement.offsetHeight; + + const sufixContainerReference = this.sufixContainer.nativeElement; + + if( widthKpiContainer > 0 ){ + this.containerHeight = heightKpiContainer ; + this.containerWidth = widthKpiContainer ; + } + //Se pone en automático el ajustado del margen del texto + sufixContainerReference.style.margin = "auto" } From 3d633c06a3b899698f69e1e01822a155e3386c32 Mon Sep 17 00:00:00 2001 From: Juanjo Ortilles Date: Mon, 19 Feb 2024 07:06:09 +0100 Subject: [PATCH 4/4] zzz --- eda/docker_run.sh | 8 ++++---- eda/eda_api/package.json | 2 +- .../module/components/eda-table/eda-table.ts | 18 +++++++++--------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/eda/docker_run.sh b/eda/docker_run.sh index 45959c31a..77b2538e3 100644 --- a/eda/docker_run.sh +++ b/eda/docker_run.sh @@ -25,11 +25,11 @@ then mongosh --eval 'db.createCollection("data-source")' EDA mongosh --eval 'db.createCollection("files")' EDA mongosh --eval 'db.createCollection("features")' EDA - mongosh --eval 'db.groups.insert( { "_id": ObjectId("135792467811111111111110"), "role": "EDA_ADMIN_ROLE", "name" : "EDA_ADMIN", "users":[ ObjectId("135792467811111111111111") ] } )' EDA - mongosh --eval 'db.groups.insert( { "_id": ObjectId("135792467811111111111113"), "role": "EDA_USER_ROLE", "name" : "RO", "users":[] } )' EDA + mongosh --eval 'db.groups.insertOne( { "_id": ObjectId("135792467811111111111110"), "role": "EDA_ADMIN_ROLE", "name" : "EDA_ADMIN", "users":[ ObjectId("135792467811111111111111") ] } )' EDA + mongosh --eval 'db.groups.insertOne( { "_id": ObjectId("135792467811111111111113"), "role": "EDA_USER_ROLE", "name" : "RO", "users":[] } )' EDA mongosh --eval 'db.groups.insert( { "_id": ObjectId("135792467811111111111115"), "role": "EDA_USER_ROLE", "name" : "EDA_DATASOURCE_CREATOR", "users":[] } )' EDA - mongosh --eval 'db.users.insert( { "_id" : ObjectId("135792467811111111111111"), "role" : [ ObjectId("135792467811111111111110") ], "name" : "EDA", "email" : "eda@jortilles.com", "password" : "$2a$10$J48xu5KAqobLzvD8FX1LOem7NZUMuXPHID1uSHzbzTbM.wGFPXjb2" } )' EDA - mongosh --eval ' db.users.insert( { "_id" : ObjectId("135792467811111111111112"), "role" : [], "name" : "edaanonim", "email" : "edaanonim@jortilles.com", "password" : "$2a$10$ziukAcgjgTe2XPmjO1xsruKJW1HlX0I2pvCiKZHQ69DdaCzgZA4/2" } ) ' EDA + mongosh --eval 'db.users.insertOne( { "_id" : ObjectId("135792467811111111111111"), "role" : [ ObjectId("135792467811111111111110") ], "name" : "EDA", "email" : "eda@jortilles.com", "password" : "$2a$10$J48xu5KAqobLzvD8FX1LOem7NZUMuXPHID1uSHzbzTbM.wGFPXjb2" } )' EDA + mongosh --eval ' db.users.insertOne( { "_id" : ObjectId("135792467811111111111112"), "role" : [], "name" : "edaanonim", "email" : "edaanonim@jortilles.com", "password" : "$2a$10$ziukAcgjgTe2XPmjO1xsruKJW1HlX0I2pvCiKZHQ69DdaCzgZA4/2" } ) ' EDA npm install -g forever forever-monitor nodemon http-server diff --git a/eda/eda_api/package.json b/eda/eda_api/package.json index 1179b235e..01b3f1e98 100644 --- a/eda/eda_api/package.json +++ b/eda/eda_api/package.json @@ -1,6 +1,6 @@ { "name": "api-eda", - "version": "0.1.0", + "version": "2.0.0", "description": "", "main": "index.js", "scripts": { diff --git a/eda/eda_app/src/app/module/components/eda-table/eda-table.ts b/eda/eda_app/src/app/module/components/eda-table/eda-table.ts index 5ff3541b5..1e5ab019a 100644 --- a/eda/eda_app/src/app/module/components/eda-table/eda-table.ts +++ b/eda/eda_app/src/app/module/components/eda-table/eda-table.ts @@ -220,9 +220,10 @@ export class EdaTable { if (this.withColSubTotals) { event ? this.colSubTotals(event.first / event.rows + 1) : this.colSubTotals(1); } - //Es te que executar sempre - this.noRepeatedRows(); - + //Aixó no s'executa per les taules creuades + + this.noRepeatedRows(); + } deleteRowTotals() { @@ -302,8 +303,9 @@ export class EdaTable { numericCols.forEach(key => { valuesKeys.forEach(valueKey => { - if (key.includes(valueKey)) { - let decimalplaces = 0; /** esto se hace para ajustar el número de dicimales porque 3.1+2.5 puede dar 5.600004 */ + let keyArray = key.split('~'); + if (keyArray.includes(valueKey)) { + let decimalplaces = new EdaColumnNumber({}).decimals; /** esto se hace para ajustar el número de dicimales porque 3.1+2.5 puede dar 5.600004 */ try{ if( row[key].toString().split(".")[1].length > 0){ decimalplaces = row[key].toString().split(".")[1].length; @@ -430,8 +432,6 @@ export class EdaTable { const values = this._value; const keys = this.cols.map(col => col.field); - - for (let i = 0; i < values.length; i++) { for (let j = 0; j < keys.length; j++) { if (i < values.length) { @@ -466,7 +466,7 @@ export class EdaTable { border: '', type: col.type }); - } + } else { if (firstNonNumericRow) { this.totalsRow.push({ data: `${this.Totals} `, border: " ", class: 'total-row-header', type: col.type }); @@ -554,7 +554,7 @@ export class EdaTable { } } else { for (let e = 0; e < values[i].length; e += 1) { - if (values[i][e] == ""){ + if (values[i][e] == "" && isNaN(values[i][e])){ obj[labels[e]] = first[e]; } else { obj[labels[e]] = values[i][e];