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

Add intermediate statuses to Explorer #3696

Merged
merged 1 commit into from
Dec 19, 2023

Conversation

opudrovs
Copy link
Contributor

@opudrovs opudrovs commented Dec 6, 2023

Closes #3679

  • Added intermediate Explorer object statuses (based on how intermediate object statuses are currently computed on the frontend ).

  • Added SuspendableAdapter for computing the Suspended object status.

  • Expanded status and message tests for Explorer objects.

  • Added showing icons for intermediate Explorer object statuses in the Explorer UI (based on how icon type and color are currently computed on the frontend in the non-Explorer UI).

  • Added unit and snapshot tests for rendering UI indicators of Explorer object statuses.

  • Renamed AutomatedClusterDiscoveryAdaptor to AutomatedClusterDiscoveryAdapter for consistency with other adapters.

  • Removed empty line(s) for consistency (this is optional, if there is a reason those lines were added, can put them back).

  • Re-arranged some (one old and two new) object type switch cases alphabetically based on object Kind without package name, for readability. Can re-arrange them back if needed.

Screenshots of the new intermediate statuses in Explorer UI:

Screenshot 2023-12-11 at 13 47 47

Testing:

  • You can just check out the branch and test that you see the new intermediate object statuses (Reconciling and Suspended) in Explorer. The PendingAction status is possible for TF objects only (because it checks for the TerraformPlannedWithChanges condition reason), which are not supported by Explorer yet.

Notes:

  • I had to use a fake Kustomization with a TF object condition in a unit test for the PendingAction object status because Explorer for now does not support TF objects and it's beyond the scope of the current issues to add them.

