web show folderPath in folder page
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
import { useParams } from "react-router";
|
import {useParams} from "react-router";
|
||||||
import { useState, useEffect } from "react";
|
import {useState, useEffect} from "react";
|
||||||
import { useNavigate } from "react-router-dom";
|
import {useNavigate} from "react-router-dom";
|
||||||
import { useQuery } from "./Common";
|
import {useQuery} from "./Common";
|
||||||
import FilesTable from "./FilesTable";
|
import FilesTable from "./FilesTable";
|
||||||
import { Tr } from "../translate";
|
import {Tr} from "../translate";
|
||||||
|
|
||||||
function FilesInFolder(props) {
|
function FilesInFolder(props) {
|
||||||
let params = useParams();
|
let params = useParams();
|
||||||
@@ -13,13 +13,14 @@ function FilesInFolder(props) {
|
|||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const offset = parseInt(query.get("o")) || 0;
|
const offset = parseInt(query.get("o")) || 0;
|
||||||
const [newFoldername, setNewFoldername] = useState("");
|
const [newFoldername, setNewFoldername] = useState("");
|
||||||
|
const [folderPath, setFolderPath] = useState("");
|
||||||
const limit = 10;
|
const limit = 10;
|
||||||
|
|
||||||
function refresh() {
|
function refresh() {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
fetch("/api/v1/get_files_in_folder", {
|
fetch("/api/v1/get_files_in_folder", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: {"Content-Type": "application/json"},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
folder_id: parseInt(params.id),
|
folder_id: parseInt(params.id),
|
||||||
offset: offset,
|
offset: offset,
|
||||||
@@ -32,6 +33,7 @@ function FilesInFolder(props) {
|
|||||||
alert(data.error);
|
alert(data.error);
|
||||||
} else {
|
} else {
|
||||||
setFiles(data.files);
|
setFiles(data.files);
|
||||||
|
setFolderPath(data.folder);
|
||||||
if (data.files.length > 0) {
|
if (data.files.length > 0) {
|
||||||
setNewFoldername(data.files[0].foldername);
|
setNewFoldername(data.files[0].foldername);
|
||||||
}
|
}
|
||||||
@@ -63,7 +65,7 @@ function FilesInFolder(props) {
|
|||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
fetch("/api/v1/update_foldername", {
|
fetch("/api/v1/update_foldername", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: {"Content-Type": "application/json"},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
id: parseInt(params.id),
|
id: parseInt(params.id),
|
||||||
foldername: newFoldername,
|
foldername: newFoldername,
|
||||||
@@ -87,7 +89,7 @@ function FilesInFolder(props) {
|
|||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
fetch("/api/v1/reset_foldername", {
|
fetch("/api/v1/reset_foldername", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: {"Content-Type": "application/json"},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
id: parseInt(params.id),
|
id: parseInt(params.id),
|
||||||
}),
|
}),
|
||||||
@@ -119,6 +121,7 @@ function FilesInFolder(props) {
|
|||||||
<button onClick={nextPage}>{Tr("Next page")}</button>
|
<button onClick={nextPage}>{Tr("Next page")}</button>
|
||||||
</div>
|
</div>
|
||||||
<FilesTable setPlayingFile={props.setPlayingFile} files={files} />
|
<FilesTable setPlayingFile={props.setPlayingFile} files={files} />
|
||||||
|
<span>{folderPath}</span>
|
||||||
<div>
|
<div>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
|
|||||||
Reference in New Issue
Block a user