File

src/app/ceph/cluster/osd/osd-flags-modal/osd-flags-modal.component.ts

Implements

OnInit

Metadata

selector cd-osd-flags-modal
styleUrls ./osd-flags-modal.component.scss
templateUrl ./osd-flags-modal.component.html

Index

Properties
Methods

Constructor

constructor(bsModalRef: BsModalRef, osdService: OsdService, notificationService: NotificationService, i18n: I18n)
Parameters :
Name Type Optional
bsModalRef BsModalRef No
osdService OsdService No
notificationService NotificationService No
i18n I18n No

Methods

ngOnInit
ngOnInit()
Returns : void
submitAction
submitAction()
Returns : void

Properties

allFlags
Type : object
Default value : { noin: { code: 'noin', name: this.i18n('No In'), value: false, description: this.i18n( 'OSDs that were previously marked out will not be marked back in when they start' ) }, noout: { code: 'noout', name: this.i18n('No Out'), value: false, description: this.i18n( 'OSDs will not automatically be marked out after the configured interval' ) }, noup: { code: 'noup', name: this.i18n('No Up'), value: false, description: this.i18n('OSDs are not allowed to start') }, nodown: { code: 'nodown', name: this.i18n('No Down'), value: false, description: this.i18n( 'OSD failure reports are being ignored, such that the monitors will not mark OSDs down' ) }, pause: { code: 'pause', name: this.i18n('Pause'), value: false, description: this.i18n('Pauses reads and writes') }, noscrub: { code: 'noscrub', name: this.i18n('No Scrub'), value: false, description: this.i18n('Scrubbing is disabled') }, 'nodeep-scrub': { code: 'nodeep-scrub', name: this.i18n('No Deep Scrub'), value: false, description: this.i18n('Deep Scrubbing is disabled') }, nobackfill: { code: 'nobackfill', name: this.i18n('No Backfill'), value: false, description: this.i18n('Backfilling of PGs is suspended') }, norecover: { code: 'norecover', name: this.i18n('No Recover'), value: false, description: this.i18n('Recovery of PGs is suspended') }, sortbitwise: { code: 'sortbitwise', name: this.i18n('Bitwise Sort'), value: false, description: this.i18n('Use bitwise sort'), disabled: true }, purged_snapdirs: { code: 'purged_snapdirs', name: this.i18n('Purged Snapdirs'), value: false, description: this.i18n('OSDs have converted snapsets'), disabled: true }, recovery_deletes: { code: 'recovery_deletes', name: this.i18n('Recovery Deletes'), value: false, description: this.i18n('Deletes performed during recovery instead of peering'), disabled: true }, pglog_hardlimit: { code: 'pglog_hardlimit', name: this.i18n('PG Log Hard Limit'), value: false, description: this.i18n('Puts a hard limit on pg log length'), disabled: true } }
Public bsModalRef
Type : BsModalRef
flags
Type : any[]
osdFlagsForm
Default value : new FormGroup({})
unknownFlags
Type : string[]
Default value : []
import { Component, OnInit } from '@angular/core';
import { FormGroup } from '@angular/forms';

import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { BsModalRef } from 'ngx-bootstrap/modal';

import { OsdService } from '../../../../shared/api/osd.service';
import { NotificationType } from '../../../../shared/enum/notification-type.enum';
import { NotificationService } from '../../../../shared/services/notification.service';

@Component({
  selector: 'cd-osd-flags-modal',
  templateUrl: './osd-flags-modal.component.html',
  styleUrls: ['./osd-flags-modal.component.scss']
})
export class OsdFlagsModalComponent implements OnInit {
  osdFlagsForm = new FormGroup({});

