Browse Source

implemented deletion of project files and dirs

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
module/files
Stephan Richter 1 month ago
parent
commit
7284637057
  1. 2
      files/src/main/java/de/srsoftware/umbrella/files/FileModule.java
  2. 6
      frontend/src/routes/files/Index.svelte

2
files/src/main/java/de/srsoftware/umbrella/files/FileModule.java

@ -24,7 +24,6 @@ import de.srsoftware.umbrella.core.model.Company;
import de.srsoftware.umbrella.core.model.Project; import de.srsoftware.umbrella.core.model.Project;
import de.srsoftware.umbrella.core.model.Token; import de.srsoftware.umbrella.core.model.Token;
import de.srsoftware.umbrella.core.model.UmbrellaUser; import de.srsoftware.umbrella.core.model.UmbrellaUser;
import java.io.*; import java.io.*;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.nio.file.Files; import java.nio.file.Files;
@ -136,6 +135,7 @@ public class FileModule extends BaseHandler implements FileService {
if (!dropDir(file)) return sendContent(ex,HTTP_SERVER_ERROR,format("Failed to delete {0}",file.getName())); if (!dropDir(file)) return sendContent(ex,HTTP_SERVER_ERROR,format("Failed to delete {0}",file.getName()));
Map<String,Object> map = getDirectory(file.getParentFile()); Map<String,Object> map = getDirectory(file.getParentFile());
map.put("title",file.getName()); map.put("title",file.getName());
map.put("delete",true);
return sendContent(ex,map); return sendContent(ex,map);
} }

6
frontend/src/routes/files/Index.svelte

@ -73,9 +73,9 @@
async function handleDirectory(res){ async function handleDirectory(res){
let json = await res.json(); let json = await res.json();
if (json.dirs) children.dirs = json.dirs; children.dirs = json.dirs ? json.dirs : {};
if (json.files) children.files = json.files; children.files = json.files ? json.files : {};
if (json.title) children.title = json.title; children.title = json.title ? json.title : {};
delete_allowed = json.delete; delete_allowed = json.delete;
yikes(); yikes();
} }

Loading…
Cancel
Save