refactor(ui): drawer replica filter uses DS Select
This commit is contained in:
@@ -49,6 +49,12 @@
|
|||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.replicaLabel {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
.emptyState {
|
.emptyState {
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { useMemo, useState } from 'react';
|
import { useMemo, useState } from 'react';
|
||||||
|
import { Select } from '@cameleer/design-system';
|
||||||
import { useInfiniteApplicationLogs } from '../../../../api/queries/logs';
|
import { useInfiniteApplicationLogs } from '../../../../api/queries/logs';
|
||||||
import type { Deployment } from '../../../../api/queries/admin/apps';
|
import type { Deployment } from '../../../../api/queries/admin/apps';
|
||||||
import { instanceIdsFor } from './instance-id';
|
import { instanceIdsFor } from './instance-id';
|
||||||
@@ -28,23 +29,24 @@ export function LogsPanel({ deployment, appSlug, envSlug }: Props) {
|
|||||||
isAtTop: true,
|
isAtTop: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const replicaOptions = [
|
||||||
|
{ value: 'all', label: `all (${deployment.replicaStates.length})` },
|
||||||
|
...deployment.replicaStates.map((_, i) => ({ value: String(i), label: String(i) })),
|
||||||
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div className={styles.filterBar}>
|
<div className={styles.filterBar}>
|
||||||
<label>
|
<label className={styles.replicaLabel}>
|
||||||
Replica:
|
<span>Replica:</span>
|
||||||
<select
|
<Select
|
||||||
value={String(replicaFilter)}
|
value={String(replicaFilter)}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
const v = e.target.value;
|
const v = e.target.value;
|
||||||
setReplicaFilter(v === 'all' ? 'all' : Number(v));
|
setReplicaFilter(v === 'all' ? 'all' : Number(v));
|
||||||
}}
|
}}
|
||||||
>
|
options={replicaOptions}
|
||||||
<option value="all">all ({deployment.replicaStates.length})</option>
|
/>
|
||||||
{deployment.replicaStates.map((_, i) => (
|
|
||||||
<option key={i} value={i}>{i}</option>
|
|
||||||
))}
|
|
||||||
</select>
|
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
{logs.items.length === 0 && !logs.isLoading && (
|
{logs.items.length === 0 && !logs.isLoading && (
|
||||||
|
|||||||
Reference in New Issue
Block a user