max-agent-ui 0.0.27 → 0.0.29
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.
- package/fesm2022/max-agent-ui.mjs +39 -13
- package/fesm2022/max-agent-ui.mjs.map +1 -1
- package/index.d.ts +4 -0
- package/package.json +1 -1
|
@@ -619,7 +619,7 @@ class MaxAssistantSupportService {
|
|
|
619
619
|
if (!this.http) {
|
|
620
620
|
return throwError(() => new Error('HttpClient is not available. Add provideHttpClient() to the host app.'));
|
|
621
621
|
}
|
|
622
|
-
return this.http.get(this.tagsEndpoint, { headers: this.getHeaders(this.mergeConfig({})) }).pipe(map(tags => tags.map(tag => ({
|
|
622
|
+
return this.http.get(this.getEndpoint(this.tagsEndpoint, this.mergeConfig({})), { headers: this.getHeaders(this.mergeConfig({})) }).pipe(map(tags => tags.map(tag => ({
|
|
623
623
|
...tag,
|
|
624
624
|
icon: 'pi pi-tag',
|
|
625
625
|
severity: 'info'
|
|
@@ -629,14 +629,14 @@ class MaxAssistantSupportService {
|
|
|
629
629
|
if (!this.http) {
|
|
630
630
|
return throwError(() => new Error('HttpClient is not available. Add provideHttpClient() to the host app.'));
|
|
631
631
|
}
|
|
632
|
-
return this.http.get(this.severitiesEndpoint, { headers: this.getHeaders(this.mergeConfig({})) });
|
|
632
|
+
return this.http.get(this.getEndpoint(this.severitiesEndpoint, this.mergeConfig({})), { headers: this.getHeaders(this.mergeConfig({})) });
|
|
633
633
|
}
|
|
634
634
|
submitTicket(ticket, config = {}) {
|
|
635
635
|
if (!this.http) {
|
|
636
636
|
return throwError(() => new Error('HttpClient is not available. Add provideHttpClient() to the host app.'));
|
|
637
637
|
}
|
|
638
638
|
const mergedConfig = this.mergeConfig(config);
|
|
639
|
-
const response$ = this.http.post(this.ticketsEndpoint, {
|
|
639
|
+
const response$ = this.http.post(this.getEndpoint(this.ticketsEndpoint, mergedConfig), {
|
|
640
640
|
subject: ticket.subject,
|
|
641
641
|
body: ticket.query,
|
|
642
642
|
severity: ticket.severity,
|
|
@@ -673,6 +673,10 @@ class MaxAssistantSupportService {
|
|
|
673
673
|
}
|
|
674
674
|
return headers;
|
|
675
675
|
}
|
|
676
|
+
getEndpoint(path, config) {
|
|
677
|
+
const baseUrl = config.apiBaseUrl?.trim();
|
|
678
|
+
return baseUrl ? `${baseUrl.replace(/\/$/, '')}${path}` : path;
|
|
679
|
+
}
|
|
676
680
|
getUser(config) {
|
|
677
681
|
return typeof config.user === 'function' ? config.user() : config.user ?? {};
|
|
678
682
|
}
|
|
@@ -1283,18 +1287,29 @@ class MaxAssistantComponent {
|
|
|
1283
1287
|
}
|
|
1284
1288
|
tablePageStatus(table) {
|
|
1285
1289
|
const pagination = table.pagination;
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1290
|
+
if (!pagination) {
|
|
1291
|
+
return '';
|
|
1292
|
+
}
|
|
1293
|
+
const retrieved = table.rows.length;
|
|
1294
|
+
return pagination.totalRecordsExact === false
|
|
1295
|
+
? `${retrieved.toLocaleString()} ${retrieved === 1 ? 'record' : 'records'} retrieved`
|
|
1296
|
+
: `${Math.min(retrieved, pagination.totalRecords).toLocaleString()} of ${pagination.totalRecords.toLocaleString()} records retrieved`;
|
|
1289
1297
|
}
|
|
1290
1298
|
hasNextTablePage(table) {
|
|
1291
1299
|
const pagination = table.pagination;
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1300
|
+
if (!pagination || pagination.nextOffset === undefined) {
|
|
1301
|
+
return false;
|
|
1302
|
+
}
|
|
1303
|
+
if (pagination.hasMore !== undefined) {
|
|
1304
|
+
return pagination.hasMore;
|
|
1305
|
+
}
|
|
1306
|
+
return Boolean(pagination.remainingRecords > 0 &&
|
|
1295
1307
|
table.rows.length < pagination.totalRecords);
|
|
1296
1308
|
}
|
|
1297
1309
|
nextTablePageLabel(pagination) {
|
|
1310
|
+
if (pagination.totalRecordsExact === false) {
|
|
1311
|
+
return `Retrieve next ${pagination.pageSize.toLocaleString()} records`;
|
|
1312
|
+
}
|
|
1298
1313
|
return `Retrieve next ${Math.min(pagination.pageSize, pagination.remainingRecords).toLocaleString()} records`;
|
|
1299
1314
|
}
|
|
1300
1315
|
isTablePageLoading(messageId, tableIndex) {
|
|
@@ -1511,18 +1526,29 @@ class MaxAssistantComponent {
|
|
|
1511
1526
|
}));
|
|
1512
1527
|
return { ...message, developerTrace };
|
|
1513
1528
|
}
|
|
1514
|
-
const
|
|
1515
|
-
const
|
|
1516
|
-
const
|
|
1529
|
+
const nextPagination = nextTable.pagination;
|
|
1530
|
+
const totalRecords = nextPagination?.totalRecords ?? rowOffset + nextTable.rows.length;
|
|
1531
|
+
const totalRecordsExact = nextPagination?.totalRecordsExact !== false;
|
|
1532
|
+
const combinedRows = [...currentTable.rows, ...nextTable.rows];
|
|
1533
|
+
const rows = totalRecordsExact
|
|
1534
|
+
? combinedRows.slice(0, totalRecords)
|
|
1535
|
+
: combinedRows;
|
|
1536
|
+
const hasMore = nextPagination?.hasMore ??
|
|
1537
|
+
((nextPagination?.remainingRecords ?? 0) > 0);
|
|
1538
|
+
const remainingRecords = totalRecordsExact
|
|
1539
|
+
? Math.max(totalRecords - rows.length, 0)
|
|
1540
|
+
: (nextPagination?.remainingRecords ?? 0);
|
|
1517
1541
|
const pagination = nextTable.pagination
|
|
1518
1542
|
? {
|
|
1519
1543
|
query: nextTable.pagination.query,
|
|
1520
1544
|
offset: 0,
|
|
1521
1545
|
pageSize: nextTable.pagination.pageSize,
|
|
1522
1546
|
totalRecords,
|
|
1547
|
+
totalRecordsExact,
|
|
1523
1548
|
returnedRecords: rows.length,
|
|
1524
1549
|
remainingRecords,
|
|
1525
|
-
|
|
1550
|
+
hasMore,
|
|
1551
|
+
...(hasMore ? { nextOffset: rows.length } : {})
|
|
1526
1552
|
}
|
|
1527
1553
|
: currentTable.pagination;
|
|
1528
1554
|
tables[tableIndex] = {
|