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

create router in BE based on openapi spec #45

Merged
merged 1 commit into from
Dec 14, 2023

Conversation

ydayagi
Copy link
Collaborator

@ydayagi ydayagi commented Dec 11, 2023

@@ -21,18 +21,23 @@
"clean": "backstage-cli package clean",
"prepack": "backstage-cli package prepack",
"postpack": "backstage-cli package postpack",
"tsc": "tsc"
"tsc": "tsc",
"openapi": "npx openapicmd typegen src/openapi.yaml > src/openapi.d.ts"
Copy link
Owner

Choose a reason for hiding this comment

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

No need for the npx since this is called by the yarn

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Without it it does not work

Copy link
Owner

Choose a reason for hiding this comment

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

This is not a proper way of calling it, most probably there is a left over from your previous trying or a global dependency. If we need the openapicmd, we should change the script to

"openapi": "openapi typegen src/openapi.yaml > src/openapi.d.ts"

and run

cd plugins/notifications-backend
yarn add openapicmd -D

This will add the opencmd to the node_modules.
And the plugins/notifications-backend/node_modules/.bin/openapi will become a symlink to the openapicmd package.
Don't ask me why they use openapi to call openapicmd.
But for sure, we need to add the openapicmd among our dependencies if we want to use it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

@@ -0,0 +1,217 @@
import type {
Copy link
Owner

Choose a reason for hiding this comment

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

Just to double-check: is this file generated without any further manual change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Of course

Copy link

@gciavarrini gciavarrini left a comment

Choose a reason for hiding this comment

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

overall lgtm, a couple of minor comments

return router;
}

function stringToNumber(s: number | undefined): number | undefined {
return s ? Number.parseInt(s.toString(), 10) : undefined;

Choose a reason for hiding this comment

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

nit: you can use Number(s.toString())

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Linter does not allow it

return undefined;
}

return s.toString() === 'true' ? true : false;

Choose a reason for hiding this comment

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

maybe it's worth to add .toLowerCase()

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No need. It comes from the openapi library after validation. It is just a workaround to convert a LEGAL boolean string to number

