mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-27 11:24:43 +00:00
Merge pull request #89 from shumaiOne/ui/fix-members-dialog
fix(webui): update members dialog UI and disable auto-focus
This commit is contained in:
@@ -1,22 +1,22 @@
|
||||
import {
|
||||
AlertDialog,
|
||||
AlertDialogAction,
|
||||
AlertDialogCancel,
|
||||
AlertDialogContent,
|
||||
AlertDialogDescription,
|
||||
AlertDialogFooter,
|
||||
AlertDialogHeader,
|
||||
AlertDialogTitle,
|
||||
AlertDialog,
|
||||
AlertDialogAction,
|
||||
AlertDialogCancel,
|
||||
AlertDialogContent,
|
||||
AlertDialogDescription,
|
||||
AlertDialogFooter,
|
||||
AlertDialogHeader,
|
||||
AlertDialogTitle,
|
||||
} from '@/ui/components/ui/alert-dialog'
|
||||
import { Avatar, AvatarFallback, AvatarImage } from '@/ui/components/ui/avatar'
|
||||
import { Button } from '@/ui/components/ui/button'
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/ui/components/ui/dialog'
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuRadioGroup,
|
||||
DropdownMenuRadioItem,
|
||||
DropdownMenuTrigger,
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuRadioGroup,
|
||||
DropdownMenuRadioItem,
|
||||
DropdownMenuTrigger,
|
||||
} from '@/ui/components/ui/dropdown-menu'
|
||||
import { Input } from '@/ui/components/ui/input'
|
||||
import { ChevronDown, Copy, Loader2, Trash2 } from 'lucide-react'
|
||||
@@ -135,7 +135,7 @@ export function MembersDialog({
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={handleOpenChange}>
|
||||
<DialogContent className="sm:max-w-md">
|
||||
<DialogContent className="sm:max-w-md" onOpenAutoFocus={(e) => e.preventDefault()}>
|
||||
<DialogHeader>
|
||||
<DialogTitle>{title}</DialogTitle>
|
||||
</DialogHeader>
|
||||
@@ -161,8 +161,8 @@ export function MembersDialog({
|
||||
</span>
|
||||
{member.scope && (
|
||||
<>
|
||||
<span className="text-[10px] text-muted-foreground/50">•</span>
|
||||
<span className="text-[10px] bg-muted px-1.5 py-0.5 rounded-full font-medium text-muted-foreground uppercase tracking-wider">
|
||||
<span className="text-[10px] text-muted-foreground/70">•</span>
|
||||
<span className="text-xs text-muted-foreground capitalize">
|
||||
{member.scope === 'team' ? 'Team Member' : 'Project Member'}
|
||||
</span>
|
||||
</>
|
||||
@@ -176,9 +176,9 @@ export function MembersDialog({
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button
|
||||
variant="ghost"
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="h-8 px-2 text-xs capitalize"
|
||||
className="h-8 px-2 text-xs capitalize w-26"
|
||||
disabled={updatingMemberId === member.id}
|
||||
>
|
||||
{member.role}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { execSync } from 'node:child_process';
|
||||
import { writeFileSync } from 'node:fs';
|
||||
import { execSync } from 'node:child_process'
|
||||
import { writeFileSync } from 'node:fs'
|
||||
|
||||
/**
|
||||
* This script extracts the exact versions of specific runtime dependencies
|
||||
@@ -14,58 +14,60 @@ const depsToExtract = [
|
||||
'@temporalio/worker',
|
||||
'@temporalio/workflow',
|
||||
'prisma',
|
||||
'sharp'
|
||||
];
|
||||
'sharp',
|
||||
]
|
||||
|
||||
function run(cmd: string) {
|
||||
try {
|
||||
return execSync(cmd, { encoding: 'utf-8', stdio: 'pipe' });
|
||||
return execSync(cmd, { encoding: 'utf-8', stdio: 'pipe' })
|
||||
} catch {
|
||||
console.error(`Command failed: ${cmd}`);
|
||||
return null;
|
||||
console.error(`Command failed: ${cmd}`)
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
console.log('Extracting runtime dependency versions using `bun pm ls --all`...');
|
||||
console.log('Extracting runtime dependency versions using `bun pm ls --all`...')
|
||||
|
||||
const output = run('bun pm ls --all');
|
||||
const output = run('bun pm ls --all')
|
||||
|
||||
if (!output) {
|
||||
console.error('Failed to get dependency list from bun.');
|
||||
process.exit(1);
|
||||
console.error('Failed to get dependency list from bun.')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const deps: Record<string, string> = {};
|
||||
const deps: Record<string, string> = {}
|
||||
|
||||
for (const dep of depsToExtract) {
|
||||
// regex to find the version after the package name in `bun pm ls` output
|
||||
// e.g., ├── @temporalio/client@1.17.2
|
||||
const escapedDep = dep.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
const regex = new RegExp(`(?:^|\\s)${escapedDep}@(\\d+\\.\\d+\\.\\d+[^\\s]*)`, 'g');
|
||||
const match = regex.exec(output);
|
||||
|
||||
const escapedDep = dep.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
||||
const regex = new RegExp(`(?:^|\\s)${escapedDep}@(\\d+\\.\\d+\\.\\d+[^\\s]*)`, 'g')
|
||||
const match = regex.exec(output)
|
||||
|
||||
if (match && match[1]) {
|
||||
// If there are multiple matches (different versions in workspace), we take the first one found.
|
||||
// In our pinned workspace, they should all be the same.
|
||||
deps[dep] = match[1];
|
||||
console.log(` Found ${dep}@${match[1]}`);
|
||||
deps[dep] = match[1]
|
||||
console.log(` Found ${dep}@${match[1]}`)
|
||||
} else {
|
||||
console.warn(` Warning: Could not find version for ${dep} in \`bun pm ls --all\` output.`);
|
||||
console.warn(` Warning: Could not find version for ${dep} in \`bun pm ls --all\` output.`)
|
||||
}
|
||||
}
|
||||
|
||||
if (Object.keys(deps).length === 0) {
|
||||
console.error('Error: No dependencies were extracted. Check if `bun install` was run correctly.');
|
||||
process.exit(1);
|
||||
console.error('Error: No dependencies were extracted. Check if `bun install` was run correctly.')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const runnerPkg = {
|
||||
name: "shumai-runner",
|
||||
version: "1.0.0",
|
||||
name: 'shumai-runner',
|
||||
version: '1.0.0',
|
||||
private: true,
|
||||
dependencies: deps
|
||||
};
|
||||
dependencies: deps,
|
||||
}
|
||||
|
||||
const outputPath = 'runner-package.json';
|
||||
writeFileSync(outputPath, JSON.stringify(runnerPkg, null, 2) + '\n', 'utf-8');
|
||||
console.log(`\nGenerated ${outputPath} with ${Object.keys(deps).length} dependencies for Docker runner stage.`);
|
||||
const outputPath = 'runner-package.json'
|
||||
writeFileSync(outputPath, JSON.stringify(runnerPkg, null, 2) + '\n', 'utf-8')
|
||||
console.log(
|
||||
`\nGenerated ${outputPath} with ${Object.keys(deps).length} dependencies for Docker runner stage.`,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user