seunggabi commented on code in PR #45272:
URL: https://github.com/apache/superset/pull/45272#discussion_r4278034876
##########
superset-frontend/src/features/apiKeys/ApiKeyCreateModal.tsx:
##########
@@ -58,6 +58,18 @@ export function ApiKeyCreateModal({
const [createdKey, setCreatedKey] = useState<string | null>(null);
const [copied, setCopied] = useState(false);
const copyTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
+ // Scopes the current user may self-issue; null until loaded (or when the
+ // lookup fails), in which case the full catalog is offered as before.
+ const [allowedScopes, setAllowedScopes] = useState<string[] | null>(null);
Review Comment:
Good catch, thanks. Done in fdee88de6: the state now starts as `undefined`
(lookup in flight → `loading` on the Select, no options offered), `null` only
on an actual error (full catalog), otherwise the allowed subset. It is reset to
`undefined` each time the modal is shown. Added a test for the in-flight window.
##########
superset-frontend/src/features/apiKeys/ApiKeyCreateModal.tsx:
##########
@@ -85,7 +97,12 @@ export function ApiKeyCreateModal({
setCreatedKey(key);
addSuccessToast(t('API key created successfully'));
} catch (error) {
- addDangerToast(t('Failed to create API key'));
+ const { message } = await getClientErrorObject(error);
+ addDangerToast(
+ message
+ ? `${t('Failed to create API key')}: ${message}`
+ : t('Failed to create API key'),
+ );
Review Comment:
Applied in fdee88de6: `t('Failed to create API key: %s', message)`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]