bharos commented on code in PR #14570:
URL: https://github.com/apache/gravitino/pull/14570#discussion_r4602977724


##########
web-v2/web/src/app/compliance/policies/CreatePolicyDialog.js:
##########
@@ -156,97 +161,144 @@ export default function CreatePolicyDialog({ ...props }) 
{
         keyboard={false}
         width={800}
         confirmLoading={confirmLoading}
+        okButtonProps={{ disabled: !!editPolicy && !cacheData }}
         onCancel={handleCancel}
       >
         <Paragraph type='secondary'>{!editPolicy ? 'Create a new policy' : 
`Edit the policy ${editPolicy}.`}</Paragraph>
-        <Form
-          form={form}
-          initialValues={defaultValues}
-          layout='vertical'
-          name='policyForm'
-          validateMessages={validateMessages}
-        >
-          <Form.Item
-            name='name'
-            label='Policy Name'
-            rules={[{ required: true }, { type: 'string', max: 64 }, { 
pattern: new RegExp(nameRegex) }]}
-            messageVariables={{ label: 'policy name' }}
-          >
-            <Input placeholder={mismatchName} />
-          </Form.Item>
-          <Form.Item name='enabled' label='Enabled'>
-            <Switch disabled={!!editPolicy} />
-          </Form.Item>
-          <Form.Item name='policyType' label='Policy Type'>
-            <Select>
-              <Select.Option value='custom'>Custom</Select.Option>
-            </Select>
-          </Form.Item>
-          <Form.Item
-            name='supportedObjectTypes'
-            rules={[{ required: true, message: 'Please select supported object 
types!' }]}
-            label='Supported Object Types'
+        <Spin spinning={isLoading}>
+          <Form
+            disabled={!!editPolicy && !cacheData}
+            form={form}
+            initialValues={defaultValues}
+            layout='vertical'
+            name='policyForm'
+            validateMessages={validateMessages}
           >
-            <Select mode='multiple'>
-              {Object.values(supportedObjectTypesMap).map(item => (
-                <Select.Option key={item} value={item}>
-                  {item}
+            <Form.Item
+              name='name'
+              label='Policy Name'
+              rules={[{ required: true }, { type: 'string', max: 64 }, { 
pattern: new RegExp(nameRegex) }]}
+              messageVariables={{ label: 'policy name' }}
+            >
+              <Input placeholder={mismatchName} />
+            </Form.Item>
+            <Form.Item name='enabled' label='Enabled'>
+              <Switch disabled={!!editPolicy} />
+            </Form.Item>
+            <Form.Item name='policyType' label='Policy Type'>
+              <Select disabled={!!editPolicy}>
+                <Select.Option 
value='custom'>{policyTypeLabels.custom}</Select.Option>
+                <Select.Option value='system_access_control' 
disabled={!anthEnable}>
+                  {policyTypeLabels.system_access_control}
                 </Select.Option>
-              ))}
-            </Select>
-          </Form.Item>
-          <Form.Item label='Rule(s)'>
-            <div className='flex flex-col gap-2'>
-              <Form.List name='rules'>
-                {(fields, { add, remove }) => (
-                  <>
-                    {fields.map(({ key, name, ...restField }) => (
-                      <Form.Item label={null} className='align-items-center 
mb-1' key={key}>
-                        <Flex gap='small' align='start'>
-                          <Form.Item
-                            {...restField}
-                            name={[name, 'ruleName']}
-                            rules={[{ required: true, message: 'Please enter 
the rule name!' }]}
-                            className='mb-0 w-full grow'
-                          >
-                            <Input placeholder='Rule Name' />
-                          </Form.Item>
-                          <Form.Item
-                            {...restField}
-                            name={[name, 'ruleContent']}
-                            rules={[{ required: true, message: 'Please enter 
the rule content!' }]}
-                            className='mb-0 w-full grow'
-                          >
-                            <Input placeholder='Rule Content' />
-                          </Form.Item>
-                          <Form.Item className='mb-0 grow-0'>
-                            <Icons.Minus
-                              className='size-8 cursor-pointer text-gray-400 
hover:text-defaultPrimary'
-                              onClick={() => remove(name)}
-                            />
-                          </Form.Item>
-                        </Flex>
-                      </Form.Item>
+              </Select>
+            </Form.Item>
+            {isAccessControl ? (
+              <>
+                <Paragraph type='secondary'>
+                  Grants the selected privileges when any applicable role 
matches. Associate this policy with a tag; it
+                  cannot be assigned directly to a table, schema, or other 
metadata object.

Review Comment:
   nit: could this also say "Users still need USE_CATALOG and USE_SCHEMA, and 
an RBAC deny overrides this policy"? Otherwise a tag grant that seems not to 
work will be confusing.



-- 
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]

Reply via email to