@ydayagi ydayagi force-pushed the flpath755 branch 2 times, most recently from f954d00 to 69548ec Compare December 13, 2023 14:38
@mareklibra mareklibra merged commit 2515681 into mareklibra:flpath560 Dec 14, 2023
2 checks passed
mareklibra pushed a commit that referenced this pull request Jan 17, 2024
…es` (#45)

* Fetch data input schema from /management/processes

* Fix some code smells

* Rename WorkflowProcess -> WorkflowInfo
mareklibra pushed a commit that referenced this pull request Jan 17, 2024
…es` (#45)

* Fetch data input schema from /management/processes

* Fix some code smells

* Rename WorkflowProcess -> WorkflowInfo
mareklibra added a commit that referenced this pull request Jan 18, 2024
* feat(orchestrator): add orchestrator plugins

Squashed and rebased. Credits to
- Guilherme Caponetto
- Tiago Dolphine
- Michael Anstis

who did the work before squash and rebase.

* feat(orchestrator): enable dynamic plugin

* fix(orchestrator): load HostDirectory from backend-app-api (#28)

Signed-off-by: Moti Asayag <[email protected]>
(cherry picked from commit 3ba02c6)

* fix(orchestrator): make the port config optional (#38)

* feat(orchestrator): handle assessment workflow and make optional the workflowsSource config (#35)

* feat: issue FLPATH-591 - Add assessment workflow type and display outputs (#21)

* Configure for assessment swf

* filter assessment on workflow definition page

* workflow columns

* workflow columns

* workflow columns

* workflow filter

* feat: Render assessment results supporting dynamic categories

* issue FLPATH-657: workflow label

* Revert "Configure for assessment swf"

This reverts commit b4048e1.

* Revert sonata service port

* Add key for workflow options category

* Fix workflow execution from choose btn

* Fix review comments

* address comments

* Fix review comment to switch to useRouteRef

* fix review comments

* fix review comments

---------

Co-authored-by: richardwang98 <[email protected]>

* feat: make optional the workflowsSource config (#25)

---------

Co-authored-by: anludke <[email protected]>

* feat(orchestrator): add backend endpoint for getting workflows from data index service (#39)

* feat: add backend for getting work flows from data index service

* feat: cherrypick - add backend for getting work flows from data index service

* feat: cherrypick - add backend for getting work flows from data index service

* feat: cherrypick - add backend for getting work flows from data index service

* chore(orchestrator): update dependencies

* feat(orchestrator): orchestrator plugin entry page & workflows table (#31)

https://issues.redhat.com/browse/FLPATH-686
https://issues.redhat.com/browse/FLPATH-682

* feat: introduced the workflows/overview endpoint (#36)

* FLPATH-702 : New endpoint to fetch workflow overview

* FLPATH-702 : iterate through all elements instead of picking the first element

* modified the map method

* calculate avg execution time change

* Add log message when http calls failing

* Fix lint issues

* rename variable

* paginated graphql object fetch

* Include workflowId in the result object

* Renamed to description

* to epoc timestamp

* suppress eslint warning

* epoc number to string

* make all string fields optional

* use a simple for loop

* extracted to a new method

* rename to lastTriggeredMs

* include uri in the WorkflowOverview type

* mark avgDurationMs as optional

* feat(orchestrator): introduced `workflows/:workflowId/overview` endpoint (#40)

* FLPATH-702 : New endpoint to fetch workflow overview

* FLPATH-702 : iterate through all elements instead of picking the first element

* modified the map method

* calculate avg execution time change

* Add log message when http calls failing

* Fix lint issues

* rename variable

* paginated graphql object fetch

* Include workflowId in the result object

* Renamed to description

* to epoc timestamp

* suppress eslint warning

* epoc number to string

* make all string fields optional

* use a simple for loop

* extracted to a new method

* rename to lastTriggeredMs

* include uri in the WorkflowOverview type

* mark avgDurationMs as optional

* fetch only one overview obj

* fix(orchestrator): make the port config optional (#37)

* feat(orchestrator): orchestrator plugin entry page & workflows table (#31)

https://issues.redhat.com/browse/FLPATH-686
https://issues.redhat.com/browse/FLPATH-682

* removed unnecessary method

---------

Co-authored-by: Guilherme Caponetto <[email protected]>
Co-authored-by: Jonathan Kilzi <[email protected]>

* feat(orchestrator): add Workflow Run List  (#30)

* feat(orchestrator): add Workflow Run List

FLPATH-693

A component listing running workflows is added.

* chore: move loading logic out of the OrchestratorPage

* chore(orchestrator): implement the WorkflowViewerFormatter (#41)

* chore: implement the WorkflowViewerFormatter: utility for converting WorkflowOverview backend data to data UI can display

* removed redundant export and removed redundant 'Interface' suffix from DataFormatter interface name

* Update plugins/orchestrator/src/dataFormatters/DataFormatter.ts

Co-authored-by: Guilherme Caponetto <[email protected]>

---------

Co-authored-by: Guilherme Caponetto <[email protected]>

* feat(orchestrator): fetch data input schema from `/management/processes` (#45)

* Fetch data input schema from /management/processes

* Fix some code smells

* Rename WorkflowProcess -> WorkflowInfo

* feat(orchestrator): implement the workflow viewer new UX (#32)

* feat(orechestrator): implement the workflow viewer new UX

* code review fixes

* visual fixes including skeleton for loading state

* chore(orchestrator): Renames the components displaying the tabs content

* chore(orchestrator): updates the OrchestratorClient

Lazy loads the baseUrl
Adds a method for calling GET /workflows/overview

* feat(orchestrator): orchestrator workflow execution page (#46)

Co-authored-by: Jonathan Kilzi <[email protected]>

* chore(orchestrator): updates the stories grouping (#50)

* chore(orchestrator): aligns the workflows table with the design (#51)

* chore(orchestrator): add Category to the procesInstance result (#52)

* fix(orchestrator): add links to workflows in the workflow list (#53)

* feat: added color icon to workflow details page last run status field (janus-idp#55)

* feat(orchestrator): enable usage of local envelope for the workflow editor (janus-idp#56)

* feat(orchestrator): add business key to assessment and pass on to workflow options (#42)

* feat(orchestrator): add page listing details of a workflow run (#49)

* feat(orchestrator): add feature flag for developer mode and config to enable/disable the integration with catalog (janus-idp#58)

* feat(orchestrator): workflow editor modal (janus-idp#59)

* feat(orchestrator): fix missing workflow type in overview (janus-idp#60)

Signed-off-by: Gloria Ciavarrini <[email protected]>

* fix(orchestrator): fix some code smells (janus-idp#63)

* fix(orchestrator): addresses sonarcloud issues (janus-idp#65)

* fix(orchestrator): addressed a couple of issues (janus-idp#64)

* fix(orchestrator): minor fixes (janus-idp#67)

* feat(orchestrator): refactoring to use data-index to fetch workflow definitions (janus-idp#57)

Co-authored-by: Guilherme Caponetto <[email protected]>

* fix(orchestrator): fix sonar issue (janus-idp#69)

* feat(orchestrator): use assessment process id as bk for next workflows (janus-idp#70)

* feat(orchestrator): execute workflow page new UX (janus-idp#68)

* fix(orchestrator): theme for `monaco-editor` in `JsonTextAreaForm` component and mandatory `dataIndexService.url` (janus-idp#71)

* fix(orchestrator): remove dependency on devmode in the entity provider (janus-idp#72)

* fix(orchestrator): skip it if hardcoded specs do not exist (janus-idp#74)

* feat(orchestrator): execute workflow page polishing (janus-idp#75)

* feat(orchestrator): workflow instance result page (janus-idp#73)

* chore(orchestrator): add codeowners to orchestrator

* fix(FLPATH-852): show WF description on the execution result page (janus-idp#77)

* chore(orchestrator): add OWNERS file to each orchestrator package

* feat(orchestrator): migrates to the new UI (janus-idp#78)

---------

Signed-off-by: Gloria Ciavarrini <[email protected]>
Co-authored-by: Moti Asayag <[email protected]>
Co-authored-by: richard wang <[email protected]>
Co-authored-by: anludke <[email protected]>
Co-authored-by: rhkp <[email protected]>
Co-authored-by: Jonathan Kilzi <[email protected]>
Co-authored-by: Jude Niroshan <[email protected]>
Co-authored-by: Marek Libra <[email protected]>
Co-authored-by: Bat-Zion Rotman <[email protected]>
Co-authored-by: yu zhao <[email protected]>
Co-authored-by: Gloria Ciavarrini <[email protected]>
Co-authored-by: Tiago Dolphine <[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.

3 participants