diff options
author | Ahmedeldeeb50 <ahmed.eldeeb.ext@orange.com> | 2020-10-27 18:16:58 +0200 |
---|---|---|
committer | Ahmedeldeeb50 <ahmed.eldeeb.ext@orange.com> | 2020-10-27 18:16:58 +0200 |
commit | 1d9cc25a7c3634f787057c0b95b88b0016c862ec (patch) | |
tree | 5b7957eb1554d8363b5c28a3f80b0b0dfa05f330 /cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models | |
parent | 7004cffc6b82c448abe62b1642b91f2e45ec2e0b (diff) |
enable editing in mapping table
Issue-ID: CCSDK-2795
Signed-off-by: Ahmedeldeeb50 <ahmed.eldeeb.ext@orange.com>
Change-Id: I724dee3bd4a4778bf86619ff08091b31925c1830
Diffstat (limited to 'cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models')
-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() |