Skip to content

Commit 0f85917

Browse files
committed
use new API for tables page
1 parent 137074e commit 0f85917

File tree

3 files changed

+166
-143
lines changed

3 files changed

+166
-143
lines changed

server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/functions.js

+130-89
Original file line numberDiff line numberDiff line change
@@ -307,15 +307,6 @@ function getJSONForTable(call, sessionDataVar) {
307307
});
308308
}
309309

310-
/**
311-
* Wraps the getJSONForTable function to call the new server
312-
* TODO: Remove this function once the new server is fully integrated
313-
*/
314-
function getJSONfromNewServer(call, sessionDataVar) {
315-
const url = 'http://localhost:43331' + call;
316-
return getJSONForTable(url, sessionDataVar);
317-
}
318-
319310
/**
320311
* Performs POST call and builds console logging message if successful
321312
* @param {string} call REST url called
@@ -471,181 +462,231 @@ function clearAllTableCells(tableId) {
471462

472463
// NEW REST CALLS
473464

465+
const REST_V2_PREFIX = '/rest-v2';
466+
467+
/**
468+
* REST GET call for /problems,
469+
* stores it on a sessionStorage variable
470+
*/
471+
function getProblems() {
472+
return getJSONForTable(REST_V2_PREFIX + '/problems', 'problems');
473+
}
474+
475+
/**
476+
* REST GET call for /lastUpdate,
477+
* stores it on a sessionStorage variable
478+
*/
479+
function getLastUpdate() {
480+
return getJSONForTable(REST_V2_PREFIX + '/lastUpdate', 'lastUpdate');
481+
}
482+
483+
/**
484+
* REST GET call for /tservers/summary/{group},
485+
* stores it on a sessionStorage variable
486+
* @param {string} group Group name
487+
*/
488+
function getTserversSummary(group) {
489+
const url = `${REST_V2_PREFIX}/tservers/summary/${group}`;
490+
const sessionDataVar = `tserversSummary_${group}`;
491+
return getJSONForTable(url, sessionDataVar);
492+
}
493+
494+
/**
495+
* REST GET call for /suggestions,
496+
* stores it on a sessionStorage variable
497+
*/
498+
function getSuggestions() {
499+
return getJSONForTable(REST_V2_PREFIX + '/suggestions', 'suggestions');
500+
}
501+
502+
/**
503+
* REST GET call for /compactors/detail/{group},
504+
* stores it on a sessionStorage variable
505+
* @param {string} group Group name
506+
*/
507+
function getCompactorsDetail(group) {
508+
const url = `${REST_V2_PREFIX}/compactors/detail/${group}`;
509+
const sessionDataVar = `compactorsDetail_${group}`;
510+
return getJSONForTable(url, sessionDataVar);
511+
}
512+
474513
/**
475514
* REST GET call for /stats,
476515
* stores it on a sessionStorage variable
477516
*/
478517
function getStats() {
479-
return getJSONfromNewServer('/stats', 'stats');
518+
return getJSONForTable(REST_V2_PREFIX + '/stats', 'stats');
480519
}
481520

482521
/**
483-
* REST GET call for /metrics,
522+
* REST GET call for /compactors/summary/{group},
484523
* stores it on a sessionStorage variable
524+
* @param {string} group Group name
485525
*/
486-
function getMetrics() {
487-
return getJSONfromNewServer('/metrics', 'metrics');
526+
function getCompactorsSummary(group) {
527+
const url = `${REST_V2_PREFIX}/compactors/summary/${group}`;
528+
const sessionDataVar = `compactorsSummary_${group}`;
529+
return getJSONForTable(url, sessionDataVar);
488530
}
489531

490532
/**
491-
* REST GET call for /metrics/lastUpdate,
533+
* REST GET call for /sservers/summary,
492534
* stores it on a sessionStorage variable
493535
*/
494-
function getMetricsLastUpdate() {
495-
return getJSONfromNewServer('/metrics/lastUpdate', 'metricsLastUpdate');
536+
function getSserversSummary() {
537+
return getJSONForTable(REST_V2_PREFIX + '/sservers/summary', 'sserversSummary');
496538
}
497539

498540
/**
499-
* REST GET call for /metrics/instance,
541+
* REST GET call for /tables/{name}/tablets,
500542
* stores it on a sessionStorage variable
543+
* @param {string} name Table name
501544
*/
502-
function getMetricsInstance() {
503-
return getJSONfromNewServer('/metrics/instance', 'metricsInstance');
545+
function getTableTablets(name) {
546+
const url = `${REST_V2_PREFIX}/tables/${name}/tablets`;
547+
const sessionDataVar = `tableTablets_${name}`;
548+
return getJSONForTable(url, sessionDataVar);
504549
}
505550

506551
/**
507-
* REST GET call for /metrics/groups,
552+
* REST GET call for /metrics,
508553
* stores it on a sessionStorage variable
509554
*/
510-
function getMetricsGroups() {
511-
return getJSONfromNewServer('/metrics/groups', 'metricsGroups');
555+
function getMetrics() {
556+
return getJSONForTable(REST_V2_PREFIX + '/metrics', 'metrics');
512557
}
513558

514559
/**
515-
* REST GET call for /metrics/manager,
560+
* REST GET call for /gc,
516561
* stores it on a sessionStorage variable
517562
*/
518-
function getMetricsManager() {
519-
return getJSONfromNewServer('/metrics/manager', 'metricsManager');
563+
function getGc() {
564+
return getJSONForTable(REST_V2_PREFIX + '/gc', 'gc');
520565
}
521566

522567
/**
523-
* REST GET call for /metrics/gc,
568+
* REST GET call for /tservers/detail/{group},
524569
* stores it on a sessionStorage variable
570+
* @param {string} group Group name
525571
*/
526-
function getMetricsGc() {
527-
return getJSONfromNewServer('/metrics/gc', 'metricsGc');
572+
function getTserversDetail(group) {
573+
const url = `${REST_V2_PREFIX}/tservers/detail/${group}`;
574+
const sessionDataVar = `tserversDetail_${group}`;
575+
return getJSONForTable(url, sessionDataVar);
528576
}
529577

530578
/**
531-
* REST GET call for /metrics/compactors/summary and /metrics/compactors/summary/{group},
579+
* REST GET call for /tables,
532580
* stores it on a sessionStorage variable
533-
* @param {string} [group] Optional group name
534581
*/
535-
function getMetricsCompactorsSummary(group) {
536-
const url = group ? `/metrics/compactors/summary/${group}` : '/metrics/compactors/summary';
537-
const sessionDataVar = group ? `metricsCompactorsSummary_${group}` : 'metricsCompactorsSummary';
538-
return getJSONfromNewServer(url, sessionDataVar);
582+
function getTables() {
583+
return getJSONForTable(REST_V2_PREFIX + '/tables', 'tables');
539584
}
540585

541586
/**
542-
* REST GET call for /metrics/compactors/detail/{group},
587+
* REST GET call for /groups,
543588
* stores it on a sessionStorage variable
544-
* @param {string} group Group name
545589
*/
546-
function getMetricsCompactorsDetail(group) {
547-
const url = `/metrics/compactors/detail/${group}`;
548-
const sessionDataVar = `metricsCompactorsDetail_${group}`;
549-
return getJSONfromNewServer(url, sessionDataVar);
590+
function getGroups() {
591+
return getJSONForTable(REST_V2_PREFIX + '/groups', 'groups');
550592
}
551593

552594
/**
553-
* REST GET call for /metrics/sservers/summary and /metrics/sservers/summary/{group},
595+
* REST GET call for /deployment,
554596
* stores it on a sessionStorage variable
555-
* @param {string} [group] Optional group name
556597
*/
557-
function getMetricsSserversSummary(group) {
558-
const url = group ? `/metrics/sservers/summary/${group}` : '/metrics/sservers/summary';
559-
const sessionDataVar = group ? `metricsSserversSummary_${group}` : 'metricsSserversSummary';
560-
return getJSONfromNewServer(url, sessionDataVar);
598+
function getDeployment() {
599+
return getJSONForTable(REST_V2_PREFIX + '/deployment', 'deployment');
561600
}
562601

563602
/**
564-
* REST GET call for /metrics/sservers/detail/{group},
603+
* REST GET call for /sservers/summary/{group},
565604
* stores it on a sessionStorage variable
566605
* @param {string} group Group name
567606
*/
568-
function getMetricsSserversDetail(group) {
569-
const url = `/metrics/sservers/detail/${group}`;
570-
const sessionDataVar = `metricsSserversDetail_${group}`;
571-
return getJSONfromNewServer(url, sessionDataVar);
607+
function getSserversSummaryGroup(group) {
608+
const url = `${REST_V2_PREFIX}/sservers/summary/${group}`;
609+
const sessionDataVar = `sserversSummary_${group}`;
610+
return getJSONForTable(url, sessionDataVar);
611+
}
612+
613+
/**
614+
* REST GET call for /tservers/summary,
615+
* stores it on a sessionStorage variable
616+
*/
617+
function getTserversSummary() {
618+
return getJSONForTable(REST_V2_PREFIX + '/tservers/summary', 'tserversSummary');
572619
}
573620

574621
/**
575-
* REST GET call for /metrics/tservers/summary and /metrics/tservers/summary/{group},
622+
* REST GET call for /instance,
576623
* stores it on a sessionStorage variable
577-
* @param {string} [group] Optional group name
578624
*/
579-
function getMetricsTserversSummary(group) {
580-
const url = group ? `/metrics/tservers/summary/${group}` : '/metrics/tservers/summary';
581-
const sessionDataVar = group ? `metricsTserversSummary_${group}` : 'metricsTserversSummary';
582-
return getJSONfromNewServer(url, sessionDataVar);
625+
function getInstanceInfo() {
626+
return getJSONForTable(REST_V2_PREFIX + '/instance', 'instance');
583627
}
584628

585629
/**
586-
* REST GET call for /metrics/tservers/detail/{group},
630+
* REST GET call for /sservers/detail/{group},
587631
* stores it on a sessionStorage variable
588632
* @param {string} group Group name
589633
*/
590-
function getMetricsTserversDetail(group) {
591-
const url = `/metrics/tservers/detail/${group}`;
592-
const sessionDataVar = `metricsTserversDetail_${group}`;
593-
return getJSONfromNewServer(url, sessionDataVar);
634+
function getSserversDetail(group) {
635+
const url = `${REST_V2_PREFIX}/sservers/detail/${group}`;
636+
const sessionDataVar = `sserversDetail_${group}`;
637+
return getJSONForTable(url, sessionDataVar);
594638
}
595639

596640
/**
597-
* REST GET call for /metrics/compactions/summary,
641+
* REST GET call for /manager,
598642
* stores it on a sessionStorage variable
599643
*/
600-
function getMetricsCompactionsSummary() {
601-
return getJSONfromNewServer('/metrics/compactions/summary', 'metricsCompactionsSummary');
644+
function getManager() {
645+
return getJSONForTable(REST_V2_PREFIX + '/manager', 'manager');
602646
}
603647

604648
/**
605-
* REST GET call for /metrics/compactions/detail and /metrics/compactions/detail/{num},
649+
* REST GET call for /compactors/summary,
606650
* stores it on a sessionStorage variable
607-
* @param {number} [num] Optional detail number
608651
*/
609-
function getMetricsCompactionsDetail(num) {
610-
const url = num ? `/metrics/compactions/detail/${num}` : '/metrics/compactions/detail';
611-
const sessionDataVar = num ? `metricsCompactionsDetail_${num}` : 'metricsCompactionsDetail';
612-
return getJSONfromNewServer(url, sessionDataVar);
652+
function getCompactorsSummary() {
653+
return getJSONForTable(REST_V2_PREFIX + '/compactors/summary', 'compactorsSummary');
613654
}
614655

615656
/**
616-
* REST GET call for /metrics/tables and /metrics/tables/{name},
657+
* REST GET call for /tables/{name},
617658
* stores it on a sessionStorage variable
618-
* @param {string} [name] Optional table name
659+
* @param {string} name Table name
619660
*/
620-
function getMetricsTables(name) {
621-
const url = name ? `/metrics/tables/${name}` : '/metrics/tables';
622-
const sessionDataVar = name ? `metricsTables_${name}` : 'metricsTables';
623-
return getJSONfromNewServer(url, sessionDataVar);
661+
function getTable(name) {
662+
const url = `${REST_V2_PREFIX}/tables/${name}`;
663+
const sessionDataVar = `table_${name}`;
664+
return getJSONForTable(url, sessionDataVar);
624665
}
625666

626667
/**
627-
* REST GET call for /metrics/tables/{name}/tablets,
668+
* REST GET call for /compactions/detail/{num},
628669
* stores it on a sessionStorage variable
629-
* @param {string} name The table name
670+
* @param {number} num Detail number
630671
*/
631-
function getMetricsTableTabletsByName(name) {
632-
const url = `/metrics/tables/${name}/tablets`;
633-
const sessionDataVar = `metricsTableTablets_${name}`;
634-
return getJSONfromNewServer(url, sessionDataVar);
672+
function getCompactionsDetail(num) {
673+
const url = `${REST_V2_PREFIX}/compactions/detail/${num}`;
674+
const sessionDataVar = `compactionsDetail_${num}`;
675+
return getJSONForTable(url, sessionDataVar);
635676
}
636677

637678
/**
638-
* REST GET call for /metrics/deployment,
679+
* REST GET call for /compactions/detail,
639680
* stores it on a sessionStorage variable
640681
*/
641-
function getMetricsDeployment() {
642-
return getJSONfromNewServer('/metrics/deployment', 'metricsDeployment');
682+
function getCompactionsDetail() {
683+
return getJSONForTable(REST_V2_PREFIX + '/compactions/detail', 'compactionsDetail');
643684
}
644685

645686
/**
646-
* REST GET call for /metrics/suggestions,
687+
* REST GET call for /compactions/summary,
647688
* stores it on a sessionStorage variable
648689
*/
649-
function getMetricsSuggestions() {
650-
return getJSONfromNewServer('/metrics/suggestions', 'metricsSuggestions');
690+
function getCompactionsSummary() {
691+
return getJSONForTable(REST_V2_PREFIX + '/compactions/summary', 'compactionsSummary');
651692
}

server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/modals.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919

2020

2121
$(document).ready(function () {
22-
getMetricsInstance().then(function () {
23-
const data = JSON.parse(sessionStorage.metricsInstance);
22+
getInstanceInfo().then(function () {
23+
const data = JSON.parse(sessionStorage.instance);
2424
$('#modal-version').text(data.version);
2525
$('#modal-instance-name').text(data.instanceName);
2626
$('#modal-instance-id').text(data.instanceUUID);

0 commit comments

Comments
 (0)