Fix localization bug (#747)
* wip provider details provider details wip move files wip wip wip all provider details remove controllers save and update working address console warnings remove log stmt update test keep aes only remove comments remove unused hook and function remove unused props revert ldap logs fix localization bug remove files * format
This commit is contained in:
parent
da8bc7c829
commit
1fe7e4ccab
2 changed files with 5 additions and 13 deletions
|
@ -23,6 +23,7 @@ import { useAdminClient } from "../context/auth/AdminClient";
|
||||||
import { ListEmptyState } from "../components/list-empty-state/ListEmptyState";
|
import { ListEmptyState } from "../components/list-empty-state/ListEmptyState";
|
||||||
import { AddMessageBundleModal } from "./AddMessageBundleModal";
|
import { AddMessageBundleModal } from "./AddMessageBundleModal";
|
||||||
import { useAlerts } from "../components/alert/Alerts";
|
import { useAlerts } from "../components/alert/Alerts";
|
||||||
|
import { useRealm } from "../context/realm-context/RealmContext";
|
||||||
|
|
||||||
type LocalizationTabProps = {
|
type LocalizationTabProps = {
|
||||||
save: (realm: RealmRepresentation) => void;
|
save: (realm: RealmRepresentation) => void;
|
||||||
|
@ -58,8 +59,7 @@ export const LocalizationTab = ({
|
||||||
const themeTypes = useServerInfo().themes!;
|
const themeTypes = useServerInfo().themes!;
|
||||||
const bundleForm = useForm<BundleForm>({ mode: "onChange" });
|
const bundleForm = useForm<BundleForm>({ mode: "onChange" });
|
||||||
const { addAlert } = useAlerts();
|
const { addAlert } = useAlerts();
|
||||||
|
const { realm: currentRealm } = useRealm();
|
||||||
console.log(realm.supportedLocales);
|
|
||||||
|
|
||||||
const watchSupportedLocales = useWatch({
|
const watchSupportedLocales = useWatch({
|
||||||
control,
|
control,
|
||||||
|
@ -73,14 +73,8 @@ export const LocalizationTab = ({
|
||||||
defaultValue: realm?.internationalizationEnabled,
|
defaultValue: realm?.internationalizationEnabled,
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("ok", realm);
|
|
||||||
|
|
||||||
const loader = async () => {
|
const loader = async () => {
|
||||||
if (realm) {
|
if (realm) {
|
||||||
// if(realm.supportedLocales?.length === 0) {
|
|
||||||
// return [[]];
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
const result = await adminClient.realms.getRealmLocalizationTexts({
|
const result = await adminClient.realms.getRealmLocalizationTexts({
|
||||||
realm: realm.realm!,
|
realm: realm.realm!,
|
||||||
selectedLocale: getValues("defaultLocale") || "en",
|
selectedLocale: getValues("defaultLocale") || "en",
|
||||||
|
@ -88,7 +82,6 @@ export const LocalizationTab = ({
|
||||||
return Object.keys(result).map((key) => [key, result[key]]);
|
return Object.keys(result).map((key) => [key, result[key]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// }
|
|
||||||
return [[]];
|
return [[]];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -103,7 +96,7 @@ export const LocalizationTab = ({
|
||||||
});
|
});
|
||||||
await adminClient.realms.addLocalization(
|
await adminClient.realms.addLocalization(
|
||||||
{
|
{
|
||||||
realm: realm.realm!,
|
realm: currentRealm!,
|
||||||
selectedLocale: getValues("defaultLocale") || "en",
|
selectedLocale: getValues("defaultLocale") || "en",
|
||||||
key: pair.key,
|
key: pair.key,
|
||||||
},
|
},
|
||||||
|
@ -111,7 +104,7 @@ export const LocalizationTab = ({
|
||||||
);
|
);
|
||||||
|
|
||||||
adminClient.setConfig({
|
adminClient.setConfig({
|
||||||
realmName: realm.realm,
|
realmName: currentRealm!,
|
||||||
});
|
});
|
||||||
refresh();
|
refresh();
|
||||||
addAlert(t("realm-settings:pairCreatedSuccess"), AlertVariant.success);
|
addAlert(t("realm-settings:pairCreatedSuccess"), AlertVariant.success);
|
||||||
|
|
|
@ -36,8 +36,7 @@ export const RSAModal = ({
|
||||||
handleModalToggle,
|
handleModalToggle,
|
||||||
open,
|
open,
|
||||||
refresh,
|
refresh,
|
||||||
}: // save,
|
}: RSAModalProps) => {
|
||||||
RSAModalProps) => {
|
|
||||||
const { t } = useTranslation("groups");
|
const { t } = useTranslation("groups");
|
||||||
const serverInfo = useServerInfo();
|
const serverInfo = useServerInfo();
|
||||||
const adminClient = useAdminClient();
|
const adminClient = useAdminClient();
|
||||||
|
|
Loading…
Reference in a new issue