mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-09-03 04:43:01 +00:00
fix: keep our copy-state styling and port stale-instance button hiding
Amends the merge resolution: drop the duplicated copy icon/tooltip block
that main reintroduced in ApiKeyCell (ours already declares it with the
text-success token), and port the functional change from main e40061965
that hides the Delete all stale button entirely when no stale instances
exist instead of rendering it disabled.
This commit is contained in:
@@ -85,16 +85,6 @@ export function ApiKeyCell({ apiKey }: { apiKey: ApiKey }) {
|
||||
if (ok) markKeyCopied(apiKey.id)
|
||||
}, [resolvedFullKey, resolveRealKey, apiKey.id, markKeyCopied])
|
||||
|
||||
let copyIcon = <Copy className='size-3.5' />
|
||||
let copyTooltip = t('Copy API key')
|
||||
if (isLoading) {
|
||||
copyIcon = <Loader2 className='size-3.5 animate-spin' />
|
||||
copyTooltip = t('Loading...')
|
||||
} else if (isCopied) {
|
||||
copyIcon = <Check className='size-3.5 text-green-600' />
|
||||
copyTooltip = t('Copied!')
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='flex max-w-full min-w-0 items-center'>
|
||||
<Popover open={popoverOpen} onOpenChange={handlePopoverOpen}>
|
||||
|
||||
+26
-25
@@ -503,6 +503,7 @@ export function SystemInstancesPanel() {
|
||||
const staleInstances = instances.filter(
|
||||
(instance) => instance.status === 'stale'
|
||||
)
|
||||
const hasStaleInstances = staleInstances.length > 0
|
||||
const loading = instancesQuery.isLoading
|
||||
const refreshing = instancesQuery.isFetching && !instancesQuery.isLoading
|
||||
|
||||
@@ -640,31 +641,31 @@ export function SystemInstancesPanel() {
|
||||
seconds: INSTANCE_POLL_INTERVAL_MS / 1000,
|
||||
})}
|
||||
</span>
|
||||
<Button
|
||||
type='button'
|
||||
variant='destructive'
|
||||
onClick={() => setDeleteAllConfirmOpen(true)}
|
||||
disabled={
|
||||
staleInstances.length === 0 ||
|
||||
isMutatingInstance ||
|
||||
deleteStaleInstancesMutation.isPending
|
||||
}
|
||||
>
|
||||
{deleteStaleInstancesMutation.isPending ? (
|
||||
<Loader2
|
||||
data-icon='inline-start'
|
||||
className='size-3.5 animate-spin'
|
||||
aria-hidden='true'
|
||||
/>
|
||||
) : (
|
||||
<Trash2
|
||||
data-icon='inline-start'
|
||||
className='size-3.5'
|
||||
aria-hidden='true'
|
||||
/>
|
||||
)}
|
||||
{t('Delete all stale')}
|
||||
</Button>
|
||||
{hasStaleInstances ? (
|
||||
<Button
|
||||
type='button'
|
||||
variant='destructive'
|
||||
onClick={() => setDeleteAllConfirmOpen(true)}
|
||||
disabled={
|
||||
isMutatingInstance || deleteStaleInstancesMutation.isPending
|
||||
}
|
||||
>
|
||||
{deleteStaleInstancesMutation.isPending ? (
|
||||
<Loader2
|
||||
data-icon='inline-start'
|
||||
className='size-3.5 animate-spin'
|
||||
aria-hidden='true'
|
||||
/>
|
||||
) : (
|
||||
<Trash2
|
||||
data-icon='inline-start'
|
||||
className='size-3.5'
|
||||
aria-hidden='true'
|
||||
/>
|
||||
)}
|
||||
{t('Delete all stale')}
|
||||
</Button>
|
||||
) : null}
|
||||
<Button
|
||||
type='button'
|
||||
variant='outline'
|
||||
|
||||
Reference in New Issue
Block a user