@nu-art/bug-report-frontend 0.401.9 → 0.500.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,10 @@
1
1
  import { Module } from '@nu-art/ts-common';
2
- import { ApiDefCaller } from '@nu-art/thunderstorm-shared';
3
- import { ApiStruct_BugReport } from '@nu-art/bug-report-shared/api';
2
+ import { API_BugReport } from '@nu-art/bug-report-shared/api';
4
3
  export declare const RequestKey_BugReportApi = "BugReport";
5
4
  export declare class ModuleFE_BugReport_Class extends Module {
6
5
  private readonly reports;
7
- readonly v1: ApiDefCaller<ApiStruct_BugReport>['v1'];
8
6
  constructor();
9
7
  protected init(): void;
10
- private sendBugReportCallback;
8
+ sendBugReport(body: API_BugReport['sendBugReport']['Body']): Promise<API_BugReport['sendBugReport']['Response']>;
11
9
  }
12
10
  export declare const ModuleFE_BugReport: ModuleFE_BugReport_Class;
@@ -15,29 +15,70 @@
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
17
  */
18
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
19
+ var useValue = arguments.length > 2;
20
+ for (var i = 0; i < initializers.length; i++) {
21
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
22
+ }
23
+ return useValue ? value : void 0;
24
+ };
25
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
26
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
27
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
28
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
29
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
30
+ var _, done = false;
31
+ for (var i = decorators.length - 1; i >= 0; i--) {
32
+ var context = {};
33
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
34
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
35
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
36
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
37
+ if (kind === "accessor") {
38
+ if (result === void 0) continue;
39
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
40
+ if (_ = accept(result.get)) descriptor.get = _;
41
+ if (_ = accept(result.set)) descriptor.set = _;
42
+ if (_ = accept(result.init)) initializers.unshift(_);
43
+ }
44
+ else if (_ = accept(result)) {
45
+ if (kind === "field") initializers.unshift(_);
46
+ else descriptor[key] = _;
47
+ }
48
+ }
49
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
50
+ done = true;
51
+ };
18
52
  import { addItemToArray, BeLogged, LogClient_MemBuffer, LogLevel, LogLevelOrdinal, Module } from '@nu-art/ts-common';
19
- import { apiWithBody } from '@nu-art/thunderstorm-frontend/index';
53
+ import { ApiCaller } from '@nu-art/http-client';
20
54
  import { ApiDef_BugReport } from '@nu-art/bug-report-shared/api';
21
55
  export const RequestKey_BugReportApi = 'BugReport';
