Skip to content

Commit

Permalink
WIP generic file sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
kulmann committed Nov 28, 2023
1 parent acdc715 commit 07c5c77
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
22 changes: 14 additions & 8 deletions packages/web-pkg/src/components/AppTemplates/AppWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<error-screen v-else-if="loadingError" :message="loadingError.message" />
<div v-else class="oc-height-1-1">
<slot v-bind="slotAttrs" />
<file-side-bar :open="true" :active-panel="'details'" :space="space" />
</div>
</main>
</template>
Expand All @@ -35,6 +36,7 @@ import { onBeforeRouteLeave, useRouter } from 'vue-router'
import AppTopBar from '../AppTopBar.vue'
import ErrorScreen from './PartialViews/ErrorScreen.vue'
import LoadingScreen from './PartialViews/LoadingScreen.vue'
import { FileSideBar } from '../SideBar'
import {
UrlForResourceOptions,
queryItemAsString,
Expand All @@ -43,9 +45,10 @@ import {
useRoute,
useRouteParam,
useRouteQuery,
useStore
useStore,
useSelectedResources
} from '../../composables'
import { Resource } from '@ownclouders/web-client'
import { Resource, SpaceResource } from '@ownclouders/web-client'
import { DavPermission, DavProperty } from '@ownclouders/web-client/src/webdav/constants'
import { Action, ActionOptions } from '../../composables/actions/types'
import {
Expand All @@ -62,6 +65,7 @@ export default defineComponent({
name: 'AppWrapper',
components: {
AppTopBar,
FileSideBar,
ErrorScreen,
LoadingScreen
},
Expand Down Expand Up @@ -92,9 +96,11 @@ export default defineComponent({
const currentRoute = useRoute()
const clientService = useClientService()
const { getResourceContext } = useGetResourceContext()
const { selectedResources } = useSelectedResources({ store })
const applicationName = ref('')
const resource: Ref<Resource> = ref()
const space: Ref<SpaceResource> = ref()
const currentETag = ref('')
const url = ref('')
const loading = ref(true)
Expand Down Expand Up @@ -206,18 +212,18 @@ export default defineComponent({
yield addMissingDriveAliasAndItem()
}
space.value = unref(unref(currentFileContext).space)
resource.value = yield getFileInfo(currentFileContext, {
davProperties: [DavProperty.FileId, DavProperty.Permissions, DavProperty.Name]
})
const space = unref(unref(currentFileContext).space)
selectedResources.value = [unref(resource)]
const newExtension = props.importResourceWithExtension(unref(resource))
if (newExtension) {
const timestamp = DateTime.local().toFormat('yyyyMMddHHmmss')
const targetPath = `${unref(resource).name}_${timestamp}.${newExtension}`
if (
!(yield clientService.webdav.copyFiles(space, unref(resource), space, {
!(yield clientService.webdav.copyFiles(unref(space), unref(resource), unref(space), {
path: targetPath
}))
) {
Expand All @@ -242,12 +248,11 @@ export default defineComponent({
}
if (unref(hasProp('url'))) {
const tmpUrl = yield getUrlForResource(
space,
url.value = yield getUrlForResource(
unref(space),
unref(resource),
props.urlForResourceOptions
)
url.value = tmpUrl
}
loading.value = false
} catch (e) {
Expand Down Expand Up @@ -448,6 +453,7 @@ export default defineComponent({
loadingError,
pageTitle,
resource,
space,
slotAttrs
}
}
Expand Down
2 changes: 2 additions & 0 deletions packages/web-pkg/src/components/SideBar/FileSideBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ export default defineComponent({
return store.getters['Files/currentFolder']
})
const panelContext = computed<SideBarPanelContext<Resource, Resource>>(() => {
// TODO: panelContext from outside?! editor apps don't have selected resources...
console.log('selectedResources', unref(selectedResources))
if (unref(selectedResources).length === 0) {
return {
parent: null,
Expand Down

0 comments on commit 07c5c77

Please sign in to comment.