= ({
+ editing,
+ children,
+ dataIndex,
+ record,
+ inputNode,
+ errorsEdit,
+ editRules,
+ editable,
+ editComponent,
+ mouseOverFct,
+ mouseLeaveFct,
+ showLabelColor,
+ inputColor,
+ ...restProps
+ }) => {
+ let firstTest = false;
+ let secondTest = false;
+
+ if (editable != undefined) {
+ if (editing) {
+ firstTest = true;
+ } else {
+ secondTest = true;
+ }
+ } else {
+ if (editing) {
+ firstTest = true;
+ }
+ }
+
+ const customFormItem = (index: string, customInputNode: JSX.Element) => {
+ if (index != 'description') {
+ return (
+ EN_US[elem] == errorsEdit[index])}
+ />
+ ),
+ validateStatus: 'error',
+ })}
+ rules={[
+ {
+ required: true,
+ message: t('required_' + index),
+ },
+ { ...editRules },
+ ]}
+ >
+ {customInputNode}
+
+ );
+ } else {
+ return (
+ EN_US[elem] == errorsEdit[index])}
+ />
+ ),
+ validateStatus: 'error',
+ })}
+ >
+ {customInputNode}
+
+ );
+ }
+ };
+
+ return (
+
+ {firstTest ? (
+
+ {customFormItem(dataIndex, inputNode)}
+ {showLabelColor && customFormItem('color', inputColor)}
+
+ ) : secondTest ? (
+ <>
+ {children}
+ {editComponent}
+ >
+ ) : (
+ children
+ )}
+ |
+ );
+};
+
+export default EditableTableUsers;
diff --git a/bbbeasy-frontend/src/components/Presets.tsx b/bbbeasy-frontend/src/components/Presets.tsx
index e21b43bc..bb809452 100644
--- a/bbbeasy-frontend/src/components/Presets.tsx
+++ b/bbbeasy-frontend/src/components/Presets.tsx
@@ -98,12 +98,12 @@ type formType = {
};
const PresetsCol: React.FC = ({
- key,
- preset,
- editName,
- editClickHandler,
- copyClickHandler,
- deleteClickHandler,
+ key,
+ preset,
+ editName,
+ editClickHandler,
+ copyClickHandler,
+ deleteClickHandler,
}) => {
const [file, setFile] = React.useState(null);
const [fileList, setFileList] = React.useState(null);
@@ -208,6 +208,9 @@ const PresetsCol: React.FC = ({
setErrorsEdit({});
setIsEditing(false);
};
+ function compareObjs(obj1,obj2){
+ return JSON.stringify(obj1)===JSON.stringify(obj2);
+ }
const handleSaveEdit = async () => {
setErrorsEdit({});
try {
@@ -215,6 +218,11 @@ const PresetsCol: React.FC = ({
PresetsService.edit_preset(values, preset.id)
.then((response) => {
+ if (compareObjs(response.data.preset, preset)) {
+ Notifications.openNotificationWithIcon('info', t('no_changes'));
+ cancelEdit();
+ return;
+ }
editClickHandler(response.data.preset, preset);
cancelEdit();
@@ -395,8 +403,8 @@ const PresetsCol: React.FC = ({
? 'leftTop'
: 'left'
: item.enabled
- ? 'rightTop'
- : 'right'
+ ? 'rightTop'
+ : 'right'
}
overlayClassName={item.enabled ? 'install-tooltip' : 'title-tooltip'}
title={
@@ -472,11 +480,11 @@ const PresetsCol: React.FC = ({
value={
item.value == true
? ReactDomServer.renderToString(
-
- )
+
+ )
: ReactDomServer.renderToString(
-
- )
+
+ )
}
/>
@@ -573,8 +581,8 @@ const PresetsCol: React.FC = ({
label:
'Guest Policy' == modalTitle
? ReactDomServer.renderToString(
-
- )
+
+ )
: data.name,
value: data.value,
}))}
@@ -651,10 +659,7 @@ const Presets = () => {
//edit
const editPreset = (newPreset: MyPresetType, oldPreset: MyPresetType) => {
- if (newPreset.name == oldPreset.name) {
- Notifications.openNotificationWithIcon('info', t('no_changes'));
- return;
- }
+
const newPresets = [...myPresets];
const index = newPresets.findIndex((item) => oldPreset.id === item.id);
if (index > -1 && newPreset != undefined) {
diff --git a/bbbeasy-frontend/src/components/Roles.tsx b/bbbeasy-frontend/src/components/Roles.tsx
index 42a1baa0..734b9812 100644
--- a/bbbeasy-frontend/src/components/Roles.tsx
+++ b/bbbeasy-frontend/src/components/Roles.tsx
@@ -23,7 +23,7 @@ import EN_US from '../locale/en-US.json';
import { PageHeader } from '@ant-design/pro-layout';
-import { Button, Row, Col, Typography, Space, Modal, Popconfirm, Card, Checkbox, Input } from 'antd';
+import {Button, Row, Col, Typography, Space, Modal, Popconfirm, Card, Checkbox, Input, Alert} from 'antd';
import {
DeleteOutlined,
QuestionCircleOutlined,
@@ -408,12 +408,20 @@ const Roles = () => {
editable={editable}
editComponent={
isShown &&
- AuthService.isAllowedAction(actions, 'edit') && (
+ AuthService.isAllowedAction(actions, 'edit') &&(
}
- onClick={toggleEditName}
+ onClick={()=>{
+
+ if(record.key == 1 || record.key == 2 ){
+ Notifications.openNotificationWithIcon('info', t('role_name'));
+ return;
+ }
+ toggleEditName()
+
+ }}
/>
)
}
diff --git a/bbbeasy-frontend/src/components/RoomDetails.tsx b/bbbeasy-frontend/src/components/RoomDetails.tsx
index 4f52c76d..f6787866 100644
--- a/bbbeasy-frontend/src/components/RoomDetails.tsx
+++ b/bbbeasy-frontend/src/components/RoomDetails.tsx
@@ -156,7 +156,12 @@ const RoomDetails = () => {
if (currentUser != null) {
PresetsService.list_presets(currentUser.id).then((result) => {
setPresets(result.data);
- });
+ })
+ .catch((error) => {
+ console.log(error);
+ navigate('/');
+ })
+
}
};
const getLabels = () => {
@@ -166,7 +171,11 @@ const RoomDetails = () => {
labels_data.push({ label: label.name, value: label.color });
});
setLabels(labels_data);
- });
+ })
+ .catch((error) => {
+ console.log(error);
+ navigate('/');
+ });
};
const getRoomRecordings = (id) => {
setLoading(true);
@@ -177,6 +186,7 @@ const RoomDetails = () => {
})
.catch((error) => {
console.log(error);
+ navigate('/');
})
.finally(() => {
setLoading(false);
diff --git a/bbbeasy-frontend/src/components/Users.tsx b/bbbeasy-frontend/src/components/Users.tsx
index 5eeeb034..5f396e8d 100644
--- a/bbbeasy-frontend/src/components/Users.tsx
+++ b/bbbeasy-frontend/src/components/Users.tsx
@@ -28,7 +28,7 @@ import { DeleteOutlined, EditOutlined, QuestionCircleOutlined, StarFilled } from
import { FormInstance } from 'antd/lib/form';
import { CompareRecords } from '../functions/compare.function';
import { EditableTable } from './EditableTable';
-import EditableTableCell from './EditableTableCell';
+import EditableTableUsers from './EditableTableUsers';
import Notifications from './Notifications';
import AddUserForm from './AddUserForm';
import EditableTableColumnSearch from './EditableTableColumnSearch';
@@ -203,13 +203,13 @@ const Users = () => {
// edit
const [editForm] = Form.useForm();
const EditableCell: React.FC = ({
- editing,
- children,
- dataIndex,
- record,
- inputType,
- ...restProps
- }) => {
+ editing,
+ children,
+ dataIndex,
+ record,
+ inputType,
+ ...restProps
+ }) => {
let inputNode: JSX.Element;
if (inputType === 'select') {
const statesOptions = allStates.map((item, index) => (
@@ -223,7 +223,7 @@ const Users = () => {
inputNode = setCancelVisibility(false)} />;
}
return (
- {
{...restProps}
>
{children}
-
+
);
};
const isEditing = (record: UserType) => record.key == editingKey;
diff --git a/bbbeasy-frontend/src/components/layout/AppHeader.tsx b/bbbeasy-frontend/src/components/layout/AppHeader.tsx
index 3c486e7a..69d69904 100644
--- a/bbbeasy-frontend/src/components/layout/AppHeader.tsx
+++ b/bbbeasy-frontend/src/components/layout/AppHeader.tsx
@@ -87,7 +87,7 @@ const AppHeader = () => {
setCurrentUser(null);
localStorage.removeItem('session');
setCurrentSession(null);
- navigate('/login');
+ navigate('/');
})
.catch((error) => {
console.log(error);
diff --git a/bbbeasy-frontend/src/locale/ar-TN.json b/bbbeasy-frontend/src/locale/ar-TN.json
index 09d91627..de516062 100644
--- a/bbbeasy-frontend/src/locale/ar-TN.json
+++ b/bbbeasy-frontend/src/locale/ar-TN.json
@@ -413,5 +413,6 @@
"email-not-exist": "المستخدم غير موجود مع هذا البريد الإلكتروني",
"publish_record_success": "تم نشر التسجيل بنجاح",
- "unpublish_record_success": "تم إلغاء نشر التسجيل بنجاح"
+ "unpublish_record_success": "تم إلغاء نشر التسجيل بنجاح",
+ "role_name": "لا يمكن تغيير هذا الاسم"
}
diff --git a/bbbeasy-frontend/src/locale/en-US.json b/bbbeasy-frontend/src/locale/en-US.json
index d111413a..57bcb69e 100644
--- a/bbbeasy-frontend/src/locale/en-US.json
+++ b/bbbeasy-frontend/src/locale/en-US.json
@@ -431,5 +431,6 @@
"email-not-exist": "User does not exist with this email",
"publish_record_success": "Recording published successfully",
- "unpublish_record_success": "Recording unpublished successfully"
+ "unpublish_record_success": "Recording unpublished successfully",
+ "role_name": "This name cannot be changed"
}
diff --git a/bbbeasy-frontend/src/locale/fr-FR.json b/bbbeasy-frontend/src/locale/fr-FR.json
index 546ea6bb..557a2cc2 100644
--- a/bbbeasy-frontend/src/locale/fr-FR.json
+++ b/bbbeasy-frontend/src/locale/fr-FR.json
@@ -411,5 +411,6 @@
"alwaysAccept": "Toujours accepter",
"alwaysDeny": "Toujours refuser",
"publish_record_success": "Enregistrement publié avec succès",
- "unpublish_record_success": "L'enregistrement a été inédit avec succès"
+ "unpublish_record_success": "L'enregistrement a été inédit avec succès",
+ "role_name": "Ce nom ne peut pas être modifié"
}