EasyRecon/Hunt3r

View on GitHub
frontend/src/app/admin/tools/tools.component.html

Summary

Maintainability
Test Coverage
<nb-layout>

  <nb-layout-header>
    <nb-sidebar-toggle style="width:100vw"></nb-sidebar-toggle>
  </nb-layout-header>

  <nb-sidebar left tag="left" state="expanded">
    <nb-menu-services></nb-menu-services>
  </nb-sidebar>




  <nb-layout-column>
    
    <nb-card  [nbSpinner]="loading" nbSpinnerStatus="primary" >
     
      <nb-card-body>
        <h3>Tools settings</h3><br>
        <div class="addGrp">
          <nb-select  placeholder="Select a tool" #toolSelected>
            <nb-option *ngFor="let item of this.toolsList"  value="{{item}}">{{item}}</nb-option>
          </nb-select>
          <button type="button" nbButton status="success"  (click)="createModal(toolSelected.selected)"><nb-icon icon="plus-outline" ></nb-icon></button>
        </div>

              <table >
          <tr>
            <th>Name</th>
            <th>Registered settings</th>
            <th>Action</th>

            
          </tr>
          <tr *ngFor="let item of this.tools">
            <td>{{ item.name }}</td>
            <td>{{ getKey(item.name) }}</td>

            <td>
              <div class="row actionGrp" >
                <div class="col">
                  <button type="button" (click)="updateModal(item.name)" nbButton status="success"><nb-icon icon="edit-outline" ></nb-icon></button>
                </div>
                <div class="col">
                 <!-- <button type="button" (click)="deleteToolsSettings(item.name)" nbButton status="danger"><nb-icon icon="trash-outline" ></nb-icon></button>-->
                </div>
              </div>
            </td>
          </tr>
        </table>
      </nb-card-body>

  </nb-card>
  
   <ng-template #dialogCreateGlobal let-data let-ref="dialogCreateGlobal">
    <nb-card  >
      <nb-card-header>Create tool config</nb-card-header>
      <nb-card-body style="width:900px">
        <nb-form-field class="col-md-12">
          <form  (ngSubmit)="this.updateTools($event,data.name)"  [formGroup]="toolsFormGlobal" class="col-md-12">
            <input class="col" nbInput type="hidden" value="{{data.name}}" formControlName="name" >
            <div class=" modaleBth row">
              <div class="form-group row" *ngIf="data.required.includes('webhook')">
                <label for="inputEmail1" class="label col-sm-3 col-form-label">Webhook</label>
                <div class="col-sm-9">
                  <input class="col" nbInput type="text" name="user"  formControlName="webhook" >
                </div>
              </div>
              <div class="form-group row" *ngIf="data.required.includes('url')">
                <label for="inputEmail1" class="label col-sm-3 col-form-label">URL</label>
                <div class="col-sm-9">
                  <input class="col" nbInput type="text" name="url" formControlName="url" >
                </div>
              </div>
              <div class="form-group row" *ngIf="data.required.includes('api_key')">
                <label for="inputEmail1" class="label col-sm-3 col-form-label">Api key</label>
                <div class="col-sm-9">
                  <input class="col" nbInput type="text" name="api_key" formControlName="api_key" >
                </div>
              </div>
                <div class="form-group row" *ngIf="data.required.includes('user')">
                  <label for="inputEmail1" class="label col-sm-3 col-form-label">User</label>
                  <div class="col-sm-9">
                    <input class="col" nbInput type="text" name="user" formControlName="user" >
                  </div>
                </div>
                  <div class="form-group row" *ngIf="data.required.includes('password')">
                    <label for="inputEmail1" class="label col-sm-3 col-form-label">Password</label>
                    <div class="col-sm-9">
                      <input class="col" nbInput type="password" name="password" formControlName="password" >
                    </div>
                  </div>
                  <div class="form-group row" *ngIf="data.required.includes('config_value')">
                    <label for="inputEmail1" class="label col-sm-3 col-form-label">Configuration file</label>
                    <div class="col-sm-9">
                      <textarea nbInput fullWidth placeholder="Textarea" class="" formControlName="config_value" ></textarea>
                    </div>
                  </div>
              <div class="col">
                <button nbButton (click)="closeModal()">Cancel</button>
              </div>
              <div class="col">
                <button type="submit" nbButton status="success">Update</button>
              </div>
            </div>
          </form>
        </nb-form-field>
      </nb-card-body>
    </nb-card>
  </ng-template>
  
  </nb-layout-column>



</nb-layout>