Skip to content

Commit

Permalink
Static Value Helps: frontend part abap-api-tools
Browse files Browse the repository at this point in the history
  • Loading branch information
bsrdjan committed Mar 23, 2021
1 parent f62f4af commit 481cd8f
Show file tree
Hide file tree
Showing 8 changed files with 252 additions and 112 deletions.
7 changes: 5 additions & 2 deletions abap-api-tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,11 @@ ABAP API for Value Help annotations, if exposed in backend system (see [ABAP hel
```yaml
MME:
search_help_api:
determine: YWS_SHLP_DETERMINE
dom_values: YWS_SHLP_DOMVALUES_GET
determine: /COE/RBP_FE_SHLP_DETERM_SEARCH
FV_descriptor_get: /COE/RBP_FE_SHLP_DOMVALUES_GET
CT_descriptor_get: FDT_GET_DDIC_METADATA
SH_descriptor_get: /COE/RBP_FE_SHLP_METADATA_GET
search: /COE/RBP_FE_SHLP_GET
```
Run `abap` command, to show help:
Expand Down
51 changes: 18 additions & 33 deletions abap-api-tools/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions abap-api-tools/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "abap-api-tools",
"description": "ABAP api tools",
"version": "2.0.0",
"version": "2.1.0",
"homepage": "https://github.com/sap/fundamental-tools",
"author": "SAP",
"license": "Apache-2.0",
Expand Down Expand Up @@ -45,7 +45,7 @@
"nodejs"
],
"dependencies": {
"abap-value-help": "file:../abap-value-help",
"abap-value-help": "^1.0.0",
"chalk": "^4.1.0",
"js-yaml": "^4.0.0",
"loglevel": "^1.7.1",
Expand Down
70 changes: 32 additions & 38 deletions abap-api-tools/src/ts/backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,13 @@ import {

import { Alpha, AlphaCatalogType } from "./alpha";

import {
deleteFile,
isEmpty,
log,
fileLoad,
fileSave,
fileExists,
} from "./utils";
import { isEmpty, log, fileLoad, fileSave, fileExists, rmDir } from "./utils";

import {
ShlpApiType,
ValueInputHelp,
DescriptorType,
FVDescriptorType,
ValueHelpType,
} from "abap-value-help";

Expand Down Expand Up @@ -355,18 +349,17 @@ export class Backend {
result.format.valueInputType = ValueInput.list;

// Binary / List type
const descriptor = this.Descriptors[helpFound.id];
const descriptor = this.Descriptors[helpFound.id] as FVDescriptorType;
if (descriptor) {
if (descriptor["valueInputType"]) {
result.format.valueInputType = descriptor["valueInputType"];
}
if (descriptor.valueInputType === ValueInput.binary) {
result.format.valueInputType = ValueInput.binary;

// Checkbox uses SHLP only when values differ from "X" and "";
if (
result.format.valueInputType === ValueInput.binary &&
!descriptor["customCheckbox"]
) {
delete result.input.shlpId;
// Checkbox SHLP used only when values differ from "X" and ""
if (descriptor.customCheckbox) {
//result.input.customCheckbox = "X";
} else {
delete result.input.shlpId;
}
}
}
}
Expand All @@ -384,6 +377,24 @@ export class Backend {
// write search help id into selection field descriptor
if (selectionHelpFound.id) {
field.shlpId = selectionHelpFound.id;
field.valueInputType = ValueInput.list;

// Binary / List type
const descriptor = this.Descriptors[
selectionHelpFound.id
] as FVDescriptorType;
if (descriptor) {
if (descriptor.valueInputType === ValueInput.binary) {
field.valueInputType = ValueInput.binary;

// Checkbox SHLP used only when values differ from "X" and ""
if (descriptor.customCheckbox) {
field.customCheckbox = "X";
// } else {
// delete field.shlpId;
}
}
}
}
}
}
Expand Down Expand Up @@ -865,26 +876,9 @@ export class Backend {
}

annotations_clean(): void {
const folder_yaml = path.join(
this.argv.output as string,
this.api_name,
"yaml"
);

log.debug(`AnnotationsType clean ${folder_yaml}`);

for (const fileName of [
"parameters",
"fields",
"helps",
"stat",
"alpha",
"usage",
"texts",
"descriptors",
]) {
deleteFile(path.join(folder_yaml, `${fileName}.yaml`));
}
const rootdir = path.join(this.argv.output as string, this.api_name);
log.debug("Clean annotations", rootdir);
rmDir(rootdir);
}
}

Expand Down
Loading

0 comments on commit 481cd8f

Please sign in to comment.