-
Notifications
You must be signed in to change notification settings - Fork 1
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
KOGITO-5541 Quarkus DEV UI: Form Service #1
base: quarkus-dev-ui-extension-forms
Are you sure you want to change the base?
KOGITO-5541 Quarkus DEV UI: Form Service #1
Conversation
48cb3f5
to
ae8ee21
Compare
...src/main/java/org/kie/kogito/runtime/tools/quarkus/extension/runtime/forms/FormsService.java
Outdated
Show resolved
Hide resolved
...src/main/java/org/kie/kogito/runtime/tools/quarkus/extension/runtime/forms/FormsStorage.java
Outdated
Show resolved
Hide resolved
@PostConstruct | ||
public void init() { | ||
formsFolder = Thread.currentThread().getContextClassLoader().getResource(FORMS_STORAGE_PATH); | ||
public void init() throws MalformedURLException, URISyntaxException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't throw, I'd catch exception and warn in case something wrong happens.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
...java/org/kie/kogito/runtime/tools/quarkus/extension/runtime/forms/impl/FormsStorageImpl.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/kie/kogito/runtime/tools/quarkus/extension/runtime/forms/model/FormInfo.java
Outdated
Show resolved
Hide resolved
private Collection<File> readFormBaseList() { | ||
if (formsFolder != null) { | ||
File rootFolder = FileUtils.toFile(formsFolder); | ||
return FileUtils.listFiles(rootFolder, new String[] { "html", "tsx", "config" }, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just list html/tsx, not config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to load the config file into formInfoCollection.
...java/org/kie/kogito/runtime/tools/quarkus/extension/runtime/forms/impl/FormsStorageImpl.java
Outdated
Show resolved
Hide resolved
...java/org/kie/kogito/runtime/tools/quarkus/extension/runtime/forms/impl/FormsStorageImpl.java
Outdated
Show resolved
Hide resolved
...e/src/main/java/org/kie/kogito/runtime/tools/quarkus/extension/runtime/forms/model/Form.java
Show resolved
Hide resolved
File formConfig = getFormConfigFile(formName); | ||
FormConfiguration formConfiguration = null; | ||
if (formConfig != null && formConfig.exists()) { | ||
formConfiguration = new FormConfiguration(IOUtils.toString(new FileInputStream(formConfig), Charset.forName("UTF-8"))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use StandardCharsets.UTF_8
a33c5ea
to
3b3c99c
Compare
@@ -37,7 +50,46 @@ public FormsService(FormsStorage storage) { | |||
@GET | |||
@Path("/list") | |||
@Produces(MediaType.APPLICATION_JSON) | |||
public Collection<FormInfo> getFormsList() { | |||
return storage.getFormList(); | |||
public Response getFormsList(@QueryParam("names") FormFilter filter) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need QueryPAram("names")?
public static String SOURCE_KEY = "source-content"; | ||
|
||
private String name; | ||
private JsonObject source = new JsonObject(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Source must be String, it should be the raw content of the form file file (html/tsx),
this.put(RECOURCES_KEY, resources); | ||
} | ||
|
||
public void setSchema(String schema) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove the setters if possible.
try { | ||
URL originURL = Thread.currentThread().getContextClassLoader().getResource(FORMS_STORAGE_PATH); | ||
URI originUri = originURL.toURI(); | ||
String newPath = originUri.getPath().replace("target/classes", "src/main/resources"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd use the originURL, not this replace. We won't do the update operation for now
public Collection<FormInfo> getFormInfoList(FormFilter filter) { | ||
final Collection<FormInfo> formInfoCollection = new ArrayList(); | ||
Collection<String> matchedNames = null; | ||
if (filter != null && filter.getNames().size() > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here you could do return formInfoMap.entrySet().filter().map().collect(); instead of having this intermediate matchedNames collection.
if (filter != null && filter.getNames().size() > 0) { | ||
matchedNames = formInfoMap.keySet().stream().filter(name -> filter.getNames().contains(name)).collect(Collectors.toList()); | ||
} else { | ||
matchedNames = formInfoMap.keySet(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you could return the formInfoMap.values()
|
||
return forms.size(); | ||
private File getFormFile(String formName) { | ||
if (formInfoMap != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't store the File in FileInfo, load the file in the same way as in getconfigFile
.map(file -> new FormInfo(FilenameUtils.removeExtension(file.getName()), FilenameUtils.getExtension(file.getName()), new Date(file.lastModified()))) | ||
.collect(Collectors.toList()); | ||
public void updateFormContent(String formContent, String formName) throws IOException { | ||
File formFile = getFormFile(formName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need update for now
3b3c99c
to
11938f0
Compare
* FAI-451: setup CF route, added initial components * FAI-451: added drawer for constraints side panel * FAI-451: switched to PF composable table * FAI-451: working on search domain editing * FAI-451: added results slider * FAI-451: improved table responsiveness * FAI-451: handling outcome selection state * FAI-451: handling input domain selection state * FAI-451: handling CF status inside state * FAI-451: handling CF execution phases * FAI-451: handling new CF creation and reset * FAI-451: analysis execution info improved * FAI-451: handling numeric constraints separate component and validation * FAI-451: handling categorical constraints * FAI-451: handling string outcomes and boolean inputs * FAI-451: showing cf execution date * FAI-451: added success message * FAI-451: making inputs constraints mandatory (except for booleans) * FAI-451: added coherent random values to CF results switched to light background displying CF results changed values with background highlight * FAI-451: styles tweaks * FAI-451: added horizontal scrolling to cf results columns * FAI-451: fixed table rows borders, added tooltips, fixed copy * FAI-451: fixed counterfactual section flex direction + minor tweaks * FAI-451: removed checkboxes to enable outcomes modification * FAI-451: added loading status, refactored reducer * FAI-451: fixed horz scroll issue, added CF results IDs row * FAI-452: mocked apis * FAI-452: plugged UI to mocked apis * FAI-452: changed input requirements logic * FAI-452: making counterfactual section hidden by default * FAI-452: improved table rezing logic * FAI-452: improved mocked apis response * FAI-452: adding tests * FAI-452: improving sizes custom hook and cf reducer * FAI-452: updates following api changes * FAI-452: work in progress * FAI-452: handling errors in counterfactual analysis executions * Fix parenthesis for CounterfactualToolbar when CF have completed. (#1) Co-authored-by: Michael Anstis <[email protected]> * FAI-517: Counterfactual: Add support for "partial" goals in Trusty UI * More to <React.Fragment>.. to support keys * Refactor following first review. * Fix CF request. * FAI-532: Update CF UI to use 'fixed' property * FAI-539: Counterfactual: Refactor support for "partial" goals in Trusty UI (#4) * FAI-539: Counterfactual: Refactor support for "partial" goals in Trusty UI * Further updates for partial goals * Revised wording based in Missy's latest design. * Final(?) wording from Missy's design. * Updates following peer review. Co-authored-by: Michael Anstis <[email protected]> * FAI-549: fix CF results table layout issues * FAI-552: rounding properties values of CF solutions * FAI-553: sorting CF results from latest to oldest * FAI-550: managing "no solutions found" scenario * FAI-452: adjusting progress bar time limit to 69 seconds * FAI-563: added a blink animation to new CF results when they are added * FAI-452: updated env variable configuration * FAI-452: lowering progress bar countdown to 20 secs * FAI-452: enabling CF section by default * FAI-452: keeping only succeeded outcomes in the CF initial state * FAI-452: disabling CF by default and restoring progress bar to 60s * FAI-452: updating yarn.lock * FAI-452: fixes and cleanup * FAI-452: improving test coverage * FAI-452: improving test coverage Co-authored-by: Michael Anstis <[email protected]> Co-authored-by: Michael Anstis <[email protected]>
Many thanks for submitting your Pull Request ❤️!
Please make sure that your PR meets the following requirements:
KOGITO-XYZ Subject
[0.9.x] KOGITO-XYZ Subject
How to retest this PR or trigger a specific build:
Pull Request
Please add comment: Jenkins retest this
Quarkus LTS checks
Please add comment: Jenkins run LTS
Native checks
Please add comment: Jenkins run native