add alert message for empty or invalid template file.
Issue-ID: CCSDK-2795
Signed-off-by: Ahmedeldeeb50 <ahmed.eldeeb.ext@orange.com>
Change-Id: Ic03b633b0ce51d0193f9c7c589bd69e4b72b2d92
private dependanciesSource: Map<string, string>) { }
ToMapping(): Mapping {
- // console.log(this.resourceDictionary.definition.property);
+ // console.log(this.resourceDictionary.definition.property);
const mapping = new Mapping();
mapping.name = this.resourceDictionary.name;
mapping.dictionaryName = this.resourceDictionary.name;
mapping.property = Object.assign({}, this.resourceDictionary.definition.property);
- mapping.inputParam = false;
+ mapping.inputParam = this.resourceDictionary['input-param'] || false;
+ // tslint:disable-next-line: no-string-literal
+ mapping.property['required'] = this.resourceDictionary['required'] || false;
mapping.dictionarySource = this.dependanciesSource.get(mapping.name);
if (this.dependancies.get(mapping.name)) {
mapping.dependencies = this.dependancies.get(mapping.name);
<tr>
<th></th>
<th>Required</th>
+ <th>Template Input</th>
<th>Parameter Name</th>
<th>Dictionary Name</th>
<th>Dictionary Source</th>
</td>
<td>
<div class="custom-control custom-checkbox reuiredInput">
- <input type="checkbox" class="custom-control-input"
- id="customCheck-{{dict.name}}" [checked]="selectedProps.has(dict.name)"
- (click)="selectProp(dict.name)">
- <label class="custom-control-label" for="customCheck-{{dict.name}}"></label>
+ <input type="checkbox" class="custom-control-input" #requiredInput
+ (click)="setProp(requiredInput,'required',i)"
+ id="requiredCheck-{{dict.name}}">
+ <label class="custom-control-label" for="requiredCheck-{{dict.name}}"></label>
+ </div>
+ </td>
+ <td>
+ <div class="custom-control custom-checkbox reuiredInput">
+ <input type="checkbox" class="custom-control-input" #tempInput
+ (click)="setProp(tempInput,'input-param',i)" id="inputCheck-{{dict.name}}">
+ <label class="custom-control-label" for="inputCheck-{{dict.name}}"></label>
</div>
-
- <img *ngIf="dict.definition?.property?.required"
- src="/assets/img/icon-required-yes.svg">
- <img *ngIf="!dict.definition?.property?.required"
- src="/assets/img/icon-required-no.svg">
</td>
<td>{{ dict.name }}</td>
<td>{{ dict.name }}</td>
<tr>
<!-- <th></th> -->
<th>Required</th>
+ <th>Template Input</th>
<th>Parameter Name</th>
<th>Dictionary Name</th>
<th>Dictionary Source</th>
</div>
</td> -->
<td>
- <img *ngIf="dict.definition?.property?.required"
- src="/assets/img/icon-required-yes.svg">
- <img *ngIf="!dict.definition?.property?.required"
- src="/assets/img/icon-required-no.svg">
+ <img *ngIf="dict?.property?.required" src="/assets/img/icon-required-yes.svg">
+ <img *ngIf="!dict?.property?.required" src="/assets/img/icon-required-no.svg">
+ </td>
+ <td>
+ <img *ngIf="dict['input-param']" src="/assets/img/icon-required-yes.svg">
+ <img *ngIf="!dict['input-param']" src="/assets/img/icon-required-no.svg">
</td>
<td>{{ dict['name'] }}</td>
<td>{{ dict['name'] }}</td>
pageLength: 25,
destroy: true,
retrieve: true,
+ columnDefs: [
+ {
+ targets: [0, 1, 2], // column or columns numbers
+ orderable: false, // set orderable for selected columns
+ searchable: false,
+ },
+
+ ],
};
this.dtOptions = {
pagingType: 'full_numbers',
};
}
+ setProp(e, propName, index) {
+ this.resourceDictionaryRes[index][propName] = e.checked;
+ console.log(this.resourceDictionaryRes[index]);
+ }
selectProp(value) {
console.log(value);
if (this.selectedProps.has(value)) {
}, err => {
this.toastr.error('Error');
});
+ } else {
+ this.toastr.error('Empty or Invalid file format. Validate your file first');
}
}
// Do not forget to unsubscribe the event
this.dtTrigger.unsubscribe();
this.resTableDtTrigger.unsubscribe();
+ // this.templateStore.unsubscribe();
}
}
-import { Component, EventEmitter, OnInit, Output } from '@angular/core';
+import { Component, EventEmitter, OnDestroy, OnInit, Output } from '@angular/core';
import { PackageCreationStore } from '../../package-creation.store';
import { Mapping, Template } from '../../mapping-models/CBAPacakge.model';
import { TemplateInfo, TemplateStore } from '../../template.store';
templateUrl: './templ-mapp-listing.component.html',
styleUrls: ['./templ-mapp-listing.component.css']
})
-export class TemplMappListingComponent implements OnInit {
+export class TemplMappListingComponent implements OnInit, OnDestroy {
@Output() showCreationView = new EventEmitter<any>();
@Output() showListView = new EventEmitter<any>();
templateAndMappingMap = new Map<string, TemplateAndMapping>();
) {
}
+ ngOnDestroy(): void {
+ // this.templateStore.unsubscribe();
+ // this.packageCreationStore.unsubscribe();
+ }
ngOnInit() {
if (this.route.snapshot.paramMap.has('id')) {
-import { Component, OnInit } from '@angular/core';
+import { Component, OnDestroy, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { PackageCreationStore } from '../package-creation.store';
import { SharedService } from './shared-service';
templateUrl: './template-mapping.component.html',
styleUrls: ['./template-mapping.component.css']
})
-export class TemplateMappingComponent implements OnInit {
+export class TemplateMappingComponent implements OnInit, OnDestroy {
creationView = false;
listView = true;
private sharedService: SharedService
) {
}
+ ngOnDestroy(): void {
+ // this.sharedService.list.unsubscribe();
+ // this.sharedService.mode.unsubscribe();
+ // this.pakcageStore.unsubscribe();
+ }
ngOnInit() {