  allFlags = {
    noin: {
      code: 'noin',
      name: this.i18n('No In'),
      value: false,
      description: this.i18n(
        'OSDs that were previously marked out will not be marked back in when they start'
      )
    },
    noout: {
      code: 'noout',
      name: this.i18n('No Out'),
      value: false,
      description: this.i18n(
        'OSDs will not automatically be marked out after the configured interval'
      )
    },
    noup: {
      code: 'noup',
      name: this.i18n('No Up'),
      value: false,
      description: this.i18n('OSDs are not allowed to start')
    },
    nodown: {
      code: 'nodown',
      name: this.i18n('No Down'),
      value: false,
      description: this.i18n(
        'OSD failure reports are being ignored, such that the monitors will not mark OSDs down'
      )
    },
    pause: {
      code: 'pause',
      name: this.i18n('Pause'),
      value: false,
      description: this.i18n('Pauses reads and writes')
    },
    noscrub: {
      code: 'noscrub',
      name: this.i18n('No Scrub'),
      value: false,
      description: this.i18n('Scrubbing is disabled')
    },
    'nodeep-scrub': {
      code: 'nodeep-scrub',
      name: this.i18n('No Deep Scrub'),
      value: false,
      description: this.i18n('Deep Scrubbing is disabled')
    },
    nobackfill: {
      code: 'nobackfill',
      name: this.i18n('No Backfill'),
      value: false,
      description: this.i18n('Backfilling of PGs is suspended')
    },
    norecover: {
      code: 'norecover',
      name: this.i18n('No Recover'),
      value: false,
      description: this.i18n('Recovery of PGs is suspended')
    },
    sortbitwise: {
      code: 'sortbitwise',
      name: this.i18n('Bitwise Sort'),
      value: false,
      description: this.i18n('Use bitwise sort'),
      disabled: true
    },
    purged_snapdirs: {
      code: 'purged_snapdirs',
      name: this.i18n('Purged Snapdirs'),
      value: false,
      description: this.i18n('OSDs have converted snapsets'),
      disabled: true
    },
    recovery_deletes: {
      code: 'recovery_deletes',
      name: this.i18n('Recovery Deletes'),
      value: false,
      description: this.i18n('Deletes performed during recovery instead of peering'),
      disabled: true
    },
    pglog_hardlimit: {
      code: 'pglog_hardlimit',
      name: this.i18n('PG Log Hard Limit'),
      value: false,
      description: this.i18n('Puts a hard limit on pg log length'),
      disabled: true
    }
  };
  flags: any[];
  unknownFlags: string[] = [];

  constructor(
    public bsModalRef: BsModalRef,
    private osdService: OsdService,
    private notificationService: NotificationService,
    private i18n: I18n
  ) {}

  ngOnInit() {
    this.osdService.getFlags().subscribe((res: string[]) => {
      res.forEach((value) => {
        if (this.allFlags[value]) {
          this.allFlags[value].value = true;
        } else {
          this.unknownFlags.push(value);
        }
      });
      this.flags = _.toArray(this.allFlags);
    });
  }

  submitAction() {
    const newFlags = this.flags
      .filter((flag) => flag.value)
      .map((flag) => flag.code)
      .concat(this.unknownFlags);

    this.osdService.updateFlags(newFlags).subscribe(
      () => {
        this.notificationService.show(NotificationType.success, this.i18n('Updated OSD Flags'));
        this.bsModalRef.hide();
      },
      () => {
        this.bsModalRef.hide();
      }
    );
  }
}
<cd-modal [modalRef]="bsModalRef">
  <ng-container class="modal-title"
                i18n>Cluster-wide OSD Flags</ng-container>

  <ng-container class="modal-content">
    <form name="osdFlagsForm"
          #formDir="ngForm"
          [formGroup]="osdFlagsForm"
          novalidate>
      <div class="modal-body osd-modal">
        <div class="checkbox checkbox-primary"
             *ngFor="let flag of flags; let last = last">
          <input type="checkbox"
                 [checked]="flag.value"
                 (change)="flag.value = !flag.value"
                 [name]="flag.code"
                 [id]="flag.code"
                 [disabled]="flag.disabled">
          <label [for]="flag.code"
                 ng-class="['tc_' + key]">
            <strong>{{ flag.name }}</strong>
            <br>
            <span class="text-muted">{{ flag.description }}</span>
          </label>
          <hr class="oa-hr-small"
              *ngIf="!last">
        </div>
      </div>

      <div class="modal-footer">
        <div class="button-group text-right">
          <cd-submit-button (submitAction)="submitAction()"
                            [form]="osdFlagsForm"
                            i18n>Submit</cd-submit-button>
          <cd-back-button [back]="bsModalRef.hide"
                          name="Cancel"
                          i18n-name>
          </cd-back-button>
        </div>
      </div>
    </form>
  </ng-container>
</cd-modal>

./osd-flags-modal.component.scss

.osd-modal {
  .oa-hr-small {
    margin: 5px;
  }
}
Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""