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

Remove old js components: Spinner, Alert #6554

Merged
merged 43 commits into from
Aug 7, 2023

Conversation

antgamdia
Copy link
Contributor

@antgamdia antgamdia commented Aug 2, 2023

Description of the change

This PR is following up #6550 (and requires it to get merged first). In this one, the focus is on:

  • Remove the Spinner old js component in favor of CdsProgressCircle.
  • Replace the old js Alert with the AlertGroup component we already had. It is just a wrapper with some handy configuration of the clarity components.
    • By default, they are now closable. Sometimes we have some transient errors and I think we can just defer to the user the decision on whether or not to close them.
  • Add a "Cancel" button in a modal (new ns) to keep UX consistency.
  • Replace the remaining plain <button> (we weren't able to back in time due to an upstream bug).

Again, this PR is pretty extensive (sorry!)

Benefits

Again, let me show some visual examples :) (the error messages like "error.message" are just placeholders while developing, they are removed in the PR).

Initial emptyKubeapps alert

alert1_BA

Typical error alert

alert2_BA

Error with action (in accordance with the clarity guidelines)

alert3_(layout)_BA

Error with action (another example)

alert4_(catalog)_BA

New update available

alert5_(pkgUpdate)_BA

Operators warning

alert6_(operators)_BA

General error (note the proper margins now)

alert7_(cloader)_BA

Repos in !kubeappsCluster

alert8_(repos)_BA

Add repo error

alert9_(newRepo)_BA

Error in a modal (note the margins again)

alert10_(rollback)_BA

Possible drawbacks

N/A (hope any!)

Applicable issues

Related to #6563

Additional information

After this PR there are just two remaining js components: Table and Card. I will work on them soon!

Signed-off-by: Antonio Gamez Diaz <[email protected]>
Signed-off-by: Antonio Gamez Diaz <[email protected]>
Signed-off-by: Antonio Gamez Diaz <[email protected]>
Signed-off-by: Antonio Gamez Diaz <[email protected]>
Signed-off-by: Antonio Gamez Diaz <[email protected]>
Signed-off-by: Antonio Gamez Diaz <[email protected]>
Signed-off-by: Antonio Gamez Diaz <[email protected]>
Signed-off-by: Antonio Gamez Diaz <[email protected]>
Signed-off-by: Antonio Gamez Diaz <[email protected]>
Signed-off-by: Antonio Gamez Diaz <[email protected]>
Signed-off-by: Antonio Gamez Diaz <[email protected]>
Signed-off-by: Antonio Gamez Diaz <[email protected]>

Conflicts:
	dashboard/src/components/AppList/AppListItem.tsx
	dashboard/src/components/AppView/AccessURLTable/AccessURLTable.tsx
	dashboard/src/components/AppView/AppControls/RollbackButton/RollbackDialog.test.tsx
	dashboard/src/components/Config/PkgRepoList/PkgRepoList.tsx
	dashboard/src/components/SearchFilter/SearchFilter.tsx
	dashboard/src/components/hooks/useOutsideClick/useOutsideClick.test.tsx
	dashboard/src/components/js/hooks/useOutsideClick/useOutsideClick.test.js
Signed-off-by: Antonio Gamez Diaz <[email protected]>
Signed-off-by: Antonio Gamez Diaz <[email protected]>
Signed-off-by: Antonio Gamez Diaz <[email protected]>
Signed-off-by: Antonio Gamez Diaz <[email protected]>
Signed-off-by: Antonio Gamez Diaz <[email protected]>
Signed-off-by: Antonio Gamez Diaz <[email protected]>
Signed-off-by: Antonio Gamez Diaz <[email protected]>
Signed-off-by: Antonio Gamez Diaz <[email protected]>
@netlify
Copy link

netlify bot commented Aug 2, 2023

Deploy Preview for kubeapps-dev canceled.

Built without sensitive environment variables

Name Link
🔨 Latest commit 4dc17ab
🔍 Latest deploy log https://app.netlify.com/sites/kubeapps-dev/deploys/64cce219f7b77100082a974d

