All files / src/app/shared/api configuration.service.ts

100% Statements 20/20
75% Branches 3/4
100% Functions 8/8
100% Lines 18/18

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 3799x 99x     99x         99x 75x   99x 1x     99x 34x     99x 29x     99x 1x     99x 1x     99x 1x   99x  
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
 
import { ConfigFormCreateRequestModel } from '../../ceph/cluster/configuration/configuration-form/configuration-form-create-request.model';
import { ApiModule } from './api.module';
 
@Injectable({
  providedIn: ApiModule
})
export class ConfigurationService {
  constructor(private http: HttpClient) {}
 
  getConfigData() {
    return this.http.get('api/cluster_conf/');
  }
 
  get(configOption: string) {
    return this.http.get(`api/cluster_conf/${configOption}`);
  }
 
  filter(configOptionNames: Array<string>) {
    return this.http.get(`api/cluster_conf/filter?names=${configOptionNames.join(',')}`);
  }
 
  create(configOption: ConfigFormCreateRequestModel) {
    return this.http.post('api/cluster_conf/', configOption);
  }
 
  delete(configOption: string, section: string) {
    return this.http.delete(`api/cluster_conf/${configOption}?section=${section}`);
  }
 
  bulkCreate(configOptions: Object) {
    return this.http.put('api/cluster_conf/', configOptions);
  }
}