Skip to content
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

Sidebar panel extension #10111

Merged
merged 27 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7c48653
feat: introduce sidebar panels as extension point
kulmann Nov 7, 2023
20e0e99
refactor: move files app sidebar into web-pkg
kulmann Nov 13, 2023
333d089
feat: generic file sidebar in AppWrapper
kulmann Nov 16, 2023
2ebbbee
fix: displayed info in details panel within apps
kulmann Dec 5, 2023
779eacf
feat: add FileSideBar to preview app
kulmann Dec 5, 2023
bf8a703
refactor: move panel filtering to SideBar
kulmann Dec 5, 2023
f650be9
refactor: rename isEnabled to isVisible in SideBarPanel
kulmann Dec 5, 2023
434a819
refactor: rename files scope to resource
kulmann Dec 6, 2023
b4ef359
refactor: rename open and sideBarOpen to isOpen and isSideBarOpen
kulmann Dec 6, 2023
c163be7
refactor: use unknown instead of any
kulmann Dec 6, 2023
f8d7d4f
feat: introduce root element in SideBarPanelContext interface
kulmann Dec 6, 2023
cb4e81e
refactor: use kebab case for extension ids
kulmann Dec 6, 2023
bb7941d
fix: opening right sidebar in spaces or shares overview
kulmann Dec 7, 2023
2e2a6f0
fix: right sidebar in trashbin views
kulmann Dec 7, 2023
8be2145
feat(sidebarPanel): Make content use all available vertical space
dschmidt Dec 7, 2023
c28c5b6
feat: add onPanelActive subscription helper
dschmidt Dec 7, 2023
cb084cb
fix: hide useless items in details panel for personal space root
kulmann Dec 8, 2023
44d23d9
refactor: types
kulmann Dec 8, 2023
39754d9
fix: types
kulmann Dec 11, 2023
f665c97
test: adjust unit tests for FileSideBar
JammingBen Dec 11, 2023
dc91a43
fix: wrong types
JammingBen Dec 11, 2023
d3a74fe
style: run linter
JammingBen Dec 11, 2023
1c60350
test: fix unit tests
JammingBen Dec 11, 2023
476dba5
test: fix acceptance and e2e tests
kulmann Dec 11, 2023
987513e
docs: add changelog item
kulmann Dec 11, 2023
8c1a51f
feat: move sidebar toggle button into the topbar
kulmann Dec 11, 2023
53c4871
fix: enforce sidebar width
kulmann Dec 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions changelog/unreleased/enhancement-extensions-sidebar-panels
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Enhancement: Registering right sidebar panels as extension

Right sidebar panels can now be registered as extensions via our extension registry. They need to be of type `sidebarPanel`.
The benefit of this is that any app can register additional panels to be shown in the right sidebar while previously the
available panels were hardcoded.

https://github.com/owncloud/web/pull/10111
6 changes: 6 additions & 0 deletions changelog/unreleased/enhancement-file-sidebar
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Enhancement: File sidebar in viewer and editor apps

Viewer and editor apps now have the same right sidebar available like the `files` app.
This makes in place viewing file details, tagging, sharing, and much more possible.

https://github.com/owncloud/web/pull/10111
60 changes: 13 additions & 47 deletions packages/web-app-admin-settings/src/components/AppTemplate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,6 @@
:per-page-default="perPageDefault"
per-page-storage-prefix="admin-settings"
/>
<oc-button
v-if="sideBarAvailablePanels.length"
id="files-toggle-sidebar"
v-oc-tooltip="toggleSidebarButtonLabel"
:aria-label="toggleSidebarButtonLabel"
appearance="raw"
class="oc-my-s oc-p-xs"
@click.stop="toggleSideBar"
>
<oc-icon name="side-bar-right" :fill-type="toggleSidebarButtonIconFillType" />
</oc-button>
</div>
</div>
<div
Expand All @@ -51,12 +40,12 @@
<slot name="mainContent" />
</div>
<side-bar
v-if="sideBarOpen"
v-if="isSideBarOpen"
:active-panel="sideBarActivePanel"
:available-panels="sideBarAvailablePanels"
:panel-context="sideBarPanelContext"
:loading="sideBarLoading"
:open="sideBarOpen"
:is-header-compact="isSideBarHeaderCompact"
:is-open="isSideBarOpen"
@select-panel="selectPanel"
@close="closeSideBar"
>
Expand All @@ -70,7 +59,7 @@