22
- export class ModuleFE_BugReport_Class extends Module {
23
- reports = [];
24
- v1;
25
- constructor() {
26
- super();
27
- addItemToArray(this.reports, new LogClient_MemBuffer('default'));
28
- addItemToArray(this.reports, new LogClient_MemBuffer('info')
29
- .setFilter(level => LogLevelOrdinal.indexOf(level) >= LogLevelOrdinal.indexOf(LogLevel.Info)));
30
- this.v1 = {
31
- sendBugReport: apiWithBody(ApiDef_BugReport.v1.sendBugReport, this.sendBugReportCallback),
32
- };
33
- }
34
- init() {
35
- this.reports.forEach(report => BeLogged.addClient(report));
36
- }
37
- sendBugReportCallback = async (response) => {
38
- // const jiraTicket = response.find(ticket => ticket.platform === Platform_Jira);
39
- // if(jiraTicket)
40
- // Dialog_JiraOpened.show(jiraTicket.issueId)
56
+ let ModuleFE_BugReport_Class = (() => {
57
+ let _classSuper = Module;
58
+ let _instanceExtraInitializers = [];
59
+ let _sendBugReport_decorators;
60
+ return class ModuleFE_BugReport_Class extends _classSuper {
61
+ static {
62
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
63
+ _sendBugReport_decorators = [ApiCaller(ApiDef_BugReport.sendBugReport)];
64
+ __esDecorate(this, null, _sendBugReport_decorators, { kind: "method", name: "sendBugReport", static: false, private: false, access: { has: obj => "sendBugReport" in obj, get: obj => obj.sendBugReport }, metadata: _metadata }, null, _instanceExtraInitializers);
65
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
66
+ }
67
+ reports = (__runInitializers(this, _instanceExtraInitializers), []);
68
+ constructor() {
69
+ super();
70
+ addItemToArray(this.reports, new LogClient_MemBuffer('default'));
71
+ addItemToArray(this.reports, new LogClient_MemBuffer('info')
72
+ .setFilter(level => LogLevelOrdinal.indexOf(level) >= LogLevelOrdinal.indexOf(LogLevel.Info)));
73
+ }
74
+ init() {
75
+ this.reports.forEach(report => BeLogged.addClient(report));
76
+ }
77
+ async sendBugReport(body) {
78
+ void body;
79
+ return undefined;
80
+ }
41
81
  };
42
- }
82
+ })();
83
+ export { ModuleFE_BugReport_Class };
43
84
  export const ModuleFE_BugReport = new ModuleFE_BugReport_Class();
@@ -1,13 +1,14 @@
1
1
  import { Module } from '@nu-art/ts-common';
2
- import { ApiDefCaller } from '@nu-art/thunderstorm-shared';
3
- import { ApiStruct_AdminBugReport, DB_BugReport, ReportLogFile } from '@nu-art/bug-report-shared/api';
2
+ import { API_AdminBugReport, DB_BugReport, ReportLogFile } from '@nu-art/bug-report-shared/api';
4
3
  export declare const RequestKey_GetLog = "GetLog";
5
4
  export declare const RequestKey_PostPath = "PostPath";
6
5
  export declare class ModuleFE_BugReportAdmin_Class extends Module {
7
- readonly v1: ApiDefCaller<ApiStruct_AdminBugReport>['v1'];
8
- constructor();
9
6
  private logs;
7
+ constructor();
8
+ retrieveLogs(_params?: API_AdminBugReport['retrieveLogs']['Params']): Promise<API_AdminBugReport['retrieveLogs']['Response']>;
9
+ downloadLogs(body: API_AdminBugReport['downloadLogs']['Body']): Promise<API_AdminBugReport['downloadLogs']['Response']>;
10
10
  downloadMultiLogs: (reports: ReportLogFile[]) => void;
11
11
  getLogs: () => DB_BugReport[];
12
+ setLogs(logs: DB_BugReport[]): void;
12
13
  }
13
14
  export declare const ModuleFE_BugReportAdmin: ModuleFE_BugReportAdmin_Class;
@@ -15,46 +15,81 @@
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
17
  */
18
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
19
+ var useValue = arguments.length > 2;
20
+ for (var i = 0; i < initializers.length; i++) {
21
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
22
+ }
23
+ return useValue ? value : void 0;
24
+ };
25
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
26
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
27
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
28
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
29
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
30
+ var _, done = false;
31
+ for (var i = decorators.length - 1; i >= 0; i--) {
32
+ var context = {};
33
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
34
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
35
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
36
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
37
+ if (kind === "accessor") {
38
+ if (result === void 0) continue;
39
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
40
+ if (_ = accept(result.get)) descriptor.get = _;
41
+ if (_ = accept(result.set)) descriptor.set = _;
42
+ if (_ = accept(result.init)) initializers.unshift(_);
43
+ }
44
+ else if (_ = accept(result)) {
45
+ if (kind === "field") initializers.unshift(_);
46
+ else descriptor[key] = _;
47
+ }
48
+ }
49
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
50
+ done = true;
51
+ };
18
52
  import { Module } from '@nu-art/ts-common';
19
- import { apiWithBody, apiWithQuery } from '@nu-art/thunderstorm-frontend/index';
53
+ import { ApiCaller } from '@nu-art/http-client';
20
54
  import { ApiDef_AdminBugReport } from '@nu-art/bug-report-shared/api';
21
55
  export const RequestKey_GetLog = 'GetLog';
22
56
  export const RequestKey_PostPath = 'PostPath';
