Skip to content

Commit

Permalink
Flow doc fix: add description for constants, variables, text template…
Browse files Browse the repository at this point in the history
… & formulas (#978)

+ Fix parsing of formulas if there is only one
  • Loading branch information
nvuillam authored Jan 7, 2025
1 parent cb1718e commit a5c0961
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

Note: Can be used with `sfdx plugins:install sfdx-hardis@beta` and docker image `hardisgroupcom/sfdx-hardis@beta`

- Flow doc fix: add description for constants, variables, text template & formulas
- Flow parsing: Fix error when there is only one formula

## [5.13.1] 2025-01-07

- [hardis:doc:project2markdown](https://sfdx-hardis.cloudity.com/hardis/doc/project2markdown/) Display a screen emoji in documentation flows table when they are not tied to an Object
Expand Down
11 changes: 7 additions & 4 deletions src/common/utils/flowVisualiser/flowParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ async function createFlowMap(flowObj: any): Promise<FlowMap> {
// Common first descriptive elements
if (['description', 'environments', 'formulas', 'interviewLabel', 'label', 'processType', 'status', 'textTemplates'].includes(property)) {
flowMap[property] = flowObj[property];
if (property === "formulas" && typeof flowObj[property] === "object") {
flowMap["formulas"] = [flowObj["formulas"]];
}
}
// Start element
else if (property === 'start') {
Expand Down Expand Up @@ -418,28 +421,28 @@ function getGeneralInfoMd(flowObj: any, flowMap: FlowMap) {

function getVariablesMd(vars: any[]): string {
if (vars && vars.length > 0) {
return mdEndSection(buildCustomMarkdownTable(vars, ["name", "dataType", "isCollection", "isInput", "isOutput", "objectType"], "## Variables", []));
return mdEndSection(buildCustomMarkdownTable(vars, ["name", "dataType", "isCollection", "isInput", "isOutput", "objectType", "description"], "## Variables", []));
}
return "";
}

function getConstantsMd(constants: any[]): string {
if (constants && constants.length > 0) {
return mdEndSection(buildCustomMarkdownTable(constants, ["name", "dataType", "value"], "## Constants", []));
return mdEndSection(buildCustomMarkdownTable(constants, ["name", "dataType", "value", "description"], "## Constants", []));
}
return "";
}

function getFormulasMd(formulas: any[]): string {
if (formulas && formulas.length > 0) {
return mdEndSection(buildCustomMarkdownTable(formulas, ["name", "dataType", "expression"], "## Formulas", []));
return mdEndSection(buildCustomMarkdownTable(formulas, ["name", "dataType", "expression", "description"], "## Formulas", []));
}
return "";
}

function getTemplatesMd(textTemplates: any[]): string {
if (textTemplates && textTemplates.length > 0) {
return mdEndSection(buildCustomMarkdownTable(textTemplates, ["name", "text"], "## Text Templates", []));
return mdEndSection(buildCustomMarkdownTable(textTemplates, ["name", "text", "description"], "## Text Templates", []));
}
return "";
}
Expand Down

0 comments on commit a5c0961

Please sign in to comment.