Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions js/apps/admin-ui/cypress/e2e/partial_import_test.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
{
"clients": [
{
"clientId": "customer-portal",
"enabled": true,
"adminUrl": "/customer-portal",
"baseUrl": "/customer-portal",
"redirectUris": [
"/customer-portal/*"
],
"secret": "password"
}]
"clients": [
{
"clientId": "customer-portal3",
"enabled": true,
"adminUrl": "/customer-portal",
"baseUrl": "/customer-portal",
"redirectUris": ["/customer-portal/*"],
"secret": "password"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -394,6 +395,7 @@ export default function NewAttributeSettings() {
});

await saveTranslations();
i18n.reloadResources();
navigate(toUserProfile({ realm: realmName, tab: "attributes" }));

addAlert(t("createAttributeSuccess"), AlertVariant.success);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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);
Expand All @@ -238,15 +240,22 @@ export const RealmOverrides = ({
onConfirm: async () => {
try {
for (const key of selectedRowKeys) {
await adminClient.realms.deleteRealmLocalizationTexts({
realm: currentRealm!,
selectedLocale: selectMenuLocale,
key: key,
});
delete (
i18n.store.data[whoAmI.getLocale()]["translation"] as Record<
string,
string
>
)[key],
await adminClient.realms.deleteRealmLocalizationTexts({
realm: currentRealm!,
selectedLocale: selectMenuLocale,
key: key,
});
}
setAreAllRowsSelected(false);
setSelectedRowKeys([]);
refreshTable();

addAlert(t("deleteAllTranslationsSuccess"), AlertVariant.success);
} catch (error) {
addError("deleteAllTranslationsError", error);
Expand Down Expand Up @@ -309,6 +318,7 @@ export const RealmOverrides = ({
},
value,
);
i18n.reloadResources();

addAlert(t("updateTranslationSuccess"), AlertVariant.success);
setTableRows(newRows);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]) => {
Expand Down Expand Up @@ -346,6 +347,7 @@ export default function AttributesGroupForm() {

if (success) {
await saveTranslations();
i18n.reloadResources();
navigate(toUserProfile({ realm: realmName, tab: "attributes-group" }));
}
};
Expand Down