diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/PoliciesPage/PoliciesDetailPage/AddRulePage.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/PoliciesPage/PoliciesDetailPage/AddRulePage.tsx
index ce2376a3046..448a7e10afe 100644
--- a/openmetadata-ui/src/main/resources/ui/src/pages/PoliciesPage/PoliciesDetailPage/AddRulePage.tsx
+++ b/openmetadata-ui/src/main/resources/ui/src/pages/PoliciesPage/PoliciesDetailPage/AddRulePage.tsx
@@ -11,7 +11,7 @@
* limitations under the License.
*/
-import { Button, Col, Form, Row, Space, Typography } from 'antd';
+import { Button, Card, Form, Space, Typography } from 'antd';
import { AxiosError } from 'axios';
import { compare } from 'fast-json-patch';
import { trim } from 'lodash';
@@ -144,39 +144,37 @@ const AddRulePage = () => {
pageTitle={t('label.add-new-entity', {
entity: t('label.rule'),
})}>
-
-
-
+
+
-
- {t('label.add-new-entity', { entity: t('label.rule') })}
-
-
-
-
+
+ {t('label.add-new-entity', { entity: t('label.rule') })}
+
+
+
);
};
diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/PoliciesPage/PoliciesDetailPage/EditRulePage.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/PoliciesPage/PoliciesDetailPage/EditRulePage.tsx
index 61084fbf149..c2772b41bf2 100644
--- a/openmetadata-ui/src/main/resources/ui/src/pages/PoliciesPage/PoliciesDetailPage/EditRulePage.tsx
+++ b/openmetadata-ui/src/main/resources/ui/src/pages/PoliciesPage/PoliciesDetailPage/EditRulePage.tsx
@@ -11,7 +11,7 @@
* limitations under the License.
*/
-import { Button, Card, Col, Form, Row, Space, Typography } from 'antd';
+import { Button, Card, Form, Space, Typography } from 'antd';
import { AxiosError } from 'axios';
import { compare } from 'fast-json-patch';
import { trim } from 'lodash';
@@ -164,52 +164,45 @@ const EditRulePage = () => {
return (
-
-
-
-
-
- {t('label.edit-entity', { entity: t('label.rule') })}{' '}
- {`"${ruleName}"`}
-
-
-
-
-
+
+
+
+ {t('label.edit-entity', { entity: t('label.rule') })}{' '}
+ {`"${ruleName}"`}
+
+
+
);
};
diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/PoliciesPage/PoliciesDetailPage/PoliciesDetailPage.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/PoliciesPage/PoliciesDetailPage/PoliciesDetailPage.tsx
index d5df8387954..879ce092d61 100644
--- a/openmetadata-ui/src/main/resources/ui/src/pages/PoliciesPage/PoliciesDetailPage/PoliciesDetailPage.tsx
+++ b/openmetadata-ui/src/main/resources/ui/src/pages/PoliciesPage/PoliciesDetailPage/PoliciesDetailPage.tsx
@@ -71,11 +71,8 @@ import {
getSettingPath,
} from '../../../utils/RouterUtils';
import { showErrorToast } from '../../../utils/ToastUtils';
-import './policies-detail.less';
import PoliciesDetailsList from './PoliciesDetailsList.component';
-const { TabPane } = Tabs;
-
type Attribute = 'roles' | 'teams';
const PoliciesDetailPage = () => {
@@ -371,6 +368,150 @@ const PoliciesDetailPage = () => {
}
};
+ const rulesTab = useMemo(() => {
+ return (
+
+ {isEmpty(policy.rules) ? (
+
+ ) : (
+ <>
+
+
+
+
+
+ {policy.rules.map((rule) => (
+
+
+
+ {rule.name}
+
+ {getRuleActionElement(rule)}
+
+
+
+ {rule.description && (
+
+
+
+ {`${t('label.description')}:`}
+
+
+
+
+
+
+ )}
+
+
+
+
+ {`${t('label.resource-plural')}:`}
+
+
+
+
+ {rule.resources
+ ?.map((resource) => startCase(resource))
+ ?.join(', ')}
+
+
+
+
+
+
+
+ {`${t('label.operation-plural')}:`}
+
+
+
+
+ {rule.operations?.join(', ')}
+
+
+
+
+
+
+ {`${t('label.effect')}:`}
+
+
+
+
+ {startCase(rule.effect)}
+
+
+
+ {rule.condition && (
+
+
+
+ {`${t('label.condition')}:`}
+
+
+
+ {rule.condition}
+
+
+ )}
+
+
+ ))}
+
+ >
+ )}
+
+ );
+ }, [policy]);
+
+ const tabItems = useMemo(() => {
+ return [
+ {
+ key: 'rules',
+ label: t('label.rule-plural'),
+ children: rulesTab,
+ },
+ {
+ key: 'roles',
+ label: t('label.role-plural'),
+ children: (
+
setEntity({ record, attribute: 'roles' })}
+ />
+ ),
+ },
+ {
+ key: 'teams',
+ label: t('label.team-plural'),
+ children: (
+ setEntity({ record, attribute: 'teams' })}
+ />
+ ),
+ },
+ ];
+ }, [rulesTab, policy]);
+
useEffect(() => {
init();
}, [fqn, policyPermission]);
@@ -449,138 +590,11 @@ const PoliciesDetailPage = () => {
onDescriptionUpdate={handleDescriptionUpdate}
/>
-
-
- {isEmpty(policy.rules) ? (
-
- ) : (
-
-
-
-
- {policy.rules.map((rule) => (
-
-
-
- {rule.name}
-
- {getRuleActionElement(rule)}
-
-
-
- {rule.description && (
-
-
-
- {`${t('label.description')}:`}
-
-
-
-
-
-
- )}
-
-
-
-
- {`${t('label.resource-plural')}:`}
-
-
-
-
- {rule.resources
- ?.map((resource) => startCase(resource))
- ?.join(', ')}
-
-
-
-
-
-
-
- {`${t('label.operation-plural')}:`}
-
-
-
-
- {rule.operations?.join(', ')}
-
-
-
-
-
-
- {`${t('label.effect')}:`}
-
-
-
-
- {startCase(rule.effect)}
-
-
-
- {rule.condition && (
-
-
-
- {`${t('label.condition')}:`}
-
-
-
- {rule.condition}
-
-
- )}
-
-
- ))}
-
-
- )}
-
-
-
- setEntity({ record, attribute: 'roles' })
- }
- />
-
-
-
- setEntity({ record, attribute: 'teams' })
- }
- />
-
-
+
)}
>
diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/PoliciesPage/PoliciesDetailPage/policies-detail.less b/openmetadata-ui/src/main/resources/ui/src/pages/PoliciesPage/PoliciesDetailPage/policies-detail.less
deleted file mode 100644
index 86955a74c62..00000000000
--- a/openmetadata-ui/src/main/resources/ui/src/pages/PoliciesPage/PoliciesDetailPage/policies-detail.less
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2022 Collate.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-@import url('../../../styles/variables.less');
-
-.policies-detail {
- .list-table {
- .ant-table-row .ant-table-cell:first-child,
- .ant-table-thead .ant-table-cell:first-child {
- padding-left: 16px;
- }
- }
-
- .ant-collapse {
- background-color: @white;
- border: 1px solid @border-color;
- box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.12);
- border-radius: 4px;
- .ant-collapse-item {
- .ant-collapse-header {
- padding: 16px;
- align-items: flex-start;
- .ant-collapse-arrow {
- color: @text-color;
- font-size: 14px;
- }
- }
- }
- .ant-collapse-content {
- border-top: none;
- .ant-collapse-content-box {
- padding-top: 0px;
- }
- }
- }
- .ant-space.tabpane-space {
- > .ant-space-item:first-child {
- align-self: flex-end;
- }
- }
-}
diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/RolesPage/RolesDetailPage/RolesDetailPage.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/RolesPage/RolesDetailPage/RolesDetailPage.tsx
index af40e8ae0b3..ec9706c5b51 100644
--- a/openmetadata-ui/src/main/resources/ui/src/pages/RolesPage/RolesDetailPage/RolesDetailPage.tsx
+++ b/openmetadata-ui/src/main/resources/ui/src/pages/RolesPage/RolesDetailPage/RolesDetailPage.tsx
@@ -12,7 +12,7 @@
*/
import Icon from '@ant-design/icons';
-import { Button, Col, Modal, Row, Space, Tabs, Typography } from 'antd';
+import { Button, Card, Col, Modal, Row, Tabs, Typography } from 'antd';
import { AxiosError } from 'axios';
import { compare } from 'fast-json-patch';
import { isEmpty, isUndefined } from 'lodash';
@@ -49,11 +49,8 @@ import { getEntityName } from '../../../utils/EntityUtils';
import { getSettingPath } from '../../../utils/RouterUtils';
import { showErrorToast } from '../../../utils/ToastUtils';
import AddAttributeModal from '../AddAttributeModal/AddAttributeModal';
-import './roles-detail.less';
import RolesDetailPageList from './RolesDetailPageList.component';
-const { TabPane } = Tabs;
-
type Attribute = 'policies' | 'teams' | 'users';
interface AddAttribute {
@@ -292,6 +289,67 @@ const RolesDetailPage = () => {
}
};
+ const tabItems = useMemo(() => {
+ return [
+ {
+ key: 'policies',
+ label: t('label.policy-plural'),
+ children: (
+