@antgamdia antgamdia changed the title Remove js components 2 Remove old js components: Spinner, Alert Aug 2, 2023
Signed-off-by: Antonio Gamez Diaz <[email protected]>
Signed-off-by: Antonio Gamez Diaz <[email protected]>
Signed-off-by: Antonio Gamez Diaz <[email protected]>
Signed-off-by: Antonio Gamez Diaz <[email protected]>
Signed-off-by: Antonio Gamez Diaz <[email protected]>
Signed-off-by: Antonio Gamez Diaz <[email protected]>
Signed-off-by: Antonio Gamez Diaz <[email protected]>

Conflicts:
	dashboard/src/components/AppView/AppView.tsx
	dashboard/src/components/Catalog/Catalog.tsx
	dashboard/src/components/DeploymentForm/DeploymentForm.tsx
	dashboard/src/components/OperatorInstance/OperatorInstance.tsx
	dashboard/src/components/OperatorList/OperatorList.tsx
	dashboard/src/components/OperatorNew/OperatorNew.tsx
	dashboard/src/components/OperatorView/OperatorView.tsx
	dashboard/src/components/PackageHeader/PackageView.test.tsx
	dashboard/src/containers/ConfigLoaderContainer/ConfigLoaderContainer.ts
	dashboard/src/containers/RoutesContainer/Routes.test.tsx
	dashboard/src/containers/RoutesContainer/Routes.tsx
Signed-off-by: Antonio Gamez Diaz <[email protected]>
Signed-off-by: Antonio Gamez Diaz <[email protected]>

Conflicts:
	dashboard/src/components/AppView/AppView.tsx
	dashboard/src/components/Catalog/Catalog.tsx
	dashboard/src/components/ConfigLoader/ConfigLoader.tsx
	dashboard/src/components/DeploymentForm/DeploymentForm.tsx
	dashboard/src/components/Header/ContextSelector.test.tsx
	dashboard/src/components/OperatorInstance/OperatorInstance.tsx
	dashboard/src/components/OperatorInstanceForm/OperatorInstanceForm.tsx
	dashboard/src/components/OperatorInstanceUpdateForm/OperatorInstanceUpdateForm.test.tsx
	dashboard/src/components/OperatorInstanceUpdateForm/OperatorInstanceUpdateForm.tsx
	dashboard/src/components/OperatorList/OperatorList.tsx
	dashboard/src/components/OperatorNew/OperatorNew.test.tsx
	dashboard/src/components/OperatorNew/OperatorNew.tsx
	dashboard/src/components/OperatorView/OperatorView.test.tsx
	dashboard/src/components/OperatorView/OperatorView.tsx
	dashboard/src/components/PackageHeader/PackageView.test.tsx
	dashboard/src/components/PackageHeader/PackageView.tsx
	dashboard/src/components/UpgradeForm/UpgradeForm.tsx
	dashboard/src/components/js/Button/Button.test.js
	dashboard/src/containers/ConfigLoaderContainer/ConfigLoaderContainer.ts
@antgamdia antgamdia changed the base branch from main to prerelease August 4, 2023 10:29
@antgamdia antgamdia changed the base branch from prerelease to main August 4, 2023 10:29
Signed-off-by: Antonio Gamez Diaz <[email protected]>

Conflicts:
	dashboard/src/components/AppList/AppListGrid.tsx
	dashboard/src/components/AppUpgrade/AppUpgrade.test.tsx
	dashboard/src/components/AppUpgrade/AppUpgrade.tsx
	dashboard/src/components/AppView/AppControls/RollbackButton/RollbackDialog.tsx
	dashboard/src/components/AppView/AppView.tsx
	dashboard/src/components/Catalog/Catalog.tsx
	dashboard/src/components/ConfirmDialog/ConfirmDialog.tsx
	dashboard/src/components/DeploymentForm/DeploymentForm.tsx
	dashboard/src/components/Header/ContextSelector.tsx
	dashboard/src/components/OperatorInstance/OperatorInstance.tsx
	dashboard/src/components/OperatorInstanceForm/OperatorInstanceForm.tsx
	dashboard/src/components/OperatorInstanceUpdateForm/OperatorInstanceUpdateForm.tsx
	dashboard/src/components/OperatorList/OperatorList.tsx
	dashboard/src/components/OperatorNew/OperatorNew.tsx
	dashboard/src/components/OperatorView/OperatorView.tsx
	dashboard/src/components/PackageHeader/PackageReadme.tsx
	dashboard/src/components/PackageHeader/PackageView.tsx
	dashboard/src/components/SelectRepoForm/SelectRepoForm.tsx
	dashboard/src/components/UpgradeForm/UpgradeForm.tsx
	dashboard/src/components/js/Button/Button.test.js
