Skip to content

Commit 125e5b3

Browse files
committed
fix(settings): persist layout toggle and improve policy row layout
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent b0728ac commit 125e5b3

1 file changed

Lines changed: 22 additions & 8 deletions

File tree

src/views/Settings/PolicyWorkbench/RealPolicyWorkbench.vue

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@
123123
<strong>{{ t('libresign', 'Global default') }}:</strong>
124124
<span v-html="highlightText(summary.defaultSummary)"></span>
125125
</span>
126-
<span class="policy-workbench__settings-row-stat"><strong>{{ t('libresign', 'Group overrides') }}:</strong> {{ summary.groupCount }}</span>
127-
<span class="policy-workbench__settings-row-stat"><strong>{{ t('libresign', 'User overrides') }}:</strong> {{ summary.userCount }}</span>
126+
<span class="policy-workbench__settings-row-stat policy-workbench__settings-row-stat--count"><strong>{{ t('libresign', 'Group overrides') }}:</strong> {{ summary.groupCount }}</span>
127+
<span class="policy-workbench__settings-row-stat policy-workbench__settings-row-stat--count"><strong>{{ t('libresign', 'User overrides') }}:</strong> {{ summary.userCount }}</span>
128128
</div>
129129

130130
<NcButton variant="secondary" class="policy-workbench__manage-button" :aria-label="t('libresign', 'Open setting policy')" @click.stop="state.openSetting(summary.key)">
@@ -498,13 +498,15 @@ import NcTextField from '@nextcloud/vue/components/NcTextField'
498498
499499
import PolicyRuleCard from './PolicyRuleCard.vue'
500500
import { usePoliciesStore } from '../../../store/policies'
501+
import { useUserConfigStore } from '../../../store/userconfig.js'
501502
import { createRealPolicyWorkbenchState } from './useRealPolicyWorkbench'
502503
503504
defineOptions({
504505
name: 'RealPolicyWorkbench',
505506
})
506507
507508
const policiesStore = usePoliciesStore()
509+
const userConfigStore = useUserConfigStore()
508510
const state = reactive(createRealPolicyWorkbenchState())
509511
const settingsFilter = ref('')
510512
const isSmallViewport = ref(false)
@@ -520,6 +522,7 @@ const recentSelectionGesture = ref<{ surface: 'cards' | 'list', key: string, at:
520522
521523
const DRAG_OPEN_THRESHOLD_PX = 6
522524
const SELECTION_GUARD_WINDOW_MS = 400
525+
const CATALOG_LAYOUT_CONFIG_KEY = 'policy_workbench_catalog_compact_view'
523526
524527
const filteredSettingSummaries = computed(() => {
525528
const normalized = settingsFilter.value.trim().toLowerCase()
@@ -775,7 +778,9 @@ function toggleCatalogLayout() {
775778
return
776779
}
777780
778-
catalogLayout.value = effectiveCatalogLayout.value === 'cards' ? 'compact' : 'cards'
781+
const nextLayout = effectiveCatalogLayout.value === 'cards' ? 'compact' : 'cards'
782+
catalogLayout.value = nextLayout
783+
void userConfigStore.update(CATALOG_LAYOUT_CONFIG_KEY, nextLayout === 'compact')
779784
}
780785
781786
function updateViewportMode() {
@@ -848,6 +853,7 @@ async function confirmRuleRemoval() {
848853
849854
onMounted(async () => {
850855
updateViewportMode()
856+
catalogLayout.value = userConfigStore.policy_workbench_catalog_compact_view ? 'compact' : 'cards'
851857
window.addEventListener('resize', updateViewportMode, { passive: true })
852858
await policiesStore.fetchEffectivePolicies()
853859
})
@@ -937,7 +943,7 @@ onBeforeUnmount(() => {
937943
938944
&__settings-row {
939945
display: grid;
940-
grid-template-columns: minmax(240px, 1.2fr) minmax(290px, 1fr) auto;
946+
grid-template-columns: minmax(220px, 1.2fr) minmax(0, 1fr) auto;
941947
gap: 1rem;
942948
align-items: center;
943949
padding: 0.9rem 1rem;
@@ -997,22 +1003,25 @@ onBeforeUnmount(() => {
9971003
}
9981004
9991005
&__settings-row-stats {
1000-
display: grid;
1001-
grid-template-columns: minmax(0, 1.8fr) auto auto;
1002-
gap: 0.65rem;
1006+
display: flex;
1007+
flex-wrap: wrap;
1008+
gap: 0.55rem 0.8rem;
1009+
align-items: baseline;
10031010
font-size: 0.9rem;
10041011
color: var(--color-text-maxcontrast);
10051012
min-width: 0;
10061013
}
10071014
10081015
&__settings-row-stat {
10091016
min-width: 0;
1010-
white-space: nowrap;
1017+
white-space: normal;
1018+
overflow-wrap: anywhere;
10111019
10121020
&--default {
10131021
display: flex;
10141022
align-items: baseline;
10151023
gap: 0.25rem;
1024+
flex: 1 1 260px;
10161025
min-width: 0;
10171026
10181027
strong {
@@ -1028,6 +1037,11 @@ onBeforeUnmount(() => {
10281037
text-overflow: ellipsis;
10291038
}
10301039
}
1040+
1041+
&--count {
1042+
white-space: nowrap;
1043+
flex: 0 0 auto;
1044+
}
10311045
}
10321046
10331047
&__setting-tile {

0 commit comments

Comments
 (0)