Skip to content
Snippets Groups Projects
Commit 485ead49 authored by Ondřej Trojan's avatar Ondřej Trojan
Browse files

video file in folde upload

parent cedf2311
No related branches found
No related tags found
No related merge requests found
Showing
with 232 additions and 107 deletions
......@@ -70,14 +70,14 @@ public class FileUploaderController {
}
if (bindingResult.hasErrors()) {
modelViewService.populateVideoFiles(principal, model);
return "videofile";
return "videoedit/videofile";
}
ResponseData<UserDto> currentUser = userService.getUserByUsername(principal.getName());
ResponseData<Boolean> response = storageService.store(Integer.parseInt(currentUser.getData().getId()), videoFileForm);
if (!response.getData()) {
bindingResult.addError(new FieldError("videoFileForm", "file", response.getMessage()));
modelViewService.populateVideoFiles(principal, model);
return "videofile";
return "videoedit/videofile";
}
redirectAttributes.addFlashAttribute("message",
"You successfully uploaded " + videoFileForm.getFile().getOriginalFilename() + "!");
......
......@@ -38,6 +38,8 @@ public class WebController implements WebMvcConfigurer {
@Resource()
public DisplayTrackService displayTrackService;
@Resource()
public FolderService folderService;
@Resource()
public UserService userService;
......@@ -213,29 +215,29 @@ public class WebController implements WebMvcConfigurer {
modelViewService.populateVideoFiles(principal, model);
return "videoedit/videofile";
}
@GetMapping("/control/videoedit/videofolder")
public String ControlVideoEditVideofolder(Principal principal, Model model, FolderForm folderForm, BindingResult bindingResult) {
modelViewService.populateVideoFolder(principal, model);
return "videoedit/videofolder";
}
//
// @PostMapping("/control/videoedit/videofolder/add")
// public String ControlVideoEditVideofolderAdd(@Valid FolderForm folderForm, BindingResult bindingResult, Model model, Principal principal) {
// if (bindingResult.hasErrors()) {
// modelViewService.populateUsersHeader(principal, model);
// model.addAttribute("addUser", "true");
// return "users";
// }
// ResponseData<Boolean> response = userService.createUser(folderForm);
// if (!response.getData() && response.getField() != null) {
// bindingResult.addError(new FieldError("userForm", response.getField(), response.getMessage()));
// }
// if (bindingResult.hasErrors()) {
// modelViewService.populateUsersHeader(principal, model);
// model.addAttribute("addUser", "true");
// return "users";
// }
// return "redirect:/users";
// }
@PostMapping("/control/videoedit/videofolder/add")
public String ControlVideoEditVideofolderAdd(@Valid FolderForm folderForm, BindingResult bindingResult, Model model, Principal principal) {
if (bindingResult.hasErrors()) {
modelViewService.populateVideoFolder(principal, model);
return "videoedit/videofolder";
}
//validate
ResponseData<Boolean> response = folderService.createFolder(Integer.parseInt(folderForm.getParentFolderId()), folderForm.getFolder());
if (!response.getData() && response.getField() != null) {
bindingResult.addError(new FieldError("folderForm", response.getField(), response.getMessage()));
}
if (bindingResult.hasErrors()) {
modelViewService.populateVideoFolder(principal, model);
return "videoedit/videofolder";
}
return "redirect:/control/videoedit/videofolder";
}
}
......@@ -37,7 +37,18 @@ public class FolderDaoService {
List<Folder> folders = jdbcTemplate.query(sql, new Object[]{id}, (resultSet, i) -> {
return resultSetToFolder(resultSet);
});
if(folders.size()==0){
if (folders.size() == 0) {
return Optional.empty();
}
return Optional.ofNullable(folders.get(0));
}
public Optional<Folder> tryGetFolderByNameAndParentId(String name, int parentId) {
final String sql = "SELECT id, parentFolderId, path FROM folder WHERE path = ? AND parentfolderid = ?";
List<Folder> folders = jdbcTemplate.query(sql, new Object[]{name, parentId}, (resultSet, i) -> {
return resultSetToFolder(resultSet);
});
if (folders.size() == 0) {
return Optional.empty();
}
return Optional.ofNullable(folders.get(0));
......
......@@ -25,8 +25,8 @@ public class VideofileDaoService {
}
public Optional<Videofile> getFilenameById(int id) {
final String sql = "SELECT videoFileId, filename, createdby, createdutc, clientSynchronized, duration, fileSize, filepath, description FROM videofile WHERE videoFileId = ?";
public Optional<Videofile> getVideoFileById(int id) {
final String sql = "SELECT videoFileId, filename, createdby, createdutc, clientSynchronized, duration, fileSize, filepath, description, folderId FROM videofile WHERE videoFileId = ?";
return Optional.ofNullable(jdbcTemplate.queryForObject(sql, new Object[]{id}, (resultSet, i) -> {
return resultSetToVideoFile(resultSet);
}));
......@@ -34,17 +34,17 @@ public class VideofileDaoService {
public List<Videofile> getVideoFiles() {
final String sql = "SELECT videoFileId, filename, createdby, createdutc, clientSynchronized, duration, fileSize, filepath, description FROM videofile ORDER BY videoFileId";
final String sql = "SELECT videoFileId, filename, createdby, createdutc, clientSynchronized, duration, fileSize, filepath, description, folderId FROM videofile ORDER BY videoFileId";
List<Videofile> videofiles = jdbcTemplate.query(sql, (resultSet, i) -> {
return resultSetToVideoFile(resultSet);
});
return videofiles;
}
public Optional<Boolean> insertVideoFile(String filename, String filePath, String description, int createdBy, boolean clientSynchronized, int durationInSec, long fileSize) {
final String SQL = "INSERT INTO videofile (filename, filepath, description, createdBy, createdUtc, clientSynchronized, duration, fileSize) "
+ "VALUES(?,?,?,?,?,?,?,?)";
return Optional.of(jdbcTemplate.update(SQL, filename, filePath, description, createdBy, Timestamp.valueOf(LocalDateTime.now(ZoneId.of("UTC"))), clientSynchronized, durationInSec, fileSize) > 0);
public Optional<Boolean> insertVideoFile(String filename, String filePath, String description, int createdBy, boolean clientSynchronized, int durationInSec, long fileSize, int folderId) {
final String SQL = "INSERT INTO videofile (filename, filepath, description, createdBy, createdUtc, clientSynchronized, duration, fileSize, folderId) "
+ "VALUES(?,?,?,?,?,?,?,?,?)";
return Optional.of(jdbcTemplate.update(SQL, filename, filePath, description, createdBy, Timestamp.valueOf(LocalDateTime.now(ZoneId.of("UTC"))), clientSynchronized, durationInSec, fileSize, folderId) > 0);
}
private Videofile resultSetToVideoFile(ResultSet resultSet) {
......@@ -57,7 +57,8 @@ public class VideofileDaoService {
resultSet.getBoolean("clientSynchronized"),
resultSet.getInt("duration"),
resultSet.getLong("fileSize"),
resultSet.getString("description"));
resultSet.getString("description"),
resultSet.getInt("folderId"));
} catch (SQLException e) {
e.printStackTrace();
}
......
......@@ -3,29 +3,31 @@ package com.museum.projection.dto.forms;
import com.museum.projection.util.validation.OnlyNumbers;
import com.museum.projection.util.validation.OnlyText;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
public class FolderForm {
@NotNull
@NotEmpty
@Size(max = 30)
@OnlyText
private String folder;
@OnlyNumbers
private int parentFolderId;
private String parentFolderId;
public FolderForm(@NotNull @Size(max = 30) String folder, @OnlyNumbers int parentFolderId) {
public FolderForm(@NotNull @Size(max = 30) String folder, @OnlyNumbers String parentFolderId) {
this.folder = folder;
this.parentFolderId = parentFolderId;
}
public int getParentFolderId() {
public String getParentFolderId() {
return parentFolderId;
}
public void setParentFolderId(int parentFolderId) {
public void setParentFolderId(String parentFolderId) {
this.parentFolderId = parentFolderId;
}
......
package com.museum.projection.dto.forms;
import com.museum.projection.util.validation.OnlyNumbers;
import com.museum.projection.util.validation.OnlyText;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
......@@ -17,13 +19,20 @@ public class VideoFileForm {
@NotNull
private MultipartFile file;
@NotNull
@NotEmpty
@OnlyNumbers
private String folder;
@OnlyText
@Size(max = 300)
private String description;
public VideoFileForm(@NotNull String filename, @NotNull MultipartFile file, String description) {
public VideoFileForm(@NotNull String filename, @NotNull MultipartFile file, @NotNull @NotEmpty String folder, String description) {
this.filename = filename;
this.file = file;
this.folder = folder;
this.description = description;
}
......@@ -50,4 +59,12 @@ public class VideoFileForm {
public void setFilename(String filename) {
this.filename = filename;
}
public String getFolder() {
return folder;
}
public void setFolder(String folder) {
this.folder = folder;
}
}
......@@ -9,19 +9,21 @@ import java.sql.Timestamp;
public class Videofile {
@NotBlank
@NotNull
private final Integer id;
@NotNull
@NotBlank
private final String filename;
@NotNull
@NotBlank
private final String filepath;
@NotBlank
@NotNull
private final Integer createdBy;
@NotBlank
@NotNull
private final Timestamp createdUtc;
@NotNull
......@@ -34,6 +36,9 @@ public class Videofile {
private final String description;
@NotNull
private final Integer folderId;
public Videofile(@JsonProperty("videoFileId") Integer id,
@JsonProperty("filename") String filename,
@JsonProperty("filePath") String filepath,
......@@ -42,7 +47,8 @@ public class Videofile {
@JsonProperty("clientSynchronized") Boolean clientSynchronized,
@JsonProperty("duration") Integer duration,
@JsonProperty("fileSize") Long fileSize,
@JsonProperty("description") String description) {
@JsonProperty("description") String description,
@JsonProperty("folderId") Integer folderId) {
this.id = id;
this.filename = filename;
this.filepath = filepath;
......@@ -52,6 +58,7 @@ public class Videofile {
this.duration = duration;
this.fileSize = fileSize;
this.description = description;
this.folderId = folderId;
}
......@@ -90,4 +97,8 @@ public class Videofile {
public String getFilepath() {
return filepath;
}
public Integer getFolderId() {
return folderId;
}
}
package com.museum.projection.service;
import com.museum.projection.config.CustomConfig;
import com.museum.projection.dao.FolderDaoService;
import com.museum.projection.dao.ResponseData;
import com.museum.projection.dto.FolderDto;
import com.museum.projection.model.Folder;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.stereotype.Service;
import java.io.File;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
......@@ -16,31 +22,91 @@ import java.util.stream.Collectors;
public class FolderService {
private final FolderDaoService folderDaoService;
private final CustomConfig config;
private static final Logger log = LoggerFactory.getLogger(FolderService.class);
@Autowired
public FolderService(FolderDaoService folderDaoService) {
public FolderService(FolderDaoService folderDaoService, CustomConfig config) {
this.folderDaoService = folderDaoService;
this.config = config;
}
public List<FolderDto> getAllFolders() {
List<FolderDto> folders = folderDaoService.getFolders().stream().map(folder -> new FolderDto(
String.valueOf(folder.getId()),
getFullRelativePath(folder.getPath(), folder.getParentFolderId()))).collect(Collectors.toList());
cutLastSlash(getFullRelativePath(folder.getPath(), folder.getParentFolderId())))).collect(Collectors.toList());
return folders;
}
private ResponseData<Boolean> creatFolderAt(String path) {
boolean flag = false;
try {
File file = new File(path + '/');
flag = file.mkdir();
} catch (Exception e) {
log.error("Error creating directory " + path, e);
}
return new ResponseData<>(flag);
}
public ResponseData<Boolean> createFolder(int parentFolderId, String folderName) {
ResponseData<Boolean> ret;
try {
Optional<Folder> existing = folderDaoService.tryGetFolderByNameAndParentId(folderName + '/', parentFolderId);
if (existing.isPresent()) {
return new ResponseData(false, "folder " + cutLastSlash(getFullRelativePath(existing.get().getPath(), existing.get().getParentFolderId())) + " already exist", "folder");
}
//get parent
Optional<Folder> chosenParent = folderDaoService.getFolderById(parentFolderId);
String pathToParent = getFullRelativePath(chosenParent.orElseThrow().getPath(), chosenParent.orElseThrow().getParentFolderId());
//try to create dir
ResponseData<Boolean> booleanResponseData = creatFolderAt(cutLastSlash(config.getVideoFolderPath()) + pathToParent + folderName);
if (!booleanResponseData.getData()) {
log.error("Error creating directory " + cutLastSlash(config.getVideoFolderPath()) + pathToParent + folderName);
return new ResponseData(false, "Error creating file at disk");
}
//if ok creat db
ret = new ResponseData<>(folderDaoService.insertFolder(folderName + '/', parentFolderId).orElse(null));
} catch (DuplicateKeyException e) {
return new ResponseData(false);
}
return ret == null ? new ResponseData<>(false, "unkown error") : ret;
}
public ResponseData<FolderDto> getFolderById(String id) {
ResponseData<FolderDto> ret;
try {
ret = folderDaoService.getFolderById(Integer.parseInt(id)).map(folder ->
new ResponseData<>(new FolderDto(
String.valueOf(folder.getId()),
cutLastSlash(getFullRelativePath(folder.getPath(), folder.getParentFolderId()))))
).orElseThrow();
} catch (EmptyResultDataAccessException e) {
return new ResponseData(null, String.format("Folder with id %s not found", id), "folderId");
}
return ret == null ? new ResponseData<>(null, "unkown error") : ret;
}
private String getFullRelativePath(String path, Integer parentFolderId) {
String ret = path;
Optional<Folder> parent = folderDaoService.tryGetFolderById(parentFolderId);
if (parent.isPresent()) {
ret = getFullRelativePath(parent.get().getPath(), parent.get().getParentFolderId()) + ret;
}
if (ret.length() > 1 && ret.endsWith("/")) {
ret = ret.substring(0, ret.length() - 1);
}
return ret;
}
private String cutLastSlash(String path) {
if (path.length() > 1 && path.endsWith("/")) {
path = path.substring(0, path.length() - 1);
}
return path;
}
......
......@@ -43,6 +43,7 @@ public class ModelViewService {
model.addAttribute("activeTab", "control");
model.addAttribute("videofiles", videofileService.getAllFilenames());
model.addAttribute("maxFileSize", multipartConfigElement.getMaxFileSize());
model.addAttribute("folders", folderService.getAllFolders());
model.addAttribute("activeTabSecondary", "videofile");
return model;
}
......
......@@ -3,6 +3,7 @@ package com.museum.projection.service;
import com.museum.projection.config.CustomConfig;
import com.museum.projection.dao.ResponseData;
import com.museum.projection.dto.FolderDto;
import com.museum.projection.dto.forms.VideoFileForm;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -21,14 +22,16 @@ public class StorageService {
private static final Logger log = LoggerFactory.getLogger(StorageService.class);
private final CustomConfig config;
private String videoFolderPath;
private final String videoFolderPath;
private final VideofileService videofileService;
private final FolderService folderService;
@Autowired
public StorageService(CustomConfig config, VideofileService videofileService) {
public StorageService(CustomConfig config, VideofileService videofileService, FolderService folderService) {
this.config = config;
this.videoFolderPath = config.getVideoFolderPath() + "uploads/";
this.videoFolderPath = config.getVideoFolderPath();
this.videofileService = videofileService;
this.folderService = folderService;
}
......@@ -36,6 +39,7 @@ public class StorageService {
}
public ResponseData<Boolean> store(int currentUserId, VideoFileForm form) {
MultipartFile file = form.getFile();
if (file.isEmpty()) {
......@@ -43,7 +47,11 @@ public class StorageService {
}
String filePath = "";
try {
filePath = videoFolderPath + form.getFilename();
ResponseData<FolderDto> folder = folderService.getFolderById(form.getFolder());
if (folder.getData() == null) {
return new ResponseData<>(false, "Folder error");
}
filePath = addEndSlashIfMissing(videoFolderPath + folder.getData().getFolder()) + form.getFilename();
File dest = new File(filePath);
if (dest.exists()) {
return new ResponseData<>(false, "File with same name already exist");
......@@ -55,8 +63,7 @@ public class StorageService {
log.error("Error with file transfer", e);
return new ResponseData<>(false, "File error");
}
videofileService.createVideoFile(currentUserId, filePath, form.getFilename(), form.getDescription(), false, 0, file.getSize());
videofileService.createVideoFile(currentUserId, filePath, form.getFilename(), form.getDescription(), false, 0, file.getSize(), Integer.parseInt(form.getFolder()));
return new ResponseData<>(true);
}
......@@ -77,4 +84,11 @@ public class StorageService {
}
private String addEndSlashIfMissing(String path) {
if (!path.endsWith("/")) {
path = path + '/';
}
return path;
}
}
\ No newline at end of file
......@@ -47,10 +47,10 @@ public class VideofileService {
return videoFileDtoList;
}
public ResponseData<Boolean> createVideoFile(int currentUserId, String filePath, String filename, String description, boolean clientSynchronized, int durationInSec, long size) {
public ResponseData<Boolean> createVideoFile(int currentUserId, String filePath, String filename, String description, boolean clientSynchronized, int durationInSec, long size, int folderId) {
ResponseData<Boolean> ret;
try {
ret = new ResponseData<>(filenameDao.insertVideoFile(filename, filePath, description, currentUserId, clientSynchronized, durationInSec, size).orElse(null));
ret = new ResponseData<>(filenameDao.insertVideoFile(filename, filePath, description, currentUserId, clientSynchronized, durationInSec, size, folderId).orElse(null));
} catch (DuplicateKeyException e) {
return new ResponseData(false, "username already exists", "username");
}
......
......@@ -13,44 +13,20 @@ CREATE TABLE account
CREATE TABLE displaySet
(
displaySetId BIGSERIAL NOT NULL PRIMARY KEY,
createdBy BIGSERIAL REFERENCES account (id) NOT NULL,
name VARCHAR(100) NOT NULL,
createdUtc TIMESTAMP WITH TIME ZONE NOT NULL
displaySetId BIGSERIAL NOT NULL PRIMARY KEY,
createdBy BIGINT REFERENCES account (id) NOT NULL,
name VARCHAR(100) NOT NULL,
createdUtc TIMESTAMP WITH TIME ZONE NOT NULL
);
CREATE TABLE displayTrack
(
displayTrackId BIGSERIAL NOT NULL PRIMARY KEY,
displaySetId BIGSERIAL REFERENCES displaySet (displaySetId) NOT NULL,
name VARCHAR(100) NOT NULL,
createdBy BIGSERIAL REFERENCES account (id) NOT NULL,
createdUtc TIMESTAMP WITH TIME ZONE NOT NULL
displayTrackId BIGSERIAL NOT NULL PRIMARY KEY,
displaySetId BIGINT REFERENCES displaySet (displaySetId) NOT NULL,
name VARCHAR(100) NOT NULL,
createdBy BIGINT REFERENCES account (id) NOT NULL,
createdUtc TIMESTAMP WITH TIME ZONE NOT NULL
);
CREATE TABLE videoFile
(
videoFileId BIGSERIAL NOT NULL PRIMARY KEY,
createdBy BIGSERIAL REFERENCES account (id) NOT NULL,
createdUtc TIMESTAMP WITH TIME ZONE NOT NULL,
fileName VARCHAR(100) NOT NULL,
filePath VARCHAR(300) NOT NULL,
clientSynchronized BOOLEAN NOT NULL,
duration INT NOT NULL,
fileSize BIGINT NOT NULL,
description VARCHAR(300)
);
CREATE TABLE displayTrackToVideoFile
(
displayTrackToVideoFileId BIGSERIAL NOT NULL PRIMARY KEY,
displayTrackId BIGSERIAL REFERENCES displayTrack (displayTrackId) NOT NULL,
videoFileId BIGSERIAL REFERENCES videoFile (videoFileId) NOT NULL,
createdBy BIGSERIAL REFERENCES account (id) NOT NULL,
createdUtc TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Folder
CREATE TABLE folder
(
......@@ -64,6 +40,31 @@ VALUES ('/');
INSERT INTO folder (path, parentFolderId)
VALUES ('test/', 1);
CREATE TABLE videoFile
(
videoFileId BIGSERIAL NOT NULL PRIMARY KEY,
createdBy BIGINT REFERENCES account (id) NOT NULL,
createdUtc TIMESTAMP WITH TIME ZONE NOT NULL,
fileName VARCHAR(100) NOT NULL,
filePath VARCHAR(300) NOT NULL,
folderId BIGINT NOT NULL,
clientSynchronized BOOLEAN NOT NULL,
duration INT NOT NULL,
fileSize BIGINT NOT NULL,
description VARCHAR(300)
);
CREATE TABLE displayTrackToVideoFile
(
displayTrackToVideoFileId BIGSERIAL NOT NULL PRIMARY KEY,
displayTrackId BIGINT REFERENCES displayTrack (displayTrackId) NOT NULL,
videoFileId BIGINT REFERENCES videoFile (videoFileId) NOT NULL,
createdBy BIGINT REFERENCES account (id) NOT NULL,
createdUtc TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Accounts
INSERT INTO account (id, username, password, roles, createdUtc, active)
VALUES (DEFAULT, 'admin', '$2a$10$2DAipSvgd75ir6BZ3a7NiOHRwi5sEWr9AP5yDO65034aZjZnc2f8e', 'ADMIN,PRESENTATOR',
......@@ -93,12 +94,12 @@ VALUES (1, 1, current_timestamp, 'my another display track');
-- Video files
INSERT INTO videoFile (createdBy, createdUtc, fileName, filePath, clientSynchronized, duration, fileSize)
VALUES (1, current_timestamp, 'video1.mp4', '/path/video1.mp4', FALSE, 60, 12300);
INSERT INTO videoFile (createdBy, createdUtc, fileName, filePath, clientSynchronized, duration, fileSize)
VALUES (1, current_timestamp, 'video2.mp4', '/path/video2.mp4', TRUE, 90, 1200);
INSERT INTO videoFile (createdBy, createdUtc, fileName, filePath, clientSynchronized, duration, fileSize)
VALUES (1, current_timestamp, 'video3.mp4', '/path/video3.mp4', FALSE, 95, 1000);
INSERT INTO videoFile (createdBy, createdUtc, fileName, filePath, clientSynchronized, duration, fileSize, folderId)
VALUES (1, current_timestamp, 'video1.mp4', '/path/video1.mp4', FALSE, 60, 12300, 1);
INSERT INTO videoFile (createdBy, createdUtc, fileName, filePath, clientSynchronized, duration, fileSize, folderId)
VALUES (1, current_timestamp, 'video2.mp4', '/path/video2.mp4', TRUE, 90, 1200, 1);
INSERT INTO videoFile (createdBy, createdUtc, fileName, filePath, clientSynchronized, duration, fileSize, folderId)
VALUES (1, current_timestamp, 'video3.mp4', '/path/video3.mp4', FALSE, 95, 1000, 1);
-- Video file - video track relationship
......
// import {serverUrl, getCookie, sendHttpRequest} from './common.js';
import {serverUrl, getCookie, sendHttpRequest} from './common.js';
let filenameInput = document.querySelector("input#inputFilename");
let fileInput = document.querySelector("input.custom-file-input");
......
......@@ -18,6 +18,9 @@
<a type="button" class="btn btn-primary btn-lg" th:classappend="${activeTabSecondary == 'videofolder' ? 'active':''}" th:href="@{/control/videoedit/videofolder}">Video folder</a>
<div class="alert alert-success" role="alert" th:if="${message}" th:text="${message}"></div>
<div class="alert alert-danger" role="alert" th:if="${messageErr}" th:text="${messageErr}"></div>
<div class="container container-videoedit" layout:fragment="content_videoedit">
<h1>Static content for prototyping purposes only</h1>
</div>
......
......@@ -13,9 +13,6 @@
<p>Video file represents uploaded video file for one device</p>
<div class="alert alert-success" role="alert" th:if="${message}" th:text="${message}"></div>
<div class="alert alert-danger" role="alert" th:if="${messageErr}" th:text="${messageErr}"></div>
<div th:replace="fragments/videoFiles :: videoFileTable"></div>
<div id="uploadVideoContent">
......@@ -58,13 +55,13 @@
<input class="custom-file-input" type="file" th:field="*{file}" id="videoFileInput"/>
<div th:if="${#fields.hasErrors('file')}" class="invalid-feedback" th:errors="*{file}"></div>
</div>
<div class="form-group row">
<label class="ml-3 my-1 mr-2" for="inlineFormCustomSelectPref">Folder</label>
<select class="custom-select custom-folder-dropdown my-1 mr-sm-2" id="inlineFormCustomSelectPref">
<option selected>Choose folder</option>
<option value="1">/vid/</option>
<option value="2">Two</option>
<option value="3">Three</option>
<select class="custom-select custom-folder-dropdown my-1 mr-sm-2" id="inlineFormCustomSelectPref" th:field="*{folder}">
<option th:if="${folders.isEmpty()}" selected>No parent</option>
<option th:each="folder : ${folders}" th:value="${folder.getId()}"
th:text="${folder.getFolder()}"></option>
</select>
</div>
......@@ -86,6 +83,6 @@
</body>
<footer layout:fragment="content_js_secondary">
<script type="module" src="/static/js/videofile.js"></script>
</footer>
<div layout:fragment="content_js_secondary">
<script type="module" src="/js/videofile.js"></script>
</div>
......@@ -51,7 +51,7 @@
<div class="form-group row">
<label class="ml-3 my-1 mr-2" for="inlineFormCustomSelectPref">Parent folder</label>
<select class="custom-select custom-folder-dropdown my-1 mr-sm-2" id="inlineFormCustomSelectPref">
<select class="custom-select custom-folder-dropdown my-1 mr-sm-2" id="inlineFormCustomSelectPref" th:field="*{parentFolderId}">
<option th:if="${folders.isEmpty()}" selected>No parent</option>
<option th:each="folder : ${folders}" th:value="${folder.getId()}"
th:text="${folder.getFolder()}"></option>
......@@ -64,9 +64,8 @@
<button id="uploadFileSubmitButton" type="submit" class="btn btn-primary float-right"
data-toggle="tooltip"
data-placement="right"
title="This action will upload file and create record in database">Upload
title="This action will upload file and create record in database">Create
</button>
<p class="float-right videoSizeText" id="videoSize"></p>
</div>
</div>
</form>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment