-
Notifications
You must be signed in to change notification settings - Fork 9
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
Ms2/config versioning #433
base: main
Are you sure you want to change the base?
Conversation
…versions except the latest disabled
…s2/config_versioning
…s latest" now causes navigation to latest version
This comment has been minimized.
This comment has been minimized.
versionDescription: string; | ||
}) => { | ||
const versionId = v4(); | ||
await addParentConfigVersion(parentConfig, environment.spaceId, versionId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should check for a user error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What kind of error do you mean?
...gement-system-v2/app/(dashboard)/[environmentId]/machine-config/[configId]/config-editor.tsx
Outdated
Show resolved
Hide resolved
...gement-system-v2/app/(dashboard)/[environmentId]/machine-config/[configId]/config-editor.tsx
Outdated
Show resolved
Hide resolved
version | ||
? (storedData.versionedParentConfigs[parentConfig.id][version] = { | ||
...parentConfig, | ||
targetConfig: targetConfigToStorage(parentConfig.id, targetConfig, newId), | ||
machineConfigs: machineConfigsToStorage(parentConfig.id, machineConfigs, newId), | ||
metadata: parametersToStorage(parentConfig.id, 'parent-config', metadata, newId), | ||
}) | ||
: (storedData.parentConfigs[parentConfig.id] = { | ||
...parentConfig, | ||
targetConfig: targetConfigToStorage(parentConfig.id, targetConfig, newId), | ||
machineConfigs: machineConfigsToStorage(parentConfig.id, machineConfigs, newId), | ||
metadata: parametersToStorage(parentConfig.id, 'parent-config', metadata, newId), | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both of these are storing the same value, you could store it in a variable and the conditionally store it.
Also, since in the lines above you set storedData.versionedParentConfigs[parentConfig.id] = {}
, the second case wouldn't happen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, but what do you mean when you say the second case wouldn't happen? The conditional branch only depends on the version string which is not changed
@@ -571,6 +638,23 @@ export async function addParentConfig( | |||
} | |||
} | |||
|
|||
// TODO | |||
export async function setParentConfigVersionAsLatest(machineConfigInput: ParentConfig) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im a bit confused as to what this function does, could you explain it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This copies the data of a specific config-version into the editable "main-config" displayed as latest version. This is to provide the same functionality as the process-versions
@@ -33,6 +34,8 @@ type StoredConfigsAndParameters = { | |||
machineConfigs: Record<string, StoredMachineConfig>; | |||
targetConfigs: Record<string, StoredTargetConfig>; | |||
parameters: Record<string, StoredParameter>; | |||
// versionedParentConfigs: Record<string, StoredParentConfig>; | |||
versionedParentConfigs: Record<string, Record<string, StoredParentConfig>>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the versionId should be a part of the config?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is. The type StoredParentConfig
contains the field version
to keep track of the version number.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ Successfully created Preview Deployment. |
Summary
This re-enables the versioning for configs/techdata sets in a similar fashion to the process versioning. This state is usable and presentable eventhough some problems still persist. For example linked parameters are currently not referenced correctly when versioned and also deletion of a config may cause version data to stay unreferenced in storage.
Details
versionedParentConfigs
added to the techdata-storeaddParentConfigVersion()
added to store a new version of the current statesetParentConfigVersionAsLatest
added overwrite latest config