File

protocol-lpwan/multiple-lns-connectors/actility-multiple-lns-connector.component.ts

Implements

OnInit

Metadata

Index

Properties
Methods

Constructor

constructor(connectorService: MultipleLnsConnectorService, alertService: AlertService, translateService: TranslateService, modal: ModalService, modalService: BsModalService)
Parameters :
Name Type Optional
connectorService MultipleLnsConnectorService No
alertService AlertService No
translateService TranslateService No
modal ModalService No
modalService BsModalService No

Methods

Async addConnection
addConnection()
Returns : any
changePassword
changePassword()
Returns : void
Async deleteConnection
deleteConnection(connection)
Parameters :
Name Optional
connection No
Returns : any
Async loadConnections
loadConnections()
Returns : any
Async ngOnInit
ngOnInit()
Returns : any
Async resetEditedUnsavedConnection
resetEditedUnsavedConnection()
Returns : any
Async save
save()
Returns : any
Async saveConnection
saveConnection()
Returns : any
Async setModel
setModel(connectionObj: null)
Parameters :
Name Type Optional Default value
connectionObj null No null
Returns : any

Properties

connection
Default value : {} as ActilityConnection
connectionBeingEdited
Type : string
connections
Default value : Array<ActilityConnection>()
connectorsForm
Type : NgForm
Decorators :
@ViewChild('connectorsForm', {static: false})
showPassword
Type : boolean
Default value : false
state
Type : State
Default value : 'loadingConnection'
<ng-container *ngIf="state === 'loadingConnection'; else renderListAndForm">
  <c8y-loading></c8y-loading>
</ng-container>
<ng-template #renderListAndForm>
  <no-connections-found
    (onAction)="addConnection()"
    *ngIf="connections.length === 0 && state !== 'addConnections'"
  >
  </no-connections-found>
  <div>
    <div
      class="card content-fullpage split-view--5-7"
      *ngIf="connections.length !== 0 || state === 'addConnections'"
    >
      <div class="card-header separator grid__col--fullspan">
        <h4>{{ 'Connections' | translate }}</h4>
      </div>
      <div class="inner-scroll split-view__list">
        <div class="bg-gray-white flex-grow">
          <c8y-list-group class="nav c8y-nav-stacked">
            <c8y-li
              class="c8y-stacked-item p-0"
              [class.active]="connection.name === connection.name"
              *ngFor="let connection of connections; let index = index"
              (click)="setModel(connection)"
            >
              <c8y-li-icon [icon]="'plug'"></c8y-li-icon>
              <span title="{{ connection.name }}">
                {{ connection.name }}
              </span>
            </c8y-li>

            <c8y-li
              *ngIf="state === 'addConnections'"
              class="c8y-nav-stacked active"
              (click)="addConnection()"
            >
              <c8y-li-icon [icon]="'plug'"></c8y-li-icon>
              {{ 'New connection' | translate }}
            </c8y-li>
          </c8y-list-group>
        </div>
        <div class="card-footer separator-top">
          <button
            [disabled]="state === 'addConnections'"
            title="{{ 'Add connection' | translate }}"
            class="btn btn-default"
            (click)="addConnection()"
          >
            <i [c8yIcon]="'plus-circle'"></i>
            {{ 'Add connection' | translate }}
          </button>
        </div>
      </div>

      <!-- 'split-view__detail--selected' condition needs to be fixed. this is needed so that both columns are visible in tablet format -->

      <div
        class="inner-scroll split-view__detail"
        ng-class="{ 'split-view__detail--selected': vm.selected && vm.jsonSchemaObjects }"
      >
        <div class="card-header separator visible-sm visible-xs fit-w sticky-top">
          <button
            title="{{ 'Back' | translate }}"
            class="btn btn-clean text-primary"
            ng-click="vm.deselect()"
          >
            <i [c8yIcon]="'chevron-left'"></i>
            <span>{{ 'Back' | translate }}</span>
          </button>
        </div>
        <form #connectorsForm="ngForm" class="d-contents">
          <div class="flex-grow">
            <div class="card-block large-padding">
              <c8y-form-group>
                <label for="name">
                  {{ 'Name' | translate }}
                </label>
                <input
                  type="text"
                  class="form-control"
                  [placeholder]="'e.g. Actility connection' | translate"                  
                  id="name"
                  name="name"
                  [(ngModel)]="connection.name"
                  required
                />
              </c8y-form-group>

              <c8y-form-group>
                <label for="description">
                  {{ 'Description' | translate }}
                </label>
                <input
                  type="text"
                  class="form-control"
                  [placeholder]="'e.g. This connection has a built-in functionality to detect...' | translate"
                  id="description"
                  name="description"
                  [(ngModel)]="connection.description"                  
                />
              </c8y-form-group>

              <c8y-form-group>
                <label for="baseUrl">
                  {{ 'URL' | translate }}
                </label>
                <input
                  type="text"
                  class="form-control"
                  [placeholder]="
                    'e.g. {{ example }}' | translate: { example: 'https://dx-api.thingpark.io' }
                  "
                  id="baseUrl"
                  name="baseUrl"
                  [(ngModel)]="connection.baseUrl"
                  required
                />
              </c8y-form-group>
              <c8y-form-group>
                <label for="profileId">
                  {{ 'Profile ID' | translate }}
                </label>
                <input
                  type="text"
                  class="form-control"
                  [placeholder]="'e.g. {{ example }}' | translate: { example: 'dev1-api' }"
                  id="profileId"
                  name="profileId"
                  [(ngModel)]="connection.profileId"
                  required
                />
              </c8y-form-group>
              <c8y-form-group>
                <label for="username">
                  {{ 'Username' | translate }}
                </label>
                <input
                  type="text"
                  class="form-control"
                  placeholder="{{ 'e.g. joe`LOCALIZE`' | translate }}"
                  id="username"
                  name="username"
                  [(ngModel)]="connection.username"
                  required
                />
              </c8y-form-group>

              <c8y-form-group *ngIf="showPassword">
                <label for="password">
                  {{ 'Password' | translate }}
                </label>
                <input
                  type="password"
                  class="form-control"
                  placeholder="{{ 'e.g. my_password' | translate }}"
                  id="password"
                  name="password"
                  [(ngModel)]="connection.password"
                  [required]="state === 'addConnections'"
                />
              </c8y-form-group>
              <button
                *ngIf="state === 'updateConnection'"
                type="button"
                class="btn btn-default"
                name="changePassword"
                (click)="changePassword()"
              >
                <span title="{{ 'Change password' | translate }}" *ngIf="!showPassword">{{
                  'Change password' | translate
                }}</span>
                <span title="{{ 'Cancel password change' | translate }}" *ngIf="showPassword">{{
                  'Cancel password change' | translate
                }}</span>
              </button>
            </div>
          </div>

          <div class="card-footer separator-top">
            <button
              title="{{ 'Cancel' | translate }}"
              class="btn btn-default"
              (click)="setModel()"
              translate
              type="button"
            >
              Cancel
            </button>
            <button
              *ngIf="state === 'updateConnection'"
              title="{{ 'Delete' | translate }}"
              class="btn btn-danger"
              (click)="deleteConnection(connection)"
              translate
              type="button"
            >
              Delete
            </button>
            <button
              [disabled]="!this.connectorsForm.form.valid || this.connectorsForm.form.pristine"
              title="{{ 'Save' | translate }}"
              class="btn btn-primary"
              (click)="save()"
              translate
              type="submit"
            >
              Save
            </button>
          </div>
        </form>
      </div>
    </div>
  </div>
</ng-template>

results matching ""

    No results matching ""