get rootpath with dav
This commit is contained in:
parent
8a34ab14d3
commit
2ac5b8e2ec
@ -916,6 +916,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
return {
|
return {
|
||||||
files: [],
|
files: [],
|
||||||
// Liste des fichiers et dossiers récupérés
|
// Liste des fichiers et dossiers récupérés
|
||||||
|
root_path: (0,_nextcloud_files_dav__WEBPACK_IMPORTED_MODULE_0__.getRootPath)(),
|
||||||
current_dir: '/',
|
current_dir: '/',
|
||||||
breadcrumbParts: [],
|
breadcrumbParts: [],
|
||||||
isAddFilePopupVisible: false,
|
isAddFilePopupVisible: false,
|
||||||
@ -930,7 +931,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
async fetchFiles() {
|
async fetchFiles() {
|
||||||
try {
|
try {
|
||||||
const client = (0,_nextcloud_files_dav__WEBPACK_IMPORTED_MODULE_0__.getClient)();
|
const client = (0,_nextcloud_files_dav__WEBPACK_IMPORTED_MODULE_0__.getClient)();
|
||||||
const directoryItems = await client.getDirectoryContents('/files/admin' + this.current_dir); // Remplacez "admin" par le nom de l'utilisateur courant
|
const directoryItems = await client.getDirectoryContents(this.root_path + this.current_dir); // Remplacez "admin" par le nom de l'utilisateur courant
|
||||||
|
|
||||||
this.files = directoryItems.map(file => ({
|
this.files = directoryItems.map(file => ({
|
||||||
basename: file.basename,
|
basename: file.basename,
|
||||||
@ -979,7 +980,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
if (!this.newFileName) return;
|
if (!this.newFileName) return;
|
||||||
try {
|
try {
|
||||||
const client = (0,_nextcloud_files_dav__WEBPACK_IMPORTED_MODULE_0__.getClient)();
|
const client = (0,_nextcloud_files_dav__WEBPACK_IMPORTED_MODULE_0__.getClient)();
|
||||||
const filePath = `/files/admin${this.current_dir}/${this.newFileName}`;
|
const filePath = `${this.root_path}${this.current_dir}/${this.newFileName}`;
|
||||||
await client.createDirectory(filePath, '');
|
await client.createDirectory(filePath, '');
|
||||||
this.newFileName = '';
|
this.newFileName = '';
|
||||||
this.isAddFilePopupVisible = false;
|
this.isAddFilePopupVisible = false;
|
||||||
|
File diff suppressed because one or more lines are too long
@ -107,7 +107,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getClient } from '@nextcloud/files/dav';
|
import { getClient, getRootPath } from '@nextcloud/files/dav';
|
||||||
import NcBreadcrumbs from '@nextcloud/vue/dist/Components/NcBreadcrumbs.js';
|
import NcBreadcrumbs from '@nextcloud/vue/dist/Components/NcBreadcrumbs.js';
|
||||||
import NcBreadcrumb from '@nextcloud/vue/dist/Components/NcBreadcrumb.js';
|
import NcBreadcrumb from '@nextcloud/vue/dist/Components/NcBreadcrumb.js';
|
||||||
import Plus from 'vue-material-design-icons/Plus.vue'
|
import Plus from 'vue-material-design-icons/Plus.vue'
|
||||||
@ -122,6 +122,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
files: [], // Liste des fichiers et dossiers récupérés
|
files: [], // Liste des fichiers et dossiers récupérés
|
||||||
|
root_path: getRootPath(),
|
||||||
current_dir: '/',
|
current_dir: '/',
|
||||||
breadcrumbParts: [],
|
breadcrumbParts: [],
|
||||||
isAddFilePopupVisible: false,
|
isAddFilePopupVisible: false,
|
||||||
@ -136,7 +137,7 @@ export default {
|
|||||||
async fetchFiles() {
|
async fetchFiles() {
|
||||||
try {
|
try {
|
||||||
const client = getClient();
|
const client = getClient();
|
||||||
const directoryItems = await client.getDirectoryContents('/files/admin' + this.current_dir); // Remplacez "admin" par le nom de l'utilisateur courant
|
const directoryItems = await client.getDirectoryContents(this.root_path + this.current_dir); // Remplacez "admin" par le nom de l'utilisateur courant
|
||||||
|
|
||||||
this.files = directoryItems.map(file => ({
|
this.files = directoryItems.map(file => ({
|
||||||
basename: file.basename,
|
basename: file.basename,
|
||||||
@ -185,7 +186,7 @@ export default {
|
|||||||
if (!this.newFileName) return;
|
if (!this.newFileName) return;
|
||||||
try {
|
try {
|
||||||
const client = getClient();
|
const client = getClient();
|
||||||
const filePath = `/files/admin${this.current_dir}/${this.newFileName}`;
|
const filePath = `${this.root_path}${this.current_dir}/${this.newFileName}`;
|
||||||
await client.createDirectory(filePath, '');
|
await client.createDirectory(filePath, '');
|
||||||
this.newFileName = '';
|
this.newFileName = '';
|
||||||
this.isAddFilePopupVisible = false;
|
this.isAddFilePopupVisible = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user