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

[full-ci] Add admin space sidebar details #8192

Merged
merged 20 commits into from
Jan 12, 2023
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ The admin settings now have a view to list all spaces for the current instance.

https://github.com/owncloud/web/pull/8178
https://github.com/owncloud/web/pull/8195
https://github.com/owncloud/web/pull/8192
https://github.com/owncloud/web/issues/8219
Original file line number Diff line number Diff line change
Expand Up @@ -379,15 +379,23 @@ export default defineComponent({

.oc-table-header-cell-manager,
.oc-table-data-cell-manager,
.oc-table-header-cell-remainingQuota,
.oc-table-data-cell-remainingQuota {
display: none;

@media only screen and (min-width: 1200px) {
display: table-cell;
}
}
.oc-table-header-cell-totalQuota,
.oc-table-data-cell-totalQuota,
.oc-table-header-cell-availableQuota,
.oc-table-data-cell-availableQuota,
.oc-table-header-cell-usedQuota,
.oc-table-data-cell-usedQuota,
.oc-table-header-cell-remainingQuota,
.oc-table-data-cell-remainingQuota {
.oc-table-data-cell-usedQuota {
display: none;

@media only screen and (min-width: 1400px) {
@media only screen and (min-width: 1700px) {
display: table-cell;
}
}
Expand Down
10 changes: 0 additions & 10 deletions packages/web-app-admin-settings/src/views/Groups.vue
Original file line number Diff line number Diff line change
Expand Up @@ -169,16 +169,6 @@ export default defineComponent({
*/
}
]
},

toggleSidebarButtonLabel() {
return this.$gettext(
this.sideBarOpen ? 'Close sidebar to hide details' : 'Open sidebar to view details'
)
},

toggleSidebarButtonIconFillType() {
return this.sideBarOpen ? 'fill' : 'line'
}
},

Expand Down
54 changes: 51 additions & 3 deletions packages/web-app-admin-settings/src/views/Spaces.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
:side-bar-active-panel="sideBarActivePanel"
:side-bar-available-panels="sideBarAvailablePanels"
:side-bar-open="sideBarOpen"
@closeSideBar="closeSideBar"
@toggleSideBar="toggleSideBar"
>
<template #topbarActions>
<div class="admin-settings-app-bar-actions oc-mt-xs">
Expand Down Expand Up @@ -59,6 +61,9 @@ import AppTemplate from '../components/AppTemplate.vue'
import { buildSpace } from 'web-client/src/helpers'
import { configurationManager } from 'web-pkg'
import SpacesList from '../components/Spaces/SpacesList.vue'
import SpaceDetails from 'web-pkg/src/components/sideBar/Details/SpaceDetails.vue'
import SpaceDetailsMultiple from 'web-pkg/src/components/sideBar/Details/SpaceDetailsMultiple.vue'
import SpaceNoSelection from 'web-pkg/src/components/sideBar/Details/SpaceNoSelection.vue'

export default defineComponent({
name: 'SpacesView',
Expand All @@ -79,7 +84,6 @@ export default defineComponent({
const listHeaderPosition = ref(0)
const selectedSpaces = ref([])
const sideBarOpen = ref(false)
const sideBarActivePanel = ref('DetailsPanel')

const loadResourcesTask = useTask(function* (signal) {
const {
Expand All @@ -99,7 +103,6 @@ export default defineComponent({
}
])

const sideBarAvailablePanels = computed(() => [])
const allSpacesSelected = computed(() => unref(spaces).length === unref(selectedSpaces).length)

const calculateListHeaderPosition = () => {
Expand All @@ -126,6 +129,49 @@ export default defineComponent({
selectedSpaces.value = []
}

const sideBarAvailablePanels = computed(() => {
return [
{
app: 'SpaceNoSelection',
icon: 'layout-grid',
title: $gettext('Space details'),
component: SpaceNoSelection,
default: true,
enabled: unref(selectedSpaces).length === 0
},
{
app: 'SpaceDetails',
icon: 'layout-grid',
title: $gettext('Space details'),
component: SpaceDetails,
default: false,
lookacat marked this conversation as resolved.
Show resolved Hide resolved
enabled: unref(selectedSpaces).length === 1,
componentAttrs: {
spaceResource: unref(selectedSpaces)[0]
}
},
{
app: 'SpaceDetailsMultiple',
icon: 'layout-grid',
title: $gettext('Space details'),
component: SpaceDetailsMultiple,
default: false,
lookacat marked this conversation as resolved.
Show resolved Hide resolved
enabled: unref(selectedSpaces).length > 1
}
]
})

const sideBarActivePanel = computed(() => {
return unref(sideBarAvailablePanels).find((e) => e.enabled).app
})

const closeSideBar = () => {
sideBarOpen.value = false
}
const toggleSideBar = () => {
sideBarOpen.value = !unref(sideBarOpen)
}

onMounted(async () => {
await loadResourcesTask.perform()
const loadResourcesEventToken = eventBus.subscribe('app.admin-settings.list.load', () => {
Expand All @@ -145,11 +191,13 @@ export default defineComponent({
graphClient,
accessToken,
breadcrumbs,
sideBarAvailablePanels,
listHeaderPosition,
selectedSpaces,
sideBarOpen,
sideBarAvailablePanels,
sideBarActivePanel,
closeSideBar,
toggleSideBar,
template,
toggleSelectAllSpaces,
toggleSelectSpace,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@
import { eventBus } from 'web-pkg/src/services/eventBus'
import maxSize from 'popper-max-size-modifier'
import { mapGetters, mapActions, mapState } from 'vuex'
import { EVENT_TROW_MOUNTED, EVENT_FILE_DROPPED } from '../../constants'
import { EVENT_TROW_MOUNTED, EVENT_FILE_DROPPED } from 'web-pkg/src/constants'
import { SortDir } from '../../composables'
import { determineSortFields } from '../../helpers/ui/resourceTable'
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { useStore, useTranslations } from 'web-pkg/src/composables'
// Constants should match what is being used in OcTable/ResourceTable
// Alignment regarding naming would be an API-breaking change and can
// Be done at a later point in time?
import { EVENT_TROW_CONTEXTMENU } from '../../constants'
import { EVENT_TROW_CONTEXTMENU } from 'web-pkg/src/constants'

export default defineComponent({
name: 'ResourceTiles',
Expand Down
2 changes: 1 addition & 1 deletion packages/web-app-files/src/components/Search/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
import { useResourcesViewDefaults } from '../../composables'
import AppLoadingSpinner from 'web-pkg/src/components/AppLoadingSpinner.vue'
import { VisibilityObserver } from 'web-pkg/src/observer'
import { ImageType, ImageDimension } from '../../constants'
import { ImageType, ImageDimension } from 'web-pkg/src/constants'
import NoContentMessage from 'web-pkg/src/components/NoContentMessage.vue'
import ResourceTable from '../FilesList/ResourceTable.vue'
import ContextActions from '../FilesList/ContextActions.vue'
Expand Down
2 changes: 1 addition & 1 deletion packages/web-app-files/src/components/Search/Preview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<script lang="ts">
import MixinFileActions from '../../mixins/fileActions'
import { VisibilityObserver } from 'web-pkg/src/observer'
import { ImageDimension, ImageType } from '../../constants'
import { ImageDimension, ImageType } from 'web-pkg/src/constants'
import { isResourceTxtFileAlmostEmpty } from '../../helpers/resources'
import { loadPreview } from 'web-pkg/src/helpers'
import debounce from 'lodash-es/debounce'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
import ResourceTable from '../FilesList/ResourceTable.vue'
import { computed, defineComponent, unref } from 'vue'
import debounce from 'lodash-es/debounce'
import { ImageDimension, ImageType } from '../../constants'
import { ImageDimension, ImageType } from 'web-pkg/src/constants'
import { VisibilityObserver } from 'web-pkg/src/observer'
import { mapActions, mapGetters, mapMutations } from 'vuex'
import FileActions from '../../mixins/fileActions'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
<script lang="ts">
import { computed, ComputedRef, defineComponent, inject, ref, unref, watch } from 'vue'
import { mapGetters } from 'vuex'
import { ImageDimension } from '../../../constants'
import { ImageDimension } from 'web-pkg/src/constants'
import { loadPreview } from 'web-pkg/src/helpers/preview'
import upperFirst from 'lodash-es/upperFirst'
import { basename, dirname } from 'path'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ import {
useStore,
useTranslations
} from 'web-pkg/src/composables'
import { ImageDimension } from '../../constants'
import { ImageDimension } from 'web-pkg/src/constants'
import { configurationManager } from 'web-pkg/src/configuration'
import { VisibilityObserver } from 'web-pkg/src/observer'
import { marked } from 'marked'
Expand Down
2 changes: 1 addition & 1 deletion packages/web-app-files/src/fileSideBars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import SharesPanel from './components/SideBar/Shares/SharesPanel.vue'
import TagsPanel from './components/SideBar/TagsPanel.vue'
import NoSelection from './components/SideBar/NoSelection.vue'
import SpaceActions from './components/SideBar/Actions/SpaceActions.vue'
import SpaceDetails from './components/SideBar/Details/SpaceDetails.vue'
import SpaceDetails from 'web-pkg/src/components/sideBar/Details/SpaceDetails.vue'
import {
isLocationTrashActive,
isLocationPublicActive,
Expand Down
2 changes: 1 addition & 1 deletion packages/web-app-files/src/helpers/user/avatarUrl.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { cacheService, ClientService } from 'web-pkg/src/services'
import { ImageDimension } from '../../constants'
import { ImageDimension } from 'web-pkg/src/constants'

interface AvatarUrlOptions {
clientService: ClientService
Expand Down
2 changes: 1 addition & 1 deletion packages/web-app-files/src/views/Favorites.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ import ResourceTable from '../components/FilesList/ResourceTable.vue'

import FileActions from '../mixins/fileActions'
import { VisibilityObserver } from 'web-pkg/src/observer'
import { ImageDimension, ImageType } from '../constants'
import { ImageDimension, ImageType } from 'web-pkg/src/constants'
import debounce from 'lodash-es/debounce'

import AppBar from '../components/AppBar/AppBar.vue'
Expand Down
2 changes: 1 addition & 1 deletion packages/web-app-files/src/views/shares/SharedViaLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ import { mapGetters, mapState, mapActions, mapMutations } from 'vuex'

import FileActions from '../../mixins/fileActions'
import { VisibilityObserver } from 'web-pkg/src/observer'
import { ImageDimension, ImageType } from '../../constants'
import { ImageDimension, ImageType } from 'web-pkg/src/constants'
import debounce from 'lodash-es/debounce'

import AppLoadingSpinner from 'web-pkg/src/components/AppLoadingSpinner.vue'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ import { mapGetters, mapState, mapActions, mapMutations } from 'vuex'

import FileActions from '../../mixins/fileActions'
import { VisibilityObserver } from 'web-pkg/src/observer'
import { ImageDimension, ImageType } from '../../constants'
import { ImageDimension, ImageType } from 'web-pkg/src/constants'
import debounce from 'lodash-es/debounce'

import ResourceTable from '../../components/FilesList/ResourceTable.vue'
Expand Down
2 changes: 1 addition & 1 deletion packages/web-app-files/src/views/spaces/GenericSpace.vue
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ import AppLoadingSpinner from 'web-pkg/src/components/AppLoadingSpinner.vue'
import NoContentMessage from 'web-pkg/src/components/NoContentMessage.vue'

import { VisibilityObserver } from 'web-pkg/src/observer'
import { ImageDimension, ImageType } from '../../constants'
import { ImageDimension, ImageType } from 'web-pkg/src/constants'
import { eventBus } from 'web-pkg/src/services/eventBus'
import { BreadcrumbItem, breadcrumbsFromPath, concatBreadcrumbs } from '../../helpers/breadcrumbs'
import { createLocationPublic, createLocationSpaces } from '../../router'
Expand Down
2 changes: 1 addition & 1 deletion packages/web-app-files/src/views/spaces/Projects.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ import AppBar from '../../components/AppBar/AppBar.vue'
import CreateSpace from '../../components/AppBar/CreateSpace.vue'
import { useAccessToken, useStore, useGraphClient } from 'web-pkg/src/composables'
import { loadPreview } from 'web-pkg/src/helpers/preview'
import { ImageDimension } from '../../constants'
import { ImageDimension } from 'web-pkg/src/constants'
import SpaceContextActions from '../../components/Spaces/SpaceContextActions.vue'
import { configurationManager } from 'web-pkg/src/configuration'
import { isProjectSpaceResource, SpaceResource } from 'web-client/src/helpers'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import SpaceQuota from 'web-app-files/src/components/SpaceQuota.vue'
import SpaceQuota from 'web-pkg/src/components/SpaceQuota.vue'
import { defaultPlugins, shallowMount } from 'web-test-helpers'

describe('SpaceQuota component', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { avatarUrl } from '../../../../src/helpers/user'
import { ImageDimension } from '../../../../src/constants'
import { ImageDimension } from 'web-pkg/src/constants'
import mockAxios from 'jest-mock-axios'
import { ClientService } from 'web-pkg/src/services'

Expand Down
3 changes: 2 additions & 1 deletion packages/web-pkg/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"vue-router": "3.6.5",
"vuex": "4.1.0",
"web-client": "npm:@ownclouders/web-client",
"web-pkg": "npm:@ownclouders/web-pkg"
"web-pkg": "npm:@ownclouders/web-pkg",
"vue-concurrency": "4.0.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,22 @@ import { buildResource } from 'web-client/src/helpers'
import { loadPreview } from 'web-pkg/src/helpers/preview'
import { spaceRoleManager } from 'web-client/src/helpers/share'
import { buildWebDavSpacesPath } from 'web-client/src/helpers'
import { ImageDimension } from '../../../constants'
import { ImageDimension } from 'web-pkg/src/constants'
import { useAccessToken, useStore } from 'web-pkg/src/composables'
import SpaceQuota from '../../SpaceQuota.vue'
import { formatDateFromISO } from 'web-pkg/src/helpers'
import { configurationManager } from 'web-pkg/src/configuration'
import { eventBus } from 'web-pkg/src/services/eventBus'
import { SideBarEventTopics } from '../../../composables/sideBar'

export default defineComponent({
name: 'SpaceDetails',
components: { SpaceQuota },
props: {
spaceResource: {
type: Object,
lookacat marked this conversation as resolved.
Show resolved Hide resolved
required: false
}
},
setup() {
const store = useStore()
const accessToken = useAccessToken({ store })
Expand Down Expand Up @@ -124,7 +129,7 @@ export default defineComponent({
...mapGetters('runtime/spaces', ['spaceMembers']),
...mapGetters(['user']),
space() {
return this.highlightedFile
return this.spaceResource || this.highlightedFile
},
hasShares() {
return this.hasMemberShares || this.hasLinkShares
Expand Down Expand Up @@ -183,6 +188,16 @@ export default defineComponent({
return formatDateFromISO(this.space.mdate, this.$language.current)
},
ownerUsernames() {
// TODO: Find a better solution for reactiveness
lookacat marked this conversation as resolved.
Show resolved Hide resolved
if (this.spaceResource) {
const allManagers = this.space.spaceRoles[spaceRoleManager.name]
const managers = allManagers.length > 2 ? allManagers.slice(0, 2) : allManagers
let managerStr = managers.map((m) => m.displayName).join(', ')
if (allManagers.length > 2) {
managerStr += `... +${allManagers.length - 2}`
}
return managerStr
}
const userId = this.user?.id
return this.spaceMembers
.filter((share) => share.role.name === spaceRoleManager.name)
Expand Down Expand Up @@ -246,7 +261,7 @@ export default defineComponent({
},
methods: {
expandSharesPanel() {
eventBus.publish(SideBarEventTopics.setActivePanel, 'space-share')
eventBus.publish('app.files.sidebar.setActivePanel', 'space-share')
}
}
})
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<template>
<div class="oc-mt-xl">
<div class="oc-flex space-info">
<oc-icon name="layout-grid" size="xxlarge" />
<p v-translate>Multiple spaces selected</p>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please open a followup issue, the multi selected space panel could show some more info. E.g. how many spaces are selected and what their combined quota values are (total, remaining, used).

</div>
</div>
</template>
<script>
export default {
name: 'SpaceDetailsMultiple'
}
</script>
<style lang="scss">
.space-info {
align-items: center;
flex-direction: column;
}
</style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<template>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the Details folder should have another parent folder named Spaces. And then please move SpaceNoSelection.vue one level up. Result should be this layout:

- Spaces
  - Details
    - SpaceDetails.vue
    - SpaceDetailsMultiple.vue
  - SpaceNoSelection.vue

In a followup PR you could make use of the SpaceNoSelection component in the Projects.vue view of the files app.

<div class="oc-mt-xl">
<div class="oc-flex space-info">
<oc-icon name="layout-grid" size="xxlarge" />
<p v-translate>Select a space to view details</p>
</div>
</div>
</template>
<script>
export default {
name: 'SpaceNoSelection'
}
</script>
<style lang="scss">
.space-info {
align-items: center;
flex-direction: column;
}
</style>
Loading