Merge "added zoom in and out button in editBar"
[ccsdk/cds.git] / cds-ui / designer-client / src / app / modules / feature-modules / packages / package-creation / template-mapping / templ-mapp-creation / templ-mapp-creation.component.html
1 <div class="row template-mapping-action">
2     <div class="col">
3         <h6 [hidden]="edit" class="create-title">Create Template</h6>
4         <button (click)="closeCreationForm()" [hidden]="!edit" class="btn btn-outline-secondary"><i
5                 class="fa fa-chevron-left mr-2"></i>Template List</button>
6     </div>
7     <div class="col text-right">
8         <button (click)="cancel()" [disabled]="fileName?.length <=0" class="btn btn-outline-secondary">Cancel</button>
9         <button (click)="saveToStore()" [disabled]="fileName?.length <=0" class="btn btn-primary">Finish</button>
10     </div>
11 </div>
12 <div class="card creat-card">
13     <div class="single-line-model">
14         <label class="label-name">Name
15             <span _ngcontent-uew-c3="">*</span>
16         </label>
17
18         <div class="label-input">
19             <input type="input" [disabled]="edit" [(ngModel)]="fileName" placeholder="Template name" name="templateName"
20                 autofocus [autofocus]="true">
21         </div>
22     </div>
23 </div>
24
25 <div class="template-mapping-accordion">
26     <div class="accordion" id="accordion">
27         <div class="card">
28             <div class="card-header" id="headingOne">
29                 <h5 class="mb-0 d-flex justify-content-between">
30                     <button class="btn btn-link" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true"
31                         aria-controls="collapseOne">
32                         1. Template <span class="accordian-title">{{currentTemplate?.fileName?.split('/')[1]}}</span>
33                     </button>
34
35                 </h5>
36             </div>
37
38             <div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
39                 <div class="card-body">
40                     <div class="single-line">
41                         <label class="label-name">Template Type</label>
42                         <div class="label-input">
43                             <label name="trst" (click)="allowedExt=['.vtl']">
44                                 <input class="form-check-input" [(ngModel)]="templateExt" type="radio"
45                                     name="exampleRadios" id="exampleRadios1" value=Velcoity>
46                                 <span>
47                                     Velcoity
48                                 </span>
49                             </label>
50                             <label name="trst" (click)="allowedExt=['.j2','.jinja2']">
51                                 <input class="form-check-input" [(ngModel)]="templateExt" type="radio"
52                                     name="exampleRadios" id="exampleRadios1" value=Jinja>
53
54                                 <span>
55                                     Jinja
56                                 </span>
57                             </label>
58                             <label name="trst" (click)="allowedExt=['.kt']">
59                                 <input class="form-check-input" [(ngModel)]="templateExt" type="radio"
60                                     name="exampleRadios" id="exampleRadios1" value=Kotlin>
61
62                                 <span>
63                                     Kotlin
64                                 </span>
65                             </label>
66                         </div>
67                     </div>
68                     <div class="create-template-import">Use the editor to add parameters or you can also
69                         <a href="#" data-toggle="modal" (click)="allowedExt=[getFileExtension()]"
70                             data-target="#templateModal"><b>Import
71                                 File</b></a></div>
72                     <div class="editor-container mb-4">
73                         <app-source-editor (textChange)="textChanges($event,templateInfo.fileName)"
74                             [(text)]="templateFileContent"></app-source-editor>
75                     </div>
76                 </div>
77             </div>
78         </div>
79         <div class="card">
80             <div class="card-header" id="headingTwo">
81                 <h5 class="mb-0">
82                     <button class="btn btn-link collapsed" data-toggle="collapse" data-target="#collapseTwo"
83                         aria-expanded="false" aria-controls="collapseTwo">
84                         2. Manage Mapping <span
85                             class="accordian-title">{{currentMapping?.fileName?.split('/')[1]}}</span>
86                     </button>
87                 </h5>
88             </div>
89             <div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordion">
90                 <div class="card-body">
91                     <p class="text-center"><b>Select a source to load config parameters</b></p>
92                     <div class="text-center">
93                         <button [disabled]="!(variables?.length>0 && templateFileContent?.trim()?.length > 0)"
94                             (click)="getMappingTableFromTemplate($event)" class="mapping-source-load" [ngClass]="variables?.length>0 && templateFileContent?.trim()?.length > 0
95                             ?'hover-enable':'hover-disable'">
96                             <i class="icon-use-attributes"></i>
97                             <br />
98                             <span>Use Current Template Instance</span>
99                         </button>
100                         <a href="#" (click)="allowedExt=['.csv']" data-toggle="modal" data-target="#templateModal"
101                             class="mapping-source-load">
102                             <i class="icon-upload-attributes"></i>
103                             <br />
104                             <div>Upload Attributes List</div>
105                             <div class="source-load-note">(Should be comma delimited file)</div>
106                         </a>
107                         <!-- <a href="#" class="mapping-source-load">
108                             <i class="icon-import-cds"></i>
109                         <br/>
110                             <span>Import from SDC Model</span>
111                         </a> -->
112                     </div>
113
114                     <div class="table-container">
115
116
117                     </div>
118                 </div>
119                 <div id="mapping-table" [hidden]="resourceDictionaryRes?.length == 0" class="mx-4 my-2">
120                     <table datatable [dtOptions]="initDtOptions" [dtTrigger]="dtTrigger" class="row-border hover">
121                         <thead>
122                             <tr>
123                                 <th>Required</th>
124                                 <th>Parameter Name</th>
125                                 <th>Dictionary Name</th>
126                                 <th>Dictionary Source</th>
127                                 <th>Dependancies</th>
128                                 <th>Default</th>
129                                 <th>Data Type</th>
130                                 <th>Entry Schema</th>
131                             </tr>
132                         </thead>
133                         <tbody>
134                             <tr *ngFor="let dict of resourceDictionaryRes">
135                                 <td>
136                                     <img *ngIf="dict.definition?.property?.required"
137                                         src="/assets/img/icon-required-yes.svg">
138                                     <img *ngIf="!dict.definition?.property?.required"
139                                         src="/assets/img/icon-required-no.svg">
140                                 </td>
141                                 <td>{{ dict.name }}</td>
142                                 <td>{{ dict.name }}</td>
143                                 <td>
144                                     <select class="custom-select" (click)="selectSource(dict,$event)">
145                                         <option *ngFor="let val of dict.definition.sources | keyvalue">
146                                             {{initMap(dict.name,val)}}
147                                         </option>
148
149                                     </select>
150                                 </td>
151                                 <td>
152                                     <!-- <select class="custom-select">
153                                         <option *ngFor="let val of getKeys(dependancies)">
154                                             {{ getValue(dict.name)}}</option>
155
156                                     </select> -->
157                                     <input type="text" class="form-control" [ngModel]="getValue(dict.name)">
158                                     <!-- {{ dict.definition.sources }} -->
159                                 </td>
160                                 <td>{{ dict.definition?.property?.default }}</td>
161                                 <td>{{ dict.definition?.property?.type }}</td>
162                                 <td>{{ dict.definition?.property['entry_schema'] }}</td>
163                             </tr>
164                         </tbody>
165                     </table>
166                 </div>
167
168                 <div id="mapping-table-res" [hidden]="mappingRes?.length == 0" class="mx-4 my-2">
169                     <table datatable [dtOptions]="dtOptions" [dtTrigger]="resTableDtTrigger" class="row-border hover">
170                         <thead>
171                             <tr>
172                                 <th>Required</th>
173                                 <th>Parameter Name</th>
174                                 <th>Dictionary Name</th>
175                                 <th>Dictionary Source</th>
176                                 <th>Dependancies</th>
177                                 <th>Default</th>
178                                 <th>Data Type</th>
179                                 <th>Entry Schema</th>
180                             </tr>
181                         </thead>
182                         <tbody>
183                             <tr *ngFor="let dict of mappingRes">
184                                 <td>
185                                     <img *ngIf="dict.definition?.property?.required"
186                                         src="/assets/img/icon-required-yes.svg">
187                                     <img *ngIf="!dict.definition?.property?.required"
188                                         src="/assets/img/icon-required-no.svg">
189                                 </td>
190                                 <td>{{ dict['name'] }}</td>
191                                 <td>{{ dict['name'] }}</td>
192                                 <td>
193                                     <input type="text" class="form-control" [value]="dict['dictionary-source']"
194                                         disabled>
195
196                                 </td>
197                                 <td>
198                                     <input type="text" class="form-control" [value]="dict['dependencies']" disabled>
199                                     <!-- {{ dict.definition.sources }} -->
200                                 </td>
201                                 <td>{{ dict['property']['default'] }}</td>
202                                 <td>{{ dict['property']['type'] }}</td>
203                                 <td>{{ dict['property']['entry_schema'] }}</td>
204                             </tr>
205                         </tbody>
206                     </table>
207                 </div>
208
209
210             </div>
211
212
213         </div>
214
215     </div>
216 </div>
217
218
219 <div class="modal fade" id="templateModal" tabindex="-1" role="dialog" aria-labelledby="templateModalLabel"
220     aria-hidden="true">
221     <div class="modal-dialog" role="document">
222         <div class="modal-content">
223             <div class="modal-header">
224                 <h5 class="modal-title" id="templateModalLabel">Import File</h5>
225                 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
226                     <img src="assets/img/icon-close.svg" />
227                 </button>
228             </div>
229             <div class="modal-body">
230                 <ngx-file-drop [multiple]="false" [accept]="allowedExt" dropZoneLabel="Drop files here"
231                     (onFileDrop)="dropped($event)" (onFileOver)="fileOver($event)" (onFileLeave)="fileLeave($event)">
232                     <ng-template ngx-file-drop-content-tmp let-openFileSelector="openFileSelector">
233                         <div class="folder-upload">
234                             <img src="assets/img/folder-upload.svg" />
235                         </div>
236                         <div class="folder-upload-text">
237                             Drag & Drop file
238                         </div>
239                         <div class="folder-upload-text">or
240                             <button type="button" class="btn btn-sm btn-primary" (click)="openFileSelector()">Browse
241                                 Files
242                             </button>
243                         </div>
244                         <div class="folder-upload-type">Allowed file type:
245                             {{allowedExt}}
246                         </div>
247                     </ng-template>
248                 </ngx-file-drop>
249                 <div class="upload-table">
250                     <table class="table">
251                         <thead>
252                             <tr *ngFor="let item of uploadedFiles; let i=index">
253                                 <th width="40"><img src="assets/img/icon-file-code.svg" /></th>
254                                 <th>{{ item.name }}</th>
255                                 <th (click)="removeFile(i)" width="40" class="text-right"><img src="assets/img/icon-remove-file.svg" /></th>
256                             </tr>
257                         </thead>
258                     </table>
259                 </div>
260             </div>
261
262             <div class="modal-footer">
263                 <button type="button" class="btn btn-sm btn-secondary btn-cancel" data-dismiss="modal"
264                     (click)="resetTheUploadedFiles()">Cancel
265                 </button>
266
267                 <button data-dismiss="modal" (click)="uploadFile()" class="btn btn-sm btn-primary" type="button">
268                     Import
269                 </button>
270             </div>
271         </div>
272     </div>
273 </div>