Merge "Fix long package name and apply mapping table style"
[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 <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 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. Create Template
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
74                     </button>
75                 </h5>
76             </div>
77             <div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordion">
78                 <div class="card-body">
79                     <p class="text-center"><b>Select a source to load config parameters</b></p>
80                     <div class="text-center">
81                         <a href="#" (click)="getMappingTableFromTemplate($event)" class="mapping-source-load">
82                             <i class="icon-use-attributes"></i>
83                             <br />
84                             <span>Use Current Template Instance</span>
85                         </a>
86                         <a href="#" (click)="allowedExt=['.csv']" data-toggle="modal" data-target="#templateModal"
87                             class="mapping-source-load">
88                             <i class="icon-upload-attributes"></i>
89                             <br />
90                             <div>Upload Attributes List</div>
91                             <div class="source-load-note">(Should be comma delimited file)</div>
92                         </a>
93                         <!-- <a href="#" class="mapping-source-load">
94                             <i class="icon-import-cds"></i>
95                         <br/>
96                             <span>Import from SDC Model</span>
97                         </a> -->
98                     </div>
99
100                     <div class="table-container">
101
102
103                     </div>
104                 </div>
105                 <div id="mapping-table" [hidden]="resourceDictionaryRes?.length == 0" class="mx-4 my-2">
106                     <table datatable [dtOptions]="dtOptions" [dtTrigger]="dtTrigger" class="row-border hover">
107                         <thead>
108                             <tr>
109                                 <th>Required</th>
110                                 <th>Parameter Name</th>
111                                 <th>Dictionary Name</th>
112                                 <th>Dictionary Source</th>
113                                 <th>Dependancies</th>
114                                 <th>Default</th>
115                                 <th>Data Type</th>
116                                 <th>Entry Schema</th>
117                             </tr>
118                         </thead>
119                         <tbody>
120                             <tr *ngFor="let dict of resourceDictionaryRes">
121                                 <td>
122                                     <img *ngIf="dict.definition?.property?.required" src="/assets/img/icon-required-yes.svg">
123                                     <img *ngIf="!dict.definition?.property?.required" src="/assets/img/icon-required-no.svg">
124                                 </td>
125                                 <td>{{ dict.name }}</td>
126                                 <td>{{ dict.name }}</td>
127                                 <td>
128                                     <select class="custom-select" (click)="selectSource(dict,$event)">
129                                         <option *ngFor="let val of dict.definition.sources | keyvalue">
130                                             {{initMap(dict.name,val)}}
131                                         </option>
132
133                                     </select>
134                                 </td>
135                                 <td>
136                                     <!-- <select class="custom-select">
137                                         <option *ngFor="let val of getKeys(dependancies)">
138                                             {{ getValue(dict.name)}}</option>
139
140                                     </select> -->
141                                     <input type="text" class="form-control" [ngModel]="getValue(dict.name)">
142                                     <!-- {{ dict.definition.sources }} -->
143                                 </td>
144                                 <td>{{ dict.definition?.property?.default }}</td>
145                                 <td>{{ dict.definition?.property?.type }}</td>
146                                 <td>{{ dict.definition?.property['entry_schema'] }}</td>
147                             </tr>
148                         </tbody>
149                     </table>
150                 </div>
151
152                 <div id="mapping-table" [hidden]="mappingRes?.length == 0" class="mx-4 my-2">
153                     <table datatable [dtOptions]="dtOptions" [dtTrigger]="resTableDtTrigger" class="row-border hover">
154                         <thead>
155                             <tr>
156                                 <th>Required</th>
157                                 <th>Parameter Name</th>
158                                 <th>Dictionary Name</th>
159                                 <th>Dictionary Source</th>
160                                 <th>Dependancies</th>
161                                 <th>Default</th>
162                                 <th>Data Type</th>
163                                 <th>Entry Schema</th>
164                             </tr>
165                         </thead>
166                         <tbody>
167                             <tr *ngFor="let dict of mappingRes">
168                                 <td>
169                                     <img *ngIf="dict.definition?.property?.required" src="/assets/img/icon-required-yes.svg">
170                                     <img *ngIf="!dict.definition?.property?.required" src="/assets/img/icon-required-no.svg">
171                                 </td>
172                                 <td>{{ dict['name'] }}</td>
173                                 <td>{{ dict['name'] }}</td>
174                                 <td>
175                                     <input type="text" class="form-control" [value]="dict['dictionary-source']"
176                                         disabled>
177
178                                 </td>
179                                 <td>
180                                     <input type="text" class="form-control" [value]="dict['dependencies']" disabled>
181                                     <!-- {{ dict.definition.sources }} -->
182                                 </td>
183                                 <td>{{ dict['property']['default'] }}</td>
184                                 <td>{{ dict['property']['type'] }}</td>
185                                 <td>{{ dict['property']['entry_schema'] }}</td>
186                             </tr>
187                         </tbody>
188                     </table>
189                 </div>
190
191
192             </div>
193
194
195         </div>
196         <div class="template-mapping-action">
197             <button class="btn btn-outline-secondary">Cancel</button>
198             <button (click)="saveToStore()" class="btn btn-primary">Submit</button>
199         </div>
200     </div>
201 </div>
202
203
204 <div class="modal fade" id="templateModal" tabindex="-1" role="dialog" aria-labelledby="templateModalLabel"
205     aria-hidden="true">
206     <div class="modal-dialog" role="document">
207         <div class="modal-content">
208             <div class="modal-header">
209                 <h5 class="modal-title" id="templateModalLabel">Import File</h5>
210                 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
211                     <img src="assets/img/icon-close.svg" />
212                 </button>
213             </div>
214             <div class="modal-body">
215                 <ngx-file-drop [multiple]="false" [accept]="allowedExt" dropZoneLabel="Drop files here" (onFileDrop)="dropped($event)"
216                     (onFileOver)="fileOver($event)" (onFileLeave)="fileLeave($event)">
217                     <ng-template ngx-file-drop-content-tmp let-openFileSelector="openFileSelector">
218                         <div class="folder-upload">
219                             <img src="assets/img/folder-upload.svg" />
220                         </div>
221                         <div class="folder-upload-text">
222                             Drag & Drop file
223                         </div>
224                         <div class="folder-upload-text">or
225                             <button type="button" class="btn btn-sm btn-primary" (click)="openFileSelector()">Browse
226                                 Files
227                             </button>
228                         </div>
229                         <div class="folder-upload-type">Allowed file type:
230                             {{allowedExt}}
231                         </div>
232                     </ng-template>
233                 </ngx-file-drop>
234                 <div class="upload-table">
235                     <table class="table">
236                         <thead>
237                             <tr *ngFor="let item of uploadedFiles; let i=index">
238                                 <th width="40"><img src="assets/img/icon-file-code.svg" /></th>
239                                 <th>{{ item.name }}</th>
240                                 <th width="40" class="text-right"><img src="assets/img/icon-remove-file.svg" /></th>
241                             </tr>
242                         </thead>
243                     </table>
244                 </div>
245             </div>
246
247             <div class="modal-footer">
248                 <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal"
249                     (click)="resetTheUploadedFiles()">Cancel
250                 </button>
251                 <button type="button" class="btn btn-sm btn-primary" data-dismiss="modal"
252                     (click)="uploadFile();openListView()">
253                     Import
254                 </button>
255             </div>
256         </div>
257     </div>
258 </div>