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] Use OcStatusIndicators for FileDetails #6583

Merged
merged 3 commits into from
Mar 14, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion changelog/unreleased/enhancement-move-share-indicators
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ and adjusted the design in ODS.

https://github.com/owncloud/web/issues/5976
https://github.com/owncloud/web/pull/6552
https://github.com/owncloud/owncloud-design-system/pull/2014
https://github.com/owncloud/owncloud-design-system/pull/2014
https://github.com/owncloud/web/pull/6583
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,12 @@
<oc-spinner v-if="$asyncComputed.preview.updating" />
</div>
<div
v-if="showShares"
v-if="shareIndicators.length"
key="file-shares"
data-testid="sharingInfo"
class="oc-flex oc-flex-middle oc-my-m"
>
<oc-button
v-if="hasPeopleShares"
v-oc-tooltip="peopleSharesLabel"
appearance="raw"
class="oc-mr-xs"
:aria-label="peopleSharesLabel"
@click="expandPeoplesPanel"
>
<oc-icon name="group" />
</oc-button>
<oc-button
v-if="hasLinkShares"
v-oc-tooltip="linkSharesLabel"
appearance="raw"
class="oc-mr-xs"
:aria-label="linkSharesLabel"
@click="expandLinksPanel"
>
<oc-icon name="link" />
</oc-button>
<oc-status-indicators :resource="file" :indicators="shareIndicators" />
<p class="oc-my-rm oc-mx-s" v-text="detailSharingInformation" />
</div>
<table class="details-table" :aria-label="detailsTableLabel">
Expand Down Expand Up @@ -113,6 +94,7 @@ import upperFirst from 'lodash-es/upperFirst'
import path from 'path'
import { createLocationSpaces, isAuthenticatedRoute } from '../../../router'
import { ShareTypes } from '../../../helpers/share'
import { getIndicators } from '../../../helpers/statusIndicators'

