api resource refactoring

This commit is contained in:
Peter Papp
2021-08-27 09:41:14 +02:00
parent 5c6a873b02
commit e0e060e5a1
22 changed files with 173 additions and 79 deletions
@@ -311,7 +311,7 @@ export default {
// Change item name
events.$on('change:name', item => {
if (this.item.data.id === item.data.id) this.itemName = item.data.attributes.name
if (this.item.data.id === item.id) this.itemName = item.name
})
}
}
@@ -1,6 +1,6 @@
<template>
<div class="inline-wrapper icon-append copy-input" :class="size">
<input ref="sel" :value="item.data.relationships.shared.link" id="link-input" type="text" class="input-text" readonly>
<input ref="sel" :value="item.data.relationships.shared.data.attributes.link" id="link-input" type="text" class="input-text" readonly>
<div class="multi-icon">
<div @click="copyUrl" class="icon-item group hover-bg-theme-100">
<link-icon v-if="! isCopiedLink" size="14" class="group-hover-text-theme hover-text-theme"/>
@@ -19,7 +19,7 @@
:subtitle="this.clipboard.length + ' ' + $tc('file_detail.items', this.clipboard.length)"
v-if="clipboard.length > 1 && !isSelectedItem" />
<TreeMenu :disabled-by-id="pickedItem" :depth="1" :nodes="items" v-for="items in navigation" :key="items.data.id" />
<TreeMenu :disabled-by-id="pickedItem" :depth="1" :nodes="items" v-for="items in navigation" :key="items.id" />
</div>
</PopupContent>
@@ -88,7 +88,7 @@
if (!this.selectedFolder) return
// Prevent to move items to the same parent
if (isArray(this.selectedFolder) && this.clipboard.find(item => item.parent_id === this.selectedFolder.data.id)) return
if (isArray(this.selectedFolder) && this.clipboard.find(item => item.parent_id === this.selectedFolder.id)) return
// Move item
if (!this.isSelectedItem) {
@@ -110,7 +110,7 @@
mounted() {
events.$on('pick-folder', folder => {
if (folder.data.id === this.pickedItem.data.id) {
if (folder.id === this.pickedItem.data.id) {
this.selectedFolder = undefined
} else if (!folder.id && folder.location === 'base') {
@@ -207,7 +207,9 @@ export default {
// End loading
this.isGeneratedShared = true
this.$store.commit('UPDATE_SHARED_ITEM', response.data.data.attributes)
this.$store.commit('UPDATE_SHARED_ITEM', response.data)
this.pickedItem.data.relationships.shared = response.data
})
.catch(() => {
events.$emit('alert:open', {
@@ -44,7 +44,7 @@
</div>
</div>
<ActionButton v-if="(pickedItem.data.relationships.shared.protected && canChangePassword) && shareOptions.isProtected" @click.native="changePassword" class="change-password">
<ActionButton v-if="(pickedItem.data.relationships.shared.data.attributes.protected && canChangePassword) && shareOptions.isProtected" @click.native="changePassword" class="change-password">
{{ $t('popup_share_edit.change_pass') }}
</ActionButton>
@@ -315,11 +315,11 @@
// Store shared options
this.shareOptions = {
id: args.item.data.relationships.shared.id,
token: args.item.data.relationships.shared.token,
expiration: args.item.data.relationships.shared.expire_in,
isProtected: args.item.data.relationships.shared.protected,
permission: args.item.data.relationships.shared.permission,
id: args.item.data.relationships.shared.data.id,
token: args.item.data.relationships.shared.data.attributes.token,
expiration: args.item.data.relationships.shared.data.attributes.expire_in,
isProtected: args.item.data.relationships.shared.data.attributes.protected,
permission: args.item.data.relationships.shared.data.attributes.permission,
password: undefined,
}
@@ -327,7 +327,7 @@
this.sendToRecipientsMenu = true
this.isEmailSended = false
this.canChangePassword = args.item.data.relationships.shared.is_protected
this.canChangePassword = args.item.data.relationships.shared.data.attributes.protected
})
events.$on('popup:close', () => {
+3 -3
View File
@@ -1,6 +1,6 @@
<template>
<!--Folder Icon-->
<div class="folder-item-wrapper" :class="{'is-inactive': disabledById && disabledById.id === nodes.id || !disableId} ">
<div class="folder-item-wrapper" :class="{'is-inactive': disabledById && disabledById.data.id === nodes.id || !disableId} ">
<div class="folder-item text-theme dark-text-theme" :class="{'is-selected': isSelected}" @click="getFolder" :style="indent">
<chevron-right-icon @click.stop="showTree" size="17" class="icon-arrow" :class="{'is-opened': isVisible, 'is-visible': nodes.folders.length !== 0}"/>
@@ -39,7 +39,7 @@
let canBeShow = true
if(this.clipboard.includes(this.disabledById)){
this.clipboard.map(item => {
if(item.id === this.nodes.id) {
if(item.data.id === this.nodes.id) {
canBeShow = false
}
})
@@ -66,7 +66,7 @@
mounted() {
// Show first location
if (this.depth == 1)
if (this.depth === 1)
this.isVisible = true
// Select clicked folder