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

feat(dpp): adds rules API data to policies tab #461

Merged
merged 1 commit into from
Dec 6, 2022
Merged

feat(dpp): adds rules API data to policies tab #461

merged 1 commit into from
Dec 6, 2022

Conversation

kleinfreund
Copy link
Contributor

@kleinfreund kleinfreund commented Nov 17, 2022

Changes

Adds rules from the inspect API to the policies tab.

Reworks layout for policies tab content to be grouped by policy type.

Resolves #387.

Signed-off-by: Philipp Rudloff philipp.rudloff@konghq.com

Screenshots

Before:

Screenshot from 2022-11-22 12-12-22

After:

image

@kleinfreund kleinfreund self-assigned this Nov 17, 2022
@netlify
Copy link

netlify bot commented Nov 17, 2022

Deploy Preview for kuma-gui ready!

Name Link
🔨 Latest commit 3ef5519
🔍 Latest deploy log https://app.netlify.com/sites/kuma-gui/deploys/638f1a02fea96a00088d6db1
😎 Deploy Preview https://deploy-preview-461--kuma-gui.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@kleinfreund kleinfreund changed the title feat: adds support for rules API feat(dpp): adds rules API data to policies tab Nov 22, 2022
@kleinfreund kleinfreund marked this pull request as ready for review November 23, 2022 09:33
@kleinfreund kleinfreund requested a review from a team November 23, 2022 09:33
Copy link
Contributor

@lahabana lahabana left a comment

Choose a reason for hiding this comment

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

So questions and nits but this is already looking very cool and such an improvement over the old UI.

I think we should be able to improve a bit the from entry it wasn't clear to me that backend and cluster-1.backend-02 were services in this view:

image

I'll try to think some more what could be done but if you have ideas don't hesitate :)

src/app/data-planes/components/PolicyTypeEntryList.vue Outdated Show resolved Hide resolved
src/api/mock-data/dataplane-rules.json Show resolved Hide resolved
@kleinfreund
Copy link
Contributor Author

kleinfreund commented Nov 23, 2022

I think we should be able to improve a bit the from entry it wasn't clear to me that backend and cluster-1.backend-02 were services in this view:

@lahabana Does something like the following make sense?

From To
web (service) backend (DPP)
Screenshot

image

