Always write Config's namespace and dashboard accepts a default one (#10572)

Closes #10564. Dashboard accepts only projects with non-empty namespace.
The change in project-manager ensures that we serialize `namespace` even if it is a default one.
The change in dashboard ensures that namespace can be empty.
This commit is contained in:
Hubert Plociniczak 2024-07-18 12:29:37 +02:00 committed by GitHub
parent 0f31fee5ef
commit 473a51cee7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 4 deletions

View File

@ -412,7 +412,7 @@ function extractProjectMetadata(yamlObj: unknown, jsonObj: unknown): ProjectMeta
} }
const name = 'name' in yamlObj && typeof yamlObj.name === 'string' ? yamlObj.name : null const name = 'name' in yamlObj && typeof yamlObj.name === 'string' ? yamlObj.name : null
const namespace = const namespace =
'namespace' in yamlObj && typeof yamlObj.namespace === 'string' ? yamlObj.namespace : null 'namespace' in yamlObj && typeof yamlObj.namespace === 'string' ? yamlObj.namespace : 'local'
const engineVersion = const engineVersion =
'edition' in yamlObj && typeof yamlObj.edition === 'string' ? yamlObj.edition : null 'edition' in yamlObj && typeof yamlObj.edition === 'string' ? yamlObj.edition : null
const id = 'id' in jsonObj && typeof jsonObj.id === 'string' ? jsonObj.id : null const id = 'id' in jsonObj && typeof jsonObj.id === 'string' ? jsonObj.id : null
@ -424,7 +424,7 @@ function extractProjectMetadata(yamlObj: unknown, jsonObj: unknown): ProjectMeta
'lastOpened' in jsonObj && typeof jsonObj.lastOpened === 'string' ? 'lastOpened' in jsonObj && typeof jsonObj.lastOpened === 'string' ?
validDateString(jsonObj.lastOpened) validDateString(jsonObj.lastOpened)
: null : null
if (name != null && namespace != null && id != null && created != null) { if (name != null && id != null && created != null) {
return { return {
name, name,
namespace, namespace,

View File

@ -249,8 +249,7 @@ object Config {
value.normalizedName.foreach(v => value.normalizedName.foreach(v =>
elements.add((JsonFields.NormalizedName, v)) elements.add((JsonFields.NormalizedName, v))
) )
if (value.namespace != DefaultNamespace) elements.add((JsonFields.Namespace, value.namespace))
elements.add((JsonFields.Namespace, value.namespace))
if (value.version != DefaultVersion) if (value.version != DefaultVersion)
elements.add( elements.add(
(JsonFields.Version, value.version) (JsonFields.Version, value.version)