Skip to content

Commit

Permalink
Merge pull request #15 from charangirijala/filterpanel
Browse files Browse the repository at this point in the history
filterpanel UI implemented-2 ✅
  • Loading branch information
charangirijala authored Jan 11, 2025
2 parents 6ba8873 + d4dcb37 commit d7e7e88
Show file tree
Hide file tree
Showing 4 changed files with 178 additions and 74 deletions.
6 changes: 3 additions & 3 deletions src/modules/main/logFileProcessor/logFileProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export default class LogFileProcessor extends LightningElement {
try {
this.exitCodeUnit(idx + 1, line);
} catch (err) {
console.error(e);
console.error(err);
}
} else if (lineEvent === 'METHOD_ENTRY') {
const RegexMap = eventsRegexMain.get(lineEvent);
Expand All @@ -177,8 +177,8 @@ export default class LogFileProcessor extends LightningElement {
//process methodunit finish logic
try {
this.exitMethodUnit(idx + 1, line);
} catch (e) {
console.error(e);
} catch (err) {
console.error(err);
}
} else {
if (lineEvent === 'EXCEPTION_THROWN') {
Expand Down
6 changes: 3 additions & 3 deletions src/modules/main/logViewer/logViewer.html
Original file line number Diff line number Diff line change
Expand Up @@ -432,11 +432,11 @@ <h1>
>
<div
class={filter.filterItemClass}
onclick={onFilterElementClick}
data-filterid={filter.id}
>
<button
class="slds-button_reset slds-grow slds-has-blur-focus"
onclick={onFilterElementClick}
data-filterid={filter.id}
>
<span
class="slds-show slds-text-body_small"
Expand Down Expand Up @@ -465,7 +465,7 @@ <h1>
<button
class="slds-button slds-button_icon slds-button_icon slds-button_icon-small"
title="Remove Filter"
data-id={filter.id}
data-filterid={filter.id}
onclick={removeFilter}
>
<svg
Expand Down
59 changes: 42 additions & 17 deletions src/modules/main/logViewer/logViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default class logViewer extends LightningElement {
LineNumMap = new Map();
LineNumFocus = null;
filterPickListMaster = [];
previousFilters = [];
logChannelSub = null;
isFilterEditing = false;
isFilterPopOverShowing = false;
Expand Down Expand Up @@ -79,7 +80,8 @@ export default class logViewer extends LightningElement {
this.filterPickListMaster =
data.eventsPicklistValues.map((str) => ({
value: str,
label: str
label: str,
isInUse: false
}));
const payload = {
currentFilterIdx: null,
Expand All @@ -100,7 +102,7 @@ export default class logViewer extends LightningElement {
if (!this.filterChannelSub) {
this.filterChannelSub = subscribe('filterChannel', (data) => {
if (data.activeFilters) {
this.activeFilters = this.activeFilters;
this.activeFilters = data.activeFilters;
}
});
}
Expand Down Expand Up @@ -162,7 +164,12 @@ export default class logViewer extends LightningElement {
}
}
}
console.log('Rerendering: ', this.activeFilters);
console.log(
'Rerendering: activeFilters:',
this.activeFilters,
' Prev filters: ',
this.previousFilters
);
}

get hasActiveFilters() {
Expand Down Expand Up @@ -217,12 +224,21 @@ export default class logViewer extends LightningElement {
// ################# FILTERS START#########################################################

closeFilter() {
this.previousFilters = null;
this.filterClass =
'slds-panel slds-size_medium slds-panel_docked slds-panel_docked-right slds-panel_drawer filter-panel slds-hidden';
}
openFilter() {
this.filterClass =
'slds-panel slds-size_medium slds-panel_docked slds-panel_docked-right slds-panel_drawer filter-panel slds-is-open';
if (this.filterClass.includes('slds-is-open')) {
this.closeFilter();
} else {
this.previousFilters = JSON.parse(
JSON.stringify(this.activeFilters)
);
console.log('openFilter called: ', this.previousFilters);
this.filterClass =
'slds-panel slds-size_medium slds-panel_docked slds-panel_docked-right slds-panel_drawer filter-panel slds-is-open';
}
}

get ShowFilterSave() {
Expand All @@ -233,7 +249,7 @@ export default class logViewer extends LightningElement {
}

removeFilter(event) {
const filterIndex = event.target.dataset.id;
const filterIndex = event.target.dataset.filterid;
this.isFilterPopOverShowing = false;
let idx = 0;
console.log('[LogPreviewer.js] removeFilter called', filterIndex);
Expand All @@ -244,7 +260,8 @@ export default class logViewer extends LightningElement {
this.activeFilters.forEach((filter) => {
filter.id = idx++;
});
this.currentEditFilterIdx = 0;
this.currentEditFilterIdx = null;
this.previousFilters = JSON.parse(JSON.stringify(this.activeFilters));
}

addFilter() {
Expand Down Expand Up @@ -284,12 +301,20 @@ export default class logViewer extends LightningElement {
this.isFilterEditing = false;
this.handlePopoverClose();
this.activeFilters = [];
this.previousFilters = [];
}

cancelFilterEdit() {
this.isFilterEditing = false;
this.isFilterPopOverShowing = false;
this.activeFilters.pop();
console.log('prev filters: ', this.previousFilters);
if (this.previousFilters === null) {
this.activeFilters = [];
} else {
this.activeFilters = JSON.parse(
JSON.stringify(this.previousFilters)
);
}
}

saveFilterEdit() {
Expand Down Expand Up @@ -326,7 +351,7 @@ export default class logViewer extends LightningElement {
item.id = idx;
});

console.log('filters after save:', typeof this.activeFilters);
this.previousFilters = JSON.parse(JSON.stringify(this.activeFilters));
}

closeFilterPopoverOnClick(event) {
Expand Down Expand Up @@ -381,10 +406,10 @@ export default class logViewer extends LightningElement {
: false;
// console.log('clicked in boundary: ', isInBoundary);
if (eventDropdown) {
console.log(
'Dropdown activated: ',
eventDropdown.getBoundingClientRect()
);
// console.log(
// 'Dropdown activated: ',
// eventDropdown.getBoundingClientRect()
// );
const dropdownBoundaries =
eventDropdown.getBoundingClientRect();
const dropXLeft = dropdownBoundaries.left;
Expand Down Expand Up @@ -447,10 +472,10 @@ export default class logViewer extends LightningElement {
const popover = this.template.querySelector('.popover-section');
const filterPanel = this.template.querySelector('.filter-panel');
const filterPanelTop = filterPanel.getBoundingClientRect().top;
console.log(
'panel boundaries: ',
filterPanel.getBoundingClientRect()
);
// console.log(
// 'panel boundaries: ',
// filterPanel.getBoundingClientRect()
// );
if (
this.currentEditFilterIdx !== null &&
this.currentEditFilterIdx !== undefined
Expand Down
Loading

0 comments on commit d7e7e88

Please sign in to comment.