forked from ddrilling/asb_cloud_front
Добавлен уникальный key для данных журнала посещений
Изменена строковая сортировка
This commit is contained in:
parent
df9eeae047
commit
996065bd58
@ -1,20 +1,11 @@
|
|||||||
export const makeNumericSorter = (key: string) => (a: any, b: any) => Number(a[key]) - Number(b[key])
|
export const makeNumericSorter = (key: string) => (a: any, b: any) => Number(a[key]) - Number(b[key])
|
||||||
|
|
||||||
export const makeStringSorter = (key: string) => (a: any, b: any) => {
|
export const makeStringSorter = (key: string) => (a: any, b: any) => {
|
||||||
if (a == null) return 1
|
if (!a && !b) return 0
|
||||||
if (b == null) return -1
|
if (!a) return 1
|
||||||
|
if (!b) return -1
|
||||||
|
|
||||||
const aValue = a[key]
|
return ('' + a[key]).localeCompare(b[key])
|
||||||
const bValue = b[key]
|
|
||||||
|
|
||||||
for (let i = 0; i < a.length; i++) {
|
|
||||||
if (isNaN(aValue.charCodeAt(i)) || (aValue.charCodeAt(i) > bValue.charCodeAt(i)))
|
|
||||||
return 1
|
|
||||||
|
|
||||||
if (aValue.charCodeAt(i) > bValue.charCodeAt(i))
|
|
||||||
return -1
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const makeDateSorter = (key: string) => (a: any, b: any) => {
|
export const makeDateSorter = (key: string) => (a: any, b: any) => {
|
||||||
|
@ -22,6 +22,8 @@ export const VisitLog = () => {
|
|||||||
async () => {
|
async () => {
|
||||||
const logData = await RequerstTrackerService.getUsersStat(1000)
|
const logData = await RequerstTrackerService.getUsersStat(1000)
|
||||||
|
|
||||||
|
logData.forEach((log) => log.key = `${log.login}${log.ip}`)
|
||||||
|
|
||||||
setLogData(logData)
|
setLogData(logData)
|
||||||
},
|
},
|
||||||
setIsLoading,
|
setIsLoading,
|
||||||
|
Loading…
Reference in New Issue
Block a user