Skip to content

Conversation

@yahia3200
Copy link
Contributor

Description

Change parser implementation to a more generic one that can parse most resources types

image

Additional Notes

The types supported by the tool are:

  • Compute Instance
  • Compute Disk
  • Compute Image
  • Machine Image
  • Compute Snapshot
  • Managed Zone
  • SQL Instance
  • Cloud Function
  • Dns Policies
  • Pubsub Sub

These types are defined in availableResourceTypes in src/types/resources.ts
Other types have special structures in the output file which we can handle later

Copy link
Contributor

@mshudrak mshudrak left a comment

Choose a reason for hiding this comment

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

Overall looks good. I left two minor comments. By the way, when I test it and click on Detail button it does not show details. I do it on a full log that was created a while ago. Is it expected?

'Managed Zone',
'SQL Instance',
'Cloud Function',
'Dns Policie',
Copy link
Contributor

Choose a reason for hiding this comment

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

Dns Policy or Policies

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

case 'Compute Disk':
return ComputeDisk;
case 'Managed Zone':
return MangedZone;
Copy link
Contributor

Choose a reason for hiding this comment

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

ManagedZone

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@yahia3200
Copy link
Contributor Author

Yes because I didn't add the Details sections to this branch yet

};
for (const [resourceType, resourceList] of Object.entries(projectData)) {
let type = titleCase(resourceType.slice(0, -1));
if (type === 'Dns Policie') type = 'Dns Policy';
Copy link
Contributor

Choose a reason for hiding this comment

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

oops, sorry. Forgot to flag this one. Dns Policies or Dns Policy

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To get the type of the resource, I use the name of it in the json file, then remove the last character to make it singular
This doesn't work in the naming of dns_policies so I handle it differently using this if statement

Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you need to remove the last character?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because I used the singular names of resources in the code
I can change that to use plural ones

Copy link
Contributor

Choose a reason for hiding this comment

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

all good. merging it.

@mshudrak
Copy link
Contributor

mshudrak commented Aug 1, 2023

There is one small typo but other than good to merge. Fix it and I will merge it.

@mshudrak mshudrak merged commit 954e1d2 into google:viz_tool Aug 1, 2023
mshudrak pushed a commit that referenced this pull request Sep 13, 2023
* feat 🎉 :Intial commit for visualization tool
* feat ✨ Adding gcp-scanner-visualizer command
* style 🎨 Adding linting and formating
* feat ➕ Add Flask to requirements
* feat: Add Layout for Resources Page
* feat: add intial TS types for resources
* add errors handling
* compress images and add them to src folder
* add status color logic to utils file
* feat: Add search through resources functionality  (#252)
* feat: add filtering with search
* auto focus on search input and with ctrl + f
* feat: Extend parser to parse most of resources (#262)
* feat: add filtering with search
* feat: add sort and search functionalities (#263)
* chore: refactor ControlMenu component into smaller components
* feat: add Details Drawer to resources cards
* feat: Add Details Drawer to Resources Cards (#264)
* feat: parse IAM policy roles
* feat: add IAM roles list
* feat: Add Searching in IAM roles using email (#274)
* Add UI for projects filter component
* filter resources using projects
* filter roles using projects
* use http.server module instead of flask
* docs: Add visualization tool usage readme
* Add visualization tool build files to git ignore
* Include visualization tool files in the MANIFEST.in
* Update INSTALL.md to include the build step for the visualization tool when building from source
* Add a build step for the visualization tool in the python-publish workflow
* add version to visualizer
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