export default {
name: 'FileDetails',
Expand Down Expand Up @@ -142,7 +124,8 @@ export default {
sharedByName: '',
sharedByDisplayName: '',
sharedTime: 0,
sharedItem: null
sharedItem: null,
shareIndicators: []
}),
computed: {
...mapGetters('Files', ['versions', 'sharesTree', 'sharesTreeLoading']),
Expand Down Expand Up @@ -207,12 +190,6 @@ export default {
}
return this.$gettext('This file has been shared.')
},
peopleSharesLabel() {
return this.$gettext('Show invited people')
},
linkSharesLabel() {
return this.$gettext('Show links')
},
sharedByLabel() {
return this.$gettext('Shared by:')
},
Expand Down Expand Up @@ -264,19 +241,6 @@ export default {
this.sharedItem !== null
)
},
hasPeopleShares() {
return (
ShareTypes.containsAnyValue(ShareTypes.authenticated, this.file.shareTypes) ||
this.file.indicators?.filter((e) => e.icon === 'group').length > 0 ||
this.sharedItem !== null
)
},
hasLinkShares() {
return (
ShareTypes.containsAnyValue(ShareTypes.unauthenticated, this.file.shareTypes) ||
this.file.indicators?.filter((e) => e.icon === 'link').length > 0
)
},
ownedByCurrentUser() {
return (
this.file.ownerId === this.user.id ||
Expand All @@ -287,13 +251,12 @@ export default {
},
watch: {
file() {
this.loadData()
this.refreshShareDetailsTree()
this.loadData().then(this.refreshShareDetailsTree)
},
sharesTree() {
// missing early return
this.sharedItem = null

this.shareIndicators = getIndicators(this.file, this.sharesTree)
const sharePathParentOrCurrent = this.getParentSharePath(this.file.path, this.sharesTree)
if (sharePathParentOrCurrent === null) {
return
Expand Down Expand Up @@ -340,12 +303,13 @@ export default {
methods: {
...mapActions('Files', ['loadPreview', 'loadVersions', 'loadSharesTree']),
...mapActions('Files/sidebar', { setSidebarPanel: 'setActivePanel' }),
refreshShareDetailsTree() {
this.loadSharesTree({
async refreshShareDetailsTree() {
await this.loadSharesTree({
client: this.$client,
path: this.file.path,
$gettext: this.$gettext
})
this.shareIndicators = getIndicators(this.file, this.sharesTree)
},
getParentSharePath(childPath, shares) {
let currentPath = childPath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ localVue.use(GetTextPlugin, {
const OcTooltip = jest.fn()

const simpleOwnFolder = {
id: '1',
type: 'folder',
ownerId: 'marie',
ownerDisplayName: 'Marie',
Expand All @@ -24,6 +25,7 @@ const simpleOwnFolder = {
}

const sharedFolder = {
id: '2',
type: 'folder',
ownerId: 'einstein',
ownerDisplayName: 'Einstein',
Expand All @@ -33,6 +35,7 @@ const sharedFolder = {
}

const simpleOwnFile = {
id: '3',
type: 'file',
ownerId: 'marie',
ownerDisplayName: 'Marie',
Expand All @@ -41,6 +44,7 @@ const simpleOwnFile = {
}

const sharedFile = {
id: '4',
path: '/Shares/123.png',
type: 'file',
ownerId: 'einstein',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ exports[`Details SideBar Panel displays a resource of type file on a private pag
<oc-spinner-stub></oc-spinner-stub>
</div>
<div data-testid="sharingInfo" class="oc-flex oc-flex-middle oc-my-m">
<oc-button-stub appearance="raw" aria-label="Show invited people" class="oc-mr-xs">
<oc-icon-stub name="group"></oc-icon-stub>
</oc-button-stub>
<!---->
<oc-status-indicators resource="[object Object]" indicators="[object Object]"></oc-status-indicators>
<p class="oc-my-rm oc-mx-s">This file has been shared.</p>
</div>
<table aria-label="Overview of the information about the selected file" class="details-table">
Expand Down Expand Up @@ -52,10 +49,7 @@ exports[`Details SideBar Panel displays a resource of type file on a private pag
<oc-spinner-stub></oc-spinner-stub>
</div>
<div data-testid="sharingInfo" class="oc-flex oc-flex-middle oc-my-m">
<oc-button-stub appearance="raw" aria-label="Show invited people" class="oc-mr-xs">
<oc-icon-stub name="group"></oc-icon-stub>
</oc-button-stub>
<!---->
<oc-status-indicators resource="[object Object]" indicators="[object Object]"></oc-status-indicators>
<p class="oc-my-rm oc-mx-s">This file has been shared.</p>
</div>
<table aria-label="Overview of the information about the selected file" class="details-table">
Expand Down Expand Up @@ -131,13 +125,7 @@ exports[`Details SideBar Panel displays a resource of type file on a private pag
<div data-testid="preview" class="details-preview oc-flex oc-flex-middle oc-flex-center oc-mb" style="background-image: none;">
<oc-spinner-stub></oc-spinner-stub>
</div>
<div data-testid="sharingInfo" class="oc-flex oc-flex-middle oc-my-m">
<oc-button-stub appearance="raw" aria-label="Show invited people" class="oc-mr-xs">
<oc-icon-stub name="group"></oc-icon-stub>
</oc-button-stub>
<!---->
<p class="oc-my-rm oc-mx-s">This file has been shared.</p>
</div>
<!---->
<table aria-label="Overview of the information about the selected file" class="details-table">
<tr data-testid="timestamp">
<th scope="col" class="oc-pr-s">Last modified:</th>
Expand Down Expand Up @@ -274,13 +262,7 @@ exports[`Details SideBar Panel displays a resource of type folder on a private p
<div id="oc-file-details-sidebar">
<div>
<!---->
<div data-testid="sharingInfo" class="oc-flex oc-flex-middle oc-my-m">
<oc-button-stub appearance="raw" aria-label="Show invited people" class="oc-mr-xs">
<oc-icon-stub name="group"></oc-icon-stub>
</oc-button-stub>
<!---->
<p class="oc-my-rm oc-mx-s">This folder has been shared.</p>
</div>
<!---->
<table aria-label="Overview of the information about the selected file" class="details-table">
<tr data-testid="timestamp">
<th scope="col" class="oc-pr-s">Last modified:</th>
Expand Down