Test Current version and apply changes
[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
index d211e94..164f0ac 100644 (file)
@@ -1,4 +1,13 @@
-<h6 class="create-title">CREATE</h6>
+
+<div class="row template-mapping-action">
+    <div class="col">
+        <h6 class="create-title">Create Template</h6>
+    </div>
+    <div class="col text-right">
+        <button (click)="cancel()" [disabled]="fileName?.length <=0" class="btn btn-outline-secondary">Cancel</button>
+        <button (click)="saveToStore()" [disabled]="fileName?.length <=0" class="btn btn-primary">Finish</button>
+    </div>
+</div>
 <div class="card creat-card">
     <div class="single-line-model">
         <label class="label-name">Name
         </label>
 
         <div class="label-input">
-            <input type="input" [(ngModel)]="fileName" placeholder="Topology name.vLB.CDS">
+            <input type="input" [disabled]="edit" [(ngModel)]="fileName" placeholder="Template name" name="templateName"
+                autofocus [autofocus]="true">
         </div>
     </div>
 </div>
 
 <div class="template-mapping-accordion">
-    <div id="accordion">
+    <div class="accordion" id="accordion">
         <div class="card">
             <div class="card-header" id="headingOne">
                 <h5 class="mb-0 d-flex justify-content-between">
                     <button class="btn btn-link" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true"
                         aria-controls="collapseOne">
-                        1. Create Template
+                        1. Template <span class="accordian-title">{{currentTemplate?.fileName?.split('/')[1]}}</span>
                     </button>
 
                 </h5>
                                 </span>
                             </label>
                         </div>
-                    </div> 
+                    </div>
                     <div class="create-template-import">Use the editor to add parameters or you can also
                         <a href="#" data-toggle="modal" (click)="allowedExt=[getFileExtension()]"
-                            data-target="#exampleModal">Import
-                            File</a></div>
-                    <div class="editor-container">
+                            data-target="#templateModal"><b>Import
+                                File</b></a></div>
+                    <div class="editor-container mb-4">
                         <app-source-editor (textChange)="textChanges($event,templateInfo.fileName)"
                             [(text)]="templateFileContent"></app-source-editor>
                     </div>
                 <h5 class="mb-0">
                     <button class="btn btn-link collapsed" data-toggle="collapse" data-target="#collapseTwo"
                         aria-expanded="false" aria-controls="collapseTwo">
-                        2. Manage Mapping
+                        2. Manage Mapping <span
+                            class="accordian-title">{{currentMapping?.fileName?.split('/')[1]}}</span>
                     </button>
                 </h5>
             </div>
             <div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordion">
                 <div class="card-body">
-                    <h6 class="text-center">Select a source to load config parameters</h6>
+                    <p class="text-center"><b>Select a source to load config parameters</b></p>
                     <div class="text-center">
-                        <a href="#" (click)="getMappingTableFromTemplate($event)" class="mapping-source-load">
-                            <i class="icon-current-template"></i>
+                        <button [disabled]="!(variables?.length>0 && templateFileContent?.trim()?.length > 0)"
+                            (click)="getMappingTableFromTemplate($event)" class="mapping-source-load" [ngClass]="variables?.length>0 && templateFileContent?.trim()?.length > 0
+                            ?'hover-enable':'hover-disable'">
+                            <i class="icon-use-attributes"></i>
                             <br />
                             <span>Use Current Template Instance</span>
-                        </a>
-                        <a href="#" (click)="allowedExt=['.csv']" data-toggle="modal" data-target="#exampleModal"
+                        </button>
+                        <a href="#" (click)="allowedExt=['.csv']" data-toggle="modal" data-target="#templateModal"
                             class="mapping-source-load">
-                            <i class="icon-Upload-attribute"></i>
+                            <i class="icon-upload-attributes"></i>
                             <br />
-                            <div>Upload attribute list</div>
+                            <div>Upload Attributes List</div>
                             <div class="source-load-note">(Should be comma delimited file)</div>
                         </a>
                         <!-- <a href="#" class="mapping-source-load">
                         <tbody>
                             <tr *ngFor="let dict of resourceDictionaryRes">
                                 <td>
-                                    <i *ngIf="dict.definition?.property?.required" class="fa fa-check-square mx-2"></i>
-                                    <i *ngIf="!dict.definition?.property?.required" class="fa fa-square mx-2"></i>
+                                    <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>
                                 <td>
-                                    <select class="custom-select" (click)="testOption(dict,$event)">
+                                    <select class="custom-select" (click)="selectSource(dict,$event)">
                                         <option *ngFor="let val of dict.definition.sources | keyvalue">
                                             {{initMap(dict.name,val)}}
                                         </option>
                     </table>
                 </div>
 
+                <div id="mapping-table" [hidden]="mappingRes?.length == 0" class="mx-4 my-2">
+                    <table datatable [dtOptions]="dtOptions" [dtTrigger]="resTableDtTrigger" class="row-border hover">
+                        <thead>
+                            <tr>
+                                <th>Required</th>
+                                <th>Parameter Name</th>
+                                <th>Dictionary Name</th>
+                                <th>Dictionary Source</th>
+                                <th>Dependancies</th>
+                                <th>Default</th>
+                                <th>Data Type</th>
+                                <th>Entry Schema</th>
+                            </tr>
+                        </thead>
+                        <tbody>
+                            <tr *ngFor="let dict of mappingRes">
+                                <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">
+                                </td>
+                                <td>{{ dict['name'] }}</td>
+                                <td>{{ dict['name'] }}</td>
+                                <td>
+                                    <input type="text" class="form-control" [value]="dict['dictionary-source']"
+                                        disabled>
+
+                                </td>
+                                <td>
+                                    <input type="text" class="form-control" [value]="dict['dependencies']" disabled>
+                                    <!-- {{ dict.definition.sources }} -->
+                                </td>
+                                <td>{{ dict['property']['default'] }}</td>
+                                <td>{{ dict['property']['type'] }}</td>
+                                <td>{{ dict['property']['entry_schema'] }}</td>
+                            </tr>
+                        </tbody>
+                    </table>
+                </div>
+
 
             </div>
 
 
         </div>
-        <div class="template-mapping-action">
-            <button class="btn btn-sm btn-outline-secondary">Cancel</button>
-            <button (click)="saveToStore()" class="btn btn-sm btn-primary">Finish</button>
-        </div>
+
     </div>
 </div>
 
 
-<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
+<div class="modal fade" id="templateModal" tabindex="-1" role="dialog" aria-labelledby="templateModalLabel"
     aria-hidden="true">
     <div class="modal-dialog" role="document">
         <div class="modal-content">
             <div class="modal-header">
-                <h5 class="modal-title" id="exampleModalLabel">Import File</h5>
+                <h5 class="modal-title" id="templateModalLabel">Import File</h5>
                 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
-                    <span aria-hidden="true">&times;</span>
+                    <img src="assets/img/icon-close.svg" />
                 </button>
             </div>
             <div class="modal-body">
-                <ngx-file-drop [accept]="allowedExt" dropZoneLabel="Drop files here" (onFileDrop)="dropped($event)"
-                    (onFileOver)="fileOver($event)" (onFileLeave)="fileLeave($event)">
+                <ngx-file-drop [multiple]="false" [accept]="allowedExt" dropZoneLabel="Drop files here"
+                    (onFileDrop)="dropped($event)" (onFileOver)="fileOver($event)" (onFileLeave)="fileLeave($event)">
                     <ng-template ngx-file-drop-content-tmp let-openFileSelector="openFileSelector">
                         <div class="folder-upload">
                             <img src="assets/img/folder-upload.svg" />
                         </div>
                     </ng-template>
                 </ngx-file-drop>
-                <div class="upload-table" *ngFor="let item of uploadedFiles; let i=index">
+                <div class="upload-table">
                     <table class="table">
                         <thead>
-                            <tr>
-                                <th>Name : {{ item.name }}</th>
+                            <tr *ngFor="let item of uploadedFiles; let i=index">
+                                <th width="40"><img src="assets/img/icon-file-code.svg" /></th>
+                                <th>{{ item.name }}</th>
+                                <th width="40" class="text-right"><img src="assets/img/icon-remove-file.svg" /></th>
                             </tr>
                         </thead>
                     </table>
                 <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal"
                     (click)="resetTheUploadedFiles()">Cancel
                 </button>
-                <button type="button" class="btn btn-sm btn-primary" data-dismiss="modal"
-                    (click)="uploadFile();openListView()">
+
+                <button (click)="uploadFile();openListView()" class="btn btn-sm btn-primary" data-dismiss="modal"
+                    type="button">
                     Import
                 </button>
             </div>