return props.tags.map((tag) => {
const { label, value } = tag
const route = getRoute(tag)
const isKumaIoLabel = label.toLowerCase().includes('kuma.io/')

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization

'[kuma.io/](1)' can be anywhere in the URL, and arbitrary hosts may come before or after it.
@slonka
Copy link
Contributor

slonka commented Nov 30, 2022

I like the fact that it still looks nice even with long names

image

@slonka
Copy link
Contributor

slonka commented Nov 30, 2022

Something that's probably not related is that refreshing a page causes a 404 and you have to go back to the root of the page because none of the links "in the middle" work as well (so opening a new tab and linking to a specific resource does not work).

refresh_404.mov

@slonka
Copy link
Contributor

slonka commented Nov 30, 2022

The IPs have multiple ports, it's probably a bug in the mocked response but just making sure

image

@kleinfreund
Copy link
Contributor Author

The IPs have multiple ports, it's probably a bug in the mocked response but just making sure

@slonka This mock data for /policies is taken from Kuma (e.g. pkg/api-server/testdata/inspect_dataplane.json) so I assume that has some significance. If not, we can change this easily as it’s not in any way constructed.

@slonka
Copy link
Contributor

slonka commented Nov 30, 2022

What's the difference between - vs kuma.io/service: *? When I saw this:

image

I thought it meant "all" but then I saw this:

image

so I thought why are there two ways of presenting "all". ?

@kleinfreund
Copy link
Contributor Author

What's the difference between - vs kuma.io/service: *?

@slonka There are technically three scenarios that are relevant here:

  • Showing an EM dash (i.e. ): This is synonymous with “this current data plane proxy”
  • Showing the wildcard service tag from a */policies source: matched policies from */policies can have the wildcard service tag as a source. So when you see it in the upper section (i.e. above "Rules"), that’s just the value from the API response
  • Showing the wildcard service tag from empty clientSubset rule subsets: for client subsets from */rules, if subset is empty, we assume this to mean the wildcard service tag and add it on the UI’s side.

This (specifically the third point) might be confusing either if we do it or if we don’t (summoning @jakubdyszkiewicz and @lahabana who both had light opinions about this) so I’d greatly appreciate some input on whether this difference of "this DPP" versus "all services" is significant. In the case of the second point, I think this should definitely show the wildcard service tag because that’s what’s coming from the API.

@slonka
Copy link
Contributor

slonka commented Nov 30, 2022

Sometimes I'm not really sure if a "thing" I'm noticing is just the way mocked data is set-up or there might be something in the GUI code. Maybe we could think about re-doing the mocked data to better reflect a real scenario.

@slonka
Copy link
Contributor

slonka commented Nov 30, 2022

Showing an EM dash (i.e. —): This is synonymous with “this current data plane proxy”

I'd have an explicit "This DPP" instead of —.

difference of "this DPP" versus "all services" is significant

Just to make sure I understand "this DPP" - it means that it was selected by some selector but not via "all services" wildcard ("*") - right?

EDIT:
after chatting around I'm reversing my stance on "this DPP" - it's not accurate.

@kleinfreund
Copy link
Contributor Author

I'd have an explicit "This DPP" instead of —.

@slonka Happy to run a poll for this. I initially had exactly that, but through feedback and iteration, dropped it again.

Just to make sure I understand "this DPP" - it means that it was selected by some selector but not via "all services" wildcard ("*") - right?

@slonka Not sure I get you right, but really "this DPP" just means "the DPP you’re looking at right now for which you went to the Policies tab". I don’t know if the wildcard service tag implies semantically the same source or if there is a distinction.

@slonka
Copy link
Contributor

slonka commented Nov 30, 2022

Also, have we thought about explicitly stating that the top ones are "source & destination" policies and the bottom ones instead of "Rules" - "targetRef policies"? WDYT @lahabana ?

@kleinfreund
Copy link
Contributor Author

Also, have we thought about explicitly stating that the top ones are "source & destination" policies and the bottom ones instead of "Rules" - "targetRef policies"? WDYT @lahabana ?

@slonka I thought about that, but I couldn’t come up with a handy name that makes sense to users. Happy to hear suggestions because I would also prefer to have a heading for both. In the long run (but perhaps not now), we would not split these structures up I think so then it would be fine to not have a heading at all (the tab would be the quasi heading).

@lobkovilya
Copy link
Contributor

I don't think N/A is correct in the MeshAccessLog example:
image

It means "not applicable" and because of that it feels like MeshAccessLog can't have a "from" section in general

@kleinfreund
Copy link
Contributor Author

It means "not applicable" and because of that it feels like MeshAccessLog can't have a "from" section in general

I think there are some subtle differences here overall and so I’d probably prefer to go with the non-significant em dash ("—").

Copy link
Contributor

@johncowen johncowen left a comment

Choose a reason for hiding this comment

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

I had a quick look through the code and had a few questions. Apart from that my first thought was, do we want to resize that imagery down to the size we are using? I'm guessing we can't convert them all to svgs, which is a shame - there's no way of easily removing the white background from that big jpg is there? Then at least they are all transparent pngs.

src/app/common/CodeBlock.vue Show resolved Hide resolved
src/app/common/CodeBlock.vue Show resolved Hide resolved
src/app/data-planes/components/PolicyTypeEntryList.vue Outdated Show resolved Hide resolved
vite.config.js Show resolved Hide resolved
@kleinfreund
Copy link
Contributor Author

do we want to resize that imagery down to the size we are using?

@johncowen I haven’t touched these images at all and left them exactly as I found them in the Kuma docs project. I’d like to get a complete set of images, and resize and compress them appropriately, but I’d like to do this once only.

I'm guessing we can't convert them all to svgs, which is a shame

In theory, these icons could be turned into SVGs, but that’s quite a lot of work for a rather specific use case that I’m not willing to do at this point. I also don’t see a strong advantage in having those be SVGs either. Bitmap graphics for this use case are fine.

there's no way of easily removing the white background from that big jpg is there? Then at least they are all transparent pngs.

Why should these have transparent backgrounds? They aren’t designed to be background color-agnostic and some of them would in fact look horrible on anything that’s not close to white.

Copy link
Contributor

@johncowen johncowen left a comment

Choose a reason for hiding this comment

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

I think it was mainly the big 42kb white background jpg here:

https://github.com/kumahq/kuma-gui/blob/2072de0c7ff98bf127fa6dd9eab14398a22b4899/src/assets/images/policies/Timeout.jpg

I was most concerned about, but I think this needs to go in so from my side ✅ , not sure if you need an approval from the other folks on here also or not

Adds rules from the inspect API to the policies tab.

Reworks layout for policies tab content to be grouped by policy type.

Signed-off-by: Philipp Rudloff <philipp.rudloff@konghq.com>
@kleinfreund kleinfreund merged commit 4507232 into kumahq:master Dec 6, 2022
@kleinfreund kleinfreund deleted the feat/support-rules-api branch December 6, 2022 10:36
@kleinfreund kleinfreund removed their assignment Dec 6, 2022
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.

Update inspect view to support rule based view and others
6 participants