Copilot commented on code in PR #14314:
URL: https://github.com/apache/gravitino/pull/14314#discussion_r4397462405
##########
web-v2/web/src/components/PolicyTag.js:
##########
@@ -36,18 +35,25 @@ const tagInputStyle = {
export default function PolicyTag({ ...props }) {
const { readOnly, metadataObjectType, metadataObjectFullName } = props
+ const isTag = metadataObjectType === 'tag'
const { token } = theme.useToken()
const [inputVisible, setInputVisible] = useState(false)
const [optionList, setOptionList] = useState([])
const inputRef = useRef(null)
const router = useRouter()
const store = useAppSelector(state => state.policies)
const dispatch = useAppDispatch()
- const [policiesForEntity, setPoliciesForEntity] = useState([])
+ const [policiesForObject, setPoliciesForObject] = useState([])
const searchParams = useSearchParams()
const currentMetalake = searchParams.get('metalake')
- const getPoliciesForEntity = async () => {
+ const getPolicies = async () => {
+ if (isTag) {
+ const { payload } = await dispatch(getPoliciesForTag({ metalake:
currentMetalake, tag: metadataObjectFullName }))
+
+ return payload || []
Review Comment:
The new tag-specific path is untested: `PolicyTag.test.jsx` only renders
`metadataObjectType='table'`, so it never exercises the association response
mapping or the new POST/DELETE endpoints. Please add tag-mode tests covering
initial listing, adding a policy with the `ALL_VALUES` selector, removal with
an empty 204 response, and rejected requests, while retaining the existing
metadata-object tests.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]