-
-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
459 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { parse as parseRedisInfo } from 'redis-info'; | ||
import { BullBoardRequest, ControllerHandlerReturnType, RedisStats } from '../../typings/app'; | ||
import { BaseAdapter } from '../queueAdapters/base'; | ||
|
||
function formatUptime(uptime: number) { | ||
const date = new Date(uptime * 1000); | ||
const days = date.getUTCDate() - 1, | ||
hours = date.getUTCHours(), | ||
minutes = date.getUTCMinutes(), | ||
seconds = date.getUTCSeconds(); | ||
|
||
// Initialize an array for the uptime. | ||
const segments = []; | ||
|
||
// Format the uptime string. | ||
if (days > 0) segments.push(days + ' day' + (days == 1 ? '' : 's')); | ||
if (hours > 0) segments.push(hours + ' hour' + (hours == 1 ? '' : 's')); | ||
if (minutes > 0) segments.push(minutes + ' minute' + (minutes == 1 ? '' : 's')); | ||
if (seconds > 0 && days === 0) segments.push(seconds + ' second' + (seconds == 1 ? '' : 's')); | ||
return segments.join(', '); | ||
} | ||
|
||
async function getStats(queue: BaseAdapter): Promise<RedisStats> { | ||
const redisInfoRaw = await queue.getRedisInfo(); | ||
const redisInfo = parseRedisInfo(redisInfoRaw); | ||
|
||
return { | ||
version: redisInfo.redis_version, | ||
mode: redisInfo.redis_mode, | ||
port: +redisInfo.tcp_port, | ||
os: redisInfo.os, | ||
uptime: formatUptime(+redisInfo.uptime_in_seconds), | ||
memory: { | ||
total: +redisInfo.total_system_memory || +redisInfo.maxmemory, | ||
used: +redisInfo.used_memory, | ||
fragmentationRatio: +redisInfo.mem_fragmentation_ratio, | ||
peak: +redisInfo.used_memory_peak, | ||
}, | ||
clients: { | ||
connected: +redisInfo.connected_clients, | ||
blocked: +redisInfo.blocked_clients, | ||
}, | ||
}; | ||
} | ||
|
||
export async function redisStatsHandler({ | ||
queues: bullBoardQueues, | ||
}: BullBoardRequest): Promise<ControllerHandlerReturnType> { | ||
const pairs = [...bullBoardQueues.values()]; | ||
|
||
const body = pairs.length > 0 ? await getStats(pairs[0]) : {}; | ||
|
||
return { | ||
body, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
import { AppQueue, ValidMetrics } from './app'; | ||
import { AppQueue } from './app'; | ||
|
||
export interface GetQueuesResponse { | ||
stats: Partial<ValidMetrics>; | ||
queues: AppQueue[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 0 additions & 97 deletions
97
packages/ui/src/components/ConfirmModal/ConfirmModal.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,100 +1,3 @@ | ||
@keyframes fadeIn { | ||
from { | ||
opacity: 0; | ||
} | ||
to { | ||
opacity: 1; | ||
} | ||
} | ||
|
||
@keyframes fadeOut { | ||
from { | ||
opacity: 1; | ||
} | ||
to { | ||
opacity: 0; | ||
} | ||
} | ||
|
||
@keyframes slideUp { | ||
from { | ||
transform: translateY(16px); | ||
opacity: 0; | ||
} | ||
to { | ||
transform: translateY(0); | ||
opacity: 1; | ||
} | ||
} | ||
|
||
@keyframes slideDown { | ||
from { | ||
transform: translateY(0); | ||
opacity: 1; | ||
} | ||
to { | ||
transform: translateY(16px); | ||
opacity: 0; | ||
} | ||
} | ||
|
||
.overlay[data-state='open'] { | ||
animation: fadeIn 150ms ease-out; | ||
} | ||
|
||
.overlay[data-state='closed'] { | ||
animation: fadeOut 150ms ease-in 150ms; | ||
} | ||
|
||
.contentWrapper[data-state='open'] { | ||
animation: slideUp 150ms ease-out; | ||
} | ||
|
||
.contentWrapper[data-state='closed'] { | ||
animation: slideDown 150ms ease-in; | ||
} | ||
|
||
.overlay { | ||
position: fixed; | ||
top: 0 !important; | ||
left: 0 !important; | ||
width: 100%; | ||
height: 100%; | ||
text-align: center; | ||
vertical-align: middle; | ||
padding: 1em; | ||
background-color: rgba(0, 0, 0, 0.85); | ||
user-select: none; | ||
will-change: opacity; | ||
z-index: 1000; | ||
} | ||
|
||
.contentWrapper { | ||
padding: 1rem; | ||
position: fixed; | ||
top: 0 !important; | ||
left: 0 !important; | ||
width: 100%; | ||
height: 100%; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
z-index: 1100; | ||
} | ||
|
||
.content { | ||
max-width: 450px; | ||
width: 100%; | ||
background-color: white; | ||
border-radius: 0.5rem; | ||
padding: 1rem; | ||
} | ||
|
||
.actions { | ||
background: #f9fafb; | ||
margin: 1rem -1rem -1rem; | ||
border-radius: 0 0 0.5rem 0.5rem; | ||
padding: 1rem 1rem; | ||
text-align: right; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
packages/ui/src/components/HeaderActions/HeaderActions.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.actions { | ||
padding: 0; | ||
margin: 0; | ||
list-style: none; | ||
} | ||
|
||
.button { | ||
font-size: 1rem; | ||
padding: 0.65rem; | ||
} | ||
|
||
.button > svg { | ||
width: 1.5rem; | ||
} |
Oops, something went wrong.