Skip to content
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.

PayloadEditor integration for write operations #191

Merged
merged 27 commits into from
Apr 24, 2023
Merged

PayloadEditor integration for write operations #191

merged 27 commits into from
Apr 24, 2023

Conversation

HknLof
Copy link
Contributor

@HknLof HknLof commented Mar 16, 2023

Edit-2: April 20th

The current implementation and state manage follows the approach, that state changes made to the HTML form are synchronized to the payload editor. When changing back form the editor and changes were made, we prompt users to either discard made changes or stay within the editor. If no changes were done, there is no prompt. Generally speaking opening the Edit as JSON button can be found at the bottom of the form.

Screenshot 2023-04-20 at 15 13 46

Exceptions to this rule are the Edit Pipeline window, Edit Config, and New Config containers.

For Edit Pipeline it would have convoluted our pipeline designer. This container already has lots of contents, hence it Edit as JSON is choice before you encounter the Pipeline Designer.

Screenshot 2023-04-20 at 15 13 55

Edit Config and New Config have a slightly special treatment because of the visible tabs. Here, the button Edit as JSON is always visible throughout both tabs.

Screenshot 2023-04-20 at 15 14 05

Will update description with screenshots, once editor draft is implemented.

EDIT-1: Create a second panel for PUT and POST methods ... @flippingbits, will need your guidance to create the same look and feel as ApiCall button. Will implement logic before going into destroying the layout just to fix it again 😄
Screenshot 2023-03-20 at 15 58 09

@HknLof HknLof linked an issue Mar 16, 2023 that may be closed by this pull request
@HknLof HknLof marked this pull request as ready for review April 12, 2023 12:51
@HknLof
Copy link
Contributor Author

HknLof commented Apr 12, 2023

@ChrisRousey @flippingbits Grew larger than expected. I did not extract functions for re-use, as this is not being done throughout our UI codebase, [for state management and this references, I guess].

@flippingbits flippingbits self-requested a review April 12, 2023 15:03
Copy link
Contributor

@flippingbits flippingbits left a comment

Choose a reason for hiding this comment

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

Thanks for your work on this great feature! 🥇

Please see below my feedback:

  • I propose removing the file ui/src/components/payload_editor/PayloadDefaults.js that seems to be obsolete from my point of view.
  • I only left comments in the container component NewConfig. The feedback also applies to the other container components, NewDeployment, NewPipeline, and NewStream.

ui/src/components/payload_editor/PayloadEditor.js Outdated Show resolved Hide resolved
ui/src/components/payload_editor/PayloadEditor.js Outdated Show resolved Hide resolved
ui/src/containers/configs/NewConfig.js Outdated Show resolved Hide resolved
ui/src/containers/configs/NewConfig.js Show resolved Hide resolved
ui/src/containers/configs/NewConfig.js Outdated Show resolved Hide resolved
ui/src/containers/configs/NewConfig.js Outdated Show resolved Hide resolved
ui/src/containers/configs/NewConfig.js Show resolved Hide resolved
@HknLof
Copy link
Contributor Author

HknLof commented Apr 13, 2023

Thanks for the feedback, I will put this PR to draft and integrate the PayloadEditor into the /**/editcontainers.

@HknLof HknLof marked this pull request as draft April 17, 2023 07:51
@HknLof HknLof changed the title feat: layout for edit payload before sending PayloadEditor integration for write operations Apr 20, 2023
@HknLof HknLof marked this pull request as ready for review April 20, 2023 13:06
@HknLof
Copy link
Contributor Author

HknLof commented Apr 20, 2023

Integrated the <PayloadEditor> into various containers, which perform write operations to our API. Along the way I encountered some issues and housekeeping tasks for our ui implementation, that I would summarize in some tickets.

@flippingbits flippingbits self-requested a review April 20, 2023 14:00
Copy link
Contributor

@flippingbits flippingbits left a comment

Choose a reason for hiding this comment

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

Thanks for your work. 🚀 I left some feedback.

I couldn't test a couple of components, e.g., EditConfig, EditDeployment, and EditStream, and will have another look after the issues have been fixed.

ui/src/components/payload_editor/PayloadEditor.js Outdated Show resolved Hide resolved
ui/src/containers/configs/EditConfig.js Show resolved Hide resolved
ui/src/containers/pipelines/ShowPipeline.js Outdated Show resolved Hide resolved
ui/src/containers/streams/EditStream.js Outdated Show resolved Hide resolved
ui/src/containers/configs/EditConfig.js Outdated Show resolved Hide resolved
ui/src/containers/configs/EditConfig.js Outdated Show resolved Hide resolved
ui/src/containers/streams/EditStream.js Outdated Show resolved Hide resolved
ui/src/containers/deployments/EditDeployment.js Outdated Show resolved Hide resolved
Copy link
Contributor

@flippingbits flippingbits left a comment

Choose a reason for hiding this comment

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

Thanks for the new revision 👍 While testing it, I found a few new issues. I feel that you are close to having this PR ready :)

ui/src/containers/pipelines/ShowPipeline.js Outdated Show resolved Hide resolved
ui/src/containers/configs/NewConfig.js Show resolved Hide resolved
@flippingbits flippingbits self-requested a review April 24, 2023 13:52
Copy link
Contributor

@flippingbits flippingbits left a comment

Choose a reason for hiding this comment

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

Thanks a lot for your work and persistence! Looks good to me for merging :)

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@HknLof HknLof merged commit 5daef3a into main Apr 24, 2023
@HknLof HknLof deleted the feat/#35 branch April 24, 2023 14:09
olis1996 pushed a commit that referenced this pull request Apr 27, 2023
* feat: layout for edit payload before sending

* feat: hooked up the layout (ugly) starting to implement logic

* feat: starting glueing everything together including creation of objects

* feat: move payloadeditor in new / edit sections

* chore(ui): Move button for switching to JSON editor

* chore(ui): Style payload editor

* chore: rebase from remote

* feat: register callbacks for handling submits

* feat: use class field instead of useref, version mismatch

* feat: functionality for NewStream complete

* chore: fix comment

* chore: cleansed new stream functionality

* chore: use underscore instead of hyphen

* feat: integrate payload editor in new stream

* chore: get bindings right for functions

* feat: integrate editor in deployment creation

* feat: add newconfig for payload editor

* feat: add config sync for multi-tab form

* fix: some correactions for loading the payload editor

* feat: payload editor integrated into edit stream

* feat: integrate payloadeditor into editdeployment

* feat: payload editor integrated to edit of pipelines

* feat: integrate payload editor into editconifg + prettier

* fix: some early caught obvious bugs

* fix: bugs from pr review

* fix: display error message from api

---------

Co-authored-by: Stefan Sprenger <stefan@datacater.io>
olis1996 added a commit that referenced this pull request May 23, 2023
* feat(api/deployment): implemented an endpoint to get the deployment's status

* [work in progress]

* [wip improvements]

* added logging and removed debugging statement

* fix(ui/streams): Align default topic config (#197)

Our control plane uses the following default values when creating Apache
Kafka topics:
- num.partitions = 3
- replication.factor = 1

This commit aligns the displayed default values in the frontend with the
ones that are actually used in the control plane.

* feat(UI): Add config functionality (#189)

* feat(ui): add configs to ui initial commit

refs: #181

* feat(ui): change imports error

refs: #181

* feat(ui): changed config icon

refs: #181

* feat(ui): fixed minor bugs when using configs

refs: #181

* feat(ui): added functionality to newConfig for kind and labels

refs: #181

* feat(ui): add logic for deployment configs

refs: #181

* feat(ui): added stream config options to configs

refs: #181

* feat(ui): added stream SerDe options to configs

refs: #181

* feat(ui): added stream Connection and topic config options to configs

resfs: #181

* feat(ui): update config spec on changes to streams

refs: #181

* feat(ui): set config spec before updating

refs: #181

* fat(ui): fix show config bug

refs: #181

* feat(ui): add ground work for update config

refs: #181

* feat(ui): added configSelectors to create deployment and stream

refs: #181

* feast(ui): remove whitespaces

refs: #181

* feat(ui): added configSelectors to editDeployment

refs: #181

* feat(ui): added configSelectors to editStream

refs: #181

* feat(ui): updated editConfig header

refs: #181

* feat(ui): fixed error 500 when editing streams and deployments

refs: #181

* feat(ui): fixed edit config errors

refs: #181

* feat(ui): minor fixes to new functionalities

refs: #181

* feat(ui): fixed spec nesting bug

refs: #181

* chore(ui): Apply npx prettier

* chore: Capitalize kind

* chore: Move labels above kind

* feat(ui/configs): Rework layouts of config forms

* feat(ui/configs): Introduce navbar to forms

* chore(ui/configs): Change wording of subtitle

* feat(ui/configs): Add config selector for deployments

* feat(ui/configs): Add config selector for streams

* fix: fixed bug where replication factor wasn't set

refs: #181

* fix: add config depth matching to avoid overwriting explicit stream configs

refs: #181

* feat(configs): document depth mapping

refs: #181

* feat(configs): add extra checks to depth config mapping

refs: #181

* feat(configs): fix typos

refs: #181

* feat(configs): fix typos

refs: #181

* fix: run pre-commit

* fix(ui): Align default values with backend

* chore(ui/configs): Correctly initialize kind selectbox

---------

Co-authored-by: Stefan Sprenger <stefan@datacater.io>

* fix(streams): Do not merge configs into streams when updating streams (#200)

* fix(streams): Avoid merging config into streams when updating streams

When updating a stream object using the endpoint `PUT /streams/:uuid`,
we should not merge referenced config objects into the stream object
before persisting it.

* chore: Clean up comment

* chore(streams): Move deep-copy functionality into Stream class

* chore(streams): Fix typo in function name

* chore(streams): Make pre-commit happy

* chore(streams): Deserialize stream spec before serializing it

* chore(streams): Use copied spec

* feature(ui): add deployment replicas to frontend (#198)

* feat(ui): added deployment replicas

* feat(ui): parse replica amount as integer

* feat(ui): rnu prettier

* feat(ui): minor changes to deployment replica fields

* fix(ui/deployments): Allow to set replicas field to 0

* fix(ui/deployments): Get pipelines before deployment

When editing a deployment, perform the API call for loading the
pipelines before performing the API call for loading the deployment, to
make sure that the dropdown box always shows the associated pipeline.

If the call to `/api/v1/pipelines` is performed last, the associated
pipeline is not shown in the dropdown box.

* fix(ui/configs): Allow to set replicas field to 0

---------

Co-authored-by: Stefan Sprenger <stefan@datacater.io>

* Fix: stream config mapping (#199)

* fix(stream-config-mapping): add config mapping to stream inspect

* fix(stream-config-mapping): add stream config mapping to createDeployment

* fix(stream-config-mapping): map stream config during streamDelete

* fix(stream-config-mapping): use hibernate session as parameter to guarantee same thread

* fix(stream-config-mapping): fix session usage

* fix(stream-config-mapping): add updateEntity to deployment

* fix(stream-config-mapping): update deploymentSpec by value not reference

* fix: remap generic exception

* fix: use deployment settings over config definition

* fix(ui/deployments): Remove replicas from payload if field is empty

* fix(ci): Login to Docker Hub

* feat: prep version bump (#202)

* feat: prep version bump

* feat: bump mem for pythonrunner to 150M

* feat: bump versions to 2023.2

* fix: bump appversion as well

* feat: postgres manifest for datacater

* feat: upgrade postgres default ns manifest

* chore(license): Update change date

* feat(ui/deployments): Allow selecting a deployment replica (#204)

* feat(ui/deployments): Allow selecting a deployment replica

We support running deployments with multiple replicas.

This commit adds support for selecting a specific replica when viewing a
deployment.

The UI shows the health/metrics/logs of the selected
replica.

By default, replica 1 is selected.

* chore(ui/deployments): Let user know if no replica is available

* Create SECURITY.md (#208)

Add a security policy to our codebase, which tells users:

* the releases that we support with security-related updates
* how to submit security issues.

* fix(platform-api): Update application version (#207)

* fix(platform-api): Update application version

Update the application version to `2023.2` at locations that still
reference to the prior release (`2023.1`).

* fix(platform-api): Update application version for redpanda manifest

---------

Co-authored-by: ChrisRousey <104754971+ChrisRousey@users.noreply.github.com>

* feature: create root info endpoint (#206)

* feat(info-endpoint): initial draft for info endpoint

refs: #205

* feat(info-endpoint): refactor and added extra fields

refs: #205

* feat(info-endpoint): reworked information shown

refs: #205

* feat(info-endpoint): re-added some information

refs: #205

* feat(info-endpoint): add test and parse urls

refs: #205

* feat(info-endpoint): update github workflows

refs: #205

* feat(info-endpoint): update naming and defaults

refs: #205

* feat(info-endpoint): added extra tests for info endpoint

* ci: fix missing new line character which caused build to break

* build: update Quarkus to most recent version (#209)

refs: #177

* Feat: support yaml payloads (#210)

* feat(yaml-payload): initial commit for yaml payload

* feat(yaml-payload): added yaml format to response

* feat(yaml-payload): annotate effected endpoints to accept yaml payload

refs: #177

* feat(yaml-payload): add tests to all endpoints that allow yml payloads

* chore: run pre-commit

* feat(yaml-payload): add kubernetes test service

* feat(yaml-payload): move k8 test service up 1 layer

* feat(yaml-payload): support returning info endpoint as yaml

* feat(yaml-payload): added info endpoint yaml test

* feat(yaml-payload): add tests for different payload/return type

* PayloadEditor integration for write operations (#191)

* feat: layout for edit payload before sending

* feat: hooked up the layout (ugly) starting to implement logic

* feat: starting glueing everything together including creation of objects

* feat: move payloadeditor in new / edit sections

* chore(ui): Move button for switching to JSON editor

* chore(ui): Style payload editor

* chore: rebase from remote

* feat: register callbacks for handling submits

* feat: use class field instead of useref, version mismatch

* feat: functionality for NewStream complete

* chore: fix comment

* chore: cleansed new stream functionality

* chore: use underscore instead of hyphen

* feat: integrate payload editor in new stream

* chore: get bindings right for functions

* feat: integrate editor in deployment creation

* feat: add newconfig for payload editor

* feat: add config sync for multi-tab form

* fix: some correactions for loading the payload editor

* feat: payload editor integrated into edit stream

* feat: integrate payloadeditor into editdeployment

* feat: payload editor integrated to edit of pipelines

* feat: integrate payload editor into editconifg + prettier

* fix: some early caught obvious bugs

* fix: bugs from pr review

* fix: display error message from api

---------

Co-authored-by: Stefan Sprenger <stefan@datacater.io>

* fix: class to classNames (#212)

* feat: utilize k8 devservices (#211)

* feat(k8-devservice): initial work for devservices

-add dev service config
-remove k8 mock servers

refs: #193

* feat(k8-devservice): removed unneeded dependency

* feat(k8-devservice): add a test for the actual underlying k8 resources

* Revert "Merge branch 'main' into feat/utilize-k8-devservices"

This reverts commit 2064850, reversing
changes made to 6283538.

* Revert "Revert "Merge branch 'main' into feat/utilize-k8-devservices""

This reverts commit 51a87c3.

* fix: fix incorrect merge from main

* fix: fix failing tests after merging from main

* feat(DeploymentEndpoint): added default values to DataCaterDeploymentStatus and removed unnecessary comments

* feat(DeploymentEndpoint): added tests for deployment status endpoint

* chore: random commit to restart github actions

github had a timeout due to downtime

* fix(DeploymentEndpoint): replaced returning null + catching null with unchecked exception on KubernetesClientException

* fix(DeploymentEndpoint): improved exception handling

* fix(DeploymentEndpoint): added comment explaining why we keep deploymentConditions as is

* chore(DeploymentEndpoint): removed duplicate annotation

---------

Co-authored-by: Stefan Sprenger <stefan@datacater.io>
Co-authored-by: Chris <104754971+ChrisRousey@users.noreply.github.com>
Co-authored-by: Hakan Lofcali <HknLof@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UI: Allow to edit the API payloads
2 participants