Skip to content

Commit

Permalink
rebase conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Alloza committed Nov 22, 2023
1 parent ef652fa commit 0071fd4
Show file tree
Hide file tree
Showing 10 changed files with 134 additions and 274 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export class EdaChartComponent implements OnInit, AfterViewInit {
@ViewChild('edaChart') edaChart: BaseChartDirective;
@Output() onClick: EventEmitter<any> = new EventEmitter<any>();
@Input() inject: EdaChart;
@Output() onClick: EventEmitter<any> = new EventEmitter();

public update: boolean;
public chartPlugins = [ ChartDataLabels ];
Expand Down Expand Up @@ -74,30 +73,17 @@ export class EdaChartComponent implements OnInit, AfterViewInit {
return;
}

<<<<<<< HEAD
=======
ngAfterViewInit(): void {
this.edaChart.chart.options.onClick = (evt, activeEls, chart) => {
if (activeEls.length === 0 || chart.getElementsAtEventForMode(<any>evt, 'nearest', { intersect: true }, true).length === 0) {
return;
}

>>>>>>> 6bff99f (chartClick - no refresh data)
activeEls.forEach(point => {
const filterBy = chart.data.datasets[point.datasetIndex].label;
const filterBy = chart.data.datasets[point.datasetIndex].label || chart.data.labels[point.index];
const label = chart.data.labels[point.index];
const value = chart.data.datasets[point.datasetIndex].data[point.index];
this.onClick.emit({ inx: point.index, label, value, filterBy })
<<<<<<< HEAD

if (this.inject.linkedDashboardProps) {
const props = this.inject.linkedDashboardProps;
const url = window.location.href.substr( 0, window.location.href.indexOf('/dashboard')) +`/dashboard/${props.dashboardID}?${props.table}.${props.col}=${label}`
window.open(url, "_blank");
}
=======
console.log('onCLick');
>>>>>>> 6bff99f (chartClick - no refresh data)
})
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ export class ChartDialogComponent extends EdaDialogAbstract {
const newDatasets = [];
const dataset = this.chart.chartDataset;

<<<<<<< HEAD

for (let i = 0, n = dataset.length; i < n; i += 1) {
if (dataset[i].label === event.label) {
Expand Down Expand Up @@ -173,33 +172,31 @@ export class ChartDialogComponent extends EdaDialogAbstract {
newDatasets.push(dataset[i]);
}

this.chart.chartDataset = newDatasets;
=======
let inx = this.chart.chartLabels.findIndex((label: string) => event.label === label);
if (inx >= 0) {
for (let i = 0, n = dataset.length; i < n; i += 1) {
if (dataset[i].label === event.label) {
//dataset[i].hoverBackgroundColor = this.hex2rgb(event.bg, 90);
//dataset[i].hoverBorderColor = 'rgb(255,255,255)';
dataset[i].backgroundColor = this.hex2rgb(event.bg, 90);
dataset[i].borderColor = this.hex2rgb(event.bg, 100);
this.chart.chartColors[i] = _.pick(dataset[i], [ 'backgroundColor', 'borderColor']);
} else if (dataset[i].data[inx]) {
dataset[i].backgroundColor[inx] = this.hex2rgb(event.bg, 90);
dataset[i].borderColor[inx] = this.hex2rgb(event.bg, 100);
this.chart.chartColors[i] = _.pick(dataset[i], [ 'backgroundColor', 'borderColor']);
} else {
//dataset[i].hoverBackgroundColor = this.chart.chartColors[i].backgroundColor;
//dataset[i].hoverBorderColor = 'rgb(255,255,255)';
dataset[i].backgroundColor = this.chart.chartColors[i].backgroundColor;
dataset[i].borderColor = this.chart.chartColors[i].backgroundColor;
this.chart.chartColors[i] = _.pick(dataset[i], [ 'backgroundColor', 'borderColor']);
}
newDatasets.push(dataset[i]);
}
this.chart.chartDataset = newDatasets;
}
>>>>>>> 6bff99f (chartClick - no refresh data)
// this.chart.chartDataset = newDatasets;
// let inx = this.chart.chartLabels.findIndex((label: string) => event.label === label);
// if (inx >= 0) {
// for (let i = 0, n = dataset.length; i < n; i += 1) {
// if (dataset[i].label === event.label) {
// //dataset[i].hoverBackgroundColor = this.hex2rgb(event.bg, 90);
// //dataset[i].hoverBorderColor = 'rgb(255,255,255)';
// dataset[i].backgroundColor = this.hex2rgb(event.bg, 90);
// dataset[i].borderColor = this.hex2rgb(event.bg, 100);
// this.chart.chartColors[i] = _.pick(dataset[i], [ 'backgroundColor', 'borderColor']);
// } else if (dataset[i].data[inx]) {
// dataset[i].backgroundColor[inx] = this.hex2rgb(event.bg, 90);
// dataset[i].borderColor[inx] = this.hex2rgb(event.bg, 100);
// this.chart.chartColors[i] = _.pick(dataset[i], [ 'backgroundColor', 'borderColor']);
// } else {
// //dataset[i].hoverBackgroundColor = this.chart.chartColors[i].backgroundColor;
// //dataset[i].hoverBorderColor = 'rgb(255,255,255)';
// dataset[i].backgroundColor = this.chart.chartColors[i].backgroundColor;
// dataset[i].borderColor = this.chart.chartColors[i].backgroundColor;
// this.chart.chartColors[i] = _.pick(dataset[i], [ 'backgroundColor', 'borderColor']);
// }
// newDatasets.push(dataset[i]);
// }
// this.chart.chartDataset = newDatasets;
// }
} else {
if (this.chart.chartLabels) {
const labels = this.chart.chartLabels;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,11 @@ <h6 id="p-header" class="panel-title" style="cursor: default">
<!-- Body of Panel -->
<div class="panel-body" [ngClass]="{'spinner-panel': display_v.minispinner === true}">
<div *ngIf="display_v.saved_panel" class="p-1" style="height: 100%">
<<<<<<< HEAD
<panel-chart class="component" #PanelChartComponent [props]="panelChartConfig" (configUpdated)="setChartProperties()" (onChartClick)="onChartClick($event)"
style="height: 100%; width: 100%; display:block">
=======
<panel-chart #PanelChartComponent
[props]="panelChartConfig"
(configUpdated)="setChartProperties()"
(onChartClick)="onChartClick($event)"
class="component" style="height: 100%; width: 100%; display:block">
>>>>>>> 6bff99f (chartClick - no refresh data)
</panel-chart>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,7 @@ export class EdaBlankPanelComponent implements OnInit {
@Input() inject: InjectEdaPanel;
@Output() remove: EventEmitter<any> = new EventEmitter();
@Output() duplicate: EventEmitter<any> = new EventEmitter();
<<<<<<< HEAD
@Output() action: EventEmitter<IPanelAction> = new EventEmitter<IPanelAction>();
=======
@Output() action: EventEmitter<IPanelAction> = new EventEmitter();
>>>>>>> 6bff99f (chartClick - no refresh data)

/** propietats que s'injecten al dialog amb les propietats específiques de cada gràfic. */
public configController: EdaDialogController;
Expand Down Expand Up @@ -453,22 +449,15 @@ export class EdaBlankPanelComponent implements OnInit {
}
}

<<<<<<< HEAD
=======
/**
* Chart click event
*/
>>>>>>> 6bff99f (chartClick - no refresh data)
public onChartClick(event: any): void {
const config = this.panelChart.getCurrentConfig();
if (config?.chartType == 'doughnut') {
this.action.emit({ code: 'ADDFILTER', data: {...event, panel: this.panel} });
}
}
<<<<<<< HEAD
=======

>>>>>>> 6bff99f (chartClick - no refresh data)

/**
* Changes chart type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ export class LinkDashboardsComponent extends EdaDialogAbstract {


for (let i = 0; i < dashboards.length; i++) {
<<<<<<< HEAD
let res;
try {
res = await this.dashboardService.getDashboard(dashboards[i]._id).toPromise();
Expand Down Expand Up @@ -218,57 +217,6 @@ export class LinkDashboardsComponent extends EdaDialogAbstract {

}
}
=======
let res;
try {
res = await this.dashboardService.getDashboard(dashboards[i]._id).toPromise();
} catch (err) {
console.log(dashboards[i]._id)
console.error(err);
}

if (res) {
/** If datasources are equal and dashboar has filters */
if (res.dashboard.config.ds._id === this.controller.params.datasource && res.dashboard.config.filters?.length > 0) {

let disable = true;

if (!this.controller.params.modeSQL) {

res.dashboard.config.filters.forEach(filter => {
if (filter.column.value.column_name === column.col && filter.table.value === column.table) {
disable = false;
}

this.targetColumn = column.col;
this.targetTable = column.table;

this.sourceColumn = column.col;
this.sourceTable = column.table;

});

if (!disable) {
this.dasboards.push({ label: dashboards[i].config.title, value: dashboards[i]._id });
}

} else {

this.sourceColumn = column.col;
this.sourceTable = column.table;

res.dashboard.config.filters.forEach(filter => {

filters.push({ colname: filter.column.value.column_name, dashboardID: dashboards[i]._id, table: filter.table.value });

});

this.dasboards.push({ label: dashboards[i].config.title, value: dashboards[i]._id });

}
}
}
>>>>>>> 6bff99f (chartClick - no refresh data)

}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
<<<<<<< HEAD
import { filter } from 'rxjs/operators';
=======
>>>>>>> 6bff99f (chartClick - no refresh data)
import { EdaKnob } from './../../../eda-knob/edaKnob';
import { EdaKnobComponent } from './../../../eda-knob/eda-knob.component';
import { EdaScatter } from './../../../eda-scatter/eda-scatter.component';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export const QueryUtils = {
* @param globalFilters flag to apply when runQuery() is called from dashboard component.
*/
runQuery: async (ebp: EdaBlankPanelComponent, globalFilters: boolean) => {
<<<<<<< HEAD

/** gestiona las columnas duplicadas. Si tengo dos columnas con el mismo nombre le añado el sufijo _1, _2, _3.... etc */
let dup = [];
Expand All @@ -98,8 +97,6 @@ export const QueryUtils = {
}
})

=======
>>>>>>> 6bff99f (chartClick - no refresh data)
ebp.display_v.disablePreview = false;

if (!globalFilters) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ <h3 *ngIf="!titleClick" class="eda-title"> {{title}} </h3>
class="p-button-raised p-button-outlined filters-size">
</button>

<<<<<<< HEAD

<div *ngFor="let filter of filtersList" class="filter-set d-flex align-items-center">
<span class="filter-name filters-size"> {{filter.column.label}}: </span>
Expand All @@ -43,20 +42,6 @@ <h3 *ngIf="!titleClick" class="eda-title"> {{title}} </h3>
[style]="{'max-width': '250px', 'min-width':'200px', 'font-family':'var(--eda-filters-font-family)'}"
[Show]="adjustSize(filter)"
(onChange)="applyGlobalFilter(filter)">
=======
<p-multiSelect *ngIf="filter.data && filter.column.value.column_type !== 'date'"
[options]="filter.data"
[(ngModel)]="filter.selectedItems"
[virtualScroll]="true"
itemSize="30"
[maxSelectedLabels]="3"
defaultLabel="{{filter.column.label}}"
display="chip"
class="customMultiselect filters-size"
[style]="{'max-width': '250px', 'min-width':'200px', 'font-family':'var(--eda-filters-font-family)'}"
[Show]="adjustSize(filter)"
(onChange)="applyGlobalFilter(filter)" >
>>>>>>> 6bff99f (chartClick - no refresh data)

<p-footer>
<button id="dashFilterConf"
Expand Down Expand Up @@ -95,10 +80,6 @@ <h3 *ngIf="!titleClick" class="eda-title"> {{title}} </h3>
</div>
</div>

<<<<<<< HEAD
=======

>>>>>>> 6bff99f (chartClick - no refresh data)
<ngx-gridster class="dashboard-grid" [options]="gridsterOptions" [draggableOptions]="gridsterDraggableOptions" #gridster1 >
<!-- Normal Size -->
<ng-container *ngIf="!toLitle && !toMedium" >
Expand Down Expand Up @@ -127,24 +108,14 @@ <h3 *ngIf="!titleClick" class="eda-title"> {{title}} </h3>
<ng-container [ngSwitch]="panel.type">

<eda-blank-panel *ngSwitchCase="0" #edaPanel [panel]="panel" [inject]="inject" (remove)="onRemovePanel($event)" (action)="onPanelAction($event)" (duplicate)="onDuplicatePanel($event)" >
<<<<<<< HEAD
</eda-blank-panel>

<eda-title-panel *ngSwitchCase="1" #edaPanel [id]="panel.id" [panel]="panel" [inject]="inject" (remove)="onRemovePanel($event)" (duplicate)="onDuplicatePanel($event)" class="eda-text-panel">
=======
</eda-blank-panel >

<eda-title-panel *ngSwitchCase="1" #edaPanel [panel]="panel" [inject]="inject" (remove)="onRemovePanel($event)" (duplicate)="onDuplicatePanel($event)" >
>>>>>>> 6bff99f (chartClick - no refresh data)
</eda-title-panel>

</ng-container>
</ng-template>

<<<<<<< HEAD

=======
>>>>>>> 6bff99f (chartClick - no refresh data)
</div>

<!-- ============================================================== -->
Expand Down
Loading

0 comments on commit 0071fd4

Please sign in to comment.