Signed-off-by: Antonio Gamez Diaz <[email protected]>
@antgamdia antgamdia marked this pull request as ready for review August 4, 2023 10:37
Signed-off-by: Antonio Gamez Diaz <[email protected]>
@antgamdia
Copy link
Contributor Author

Additionally, I have collected all the messages we currently have. I think we should uniformize them at some point ("unable to...", "an error occurred...", "an error occurred while....", "there is a problem..."). Find below the list, but here is a summary of the main occurrences:

  • An error occurred while ACTION(creating, deleting, fetching, updating) SOMETHING: demo message.
  • An error occurred: demo message.
  • Unable to ACTION(delete, fetch, load, retrieve) SOMETHING: demo message.
  • There is a problem with this package: demo message.
  • demo message
  • Operator-related:
    • Found an error updating the instance: demo message.
    • It's not possible to install a namespaced operator in the "operators" namespace.
    • Operator OPERATOR_NAME doesn't define a valid channel. This is needed to extract required info.
    • Resource RESOURCE_NAME not found
    • The CRD "CRD_NAME" was not found in the definition of "CSV_NAME".
    • The Operator OPERATOR_NAME doesn't define a valid channel. This is needed to extract required info.
Normalized unique instances
An error occurred while creating the instance: demo message.
An error occurred while creating the operator OPERATOR_NAME: demo message.
An error occurred while creating the repository: demo message.
An error occurred while deleting the repository: demo message.
An error occurred while fetching Operators: demo message.
An error occurred while fetching repositories: demo message.
An error occurred while fetching the ClusterServiceVersion: demo message.
An error occurred while fetching the Operator OPERATOR_NAME: demo message.
An error occurred while fetching the application: demo message.
An error occurred while fetching the catalog: demo message.
An error occurred while fetching the instance: demo message.
An error occurred while fetching the operator OPERATOR_NAME: demo message.
An error occurred while fetching the repository: demo message.
An error occurred while updating the repository: demo message.
An error occurred: demo message.
Found an error updating the instance: demo message.
It's not possible to install a namespaced operator in the "operators" namespace.
Operator OPERATOR_NAME doesn't define a valid channel. This is needed to extract required info.
Resource RESOURCE_NAME not found
The CRD "CRD_NAME" was not found in the definition of "CSV_NAME".
The Operator OPERATOR_NAME doesn't define a valid channel. This is needed to extract required info.
There is a problem with this package: demo message.
Unable to delete the application. Received: demo message.
Unable to fetch the package "PACKAGE_ID (PACKAGE_VERSION)": demo message.
Unable to fetch the package's README: demo message.
Unable to fetch the package: demo message.
Unable to load the Kubeapps configuration: demo message.
Unable to retrieve API info: demo message.
Unable to retrieve the CustomResourceDefinition for RESOURCE_KIND in CSV_METADATA_NAME
Unable to retrieve the current app: demo message.
Unable to retrieve the package: demo message.
demo message
demo message.
Raw list
Deploy applications on your Kubernetes cluster with a single click.
Unable to retrieve the CustomResourceDefinition for ${resource.kind} in ${csv.metadata.name}
Unable to retrieve the current app: {error.message}.
An error occurred while fetching the application: {error?.message}.
There is a problem with this package: {error["message"]}.
Unable to delete the application. Received: {error["message"]}.
An error occurred: {error["message"]}.
There is a problem with this package: {error["message"]}.
Unable to delete the application. Received: {error["message"]}.
An error occurred: {error["message"]}.
An error occurred while fetching the catalog: {error.message}.
An error occurred while creating the repository: {createError.message}.
An error occurred while updating the repository: {updateError.message}.
An error occurred while deleting the repository: {deleteError.message}.
An error occurred while fetching the repository: {fetchError.message}.
Package Repositories can't be managed from this cluster. <br /> <br /> Currently, the <b> Package Repositories must be managed from the default cluster </b>{" "} (the one on which Kubeapps has been installed). <br /> <br /> Any <i>global</i> Package Repository defined in the default cluster can be later used across any target cluster. <br /> However, <i>namespaced</i> Package Repositories can only be used on the default cluster.
An error occurred while fetching repositories: {errors.fetch.message}.
An error occurred while deleting the repository: {errors.delete.message}.
An error occurred while deleting the repository: {errors.delete.message}.
Unable to load the {kubeappsTitle} configuration: {error?.message}.
There is a problem with this package: {error["message"]}.
Unable to delete the application. Received: {error["message"]}.
An error occurred: {error["message"]}.
Unable to retrieve the package: {(error as FetchError)?.message}.
An error occurred: {error.message}.
Unable to fetch the package "{decodeURIComponent(packageId)} ({packageVersion})":{" "}{error.message}.
An error occurred: {error.error.message}.
An error occurred: {error.message}.
Unable to retrieve API info: {kindsError.message}.
An error occurred while fetching the instance: {errors.fetch.message}.
An error occurred: {error.message}.
The CRD "{crdName}" was not found in the definition of "{csvName}".
An error occurred while fetching the ClusterServiceVersion: {fetchError.message}.
An error occurred while creating the instance: {createError.message}.
{parseError.message}.
Resource {resourceName} not found
An error occurred while fetching the ClusterServiceVersion: {fetchError.message}.
Found an error updating the instance: {updateError.message}.
Operators integration is under heavy development and currently in beta state. If you find an issue, please{" "} <a target="_blank" rel="noopener noreferrer" href="https://github.com/vmware-tanzu/kubeapps/issues/new" > report it here </a> .
An error occurred while fetching Operators: {error.message}.
An error occurred while fetching the operator {operatorName}: {errors.fetch.message}.
An error occurred while creating the operator {operatorName}: {errors.create.message}.
The Operator {operatorName} doesn't define a valid channel. This is needed to extract required info.
It's not possible to install a namespaced operator in the "operators" namespace.
Operator {operator.metadata.name} doesn't define a valid channel. This is needed to extract required info.
An error occurred while fetching the Operator {operatorName}: {error.message}.
Operator {operatorName} doesn't define a valid channel. This is needed to extract required info.
Unable to fetch the package's README: {error}.
Unable to fetch the package: {selectedPackage.error.message}.
An error occurred: {fetchError.message}.
No repositories found. <br /> Manage your repositories in Kubeapps by visiting the{" "} <Link to={url.app.config.pkgrepositories(cluster, namespace)}> Package Repositories configuration </Link>{" "} page.
An error occurred: {packageError.message}.
An error occurred: {error?.message}.
{message}

