UNPKG

@intuitionrobotics/bug-report

Version:
51 lines 2.7 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.AdminBRModule = exports.AdminBRModule_Class = exports.RequestKey_PostPath = exports.RequestKey_GetLog = void 0; const ts_common_1 = require("@intuitionrobotics/ts-common"); const frontend_1 = require("@intuitionrobotics/thunderstorm/frontend"); const thunderstorm_1 = require("@intuitionrobotics/thunderstorm"); exports.RequestKey_GetLog = "GetLog"; exports.RequestKey_PostPath = "PostPath"; class AdminBRModule_Class extends ts_common_1.Module { constructor() { super("AdminBRModule"); this.logs = []; this.retrieveLogs = () => { this.logInfo("getting logs from firestore..."); frontend_1.XhrHttpModule .createRequest(thunderstorm_1.HttpMethod.GET, exports.RequestKey_GetLog) .setRelativeUrl("/v1/bug-reports/get-logs") .setOnError(`Error getting new message from backend`) .execute((response) => __awaiter(this, void 0, void 0, function* () { this.logs = response; })); this.logInfo("continue... will receive an event once request is completed.."); }; this.downloadLogs = (path) => { this.logInfo("downloading the logs to the client.."); const bodyObject = { path: path }; frontend_1.XhrHttpModule .createRequest(thunderstorm_1.HttpMethod.POST, exports.RequestKey_PostPath) .setJsonBody(bodyObject) .setRelativeUrl("/v1/bug-reports/download-logs") .setOnError(`Error getting new message from backend`) .execute(); }; this.downloadMultiLogs = (reports) => { reports.forEach(report => this.downloadLogs(report.path)); }; this.getLogs = () => this.logs; } } exports.AdminBRModule_Class = AdminBRModule_Class; exports.AdminBRModule = new AdminBRModule_Class(); //# sourceMappingURL=AdminBRModule.js.map