Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Homepage #11

Merged
merged 2 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lwr.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"lwc": { "modules": [{ "dir": "$rootDir/src/modules" }] },
"routes": [
{
"id": "example",
"id": "home",
"path": "/",
"layoutTemplate": "$layoutsDir/index.html",
"rootComponent": "my/app",
Expand Down
4 changes: 2 additions & 2 deletions src/modules/main/logFileProcessor/logFileProcessor.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
>
<div class="slds-media__figure">
<span
class="slds-icon_container slds-icon-standard-account"
class="slds-icon_container slds-icon-standard-file"
title="account"
>
<svg
class="slds-icon slds-icon_small"
aria-hidden="true"
>
<use
xlink:href="/public/assets/icons/standard-sprite/svg/symbols.svg#account"
xlink:href="/public/assets/icons/standard-sprite/svg/symbols.svg#file"
></use>
</svg>
</span>
Expand Down
31 changes: 30 additions & 1 deletion src/modules/main/logFileProcessor/logFileProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
expThrownRegex
} from 'parser/utilVariables';

import { publish } from 'services/pubsub';
import { publish, subscribe } from 'services/pubsub';
// import { publish, MessageContext } from 'lightning/messageService';

// import STATE from '@salesforce/messageChannel/App_Service__c';
Expand Down Expand Up @@ -97,6 +97,18 @@ export default class LogFileProcessor extends LightningElement {
get acceptedFormats() {
return ['.log', '.txt'];
}

connectedCallback() {
subscribe('logtext', (data) => {
if (Array.isArray(data) && data.length > 0) {
this.fileData = data;
this.processLogData();
} else if (data.length === 0) {
this.fileData = [];
this.processLogData();
}
});
}
handleFileUpload(event) {
var reader = new FileReader();
console.log('[fileUploader.js] Processing Uploaded file...');
Expand All @@ -119,6 +131,7 @@ export default class LogFileProcessor extends LightningElement {
reader.readAsText(rawFile);
}
processLogData() {
this.resetVars();
let isSoql = false;
let isDml = false;
this.fileData.forEach((line, idx) => {
Expand Down Expand Up @@ -518,4 +531,20 @@ export default class LogFileProcessor extends LightningElement {
this.errors.push(errObj);
// console.log('Error Object: ', errObj);
}

resetVars() {
this.result = [];
this.errors = [];
this.isCurUnitCU = true;
this.codeUnitsStack = [];
this.methodUnitsStack = [];
this.stdExpCount = 0;
this.codeUnitsCount = 0;
this.methodUnitsCount = 0;
this.soqlCount = 0;
this.dmlCount = 0;
this.eventsPicklistValues = new Set();
this.execAnonyCount = 0;
this.fileDataPartial = [];
}
}
16 changes: 6 additions & 10 deletions src/modules/main/logViewer/logViewer.html
Original file line number Diff line number Diff line change
Expand Up @@ -655,8 +655,7 @@ <h1>
<li>
<div
class="metricsElement metricsTitle"
title="Total
Lines"
title="Total Lines"
>
Total
Lines
Expand All @@ -670,8 +669,7 @@ <h1>
<li>
<div
class="metricsElement metricsTitle"
title="Total
CodeUnits"
title="Total CodeUnits"
>
Total
CodeUnits
Expand All @@ -685,8 +683,7 @@ <h1>
<li>
<div
class="metricsElement metricsTitle"
title="Total
MethodUnits"
title="Total MethodUnits"
>
Total
MethodUnits
Expand All @@ -700,9 +697,9 @@ <h1>
<li>
<div
class="metricsElement metricsTitle"
title="SQOL Queries"
title="SOQL Queries"
>
SQOL
SOQL
Queries
</div>
<div
Expand All @@ -714,8 +711,7 @@ <h1>
<li>
<div
class="metricsElement metricsTitle"
title="DML
Operations"
title="DML Operations"
>
DML
Operations
Expand Down
4 changes: 4 additions & 0 deletions src/modules/my/appContent/appContent.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
width: var(--fullWidth);
}

.slds-template_default {
padding: 0.5rem;
}

.oneCenterStage {
overflow: visible;
background-color: transparent;
Expand Down
14 changes: 7 additions & 7 deletions src/modules/my/appContent/appContent.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<div class="oneCenterStage slds-is-absolute">
<div class="appContent slds-is-relative">
<div class="slds-brand-band slds-template_default">
<div class={isHome}>
<!-- <c-log-file-processor></c-log-file-processor> -->
<main-log-file-processor></main-log-file-processor>
</div>
<div class={isRawLogViewer}>
<main-log-viewer></main-log-viewer>
</div>
<my-app-home></my-app-home>
<!-- <c-log-file-processor></c-log-file-processor> -->
<!-- </div> -->
<!-- <div class={isRawLogViewer}> -->
<!-- <main-log-viewer></main-log-viewer> -->
<!-- </div> -->
<my-app-log-viewer></my-app-log-viewer>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/modules/my/appContent/appContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { subscribe } from 'services/pubsub';
export default class AppContent extends LightningElement {
// @wire(MessageContext)
// messageContext;
activeApp = 'Home';
activeApp;
appChannelSub = null;
connectedCallback() {
if (!this.appChannelSub) {
Expand Down
12 changes: 12 additions & 0 deletions src/modules/my/appHome/appHome.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<template>
<div class={isHome}>
<div class="slds-grid">
<div class="slds-col slds-size_1-of-3">
<main-log-file-processor></main-log-file-processor>
</div>
<div class="slds-col slds-size_2-of-3 slds-var-p-left_x-small">
<ui-paste-log></ui-paste-log>
</div>
</div>
</div>
</template>
18 changes: 18 additions & 0 deletions src/modules/my/appHome/appHome.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { LightningElement } from 'lwc';
import { subscribe } from 'services/pubsub';

export default class AppHome extends LightningElement {
activeApp = 'Home';
appChannelSub = null;
connectedCallback() {
if (!this.appChannelSub) {
this.appChannelSub = subscribe('appChannel', (data) => {
this.activeApp = data.activeApp;
console.log('activeApp: ', this.activeApp);
});
}
}
get isHome() {
return this.activeApp === 'Home' ? '' : 'slds-hide';
}
}
5 changes: 5 additions & 0 deletions src/modules/my/appLogViewer/appLogViewer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<div class={isLogViewer}>
<main-log-viewer></main-log-viewer>
</div>
</template>
17 changes: 17 additions & 0 deletions src/modules/my/appLogViewer/appLogViewer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { LightningElement } from 'lwc';
import { subscribe } from 'services/pubsub';
export default class AppLogViewer extends LightningElement {
activeApp;
appChannelSub = null;
connectedCallback() {
if (!this.appChannelSub) {
this.appChannelSub = subscribe('appChannel', (data) => {
this.activeApp = data.activeApp;
// console.log('activeApp: ', this.activeApp);
});
}
}
get isLogViewer() {
return this.activeApp === 'Log Viewer' ? '' : 'slds-hide';
}
}
4 changes: 3 additions & 1 deletion src/modules/my/appNavigation/appNavigation.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
.nav-item {
color: rgb(24, 24, 24);
}

img {
width: 37px;
}
a {
text-decoration: none !important;
}
Expand Down
1 change: 0 additions & 1 deletion src/modules/my/appNavigation/appNavigation.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,5 @@
</div>
</div>
</div>
<!-- <c-app-content></c-app-content> -->
<my-app-content></my-app-content>
</template>
11 changes: 11 additions & 0 deletions src/modules/ui/pasteLog/pasteLog.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
:host {
--slds-c-textarea-sizing-min-height: 16rem;
}

.btn-container {
justify-content: end;
}

.clear-btn {
color: #747474;
}
77 changes: 77 additions & 0 deletions src/modules/ui/pasteLog/pasteLog.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<template>
<article class="slds-card">
<div class="slds-card__header slds-grid">
<header
class="slds-media slds-media_center slds-has-flexi-truncate"
>
<div class="slds-media__figure">
<span
class="slds-icon_container slds-icon-standard-account"
title="Paste Debug Logs"
>
<svg
class="slds-icon slds-icon_small"
aria-hidden="true"
>
<use
xlink:href="/public/assets/icons/standard-sprite/svg/symbols.svg#display_text
"
></use>
</svg>
</span>
</div>
<div class="slds-media__body">
<h2 class="slds-card__header-title">
<a
href="#"
class="slds-card__header-link slds-truncate"
title="Paste Debug Logs"
>
<span>Paste Debug Logs</span>
</a>
</h2>
</div>
</header>
</div>
<div class="slds-card__body slds-card__body_inner">
<div class="slds-form-element">
<div class="slds-form-element__control">
<textarea
placeholder="Paste log here..."
class="slds-textarea"
onchange={handleLogChange}
></textarea>
</div>
</div>
<div class="slds-grid btn-container">
<button
class="slds-button slds-button_neutral clear-btn"
onclick={clearLog}
>
<svg
class="slds-button__icon slds-button__icon_left"
aria-hidden="true"
>
<use
xlink:href="/public/assets/icons/utility-sprite/svg/symbols.svg#clear"
></use>
</svg>
Clear Log
</button>
<button
class="slds-button slds-button_outline-brand analyze-btn"
onclick={analyzeLog}
>
<svg
class="slds-button__icon slds-button__icon_left"
aria-hidden="true"
>
<use
xlink:href="/public/assets/icons/utility-sprite/svg/symbols.svg#service_report"
></use></svg
>Analyze Log
</button>
</div>
</div>
</article>
</template>
25 changes: 25 additions & 0 deletions src/modules/ui/pasteLog/pasteLog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { LightningElement } from 'lwc';

import { publish, subscribe } from 'services/pubsub';

export default class PasteLog extends LightningElement {
logText;

handleLogChange(event) {
// console.log('event', event.target.value);
this.logText = event.target.value;
}
clearLog() {
this.logText = '';
this.template.querySelector('textarea').value = '';
publish('logtext', []);
}

analyzeLog() {
if (this.logText !== null && this.logText !== '') {
const logData = this.logText.split(/\r\n|\n/);
console.log('paste data length: ', logData.length);
publish('logtext', logData);
}
}
}
4 changes: 2 additions & 2 deletions src/modules/ui/utilityPanel/utilityPanel.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
}
.utility-panel {
width: auto;
left: 0.75rem;
right: 0.75rem;
left: 0.5rem;
right: 0.5rem;
bottom: 2.5rem;
}

Expand Down
Loading