Skip to content

Commit 45d3bef

Browse files
authored
Merge pull request #1308 from utmstack/backlog/fix_logexplorer_inconsistences
fix[frontend](logexplorer_tabs): fixed logexplorer tab indexPatter change incon…
2 parents 1cc11b6 + 3cf0eaf commit 45d3bef

5 files changed

Lines changed: 26 additions & 14 deletions

File tree

frontend/src/app/log-analyzer/explorer/log-analyzer-field/log-analyzer-field.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ export class LogAnalyzerFieldComponent implements OnInit, OnDestroy {
4646
filter((dataChange: LogAnalyzerDataChangeType) => {
4747
return !!dataChange && this.uuid === dataChange.tabUUID;
4848
}))
49-
.subscribe((dataChange: LogAnalyzerDataChangeType) => {
49+
.subscribe( (dataChange: LogAnalyzerDataChangeType) => {
5050
this.pageStart = 0;
5151
this.pageEnd = 100;
5252
this.pattern = dataChange.pattern.pattern;
53-
this.loadFields();
53+
this.loadFields()
5454
});
5555

5656
this.indexFieldController.$field.subscribe(async (field) => {

frontend/src/app/log-analyzer/explorer/log-analyzer-tabs/log-analyzer-tabs.component.html

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,9 @@ <h5 class="card-title mb-0 text-uppercase label-header">
1111
</div>
1212
</div>-->
1313
<ul class="nav nav-tabs">
14-
<li (click)="tabChanged(tab)" *ngFor="let tab of tabs; let tabIndex = index"
15-
class="nav-item">
16-
<a [ngClass]="{'active':tab.active}" [ngbTooltip]="tab.title"
17-
[openDelay]="1000"
18-
class="nav-link"
19-
placement="bottom"
20-
tooltipClass="utm-tooltip-bottom">
14+
<li (click)="tabChanged(tab)" *ngFor="let tab of tabs; let tabIndex = index" class="nav-item">
15+
<a [ngClass]="{'active':tab.active}" [ngbTooltip]="tab.title" [openDelay]="1000" class="nav-link"
16+
placement="bottom" tooltipClass="utm-tooltip-bottom">
2117
<i (click)="removeTab(tabIndex)" class="icon-cross2 mr-2"></i>
2218
{{tab.title}}
2319
</a>
@@ -28,14 +24,13 @@ <h5 class="card-title mb-0 text-uppercase label-header">
2824
</li>
2925
</ul>
3026
</div>
31-
<div *ngIf="tabs.length === 0"
32-
class="warning-empty-discovery w-100 p-5 mt-5 d-flex
27+
<div *ngIf="tabs.length === 0" class="warning-empty-discovery w-100 p-5 mt-5 d-flex
3328
justify-content-center align-items-center flex-column">
3429
<i class="icon-zoomin3 icon-3x text-grey-300"></i>
35-
<h6 (click)="addNewTab()"
36-
class="text-blue-800 mt-3 cursor-pointer">Add new tab to explore your data</h6>
30+
<h6 (click)="addNewTab()" class="text-blue-800 mt-3 cursor-pointer">Add new tab to explore your data</h6>
3731
</div>
3832
<ng-container *ngIf="tabs.length > 0">
39-
<app-tab-content *ngFor="let tab of tabs; let tabIndex = index; trackBy: trackByFn" [hidden]="tab !== tabSelected" [tab]="tab"></app-tab-content>
33+
<app-tab-content *ngFor="let tab of tabs; let tabIndex = index; trackBy: trackByFn" [hidden]="tab !== tabSelected"
34+
[tab]="tab"></app-tab-content>
4035
</ng-container>
4136
</ng-container>

frontend/src/app/log-analyzer/explorer/log-analyzer-tabs/log-analyzer-tabs.component.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ export class LogAnalyzerTabsComponent implements OnInit, OnDestroy {
5050
if (this.tabService.getTabCount() ==0) {
5151
this.addNewTab(null, null, params);
5252
}
53+
if(isRefresh){
54+
this.updateCurrentTab(params)
55+
}
5356
}
5457
});
5558

@@ -78,11 +81,23 @@ export class LogAnalyzerTabsComponent implements OnInit, OnDestroy {
7881
}
7982

8083
tabChanged(tab: TabType) {
84+
console.log(tab)
8185
this.tabSelected = tab;
8286
this.tabService.setActiveTab(tab.id);
8387
this.indexPatternBehavior.changePattern({pattern: tab.tabData.pattern, tabUUID: tab.uuid});
8488
}
8589

90+
updateCurrentTab(params?:Params){
91+
if(!this.tabSelected)return
92+
const pattern = params && params.patternId ? new UtmIndexPattern(params.patternId, params.indexPattern, true) :
93+
new UtmIndexPattern(1, 'v11-log-*', true);
94+
this.tabService.updateActiveTab({name:this.tabSelected.title,pattern})
95+
//timeout to set the reload at the end of DOM reload
96+
setTimeout(()=>{
97+
this.indexPatternBehavior.changePattern({pattern, tabUUID:this.tabSelected.uuid});
98+
},0)
99+
}
100+
86101
addNewTab(tabName?: string, query?: LogAnalyzerQueryType, params?: Params) {
87102
const uuid = UUID.UUID();
88103
this.tabNumber = this.tabService.getTabCount() + 1;

frontend/src/app/log-analyzer/explorer/log-analyzer-view/log-analyzer-view.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ export class LogAnalyzerViewComponent implements OnInit, OnDestroy {
117117
};
118118
}
119119
}
120+
120121
});
121122
this.dateFormat$ = this.timezoneFormatService.getDateFormatSubject();
122123
this.initExplorer();

frontend/src/app/log-analyzer/shared/services/tab.service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export class TabService {
6464
const activeTab = this.getActiveTab();
6565
if (activeTab) {
6666
activeTab.title = query.name;
67+
activeTab.tabData=query
6768
this.emitTabs();
6869
}
6970
}

0 commit comments

Comments
 (0)