diff options
author | 2020-10-27 18:10:56 +0000 | |
---|---|---|
committer | 2020-10-27 18:10:56 +0000 | |
commit | efc4ccc5334af213456cb105bb0c55663736a190 (patch) | |
tree | 6648d68f80b366d7e396731a17c01dedf36723e0 /cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/mappingAdapter.model.ts | |
parent | 4dd2f9d159e12e888e4e6dd9dda245e296e38b98 (diff) | |
parent | 1d9cc25a7c3634f787057c0b95b88b0016c862ec (diff) |
Merge "enable editing in mapping table"
Diffstat (limited to 'cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/mappingAdapter.model.ts')
-rw-r--r-- | cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/mappingAdapter.model.ts | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/mappingAdapter.model.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/mappingAdapter.model.ts index e63b17fa2..a994da4a3 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/mappingAdapter.model.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/mappingAdapter.model.ts @@ -1,5 +1,5 @@ import { ResourceDictionary } from './ResourceDictionary.model'; -import { JsonObject, JsonProperty, JsonConvert } from 'json2typescript'; +import { JsonObject, JsonProperty } from 'json2typescript'; // Convert ResourceDictionary object to store Mapping. export class MappingAdapter { @@ -14,17 +14,26 @@ export class MappingAdapter { const mapping = new Mapping(); mapping.name = this.resourceDictionary.name; mapping.dictionaryName = this.resourceDictionary.name; + // move all properties at once mapping.property = Object.assign({}, this.resourceDictionary.definition.property); - mapping.inputParam = this.resourceDictionary['input-param'] || false; - // tslint:disable-next-line: no-string-literal - mapping.property['required'] = this.resourceDictionary['required'] || false; + mapping.inputParam = this.resourceDictionary.definition.property['input-param'] || false; + // for reading + mapping.sources = this.resourceDictionary.definition.sources; + console.log(mapping.sources); + mapping.version = 0; + return mapping; + } + + // Get the final object to save + finalize(mapping: Mapping): Mapping { + mapping.dictionarySource = this.dependanciesSource.get(mapping.name); if (this.dependancies.get(mapping.name)) { mapping.dependencies = this.dependancies.get(mapping.name); } else { mapping.dependencies = []; } - mapping.version = 0; + delete mapping.sources; return mapping; } } @@ -39,6 +48,8 @@ export class Mapping { inputParam: boolean; @JsonProperty('dictionary-name') dictionaryName: string; + @JsonProperty(true) + sources: string[]; @JsonProperty('dictionary-source') dictionarySource: string; @JsonProperty() |