Added a to-do to replace this fake TF objects with a real TF object after support for TF objects is added to Explorer.

  • It's the best I can do with adapters. 😅 If you knwo of a better way to add getting the value of Spec.Suspend from underlying Flux objects in Explorer's FluxObject, any suggestions are most welcome.

  • In pkg/query/configuration/fluxobject_test.go, I had to change the type of test object from FluxObject to client.Object because with the new adapter added I was getting an error: [object kind] does not implement FluxObject (missing method GetSuspended.

Questions:

  1. Should the object message is computed be reworked with taking some intermediate statuses into account? Or is using only message from object Condition with type Ready or Available, as now, still OK?

  2. Based on the frontend logic (how the icon is picked for different statuses), the icon for the NoStatus status is RemoveCircleIcon instead of the same icon as the error icon, which before was used for both Failed and NoStatus status.

  3. Should any of the custom status functions used by the following objects:

PolicyAgentAuditEventObjectKind

StatusFunc: func(obj client.Object) ObjectStatus {

GitopsTemplateObjectKind

StatusFunc: func(obj client.Object) ObjectStatus {

CapiTemplateObjectKind

StatusFunc: func(obj client.Object) ObjectStatus {

be reworked too to include intermediate statuses? Do intermediate statuses make sense for any of the objects which use custom status functions? I guess not (those objects cannot be suspended or reconciled, I mean similar to Applications and Sources, correct?) but wanted to check.

  1. Should the Ready status for test Explorer objects data in the existing frontend tests (for example, here) be updated to Success, to match the way it is returned from the backend (currently in the main branch too, Success is returned)? In the new UI snapshot test, I used the Success status in test objects.

@opudrovs opudrovs added enhancement New feature or request area/ui labels Dec 6, 2023
@opudrovs opudrovs self-assigned this Dec 6, 2023
@opudrovs opudrovs force-pushed the 3679-add-intermediate-statuses-to-explorer branch 9 times, most recently from 5eaeaeb to caddbd3 Compare December 7, 2023 03:52
opudrovs added a commit that referenced this pull request Dec 7, 2023
Add `SuspendableAdapter` for computing the `Suspended` object status.

Update status and message tests for `FluxObject`.

Add UI icons for indicating Explorer object statuses.

Remove empty lines for consistency.
opudrovs added a commit that referenced this pull request Dec 7, 2023
Add `SuspendableAdapter` for computing the `Suspended` object status.

Update status and message tests for `FluxObject`.

Add UI icons for indicating Explorer object statuses.

Remove empty lines for consistency.
@opudrovs opudrovs force-pushed the 3679-add-intermediate-statuses-to-explorer branch 2 times, most recently from c61cdea to c346374 Compare December 8, 2023 14:25
opudrovs added a commit that referenced this pull request Dec 8, 2023
* Add `SuspendableAdapter` for computing the `Suspended` object status.

* Update status and message tests for `FluxObject`.

* Add UI icons for indicating Explorer object statuses.

* Remove empty lines for consistency.

* Improve test coverage of Explorer object statuses.
@opudrovs opudrovs force-pushed the 3679-add-intermediate-statuses-to-explorer branch from c346374 to a71a4d8 Compare December 8, 2023 14:25
@opudrovs opudrovs removed their assignment Dec 8, 2023
@opudrovs opudrovs force-pushed the 3679-add-intermediate-statuses-to-explorer branch from a71a4d8 to 8ce8116 Compare December 8, 2023 14:51
opudrovs added a commit that referenced this pull request Dec 8, 2023
* Add `SuspendableAdapter` for computing the `Suspended` object status.

* Update status and message tests for `FluxObject`.

* Add UI icons for indicating Explorer object statuses.

* Improve test coverage of Explorer object statuses.

* Remove empty lines for consistency.
opudrovs added a commit that referenced this pull request Dec 11, 2023
* Add `SuspendableAdapter` for computing the `Suspended` object status.

* Update status and message tests for `FluxObject`.

* Add UI icons for indicating Explorer object statuses.

* Improve test coverage of Explorer object statuses.

* Remove empty lines for consistency.
@opudrovs opudrovs force-pushed the 3679-add-intermediate-statuses-to-explorer branch from 916aeb1 to 13575be Compare December 11, 2023 11:01
opudrovs added a commit that referenced this pull request Dec 11, 2023
* Add `SuspendableAdapter` for computing the `Suspended` object status.

* Update status and message tests for `FluxObject`.

* Add UI icons for indicating Explorer object statuses.

* Improve test coverage of Explorer object statuses.

* Remove empty lines for consistency.
@opudrovs opudrovs force-pushed the 3679-add-intermediate-statuses-to-explorer branch from 13575be to 475b937 Compare December 11, 2023 12:10
opudrovs added a commit that referenced this pull request Dec 11, 2023
* Add `SuspendableAdapter` for computing the `Suspended` object status.

* Update status and message tests for Explorer objects.

* Add UI icons for indicating Explorer object statuses.

* Add a snapshot test for Explorer object status indicators.

* Improve test coverage of Explorer object statuses.

* Remove empty lines for consistency.
@opudrovs opudrovs force-pushed the 3679-add-intermediate-statuses-to-explorer branch from 475b937 to 6dceafe Compare December 11, 2023 13:42
opudrovs added a commit that referenced this pull request Dec 11, 2023
* Add `SuspendableAdapter` for computing the `Suspended` object status.

* Update status and message tests for Explorer objects.

* Add UI icons for indicating Explorer object statuses.

* Add a snapshot test for Explorer object status indicators.

* Improve test coverage of Explorer object statuses.

* Remove empty lines for consistency.
@opudrovs opudrovs force-pushed the 3679-add-intermediate-statuses-to-explorer branch 2 times, most recently from eb1df71 to 03ca925 Compare December 11, 2023 20:51
@opudrovs opudrovs force-pushed the 3679-add-intermediate-statuses-to-explorer branch 3 times, most recently from d80c7b2 to 56df98a Compare December 18, 2023 23:31
@opudrovs
Copy link
Contributor Author

opudrovs commented Dec 18, 2023

@enekofb @jpellizzari changes addressed, please re-review.

Main changes:

  • Added @enekofb 's suggestions on passing anonymous functions for getting conditions and suspend with each object kind. Thanks, Eneko! ✨

  • Removed adapters and toFluxObject converter, we don't need them or those long switch statements anymore. 😄

  • Added returning errors from StatusFunc and MesageFunc based on @enekofb's TODO "need to return an error" comment Please check if it is the kind of error handling you had in mind.

  • Added passing object kind with test objects in fluxobject_test.go because we now need access to the real ObjectKind's get conditions and suspended functions.

I will squash the commits after the PR is approved, keeping them for higher visibility of the latest changes.

Tested the branch locally, the intermediate statuses are visible in Explorer after the latest changes:

Screenshot 2023-12-18 at 19 27 51

Screenshot 2023-12-18 at 19 27 46

@opudrovs opudrovs force-pushed the 3679-add-intermediate-statuses-to-explorer branch from 56df98a to 96f69bb Compare December 19, 2023 09:34
opudrovs added a commit that referenced this pull request Dec 19, 2023
* Add `SuspendableAdapter` for computing the `Suspended` object status.

* Expand status and message tests for Explorer objects.

* Add showing icons for intermediate Explorer object statuses in the Explorer UI.

* Add unit and snapshot tests for rendering UI indicators of Explorer object statuses.

* Rename `AutomatedClusterDiscoveryAdaptor` to `AutomatedClusterDiscoveryAdapter` for consistency with other adapters.

* Remove empty lines for consistency.
@enekofb enekofb requested review from enekofb and a team December 19, 2023 09:36
@enekofb
Copy link
Contributor

enekofb commented Dec 19, 2023

added @weaveworks/pesto and @weaveworks/timber-wolf for visibility (not required approval) but to be aware of the PR for the changes around their affected resources

@enekofb enekofb requested a review from a team December 19, 2023 09:40
Copy link
Contributor

@enekofb enekofb left a comment

Choose a reason for hiding this comment

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

Tested the functionality using suspended as example

Screenshot 2023-12-19 at 10 42 51

approved with minor cleanup suggestions (no blockers)

Shalllow skimmed through FE changes, dont trust my review in that sense.

pkg/query/configuration/objectkind.go Show resolved Hide resolved
pkg/query/configuration/fluxobject_test.go Outdated Show resolved Hide resolved
pkg/query/configuration/objectkind.go Outdated Show resolved Hide resolved
pkg/query/configuration/objectkind.go Outdated Show resolved Hide resolved
pkg/query/configuration/objectkind.go Show resolved Hide resolved
@enekofb enekofb requested a review from a team December 19, 2023 09:59
opudrovs added a commit that referenced this pull request Dec 19, 2023
* Add `SuspendableAdapter` for computing the `Suspended` object status.

* Expand status and message tests for Explorer objects.

* Add showing icons for intermediate Explorer object statuses in the Explorer UI.

* Add unit and snapshot tests for rendering UI indicators of Explorer object statuses.

* Rename `AutomatedClusterDiscoveryAdaptor` to `AutomatedClusterDiscoveryAdapter` for consistency with other adapters.

* Remove empty lines for consistency.
@opudrovs opudrovs force-pushed the 3679-add-intermediate-statuses-to-explorer branch 2 times, most recently from b1f91cb to 9ed0317 Compare December 19, 2023 10:48
opudrovs added a commit that referenced this pull request Dec 19, 2023
* Add `GetConditionsFunc` and `GetSuspendedFunc` to `ObjectKind` to simplify adding new object kinds (with updates required in a single place).

* Add showing icons for intermediate Explorer object statuses in the Explorer UI.

* Expand status and message tests for Explorer objects.

* Add unit and snapshot tests for rendering UI indicators of Explorer object statuses.

* Remove the `FluxObject` interface, `ToFluxObject` function, and adapters.

* Add returning errors from `StatusFunc` and `MessageFunc`.

* Update the comment for the `defaultStatusFunc` function to reflect changes in status computation logic logic.

* Rename `AutomatedClusterDiscoveryKind` to `AutomatedClusterDiscoveryObjectKind` for consistency.

* Add a test for computing `AutomatedClusterDiscoveryObjectKind` status message.

* Remove empty lines for consistency.
@opudrovs opudrovs force-pushed the 3679-add-intermediate-statuses-to-explorer branch from 9ed0317 to 72fbbff Compare December 19, 2023 11:01
opudrovs added a commit that referenced this pull request Dec 19, 2023
* Add `GetConditionsFunc` and `GetSuspendedFunc` to `ObjectKind` to simplify adding new object kinds (with updates required in a single place).

* Add showing icons for intermediate Explorer object statuses in the Explorer UI.

* Expand status and message tests for Explorer objects.

* Add unit and snapshot tests for rendering UI indicators of Explorer object statuses.

* Remove the `FluxObject` interface, `ToFluxObject` function, and adapters.

* Improve error handling in `StatusFunc` and `MessageFunc`.

* Rename `AutomatedClusterDiscoveryKind` to `AutomatedClusterDiscoveryObjectKind` for consistency.

* Remove empty lines for consistency.
@opudrovs opudrovs force-pushed the 3679-add-intermediate-statuses-to-explorer branch from 72fbbff to 05d8c7e Compare December 19, 2023 11:01
opudrovs added a commit that referenced this pull request Dec 19, 2023
* Add `GetConditionsFunc` and `GetSuspendedFunc` to `ObjectKind` to simplify adding new object kinds (with necessary modifications consolidated in one location).

* Remove the `FluxObject` interface, `ToFluxObject` function, and related adapters.

* Improve error handling in `StatusFunc` and `MessageFunc`.

* Add showing icons for intermediate Explorer object statuses in the Explorer UI.

* Expand status and message tests for Explorer objects.

* Add unit and snapshot tests for rendering UI indicators of Explorer object statuses.

* Rename `AutomatedClusterDiscoveryKind` to `AutomatedClusterDiscoveryObjectKind` for consistency.

* Remove empty lines for consistency.
@opudrovs opudrovs force-pushed the 3679-add-intermediate-statuses-to-explorer branch from 05d8c7e to ee74234 Compare December 19, 2023 11:09
opudrovs added a commit that referenced this pull request Dec 19, 2023
* Add `GetConditionsFunc` and `GetSuspendedFunc` to `ObjectKind` to simplify adding new object kinds (to ensure that necessary modifications are consolidated in one location).

* Remove the `FluxObject` interface, `ToFluxObject` function, and a related adapter.

* Improve error handling in `StatusFunc` and `MessageFunc`.

* Add showing icons for intermediate Explorer object statuses in the Explorer UI.

* Expand status and message tests for Explorer objects.

* Add unit and snapshot tests for rendering UI indicators of Explorer object statuses.

* Rename `AutomatedClusterDiscoveryKind` to `AutomatedClusterDiscoveryObjectKind` for consistency.

* Remove empty lines for consistency.
@opudrovs opudrovs force-pushed the 3679-add-intermediate-statuses-to-explorer branch 2 times, most recently from 8c383ab to 56b8b88 Compare December 19, 2023 11:23
opudrovs added a commit that referenced this pull request Dec 19, 2023
* Add `GetConditionsFunc` and `GetSuspendedFunc` to `ObjectKind` to simplify adding new object kinds (to ensure that necessary modifications are consolidated in one location).

* Remove the `FluxObject` interface, `ToFluxObject` function, and a related adapter.

* Improve error handling in `StatusFunc` and `MessageFunc`.

* Add showing icons for intermediate Explorer object statuses in the Explorer UI.

* Expand status and message tests for Explorer objects.

* Add unit and snapshot tests for rendering UI indicators of Explorer object statuses.

* Rename `AutomatedClusterDiscoveryKind` to `AutomatedClusterDiscoveryObjectKind` for consistency.

* Remove empty lines for consistency.
@opudrovs
Copy link
Contributor Author

@enekofb re-tested it locally, working as expected. The latest comments addressed. If there are no more changes required, I am merging it.

* Add `GetConditionsFunc` and `GetSuspendedFunc` to `ObjectKind` to simplify adding new object kinds (to ensure that necessary modifications are consolidated in one location).

* Remove the `FluxObject` interface, `ToFluxObject` function, and a related adapter.

* Improve error handling in `StatusFunc` and `MessageFunc`.

* Add showing icons for intermediate Explorer object statuses in the Explorer UI.

* Expand status and message tests for Explorer objects.

* Add unit and snapshot tests for rendering UI indicators of Explorer object statuses.

* Rename `AutomatedClusterDiscoveryKind` to `AutomatedClusterDiscoveryObjectKind` for consistency.

* Remove empty lines for consistency.
@opudrovs opudrovs force-pushed the 3679-add-intermediate-statuses-to-explorer branch from 56b8b88 to e517eae Compare December 19, 2023 12:20
@opudrovs opudrovs merged commit ff98845 into main Dec 19, 2023
10 checks passed
@opudrovs opudrovs deleted the 3679-add-intermediate-statuses-to-explorer branch December 19, 2023 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ui enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add intermediate statuses to Explorer
3 participants