Process UXD review for Client Scopes (#1026)
This commit is contained in:
parent
3469ccb509
commit
ddd248ed0e
3 changed files with 33 additions and 20 deletions
|
@ -33,9 +33,11 @@ import { toNewClientScope } from "./routes/NewClientScope";
|
||||||
|
|
||||||
import "./client-scope.css";
|
import "./client-scope.css";
|
||||||
import { toClientScope } from "./routes/ClientScope";
|
import { toClientScope } from "./routes/ClientScope";
|
||||||
|
import { useWhoAmI } from "../context/whoami/WhoAmI";
|
||||||
|
|
||||||
export const ClientScopesSection = () => {
|
export const ClientScopesSection = () => {
|
||||||
const { realm } = useRealm();
|
const { realm } = useRealm();
|
||||||
|
const { whoAmI } = useWhoAmI();
|
||||||
const { t } = useTranslation("client-scopes");
|
const { t } = useTranslation("client-scopes");
|
||||||
|
|
||||||
const adminClient = useAdminClient();
|
const adminClient = useAdminClient();
|
||||||
|
@ -55,9 +57,10 @@ export const ClientScopesSection = () => {
|
||||||
await adminClient.clientScopes.listDefaultClientScopes();
|
await adminClient.clientScopes.listDefaultClientScopes();
|
||||||
const optionalScopes =
|
const optionalScopes =
|
||||||
await adminClient.clientScopes.listDefaultOptionalClientScopes();
|
await adminClient.clientScopes.listDefaultOptionalClientScopes();
|
||||||
|
const clientScopes = await adminClient.clientScopes.find();
|
||||||
|
|
||||||
const clientScopes = (await adminClient.clientScopes.find()).map(
|
return clientScopes
|
||||||
(scope) => {
|
.map((scope) => {
|
||||||
return {
|
return {
|
||||||
...scope,
|
...scope,
|
||||||
type: defaultScopes.find(
|
type: defaultScopes.find(
|
||||||
|
@ -70,10 +73,8 @@ export const ClientScopesSection = () => {
|
||||||
? ClientScope.optional
|
? ClientScope.optional
|
||||||
: AllClientScopes.none,
|
: AllClientScopes.none,
|
||||||
};
|
};
|
||||||
}
|
})
|
||||||
);
|
.sort((a, b) => a.name!.localeCompare(b.name!, whoAmI.getLocale()));
|
||||||
|
|
||||||
return clientScopes;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({
|
const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({
|
||||||
|
@ -232,8 +233,11 @@ export const ClientScopesSection = () => {
|
||||||
name: "name",
|
name: "name",
|
||||||
cellRenderer: ClientScopeDetailLink,
|
cellRenderer: ClientScopeDetailLink,
|
||||||
},
|
},
|
||||||
{ name: "description", cellFormatters: [emptyFormatter()] },
|
{
|
||||||
{ name: "type", cellRenderer: TypeSelector },
|
name: "type",
|
||||||
|
displayKey: "client-scopes:assignedType",
|
||||||
|
cellRenderer: TypeSelector,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "protocol",
|
name: "protocol",
|
||||||
displayKey: "client-scopes:protocol",
|
displayKey: "client-scopes:protocol",
|
||||||
|
@ -246,6 +250,7 @@ export const ClientScopesSection = () => {
|
||||||
cellFormatters: [emptyFormatter()],
|
cellFormatters: [emptyFormatter()],
|
||||||
transforms: [cellWidth(15)],
|
transforms: [cellWidth(15)],
|
||||||
},
|
},
|
||||||
|
{ name: "description", cellFormatters: [emptyFormatter()] },
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
</PageSection>
|
</PageSection>
|
||||||
|
|
|
@ -284,18 +284,25 @@ export const ScopeForm = ({ clientScope, save }: ScopeFormProps) => {
|
||||||
name="attributes.gui-order"
|
name="attributes.gui-order"
|
||||||
defaultValue={1}
|
defaultValue={1}
|
||||||
control={control}
|
control={control}
|
||||||
render={({ onChange, value }) => (
|
render={({ onChange, value }) => {
|
||||||
<NumberInput
|
const MIN_VALUE = 0;
|
||||||
type="text"
|
const setValue = (newValue: number) =>
|
||||||
id="kc-gui-order"
|
onChange(Math.max(newValue, MIN_VALUE));
|
||||||
value={value}
|
|
||||||
onPlus={() => onChange(value + 1)}
|
return (
|
||||||
onMinus={() => onChange(value - 1)}
|
<NumberInput
|
||||||
onChange={(event) =>
|
id="kc-gui-order"
|
||||||
onChange(Number((event.target as HTMLInputElement).value))
|
value={value}
|
||||||
}
|
min={MIN_VALUE}
|
||||||
/>
|
onPlus={() => setValue(value + 1)}
|
||||||
)}
|
onMinus={() => setValue(value - 1)}
|
||||||
|
onChange={(event) => {
|
||||||
|
const newValue = Number(event.currentTarget.value);
|
||||||
|
setValue(!isNaN(newValue) ? newValue : 0);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
<ActionGroup>
|
<ActionGroup>
|
||||||
|
|
|
@ -8,6 +8,7 @@ export default {
|
||||||
"Client scopes allow you to define a common set of protocol mappers and roles, which are shared between multiple clients",
|
"Client scopes allow you to define a common set of protocol mappers and roles, which are shared between multiple clients",
|
||||||
searchFor: "Search for client scope",
|
searchFor: "Search for client scope",
|
||||||
protocol: "Protocol",
|
protocol: "Protocol",
|
||||||
|
assignedType: "Assigned type",
|
||||||
displayOrder: "Display order",
|
displayOrder: "Display order",
|
||||||
type: "Type",
|
type: "Type",
|
||||||
deleteClientScope: "Delete client scope {{name}}",
|
deleteClientScope: "Delete client scope {{name}}",
|
||||||
|
|
Loading…
Reference in a new issue