Copy link
Contributor

@absoludity absoludity left a comment

Choose a reason for hiding this comment

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

Again, this PR is pretty extensive (sorry!)

No problem - thanks for the cleanups! Great to be removing the old non-TS code.

@antgamdia antgamdia merged commit e1a72e6 into vmware-tanzu:main Aug 7, 2023
@antgamdia antgamdia deleted the remove-js-components-2 branch August 7, 2023 07:22
antgamdia added a commit that referenced this pull request Aug 10, 2023
## Description of the change

This PR is following up #6554 (and requires it to get merged first). In
this final one, the focus is on:

- Transform the `Card` and its sub-components to tsx.
- Transform the `Table` to tsx
- Remove the remaining test snapshots 

### Benefits

No cool before/after pics this time :P Here we have just migrated
js-based code to typescript.
However, after this PR we will able to say we finally got rid of the
legacy js-components!!

### Possible drawbacks

N/A - hopefully.

### Applicable issues

Related to #6563

### Additional information

While transforming the `Card` to tsx I also had a look at the `CdsCard`
from Clarity. Unfortunately, there is no drop-in replacement; a
migration would require plenty of style-related changes. Besides, the
"native" style differs a bit from the general style we have in Kubeapps.
Below are some examples:

<details><summary>Example from the Clarity website</summary>


![image](https://github.com/vmware-tanzu/kubeapps/assets/11535726/c0b783b0-25dd-48ba-b673-abd85fddd830)

</details>

<details><summary>Quick/dirty replacement, it does not look
good</summary>


![image](https://github.com/vmware-tanzu/kubeapps/assets/11535726/34a6c2c5-d5c0-418e-83d3-6143766d4170)

</details>

<details><summary>Our current custom card</summary>


![image](https://github.com/vmware-tanzu/kubeapps/assets/11535726/4bf0def2-3a8f-4680-bf01-56f3ea390d6a)

</details>

---------

Signed-off-by: Antonio Gamez Diaz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants