Skip to content

Adding FLOW_ELEMENT_ERROR, FLOW_ACTIONCALL_DETAIL #25

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

Merged
merged 10 commits into from
Nov 18, 2024
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
72 changes: 46 additions & 26 deletions force-app/main/default/classes/Flow/flowUtility.cls
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
public class flowUtility {
//extracting the Flow ID and storing it in Utility variable flowId
public static void analyzeFlowStart(String line) {
List<String> splitArr = line.split('\\|');
utilityVariables.flowId = splitArr[splitArr.size() - 2];
}
public static void analyzeFlowStart(String line) {
List<String> splitArr = line.split('\\|');
utilityVariables.flowId = splitArr[splitArr.size() - 2];
}

//pushing the method to Stack i.e each flow under a particular object
public static void analyzeFlowName(String line) {
Expand All @@ -15,46 +15,66 @@ public class flowUtility {
addMethodtoStack(methodUnit);
}

public static void addElement(String line) {
public static void addElement(String line) {
List<String> splitArr = line.split('\\|');
LogLineSchema logLine = new LogLineSchema();
logLine.type = 'FLOEL';
logLine.isFlowElement = true;
logLine.elementType = splitArr.size()==4 ? splitArr[splitArr.size() - 2]: +splitArr[splitArr.size() - 2];
logLine.ruleName = splitArr.size()==4 ? 'Bulk Element '+splitArr[splitArr.size() - 1]+' Has started': 'Element '+splitArr[splitArr.size() - 1]+ ' has Started';
pushVal(logLine);
}
public static void removeElement(String line) {
List<String> splitArr = line.split('\\|');
LogLineSchema logLine = new LogLineSchema();
logLine.type = 'FLOEL';
logLine.isFlowElement = true;
//logLine.elementType = splitArr.size()==6 ? 'Bulk ' +splitArr[splitArr.size() - 4] + ' End' : splitArr[splitArr.size() - 2] + ' End';
logLine.ruleName = splitArr.size()==6 ?'Bulk Element '+ splitArr[splitArr.size() -3]+' has Ended':'Element '+splitArr[splitArr.size() -1]+' has Ended';
pushVal(logLine);
}
public static void addvalue(String line) {
List<String> splitArr = line.split('\\|');
LogLineSchema logLine = new LogLineSchema();
logLine.type = 'FLORL';
logLine.isInFlow = true;
logLine.ruleName = 'The outcome '+splitArr[splitArr.size() - 2] +' in above element is set to ' +splitArr[splitArr.size() - 1];
pushVal(logLine);
}
public static void isError(String line) {
List<String> splitArr = line.split('\\|');
LogLineSchema logLine = new LogLineSchema();
logLine.type = 'FLOEL';
logLine.isFlowElement = true;
logLine.ruleName =
splitArr[splitArr.size() - 1] +
' ' +
splitArr[splitArr.size() - 2];
logLine.type = 'FLOER';
logLine.isInFlow = true;
logLine.isError=true;
logLine.ruleName = 'The element ('+splitArr[splitArr.size() - 1] +') '+splitArr[splitArr.size() - 2] +' caused an Error. Error Message - '+ splitArr[splitArr.size() - 3];
pushVal(logLine);
}
public static void removeElement() {
}
public static void addvalue(String line) {
public static void actionDetail(String line) {
List<String> splitArr = line.split('\\|');
LogLineSchema logLine = new LogLineSchema();
logLine.type = 'FLORL';
logLine.isFlowElement = true;
logLine.ruleName =
splitArr[splitArr.size() - 2] +
' ' +
splitArr[splitArr.size() - 1];
logLine.type = 'FLOAC';
logLine.isInFlow = true;
logLine.ruleName = splitArr.size()==8 ? 'Action Type - '+splitArr[splitArr.size() -4] +', Action Name - '+splitArr[splitArr.size() -3] +', Is Action Success - '+splitArr[splitArr.size() -2] +', Error Message - '+splitArr[splitArr.size() -1]:
'Action Type - '+splitArr[splitArr.size() -3] +', Action Name - '+splitArr[splitArr.size() -2] +', Is Action Success - '+splitArr[splitArr.size() -1];
pushVal(logLine);
}
public static void popMethodUnit() {
public static void popMethodUnit(){
if (!utilityVariables.methodUnitsStack.isEmpty()) {
utilityVariables.methodUnitsStack.pop();
}
}
//adding the existing flow to method stack and codeunit
}
//adding the existing flow to method stack and codeunit
private static void addMethodtoStack(MethodSchema methodUnit) {
if (!utilityVariables.codeUnitsStack.isEmpty()) {
CodeUnitContainerSchema currentCodeUnit = (CodeUnitContainerSchema) utilityVariables.codeUnitsStack.peek();
ExecutedLineAndSubUnitSchema elss = new ExecutedLineAndSubUnitSchema();
elss.methodUnit = methodUnit;
currentCodeUnit.executedLinesAndSubUnits.add(elss);
utilityVariables.methodUnitsStack.push(methodUnit);
}
}
}

private static void pushVal(LogLineSchema log) {
if (!utilityVariables.methodUnitsStack.isEmpty()) {
MethodSchema currentMethodUnit = (MethodSchema) utilityVariables.methodUnitsStack.peek();
Expand All @@ -64,4 +84,4 @@ public class flowUtility {
utilityVariables.currentLog = log;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@ public class LogLineSchema {
@AuraEnabled
public String ruleName;
@AuraEnabled
public String elementType;
@AuraEnabled
public Boolean isFlowElement;
@AuraEnabled
public Boolean isInFlow;
@AuraEnabled
public Boolean isError;
//Added for Validation formula
@AuraEnabled
public String valFor;
Expand Down
66 changes: 35 additions & 31 deletions force-app/main/default/classes/UtilityMethods.cls
Original file line number Diff line number Diff line change
Expand Up @@ -283,39 +283,43 @@ public class UtilityMethods {
) {
flowUtility.analyzeFlowName(line);
break;
} else if (
utilityVariables.currentLineEvent == 'FLOW_ELEMENT_BEGIN'
) {
flowUtility.addElement(line);
break;
} else if (utilityVariables.currentLineEvent == 'FLOW_ELEMENT_END') {
flowUtility.removeElement();
break;
} else if (
utilityVariables.currentLineEvent == 'FLOW_BULK_ELEMENT_BEGIN'
) {
/*
* 1. Use same methods as FLOW_ELEMENT_BEGIN
*/
flowUtility.addElement(line);
break;
} else if (
utilityVariables.currentLineEvent == 'FLOW_BULK_ELEMENT_END'
) {
/*
* 1. Use same methods as FLOW_ELEMENT_END
*/
flowUtility.removeElement();
}
else if (utilityVariables.currentLineEvent == 'FLOW_ELEMENT_BEGIN') {
flowUtility.addElement(line);
break;
}
else if (utilityVariables.currentLineEvent == 'FLOW_ELEMENT_END') {
flowUtility.removeElement(line);
break;
}
else if (utilityVariables.currentLineEvent == 'FLOW_BULK_ELEMENT_BEGIN') {
/*
* 1. Use same methods as FLOW_ELEMENT_BEGIN
*/
flowUtility.addElement(line);
break;
}
else if (utilityVariables.currentLineEvent == 'FLOW_BULK_ELEMENT_END') {
/*
* 1. Use same methods as FLOW_ELEMENT_END
*/
flowUtility.removeElement(line);
break;
}
else if (utilityVariables.currentLineEvent == 'FLOW_VALUE_ASSIGNMENT') {
flowUtility.addvalue(line);
break;
}
else if (utilityVariables.currentLineEvent == 'FLOW_START_INTERVIEWS_END') {
flowUtility.popMethodUnit();
break;
} else if (
utilityVariables.currentLineEvent == 'FLOW_VALUE_ASSIGNMENT'
) {
flowUtility.addvalue(line);
}
else if (utilityVariables.currentLineEvent == 'FLOW_ELEMENT_ERROR') {
flowUtility.isError(line);
break;
} else if (
utilityVariables.currentLineEvent == 'FLOW_START_INTERVIEWS_END'
) {
flowUtility.popMethodUnit();
}
else if (utilityVariables.currentLineEvent == 'FLOW_ACTIONCALL_DETAIL') {
flowUtility.actionDetail(line);
break;
}
}
Expand Down
8 changes: 7 additions & 1 deletion force-app/main/default/classes/utilityVariables.cls
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,19 @@ public class utilityVariables {
'[0-9:.\\s\\(\\)]+(\\|)(FLOW_BULK_ELEMENT_BEGIN)(\\|)[a-zA-Z]+(\\|)[a-zA-Z_]+' => 'Flow-Bulk-Element-Begin-Generic'
},
'FLOW_BULK_ELEMENT_END' => new Map<String, String>{
'^[0-9:.\\s\\(\\)]+(\\|)(FLOW_BULK_ELEMENT_END)(\\|)[a-zA-Z]+(\\|)[a-zA-Z_]+(\\|)[0,1](\\|)[0,1]' => 'Flow-Bullk-Element-End-Generic'
'^[0-9:.\\s\\(\\)]+(\\|)(FLOW_BULK_ELEMENT_END)(\\|)[a-zA-Z]+(\\|)[a-zA-Z_]+(\\|)[0,1](\\|)[0,1]' => 'Flow-Bulk-Element-End-Generic'
},
'FLOW_VALUE_ASSIGNMENT' => new Map<String, String>{
'^[0-9:.\\s\\(\\)]+(\\|)(FLOW_VALUE_ASSIGNMENT)(\\|)[0-9a-z\\-]+(\\|)[A-Za-z_]+(\\|)[a-z]+' => 'Flow-Value-Assignment'
},
'FLOW_START_INTERVIEWS_END' => new Map<String, String>{
'^[0-9:.\\s\\(\\)]+(\\|)FLOW_START_INTERVIEWS_END(\\|)[0-1]' => 'Flow-Start-Interviews-End'
},
'FLOW_ELEMENT_ERROR'=>new Map<String,String>{
'^[0-9:.\\s\\(\\)]+(\\|)FLOW_ELEMENT_ERROR(\\|)[\\s\\w.,:\\-\\(\\)]+(\\|)[a-zA-Z]+(\\|)[a-zA-Z_0-9]+' => 'Flow-Error-Generic'
},
'FLOW_ACTIONCALL_DETAIL'=>new Map<String,String>{
'^[0-9:.\\s\\(\\)]+(\\|)FLOW_ACTIONCALL_DETAIL(\\|)[0-9a-z\\-]+(\\|)[\\w]+(\\|)[\\w\\s]+(\\|)[\\w]+(\\|)[a-z]+(\\|)[\\s\\w.,:\\-\\(\\\\)]+' => 'Flow-Action-Detail'
}
};

Expand Down
8 changes: 7 additions & 1 deletion force-app/main/default/lwc/logLineWrapper/logLineWrapper.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,17 @@
.soqe {
color: rgb(73, 208, 63);
}
.floer {
color: rgb(208, 63, 63);
}
.floac {
color: rgb(63, 208, 73);
}
.florl {
color: rgb(216, 76, 198);
}
.floel {
color: rgb(158, 47, 166);
color: rgb(58, 17, 139);
}
.debug {
color: rgb(248, 197, 85);
Expand Down
13 changes: 11 additions & 2 deletions force-app/main/default/lwc/logLineWrapper/logLineWrapper.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,17 @@
<td class="slds-text-body_small slds-cell-wrap line-content">
<div class="slds-line-clamp" title={line.logLineData.varValue}>
<span class="slds-text-font_monospace">
{line.logLineData.ruleName}</span
>
{line.logLineData.ruleName} </span>
<span class="slds-badge">{line.logLineData.elementType}</span>
</div>
</td>
</template>
<template lwc:if={line.logLineData.isInFlow}>
<td class="slds-text-body_small slds-cell-wrap line-content">
<div class="slds-line-clamp" title={line.logLineData.varValue}>
<span class="slds-text-font_monospace">
{line.logLineData.ruleName} </span>
<template lwc:if={line.logLineData.isError}><span class="slds-badge slds-theme_error">Error</span></template>
</div>
</td>
</template>
Expand Down
9 changes: 8 additions & 1 deletion force-app/main/default/lwc/logLineWrapper/logLineWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,14 @@ export default class LogLineWrapper extends LightningElement {
//<!-- FLOEL -->
else if (logTemp.logLineData.type === "FLOEL") {
logTemp.eventClassComb = "slds-line-clamp floel";
// console.log("No.of Rows: ", JSON.stringify(logTemp.logLineData));
}
//<!-- FLOER -->
else if (logTemp.logLineData.type === "FLOER") {
logTemp.eventClassComb = "slds-line-clamp floer";
}
//<!-- FLOAC -->
else if (logTemp.logLineData.type === "FLOAC") {
logTemp.eventClassComb = "slds-line-clamp floac";
}
log = logTemp;
} else if (log.type === "unit") {
Expand Down
Loading