Skip to content

Commit

Permalink
fix: 服务可见性与授权开关解耦
Browse files Browse the repository at this point in the history
  • Loading branch information
tingfuyeh committed Sep 5, 2024
1 parent c08808f commit 4014f39
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 87 deletions.
84 changes: 42 additions & 42 deletions web/src/polaris/namespace/operation/Create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ const CreateForm = purify(function CreateForm(props: DuckCmpProps<Duck>) {
<Input field={comment} maxLength={1024} placeholder={'长度不超过1024个字符'} size={'l'} />
</FormField>

{options.authOpen && (
<>
<Button type={'link'} onClick={() => setShowAdvance(!showAdvance)} style={{ cursor: 'pointer' }}>
<Icon type={showAdvance ? 'arrowup' : 'arrowdown'} />
{'高级设置'}
</Button>
{showAdvance && (
<>
{' '}
<>
<Button type={'link'} onClick={() => setShowAdvance(!showAdvance)} style={{ cursor: 'pointer' }}>
<Icon type={showAdvance ? 'arrowup' : 'arrowdown'} />
{'高级设置'}
</Button>

{showAdvance && (
<>
{options.authOpen && (
<FormItem label={'授权'}>
<ResourcePrincipalAuth
userDuck={userSelect}
Expand All @@ -81,39 +81,39 @@ const CreateForm = purify(function CreateForm(props: DuckCmpProps<Duck>) {
dispatch={dispatch}
/>
</FormItem>
<FormItem label={'服务可见性'} tips={'当前命名空间下的服务被允许可见的命名空间列表'} required>
<section style={{ marginBottom: '15px' }}>
<RadioGroup
value={visibilityMode.getValue()}
onChange={v => {
visibilityMode.setValue(v)
service_export_to.setValue([])
}}
>
<Radio name={VisibilityMode.Single}>{'仅当前命名空间'}</Radio>
<Radio name={VisibilityMode.All}>{'全部命名空间(包括新增)'}</Radio>
<Radio name={''}>{'指定命名空间'}</Radio>
</RadioGroup>
</section>
{visibilityMode.getValue() === '' && (
<SelectMultiple
searchable
allOption={{ text: '当前全部命名空间', value: 'all' }}
value={service_export_to.getValue() || []}
options={options.namespaceList || []}
onChange={value => {
service_export_to.setValue(value)
visibilityMode.setValue('')
}}
appearance={'button'}
size='l'
></SelectMultiple>
)}
</FormItem>
</>
)}
</>
)}
)}
<FormItem label={'服务可见性'} tips={'当前命名空间下的服务被允许可见的命名空间列表'} required>
<section style={{ marginBottom: '15px' }}>
<RadioGroup
value={visibilityMode.getValue()}
onChange={v => {
visibilityMode.setValue(v)
service_export_to.setValue([])
}}
>
<Radio name={VisibilityMode.Single}>{'仅当前命名空间'}</Radio>
<Radio name={VisibilityMode.All}>{'全部命名空间(包括新增)'}</Radio>
<Radio name={''}>{'指定命名空间'}</Radio>
</RadioGroup>
</section>
{visibilityMode.getValue() === '' && (
<SelectMultiple
searchable
allOption={{ text: '当前全部命名空间', value: 'all' }}
value={service_export_to.getValue() || []}
options={options.namespaceList || []}
onChange={value => {
service_export_to.setValue(value)
visibilityMode.setValue('')
}}
appearance={'button'}
size='l'
></SelectMultiple>
)}
</FormItem>
</>
)}
</>
</Form>
</>
)
Expand Down
90 changes: 45 additions & 45 deletions web/src/polaris/service/operation/Create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ const CreateForm = purify(function CreateForm(props: DuckCmpProps<Duck>) {
/>
</FormField>

{options.authOpen && (
<>
<Button type={'link'} onClick={() => setShowAdvance(!showAdvance)} style={{ cursor: 'pointer' }}>
<Icon type={showAdvance ? 'arrowup' : 'arrowdown'} />
{'高级设置'}
</Button>
{showAdvance && (
<>
<>
<Button type={'link'} onClick={() => setShowAdvance(!showAdvance)} style={{ cursor: 'pointer' }}>
<Icon type={showAdvance ? 'arrowup' : 'arrowdown'} />
{'高级设置'}
</Button>
{showAdvance && (
<>
{options.authOpen && (
<FormItem label={'授权'}>
<ResourcePrincipalAuth
userDuck={userSelect}
Expand All @@ -114,43 +114,43 @@ const CreateForm = purify(function CreateForm(props: DuckCmpProps<Duck>) {
dispatch={dispatch}
/>
</FormItem>
<FormItem
label={'可见性'}
tips={'当前服务允许可见的命名空间列表,当与命名空间的服务可见性冲突时,优先使用该选项配置'}
required
>
<section style={{ marginBottom: '15px' }}>
<RadioGroup
value={visibilityMode.getValue()}
onChange={v => {
visibilityMode.setValue(v)
export_to.setValue([])
}}
>
<Radio name={VisibilityMode.Single}>{'仅当前命名空间'}</Radio>
<Radio name={VisibilityMode.All}>{'全部命名空间(包括新增)'}</Radio>
<Radio name={''}>{'指定命名空间'}</Radio>
</RadioGroup>
</section>
{visibilityMode.getValue() === '' && (
<SelectMultiple
searchable
allOption={{ text: '当前全部命名空间', value: 'all' }}
value={export_to.getValue() || []}
options={options.namespaceList || []}
onChange={value => {
export_to.setValue(value)
visibilityMode.setValue('')
}}
appearance={'button'}
size='l'
></SelectMultiple>
)}
</FormItem>
</>
)}
</>
)}
)}
<FormItem
label={'可见性'}
tips={'当前服务允许可见的命名空间列表,当与命名空间的服务可见性冲突时,优先使用该选项配置'}
required
>
<section style={{ marginBottom: '15px' }}>
<RadioGroup
value={visibilityMode.getValue()}
onChange={v => {
visibilityMode.setValue(v)
export_to.setValue([])
}}
>
<Radio name={VisibilityMode.Single}>{'仅当前命名空间'}</Radio>
<Radio name={VisibilityMode.All}>{'全部命名空间(包括新增)'}</Radio>
<Radio name={''}>{'指定命名空间'}</Radio>
</RadioGroup>
</section>
{visibilityMode.getValue() === '' && (
<SelectMultiple
searchable
allOption={{ text: '当前全部命名空间', value: 'all' }}
value={export_to.getValue() || []}
options={options.namespaceList || []}
onChange={value => {
export_to.setValue(value)
visibilityMode.setValue('')
}}
appearance={'button'}
size='l'
></SelectMultiple>
)}
</FormItem>
</>
)}
</>
</Form>
</>
)
Expand Down

0 comments on commit 4014f39

Please sign in to comment.