mirror of
https://github.com/Mueller-Patrick/Betterzon.git
synced 2024-12-22 19:55:12 +00:00
BETTERZON-124: Adding service function for crawling status API (#71)
This commit is contained in:
parent
63362fbe67
commit
25b6b43e9f
7
Frontend/src/app/models/crawlingstatus.ts
Normal file
7
Frontend/src/app/models/crawlingstatus.ts
Normal file
|
@ -0,0 +1,7 @@
|
|||
export interface CrawlingStatus {
|
||||
process_id: number;
|
||||
started_timestamp: Date;
|
||||
combinations_to_crawl: number;
|
||||
successful_crawls: number;
|
||||
failed_crawls: number;
|
||||
}
|
|
@ -10,6 +10,7 @@ import {FavoriteShop} from '../models/favoriteshop';
|
|||
import {ContactPerson} from '../models/contactperson';
|
||||
import {Category} from '../models/category';
|
||||
import {Manufacturer} from '../models/manufacturer';
|
||||
import {CrawlingStatus} from '../models/crawlingstatus';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
@ -575,4 +576,25 @@ export class ApiService {
|
|||
process.stderr.write(`ERROR received from ${this.apiUrl}: ${exception}\n`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* ______ ___ _____ __ __
|
||||
/ ____/________ __ __/ (_)___ ____ _ / ___// /_____ _/ /___ _______
|
||||
/ / / ___/ __ `/ | /| / / / / __ \/ __ `/ \__ \/ __/ __ `/ __/ / / / ___/
|
||||
/ /___/ / / /_/ /| |/ |/ / / / / / / /_/ / ___/ / /_/ /_/ / /_/ /_/ (__ )
|
||||
\____/_/ \__,_/ |__/|__/_/_/_/ /_/\__, / /____/\__/\__,_/\__/\__,_/____/
|
||||
/____/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gets the current crawling status
|
||||
* @return Observable<CrawlingStatus> An observable containing a single crawling status object
|
||||
*/
|
||||
getCurrentCrawlingStatus(): Observable<CrawlingStatus> {
|
||||
try {
|
||||
return this.http.get<CrawlingStatus>((this.apiUrl + '/crawlingstatus'));
|
||||
} catch (exception) {
|
||||
process.stderr.write(`ERROR received from ${this.apiUrl}: ${exception}\n`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user