mirror of
https://github.com/YouXam/claude-code-usage-dashboard.git
synced 2026-02-04 15:10:16 +08:00
feat: add schedulable and stoppedReason fields to account interfaces
This commit is contained in:
@@ -7,6 +7,8 @@ interface ClaudeAccount {
|
|||||||
status: string;
|
status: string;
|
||||||
accountType: string;
|
accountType: string;
|
||||||
lastUsedAt: string | null;
|
lastUsedAt: string | null;
|
||||||
|
schedulable?: boolean;
|
||||||
|
stoppedReason?: string;
|
||||||
usage?: {
|
usage?: {
|
||||||
daily?: {
|
daily?: {
|
||||||
tokens: number;
|
tokens: number;
|
||||||
@@ -39,6 +41,8 @@ interface OpenAIAccount {
|
|||||||
status: string;
|
status: string;
|
||||||
accountType: string;
|
accountType: string;
|
||||||
lastUsedAt: string | null;
|
lastUsedAt: string | null;
|
||||||
|
schedulable?: boolean;
|
||||||
|
stoppedReason?: string;
|
||||||
usage?: {
|
usage?: {
|
||||||
daily?: {
|
daily?: {
|
||||||
tokens: number;
|
tokens: number;
|
||||||
@@ -253,9 +257,9 @@ export function AIAccounts({ apiKey }: AIAccountsProps) {
|
|||||||
<tr>
|
<tr>
|
||||||
<th scope="col" className="px-6 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider">Account</th>
|
<th scope="col" className="px-6 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider">Account</th>
|
||||||
<th scope="col" className="px-3 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider">Status</th>
|
<th scope="col" className="px-3 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider">Status</th>
|
||||||
<th scope="col" className="px-3 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider">Daily Usage</th>
|
<th scope="col" className="px-3 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider min-w-[120px]">Daily Usage</th>
|
||||||
<th scope="col" className="px-3 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider">Usage Windows</th>
|
<th scope="col" className="px-3 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider min-w-[200px]">Usage Windows</th>
|
||||||
<th scope="col" className="px-3 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider">Last Used</th>
|
<th scope="col" className="px-3 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider min-w-[110px]">Last Used</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody className="bg-card divide-y divide-border">
|
<tbody className="bg-card divide-y divide-border">
|
||||||
@@ -273,11 +277,36 @@ export function AIAccounts({ apiKey }: AIAccountsProps) {
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td className="px-3 py-3 whitespace-nowrap">
|
<td className="px-3 py-3 whitespace-nowrap">
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
<span className={`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${getStatusColor(account.status)}`}>
|
<span className={`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${getStatusColor(account.status)}`}>
|
||||||
{account.status}
|
{account.status}
|
||||||
</span>
|
</span>
|
||||||
|
{account.schedulable === false && (
|
||||||
|
<span className="relative inline-flex items-center group">
|
||||||
|
<span className="inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-destructive/15 text-destructive cursor-pointer">
|
||||||
|
Not schedulable
|
||||||
|
<svg
|
||||||
|
className="ml-1 h-3 w-3"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
strokeWidth="2"
|
||||||
|
strokeLinecap="round"
|
||||||
|
strokeLinejoin="round"
|
||||||
|
aria-hidden="true"
|
||||||
|
>
|
||||||
|
<circle cx="12" cy="12" r="9" />
|
||||||
|
<path d="M12 8h.01M11 12h1v4h1" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
<span className="pointer-events-none absolute left-1/2 top-full z-10 mt-2 w-max -translate-x-1/2 whitespace-nowrap rounded-md border border-border bg-popover px-2 py-1 text-xs text-popover-foreground shadow-sm opacity-0 transition-opacity duration-150 group-hover:opacity-100">
|
||||||
|
{account.stoppedReason || 'Not schedulable'}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td className="px-3 py-3">
|
<td className="px-3 py-3 min-w-[120px]">
|
||||||
{account.usage?.daily && (isClaudeAccount || account.usage.daily.requests > 0) ? (
|
{account.usage?.daily && (isClaudeAccount || account.usage.daily.requests > 0) ? (
|
||||||
<div className="text-xs">
|
<div className="text-xs">
|
||||||
<div className="text-muted-foreground">{account.usage.daily.requests} reqs</div>
|
<div className="text-muted-foreground">{account.usage.daily.requests} reqs</div>
|
||||||
@@ -287,7 +316,7 @@ export function AIAccounts({ apiKey }: AIAccountsProps) {
|
|||||||
<span className="text-muted-foreground text-xs">{isClaudeAccount ? 'No data' : 'No usage today'}</span>
|
<span className="text-muted-foreground text-xs">{isClaudeAccount ? 'No data' : 'No usage today'}</span>
|
||||||
)}
|
)}
|
||||||
</td>
|
</td>
|
||||||
<td className="px-3 py-3">
|
<td className="px-3 py-3 min-w-[300px]">
|
||||||
{claudeAcc?.claudeUsage ? (
|
{claudeAcc?.claudeUsage ? (
|
||||||
<div className="space-y-1.5 min-w-[180px]">
|
<div className="space-y-1.5 min-w-[180px]">
|
||||||
{claudeAcc.claudeUsage.fiveHour && (
|
{claudeAcc.claudeUsage.fiveHour && (
|
||||||
@@ -333,7 +362,7 @@ export function AIAccounts({ apiKey }: AIAccountsProps) {
|
|||||||
<span className="text-muted-foreground text-xs">No data</span>
|
<span className="text-muted-foreground text-xs">No data</span>
|
||||||
)}
|
)}
|
||||||
</td>
|
</td>
|
||||||
<td className="px-3 py-3 text-muted-foreground text-xs text-left">{formatLastUsed(account.lastUsedAt)}</td>
|
<td className="px-3 py-3 text-muted-foreground text-xs text-left min-w-[110px]">{formatLastUsed(account.lastUsedAt)}</td>
|
||||||
</tr>
|
</tr>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -74,6 +74,8 @@ interface ClaudeAccount {
|
|||||||
status: string;
|
status: string;
|
||||||
accountType: string;
|
accountType: string;
|
||||||
lastUsedAt: string | null;
|
lastUsedAt: string | null;
|
||||||
|
schedulable?: boolean;
|
||||||
|
stoppedReason?: string;
|
||||||
usage?: {
|
usage?: {
|
||||||
daily?: {
|
daily?: {
|
||||||
tokens: number;
|
tokens: number;
|
||||||
@@ -119,6 +121,8 @@ interface OpenAIAccount {
|
|||||||
status: string;
|
status: string;
|
||||||
accountType: string;
|
accountType: string;
|
||||||
lastUsedAt: string | null;
|
lastUsedAt: string | null;
|
||||||
|
schedulable?: boolean;
|
||||||
|
stoppedReason?: string;
|
||||||
usage?: {
|
usage?: {
|
||||||
daily?: {
|
daily?: {
|
||||||
tokens: number;
|
tokens: number;
|
||||||
@@ -425,6 +429,8 @@ export class ApiClient {
|
|||||||
status: acc.status,
|
status: acc.status,
|
||||||
accountType: acc.accountType,
|
accountType: acc.accountType,
|
||||||
lastUsedAt: acc.lastUsedAt,
|
lastUsedAt: acc.lastUsedAt,
|
||||||
|
schedulable: acc.schedulable,
|
||||||
|
stoppedReason: acc.stoppedReason ?? undefined,
|
||||||
usage: acc.usage ? {
|
usage: acc.usage ? {
|
||||||
daily: acc.usage.daily ? {
|
daily: acc.usage.daily ? {
|
||||||
tokens: acc.usage.daily.tokens || 0,
|
tokens: acc.usage.daily.tokens || 0,
|
||||||
@@ -473,6 +479,8 @@ export class ApiClient {
|
|||||||
status: acc.status,
|
status: acc.status,
|
||||||
accountType: acc.accountType,
|
accountType: acc.accountType,
|
||||||
lastUsedAt: acc.lastUsedAt,
|
lastUsedAt: acc.lastUsedAt,
|
||||||
|
schedulable: acc.schedulable,
|
||||||
|
stoppedReason: acc.stoppedReason ?? undefined,
|
||||||
usage: acc.usage ? {
|
usage: acc.usage ? {
|
||||||
daily: acc.usage.daily ? {
|
daily: acc.usage.daily ? {
|
||||||
tokens: acc.usage.daily.tokens || 0,
|
tokens: acc.usage.daily.tokens || 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user