-
Notifications
You must be signed in to change notification settings - Fork 316
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
Come up with way to store user specific preferences for use in the Console #6483
Comments
I think this is the way to go. I don't see an issue with the first con here; the Console is a first class component in TTS and it just needs to persist state, just like other components persist (private) state.
These are simply columns per user, right? For booksmarks/favorites or recently viewed there would be an array column basically.
I'm not too sure about this though. I'm not against this, but we should be very mindful about adding something like this. Is this a customer request? |
In general I am on the same boat regarding the storage - it should stay in the Identity Server, and it probably should be under two forms:
Update on (1): As I mentioned before, we don't need to add multiple columns to the table such that every time we need to add something new we have to write a migration. We can have something like: message UserPreferences {
bool dark_mode = 1;
message DashboardLayouts {
...
}
DashboardLayouts dashboard_layouts = 2;
...
}
message User {
...
UserPreferences preferences = 99;
} This is in turn backed in the |
I'm not so sure if its ideal to store the console user preferences on the Identity Server as it is a set of information which aren't attached to entities but rather to desired user behaviors on the front-end. Having said that, I still agree that its probably the best choice to store said information on the IS purely due to the decrease of complexity that this approach brings. I also agree with the two approaches of storage given by @adriansmares. |
Great, then let's go with the IS approach.
Let's see:
@KrishnaIyer can you help to schedule this in conjunction with the Console design updates? |
Yes. This is added as an item to https://github.com/TheThingsIndustries/product-management/issues/29. |
@nicholaspcr: Do you have sufficient input in the issue to start implementing this? |
@KrishnaIyer yeah the suggestion made by Adrian is good solution. Will work on this after finishing the |
Updating this issue with the changes made to the IS, this should unblock the front-end issues related to these features. Changes introduced by #6890 A new field {
"console_theme": "('CONSOLE_THEME_SYSTEM'|'CONSOLE_THEME_LIGHT'|'CONSOLE_THEME_DARK')",
"dashboard_layouts": {
"api_key": "('DASHBOARD_LAYOUT_TABLE', 'DASHBOARD_LAYOUT_LIST', 'DASHBOARD_LAYOUT_GRID')",
"application": "('DASHBOARD_LAYOUT_TABLE', 'DASHBOARD_LAYOUT_LIST', 'DASHBOARD_LAYOUT_GRID')",
"collaborator": "('DASHBOARD_LAYOUT_TABLE', 'DASHBOARD_LAYOUT_LIST', 'DASHBOARD_LAYOUT_GRID')",
"end_device": "('DASHBOARD_LAYOUT_TABLE', 'DASHBOARD_LAYOUT_LIST', 'DASHBOARD_LAYOUT_GRID')",
"gateway": "('DASHBOARD_LAYOUT_TABLE', 'DASHBOARD_LAYOUT_LIST', 'DASHBOARD_LAYOUT_GRID')",
"organization": "('DASHBOARD_LAYOUT_TABLE', 'DASHBOARD_LAYOUT_LIST', 'DASHBOARD_LAYOUT_GRID')",
"overview": "('DASHBOARD_LAYOUT_TABLE', 'DASHBOARD_LAYOUT_LIST', 'DASHBOARD_LAYOUT_GRID')",
"user": "('DASHBOARD_LAYOUT_TABLE', 'DASHBOARD_LAYOUT_LIST', 'DASHBOARD_LAYOUT_GRID')"
},
"sort_by": {
"api_key": "same fields allowed in the respective list entity request",
"application": "same fields allowed in the respective list entity request",
"collaborator": "same fields allowed in the respective list entity request",
"end_device": "same fields allowed in the respective list entity request",
"gateway": "same fields allowed in the respective list entity request",
"organization": "same fields allowed in the respective list entity request",
"user": "same fields allowed in the respective list entity request"
}
} The idea here is that the front-end team can add new fields to the Changes introduced by #6968 A new registry was added lorawan-stack/api/ttn/lorawan/v3/user_services.proto Lines 176 to 208 in 282b6a3
The operations are quite straight forward. Bookmarks are entities that can be soft-deleted but not by any of the So when user-X has a bookmark to entity-Y, if entity-Y is deleted and restored the bookmark will remain present and it Additionally there is support for listing deleted bookmarks: lorawan-stack/api/ttn/lorawan/v3/user.proto Lines 554 to 555 in 282b6a3
But I'm not sure if it is wise to show deleted bookmarks, unless requested by users later on. |
Thank you! I believe we can close this issue then, since all Console related issues are filed individually. cc @ryaplots |
Summary
As part of the ongoing UX improvement plans for the Console, it will be beneficial to store certain user preferences in the user record so they can be accessed universally.
Current Situation
Right now, it is only possible to store attributes to entities (including users). Using this interface is only good for storing strings. This means that while we could store some data as simple strings and/or JSON, this approach has a couple of drawbacks:
I believe this why we should think of a new way to store such data.
Why do we need this? Who uses it, and when?
We need this for purposes such as:
There are various other ways we could make use of such user data.
Proposed Implementation
First of all, I want to point out that while using browser-based storage such as cookies/local storage can be used to address this issue as well, the biggest drawback is that such preferences would be attached to the browser and as such lost whenever a user logs in from a different browser (eg when using mobile). This is less dramatic for some settings such as preferred sort orders, but would become more frustrating when storing bookmarks such as favorite end devices or gateways.
As such, I see two remaining options:
Backend-for-frontend
This approach would mean that we set up a small service (eg. express.js server) that would connect to a database to store such user-defined data and generally act as a middleware between Console and backend.
Pros:
Cons:
Extend user registry
This is I guess the most intuitive approach, where we would add new fields to the user schema that are then handled exclusively by the Console to store user preferences.
Pros:
Cons:
I myself would lean to the latter approach but I might not understand all possible concerns, so I'd like to gather some opinions here so we can decide which approach to take.
cc @adriansmares @johanstokking @KrishnaIyer
Contributing
Code of Conduct
The text was updated successfully, but these errors were encountered: