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(Settings): Add Settings Page #1201

Merged
merged 1 commit into from
Jun 28, 2024
Merged

Conversation

lordrip
Copy link
Member

@lordrip lordrip commented Jun 25, 2024

Context

In the scope of selecting the Runtime in use, a settings page pointing to a catalog URL is needed.

This commit adds a Settings component and a Settings provider. By default, it will store the settings in the browser's LocalStorage.

The idea behind using a SettingsAdapter is to give the possibility to set the settings at the VSCode level if needed.

How to test

For setting a remote catalog you could use: https://raw.githubusercontent.com/lordrip/kaoto-catalog-test/main as URL

fix: #834

@lordrip lordrip force-pushed the feat/settings-page branch 3 times, most recently from 1e366a3 to 4566738 Compare June 26, 2024 12:59
@lordrip lordrip marked this pull request as ready for review June 26, 2024 13:29
@apupier
Copy link
Member

apupier commented Jun 26, 2024

I think either we need to keep the index.json or use the non-raw url because there is no way in the UI to get the described url directly. i tis even giving a 400 Invalid request

So either:

Copy link
Member

@apupier apupier left a comment

Choose a reason for hiding this comment

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

for another iteration:

  • check all camel catalog entries, it currently checks only the first one. The error on an entry catalog appears only when trying to load the catalog later. it might be anothe rbutton to call validate/Load test explicitely to avo dthat it take too much time.

packages/ui/src/providers/schemas.provider.tsx Outdated Show resolved Hide resolved
@lordrip lordrip force-pushed the feat/settings-page branch from 4566738 to 5dc4d2c Compare June 28, 2024 12:37
@lordrip
Copy link
Member Author

lordrip commented Jun 28, 2024

for another iteration:

* check all camel catalog entries, it currently checks only the first one. The error on an entry catalog appears only when trying to load the catalog later. it might be anothe rbutton to call validate/Load test explicitely to avo  dthat it take too much time.

Is that still happening?
image

Using the following URL: https://raw.githubusercontent.com/lordrip/kaoto-catalog-test/main/ works for me, as soon as you save it, the page gets refreshed, and if there's an error, it offers a mechanism to go back:
image

@apupier
Copy link
Member

apupier commented Jun 28, 2024

Using the following URL: https://raw.githubusercontent.com/lordrip/kaoto-catalog-test/main/ works for me

it works to load it in Kaoto.
it gives an error when accessing directly in the browser.

@lordrip
Copy link
Member Author

lordrip commented Jun 28, 2024

Using the following URL: https://raw.githubusercontent.com/lordrip/kaoto-catalog-test/main/ works for me

it works to load it in Kaoto. it gives an error when accessing directly in the browser.

ah, yes, I think is because loading the URL would be a folder, so nothing to deliver from the CDN perspective, but in Kaoto, we use this to build the final index.json URL

https://github.com/KaotoIO/kaoto/pull/1201/files#diff-c8639e81b24a2fc657a86f21762476165dc395c2b57841851321c61775ac6189R36

@apupier
Copy link
Member

apupier commented Jun 28, 2024

Using the following URL: https://raw.githubusercontent.com/lordrip/kaoto-catalog-test/main/ works for me

it works to load it in Kaoto. it gives an error when accessing directly in the browser.

ah, yes, I think is because loading the URL would be a folder, so nothing to deliver from the CDN perspective, but in Kaoto, we use this to build the final index.json URL

https://github.com/KaotoIO/kaoto/pull/1201/files#diff-c8639e81b24a2fc657a86f21762476165dc395c2b57841851321c61775ac6189R36

my point is that it makes things more complicated for end-users to stripe out the index.json than requiring it

@lordrip
Copy link
Member Author

lordrip commented Jun 28, 2024

Using the following URL: https://raw.githubusercontent.com/lordrip/kaoto-catalog-test/main/ works for me

it works to load it in Kaoto. it gives an error when accessing directly in the browser.

ah, yes, I think is because loading the URL would be a folder, so nothing to deliver from the CDN perspective, but in Kaoto, we use this to build the final index.json URL
https://github.com/KaotoIO/kaoto/pull/1201/files#diff-c8639e81b24a2fc657a86f21762476165dc395c2b57841851321c61775ac6189R36

my point is that it makes things more complicated for end-users to stripe out the index.json than requiring it

Ah, absolutely, got it, I'll adapt it to use the URL as an entry point directly then, so if someone wants to have index.json named differently for whatever reason, it can be done.

Initially, I wasn't sure what was the best way to expose this information, so I kept the same approach.

@lordrip lordrip force-pushed the feat/settings-page branch 2 times, most recently from 2dbca2d to 5b32f91 Compare June 28, 2024 15:17
@lordrip
Copy link
Member Author

lordrip commented Jun 28, 2024

Using the following URL: https://raw.githubusercontent.com/lordrip/kaoto-catalog-test/main/ works for me

it works to load it in Kaoto. it gives an error when accessing directly in the browser.

ah, yes, I think is because loading the URL would be a folder, so nothing to deliver from the CDN perspective, but in Kaoto, we use this to build the final index.json URL
https://github.com/KaotoIO/kaoto/pull/1201/files#diff-c8639e81b24a2fc657a86f21762476165dc395c2b57841851321c61775ac6189R36

my point is that it makes things more complicated for end-users to stripe out the index.json than requiring it

Ah, absolutely, got it, I'll adapt it to use the URL as an entry point directly then, so if someone wants to have index.json named differently for whatever reason, it can be done.

Initially, I wasn't sure what was the best way to expose this information, so I kept the same approach.

I updated the PR to use the index.json file directly: https://raw.githubusercontent.com/lordrip/kaoto-catalog-test/main/index.json

In the scope of selecting the Runtime in use, a settings page pointing
to a catalog URL is needed.

This commit adds a Settings component and a Settings provider. By
default, it will store the settings to the browser's LocalStorage.

The idea behind using a SettingsAdapter is to give the possibilit in the
future to set the settings at VSCode level if needed.

fix: KaotoIO#834
@lordrip lordrip force-pushed the feat/settings-page branch from 5b32f91 to b6bd97f Compare June 28, 2024 16:46
@lordrip lordrip merged commit f4bf6d0 into KaotoIO:main Jun 28, 2024
7 of 9 checks passed
@lordrip lordrip deleted the feat/settings-page branch June 28, 2024 17:07
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.

Create a Settings screen
3 participants