-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(plugin-form): disable scoped plugin toggle #1816
base: main
Are you sure you want to change the base?
Conversation
@@ -99,6 +114,9 @@ export default { | |||
entity() { | |||
return this.schema.entity | |||
}, | |||
scope() { | |||
return this.entity.replace('_',' ').replace(/s$/,'') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if we add some entity with three words in the name, or the name ends with y
? I think it's clearer to create a string mapping instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a second thought, should the scope
value also be an i18n key? Maybe we can use entity
as that key directly?
v-for="(option, i) in schema.fields" | ||
:key="i" | ||
class="option-group" | ||
:class="{ 'radio-diabled': $props.disabled }" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:class="{ 'radio-diabled': $props.disabled }" | |
:class="{ 'radio-disabled': $props.disabled }" |
@@ -157,6 +178,16 @@ export default { | |||
flex-direction: row; | |||
gap: $kui-space-80; | |||
} | |||
|
|||
.radio-diabled { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.radio-diabled { | |
.radio-disabled { |
|
||
input { | ||
cursor: not-allowed; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can group the above rulesets.
@@ -443,7 +443,8 @@ const defaultFormSchema: DefaultPluginsSchemaRecord = reactive({ | |||
}, | |||
// plugin scoping | |||
selectionGroup: { | |||
type: !props.hideScopeSelection ? 'selectionGroup' : props.hideScopeSelection || (formType.value === EntityBaseFormType.Create && props.config.entityId) ? 'foreign' : 'selectionGroup', | |||
type: 'selectionGroup', | |||
disabled: !props.hideScopeSelection ? false : props.hideScopeSelection || (formType.value === EntityBaseFormType.Create && props.config.entityId) ? true : false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's reverse the condition for better readability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. When i copied those code, i already found it weird that || (formType.value === EntityBaseFormType.Create && props.config.entityId)
is totally not working
fb59b8f
to
5b29f32
Compare
Note: let's merge this PR after 3.9 code freeze. |
@@ -1,6 +1,8 @@ | |||
{ | |||
"general": { | |||
"packageName": "forms" | |||
"packageName": "forms", | |||
"disable_global_radio": "The plugin is set to 'Scoped' by default when configured under a {scope}. To configure a global plugin, navigate to the plugin list page.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about adding global
?
"disable_global_radio": "The plugin is set to 'Scoped' by default when configured under a {scope}. To configure a global plugin, navigate to the plugin list page.", | |
"disable_global_radio": "The plugin is set to 'Scoped' by default when configured under a {scope}. To configure a global plugin, navigate to the global plugin list page.", |
5b29f32
to
51d0701
Compare
Preview components from this PR in consuming applicationIn consuming application project install preview versions of shared packages generated by this PR:
|
Summary
KM-621
Instead of hiding scope selection group under scoped plugin, the source scope is fixed and global/scoped checkbox group is greyed out with explanation(by passing a new prop
disableScopeSelection
). This keeps UI consistency and provide easier configuration of scoped plugins.Slack: https://kongstrong.slack.com/archives/C03NRECFJPM/p1732126368893859?thread_ts=1729624945.925459&cid=C03NRECFJPM
KM
disableScopeSelection
is not passed,hideScopeSelection
is kept.KM Dev Portal
GM
hideScopeSelection
is replaced bydisableScopeSelection
.GM preview link: https://pr-5021--gateway-manager.cloud-preview.konghq.tech/gateway-manager