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