File

core/provider-configuration/provider-configuration.component.ts

Metadata

Index

Properties
Methods

Constructor

constructor(permissions: Permissions, activatedRoute: ActivatedRoute, modalService: ModalService, alertService: AlertService, providerDefinitionsService: ProviderDefinitionsService, providerConfigurationService: ProviderConfigurationService, jsonschema: C8yJSONSchema)
Parameters :
Name Type Optional
permissions Permissions No
activatedRoute ActivatedRoute No
modalService ModalService No
alertService AlertService No
providerDefinitionsService ProviderDefinitionsService No
providerConfigurationService ProviderConfigurationService No
jsonschema C8yJSONSchema No

Methods

Async deleteProviderConfiguration
deleteProviderConfiguration()
Returns : any
ngOnInit
ngOnInit()
Returns : void
Async saveProviderConfiguration
saveProviderConfiguration()
Returns : any

Properties

allRoles$
Type : Observable<string[]>
Default value : this.layout$.pipe( map((layout: DynamicProviderLayoutConfig) => [ ...(layout.deleteRoles || []), ...(layout.saveRoles || []) ]) )
changeProvider$
Type : Subject<ProviderDefinition>
Default value : new BehaviorSubject(null)
configuration$
Type : Observable<ProviderProperties>
fields
Type : FormlyFieldConfig[]
Default value : []
form
Default value : new FormGroup({})
layout$
Type : Observable<DynamicProviderLayoutConfig>
Default value : this.activatedRoute.data.pipe( map((config: DynamicProviderConfig) => config.layout), tap((layout: DynamicProviderLayoutConfig) => (this.layout = layout)), tap((layout: DynamicProviderLayoutConfig) => { this.options.formState.disabled = !this.permissions.hasAllRoles(layout.saveRoles || []); this.beforeSaveHook = layout.beforeSaveHook; }) )
model
Type : ProviderProperties
options
Type : FormlyFormOptions
Default value : { formState: { disabled: false } }
Public permissions
Type : Permissions
providerInput$
Default value : new BehaviorSubject<string>('')
providers$
Type : Observable<ProviderDefinition[]>
selectedProvider$
Type : Observable<ProviderDefinition>
<c8y-title>
  {{ (layout$ | async)?.pageTitle | translate }}
</c8y-title>

<div class="row">
  <div class="col-md-8 col-xs-12">
    <form class="card card--fullpage" (ngSubmit)="saveProviderConfiguration()">
      <div class="card-header separator">
        <h4 class="card-title">
          {{ (layout$ | async)?.cardTitle | translate }}
        </h4>
      </div>
      <div class="inner-scroll">
        <div class="card-block">
          <p *ngIf="!!(layout$ | async)?.description" class="m-b-8">
            {{ (layout$ | async)?.description | translate }}
          </p>
          <c8y-form-group>
            <label for="providerName">{{ (layout$ | async)?.providerName | translate }}</label>
            <c8y-typeahead
              [disabled]="!permissions.hasAllRoles((layout$ | async)?.saveRoles || [])"
              [ngModel]="selectedProvider$ | async"
              [displayProperty]="'displayName'"
              name="providerName"
              placeholder="{{ (layout$ | async)?.providerNamePlaceholder | translate }}"
              (onSearch)="providerInput$.next($event)"
              [allowFreeEntries]="false"
              [required]="true"
              [container]="'body'"
            >
              <c8y-li
                *ngFor="let provider of providers$ | async"
                class="p-l-8 p-r-8 c8y-list__item--link"
                (click)="changeProvider$.next(provider); providerInput$.next('')"
                [active]="(selectedProvider$ | async) === provider"
              >
                <c8y-highlight
                  [text]="provider.displayName || '--'"
                  [pattern]="providerInput$ | async"
                ></c8y-highlight>
              </c8y-li>
            </c8y-typeahead>
            <c8y-messages
              ><c8y-message
                name="notExisting"
                [text]="(layout$ | async)?.providerNameNoMatchesHint | translate"
              ></c8y-message>
            </c8y-messages>
          </c8y-form-group>
          <formly-form
            *ngIf="selectedProvider$ | async"
            [form]="form"
            [fields]="fields"
            [model]="model"
            [options]="options"
          ></formly-form>
        </div>
      </div>
      <div class="card-footer separator" *c8yIfAllowed="allRoles$ | async; allowAny">
        <button
          *c8yIfAllowed="(layout$ | async)?.deleteRoles"
          class="btn btn-default"
          type="button"
          (click)="deleteProviderConfiguration()"
          [disabled]="
            !(configuration$ | async)?.provider && !(configuration$ | async)?.providerName
          "
          title="{{ (layout$ | async)?.deleteBtnLabel | translate }}"
        >
          {{ (layout$ | async)?.deleteBtnLabel | translate }}
        </button>
        <button
          *c8yIfAllowed="(layout$ | async)?.saveRoles"
          class="btn btn-primary"
          type="submit"
          [disabled]="form.invalid || form.pristine"
          title="{{ (layout$ | async)?.saveBtnLabel | translate }}"
        >
          {{ (layout$ | async)?.saveBtnLabel | translate }}
        </button>
      </div>
    </form>
  </div>
</div>

results matching ""

    No results matching ""