<script lang="ts">
import { perPageDefault, paginationOptions } from 'web-app-admin-settings/src/defaults'
import { AppLoadingSpinner, SideBar, BatchActions } from '@ownclouders/web-pkg'
import { AppLoadingSpinner, SideBar, BatchActions, SideBarPanelContext } from '@ownclouders/web-pkg'
import {
defineComponent,
inject,
Expand All @@ -84,7 +73,7 @@ import {
} from 'vue'
import { eventBus, useAppDefaults } from '@ownclouders/web-pkg'
import { SideBarEventTopics } from '@ownclouders/web-pkg'
import { Panel } from '@ownclouders/web-pkg'
import { SideBarPanel } from '@ownclouders/web-pkg'
import { BreadcrumbItem } from 'design-system/src/components/OcBreadcrumb/types'
import { ViewOptions } from '@ownclouders/web-pkg'

Expand All @@ -100,16 +89,21 @@ export default defineComponent({
required: true,
type: Array as PropType<BreadcrumbItem[]>
},
sideBarOpen: {
isSideBarOpen: {
required: false,
type: Boolean,
default: false
},
sideBarAvailablePanels: {
required: false,
type: Array as PropType<Panel[]>,
type: Array as PropType<SideBarPanel<unknown, unknown, unknown>[]>,
default: () => []
},
sideBarPanelContext: {
required: false,
type: Object as PropType<SideBarPanelContext<unknown, unknown, unknown>>,
default: () => ({})
},
sideBarActivePanel: {
required: false,
type: [String, null],
Expand All @@ -125,11 +119,6 @@ export default defineComponent({
type: Boolean,
default: false
},
isSideBarHeaderCompact: {
required: false,
type: Boolean,
default: false
},
showViewOptions: {
type: Boolean,
required: false,
Expand Down Expand Up @@ -160,7 +149,7 @@ export default defineComponent({
const appBarRef = ref<VNodeRef>()
const limitedScreenSpace = ref(false)
const onResize = () => {
limitedScreenSpace.value = props.sideBarOpen
limitedScreenSpace.value = props.isSideBarOpen
? window.innerWidth <= 1600
: window.innerWidth <= 1200
}
Expand All @@ -169,9 +158,6 @@ export default defineComponent({
const closeSideBar = () => {
eventBus.publish(SideBarEventTopics.close)
}
const toggleSideBar = () => {
eventBus.publish(SideBarEventTopics.toggle)
}
const selectPanel = (panel) => {
eventBus.publish(SideBarEventTopics.setActivePanel, panel)
}
Expand All @@ -197,24 +183,13 @@ export default defineComponent({
appBarRef,
limitedScreenSpace,
closeSideBar,
toggleSideBar,
selectPanel,
...useAppDefaults({
applicationId: 'admin-settings'
}),
perPageDefault,
paginationOptions
}
},
computed: {
toggleSidebarButtonLabel() {
return this.sideBarOpen
? this.$gettext('Close sidebar to hide details')
: this.$gettext('Open sidebar to view details')
},
toggleSidebarButtonIconFillType() {
return this.sideBarOpen ? 'fill' : 'line'
}
}
})
</script>
Expand All @@ -234,15 +209,6 @@ export default defineComponent({
top: 0;
}

#files-toggle-sidebar {
vertical-align: middle;
border: 3px solid transparent;
&:hover {
background-color: var(--oc-color-background-hover);
border-radius: 3px;
}
}

.admin-settings-app-bar-controls {
height: 52px;

Expand Down
Loading