23
- export class ModuleFE_BugReportAdmin_Class extends Module {
24
- v1;
25
- constructor() {
26
- super();
27
- this.v1 = {
28
- downloadLogs: apiWithBody(ApiDef_AdminBugReport.v1.downloadLogs),
29
- retrieveLogs: apiWithQuery(ApiDef_AdminBugReport.v1.retrieveLogs),
57
+ let ModuleFE_BugReportAdmin_Class = (() => {
58
+ let _classSuper = Module;
59
+ let _instanceExtraInitializers = [];
60
+ let _retrieveLogs_decorators;
61
+ let _downloadLogs_decorators;
62
+ return class ModuleFE_BugReportAdmin_Class extends _classSuper {
63
+ static {
64
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
65
+ _retrieveLogs_decorators = [ApiCaller(ApiDef_AdminBugReport.retrieveLogs, {
66
+ onComplete: (m, ctx) => m.setLogs(ctx.response)
67
+ })];
68
+ _downloadLogs_decorators = [ApiCaller(ApiDef_AdminBugReport.downloadLogs)];
69
+ __esDecorate(this, null, _retrieveLogs_decorators, { kind: "method", name: "retrieveLogs", static: false, private: false, access: { has: obj => "retrieveLogs" in obj, get: obj => obj.retrieveLogs }, metadata: _metadata }, null, _instanceExtraInitializers);
70
+ __esDecorate(this, null, _downloadLogs_decorators, { kind: "method", name: "downloadLogs", static: false, private: false, access: { has: obj => "downloadLogs" in obj, get: obj => obj.downloadLogs }, metadata: _metadata }, null, _instanceExtraInitializers);
71
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
72
+ }
73
+ logs = (__runInitializers(this, _instanceExtraInitializers), []);
74
+ constructor() {
75
+ super();
76
+ }
77
+ async retrieveLogs(_params) {
78
+ void _params;
79
+ return undefined;
80
+ }
81
+ async downloadLogs(body) {
82
+ void body;
83
+ return undefined;
84
+ }
85
+ downloadMultiLogs = (reports) => {
86
+ reports.forEach(report => void this.downloadLogs({ path: report.path }));
30
87
  };
31
- }
32
- logs = [];
33
- // public retrieveLogs = () => {
34
- // this.logInfo('getting logs from firestore...');
35
- // ModuleFE_XHR
36
- // .createRequest<ApiGetLog>(HttpMethod.GET, RequestKey_GetLog)
37
- // .setRelativeUrl('v1/bug-reports/get-logs')
38
- // .setOnError(`Error getting new message from backend`)
39
- // .execute(async response => {
40
- // this.logs = response;
41
- // });
42
- //
43
- // this.logInfo('continue... will receive an event once request is completed..');
44
- // };
45
- // public downloadLogs = (path: string) => {
46
- // this.logInfo('downloading the logs to the client..');
47
- // const bodyObject: Paths = {path: path};
48
- // ModuleFE_XHR
49
- // .createRequest<ApiPostPath>(HttpMethod.POST, RequestKey_PostPath)
50
- // .setBodyAsJson(bodyObject)
51
- // .setRelativeUrl('v1/bug-reports/download-logs')
52
- // .setOnError(`Error getting new message from backend`)
53
- // .execute();
54
- // };
55
- downloadMultiLogs = (reports) => {
56
- reports.forEach(report => this.v1.downloadLogs({ path: report.path }).execute());
88
+ getLogs = () => this.logs;
89
+ setLogs(logs) {
90
+ this.logs = logs;
91
+ }
57
92
  };
58
- getLogs = () => this.logs;
59
- }
93
+ })();
94
+ export { ModuleFE_BugReportAdmin_Class };
60
95
  export const ModuleFE_BugReportAdmin = new ModuleFE_BugReportAdmin_Class();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nu-art/bug-report-frontend",
3
- "version": "0.401.9",
3
+ "version": "0.500.0",
4
4
  "description": "Bug Report Frontend",
5
5
  "keywords": [
6
6
  "TacB0sS",
@@ -29,17 +29,15 @@
29
29
  "build": "tsc"
30
30
  },
31
31
  "dependencies": {
32
- "@nu-art/bug-report-shared": "0.401.9",
33
- "@nu-art/firebase-frontend": "0.401.9",
34
- "@nu-art/firebase-shared": "0.401.9",
35
- "@nu-art/jira-shared": "0.401.9",
36
- "@nu-art/slack-frontend": "0.401.9",
37
- "@nu-art/slack-shared": "0.401.9",
38
- "@nu-art/thunderstorm-frontend": "0.401.9",
39
- "@nu-art/thunderstorm-shared": "0.401.9",
40
- "@nu-art/ts-common": "0.401.9",
41
- "@nu-art/user-account-frontend": "0.401.9",
42
- "@nu-art/user-account-shared": "0.401.9",
32
+ "@nu-art/bug-report-shared": "0.500.0",
33
+ "@nu-art/firebase-frontend": "0.500.0",
34
+ "@nu-art/firebase-shared": "0.500.0",
35
+ "@nu-art/jira-shared": "0.500.0",
36
+ "@nu-art/slack-frontend": "0.500.0",
37
+ "@nu-art/slack-shared": "0.500.0",
38
+ "@nu-art/ts-common": "0.500.0",
39
+ "@nu-art/user-account-frontend": "0.500.0",
40
+ "@nu-art/user-account-shared": "0.500.0",
43
41
  "express": "^4.18.2",
44
42
  "firebase": "^11.9.0",
45
43
  "firebase-admin": "13.4.0",
@@ -47,14 +45,16 @@
47
45
  "moment": "^2.29.4",
48
46
  "react": "^18.0.0",
49
47
  "react-dom": "^18.0.0",
50
- "react-router-dom": "^6.9.0"
48
+ "react-router-dom": "^6.9.0",
49
+ "@nu-art/http-client": "{{THUNDERSTORM_VERSION}}"
51
50
  },
52
51
  "devDependencies": {
53
52
  "@types/express": "^4.17.17",
54
53
  "@types/file-saver": "^2.0.1",
55
54
  "@types/history": "^4.7.2",
56
55
  "@types/jszip": "^3.1.7",
57
- "@types/react": "^18.0.0"
56
+ "@types/react": "^18.0.0",
57
+ "@types/request": "^2.48.1"
58
58
  },
59
59
  "unitConfig": {
60
60
  "type": "typescript-lib"
package/ui/AdminBR.d.ts CHANGED
@@ -1,8 +1,5 @@
1
- import { ComponentSync } from '@nu-art/thunderstorm-frontend/index';
2
- import { OnRequestListener } from '@nu-art/thunderstorm-shared';
3
- export declare class AdminBR extends ComponentSync implements OnRequestListener {
4
- protected deriveStateFromProps(nextProps: any): any;
1
+ import * as React from 'react';
2
+ export declare class AdminBR extends React.Component<Record<string, unknown>> {
5
3
  render(): import("react/jsx-runtime").JSX.Element;
6
4
  private createRow;
7
- __onRequestCompleted: (key: string, success: boolean) => void;
8
5
  }
package/ui/AdminBR.js CHANGED
@@ -17,24 +17,16 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
17
  * See the License for the specific language governing permissions and
18
18
  * limitations under the License.
19
19
  */
20
- import { ComponentSync, } from '@nu-art/thunderstorm-frontend/index';
20
+ import * as React from 'react';
21
21
  import { __stringify } from '@nu-art/ts-common';
22
- import { ModuleFE_BugReportAdmin, RequestKey_GetLog } from '../modules/ModuleFE_BugReportAdmin.js';
23
- export class AdminBR extends ComponentSync {
24
- deriveStateFromProps(nextProps) {
25
- return { ...nextProps };
26
- }
22
+ import { ModuleFE_BugReportAdmin } from '../modules/ModuleFE_BugReportAdmin.js';
23
+ export class AdminBR extends React.Component {
27
24
  render() {
28
25
  const logs = ModuleFE_BugReportAdmin.getLogs();
29
- return (_jsxs("div", { children: [_jsx("button", { onClick: () => ModuleFE_BugReportAdmin.v1.retrieveLogs({}).execute(), children: "click to display logs" }), _jsx("div", { children: _jsx("table", { style: { width: '100%' }, children: logs.map(this.createRow) }) })] }));
26
+ return (_jsxs("div", { children: [_jsx("button", { onClick: async () => {
27
+ await ModuleFE_BugReportAdmin.retrieveLogs();
28
+ this.forceUpdate();
29
+ }, children: "click to display logs" }), _jsx("div", { children: _jsx("table", { style: { width: '100%' }, children: logs.map(this.createRow) }) })] }));
30
30
  }
31
31
  createRow = (report) => _jsxs("tr", { children: [_jsx("td", { style: { padding: '15px', textAlign: 'left', border: '1px solid #ddd', fontSize: '15px' }, children: report.description }), _jsx("td", { style: { padding: '15px', textAlign: 'left', border: '1px solid #ddd', fontSize: '15px' }, children: report.reports[0].path }), _jsx("td", { style: { padding: '15px', textAlign: 'left', border: '1px solid #ddd', fontSize: '15px' }, children: __stringify(report.tickets) }), _jsx("td", { style: { padding: '15px', textAlign: 'left', border: '1px solid #ddd', fontSize: '15px' }, children: _jsx("button", { onClick: () => ModuleFE_BugReportAdmin.downloadMultiLogs(report.reports), children: "download" }) })] });
32
- __onRequestCompleted = (key, success) => {
33
- switch (key) {
34
- default:
35
- return;
36
- case RequestKey_GetLog:
37
- this.forceUpdate();
38
- }
39
- };
40
32
  }