|
|
|
@ -1,19 +1,18 @@ |
|
|
|
|
import isEmpty from 'lodash/isEmpty'; |
|
|
|
|
import isString from 'lodash/isString'; |
|
|
|
|
import isBoolean from 'lodash/isBoolean'; |
|
|
|
|
import toInteger from 'lodash/toInteger'; |
|
|
|
|
import isEmpty from "lodash/isEmpty" |
|
|
|
|
import isString from "lodash/isString" |
|
|
|
|
import isBoolean from "lodash/isBoolean" |
|
|
|
|
import toInteger from "lodash/toInteger" |
|
|
|
|
|
|
|
|
|
import { formatDateTime } from '../utils/dates'; |
|
|
|
|
import NotificationMixin from './NotificationMixin'; |
|
|
|
|
import {ENTRYPOINT} from "../config/entrypoint"; |
|
|
|
|
import axios from "axios"; |
|
|
|
|
import { formatDateTime } from "../utils/dates" |
|
|
|
|
import NotificationMixin from "./NotificationMixin" |
|
|
|
|
import axios from "axios" |
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
mixins: [NotificationMixin], |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
pagination: { |
|
|
|
|
sortBy: 'resourceNode.title', |
|
|
|
|
sortBy: "resourceNode.title", |
|
|
|
|
descending: false, |
|
|
|
|
page: 1, // page to be displayed
|
|
|
|
|
rowsPerPage: 10, // maximum displayed rows
|
|
|
|
@ -25,90 +24,91 @@ export default { |
|
|
|
|
expandedFilter: false, |
|
|
|
|
options: { |
|
|
|
|
page: 1, |
|
|
|
|
itemsPerPage: 10 |
|
|
|
|
itemsPerPage: 10, |
|
|
|
|
}, |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
|
$route() { |
|
|
|
|
// react to route changes...
|
|
|
|
|
this.resetList = true; |
|
|
|
|
let nodeId = this.$route.params['node']; |
|
|
|
|
this.resetList = true |
|
|
|
|
let nodeId = this.$route.params["node"] |
|
|
|
|
if (!isEmpty(nodeId)) { |
|
|
|
|
let cid = toInteger(this.$route.query.cid); |
|
|
|
|
let sid = toInteger(this.$route.query.sid); |
|
|
|
|
let gid = toInteger(this.$route.query.gid); |
|
|
|
|
let id = '/api/resource_nodes/'+ nodeId; |
|
|
|
|
const params = {id, cid, sid, gid}; |
|
|
|
|
this.findResourceNode(params); |
|
|
|
|
let cid = toInteger(this.$route.query.cid) |
|
|
|
|
let sid = toInteger(this.$route.query.sid) |
|
|
|
|
let gid = toInteger(this.$route.query.gid) |
|
|
|
|
let id = "/api/resource_nodes/" + nodeId |
|
|
|
|
const params = { id, cid, sid, gid } |
|
|
|
|
this.findResourceNode(params) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.onUpdateOptions(this.options); |
|
|
|
|
this.onUpdateOptions(this.options) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
deletedItem(item) { |
|
|
|
|
this.showMessage(`${item['@id']} deleted.`); |
|
|
|
|
this.showMessage(`${item["@id"]} deleted.`) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
deletedResource(item) { |
|
|
|
|
const message = this.$i18n && this.$i18n.t |
|
|
|
|
? this.$t('{resource} created', {'resource': item['resourceNode'].title}) |
|
|
|
|
: `${item['resourceNode'].title} created`; |
|
|
|
|
this.showMessage(message); |
|
|
|
|
this.onUpdateOptions(this.options); |
|
|
|
|
const message = |
|
|
|
|
this.$i18n && this.$i18n.t |
|
|
|
|
? this.$t("{resource} created", { resource: item["resourceNode"].title }) |
|
|
|
|
: `${item["resourceNode"].title} created` |
|
|
|
|
this.showMessage(message) |
|
|
|
|
this.onUpdateOptions(this.options) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
error(message) { |
|
|
|
|
message && this.showError(message); |
|
|
|
|
message && this.showError(message) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
items() { |
|
|
|
|
this.options.totalItems = this.totalItems; |
|
|
|
|
} |
|
|
|
|
this.options.totalItems = this.totalItems |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
onRequest(props) { |
|
|
|
|
console.log('onRequest'); |
|
|
|
|
console.log(props); |
|
|
|
|
const { page, rowsPerPage: itemsPerPage, sortBy, descending } = props.pagination; |
|
|
|
|
const filter = props.filter; |
|
|
|
|
console.log("onRequest") |
|
|
|
|
console.log(props) |
|
|
|
|
const { page, rowsPerPage: itemsPerPage, sortBy, descending } = props.pagination |
|
|
|
|
const filter = props.filter |
|
|
|
|
|
|
|
|
|
this.nextPage = page; |
|
|
|
|
this.nextPage = page |
|
|
|
|
if (isEmpty(this.nextPage)) { |
|
|
|
|
this.nextPage = 1; |
|
|
|
|
this.nextPage = 1 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
let params = {}; |
|
|
|
|
let params = {} |
|
|
|
|
if (itemsPerPage > 0) { |
|
|
|
|
params = { ...params, itemsPerPage, page }; |
|
|
|
|
params = { ...params, itemsPerPage, page } |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (sortBy) { |
|
|
|
|
params[`order[${sortBy}]`] = descending ? "desc" : "asc"; |
|
|
|
|
params[`order[${sortBy}]`] = descending ? "desc" : "asc" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (this.$route.params.node) { |
|
|
|
|
params[`resourceNode.parent`] = this.$route.params.node; |
|
|
|
|
params[`resourceNode.parent`] = this.$route.params.node |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.resetList = true; |
|
|
|
|
this.resetList = true |
|
|
|
|
this.getPage(params).then(() => { |
|
|
|
|
this.pagination.sortBy = sortBy; |
|
|
|
|
this.pagination.descending = descending; |
|
|
|
|
this.pagination.rowsPerPage = itemsPerPage; |
|
|
|
|
}); |
|
|
|
|
this.pagination.sortBy = sortBy |
|
|
|
|
this.pagination.descending = descending |
|
|
|
|
this.pagination.rowsPerPage = itemsPerPage |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
onUpdateOptions({ page, itemsPerPage, sortBy, sortDesc, totalItems } = {}) { |
|
|
|
|
console.log('ListMixin.js: onUpdateOptions'); |
|
|
|
|
console.log("ListMixin.js: onUpdateOptions") |
|
|
|
|
|
|
|
|
|
this.resetList = true; |
|
|
|
|
this.resetList = true |
|
|
|
|
|
|
|
|
|
let params = { |
|
|
|
|
...this.filters |
|
|
|
|
...this.filters, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (1 === this.filters['loadNode']) { |
|
|
|
|
params[`resourceNode.parent`] = this.$route.params.node; |
|
|
|
|
if (1 === this.filters["loadNode"]) { |
|
|
|
|
params[`resourceNode.parent`] = this.$route.params.node |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*if (this.$route.params.node) { |
|
|
|
@ -116,170 +116,165 @@ export default { |
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
if (itemsPerPage > 0) { |
|
|
|
|
params = { ...params, itemsPerPage, page }; |
|
|
|
|
params = { ...params, itemsPerPage, page } |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// prime
|
|
|
|
|
if (!isEmpty(sortBy)) { |
|
|
|
|
params[`order[${sortBy}]`] = sortDesc ? 'desc' : 'asc' |
|
|
|
|
params[`order[${sortBy}]`] = sortDesc ? "desc" : "asc" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
let cid = toInteger(this.$route.query.cid); |
|
|
|
|
let sid = toInteger(this.$route.query.sid); |
|
|
|
|
let gid = toInteger(this.$route.query.gid); |
|
|
|
|
let type = this.$route.query.type; |
|
|
|
|
let cid = toInteger(this.$route.query.cid) |
|
|
|
|
let sid = toInteger(this.$route.query.sid) |
|
|
|
|
let gid = toInteger(this.$route.query.gid) |
|
|
|
|
let type = this.$route.query.type |
|
|
|
|
|
|
|
|
|
params = { ...params, cid, sid, gid, type }; |
|
|
|
|
params = { ...params, cid, sid, gid, type } |
|
|
|
|
|
|
|
|
|
/*if (!isEmpty(sortBy) && !isEmpty(sortDesc)) { |
|
|
|
|
params[`order[${sortBy[0]}]`] = sortDesc[0] ? 'desc' : 'asc' |
|
|
|
|
}*/ |
|
|
|
|
this.getPage(params).then(() => { |
|
|
|
|
this.options.sortBy = sortBy; |
|
|
|
|
this.options.sortDesc = sortDesc; |
|
|
|
|
this.options.itemsPerPage = itemsPerPage; |
|
|
|
|
this.options.totalItems = totalItems; |
|
|
|
|
}); |
|
|
|
|
this.options.sortBy = sortBy |
|
|
|
|
this.options.sortDesc = sortDesc |
|
|
|
|
this.options.itemsPerPage = itemsPerPage |
|
|
|
|
this.options.totalItems = totalItems |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
fetchNewItems({ page, itemsPerPage, sortBy, sortDesc, totalItems } = {}) { |
|
|
|
|
console.log('fetchNewItems'); |
|
|
|
|
console.log("fetchNewItems") |
|
|
|
|
let params = { |
|
|
|
|
...this.filters |
|
|
|
|
}; |
|
|
|
|
...this.filters, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (itemsPerPage > 0) { |
|
|
|
|
params = { ...params, itemsPerPage, page }; |
|
|
|
|
params = { ...params, itemsPerPage, page } |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (this.$route.params.node) { |
|
|
|
|
params[`resourceNode.parent`] = this.$route.params.node; |
|
|
|
|
params[`resourceNode.parent`] = this.$route.params.node |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (isString(sortBy) && isBoolean(sortDesc)) { |
|
|
|
|
//params[`order[${sortBy[0]}]`] = sortDesc[0] ? 'desc' : 'asc'
|
|
|
|
|
params[`order[${sortBy}]`] = sortDesc ? 'desc' : 'asc' |
|
|
|
|
params[`order[${sortBy}]`] = sortDesc ? "desc" : "asc" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.options.sortBy = sortBy; |
|
|
|
|
this.options.sortDesc = sortDesc; |
|
|
|
|
this.options.itemsPerPage = itemsPerPage; |
|
|
|
|
this.options.totalItems = totalItems; |
|
|
|
|
this.options.sortBy = sortBy |
|
|
|
|
this.options.sortDesc = sortDesc |
|
|
|
|
this.options.itemsPerPage = itemsPerPage |
|
|
|
|
this.options.totalItems = totalItems |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
onSendFilter() { |
|
|
|
|
console.log('onSendFilter'); |
|
|
|
|
this.resetList = true; |
|
|
|
|
this.pagination.page = 1; |
|
|
|
|
this.onRequest({pagination: this.pagination}) |
|
|
|
|
console.log("onSendFilter") |
|
|
|
|
this.resetList = true |
|
|
|
|
this.pagination.page = 1 |
|
|
|
|
this.onRequest({ pagination: this.pagination }) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
resetFilter() { |
|
|
|
|
console.log('resetFilter'); |
|
|
|
|
this.filters = {}; |
|
|
|
|
this.pagination.page = 1; |
|
|
|
|
this.onRequest({pagination: this.pagination}) |
|
|
|
|
console.log("resetFilter") |
|
|
|
|
this.filters = {} |
|
|
|
|
this.pagination.page = 1 |
|
|
|
|
this.onRequest({ pagination: this.pagination }) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
addHandler() { |
|
|
|
|
console.log('addHandler'); |
|
|
|
|
let folderParams = this.$route.query; |
|
|
|
|
this.$router.push({name: `${this.$options.servicePrefix}Create`, query: folderParams}); |
|
|
|
|
console.log("addHandler") |
|
|
|
|
let folderParams = this.$route.query |
|
|
|
|
this.$router.push({ name: `${this.$options.servicePrefix}Create`, query: folderParams }) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
addDocumentHandler() { |
|
|
|
|
let folderParams = this.$route.query; |
|
|
|
|
this.$router.push({ name: `${this.$options.servicePrefix}CreateFile` , query: folderParams}); |
|
|
|
|
let folderParams = this.$route.query |
|
|
|
|
this.$router.push({ name: `${this.$options.servicePrefix}CreateFile`, query: folderParams }) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
uploadDocumentHandler() { |
|
|
|
|
let folderParams = this.$route.query; |
|
|
|
|
this.$router.push({ name: `${this.$options.servicePrefix}UploadFile` , query: folderParams}); |
|
|
|
|
let folderParams = this.$route.query |
|
|
|
|
this.$router.push({ name: `${this.$options.servicePrefix}UploadFile`, query: folderParams }) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
sharedDocumentHandler() { |
|
|
|
|
let folderParams = this.$route.query; |
|
|
|
|
this.filters['shared'] = 1; |
|
|
|
|
this.filters['loadNode'] = 0; |
|
|
|
|
delete this.filters['resourceNode.parent']; |
|
|
|
|
this.resetList = true; |
|
|
|
|
this.$router.push({ name: `${this.$options.servicePrefix}Shared` , query: folderParams}); |
|
|
|
|
let folderParams = this.$route.query |
|
|
|
|
this.filters["shared"] = 1 |
|
|
|
|
this.filters["loadNode"] = 0 |
|
|
|
|
delete this.filters["resourceNode.parent"] |
|
|
|
|
this.resetList = true |
|
|
|
|
this.$router.push({ name: `${this.$options.servicePrefix}Shared`, query: folderParams }) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
showHandler(item) { |
|
|
|
|
console.log('listmixin showHandler'); |
|
|
|
|
let folderParams = this.$route.query; |
|
|
|
|
console.log(item); |
|
|
|
|
console.log("listmixin showHandler") |
|
|
|
|
let folderParams = this.$route.query |
|
|
|
|
console.log(item) |
|
|
|
|
if (item) { |
|
|
|
|
folderParams['id'] = item['@id']; |
|
|
|
|
folderParams["id"] = item["@id"] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.$router.push({ |
|
|
|
|
name: `${this.$options.servicePrefix}Show`, |
|
|
|
|
params: folderParams, |
|
|
|
|
query: folderParams |
|
|
|
|
}); |
|
|
|
|
query: folderParams, |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
handleClick(item) { |
|
|
|
|
let folderParams = this.$route.query; |
|
|
|
|
this.resetList = true; |
|
|
|
|
let resourceId = item['resourceNode']['id']; |
|
|
|
|
this.$route.params.node = resourceId; |
|
|
|
|
let folderParams = this.$route.query |
|
|
|
|
this.resetList = true |
|
|
|
|
let resourceId = item["resourceNode"]["id"] |
|
|
|
|
this.$route.params.node = resourceId |
|
|
|
|
|
|
|
|
|
this.filters[`resourceNode.parent`] = resourceId; |
|
|
|
|
this.filters[`resourceNode.parent`] = resourceId |
|
|
|
|
|
|
|
|
|
this.$router.push({ |
|
|
|
|
name: `${this.$options.servicePrefix}List`, |
|
|
|
|
params: {node: resourceId}, |
|
|
|
|
params: { node: resourceId }, |
|
|
|
|
query: folderParams, |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
changeVisibilityHandler(item, slotProps) { |
|
|
|
|
let folderParams = this.$route.query; |
|
|
|
|
folderParams['id'] = item['@id']; |
|
|
|
|
axios |
|
|
|
|
.put(item['@id'] + '/toggle_visibility', { |
|
|
|
|
}) |
|
|
|
|
.then(response => { |
|
|
|
|
let data = response.data; |
|
|
|
|
item['resourceLinkListFromEntity'] = data['resourceLinkListFromEntity']; |
|
|
|
|
let folderParams = this.$route.query |
|
|
|
|
folderParams["id"] = item["@id"] |
|
|
|
|
axios.put(item["@id"] + "/toggle_visibility", {}).then((response) => { |
|
|
|
|
let data = response.data |
|
|
|
|
item["resourceLinkListFromEntity"] = data["resourceLinkListFromEntity"] |
|
|
|
|
}) |
|
|
|
|
; |
|
|
|
|
}, |
|
|
|
|
editHandler(item) { |
|
|
|
|
let folderParams = this.$route.query; |
|
|
|
|
folderParams['id'] = item['@id']; |
|
|
|
|
let folderParams = this.$route.query |
|
|
|
|
folderParams["id"] = item["@id"] |
|
|
|
|
|
|
|
|
|
if ('folder' === item.filetype || isEmpty(item.filetype)) { |
|
|
|
|
if ("folder" === item.filetype || isEmpty(item.filetype)) { |
|
|
|
|
this.$router.push({ |
|
|
|
|
name: `${this.$options.servicePrefix}Update`, |
|
|
|
|
params: { id: item['@id'] }, |
|
|
|
|
query: folderParams |
|
|
|
|
}); |
|
|
|
|
params: { id: item["@id"] }, |
|
|
|
|
query: folderParams, |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ('file' === item.filetype) { |
|
|
|
|
folderParams['getFile'] = true; |
|
|
|
|
if (item.resourceNode.resourceFile && |
|
|
|
|
if ("file" === item.filetype) { |
|
|
|
|
folderParams["getFile"] = true |
|
|
|
|
if ( |
|
|
|
|
item.resourceNode.resourceFile && |
|
|
|
|
item.resourceNode.resourceFile.mimeType && |
|
|
|
|
'text/html' === item.resourceNode.resourceFile.mimeType |
|
|
|
|
"text/html" === item.resourceNode.resourceFile.mimeType |
|
|
|
|
) { |
|
|
|
|
//folderParams['getFile'] = true;
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.$router.push({ |
|
|
|
|
name: `${this.$options.servicePrefix}UpdateFile`, |
|
|
|
|
params: { id: item['@id'] }, |
|
|
|
|
query: folderParams |
|
|
|
|
}); |
|
|
|
|
params: { id: item["@id"] }, |
|
|
|
|
query: folderParams, |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
deleteHandler(item) { |
|
|
|
|
this.pagination.page = 1; |
|
|
|
|
this.deleteItem(item).then(() => |
|
|
|
|
this.onRequest({pagination: this.pagination}) |
|
|
|
|
); |
|
|
|
|
this.pagination.page = 1 |
|
|
|
|
this.deleteItem(item).then(() => this.onRequest({ pagination: this.pagination })) |
|
|
|
|
}, |
|
|
|
|
formatDateTime |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
formatDateTime, |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|