generated from openmcp-project/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 3
YAML view improvements #303
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
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
7969060
Update removeManagedFieldsProperty.ts
lucasgoral 3c34a39
fix
lucasgoral 20ac8b3
Add option to show only important YAML data
lucasgoral d81fb6f
fix
lucasgoral b6f7f2f
fix
lucasgoral ecdf4b5
fixes
lucasgoral f176198
refactor
lucasgoral 846b341
Merge branch 'main' into yaml-view-improvements
lucasgoral 411f406
Update src/utils/removeManagedFieldsAndFilterData.ts
lucasgoral ba3644c
Update src/utils/removeManagedFieldsAndFilterData.ts
lucasgoral e69ba68
Update src/components/Graphs/Graph.tsx
lucasgoral fa55744
Update removeManagedFieldsAndFilterData.ts
lucasgoral 4271f16
Update Graph.tsx
lucasgoral 5eebe57
Update Graph.tsx
lucasgoral 9d8106b
Update YamlViewButtonWithLoader.tsx
lucasgoral 59dcd23
Update YamlViewButton.tsx
lucasgoral File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { LAST_APPLIED_CONFIGURATION_ANNOTATION } from '../lib/api/types/shared/keyNames'; | ||
|
||
export type Resource = { | ||
apiVersion: string; | ||
kind: string; | ||
items?: Omit<Resource, 'items'>[]; | ||
metadata: { | ||
name: string; | ||
namespace?: string; | ||
labels?: Record<string, string>; | ||
annotations?: { | ||
[LAST_APPLIED_CONFIGURATION_ANNOTATION]?: string; | ||
[key: string]: string | undefined; | ||
}; | ||
managedFields?: unknown; | ||
creationTimestamp?: string; | ||
finalizers?: string[]; | ||
generation?: number; | ||
resourceVersion?: string; | ||
uid?: string; | ||
}; | ||
spec?: unknown; | ||
status?: unknown; | ||
}; | ||
|
||
const cleanUpResource = ( | ||
resource: Omit<Resource, 'items'>, | ||
showOnlyImportantData: boolean, | ||
): Omit<Resource, 'items'> => { | ||
const newResource = { ...resource }; | ||
|
||
if (newResource.metadata) { | ||
newResource.metadata = { ...newResource.metadata }; | ||
delete newResource.metadata.managedFields; | ||
|
||
if (showOnlyImportantData) { | ||
if (newResource.metadata.annotations) { | ||
newResource.metadata.annotations = { ...newResource.metadata.annotations }; | ||
delete newResource.metadata.annotations[LAST_APPLIED_CONFIGURATION_ANNOTATION]; | ||
} | ||
delete newResource.metadata.generation; | ||
delete newResource.metadata.uid; | ||
} | ||
} | ||
|
||
return newResource; | ||
}; | ||
|
||
export const removeManagedFieldsAndFilterData = ( | ||
resourceObject: Resource, | ||
showOnlyImportantData: boolean, | ||
): Resource => { | ||
if (!resourceObject) { | ||
return {} as Resource; | ||
} | ||
if (resourceObject.items) { | ||
return { | ||
...cleanUpResource(resourceObject, showOnlyImportantData), | ||
items: resourceObject.items.map((item) => cleanUpResource(item, showOnlyImportantData)), | ||
}; | ||
} | ||
|
||
return cleanUpResource(resourceObject, showOnlyImportantData); | ||
}; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.