@@ -2,6 +2,8 @@ import React from 'react';
22
33import { DefinitionList } from '@gravity-ui/components' ;
44import type { DefinitionListItem } from '@gravity-ui/components' ;
5+ import { SquareCheck } from '@gravity-ui/icons' ;
6+ import { Icon } from '@gravity-ui/uikit' ;
57
68import { ResponseError } from '../../../components/Errors/ResponseError' ;
79import { Loader } from '../../../components/Loader' ;
@@ -94,6 +96,7 @@ function getAclListItems(acl?: TACE[]): DefinitionListItem[] {
9496 return {
9597 name : Subject ,
9698 content : < DefinitionValue value = { definedDataEntries [ 0 ] [ 1 ] } /> ,
99+ multilineName : true ,
97100 } ;
98101 }
99102 return {
@@ -105,6 +108,7 @@ function getAclListItems(acl?: TACE[]): DefinitionListItem[] {
105108 return {
106109 name : aclParamToName [ key ] ,
107110 content : < DefinitionValue value = { value } /> ,
111+ multilineName : true ,
108112 } ;
109113 }
110114 return undefined ;
@@ -121,8 +125,22 @@ function getOwnerItem(owner?: string): DefinitionListItem[] {
121125 }
122126 return [
123127 {
124- name : < span className = { b ( 'owner' ) } > { preparedOwner } </ span > ,
125- content : < span className = { b ( 'owner' ) } > { i18n ( 'title_owner' ) } </ span > ,
128+ name : preparedOwner ,
129+ content : i18n ( 'title_owner' ) ,
130+ multilineName : true ,
131+ } ,
132+ ] ;
133+ }
134+
135+ function getInterruptInheritanceItem ( flag ?: boolean ) : DefinitionListItem [ ] {
136+ if ( ! flag ) {
137+ return [ ] ;
138+ }
139+ return [
140+ {
141+ name : i18n ( 'title_interupt-inheritance' ) ,
142+ content : < Icon data = { SquareCheck } size = { 20 } /> ,
143+ multilineName : true ,
126144 } ,
127145 ] ;
128146}
@@ -132,13 +150,15 @@ export const Acl = ({path, database}: {path: string; database: string}) => {
132150
133151 const loading = isFetching && ! currentData ;
134152
135- const { acl, effectiveAcl, owner} = currentData || { } ;
153+ const { acl, effectiveAcl, owner, interruptInheritance } = currentData || { } ;
136154
137155 const aclListItems = getAclListItems ( acl ) ;
138156 const effectiveAclListItems = getAclListItems ( effectiveAcl ) ;
139157
140158 const ownerItem = getOwnerItem ( owner ) ;
141159
160+ const interruptInheritanceItem = getInterruptInheritanceItem ( interruptInheritance ) ;
161+
142162 if ( loading ) {
143163 return < Loader /> ;
144164 }
@@ -155,26 +175,34 @@ export const Acl = ({path, database}: {path: string; database: string}) => {
155175
156176 return (
157177 < div className = { b ( ) } >
158- { accessRightsItems . length ? (
159- < React . Fragment >
160- < div className = { b ( 'list-title' ) } > { i18n ( 'title_rights' ) } </ div >
161- < DefinitionList
162- items = { accessRightsItems }
163- nameMaxWidth = { 200 }
164- className = { b ( 'result' ) }
165- />
166- </ React . Fragment >
167- ) : null }
168- { effectiveAclListItems . length ? (
169- < React . Fragment >
170- < div className = { b ( 'list-title' ) } > { i18n ( 'title_effective-rights' ) } </ div >
171- < DefinitionList
172- items = { effectiveAclListItems }
173- nameMaxWidth = { 200 }
174- className = { b ( 'result' ) }
175- />
176- </ React . Fragment >
177- ) : null }
178+ < AclDefinitionList items = { interruptInheritanceItem } />
179+ < AclDefinitionList items = { accessRightsItems } title = { i18n ( 'title_rights' ) } />
180+ < AclDefinitionList
181+ items = { effectiveAclListItems }
182+ title = { i18n ( 'title_effective-rights' ) }
183+ />
178184 </ div >
179185 ) ;
180186} ;
187+
188+ interface AclDefinitionListProps {
189+ items : DefinitionListItem [ ] ;
190+ title ?: string ;
191+ }
192+
193+ function AclDefinitionList ( { items, title} : AclDefinitionListProps ) {
194+ if ( ! items . length ) {
195+ return null ;
196+ }
197+ return (
198+ < React . Fragment >
199+ { title && < div className = { b ( 'list-title' ) } > { title } </ div > }
200+ < DefinitionList
201+ items = { items }
202+ nameMaxWidth = { 200 }
203+ className = { b ( 'result' , { 'no-title' : ! title } ) }
204+ responsive
205+ />
206+ </ React . Fragment >
207+ ) ;
208+ }
0 commit comments