mirror of
https://github.com/router-for-me/Cli-Proxy-API-Management-Center.git
synced 2026-02-19 03:00:49 +08:00
feat(usage): enhance ServiceHealthCard with scrollable health grid
This commit is contained in:
@@ -137,13 +137,11 @@ export function ServiceHealthCard({ usage, loading }: ServiceHealthCardProps) {
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div className={styles.healthGridScroller}>
|
||||||
className={styles.healthGrid}
|
<div
|
||||||
ref={gridRef}
|
className={styles.healthGrid}
|
||||||
style={{
|
ref={gridRef}
|
||||||
gridTemplateRows: `repeat(${healthData.rows}, 10px)`,
|
>
|
||||||
}}
|
|
||||||
>
|
|
||||||
{healthData.blockDetails.map((detail, idx) => {
|
{healthData.blockDetails.map((detail, idx) => {
|
||||||
const isIdle = detail.rate === -1;
|
const isIdle = detail.rate === -1;
|
||||||
const blockStyle = isIdle ? undefined : { backgroundColor: rateToColor(detail.rate) };
|
const blockStyle = isIdle ? undefined : { backgroundColor: rateToColor(detail.rate) };
|
||||||
@@ -166,6 +164,7 @@ export function ServiceHealthCard({ usage, loading }: ServiceHealthCardProps) {
|
|||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div className={styles.healthLegend}>
|
<div className={styles.healthLegend}>
|
||||||
<span className={styles.healthLegendLabel}>{t('service_health.oldest')}</span>
|
<span className={styles.healthLegendLabel}>{t('service_health.oldest')}</span>
|
||||||
<div className={styles.healthLegendColors}>
|
<div className={styles.healthLegendColors}>
|
||||||
|
|||||||
@@ -975,10 +975,17 @@
|
|||||||
background: var(--failure-badge-bg);
|
background: var(--failure-badge-bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.healthGridScroller {
|
||||||
|
overflow-x: auto;
|
||||||
|
overflow-y: hidden;
|
||||||
|
-webkit-overflow-scrolling: touch;
|
||||||
|
}
|
||||||
|
|
||||||
.healthGrid {
|
.healthGrid {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 3px;
|
gap: 3px;
|
||||||
grid-auto-flow: column;
|
grid-auto-flow: column;
|
||||||
|
grid-template-rows: repeat(7, 10px);
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
@@ -1140,9 +1147,20 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@include mobile {
|
@include mobile {
|
||||||
|
.healthCard {
|
||||||
|
padding: 14px;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.healthGrid {
|
||||||
|
grid-template-rows: repeat(7, 6px);
|
||||||
|
gap: 2px;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.healthBlockWrapper {
|
.healthBlockWrapper {
|
||||||
width: 8px;
|
width: 6px;
|
||||||
height: 8px;
|
height: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.healthTooltip {
|
.healthTooltip {
|
||||||
|
|||||||
Reference in New Issue
Block a user