|
200 | 200 | </label> |
201 | 201 | </div> |
202 | 202 | <div v-if="state.viewMode === 'system-admin'" class="policy-workbench__crud-create"> |
203 | | - <p class="policy-workbench__table-note policy-workbench__table-note--compact"> |
204 | | - {{ t('libresign', 'Select the scope filter to choose where the next rule will be created.') }} |
205 | | - </p> |
| 203 | + <label class="policy-workbench__create-inline"> |
| 204 | + <span>{{ t('libresign', 'Create in') }}</span> |
| 205 | + <select class="policy-workbench__create-select" :value="newRuleScope" @change="setNewRuleScope(($event.target as HTMLSelectElement).value as 'system' | 'group' | 'user', true)"> |
| 206 | + <option value="system">{{ t('libresign', 'Instance') }}</option> |
| 207 | + <option value="group">{{ t('libresign', 'Group') }}</option> |
| 208 | + <option value="user">{{ t('libresign', 'User') }}</option> |
| 209 | + </select> |
| 210 | + </label> |
206 | 211 | <NcButton variant="primary" size="small" :disabled="isCreateRuleDisabled" :title="createRuleDisabledReason || undefined" @click="startCreateRule()"> |
207 | 212 | {{ t('libresign', 'Create rule') }} |
208 | 213 | </NcButton> |
|
263 | 268 | </NcActionButton> |
264 | 269 | </NcActions> |
265 | 270 | </template> |
266 | | - <span class="policy-workbench__table-note">{{ t('libresign', 'Read only') }}</span> |
| 271 | + <span v-else class="policy-workbench__table-note">{{ t('libresign', 'Read only') }}</span> |
267 | 272 | </td> |
268 | 273 | </tr> |
269 | 274 | <tr v-if="pagedCrudRows.length === 0"> |
@@ -401,6 +406,7 @@ const lastPress = ref<{ surface: 'cards' | 'list', key: string, x: number, y: nu |
401 | 406 | const recentSelectionGesture = ref<{ surface: 'cards' | 'list', key: string, at: number } | null>(null) |
402 | 407 | const crudSearch = ref('') |
403 | 408 | const crudScopeFilter = ref<'all' | 'system' | 'group' | 'user'>('all') |
| 409 | +const newRuleScope = ref<'system' | 'group' | 'user'>('group') |
404 | 410 | const crudPage = ref(1) |
405 | 411 | const CRUD_PAGE_SIZE = 20 |
406 | 412 |
|
@@ -544,15 +550,11 @@ const editorHelp = computed(() => { |
544 | 550 | }) |
545 | 551 |
|
546 | 552 | const createRuleDisabledReason = computed(() => { |
547 | | - if (crudScopeFilter.value === 'all') { |
548 | | - return t('libresign', 'Select Instance, Group, or User in the scope filter before creating a rule.') |
549 | | - } |
550 | | -
|
551 | | - if (crudScopeFilter.value === 'group') { |
| 553 | + if (newRuleScope.value === 'group') { |
552 | 554 | return state.createGroupOverrideDisabledReason || '' |
553 | 555 | } |
554 | 556 |
|
555 | | - if (crudScopeFilter.value === 'user') { |
| 557 | + if (newRuleScope.value === 'user') { |
556 | 558 | return state.createUserOverrideDisabledReason || '' |
557 | 559 | } |
558 | 560 |
|
@@ -649,16 +651,20 @@ function setCrudScopeFilter(value: 'all' | 'system' | 'group' | 'user', selected |
649 | 651 | crudPage.value = 1 |
650 | 652 | } |
651 | 653 |
|
652 | | -function startCreateRule() { |
653 | | - if (isCreateRuleDisabled.value) { |
| 654 | +function setNewRuleScope(value: 'system' | 'group' | 'user', selected: boolean) { |
| 655 | + if (!selected) { |
654 | 656 | return |
655 | 657 | } |
656 | 658 |
|
657 | | - if (crudScopeFilter.value === 'all') { |
| 659 | + newRuleScope.value = value |
| 660 | +} |
| 661 | +
|
| 662 | +function startCreateRule() { |
| 663 | + if (isCreateRuleDisabled.value) { |
658 | 664 | return |
659 | 665 | } |
660 | 666 |
|
661 | | - state.startEditor({ scope: crudScopeFilter.value }) |
| 667 | + state.startEditor({ scope: newRuleScope.value }) |
662 | 668 | } |
663 | 669 |
|
664 | 670 | function onSettingsFilterChange(value: string | number) { |
@@ -1894,6 +1900,24 @@ onBeforeUnmount(() => { |
1894 | 1900 | } |
1895 | 1901 | } |
1896 | 1902 |
|
| 1903 | + &__create-inline { |
| 1904 | + display: inline-flex; |
| 1905 | + align-items: center; |
| 1906 | + gap: 0.45rem; |
| 1907 | + font-size: 0.84rem; |
| 1908 | + color: var(--color-text-maxcontrast); |
| 1909 | + } |
| 1910 | +
|
| 1911 | + &__create-select { |
| 1912 | + height: 2rem; |
| 1913 | + min-width: 8.5rem; |
| 1914 | + padding: 0 0.5rem; |
| 1915 | + border: 1px solid color-mix(in srgb, var(--color-border-maxcontrast) 68%, transparent); |
| 1916 | + border-radius: 8px; |
| 1917 | + background: var(--color-main-background); |
| 1918 | + color: var(--color-main-text); |
| 1919 | + } |
| 1920 | +
|
1897 | 1921 | &__table-empty-state { |
1898 | 1922 | display: flex; |
1899 | 1923 | flex-direction: column; |
|
0 commit comments