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

KOGITO-5541 Quarkus DEV UI: Form Service #1

Open
wants to merge 1 commit into
base: quarkus-dev-ui-extension-forms
Choose a base branch
from

Conversation

bxf12315
Copy link

Many thanks for submitting your Pull Request ❤️!

Please make sure that your PR meets the following requirements:

  • You have read the contributors guide
  • Pull Request title is properly formatted: KOGITO-XYZ Subject
  • Pull Request title contains the target branch if not targeting master: [0.9.x] KOGITO-XYZ Subject
  • Pull Request contains link to the JIRA issue
  • Pull Request contains link to any dependent or related Pull Request
  • Pull Request contains description of the issue
  • Pull Request does not include fixes for issues other than the main ticket
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

@bxf12315 bxf12315 force-pushed the quarkus-dev-ui-extension-forms branch from 48cb3f5 to ae8ee21 Compare July 29, 2021 10:57
@PostConstruct
public void init() {
formsFolder = Thread.currentThread().getContextClassLoader().getResource(FORMS_STORAGE_PATH);
public void init() throws MalformedURLException, URISyntaxException {
Copy link
Owner

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

private Collection<File> readFormBaseList() {
if (formsFolder != null) {
File rootFolder = FileUtils.toFile(formsFolder);
return FileUtils.listFiles(rootFolder, new String[] { "html", "tsx", "config" }, false);
Copy link
Owner

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

Copy link
Author

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.

File formConfig = getFormConfigFile(formName);
FormConfiguration formConfiguration = null;
if (formConfig != null && formConfig.exists()) {
formConfiguration = new FormConfiguration(IOUtils.toString(new FileInputStream(formConfig), Charset.forName("UTF-8")));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use StandardCharsets.UTF_8

@bxf12315 bxf12315 force-pushed the quarkus-dev-ui-extension-forms branch 7 times, most recently from a33c5ea to 3b3c99c Compare July 30, 2021 13:11
@@ -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) {
Copy link
Owner

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();
Copy link
Owner

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) {
Copy link
Owner

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");
Copy link
Owner

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) {
Copy link
Owner

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();
Copy link
Owner

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) {
Copy link
Owner

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);
Copy link
Owner

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

@paulovmr paulovmr self-requested a review July 30, 2021 15:10
@bxf12315 bxf12315 force-pushed the quarkus-dev-ui-extension-forms branch from 3b3c99c to 11938f0 Compare August 2, 2021 13:08
pefernan pushed a commit that referenced this pull request Oct 4, 2021
* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants