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

[lfx] Develop Override policy, Resource Binding, Work Page #29

Open
wants to merge 3 commits into
base: ng-dashboard-react
Choose a base branch
from

Conversation

ada2468
Copy link

@ada2468 ada2468 commented Aug 30, 2022

What type of PR is this?
/kind feature

What this PR does / why we need it:

  1. Construct the main page layout with a topbar and sidebar.
  2. Creating page routing.
  3. Create Override Policy, Resource Binding and Works pages. Sub-pages includes: Override Policy, Cluster Override Policy, Resource Binding, Cluster Resource Binding, and Works.
  4. Create a data grid component for displaying summary of response from backend endpoint API. Create a Tree view to view details of the responses.
  5. Create Frontend API that dynamically fetch data through backend endpoints of Karmada-api-server.

How to run this PR locally?

  1. Pull the PR locally. Make sure you have latest Node.js.
  2. Follow the instructions in README.me.

Special notes for your reviewer:
TEST mode: a dev feature for easier debugging program locally.

This mode allows user to generate some mock data based on the go-server API spec file, karmada/master/api/openapi-spec/swagger.json. The test mode bypass the authentication token check and allow you to go to preview the pages populated with mock data.

To enable testing mode, go to root folder, find .env file, and change "REACT_APP_STAGE=DEV" to "REACT_APP_STAGE=TEST". Use uppercase! To exist TEST mode, just change that field back to "DEV".

The testing script generates five sets of response data, each for the following API path:
/apis/policy.karmada.io/v1alpha1/overridepolicies
/apis/policy.karmada.io/v1alpha1/clusteroverridepolicies
/apis/work.karmada.io/v1alpha2/resourcebindings
/apis/work.karmada.io/v1alpha2/clusterresourcebindings
/apis/work.karmada.io/v1alpha1/works

, in accordance with pages:
Override Policy
Cluster Override Policy
Resource Binding
Cluster Resource Binding
Works.


demo:
https://raw.githubusercontent.com/AdaTempImg/temp1/main/LFX%20demo.gif

Signed-off-by: Jun Xiang jx2161@nyu.edu

Signed-off-by: Jun Xiang <jx2161@nyu.edu>
@karmada-bot karmada-bot added the kind/feature Categorizes issue or PR as related to a new feature. label Aug 30, 2022
@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign rainbowmango after the PR has been reviewed.
You can assign the PR to them by writing /assign @rainbowmango in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@karmada-bot karmada-bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Aug 30, 2022
@ada2468
Copy link
Author

ada2468 commented Aug 30, 2022

@RainbowMango @chinmaym07
Please take a look.

@RainbowMango
Copy link
Member

demo:
https://github.com/AdaTempImg/temp1/blob/main/demo.gif
Example mock data of path, /apis/policy.karmada.io/v1alpha1/overridepolicies:
https://github.com/AdaTempImg/temp1/blob/main/Mock%20Data.json

Does this demo base on static data?

@ada2468
Copy link
Author

ada2468 commented Aug 30, 2022

@RainbowMango
No, each time you go to the page, new data is generated randomly. Do you want static data? Or do you have a specific set of data for testing?

@RainbowMango
Copy link
Member

No, each time you go to the page, new data is generated randomly. Do you want static data?

I mean, we should get the data from karmada-apiserver dynamically. Just like what I asked on #27 (comment).

Signed-off-by: Jun Xiang <jx2161@nyu.edu>
Signed-off-by: Jun Xiang <jx2161@nyu.edu>
@ada2468
Copy link
Author

ada2468 commented Sep 1, 2022

@RainbowMango
I fixed that login issue and successfully verified the part to dynamically fetch data from the backend endpoints, aka from the Karmada-apiserver.
Please see the new demo.

demo:
https://raw.githubusercontent.com/AdaTempImg/temp1/main/LFX%20demo.gif

Here is the example .yaml file I use to define the Override Policy in my Karmada during demo:

apiVersion: policy.karmada.io/v1alpha1
kind: OverridePolicy
metadata:
  name: example-override
  namespace: default
spec:
  resourceSelectors:
  - apiVersion: helm.toolkit.fluxcd.io/v2beta1
    kind: HelmRelease
    name: podinfo
  overrideRules:
  - targetCluster:
      clusterNames:
        - member1
    overriders:
      plaintext:
        - path: "/spec/values"
          operator: add
          value:
            replicaCount: 2 

and the resource template .yaml:

apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: HelmRepository
metadata:
  name: podinfo
spec:
  interval: 1m
  url: https://stefanprodan.github.io/podinfo  
---
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
  name: podinfo
spec:
  interval: 5m
  chart:
    spec:
      chart: podinfo
      version: 5.0.3
      sourceRef:
        kind: HelmRepository
        name: podinfo

@ada2468
Copy link
Author

ada2468 commented Sep 1, 2022

@RainbowMango @chinmaym07
Please take a look.

Copy link

@chinmaym07 chinmaym07 left a comment

Choose a reason for hiding this comment

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

Great work done so far @ada2468 .. 🔥 💯
Demo looks good to me.
Tree view is great. But it's currently breaking the design. Also some components are not as per the designs.
We will have to look for other ways to show the data.

Once we have the CRUD functionality in place, can we include Json editor view as well as yaml file editor like we have in kubernetes dashboard.?

What other features can we add to our karmada dashboard to enhance it from UI as well as UX perspective ?

@ada2468
Copy link
Author

ada2468 commented Sep 13, 2022

@chinmaym07
Yes, having tree view at the bottom of data grid is not a good from UI/UX perspective. I suggest to make it as popover layer when you click on an action button in any of the row. The tree view is great for CRUD. We got read already. Write and delete can be done with the text window next to the tree view with slight modification. For creating a new override policy, let's just import a JSON/YAML and forward it in a POST request.

Other features can include search bar and filtering bar. They are already built-in in MUI Datagrid, I just need to correctly configure them. Also I can write some shell script to automate the deployment process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants