-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Beautify Portal TraceLog UI interface #5149
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -16,160 +16,160 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
*/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
audit_log_menu_module.controller('AuditLogMenuController', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
['$scope', '$window', '$translate', '$document', 'toastr', 'AppService', 'AppUtil', 'EventManager', 'AuditLogService', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
auditLogMenuController] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
auditLogMenuController] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
function auditLogMenuController($scope, $window, $translate, $document, toastr, AppService, AppUtil, EventManager, AuditLogService) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.auditEnabled = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.auditEnabled = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.auditLogList = []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.goToTraceDetailsPage = goToTraceDetailsPage; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.searchByOpNameAndDate = searchByOpNameAndDate; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.getMoreAuditLogs = getMoreAuditLogs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.auditLogList = []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.goToTraceDetailsPage = goToTraceDetailsPage; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.searchByOpNameAndDate = searchByOpNameAndDate; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.getMoreAuditLogs = getMoreAuditLogs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.page = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
var PAGE_SIZE = 10; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.page = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
var PAGE_SIZE = 10; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.opName = ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.startDate = null; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.endDate = null; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.startDateFmt = null; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.endDateFmt = null; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.opName = ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.startDate = null; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.endDate = null; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.startDateFmt = null; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.endDateFmt = null; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.hasLoadAll = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.hasLoadAll = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.options = []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.showSearchDropdown = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.options = []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.showSearchDropdown = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.showOptions = function(query) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.options = []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
searchAuditLogs(query); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.showOptions = function (query) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.options = []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
searchAuditLogs(query); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.selectOption = function(option) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.opName = option.opName; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.showSearchDropdown = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.selectOption = function (option) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.opName = option.opName; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.showSearchDropdown = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+50
to
+53
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Convert this function expression to an arrow function for consistency and improved readability. - $scope.selectOption = function (option) {
- $scope.opName = option.opName;
- $scope.showSearchDropdown = false;
- };
+ $scope.selectOption = (option) => {
+ $scope.opName = option.opName;
+ $scope.showSearchDropdown = false;
+ }; Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
init(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
init(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
function init() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
getAuditProperties(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
initSearchingMenu(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
function init() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
getAuditProperties(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
initSearchingMenu(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
function getAuditProperties() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
AuditLogService.get_properties().then(function (result) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.auditEnabled = result.enabled; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
function initSearchingMenu() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
AuditLogService.find_all_logs($scope.page, PAGE_SIZE).then(function (result) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (!result || result.length < PAGE_SIZE) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.hasLoadAll = true; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (result.length === 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.auditLogList = $scope.auditLogList.concat(result); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
function getAuditProperties() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
AuditLogService.get_properties().then(function (result) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.auditEnabled = result.enabled; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+63
to
+65
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use arrow function for a more concise and modern approach. - function getAuditProperties() {
- AuditLogService.get_properties().then(function (result) {
- $scope.auditEnabled = result.enabled;
- });
- }
+ const getAuditProperties = () => {
+ AuditLogService.get_properties().then((result) => {
+ $scope.auditEnabled = result.enabled;
+ });
+ }; Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
function searchByOpNameAndDate(opName, startDate, endDate) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (startDate !== null) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.startDateFmt = new Date(startDate).Format("yyyy-MM-dd hh:mm:ss.S"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
function initSearchingMenu() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
AuditLogService.find_all_logs($scope.page, PAGE_SIZE).then(function (result) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (!result || result.length < PAGE_SIZE) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.hasLoadAll = true; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (endDate !== null) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.endDateFmt = new Date(endDate).Format("yyyy-MM-dd hh:mm:ss.S"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (result.length === 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.auditLogList = []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.page = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.opName = opName; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.startDate = startDate; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.endDate = endDate; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.auditLogList = $scope.auditLogList.concat(result); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+69
to
+77
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Refactor to use arrow functions for asynchronous operations. - function initSearchingMenu() {
- AuditLogService.find_all_logs($scope.page, PAGE_SIZE).then(function (result) {
- if (!result || result.length < PAGE_SIZE) {
- $scope.hasLoadAll = true;
- }
- if (result.length === 0) {
- return;
- }
- $scope.auditLogList = $scope.auditLogList.concat(result);
- });
- }
+ const initSearchingMenu = () => {
+ AuditLogService.find_all_logs($scope.page, PAGE_SIZE).then((result) => {
+ if (!result || result.length < PAGE_SIZE) {
+ $scope.hasLoadAll = true;
+ }
+ if (result.length === 0) {
+ return;
+ }
+ $scope.auditLogList = $scope.auditLogList.concat(result);
+ });
+ }; Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
function searchByOpNameAndDate(opName, startDate, endDate) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (startDate !== null) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.startDateFmt = new Date(startDate).Format("yyyy-MM-dd hh:mm:ss.S"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (endDate !== null) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.endDateFmt = new Date(endDate).Format("yyyy-MM-dd hh:mm:ss.S"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.auditLogList = []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.page = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.opName = opName; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.startDate = startDate; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.endDate = endDate; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
AuditLogService.find_logs_by_opName( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.opName, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.startDateFmt, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.endDateFmt, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.page, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
PAGE_SIZE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
).then(function (result) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (!result || result.length < PAGE_SIZE) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.hasLoadAll = true; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (result.length === 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.auditLogList = $scope.auditLogList.concat(result); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+98
to
+106
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Convert this function to use arrow syntax for consistency and modern JavaScript practices. - function searchByOpNameAndDate(opName, startDate, endDate) {
- if (startDate !== null) {
- $scope.startDateFmt = new Date(startDate).Format("yyyy-MM-dd hh:mm:ss.S");
- }
- if (endDate !== null) {
- $scope.endDateFmt = new Date(endDate).Format("yyyy-MM-dd hh:mm:ss.S");
- }
- $scope.auditLogList = [];
- $scope.page = 0;
- $scope.opName = opName;
- $scope.startDate = startDate;
- $scope.endDate = endDate;
- AuditLogService.find_logs_by_opName(
- $scope.opName,
- $scope.startDateFmt,
- $scope.endDateFmt,
- $scope.page,
- PAGE_SIZE
- ).then(function (result) {
- if (!result || result.length < PAGE_SIZE) {
- $scope.hasLoadAll = true;
- }
- if (result.length === 0) {
- return;
- }
- $scope.auditLogList = $scope.auditLogList.concat(result);
- });
- }
+ const searchByOpNameAndDate = (opName, startDate, endDate) => {
+ if (startDate !== null) {
+ $scope.startDateFmt = new Date(startDate).Format("yyyy-MM-dd hh:mm:ss.S");
+ }
+ if (endDate !== null) {
+ $scope.endDateFmt = new Date(endDate).Format("yyyy-MM-dd hh:mm:ss.S");
+ }
+ $scope.auditLogList = [];
+ $scope.page = 0;
+ $scope.opName = opName;
+ $scope.startDate = startDate;
+ $scope.endDate = endDate;
+ AuditLogService.find_logs_by_opName(
+ $scope.opName,
+ $scope.startDateFmt,
+ $scope.endDateFmt,
+ $scope.page,
+ PAGE_SIZE
+ ).then((result) => {
+ if (!result || result.length < PAGE_SIZE) {
+ $scope.hasLoadAll = true;
+ }
+ if (result.length === 0) {
+ return;
+ }
+ $scope.auditLogList = $scope.auditLogList.concat(result);
+ });
+ }; Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
function getMoreAuditLogs() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.page = $scope.page + 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if ($scope.opName === '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
AuditLogService.find_all_logs($scope.page, PAGE_SIZE).then(function (result) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (!result || result.length < PAGE_SIZE) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.hasLoadAll = true; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (result.length === 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.auditLogList = $scope.auditLogList.concat(result); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
AuditLogService.find_logs_by_opName( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.opName, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.startDateFmt, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.endDateFmt, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.page, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
PAGE_SIZE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
).then(function (result) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (!result || result.length < PAGE_SIZE) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.hasLoadAll = true; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (result.length === 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.auditLogList = $scope.auditLogList.concat(result); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (!result || result.length < PAGE_SIZE) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.hasLoadAll = true; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (result.length === 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.auditLogList = $scope.auditLogList.concat(result); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
function getMoreAuditLogs() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.page = $scope.page + 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if($scope.opName === '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
AuditLogService.find_all_logs($scope.page, PAGE_SIZE).then(function (result) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (!result || result.length < PAGE_SIZE) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.hasLoadAll = true; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (result.length === 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.auditLogList = $scope.auditLogList.concat(result); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
AuditLogService.find_logs_by_opName( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.opName, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.startDateFmt, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.endDateFmt, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.page, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
PAGE_SIZE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
).then(function (result) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (!result || result.length < PAGE_SIZE) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.hasLoadAll = true; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (result.length === 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.auditLogList = $scope.auditLogList.concat(result); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
function searchAuditLogs(query) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
AuditLogService.search_by_name_or_type_or_operator(query, 0, 20).then(function (result) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
result.forEach(function (log) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
var optionDisplay = log.opName + '-(' + log.opType + ').by:' + log.operator; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
var option = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
id: log.id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
display: optionDisplay, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
opName: log.opName | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.options.push(option); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.showSearchDropdown = $scope.options.length > 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
function searchAuditLogs(query) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
AuditLogService.search_by_name_or_type_or_operator(query, 0, 20).then(function (result) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
result.forEach(function (log) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
var optionDisplay = log.opName + '-(' + log.opType + ').by:' + log.operator; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
var option = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
id: log.id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
display: optionDisplay, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
opName: log.opName | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.options.push(option); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.showSearchDropdown = $scope.options.length > 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+141
to
+152
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Prefer using - result.forEach(function (log) {
- var optionDisplay = log.opName + '-(' + log.opType + ').by:' + log.operator;
- var option = {
- id: log.id,
- display: optionDisplay,
- opName: log.opName
- };
- $scope.options.push(option);
- });
+ for (const log of result) {
+ const optionDisplay = `${log.opName}-(${log.opType}).by:${log.operator}`;
+ const option = {
+ id: log.id,
+ display: optionDisplay,
+ opName: log.opName
+ };
+ $scope.options.push(option);
+ } Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
function goToTraceDetailsPage(traceId) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$window.location.href = AppUtil.prefixPath() + "/audit_log_trace_detail.html?#traceId=" + traceId; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
function goToTraceDetailsPage(traceId) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$window.location.href = AppUtil.prefixPath() + "/audit_log_trace_detail.html?#traceId=" + traceId; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use template literals for string concatenation to improve readability and maintainability. - $window.location.href = AppUtil.prefixPath() + "/audit_log_trace_detail.html?#traceId=" + traceId;
+ $window.location.href = `${AppUtil.prefixPath()}/audit_log_trace_detail.html?#traceId=${traceId}`; Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$document.on('click', function(event) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (!$scope.showSearchDropdown) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$document.on('click', function (event) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (!$scope.showSearchDropdown) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
var target = angular.element(event.target); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
var target = angular.element(event.target); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// 检查点击的目标是否是输入框或下拉栏,如果不是,则隐藏下拉栏 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (!target.hasClass('form-control') && !target.hasClass('options-container')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.$apply(function() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.showSearchDropdown = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// 检查点击的目标是否是输入框或下拉栏,如果不是,则隐藏下拉栏 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (!target.hasClass('form-control') && !target.hasClass('options-container')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.$apply(function () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
$scope.showSearchDropdown = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using arrow functions for cleaner and more concise syntax.
Committable suggestion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BlackBear2003, glad to see the suggestion got a smile! 😄 If you have any questions or need further assistance, feel free to ask. Happy coding!