src.app.core.services.database-admin.service.ts Maven / Gradle / Ivy
The newest version!
/*
* SPDX-FileCopyrightText: 2017-2024 Enedis
*
* SPDX-License-Identifier: Apache-2.0
*
*/
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { map, Observable } from 'rxjs';
import { environment } from '@env/environment';
import { Execution } from '@core/model';
@Injectable({
providedIn: 'root'
})
export class DatabaseAdminService {
private adminUrl = '/api/v1/admin/database';
constructor(private http: HttpClient) { }
getExecutionReportMatchQuery(query: string): Observable {
return this.http.get(environment.backend + this.adminUrl + '/execution', {params: {query: query}})
.pipe(
map((res: Execution[]) => {
return res.map((execution) => Execution.deserialize(execution));
})
)
}
compactDatabase(): Observable {
return this.http.post(environment.backend + this.adminUrl + '/compact', null);
}
computeDatabaseSize(): Observable {
return this.http.get(environment.backend + this.adminUrl + '/size');
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy