Add support for server side profiles#3066
Draft
SanjulaGanepola wants to merge 14 commits into
Draft
Conversation
Signed-off-by: Sanjula Ganepola <Sanjula.Ganepola@ibm.com>
Signed-off-by: Sanjula Ganepola <Sanjula.Ganepola@ibm.com>
Signed-off-by: Sanjula Ganepola <Sanjula.Ganepola@ibm.com>
Signed-off-by: Sanjula Ganepola <Sanjula.Ganepola@ibm.com>
Signed-off-by: Sanjula Ganepola <Sanjula.Ganepola@ibm.com>
… file Signed-off-by: Sanjula Ganepola <Sanjula.Ganepola@ibm.com>
Signed-off-by: Sanjula Ganepola <Sanjula.Ganepola@ibm.com>
…ved to server profile Signed-off-by: Sanjula Ganepola <Sanjula.Ganepola@ibm.com>
Signed-off-by: Sanjula Ganepola <Sanjula.Ganepola@ibm.com>
Signed-off-by: Sanjula Ganepola <Sanjula.Ganepola@ibm.com>
Signed-off-by: Sanjula Ganepola <Sanjula.Ganepola@ibm.com>
Signed-off-by: Sanjula Ganepola <Sanjula.Ganepola@ibm.com>
Contributor
|
👋 A new build is available for this PR based on 1859135. |
Signed-off-by: Sanjula Ganepola <Sanjula.Ganepola@ibm.com>
Signed-off-by: Sanjula Ganepola <Sanjula.Ganepola@ibm.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Changes
This PR builds on #2942 to add support for server side profiles. The best approach from my testing to support multiple developers working on the same server profile, is to allow a checkout flow where users activate the server profile, freely make changes in their local copy and then explicitly push changes when ready.
Storage
When using
Create new profileorCreate new profile from current context, users will be prompted for the name of the profile as before, but will now also be prompted for the type of profile:When users select
Server, the profile will be stored in/etc/vscode/profiles.json. We will use theConfigFileAPIs to store the state of this file. All normalConnectionProfilefields will be stored in server profiles except for thehomeDirectory. I also introduced a new field calledlastUpdatedto track when the profile was last updated. This is to handle synchronization between multiple developers working on the same profile and is used to determine the server profile state (described further below). Example below:[ { "name": "My Server Profile", "currentLibrary": "QGPL", "libraryList": [ "QGPL", "QTEMP" ], "customVariables": [], "ifsShortcuts": [ "/home/SANJULA" ], "objectFilters": [], "lastUpdated": 1770679579920 } ]In the user's
settings.json, I kept thecurrentProfilefield in the connecting settings and introduced 2 new fields:currentProfileType: This is eitherlocalorserver.currentProfileLastKnownUpdate: Similar tolastUpdatedfromprofiles.json, but this is just the last known update at the time we loaded them. The actuallastUpdatedcould change when other developers make server profile changes, and so we compare these 2 to get the profile state (again, described further below).Profile States and Actions
There are 3 different server profile states:
1. In Sync
This is when the local copy of the server profile is in sync (in terms of the
ConnectionProfilefields).2. Modified
This is when the local copy of the server profile is not in sync (in terms of the
ConnectionProfilefields), but the timestamps are the same (currentProfileLastKnownUpdateandlastKnownUpdate). This means the user may have added/deleted/updated their library list, filters, custom variables, etc + no developer has pushed any other changes resulting in the timestamp to change.The user can continue to freely work, but they can perform the following actions at any time to push their changes to server or discard them:
3. Out of Sync
This is when the local copy of the server profile is not in sync (in terms of the
ConnectionProfilefields), but this time thelastKnownUpdateis ahead of thecurrentProfileLastKnownUpdatemeaning that some other developers on the team pushed some changes.Again, the user can continue to freely work, but they can perform the following actions at any time to force push their changes to server or discard them:
Profile State Management
As mentioned above, we will use the
ConfigFileAPIs to store the state ofprofiles.json. We want to avoid constantly having to reload this file from the server so instead we try our best to rely on the cached result when possible and only reload when necessary. The flow is described below:profiles.jsonfile is loaded and cached initially when connecting if it existsRefreshbutton on theEnvironmentview, we will reload the file from the server as this is an explicit actionModified. Technically at any point if another developer happened to push some changes to the server profile, the profile would truly be inOut of Sync, but the user would continue to seeModifiedas we have not reloaded the file (unless they clicked theRefreshbutton). This is perfectly fine as we don't want to constantly reload the config file when users make changes to their local copy. Instead we will do a reload right before attempting to actually push any updates. This will be when users try to unload, try to rename, useSave Changes to Server, orOverwrite Changes to ServerOther Minor UI Improvements
Object filterswill now show the name and descriptionUnload active profileaction moved from theProfilesheading node to the actual active profileNext Steps
Following this, I am going to explore server side actions and adding the actions API (#2802)
How to test this PR
"") which is used when no profile is activated, does not lose changes when switching between different profilesChecklist