Fixed refreshing translations on user detail's tab (#30199)
* added translations refresh Signed-off-by: Agnieszka Gancarczyk <agancarc@redhat.com> * added translation refresh on adding new translation from realm overrides Signed-off-by: Agnieszka Gancarczyk <agancarc@redhat.com> * added translation refresh on deleting translations from realm overrides Signed-off-by: Agnieszka Gancarczyk <agancarc@redhat.com> * fixed test Signed-off-by: Agnieszka Gancarczyk <agancarc@redhat.com> * fixed test Signed-off-by: Agnieszka Gancarczyk <agancarc@redhat.com> * fixed test Signed-off-by: Agnieszka Gancarczyk <agancarc@redhat.com> * fixed test Signed-off-by: Agnieszka Gancarczyk <agancarc@redhat.com> --------- Signed-off-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com>
This commit is contained in:
parent
67098f0469
commit
83af3bc455
5 changed files with 34 additions and 20 deletions
|
@ -110,7 +110,7 @@ describe("Partial import test", () => {
|
|||
modal.importButton().click();
|
||||
|
||||
cy.contains("One record added");
|
||||
cy.contains("customer-portal");
|
||||
cy.contains("customer-portal3");
|
||||
modal.closeButton().click();
|
||||
});
|
||||
|
||||
|
@ -119,8 +119,9 @@ describe("Partial import test", () => {
|
|||
|
||||
//clear button should be disabled if there is nothing in the dialog
|
||||
modal.clearButton().should("be.disabled");
|
||||
modal.textArea().type("test", { force: true });
|
||||
modal.textArea().get(".view-lines").should("have.text", "test");
|
||||
modal.textArea().get(".view-lines").should("have.text", "");
|
||||
modal.textArea().type("{}", { force: true });
|
||||
modal.textArea().get(".view-lines").should("have.text", "{}");
|
||||
modal.clearButton().should("not.be.disabled");
|
||||
modal.clearButton().click();
|
||||
modal.clickClearConfirmButton();
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
{
|
||||
"clients": [
|
||||
{
|
||||
"clientId": "customer-portal",
|
||||
"clientId": "customer-portal3",
|
||||
"enabled": true,
|
||||
"adminUrl": "/customer-portal",
|
||||
"baseUrl": "/customer-portal",
|
||||
"redirectUris": [
|
||||
"/customer-portal/*"
|
||||
],
|
||||
"redirectUris": ["/customer-portal/*"],
|
||||
"secret": "password"
|
||||
}]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import { AttributeAnnotations } from "./user-profile/attribute/AttributeAnnotati
|
|||
import { AttributeGeneralSettings } from "./user-profile/attribute/AttributeGeneralSettings";
|
||||
import { AttributePermission } from "./user-profile/attribute/AttributePermission";
|
||||
import { AttributeValidations } from "./user-profile/attribute/AttributeValidations";
|
||||
import { i18n } from "../i18n/i18n";
|
||||
|
||||
type TranslationForm = {
|
||||
locale: string;
|
||||
|
@ -394,6 +395,7 @@ export default function NewAttributeSettings() {
|
|||
});
|
||||
|
||||
await saveTranslations();
|
||||
i18n.reloadResources();
|
||||
navigate(toUserProfile({ realm: realmName, tab: "attributes" }));
|
||||
|
||||
addAlert(t("createAttributeSuccess"), AlertVariant.success);
|
||||
|
|
|
@ -49,7 +49,7 @@ import { ListEmptyState } from "../../components/list-empty-state/ListEmptyState
|
|||
import { PaginatingTableToolbar } from "../../components/table-toolbar/PaginatingTableToolbar";
|
||||
import { useRealm } from "../../context/realm-context/RealmContext";
|
||||
import { useWhoAmI } from "../../context/whoami/WhoAmI";
|
||||
import { DEFAULT_LOCALE } from "../../i18n/i18n";
|
||||
import { DEFAULT_LOCALE, i18n } from "../../i18n/i18n";
|
||||
import { localeToDisplayName } from "../../util";
|
||||
import { AddTranslationModal } from "../AddTranslationModal";
|
||||
|
||||
|
@ -218,6 +218,8 @@ export const RealmOverrides = ({
|
|||
refreshTable();
|
||||
translationForm.setValue("key", "");
|
||||
translationForm.setValue("value", "");
|
||||
i18n.reloadResources();
|
||||
|
||||
addAlert(t("addTranslationSuccess"), AlertVariant.success);
|
||||
} catch (error) {
|
||||
addError(t("addTranslationError"), error);
|
||||
|
@ -238,6 +240,12 @@ export const RealmOverrides = ({
|
|||
onConfirm: async () => {
|
||||
try {
|
||||
for (const key of selectedRowKeys) {
|
||||
delete (
|
||||
i18n.store.data[whoAmI.getLocale()]["translation"] as Record<
|
||||
string,
|
||||
string
|
||||
>
|
||||
)[key],
|
||||
await adminClient.realms.deleteRealmLocalizationTexts({
|
||||
realm: currentRealm!,
|
||||
selectedLocale: selectMenuLocale,
|
||||
|
@ -247,6 +255,7 @@ export const RealmOverrides = ({
|
|||
setAreAllRowsSelected(false);
|
||||
setSelectedRowKeys([]);
|
||||
refreshTable();
|
||||
|
||||
addAlert(t("deleteAllTranslationsSuccess"), AlertVariant.success);
|
||||
} catch (error) {
|
||||
addError("deleteAllTranslationsError", error);
|
||||
|
@ -309,6 +318,7 @@ export const RealmOverrides = ({
|
|||
},
|
||||
value,
|
||||
);
|
||||
i18n.reloadResources();
|
||||
|
||||
addAlert(t("updateTranslationSuccess"), AlertVariant.success);
|
||||
setTableRows(newRows);
|
||||
|
|
|
@ -40,6 +40,7 @@ import {
|
|||
AddTranslationsDialog,
|
||||
TranslationsType,
|
||||
} from "./attribute/AddTranslationsDialog";
|
||||
import { i18n } from "../../i18n/i18n";
|
||||
|
||||
function parseAnnotations(input: Record<string, unknown>): KeyValueType[] {
|
||||
return Object.entries(input).reduce((p, [key, value]) => {
|
||||
|
@ -346,6 +347,7 @@ export default function AttributesGroupForm() {
|
|||
|
||||
if (success) {
|
||||
await saveTranslations();
|
||||
i18n.reloadResources();
|
||||
navigate(toUserProfile({ realm: realmName, tab: "attributes-group" }));
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue