Skip to content

Commit

Permalink
Merge pull request #248 from shuhaib-aot/Bugfix/FWF-3540-show-only-re…
Browse files Browse the repository at this point in the history
…levent-groups

 FWF 3540 [ bugfix] fixed groups showing in multi tenant and label changed
  • Loading branch information
shuhaib-aot authored Aug 7, 2024
2 parents 0e6a663 + 0b0d73e commit a862f25
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 11 deletions.
12 changes: 8 additions & 4 deletions forms-flow-admin/src/components/dashboard/dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import "react-bootstrap-table2-paginator/dist/react-bootstrap-table2-paginator.m
import paginationFactory from "react-bootstrap-table2-paginator";
import { toast } from "react-toastify";
import Loading from "../loading";
import { useParams } from "react-router-dom";
import {removeTenantKey} from "../../utils/utils.js";
import { MULTITENANCY_ENABLED } from "../../constants";

import {
updateAuthorization,
fetchAuthorizations,
Expand Down Expand Up @@ -44,7 +48,7 @@ export const InsightDashboard = React.memo((props: any) => {
const [isAuthUpdated, setIsAuthUpdated] = React.useState(false);

const { t } = useTranslation();

const { tenantId } = useParams();
const [remainingGroups, setRemainingGroups] = React.useState([]);

const [activeRow, setActiveRow] = React.useState(null);
Expand Down Expand Up @@ -181,7 +185,7 @@ export const InsightDashboard = React.memo((props: any) => {
},
{
dataField: "roles",
text: <Translation>{(t) => t("Access Groups")}</Translation>,
text: <Translation>{(t) => t("Access Roles")}</Translation>,
formatter: (cell, rowData) => {
return (
<div className="d-flex flex-wrap col-12">
Expand All @@ -190,7 +194,7 @@ export const InsightDashboard = React.memo((props: any) => {
style={{ background: "#EAEFFF" }}
data-testid={`dashboard-access-group-${i}`}>
<span className="">
{label}
{MULTITENANCY_ENABLED ? removeTenantKey(label,tenantId) : label}
<i
className="fa-solid fa-xmark chip-close ms-2"
onClick={() => removeDashboardAuth(rowData, label)}
Expand Down Expand Up @@ -227,7 +231,7 @@ export const InsightDashboard = React.memo((props: any) => {
onClick={() => addDashboardAuth(item)}
data-testid={`dashboard-remaining-group-${key}`}
>
{item.path}
{MULTITENANCY_ENABLED ? removeTenantKey(item.path, tenantId) : item.path}
</div>
))
) : (
Expand Down
13 changes: 13 additions & 0 deletions forms-flow-admin/src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,16 @@ export const removingTenantId = (roles=[], tenantId, tenantIdInPath = false) =>
}
return roles;
};


export const removeTenantKey = (value, tenantkey) => {
const tenantKeyCheck = value.match(`${tenantkey}-`);
if (
tenantKeyCheck &&
tenantKeyCheck[0].toLowerCase() === `${tenantkey.toLowerCase()}-`
) {
return value.replace(`${tenantkey.toLowerCase()}-`, "");
} else {
return false;
}
};
3 changes: 2 additions & 1 deletion forms-flow-service/src/resourceBundles/bg/resourceBundles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1200,5 +1200,6 @@ export const RESOURCE_BUNDLES_BG = {
"Proceed to Sign In": "Продължете към Вход",
"Contact formsflow.ai support": "Свържете се с поддръжката на formsflow.ai",
"Please provide your tenant name to sign in": "Моля, предоставете името на вашата аренда, за да влезете",
"Tenant not found":"Наемателят не е намерен"
"Tenant not found":"Наемателят не е намерен",
"Access Roles": "Роли за достъп",
}
3 changes: 2 additions & 1 deletion forms-flow-service/src/resourceBundles/de/resourceBundles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1205,6 +1205,7 @@ export const RESOURCE_BUNDLES_DE = {
"Proceed to Sign In": "Weiter zur Anmeldung",
"Contact formsflow.ai support": "Kontaktieren Sie den Support von formsflow.ai",
"Please provide your tenant name to sign in": "Bitte geben Sie Ihren Mandantenname zum Anmelden ein",
"Tenant not found":"Mandant nicht gefunden"
"Tenant not found":"Mandant nicht gefunden",
"Access Roles": "Zugriffsrollen",

}
3 changes: 2 additions & 1 deletion forms-flow-service/src/resourceBundles/en/resourceBundles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -708,5 +708,6 @@ export const RESOURCE_BUNDLES_EN ={
"Proceed to Sign In": "Proceed to Sign In",
"Contact formsflow.ai support": "Contact formsflow.ai support",
"Please provide your tenant name to sign in": "Please provide your tenant name to sign in",
"Tenant not found":"Tenant not found"
"Tenant not found":"Tenant not found",
"Access Roles" :"Access Roles",
}
3 changes: 2 additions & 1 deletion forms-flow-service/src/resourceBundles/es/resourceBundles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -689,5 +689,6 @@ export const RESOURCE_BUNDLES_ES = {
"Proceed to Sign In": "Continuar para iniciar sesión",
"Contact formsflow.ai support": "Contactar con el soporte de formsflow.ai",
"Please provide your tenant name to sign in": "Por favor, proporcione el nombre de su inquilino para iniciar sesión",
"Tenant not found":"Inquilino no encontrado"
"Tenant not found":"Inquilino no encontrado",
"Access Roles": "Roles de acceso",
}
3 changes: 2 additions & 1 deletion forms-flow-service/src/resourceBundles/fr/resourceBundles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,8 @@ export const RESOURCE_BUNDLES_FR ={
"Proceed to Sign In": "Procéder à la connexion",
"Contact formsflow.ai support": "Contacter le support de formsflow.ai",
"Please provide your tenant name to sign in": "Veuillez fournir le nom de votre locataire pour vous connecter",
"Tenant not found":"Locataire non trouvé"
"Tenant not found":"Locataire non trouvé",
"Access Roles": "Rôles d'accès",
}


Expand Down
3 changes: 2 additions & 1 deletion forms-flow-service/src/resourceBundles/pt/resourceBundles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1202,5 +1202,6 @@ export const RESOURCE_BUNDLES_PT ={
"Proceed to Sign In": "Prosseguir para Entrar",
"Contact formsflow.ai support": "Contactar suporte formsflow.ai",
"Please provide your tenant name to sign in": "Por favor, forneça o nome do seu inquilino para entrar",
"Tenant not found":"Inquilino não encontrado"
"Tenant not found":"Inquilino não encontrado",
"Access Roles": "Funções de Acesso",
};
3 changes: 2 additions & 1 deletion forms-flow-service/src/resourceBundles/zh/resourceBundles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1189,5 +1189,6 @@ export const RESOURCE_BUNDLES_ZH = {
"Proceed to Sign In": "继续登录",
"Contact formsflow.ai support": "联系 formsflow.ai 支持",
"Please provide your tenant name to sign in": "请提供您的租户名称以登录",
"Tenant not found":"未找到租户"
"Tenant not found":"未找到租户",
"Access Roles": "访问角色",
}

0 comments on commit a862f25

Please sign in to comment.