mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-13 22:15:47 +00:00
fix(ui): scope API key create dialog to current tenant only
Owner sees only "System" + current tenant in dropdown (not all tenants). Default selection is current tenant instead of system.
This commit is contained in:
1 parent
7aa47d1baf
commit
4276c043c6
1 file changed
+6
-8
@@ -50,11 +50,9 @@ interface Props {
|
||||
|
||||
export function ApiKeyCreateDialog({ open, onOpenChange, onCreate }: Props) {
|
||||
const { t } = useTranslation("api-keys");
|
||||
const { isOwner, tenants, currentTenantId } = useTenants();
|
||||
const { isOwner, currentTenantId, currentTenantName } = useTenants();
|
||||
|
||||
const defaultTenant = isOwner
|
||||
? currentTenantId || SYSTEM_TENANT
|
||||
: SYSTEM_TENANT;
|
||||
const defaultTenant = currentTenantId || SYSTEM_TENANT;
|
||||
|
||||
const [name, setName] = useState("");
|
||||
const [scopes, setScopes] = useState<string[]>([]);
|
||||
@@ -132,11 +130,11 @@ export function ApiKeyCreateDialog({ open, onOpenChange, onCreate }: Props) {
|
||||
<SelectItem value={SYSTEM_TENANT}>
|
||||
{t("form.tenantSystem")}
|
||||
</SelectItem>
|
||||
{tenants.map((tenant) => (
|
||||
<SelectItem key={tenant.id} value={tenant.id}>
|
||||
{tenant.name}
|
||||
{currentTenantId && (
|
||||
<SelectItem value={currentTenantId}>
|
||||
{currentTenantName || currentTenantId}
|
||||
</SelectItem>
|
||||
))}
|
||||
)}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user