Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3b6e84d1af |
@@ -12,7 +12,6 @@ import de.srsoftware.tools.ColorLogger;
|
|||||||
import de.srsoftware.umbrella.bookmarks.BookmarkApi;
|
import de.srsoftware.umbrella.bookmarks.BookmarkApi;
|
||||||
import de.srsoftware.umbrella.company.CompanyModule;
|
import de.srsoftware.umbrella.company.CompanyModule;
|
||||||
import de.srsoftware.umbrella.contact.ContactModule;
|
import de.srsoftware.umbrella.contact.ContactModule;
|
||||||
import de.srsoftware.umbrella.core.SettingsService;
|
|
||||||
import de.srsoftware.umbrella.core.Util;
|
import de.srsoftware.umbrella.core.Util;
|
||||||
import de.srsoftware.umbrella.core.exceptions.UmbrellaException;
|
import de.srsoftware.umbrella.core.exceptions.UmbrellaException;
|
||||||
import de.srsoftware.umbrella.documents.DocumentApi;
|
import de.srsoftware.umbrella.documents.DocumentApi;
|
||||||
@@ -89,7 +88,6 @@ public class Application {
|
|||||||
new WebHandler().bindPath("/").on(server);
|
new WebHandler().bindPath("/").on(server);
|
||||||
new WikiModule(config).bindPath("/api/wiki").on(server);
|
new WikiModule(config).bindPath("/api/wiki").on(server);
|
||||||
new FileModule(config).bindPath("/api/files").on(server);
|
new FileModule(config).bindPath("/api/files").on(server);
|
||||||
new SettingsService(config).bindPath("/api/settings").on(server);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.log(ERROR,"Startup failed",e);
|
LOG.log(ERROR,"Startup failed",e);
|
||||||
System.exit(-1);
|
System.exit(-1);
|
||||||
|
|||||||
@@ -49,11 +49,11 @@ public class MessageApi extends BaseHandler{
|
|||||||
if (++counter > 300) counter = sendBeacon(addr,stream);
|
if (++counter > 300) counter = sendBeacon(addr,stream);
|
||||||
} else {
|
} else {
|
||||||
var event = eventQueue.removeFirst();
|
var event = eventQueue.removeFirst();
|
||||||
if (event.isIntendedFor(user.get())) {
|
//if (event.isIntendedFor(user.get())) {
|
||||||
LOG.log(DEBUG, "sending event to {0}", addr);
|
LOG.log(DEBUG, "sending event to {0}", addr);
|
||||||
sendEvent(stream, event);
|
sendEvent(stream, event);
|
||||||
counter = 0;
|
counter = 0;
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG.log(INFO,"{0} disconnected from event stream.",addr);
|
LOG.log(INFO,"{0} disconnected from event stream.",addr);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ public class MessageBus {
|
|||||||
|
|
||||||
private MessageBus(){}
|
private MessageBus(){}
|
||||||
|
|
||||||
public void dispatch(Event<?> event){
|
public void dispatch(Event event){
|
||||||
new Thread(() -> { // TODO: use thread pool
|
new Thread(() -> { // TODO: use thread pool
|
||||||
try {
|
try {
|
||||||
Thread.sleep(100);
|
Thread.sleep(100);
|
||||||
|
|||||||
@@ -1,49 +0,0 @@
|
|||||||
package de.srsoftware.umbrella.messagebus.events;
|
|
||||||
|
|
||||||
import de.srsoftware.umbrella.core.ModuleRegistry;
|
|
||||||
import de.srsoftware.umbrella.core.api.Owner;
|
|
||||||
import de.srsoftware.umbrella.core.constants.Field;
|
|
||||||
import de.srsoftware.umbrella.core.model.*;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static de.srsoftware.umbrella.core.constants.Field.*;
|
|
||||||
import static de.srsoftware.umbrella.core.model.Translatable.t;
|
|
||||||
|
|
||||||
public class ItemEvent extends Event<Item>{
|
|
||||||
public ItemEvent(UmbrellaUser initiator, String module, Item item, EventType type) {
|
|
||||||
super(initiator, module, item, type);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Collection<UmbrellaUser> audience() {
|
|
||||||
Owner owner = payload().location().resolve().owner().resolve();
|
|
||||||
if (owner instanceof UmbrellaUser user) return List.of(user);
|
|
||||||
if (owner instanceof Company company) return ModuleRegistry.companyService().getMembers(company.id());
|
|
||||||
return List.of();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Translatable describe() {
|
|
||||||
return switch (eventType()){
|
|
||||||
case CREATE -> describeCreate();
|
|
||||||
case null, default -> null;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private Translatable describeCreate() {
|
|
||||||
var loc = payload().location().resolve().name();
|
|
||||||
return t("{user} added \"{item}\" to \"{location}\"", USER,initiator().name(), ITEM, payload().name(), LOCATION, loc);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Translatable subject() {
|
|
||||||
var loc = payload().location().resolve().name();
|
|
||||||
return switch (eventType()){
|
|
||||||
case CREATE -> t("A new item has been added to \"{location}\":",LOCATION,loc);
|
|
||||||
case null, default -> null;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,119 +0,0 @@
|
|||||||
/* © SRSoftware 2025 */
|
|
||||||
package de.srsoftware.umbrella.core;
|
|
||||||
|
|
||||||
import static de.srsoftware.umbrella.core.ModuleRegistry.userService;
|
|
||||||
import static de.srsoftware.umbrella.core.constants.Constants.CLASS;
|
|
||||||
import static de.srsoftware.umbrella.core.constants.Field.*;
|
|
||||||
import static de.srsoftware.umbrella.core.constants.Path.MENU;
|
|
||||||
import static de.srsoftware.umbrella.core.constants.Text.*;
|
|
||||||
import static de.srsoftware.umbrella.core.constants.Text.USERS;
|
|
||||||
import static java.text.MessageFormat.format;
|
|
||||||
|
|
||||||
import com.sun.net.httpserver.HttpExchange;
|
|
||||||
import de.srsoftware.configuration.Configuration;
|
|
||||||
import de.srsoftware.tools.Mappable;
|
|
||||||
import de.srsoftware.tools.Path;
|
|
||||||
import de.srsoftware.tools.SessionToken;
|
|
||||||
import de.srsoftware.umbrella.core.constants.Module;
|
|
||||||
import de.srsoftware.umbrella.core.constants.Text;
|
|
||||||
import de.srsoftware.umbrella.core.exceptions.UmbrellaException;
|
|
||||||
import de.srsoftware.umbrella.core.model.Token;
|
|
||||||
import de.srsoftware.umbrella.core.model.UmbrellaUser;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.*;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
public class SettingsService extends BaseHandler {
|
|
||||||
|
|
||||||
private final Configuration config;
|
|
||||||
|
|
||||||
public SettingsService(Configuration config) {
|
|
||||||
this.config = config;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean doGet(Path path, HttpExchange ex) throws IOException {
|
|
||||||
addCors(ex);
|
|
||||||
try {
|
|
||||||
Optional<Token> token = SessionToken.from(ex).map(Token::of);
|
|
||||||
var user = userService().loadUser(token);
|
|
||||||
if (user.isEmpty()) return unauthorized(ex);
|
|
||||||
var head = path.pop();
|
|
||||||
return switch (head) {
|
|
||||||
case MENU -> getMenuSettings(user.get(), ex);
|
|
||||||
case null, default -> super.doGet(path, ex);
|
|
||||||
};
|
|
||||||
} catch (UmbrellaException e) {
|
|
||||||
return send(ex, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private record MenuEntry(int pos, String module, String clazz, String title) implements Mappable {
|
|
||||||
public static MenuEntry of(int pos, String module){
|
|
||||||
return new MenuEntry(pos, module, module, module);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MenuEntry of(int pos, String module, String title){
|
|
||||||
return new MenuEntry(pos,module,module,title);
|
|
||||||
}
|
|
||||||
public static MenuEntry of(int pos, String module, String clazz, String title){
|
|
||||||
return new MenuEntry(pos,module,clazz,title);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> toMap() {
|
|
||||||
return Map.of(MODULE,module,CLASS,clazz,TITLE,title);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private boolean getMenuSettings(UmbrellaUser user, HttpExchange ex) throws IOException {
|
|
||||||
Optional<JSONObject> modules = config.get("umbrella.modules");
|
|
||||||
if (modules.isEmpty()) throw UmbrellaException.missingConfig("umbrella.modules");
|
|
||||||
|
|
||||||
var entries = new ArrayList<MenuEntry>();
|
|
||||||
entries.add(MenuEntry.of(1, Module.USER, USERS));
|
|
||||||
entries.add(MenuEntry.of(2, Module.COMPANY, COMPANIES));
|
|
||||||
entries.add(MenuEntry.of(3, Module.PROJECT,Text.PROJECTS));
|
|
||||||
entries.add(MenuEntry.of(4,Module.TASK,Text.TASKS));
|
|
||||||
entries.add(MenuEntry.of(5,Module.TAGS));
|
|
||||||
entries.add(MenuEntry.of(6,Module.DOCUMENT,"doc",Text.DOCUMENTS));
|
|
||||||
entries.add(MenuEntry.of(7,Module.BOOKMARK,"mark",BOOKMARKS));
|
|
||||||
entries.add(MenuEntry.of(8,Module.NOTES,"note",Text.NOTES));
|
|
||||||
entries.add(MenuEntry.of(9,Module.FILES,"file", FILES));
|
|
||||||
entries.add(MenuEntry.of(10,Module.TIME, Text.TIMETRACKING));
|
|
||||||
entries.add(MenuEntry.of(11,Module.WIKI));
|
|
||||||
entries.add(MenuEntry.of(12,Module.CONTACT, CONTACTS));
|
|
||||||
entries.add(MenuEntry.of(13,Module.STOCK));
|
|
||||||
entries.add(MenuEntry.of(14,Module.MESSAGE, MESSAGES));
|
|
||||||
entries.add(MenuEntry.of(15,Module.POLL,Text.POLLS));
|
|
||||||
|
|
||||||
for (var i=0; i<entries.size(); i++){
|
|
||||||
var entry = entries.get(i);
|
|
||||||
var key = format("umbrella.modules.{0}.menuIndex",entry.module);
|
|
||||||
Optional<Integer> val = config.get(key);
|
|
||||||
if (val.isEmpty()) {
|
|
||||||
key = format("umbrella.modules.{0}.menu_index",entry.module);
|
|
||||||
val = config.get(key);
|
|
||||||
}
|
|
||||||
if (val.isPresent()) {
|
|
||||||
var index = val.get();
|
|
||||||
if (index<0) {
|
|
||||||
entries.remove(i);
|
|
||||||
i--;
|
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
entry = MenuEntry.of(index,entry.module,entry.clazz,entry.title);
|
|
||||||
entries.set(i,entry);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
key = format("umbrella.modules.{0}.baseUrl",entry.module);
|
|
||||||
Optional<String> baseUrl = config.get(key);
|
|
||||||
if (baseUrl.isPresent()) {
|
|
||||||
entry = MenuEntry.of(entry.pos,baseUrl.get(), entry.clazz,entry.title);
|
|
||||||
entries.set(i,entry);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var list = entries.stream().sorted((a,b) -> a.pos - b.pos)
|
|
||||||
.map(MenuEntry::toMap).toList();
|
|
||||||
return sendContent(ex,list);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -12,10 +12,7 @@ public class Constants {
|
|||||||
// prevent instantiation
|
// prevent instantiation
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String CLASS = "class";
|
public static final String COUNT = "COUNT(*)";
|
||||||
public static final String CONFIG_SESSION_DURATION = "umbrella.session.duration";
|
|
||||||
public static final String COUNT = "COUNT(*)";
|
|
||||||
|
|
||||||
public static final String FALLBACK_LANG = "de";
|
public static final String FALLBACK_LANG = "de";
|
||||||
public static final String HOME = "home";
|
public static final String HOME = "home";
|
||||||
public static final String JSONARRAY = "json array";
|
public static final String JSONARRAY = "json array";
|
||||||
@@ -23,10 +20,8 @@ public class Constants {
|
|||||||
public static final String KEEP_ALIVE = "keep-alive";
|
public static final String KEEP_ALIVE = "keep-alive";
|
||||||
public static final String NO_CACHE = "no-cache";
|
public static final String NO_CACHE = "no-cache";
|
||||||
public static final String NONE = "none";
|
public static final String NONE = "none";
|
||||||
|
public static final String TABLE_SETTINGS = "settings";
|
||||||
public static final String TABLE_SETTINGS = "settings";
|
|
||||||
public static final DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
public static final DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
public static final String UMBRELLA = "Umbrella";
|
public static final String UMBRELLA = "Umbrella";
|
||||||
public static final String UTF8 = UTF_8.displayName();
|
public static final String UTF8 = UTF_8.displayName();
|
||||||
|
|
||||||
|
|||||||
@@ -86,7 +86,6 @@ public class Field {
|
|||||||
public static final String LOGIN = "login";
|
public static final String LOGIN = "login";
|
||||||
|
|
||||||
public static final String MEMBERS = "members";
|
public static final String MEMBERS = "members";
|
||||||
public static final String MENU_INDEX = "menu_index";
|
|
||||||
public static final String MESSAGE_ID = "message_id";
|
public static final String MESSAGE_ID = "message_id";
|
||||||
public static final String MIME = "mime";
|
public static final String MIME = "mime";
|
||||||
public static final String MODULE = "module";
|
public static final String MODULE = "module";
|
||||||
|
|||||||
@@ -4,17 +4,8 @@ package de.srsoftware.umbrella.core.constants;
|
|||||||
public class Module {
|
public class Module {
|
||||||
public static final String BOOKMARK = "bookmark";
|
public static final String BOOKMARK = "bookmark";
|
||||||
public static final String COMPANY = "company";
|
public static final String COMPANY = "company";
|
||||||
public static final String CONTACT = "contact";
|
|
||||||
public static final String DOCUMENT = "document";
|
|
||||||
public static final String FILES = "files";
|
|
||||||
public static final String MESSAGE = "message";
|
|
||||||
public static final String NOTES = "notes";
|
|
||||||
public static final String POLL = "poll";
|
|
||||||
public static final String PROJECT = "project";
|
public static final String PROJECT = "project";
|
||||||
public static final String STOCK = "stock";
|
|
||||||
public static final String TAGS = "tags";
|
|
||||||
public static final String TASK = "task";
|
public static final String TASK = "task";
|
||||||
public static final String TIME = "time";
|
|
||||||
public static final String USER = "user";
|
public static final String USER = "user";
|
||||||
public static final String WIKI = "wiki";
|
public static final String WIKI = "wiki";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,13 +5,11 @@ public class Path {
|
|||||||
private Path(){};
|
private Path(){};
|
||||||
|
|
||||||
public static final String ADD = "add";
|
public static final String ADD = "add";
|
||||||
public static final String AVAILABLE = "available";
|
public static final String AVAILABLE = "available";
|
||||||
|
public static final String CSS = "css";
|
||||||
public static final String CSS = "css";
|
public static final String COMMON_TEMPLATES = "common_templates";
|
||||||
public static final String CLONE = "clone";
|
public static final String COMPANY = "company";
|
||||||
public static final String COMMON_TEMPLATES = "common_templates";
|
public static final String CONNECTED = "connected";
|
||||||
public static final String COMPANY = "company";
|
|
||||||
public static final String CONNECTED = "connected";
|
|
||||||
|
|
||||||
public static final String ITEM = "item";
|
public static final String ITEM = "item";
|
||||||
|
|
||||||
@@ -24,9 +22,6 @@ public class Path {
|
|||||||
public static final String LOGIN = "login";
|
public static final String LOGIN = "login";
|
||||||
|
|
||||||
public static final String LOGOUT = "logout";
|
public static final String LOGOUT = "logout";
|
||||||
|
|
||||||
public static final String MENU = "menu";
|
|
||||||
|
|
||||||
public static final String PAGE = "page";
|
public static final String PAGE = "page";
|
||||||
public static final String PASSWORD = "password";
|
public static final String PASSWORD = "password";
|
||||||
public static final String PROJECT = "project";
|
public static final String PROJECT = "project";
|
||||||
|
|||||||
@@ -5,9 +5,8 @@ package de.srsoftware.umbrella.core.constants;
|
|||||||
* This is a collection of messages that appear throughout the project
|
* This is a collection of messages that appear throughout the project
|
||||||
*/
|
*/
|
||||||
public class Text {
|
public class Text {
|
||||||
public static final String BOOKMARK = "bookmark";
|
public static final String BOOKMARK = "bookmark";
|
||||||
public static final String BOOKMARKS = "bookmarks";
|
public static final String BOOLEAN = "Boolean";
|
||||||
public static final String BOOLEAN = "Boolean";
|
|
||||||
|
|
||||||
public static final String COMPANIES = "companies";
|
public static final String COMPANIES = "companies";
|
||||||
public static final String COMPANY = "company";
|
public static final String COMPANY = "company";
|
||||||
@@ -25,8 +24,6 @@ public class Text {
|
|||||||
|
|
||||||
public static final String EMAILS_FOR_RECEIVER = "emails for {email}";
|
public static final String EMAILS_FOR_RECEIVER = "emails for {email}";
|
||||||
|
|
||||||
public static final String FILES = "files";
|
|
||||||
|
|
||||||
public static final String INVALID_DB_CODE = "Encountered invalid dbCode: {code}";
|
public static final String INVALID_DB_CODE = "Encountered invalid dbCode: {code}";
|
||||||
public static final String ITEM = "item";
|
public static final String ITEM = "item";
|
||||||
public static final String ITEMS = "items";
|
public static final String ITEMS = "items";
|
||||||
@@ -37,16 +34,13 @@ public class Text {
|
|||||||
public static final String LONG = "Long";
|
public static final String LONG = "Long";
|
||||||
|
|
||||||
public static final String MESSAGE = "message";
|
public static final String MESSAGE = "message";
|
||||||
public static final String MESSAGES = "messages";
|
|
||||||
|
|
||||||
public static final String NOTE = "note";
|
public static final String NOTE = "note";
|
||||||
public static final String NOTES = "notes";
|
|
||||||
public static final String NOTE_WITH_ID = "note ({id})";
|
public static final String NOTE_WITH_ID = "note ({id})";
|
||||||
public static final String NUMBER = "number";
|
public static final String NUMBER = "number";
|
||||||
|
|
||||||
public static final String PATH = "path";
|
public static final String PATH = "path";
|
||||||
public static final String POLLS = "polls";
|
public static final String PROJECT = "project";
|
||||||
public static final String PROJECTS = "projects";
|
|
||||||
public static final String PROJECT_WITH_ID = "project ({id})";
|
public static final String PROJECT_WITH_ID = "project ({id})";
|
||||||
public static final String PROPERTIES = "properties";
|
public static final String PROPERTIES = "properties";
|
||||||
public static final String PROPERTY = "property";
|
public static final String PROPERTY = "property";
|
||||||
@@ -58,21 +52,18 @@ public class Text {
|
|||||||
public static final String SERVICE_WITH_ID = "service ({id})";
|
public static final String SERVICE_WITH_ID = "service ({id})";
|
||||||
public static final String SESSION = "session";
|
public static final String SESSION = "session";
|
||||||
public static final String SETTINGS = "settings";
|
public static final String SETTINGS = "settings";
|
||||||
public static final String STOCK = "stock";
|
|
||||||
public static final String STRING = "string";
|
public static final String STRING = "string";
|
||||||
|
|
||||||
public static final String TABLE_WITH_NAME = "table {name}";
|
public static final String TABLE_WITH_NAME = "table {name}";
|
||||||
public static final String TAGS = "tags";
|
public static final String TAGS = "tags";
|
||||||
public static final String TASK = "task";
|
public static final String TASK = "task";
|
||||||
public static final String TASKS = "tasks";
|
public static final String TASKS = "tasks";
|
||||||
public static final String TIMETRACKING = "timetracking";
|
|
||||||
public static final String TIME_WITH_ID = "time ({id})";
|
public static final String TIME_WITH_ID = "time ({id})";
|
||||||
public static final String TYPE = "type";
|
public static final String TYPE = "type";
|
||||||
|
|
||||||
public static final String UNIT = "unit";
|
public static final String UNIT = "unit";
|
||||||
public static final String USER_WITH_ID = "user ({id})";
|
public static final String USER_WITH_ID = "user ({id})";
|
||||||
|
|
||||||
public static final String WIKI = "wiki";
|
|
||||||
public static final String WIKI_PAGE = "wiki page";
|
public static final String WIKI_PAGE = "wiki page";
|
||||||
public static final String WIKI_PAGES = "wiki pages";
|
public static final String WIKI_PAGES = "wiki pages";
|
||||||
|
|
||||||
|
|||||||
@@ -228,19 +228,20 @@ public class Task implements Mappable {
|
|||||||
return tags;
|
return tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String,Object> toMap(boolean renderMarkdown){
|
@Override
|
||||||
|
public Map<String, Object> toMap() {
|
||||||
var map = new HashMap<String,Object>();
|
var map = new HashMap<String,Object>();
|
||||||
var memberMap = new HashMap<Long,Map<String,Object>>();
|
var memberMap = new HashMap<Long,Map<String,Object>>();
|
||||||
if (members != null) for (var entry : members.entrySet()){
|
if (members != null) for (var entry : members.entrySet()){
|
||||||
memberMap.put(entry.getKey(),entry.getValue().toMap());
|
memberMap.put(entry.getKey(),entry.getValue().toMap());
|
||||||
}
|
}
|
||||||
map.put(ID, id);
|
map.put(ID, id);
|
||||||
map.put(PROJECT_ID, projectId);
|
map.put(PROJECT_ID, projectId);
|
||||||
map.put(PARENT_TASK_ID, parentTaskId);
|
map.put(PARENT_TASK_ID, parentTaskId);
|
||||||
map.put(PRIORITY,priority);
|
map.put(PRIORITY,priority);
|
||||||
map.put(NAME, name);
|
map.put(NAME, name);
|
||||||
map.put(DESCRIPTION, renderMarkdown ? mapMarkdown(description) : Map.of(SOURCE,description));
|
map.put(DESCRIPTION, mapMarkdown(description));
|
||||||
map.put(STATUS, status);
|
map.put(STATUS, status);
|
||||||
map.put(EST_TIME, estimatedTime);
|
map.put(EST_TIME, estimatedTime);
|
||||||
map.put(START_DATE,start);
|
map.put(START_DATE,start);
|
||||||
map.put(DUE_DATE,dueDate);
|
map.put(DUE_DATE,dueDate);
|
||||||
@@ -253,11 +254,6 @@ public class Task implements Mappable {
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> toMap() {
|
|
||||||
return toMap(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private int totalPrio() {
|
private int totalPrio() {
|
||||||
if (status >= Status.COMPLETE.code()) return 0; // task is done, do no longer highlight
|
if (status >= Status.COMPLETE.code()) return 0; // task is done, do no longer highlight
|
||||||
int total = priority;
|
int total = priority;
|
||||||
|
|||||||
@@ -552,7 +552,7 @@ public class DocumentApi extends BaseHandler implements DocumentService {
|
|||||||
private boolean postToDocument(HttpExchange ex, de.srsoftware.tools.Path path, UmbrellaUser user, long docId) throws IOException, UmbrellaException {
|
private boolean postToDocument(HttpExchange ex, de.srsoftware.tools.Path path, UmbrellaUser user, long docId) throws IOException, UmbrellaException {
|
||||||
var head = path.pop();
|
var head = path.pop();
|
||||||
return switch (head){
|
return switch (head){
|
||||||
case Path.CLONE -> postCloneDoc(docId,ex,user);
|
case CLONE -> postCloneDoc(docId,ex,user);
|
||||||
case POSITION -> postDocumentPosition(docId,ex,user);
|
case POSITION -> postDocumentPosition(docId,ex,user);
|
||||||
case PATH_SEND -> sendDocument(ex,path,user,docId);
|
case PATH_SEND -> sendDocument(ex,path,user,docId);
|
||||||
case null, default -> super.doPost(path,ex);
|
case null, default -> super.doPost(path,ex);
|
||||||
|
|||||||
@@ -103,8 +103,7 @@
|
|||||||
<Route path="/search" component={Search} />
|
<Route path="/search" component={Search} />
|
||||||
<Route path="/stock" component={Stock} />
|
<Route path="/stock" component={Stock} />
|
||||||
<Route path="/stock/location/:location_id" component={Stock} />
|
<Route path="/stock/location/:location_id" component={Stock} />
|
||||||
<Route path="/stock/:item_id/view" component={Stock} />
|
<Route path="/stock/:owner/:owner_id/item/:item_id" component={Stock} />
|
||||||
<Route path="/stock/:owner/:owner_id/item/:owner_number" component={Stock} />
|
|
||||||
<Route path="/tags" component={TagList} />
|
<Route path="/tags" component={TagList} />
|
||||||
<Route path="/tags/use/:tag" component={TagUses} />
|
<Route path="/tags/use/:tag" component={TagUses} />
|
||||||
<Route path="/task" component={TaskList} />
|
<Route path="/task" component={TaskList} />
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
onclick = evt => {},
|
onclick = evt => {},
|
||||||
onSet = newVal => {return true;},
|
onSet = newVal => {return true;},
|
||||||
simple = false,
|
simple = false,
|
||||||
store_id = null,
|
|
||||||
type = 'div',
|
type = 'div',
|
||||||
value = $bindable({source:null,rendered:null})
|
value = $bindable({source:null,rendered:null})
|
||||||
} = $props();
|
} = $props();
|
||||||
@@ -16,7 +15,6 @@
|
|||||||
let editing = $state(false);
|
let editing = $state(false);
|
||||||
let editValue = $state({source:value.source,rendered:value.rendered});
|
let editValue = $state({source:value.source,rendered:value.rendered});
|
||||||
let start = 0;
|
let start = 0;
|
||||||
let stored_source = $state(store_id ? localStorage.getItem(store_id) : null);
|
|
||||||
let timer = null;
|
let timer = null;
|
||||||
|
|
||||||
async function applyEdit(){
|
async function applyEdit(){
|
||||||
@@ -29,7 +27,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function doSave(){
|
function doSave(){
|
||||||
if (store_id) localStorage.removeItem(store_id);
|
|
||||||
if (simple){
|
if (simple){
|
||||||
onSet(editValue.source);
|
onSet(editValue.source);
|
||||||
} else applyEdit();
|
} else applyEdit();
|
||||||
@@ -53,7 +50,6 @@
|
|||||||
body : editValue.source
|
body : editValue.source
|
||||||
});
|
});
|
||||||
editValue.rendered = await resp.text();
|
editValue.rendered = await resp.text();
|
||||||
if (store_id) localStorage.setItem(store_id,editValue.source);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function typed(ev){
|
function typed(ev){
|
||||||
@@ -104,37 +100,13 @@
|
|||||||
measured(evt, evt.timeStamp - start);
|
measured(evt, evt.timeStamp - start);
|
||||||
}
|
}
|
||||||
|
|
||||||
function restore(ev){
|
|
||||||
editValue.source = stored_source;
|
|
||||||
stored_source = null;
|
|
||||||
render();
|
|
||||||
}
|
|
||||||
|
|
||||||
activeField.subscribe((val) => resetEdit());
|
activeField.subscribe((val) => resetEdit());
|
||||||
if (simple) startEdit();
|
if (simple) startEdit();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
|
||||||
.markdown{
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
#restore_markdown{
|
|
||||||
position: absolute;
|
|
||||||
right: 50%;
|
|
||||||
top: -10px;
|
|
||||||
background: orange;
|
|
||||||
color: black;
|
|
||||||
padding: 5px;
|
|
||||||
border-radius: 5px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<div class="markdown {editing?'editing':''}">
|
<div class="markdown {editing?'editing':''}">
|
||||||
{#if editing}
|
{#if editing}
|
||||||
<span class="hint">{@html t('markdown_supported')}</span>
|
<span class="hint">{@html t('markdown_supported')}</span>
|
||||||
{#if stored_source}
|
|
||||||
<span id="restore_markdown" onclick={restore} class="hint">{t('unsaved_content')}</span>
|
|
||||||
{/if}
|
|
||||||
<textarea bind:value={editValue.source} onkeyup={typed} autofocus={!simple}></textarea>
|
<textarea bind:value={editValue.source} onkeyup={typed} autofocus={!simple}></textarea>
|
||||||
<div class="preview">{@html target(editValue.rendered)}</div>
|
<div class="preview">{@html target(editValue.rendered)}</div>
|
||||||
{#if !simple}
|
{#if !simple}
|
||||||
@@ -146,4 +118,4 @@
|
|||||||
{:else}
|
{:else}
|
||||||
<svelte:element this={type} {onclick} {oncontextmenu} class={{editable}} title={t('right_click_to_edit')} >{@html target(value.rendered)}</svelte:element>
|
<svelte:element this={type} {onclick} {oncontextmenu} class={{editable}} title={t('right_click_to_edit')} >{@html target(value.rendered)}</svelte:element>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
@@ -2,25 +2,27 @@
|
|||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { useTinyRouter } from 'svelte-tiny-router';
|
import { useTinyRouter } from 'svelte-tiny-router';
|
||||||
|
|
||||||
import { api, get } from '../urls.svelte';
|
import { logout, user } from '../user.svelte.js';
|
||||||
import { error } from '../warn.svelte';
|
import { t } from '../translations.svelte.js';
|
||||||
import { logout, user } from '../user.svelte';
|
|
||||||
import { t } from '../translations.svelte';
|
|
||||||
|
|
||||||
import TimeRecorder from './TimeRecorder.svelte';
|
import TimeRecorder from './TimeRecorder.svelte';
|
||||||
|
|
||||||
let key = $state(null);
|
let key = $state(null);
|
||||||
const router = useTinyRouter();
|
const router = useTinyRouter();
|
||||||
let modules = $state(null);
|
const modules = $state([]);
|
||||||
let expand = $state(false);
|
let expand = $state(false);
|
||||||
|
|
||||||
async function fetchModules(){
|
async function fetchModules(){
|
||||||
let url = api('settings/menu');
|
const url = `${location.protocol}//${location.host.replace('5173','8080')}/legacy/user/modules`;
|
||||||
const res = await get(url);
|
const resp = await fetch(url,{credentials:'include'});
|
||||||
if (res.ok){
|
if (resp.ok){
|
||||||
modules = await res.json();
|
const arr = await resp.json();
|
||||||
|
for (let entry of arr) {
|
||||||
|
let name = t('module.'+entry.module);
|
||||||
|
if (name) modules.push({name:name,url:entry.url});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
error(res);
|
console.log('error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,11 +30,7 @@ function onclick(e){
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
expand = false;
|
expand = false;
|
||||||
let href = e.target.getAttribute('href');
|
let href = e.target.getAttribute('href');
|
||||||
if (href) {
|
if (href) router.navigate(href);
|
||||||
if (href.includes('://')) {
|
|
||||||
window.location.href = href;
|
|
||||||
} else router.navigate(href);
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,13 +55,27 @@ onMount(fetchModules);
|
|||||||
<input type="text" bind:value={key} />
|
<input type="text" bind:value={key} />
|
||||||
<button type="submit">{t('search')}</button>
|
<button type="submit">{t('search')}</button>
|
||||||
</form>
|
</form>
|
||||||
<button class="symbol" onclick={e => expand = !expand}> </button>
|
<button class="symbol" onclick={e => expand = !expand}></button>
|
||||||
{#each modules as module,i}
|
<a href="/user" {onclick} class="user">{t('users')}</a>
|
||||||
<a href={module.module.includes('://') ? module.module : '/'+module.module} {onclick} class={module.class}>{@html t(module.title)}</a>
|
<a href="/company" {onclick} class="company">{t('companies')}</a>
|
||||||
{/each}
|
<a href="/project" {onclick} class="project">{t('projects')}</a>
|
||||||
|
<a href="/task" {onclick} class="task">{t('tasks')}</a>
|
||||||
|
<a href="/tags" {onclick} class="tags">{t('tags')}</a>
|
||||||
|
<a href="/document" {onclick} class="doc">{t('documents')}</a>
|
||||||
|
<a href="/bookmark" {onclick} class="mark">{t('bookmarks')}</a>
|
||||||
|
<a href="/notes" {onclick} class="note">{t('notes')}</a>
|
||||||
|
<a href="/files" {onclick} class="file">{t('files')}</a>
|
||||||
|
<a href="/time" {onclick} class="time">{t('timetracking')}</a>
|
||||||
|
<a href="/wiki" {onclick} class="wiki">{t('wiki')}</a>
|
||||||
|
<a href="/contact" {onclick} class="contact">{t('contacts')}</a>
|
||||||
|
<a href="/stock" {onclick} class="stock">{t('stock')}</a>
|
||||||
|
<a href="/message" {onclick} class="message">{t('messages')}</a>
|
||||||
{#if user.id == 2}
|
{#if user.id == 2}
|
||||||
<a href="https://svelte.dev/tutorial/svelte/state" target="_blank">{t('tutorial')}</a>
|
<a href="https://svelte.dev/tutorial/svelte/state" target="_blank">{t('tutorial')}</a>
|
||||||
{/if}
|
{/if}
|
||||||
|
{#each modules as module,i}
|
||||||
|
{#if module.name.trim()}<a href={module.url}>{module.name}</a>{/if}
|
||||||
|
{/each}
|
||||||
{#if user.name }
|
{#if user.name }
|
||||||
<a class="logout" onclick={logout}>{t('logout_user',{user:user.name})}</a>
|
<a class="logout" onclick={logout}>{t('logout_user',{user:user.name})}</a>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -62,7 +62,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{@html t('messages')} <button onclick={showSettings}>{t('settings')}</button></legend>
|
<legend>{t('messages')} <button onclick={showSettings}>{t('settings')}</button></legend>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import { onDestroy, onMount } from 'svelte';
|
import { onDestroy, onMount } from 'svelte';
|
||||||
import { useTinyRouter } from 'svelte-tiny-router';
|
import { useTinyRouter } from 'svelte-tiny-router';
|
||||||
|
|
||||||
import { api, patch, post, eventStream, target } from '../../urls.svelte.js';
|
import { api, eventStream, target } from '../../urls.svelte.js';
|
||||||
import { error, messages, yikes } from '../../warn.svelte';
|
import { error, messages, yikes } from '../../warn.svelte';
|
||||||
import { t } from '../../translations.svelte.js';
|
import { t } from '../../translations.svelte.js';
|
||||||
import { user } from '../../user.svelte.js';
|
import { user } from '../../user.svelte.js';
|
||||||
@@ -10,7 +10,6 @@
|
|||||||
import Card from './KanbanCard.svelte';
|
import Card from './KanbanCard.svelte';
|
||||||
import LineEditor from '../../Components/LineEditor.svelte';
|
import LineEditor from '../../Components/LineEditor.svelte';
|
||||||
import MarkdownEditor from '../../Components/MarkdownEditor.svelte';
|
import MarkdownEditor from '../../Components/MarkdownEditor.svelte';
|
||||||
import TaskForm from '../task/Add.svelte';
|
|
||||||
|
|
||||||
let eventSource = null;
|
let eventSource = null;
|
||||||
let connectionStatus = 'disconnected';
|
let connectionStatus = 'disconnected';
|
||||||
@@ -27,7 +26,7 @@
|
|||||||
let users = [];
|
let users = [];
|
||||||
let columns = $derived(project.allowed_states?Object.keys(project.allowed_states).length+1:1);
|
let columns = $derived(project.allowed_states?Object.keys(project.allowed_states).length+1:1);
|
||||||
let info = $state(null);
|
let info = $state(null);
|
||||||
let task_form = $state(false);
|
|
||||||
let stateList = {};
|
let stateList = {};
|
||||||
$effect(() => updateUrl(filter_input));
|
$effect(() => updateUrl(filter_input));
|
||||||
|
|
||||||
@@ -46,7 +45,11 @@
|
|||||||
}
|
}
|
||||||
task.members[user_id] = { permission: { name : 'ASSIGNEE' }};
|
task.members[user_id] = { permission: { name : 'ASSIGNEE' }};
|
||||||
task.members[user.id] = { permission: { name : 'OWNER' }};
|
task.members[user.id] = { permission: { name : 'OWNER' }};
|
||||||
const resp = await post(url,task);
|
const resp = await fetch(url,{
|
||||||
|
credentials : 'include',
|
||||||
|
method : 'POST',
|
||||||
|
body : JSON.stringify(task)
|
||||||
|
});
|
||||||
if (resp.ok) {
|
if (resp.ok) {
|
||||||
task = await resp.json();
|
task = await resp.json();
|
||||||
task.assignee = user_id;
|
task.assignee = user_id;
|
||||||
@@ -65,7 +68,11 @@
|
|||||||
ex.preventDefault();
|
ex.preventDefault();
|
||||||
var task = dragged;
|
var task = dragged;
|
||||||
const url = api(`task/${task.id}`);
|
const url = api(`task/${task.id}`);
|
||||||
const resp = await patch(url,{no_index:true});
|
const resp = await fetch(url,{
|
||||||
|
credentials : 'include',
|
||||||
|
method : 'PATCH',
|
||||||
|
body : JSON.stringify({no_index:true})
|
||||||
|
});
|
||||||
delete highlight.archive;
|
delete highlight.archive;
|
||||||
if (resp.ok){
|
if (resp.ok){
|
||||||
yikes();
|
yikes();
|
||||||
@@ -81,10 +88,14 @@
|
|||||||
highlight = {};
|
highlight = {};
|
||||||
|
|
||||||
if (task.assignee == user_id && task.status == state) return; // no change
|
if (task.assignee == user_id && task.status == state) return; // no change
|
||||||
let data = {members:{},status:+state}
|
let patch = {members:{},status:+state}
|
||||||
data.members[user_id] = 'ASSIGNEE';
|
patch.members[user_id] = 'ASSIGNEE';
|
||||||
const url = api(`task/${task.id}`);
|
const url = api(`task/${task.id}`);
|
||||||
const resp = await patch(url,data);
|
const resp = await fetch(url,{
|
||||||
|
credentials : 'include',
|
||||||
|
method : 'PATCH',
|
||||||
|
body : JSON.stringify(patch)
|
||||||
|
});
|
||||||
if (resp.ok){
|
if (resp.ok){
|
||||||
yikes();
|
yikes();
|
||||||
} else {
|
} else {
|
||||||
@@ -109,9 +120,7 @@
|
|||||||
if (method != 'delete') processTask(json.task);
|
if (method != 'delete') processTask(json.task);
|
||||||
|
|
||||||
// show notification
|
// show notification
|
||||||
if (json.user.id == user.id) {
|
if (json.user.id != user.id) {
|
||||||
if (method == 'create') task_form = false; // task has been created by current user
|
|
||||||
} else {
|
|
||||||
let term = "user_updated_entity";
|
let term = "user_updated_entity";
|
||||||
if (method == 'create') term = "user_created_entity";
|
if (method == 'create') term = "user_created_entity";
|
||||||
if (method == 'delete') term = "user_deleted_entity";
|
if (method == 'delete') term = "user_deleted_entity";
|
||||||
@@ -178,8 +187,11 @@
|
|||||||
const url = api('task/list');
|
const url = api('task/list');
|
||||||
selector.show_closed = true;
|
selector.show_closed = true;
|
||||||
selector.no_index = true;
|
selector.no_index = true;
|
||||||
selector.rendered = false;
|
var resp = await fetch(url,{
|
||||||
var resp = await post(url,selector);
|
credentials :'include',
|
||||||
|
method : 'POST',
|
||||||
|
body : JSON.stringify(selector)
|
||||||
|
});
|
||||||
if (resp.ok){
|
if (resp.ok){
|
||||||
var json = await resp.json();
|
var json = await resp.json();
|
||||||
for (var task_id of Object.keys(json)) {
|
for (var task_id of Object.keys(json)) {
|
||||||
@@ -224,7 +236,11 @@
|
|||||||
share : user_ids
|
share : user_ids
|
||||||
}
|
}
|
||||||
const url = api('bookmark');
|
const url = api('bookmark');
|
||||||
const resp = await post(url,data);
|
const resp = await fetch(url,{
|
||||||
|
credentials : 'include',
|
||||||
|
method : 'POST',
|
||||||
|
body : JSON.stringify(data)
|
||||||
|
});
|
||||||
if (resp.ok) {
|
if (resp.ok) {
|
||||||
yikes();
|
yikes();
|
||||||
router.navigate('/bookmark');
|
router.navigate('/bookmark');
|
||||||
@@ -233,9 +249,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_task_form(project_id,assignee,state_id){
|
|
||||||
task_form = {project_id,assignee,state_id};
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateUrl(){
|
function updateUrl(){
|
||||||
let url = window.location.origin + window.location.pathname;
|
let url = window.location.origin + window.location.pathname;
|
||||||
@@ -254,12 +267,6 @@
|
|||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
{#if project}
|
{#if project}
|
||||||
{#if task_form}
|
|
||||||
<div class="overlay">
|
|
||||||
<TaskForm assignee={task_form.assignee} on_abort={ev => {task_form = false;}} project_id={task_form.project_id} state_id={task_form.state_id} />
|
|
||||||
</div>
|
|
||||||
{/if} <!-- task form -->
|
|
||||||
|
|
||||||
<h1 onclick={ev => router.navigate(`/project/${project.id}/view`)}>{project.name}</h1>
|
<h1 onclick={ev => router.navigate(`/project/${project.id}/view`)}>{project.name}</h1>
|
||||||
{/if}
|
{/if}
|
||||||
{#if info}
|
{#if info}
|
||||||
@@ -293,8 +300,8 @@
|
|||||||
<Card onclick={e => openTask(task.id)} ondragstart={ev => dragged=task} {task} tag_colors={project.tag_colors} />
|
<Card onclick={e => openTask(task.id)} ondragstart={ev => dragged=task} {task} tag_colors={project.tag_colors} />
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
<div class="add_task" onclick={ev => show_task_form(project.id,u.id,+state)}>
|
<div class="add_task">
|
||||||
{t('add_object',{object:t('task')})}
|
<LineEditor value={t('add_object',{object:t('task')})} editable={true} onSet={(name) => create(name,u.id,state)}/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
@@ -303,4 +310,4 @@
|
|||||||
<div class="archive {highlight.archive?'hover':''}" ondragover={hover_archive} ondragleave={e => delete highlight.archive} ondrop={do_archive} >
|
<div class="archive {highlight.archive?'hover':''}" ondragover={hover_archive} ondragleave={e => delete highlight.archive} ondrop={do_archive} >
|
||||||
{t('hide')}
|
{t('hide')}
|
||||||
</div>
|
</div>
|
||||||
{/if} <!-- project -->
|
{/if}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { useTinyRouter } from 'svelte-tiny-router';
|
|
||||||
import { api, drop, get, patch } from '../../urls.svelte';
|
import { api, drop, get, patch } from '../../urls.svelte';
|
||||||
import { error, yikes } from '../../warn.svelte';
|
import { error, yikes } from '../../warn.svelte';
|
||||||
import { t } from '../../translations.svelte';
|
import { t } from '../../translations.svelte';
|
||||||
@@ -18,9 +17,8 @@
|
|||||||
let location = $state(null);
|
let location = $state(null);
|
||||||
let draggedItem = $state(null)
|
let draggedItem = $state(null)
|
||||||
let draggedLocation = $state(null)
|
let draggedLocation = $state(null)
|
||||||
let { item_id, location_id, owner, owner_id, owner_number } = $props();
|
let { item_id, location_id, owner, owner_id } = $props();
|
||||||
let skip_location = false; // disable effect on setting location within loadItem()
|
let skip_location = false; // disable effect on setting location within loadItem()
|
||||||
let router = useTinyRouter();
|
|
||||||
|
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
// This effect runs whenever `location` changes
|
// This effect runs whenever `location` changes
|
||||||
@@ -100,8 +98,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function loadItem(){
|
async function loadItem(){
|
||||||
if (!owner_number) return;
|
if (!item_id) return;
|
||||||
const url = api(`stock/${owner}/${owner_id}/item/${owner_number}`);
|
const url = api(`stock/${owner}/${owner_id}/item/${item_id}`);
|
||||||
const res = await get(url);
|
const res = await get(url);
|
||||||
if (res.ok){
|
if (res.ok){
|
||||||
yikes();
|
yikes();
|
||||||
@@ -118,7 +116,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (let i of json.items){
|
for (let i of json.items){
|
||||||
if (i.owner_number == +owner_number) item = i;
|
if (i.owner_number == +item_id) item = i;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
error(res);
|
error(res);
|
||||||
@@ -172,27 +170,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function load(){
|
async function load(){
|
||||||
await preload();
|
|
||||||
await loadUserLocations();
|
await loadUserLocations();
|
||||||
await loadPath();
|
await loadPath();
|
||||||
await loadProperties();
|
await loadProperties();
|
||||||
await loadItem();
|
await loadItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function preload(){
|
|
||||||
if (item_id) {
|
|
||||||
let url = api(`stock/item/${item_id}`);
|
|
||||||
const res = await get(url);
|
|
||||||
if (res.ok){
|
|
||||||
const json = await res.json();
|
|
||||||
owner = json.owner.type;
|
|
||||||
owner_id = json.owner.id;
|
|
||||||
owner_number = json.owner_number;
|
|
||||||
location_id = json.location.id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function moveToTop(loc){
|
function moveToTop(loc){
|
||||||
if (patchLocation(location,'parent_location_id',0)){
|
if (patchLocation(location,'parent_location_id',0)){
|
||||||
loc.parent_location_id = 0;
|
loc.parent_location_id = 0;
|
||||||
|
|||||||
@@ -1,39 +1,11 @@
|
|||||||
<script>
|
<script>
|
||||||
import { onDestroy, onMount } from 'svelte';
|
import { api, post } from '../../urls.svelte';
|
||||||
import { api, eventStream, post } from '../../urls.svelte';
|
|
||||||
import { error, yikes } from '../../warn.svelte';
|
import { error, yikes } from '../../warn.svelte';
|
||||||
import { t } from '../../translations.svelte';
|
import { t } from '../../translations.svelte';
|
||||||
|
|
||||||
let { items, selected = $bindable(null), location = null, drag_start = item => console.log({dragging:item}) } = $props();
|
let { items, selected = $bindable(null), location = null, drag_start = item => console.log({dragging:item}) } = $props();
|
||||||
let eventSource = null;
|
|
||||||
let newItem = $state({name:null, code: null});
|
let newItem = $state({name:null, code: null});
|
||||||
|
|
||||||
function handleCreateEvent(evt){
|
|
||||||
let json = JSON.parse(evt.data);
|
|
||||||
if (json.item.location.id == location.id){
|
|
||||||
items = [...items,json.item];
|
|
||||||
selected = json.item;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleEvent(evt,method){
|
|
||||||
console.log(evt,method);
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleDeleteEvent(evt){
|
|
||||||
handleEvent(evt,'delete');
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleUpdateEvent(evt){
|
|
||||||
handleEvent(evt,'update');
|
|
||||||
}
|
|
||||||
|
|
||||||
function load(){
|
|
||||||
try {
|
|
||||||
eventSource = eventStream(handleCreateEvent,handleUpdateEvent,handleDeleteEvent);
|
|
||||||
} catch (ignored) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function saveNewItem(){
|
async function saveNewItem(){
|
||||||
newItem.location = location;
|
newItem.location = location;
|
||||||
const url = api('stock/item');
|
const url = api('stock/item');
|
||||||
@@ -45,12 +17,6 @@
|
|||||||
items = [...items, it];
|
items = [...items, it];
|
||||||
} else error(res);
|
} else error(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
onDestroy(() => {
|
|
||||||
if (eventSource) eventSource.close();
|
|
||||||
});
|
|
||||||
onMount(load);
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import LineEditor from '../../Components/LineEditor.svelte';
|
import LineEditor from '../../Components/LineEditor.svelte';
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { api, patch, post } from '../../urls.svelte';
|
import { api } from '../../urls.svelte';
|
||||||
import { error, yikes } from '../../warn.svelte';
|
import { error, yikes } from '../../warn.svelte';
|
||||||
import { t } from '../../translations.svelte';
|
import { t } from '../../translations.svelte';
|
||||||
|
|
||||||
@@ -15,15 +15,6 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
async function doClone(ev){
|
|
||||||
let url = api('stock/clone');
|
|
||||||
let res = await post(url,{id:item.id});
|
|
||||||
if (res.ok){
|
|
||||||
let json = await res.json();
|
|
||||||
yikes(res);
|
|
||||||
} else error(res);
|
|
||||||
}
|
|
||||||
|
|
||||||
function byName(a,b){
|
function byName(a,b){
|
||||||
return a.name.localeCompare(b.name);
|
return a.name.localeCompare(b.name);
|
||||||
}
|
}
|
||||||
@@ -39,7 +30,11 @@
|
|||||||
},
|
},
|
||||||
add_prop : add_prop
|
add_prop : add_prop
|
||||||
}
|
}
|
||||||
const res = await post(url,data);
|
const res = await fetch(url,{
|
||||||
|
credentials:'include',
|
||||||
|
method:'POST',
|
||||||
|
body:JSON.stringify(data)
|
||||||
|
});
|
||||||
if (res.ok){
|
if (res.ok){
|
||||||
const prop = await res.json();
|
const prop = await res.json();
|
||||||
const id = prop.id;
|
const id = prop.id;
|
||||||
@@ -50,14 +45,18 @@
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function update(key,newVal){
|
async function patch(key,newVal){
|
||||||
const url = api('stock');
|
const url = api('stock');
|
||||||
const data = {
|
const data = {
|
||||||
id : item.id,
|
id : item.id,
|
||||||
owner : item.owner,
|
owner : item.owner,
|
||||||
};
|
};
|
||||||
data[key] = newVal;
|
data[key] = newVal;
|
||||||
const res = await patch(url,data);
|
const res = await fetch(url,{
|
||||||
|
credentials:'include',
|
||||||
|
method:'PATCH',
|
||||||
|
body:JSON.stringify(data)
|
||||||
|
});
|
||||||
if (res.ok){
|
if (res.ok){
|
||||||
yikes();
|
yikes();
|
||||||
return true;
|
return true;
|
||||||
@@ -68,23 +67,13 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if item}
|
{#if item}
|
||||||
<LineEditor type="h3" editable={true} value={item.name} onSet={v => update('name',v)} />
|
<LineEditor type="h3" editable={true} value={item.name} onSet={v => patch('name',v)} />
|
||||||
<button class="clone symbol" title={t('clone')} onclick={doClone}></button>
|
Code: <LineEditor type="span" editable={true} value={item.code} onSet={v => patch('code',v)} />
|
||||||
<div>
|
<div>
|
||||||
{@html item.description.rendered}
|
{@html item.description.rendered}
|
||||||
</div>
|
</div>
|
||||||
<table>
|
<table>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
|
||||||
<td>{t('ID')}</td>
|
|
||||||
<td>{item.id}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>{t('Code')}:</td>
|
|
||||||
<td>
|
|
||||||
<LineEditor type="span" editable={true} value={item.code} onSet={v => update('code',v)} />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{#each item.properties.toSorted(byName) as prop}
|
{#each item.properties.toSorted(byName) as prop}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
+138
-101
@@ -2,7 +2,7 @@
|
|||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { useTinyRouter } from 'svelte-tiny-router';
|
import { useTinyRouter } from 'svelte-tiny-router';
|
||||||
|
|
||||||
import { api, get } from '../../urls.svelte.js';
|
import { api } from '../../urls.svelte.js';
|
||||||
import { error, yikes } from '../../warn.svelte';
|
import { error, yikes } from '../../warn.svelte';
|
||||||
import { t } from '../../translations.svelte.js';
|
import { t } from '../../translations.svelte.js';
|
||||||
import { user } from '../../user.svelte.js';
|
import { user } from '../../user.svelte.js';
|
||||||
@@ -11,16 +11,15 @@
|
|||||||
import PermissionEditor from '../../Components/PermissionEditor.svelte';
|
import PermissionEditor from '../../Components/PermissionEditor.svelte';
|
||||||
import Tags from '../tags/TagList.svelte';
|
import Tags from '../tags/TagList.svelte';
|
||||||
|
|
||||||
let { assignee = null, on_abort = null, project_id = null, parent_task_id = null, state_id = null } = $props();
|
let { project_id = null, parent_task_id } = $props();
|
||||||
let project = $state(null);
|
let project = $state(null);
|
||||||
let extendedSettings = $state(false);
|
let extendedSettings = $state(false);
|
||||||
let parent_task = $state(null);
|
let parent_task = $state(null);
|
||||||
let task = $state({
|
let task = $state({
|
||||||
name : '',
|
name : '',
|
||||||
description : { source:'',rendered:''},
|
description : { source : '', rendered : '' },
|
||||||
due_date : null,
|
due_date : null,
|
||||||
est_time : null,
|
est_time : null,
|
||||||
members : {},
|
|
||||||
no_index : false,
|
no_index : false,
|
||||||
show_closed : false,
|
show_closed : false,
|
||||||
start_date : null,
|
start_date : null,
|
||||||
@@ -42,43 +41,32 @@
|
|||||||
/// TODO: ?
|
/// TODO: ?
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getCandidates(text){
|
|
||||||
const origin = parent_task ? parent_task.members : project.members;
|
|
||||||
const candidates = Object.values(origin)
|
|
||||||
.filter(member => member.user.name.toLowerCase().includes(text.toLowerCase()))
|
|
||||||
.map(member => [member.user.id,member.user.name]);
|
|
||||||
return Object.fromEntries(candidates);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function load(){
|
async function load(){
|
||||||
if (parent_task_id) await loadParent();
|
if (parent_task_id) await loadParent();
|
||||||
if (project_id) loadProject();
|
if (project_id) loadProject();
|
||||||
if (state_id) task.status = { code : +state_id };
|
|
||||||
loadTags();
|
loadTags();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadParent(){
|
async function loadParent(){
|
||||||
const url = api(`task/${parent_task_id}`);
|
const url = api(`task/${parent_task_id}`);
|
||||||
const resp = await get(url);
|
const resp = await fetch(url,{credentials:'include'});
|
||||||
if (resp.ok){
|
if (resp.ok){
|
||||||
parent_task = await resp.json();
|
parent_task = await resp.json();
|
||||||
task.parent_task_id = +parent_task_id;
|
task.parent_task_id = +parent_task_id;
|
||||||
project_id = +parent_task.project_id;
|
project_id = parent_task.project_id;
|
||||||
yikes();
|
yikes();
|
||||||
project = null; // TODO
|
project = null; // TODO
|
||||||
} else error(resp);
|
} else {
|
||||||
|
error(resp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadProject(){
|
async function loadProject(){
|
||||||
const url = api(`project/${project_id}`);
|
const url = api(`project/${project_id}`);
|
||||||
const resp = await get(url);
|
const resp = await fetch(url,{credentials:'include'});
|
||||||
if (resp.ok){
|
if (resp.ok){
|
||||||
project = await resp.json();
|
project = await resp.json();
|
||||||
task.project_id = +project_id;
|
task.project_id = +project_id;
|
||||||
if (assignee && project.members[assignee]){
|
|
||||||
task.members[assignee] = project.members[assignee];
|
|
||||||
task.members[assignee].permission = { name : "ASSIGNEE", code : 3 }
|
|
||||||
}
|
|
||||||
yikes();
|
yikes();
|
||||||
} else {
|
} else {
|
||||||
error(resp);
|
error(resp);
|
||||||
@@ -90,12 +78,21 @@
|
|||||||
if (project_id) url = api(`tags/project/${project_id}`);
|
if (project_id) url = api(`tags/project/${project_id}`);
|
||||||
if (parent_task_id) url = api(`tags/task/${parent_task_id}`);
|
if (parent_task_id) url = api(`tags/task/${parent_task_id}`);
|
||||||
if (url) {
|
if (url) {
|
||||||
const resp = await get(url);
|
const resp = await fetch(url,{credentials:'include'});
|
||||||
if (resp.ok) task.tags = await resp.json();
|
if (resp.ok) task.tags = await resp.json();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onkeydown(e){
|
async function getCandidates(text){
|
||||||
|
const origin = parent_task ? parent_task.members : project.members;
|
||||||
|
const candidates = Object.values(origin)
|
||||||
|
.filter(member => member.user.name.toLowerCase().includes(text.toLowerCase()))
|
||||||
|
.map(member => [member.user.id,member.user.name]);
|
||||||
|
return Object.fromEntries(candidates);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function onkeydown(e){
|
||||||
if (e.ctrlKey && e.keyCode === 83) {
|
if (e.ctrlKey && e.keyCode === 83) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
saveTask();
|
saveTask();
|
||||||
@@ -110,13 +107,10 @@
|
|||||||
body : JSON.stringify(task)
|
body : JSON.stringify(task)
|
||||||
});
|
});
|
||||||
if (resp.ok) {
|
if (resp.ok) {
|
||||||
localStorage.removeItem(`task/${task.id}/description`);
|
task = await resp.json();
|
||||||
if (!assignee) { // if assignee is set, this form was opened within an external context. hence we don`t want to navigate somewhere else!
|
if (task.parent_task_id){
|
||||||
task = await resp.json();
|
router.navigate(`/task/${task.parent_task_id}/view`);
|
||||||
if (task.parent_task_id){
|
} else router.navigate(`/task/${task.id}/view`);
|
||||||
router.navigate(`/task/${task.parent_task_id}/view`);
|
|
||||||
} else router.navigate(`/task/${task.id}/view`);
|
|
||||||
}
|
|
||||||
yikes();
|
yikes();
|
||||||
} else {
|
} else {
|
||||||
error(resp);
|
error(resp);
|
||||||
@@ -136,76 +130,119 @@
|
|||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{t('add_object',{object:t('task')})}</legend>
|
<legend>{t('add_object',{object:t('task')})}</legend>
|
||||||
<div class="task grid2">
|
<table {onkeydown}>
|
||||||
<div>{t('name')}</div>
|
<tbody>
|
||||||
<div>
|
<tr>
|
||||||
<input bind:value={task.name} autofocus>
|
<th>
|
||||||
</div>
|
{t('name')}
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
<input bind:value={task.name} autofocus>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{#if project}
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
{t('project')}
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
{project.name}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/if}
|
||||||
|
{#if parent_task}
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
{t('parent_task')}
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
{parent_task.name}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/if}
|
||||||
|
|
||||||
{#if project}
|
<tr>
|
||||||
<div>{t('project')}</div>
|
<th>
|
||||||
<a href="/project/{project.id}/view">{project.name}</a>
|
{t('description')}
|
||||||
{/if}
|
</th>
|
||||||
|
<td>
|
||||||
{#if parent_task}
|
<MarkdownEditor bind:value={task.description} simple={true} />
|
||||||
<div>{t('parent_task')}</div>
|
</td>
|
||||||
<div>{parent_task.name}</div>
|
</tr>
|
||||||
{/if}
|
<tr>
|
||||||
|
<th>
|
||||||
<div>{t('description')}</div>
|
{t('tags')}
|
||||||
<div>
|
</th>
|
||||||
<MarkdownEditor bind:value={task.description} simple={true} store_id="task/add_to/{project_id}"/>
|
<td>
|
||||||
</div>
|
<Tags module="task" bind:tags={task.tags} />
|
||||||
<div>{t('tags')}</div>
|
</td>
|
||||||
<div>
|
</tr>
|
||||||
<Tags module="task" bind:tags={task.tags} />
|
{#if extendedSettings}
|
||||||
</div>
|
<tr>
|
||||||
|
<th>
|
||||||
{#if extendedSettings}
|
{t('members')}
|
||||||
<div>{t('members')}</div>
|
</th>
|
||||||
<div>
|
<td>
|
||||||
<PermissionEditor members={task.members} {addMember} {dropMember} {getCandidates} />
|
<PermissionEditor members={task.members} {addMember} {getCandidates} {dropMember} />
|
||||||
</div>
|
</td>
|
||||||
|
</tr>
|
||||||
<div>{t('estimated_time')}</div>
|
<tr>
|
||||||
<div>
|
<th>
|
||||||
<input type="number" bind:value={task.est_time} /> {t('hours')}
|
{t('estimated_time')}
|
||||||
</div>
|
</th>
|
||||||
|
<td>
|
||||||
<div>{t('start_date')}</div>
|
<input type="number" bind:value={task.est_time} /> {t('hours')}
|
||||||
<div>
|
</td>
|
||||||
<input type="date" bind:value={task.start_date} />
|
</tr>
|
||||||
</div>
|
<tr>
|
||||||
|
<th>
|
||||||
<div>{t('due_date')}</div>
|
{t('start_date')}
|
||||||
<div>
|
</th>
|
||||||
<input type="date" bind:value={task.due_date} />
|
<td>
|
||||||
</div>
|
<input type="date" bind:value={task.start_date} />
|
||||||
|
</td>
|
||||||
<div>{t('subtasks')}</div>
|
</tr>
|
||||||
<div>
|
<tr>
|
||||||
<label>
|
<th>
|
||||||
<input type="checkbox" bind:checked={task.show_closed} >
|
{t('due_date')}
|
||||||
{t('display_closed_tasks')}
|
</th>
|
||||||
</label>
|
<td>
|
||||||
</div>
|
<input type="date" bind:value={task.due_date} />
|
||||||
|
</td>
|
||||||
<div>
|
</tr>
|
||||||
{t('index_page')}
|
<tr>
|
||||||
</div>
|
<th>
|
||||||
<label>
|
{t('subtasks')}
|
||||||
<input type="checkbox" bind:checked={task.no_index} >
|
</th>
|
||||||
{t('hide_on_index_page')}
|
<td>
|
||||||
</label>
|
<label>
|
||||||
{:else}
|
<input type="checkbox" bind:checked={task.show_closed} >
|
||||||
<div>{t('extended_settings')}</div>
|
{t('display_closed_tasks')}
|
||||||
<div>
|
</label>
|
||||||
<button onclick={toggleSettings}>{t('show')}</button>
|
</td>
|
||||||
</div>
|
</tr>
|
||||||
{/if}
|
<tr>
|
||||||
</div>
|
<th>
|
||||||
|
{t('index_page')}
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" bind:checked={task.no_index} >
|
||||||
|
{t('hide_on_index_page')}
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{:else}
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
{t('extended_settings')}
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
<button onclick={toggleSettings}>{t('show')}</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/if}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
<button onclick={saveTask}>{t('save_object',{object:t('task')})}</button>
|
<button onclick={saveTask}>{t('save_object',{object:t('task')})}</button>
|
||||||
{#if on_abort}
|
</fieldset>
|
||||||
<button onclick={on_abort}>{t('abort')}</button>
|
|
||||||
{/if}
|
|
||||||
</fieldset>
|
|
||||||
@@ -88,8 +88,8 @@
|
|||||||
function onclick(evt) {
|
function onclick(evt) {
|
||||||
ignore(evt);
|
ignore(evt);
|
||||||
let task = getTask(evt);
|
let task = getTask(evt);
|
||||||
if (task.status <= 20) { // open
|
if (task.status == 20) { // open
|
||||||
update(task,60);
|
update(task,10);
|
||||||
} else update(task,20);
|
} else update(task,20);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -153,7 +153,7 @@
|
|||||||
<legend>{t('state_complete')}</legend>
|
<legend>{t('state_complete')}</legend>
|
||||||
{#if sorted}
|
{#if sorted}
|
||||||
{#each sorted as task}
|
{#each sorted as task}
|
||||||
{#if task.status > 20 && match(task)}
|
{#if task.status < 20 && match(task)}
|
||||||
<div href={`/task/${task.id}/view`} title={task.description.source} task_id={task.id} {onclick} {oncontextmenu} {ontouchstart} {ontouchend} onmousedown={ontouchstart} onmouseup={ontouchend} >
|
<div href={`/task/${task.id}/view`} title={task.description.source} task_id={task.id} {onclick} {oncontextmenu} {ontouchstart} {ontouchend} onmousedown={ontouchstart} onmouseup={ontouchend} >
|
||||||
{task.name}
|
{task.name}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -241,7 +241,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{#if task.description}
|
{#if task.description}
|
||||||
<div>{t('description')}</div>
|
<div>{t('description')}</div>
|
||||||
<MarkdownEditor store_id="task/{task.id}/description" bind:value={task.description} editable={true} onSet={val => update({description:val})} />
|
<MarkdownEditor bind:value={task.description} editable={true} onSet={val => update({description:val})} />
|
||||||
{/if}
|
{/if}
|
||||||
{#if !showSettings && task.start_date}
|
{#if !showSettings && task.start_date}
|
||||||
<div>{t('start_date')}</div>
|
<div>{t('start_date')}</div>
|
||||||
@@ -270,7 +270,7 @@
|
|||||||
|
|
||||||
<div>{t('members')}</div>
|
<div>{t('members')}</div>
|
||||||
<div>
|
<div>
|
||||||
<PermissionEditor members={task.members} {addMember} {dropMember} {getCandidates} {updatePermission} />
|
<PermissionEditor members={task.members} {updatePermission} {addMember} {dropMember} {getCandidates} />
|
||||||
</div>
|
</div>
|
||||||
<div>{t('start_date')}</div>
|
<div>{t('start_date')}</div>
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
});
|
});
|
||||||
if (res.ok){
|
if (res.ok){
|
||||||
yikes();
|
yikes();
|
||||||
localStorage.removeItem('wiki/new/content');
|
|
||||||
router.navigate(`/wiki/${title}/view`);
|
router.navigate(`/wiki/${title}/view`);
|
||||||
} else {
|
} else {
|
||||||
error(res);
|
error(res);
|
||||||
@@ -61,7 +60,7 @@
|
|||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
{t('content')}
|
{t('content')}
|
||||||
<Markdown bind:value={content} simple={true} store_id="wiki/new/content" />
|
<Markdown bind:value={content} simple={true} />
|
||||||
<button type="submit">{t('save')}</button>
|
<button type="submit">{t('save')}</button>
|
||||||
</label>
|
</label>
|
||||||
</form>
|
</form>
|
||||||
@@ -39,6 +39,6 @@
|
|||||||
|
|
||||||
<h2>{lastLetter = page.charAt(0).toUpperCase()||page.charAt(0).toUpperCase()}</h2>
|
<h2>{lastLetter = page.charAt(0).toUpperCase()||page.charAt(0).toUpperCase()}</h2>
|
||||||
{/if}
|
{/if}
|
||||||
<a class="wikilink" href={`/wiki/${encodeURIComponent(page)}/view`} {onclick} >{page}</a>
|
<a class="wikilink" href={`/wiki/${page}/view`} {onclick} >{page}</a>
|
||||||
{/each}
|
{/each}
|
||||||
{/if}
|
{/if}
|
||||||
@@ -188,7 +188,7 @@
|
|||||||
</table>
|
</table>
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
<MarkdownEditor {editable} value={page.content} onSet={s => patch({content:s})} store_id="wiki/{page.id}/description" />
|
<MarkdownEditor {editable} value={page.content} onSet={s => patch({content:s})} />
|
||||||
<TagList module="wiki" id={page.id} user_list={Object.keys(page.members).map(id => +id)} />
|
<TagList module="wiki" id={page.id} user_list={Object.keys(page.members).map(id => +id)} />
|
||||||
<div class="notes">
|
<div class="notes">
|
||||||
<h3>{t('notes')}</h3>
|
<h3>{t('notes')}</h3>
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
description = "Umbrella : Stock"
|
description = "Umbrella : Stock"
|
||||||
|
|
||||||
dependencies{
|
dependencies{
|
||||||
implementation(project(":bus"))
|
|
||||||
implementation(project(":core"))
|
implementation(project(":core"))
|
||||||
implementation("de.srsoftware:configuration.json:1.0.3")
|
implementation("de.srsoftware:configuration.json:1.0.3")
|
||||||
}
|
}
|
||||||
@@ -14,7 +14,6 @@ import static de.srsoftware.umbrella.core.constants.Module.USER;
|
|||||||
import static de.srsoftware.umbrella.core.constants.Path.*;
|
import static de.srsoftware.umbrella.core.constants.Path.*;
|
||||||
import static de.srsoftware.umbrella.core.constants.Path.PROPERTY;
|
import static de.srsoftware.umbrella.core.constants.Path.PROPERTY;
|
||||||
import static de.srsoftware.umbrella.core.exceptions.UmbrellaException.*;
|
import static de.srsoftware.umbrella.core.exceptions.UmbrellaException.*;
|
||||||
import static de.srsoftware.umbrella.messagebus.MessageBus.messageBus;
|
|
||||||
import static de.srsoftware.umbrella.stock.Constants.*;
|
import static de.srsoftware.umbrella.stock.Constants.*;
|
||||||
import static java.lang.System.Logger.Level.WARNING;
|
import static java.lang.System.Logger.Level.WARNING;
|
||||||
import static java.util.Comparator.comparing;
|
import static java.util.Comparator.comparing;
|
||||||
@@ -27,18 +26,12 @@ import de.srsoftware.umbrella.core.*;
|
|||||||
import de.srsoftware.umbrella.core.api.Owner;
|
import de.srsoftware.umbrella.core.api.Owner;
|
||||||
import de.srsoftware.umbrella.core.api.StockService;
|
import de.srsoftware.umbrella.core.api.StockService;
|
||||||
import de.srsoftware.umbrella.core.constants.Field;
|
import de.srsoftware.umbrella.core.constants.Field;
|
||||||
import de.srsoftware.umbrella.core.constants.Module;
|
|
||||||
import de.srsoftware.umbrella.core.constants.Path;
|
import de.srsoftware.umbrella.core.constants.Path;
|
||||||
import de.srsoftware.umbrella.core.constants.Text;
|
|
||||||
import de.srsoftware.umbrella.core.exceptions.UmbrellaException;
|
import de.srsoftware.umbrella.core.exceptions.UmbrellaException;
|
||||||
import de.srsoftware.umbrella.core.model.*;
|
import de.srsoftware.umbrella.core.model.*;
|
||||||
import de.srsoftware.umbrella.core.model.Location;
|
import de.srsoftware.umbrella.core.model.Location;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import de.srsoftware.umbrella.messagebus.events.Event;
|
|
||||||
import de.srsoftware.umbrella.messagebus.events.ItemEvent;
|
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
public class StockModule extends BaseHandler implements StockService {
|
public class StockModule extends BaseHandler implements StockService {
|
||||||
@@ -120,7 +113,6 @@ public class StockModule extends BaseHandler implements StockService {
|
|||||||
yield super.doGet(path,ex);
|
yield super.doGet(path,ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case Path.ITEM -> getItemById(user.get(),path,ex);
|
|
||||||
case Path.LOCATION -> {
|
case Path.LOCATION -> {
|
||||||
try {
|
try {
|
||||||
var location = Location.of(Long.parseLong(path.pop()));
|
var location = Location.of(Long.parseLong(path.pop()));
|
||||||
@@ -163,22 +155,6 @@ public class StockModule extends BaseHandler implements StockService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean getItemById(UmbrellaUser user, de.srsoftware.tools.Path path, HttpExchange ex) throws IOException {
|
|
||||||
var head = path.pop();
|
|
||||||
if (head == null) throw missingField(Field.ID);
|
|
||||||
try {
|
|
||||||
var itemId = Long.parseLong(head);
|
|
||||||
var item = stockDb.loadItem(itemId);
|
|
||||||
var owner = item.location().resolve().owner().resolve();
|
|
||||||
boolean allowed = owner instanceof UmbrellaUser u && user.equals(u);
|
|
||||||
allowed = allowed || owner instanceof Company c && companyService().membership(c.id(),user.id());
|
|
||||||
if (!allowed) throw forbidden("You are not allowed to access item {id}",ID,itemId);
|
|
||||||
return sendContent(ex,item);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
throw invalidField(Field.ID, Text.NUMBER);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean doPatch(de.srsoftware.tools.Path path, HttpExchange ex) throws IOException {
|
public boolean doPatch(de.srsoftware.tools.Path path, HttpExchange ex) throws IOException {
|
||||||
addCors(ex);
|
addCors(ex);
|
||||||
@@ -214,7 +190,6 @@ public class StockModule extends BaseHandler implements StockService {
|
|||||||
if (user.isEmpty()) return unauthorized(ex);
|
if (user.isEmpty()) return unauthorized(ex);
|
||||||
var head = path.pop();
|
var head = path.pop();
|
||||||
return switch (head) {
|
return switch (head) {
|
||||||
case Path.CLONE -> postClone(user.get(),ex);
|
|
||||||
case Path.ITEM -> postItem(user.get(), ex);
|
case Path.ITEM -> postItem(user.get(), ex);
|
||||||
case LIST -> postItemList(user.get(), path, ex);
|
case LIST -> postItemList(user.get(), path, ex);
|
||||||
case Path.LOCATION -> postLocation(user.get(),ex);
|
case Path.LOCATION -> postLocation(user.get(),ex);
|
||||||
@@ -310,7 +285,7 @@ public class StockModule extends BaseHandler implements StockService {
|
|||||||
var json = json(ex);
|
var json = json(ex);
|
||||||
if (!(json.get(ID) instanceof Number id)) throw missingField(ID);
|
if (!(json.get(ID) instanceof Number id)) throw missingField(ID);
|
||||||
json.remove(ID);
|
json.remove(ID);
|
||||||
LOG.log(WARNING,"Missing permission check in StockModule.patchItem()!");
|
|
||||||
var item = stockDb.loadItem(id.longValue());
|
var item = stockDb.loadItem(id.longValue());
|
||||||
item.patch(json);
|
item.patch(json);
|
||||||
return sendContent(ex,stockDb.save(item));
|
return sendContent(ex,stockDb.save(item));
|
||||||
@@ -361,23 +336,6 @@ public class StockModule extends BaseHandler implements StockService {
|
|||||||
return sendContent(ex,location);
|
return sendContent(ex,location);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean postClone(UmbrellaUser user, HttpExchange ex) throws IOException {
|
|
||||||
var json = json(ex);
|
|
||||||
if (!json.has(ID))throw missingField(ID);
|
|
||||||
if (!(json.get(ID) instanceof Number num)) throw invalidField(ID,Text.NUMBER);
|
|
||||||
long itemId = num.longValue();
|
|
||||||
var item = stockDb.loadItem(itemId);
|
|
||||||
stockDb.loadProperties(item);
|
|
||||||
var location = item.location().resolve();
|
|
||||||
var owner = location.owner().resolve();
|
|
||||||
if (!assigned(owner,user)) throw forbidden("You are not allowed to add items to \"{location}\"!", Text.LOCATION,location.name());
|
|
||||||
var newItem = new Item(0,owner,0,location,item.code(),item.name(),item.description());
|
|
||||||
for (var property : item.properties()) newItem.properties().add(property);
|
|
||||||
newItem = stockDb.save(newItem);
|
|
||||||
messageBus().dispatch(new ItemEvent(user, Module.STOCK, newItem, Event.EventType.CREATE));
|
|
||||||
return sendContent(ex,newItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean postItem(UmbrellaUser user, HttpExchange ex) throws IOException {
|
private boolean postItem(UmbrellaUser user, HttpExchange ex) throws IOException {
|
||||||
var json = json(ex);
|
var json = json(ex);
|
||||||
if (!json.has(NAME) || !(json.get(NAME) instanceof String name)) throw missingField(NAME);
|
if (!json.has(NAME) || !(json.get(NAME) instanceof String name)) throw missingField(NAME);
|
||||||
@@ -387,10 +345,8 @@ public class StockModule extends BaseHandler implements StockService {
|
|||||||
var location = stockDb.loadLocation(locationData.getLong(ID));
|
var location = stockDb.loadLocation(locationData.getLong(ID));
|
||||||
var owner = location.owner().resolve();
|
var owner = location.owner().resolve();
|
||||||
if (!assigned(owner,user)) throw forbidden("You are not allowed to add items to {location}!", Field.LOCATION,location);
|
if (!assigned(owner,user)) throw forbidden("You are not allowed to add items to {location}!", Field.LOCATION,location);
|
||||||
var newItem = stockDb.save(new Item(0,owner,0,location,code,name,description));
|
var newItem = new Item(0,owner,0,location,code,name,description);
|
||||||
messageBus().dispatch(new ItemEvent(user, Module.STOCK, newItem, Event.EventType.CREATE));
|
return sendContent(ex,stockDb.save(newItem));
|
||||||
return sendContent(ex,newItem);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean postItemList(UmbrellaUser user, de.srsoftware.tools.Path path, HttpExchange ex) throws IOException {
|
private boolean postItemList(UmbrellaUser user, de.srsoftware.tools.Path path, HttpExchange ex) throws IOException {
|
||||||
@@ -439,7 +395,6 @@ public class StockModule extends BaseHandler implements StockService {
|
|||||||
if (!(itemData.get(ID) instanceof Number itemId)) throw missingField(ID);
|
if (!(itemData.get(ID) instanceof Number itemId)) throw missingField(ID);
|
||||||
if (!(json.get("add_prop") instanceof JSONObject propData)) throw missingField("add_prop");
|
if (!(json.get("add_prop") instanceof JSONObject propData)) throw missingField("add_prop");
|
||||||
if (!propData.has(VALUE)) throw missingField(VALUE);
|
if (!propData.has(VALUE)) throw missingField(VALUE);
|
||||||
LOG.log(WARNING,"Missing permission check in StockModule.postProperty()!");
|
|
||||||
var value = propData.get(VALUE);
|
var value = propData.get(VALUE);
|
||||||
if (value == null) throw missingField(VALUE);
|
if (value == null) throw missingField(VALUE);
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ import de.srsoftware.tools.SessionToken;
|
|||||||
import de.srsoftware.umbrella.core.BaseHandler;
|
import de.srsoftware.umbrella.core.BaseHandler;
|
||||||
import de.srsoftware.umbrella.core.ModuleRegistry;
|
import de.srsoftware.umbrella.core.ModuleRegistry;
|
||||||
import de.srsoftware.umbrella.core.api.*;
|
import de.srsoftware.umbrella.core.api.*;
|
||||||
import de.srsoftware.umbrella.core.constants.Field;
|
|
||||||
import de.srsoftware.umbrella.core.constants.Text;
|
import de.srsoftware.umbrella.core.constants.Text;
|
||||||
import de.srsoftware.umbrella.core.exceptions.UmbrellaException;
|
import de.srsoftware.umbrella.core.exceptions.UmbrellaException;
|
||||||
import de.srsoftware.umbrella.core.model.*;
|
import de.srsoftware.umbrella.core.model.*;
|
||||||
@@ -272,12 +271,6 @@ public class TaskModule extends BaseHandler implements TaskService {
|
|||||||
return taskList;
|
return taskList;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<Long,Map<String,Object>> mapTasks(Map<Long,Task> tasks, boolean render){
|
|
||||||
if (render) return mapValues(tasks);
|
|
||||||
return tasks.entrySet().stream()
|
|
||||||
.collect(Collectors.toMap(Map.Entry::getKey,e -> e.getValue().toMap(false)));
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean newParentIsSubtask(Task task, long newParent) {
|
private boolean newParentIsSubtask(Task task, long newParent) {
|
||||||
var parent = taskDb.load(newParent);
|
var parent = taskDb.load(newParent);
|
||||||
while (parent != null) {
|
while (parent != null) {
|
||||||
@@ -429,23 +422,21 @@ public class TaskModule extends BaseHandler implements TaskService {
|
|||||||
var noIndex = json.has(NO_INDEX) && json.get(NO_INDEX) instanceof Boolean bool ? bool : false;
|
var noIndex = json.has(NO_INDEX) && json.get(NO_INDEX) instanceof Boolean bool ? bool : false;
|
||||||
var projectId = json.has(PROJECT_ID) && json.get(PROJECT_ID) instanceof Number number ? number.longValue() : null;
|
var projectId = json.has(PROJECT_ID) && json.get(PROJECT_ID) instanceof Number number ? number.longValue() : null;
|
||||||
var parentTaskId = json.has(PARENT_TASK_ID) && json.get(PARENT_TASK_ID) instanceof Number number ? number.longValue() : null;
|
var parentTaskId = json.has(PARENT_TASK_ID) && json.get(PARENT_TASK_ID) instanceof Number number ? number.longValue() : null;
|
||||||
var markdown = !json.has(RENDERED) || !(json.get(RENDERED) instanceof Boolean render) || render;
|
|
||||||
if (isSet(projectId)) {
|
if (isSet(projectId)) {
|
||||||
if (parentTaskId == null) {
|
if (parentTaskId == null) {
|
||||||
var list = taskDb.listRootTasks(projectId, user, showClosed);
|
var list = taskDb.listRootTasks(projectId, user, showClosed);
|
||||||
return sendContent(ex, mapTasks(list,markdown));
|
return sendContent(ex, mapValues(list));
|
||||||
}
|
}
|
||||||
var projectTasks = taskDb.listProjectTasks(projectId, parentTaskId, noIndex);
|
var projectTasks = taskDb.listProjectTasks(projectId, parentTaskId, noIndex);
|
||||||
loadMembers(projectTasks.values());
|
loadMembers(projectTasks.values());
|
||||||
var tags = tagService().getTags(TASK,projectTasks.keySet(),user);
|
var tags = tagService().getTags(TASK,projectTasks.keySet(),user);
|
||||||
|
|
||||||
projectTasks = addTags(projectTasks, tags);
|
projectTasks = addTags(projectTasks, tags);
|
||||||
return sendContent(ex, mapTasks(projectTasks, markdown));
|
return sendContent(ex, mapValues(projectTasks));
|
||||||
}
|
}
|
||||||
if (isSet(parentTaskId)) return sendContent(ex, mapValues(taskDb.listChildrenOf(parentTaskId, user, showClosed)));
|
if (isSet(parentTaskId)) return sendContent(ex, mapValues(taskDb.listChildrenOf(parentTaskId, user, showClosed)));
|
||||||
var taskIds = json.has(IDS) && json.get(IDS) instanceof JSONArray ids ? ids.toList().stream().map(Object::toString).map(Long::parseLong).toList() : null;
|
var taskIds = json.has(IDS) && json.get(IDS) instanceof JSONArray ids ? ids.toList().stream().map(Object::toString).map(Long::parseLong).toList() : null;
|
||||||
var tasks = taskDb.load(taskIds);
|
if (isSet(taskIds)) return sendContent(ex, mapValues(taskDb.load(taskIds)));
|
||||||
if (isSet(taskIds)) return sendContent(ex, mapTasks(tasks,markdown));
|
|
||||||
return sendEmptyResponse(HTTP_NOT_IMPLEMENTED, ex);
|
return sendEmptyResponse(HTTP_NOT_IMPLEMENTED, ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -210,7 +210,7 @@
|
|||||||
"member": "Mitarbeiter",
|
"member": "Mitarbeiter",
|
||||||
"members": "Mitarbeiter",
|
"members": "Mitarbeiter",
|
||||||
"message": "Nachricht",
|
"message": "Nachricht",
|
||||||
"messages": "Be­nach­rich­ti­gung­en",
|
"messages": "Benachrichtigungen",
|
||||||
"miscellaneous_settings": "sonstige Einstellungen",
|
"miscellaneous_settings": "sonstige Einstellungen",
|
||||||
"missing_new_item_id": "Alter Artikel-ID ({0}) wurde keine neue ID zugeordnet!",
|
"missing_new_item_id": "Alter Artikel-ID ({0}) wurde keine neue ID zugeordnet!",
|
||||||
"mismatch": "ungleich",
|
"mismatch": "ungleich",
|
||||||
@@ -399,7 +399,6 @@
|
|||||||
"unit_price": "Preis/Einheit",
|
"unit_price": "Preis/Einheit",
|
||||||
"unknown_item_location": "Artikel {0} von {1} {2} ist verknüpft mit unbekanntem Lagerort {3}!",
|
"unknown_item_location": "Artikel {0} von {1} {2} ist verknüpft mit unbekanntem Lagerort {3}!",
|
||||||
"unlink": "Trennen",
|
"unlink": "Trennen",
|
||||||
"unsaved_content": "Hier klicken, um ungespeicherte Änderungen zu laden",
|
|
||||||
"update": "aktualisieren",
|
"update": "aktualisieren",
|
||||||
"UPDATE_USERS" : "Nutzer aktualisieren",
|
"UPDATE_USERS" : "Nutzer aktualisieren",
|
||||||
"upload_file": "Datei hochladen",
|
"upload_file": "Datei hochladen",
|
||||||
|
|||||||
@@ -399,7 +399,6 @@
|
|||||||
"unit_price": "price/unit",
|
"unit_price": "price/unit",
|
||||||
"unknown_item_location": "Item {0} of {1} {2} refers to location {3}, which is unknown!",
|
"unknown_item_location": "Item {0} of {1} {2} refers to location {3}, which is unknown!",
|
||||||
"unlink": "unlink",
|
"unlink": "unlink",
|
||||||
"unsaved_content": "Click here to load unsaved changes",
|
|
||||||
"update": "update",
|
"update": "update",
|
||||||
"UPDATE_USERS" : "update users",
|
"UPDATE_USERS" : "update users",
|
||||||
"upload_file": "upload file",
|
"upload_file": "upload file",
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import static de.srsoftware.umbrella.core.ModuleRegistry.postBox;
|
|||||||
import static de.srsoftware.umbrella.core.ResponseCode.*;
|
import static de.srsoftware.umbrella.core.ResponseCode.*;
|
||||||
import static de.srsoftware.umbrella.core.ResponseCode.HTTP_SERVER_ERROR;
|
import static de.srsoftware.umbrella.core.ResponseCode.HTTP_SERVER_ERROR;
|
||||||
import static de.srsoftware.umbrella.core.Util.*;
|
import static de.srsoftware.umbrella.core.Util.*;
|
||||||
import static de.srsoftware.umbrella.core.constants.Constants.CONFIG_SESSION_DURATION;
|
|
||||||
import static de.srsoftware.umbrella.core.constants.Field.*;
|
import static de.srsoftware.umbrella.core.constants.Field.*;
|
||||||
import static de.srsoftware.umbrella.core.constants.Field.PASSWORD;
|
import static de.srsoftware.umbrella.core.constants.Field.PASSWORD;
|
||||||
import static de.srsoftware.umbrella.core.constants.Field.REDIRECT;
|
import static de.srsoftware.umbrella.core.constants.Field.REDIRECT;
|
||||||
@@ -89,14 +88,9 @@ public class UserModule extends BaseHandler implements UserService {
|
|||||||
public UserModule(Configuration config) throws UmbrellaException {
|
public UserModule(Configuration config) throws UmbrellaException {
|
||||||
super();
|
super();
|
||||||
var dbFile = config.get(CONFIG_DATABASE).orElseThrow(() -> missingConfig(CONFIG_DATABASE));
|
var dbFile = config.get(CONFIG_DATABASE).orElseThrow(() -> missingConfig(CONFIG_DATABASE));
|
||||||
var sqlite = new SqliteDB(connect(dbFile));
|
|
||||||
|
|
||||||
// may be splitted in separate db files later
|
// may be splitted in separate db files later
|
||||||
logins = sqlite;
|
logins = new SqliteDB(connect(dbFile));
|
||||||
users = sqlite;
|
users = new SqliteDB(connect(dbFile));
|
||||||
|
|
||||||
Optional<Number> sessionDuration = config.get(CONFIG_SESSION_DURATION);
|
|
||||||
sessionDuration.ifPresent(users::setSessionDuration);
|
|
||||||
ModuleRegistry.add(this);
|
ModuleRegistry.add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,4 @@ public interface UserDb {
|
|||||||
UmbrellaUser save(DbUser user) throws UmbrellaException;
|
UmbrellaUser save(DbUser user) throws UmbrellaException;
|
||||||
|
|
||||||
Map<Long,DbUser> search(String key);
|
Map<Long,DbUser> search(String key);
|
||||||
|
|
||||||
UserDb setSessionDuration(Number minutes);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,14 +35,12 @@ import java.security.NoSuchAlgorithmException;
|
|||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.time.Duration;
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class SqliteDB extends BaseDb implements LoginServiceDb, UserDb {
|
public class SqliteDB extends BaseDb implements LoginServiceDb, UserDb {
|
||||||
private static final System.Logger LOG = System.getLogger(SqliteDB.class.getSimpleName());
|
private static final System.Logger LOG = System.getLogger(SqliteDB.class.getSimpleName());
|
||||||
private static Duration sessionDuration = DEFAULT_SESSION_DURATION;
|
|
||||||
|
|
||||||
public SqliteDB(Connection conn){
|
public SqliteDB(Connection conn){
|
||||||
super(conn);
|
super(conn);
|
||||||
@@ -483,15 +481,8 @@ CREATE TABLE IF NOT EXISTS {0} (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public UserDb setSessionDuration(Number minutes) {
|
|
||||||
LOG.log(INFO,"Session duration set to {} minutes",minutes);
|
|
||||||
sessionDuration = Duration.ofMinutes(minutes.longValue());
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Instant then(){
|
public Instant then(){
|
||||||
return LocalDateTime.now().plus(sessionDuration).toInstant(UTC);
|
return LocalDateTime.now().plus(DEFAULT_SESSION_DURATION).toInstant(UTC);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ForeignLogin toForeignLogin(ResultSet rs) throws SQLException {
|
private ForeignLogin toForeignLogin(ResultSet rs) throws SQLException {
|
||||||
|
|||||||
@@ -74,10 +74,6 @@ tr:hover .taglist .tag button {
|
|||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
.code{
|
|
||||||
color: orangered;
|
|
||||||
}
|
|
||||||
|
|
||||||
.error {
|
.error {
|
||||||
background-color: red;
|
background-color: red;
|
||||||
color: black;
|
color: black;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ fieldset[tabindex="0"]{
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldset[tabindex="0"]:hover{
|
fieldset[tabindex="0"]:focus-within{
|
||||||
max-height: unset;
|
max-height: unset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,26 +91,6 @@ td, tr{
|
|||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 0;
|
|
||||||
right: 0;
|
|
||||||
font-size: 14px;
|
|
||||||
z-index: 200;
|
|
||||||
padding: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.overlay {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
bottom: 0;
|
|
||||||
right: 0;
|
|
||||||
left: 0;
|
|
||||||
padding: 40px 10px 10px;
|
|
||||||
background: rgba(0,0,0,0.9);
|
|
||||||
z-index: 50;
|
|
||||||
}
|
|
||||||
|
|
||||||
.warn {
|
.warn {
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
@@ -142,6 +122,16 @@ td, tr{
|
|||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.settings {
|
||||||
|
position: fixed;
|
||||||
|
top: 60px;
|
||||||
|
left: 10px;
|
||||||
|
right: 10px;
|
||||||
|
padding: 10px;
|
||||||
|
border: 1px solid;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
.project.list td:not(.actions){
|
.project.list td:not(.actions){
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,10 +72,6 @@ tr:hover .taglist .tag button {
|
|||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
.code{
|
|
||||||
color: chocolate;
|
|
||||||
}
|
|
||||||
|
|
||||||
.em {
|
.em {
|
||||||
background: rgba(255, 215, 0, 0.09);
|
background: rgba(255, 215, 0, 0.09);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -183,17 +183,6 @@ td, tr{
|
|||||||
padding: 3px;
|
padding: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.overlay {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
bottom: 0;
|
|
||||||
right: 0;
|
|
||||||
left: 0;
|
|
||||||
padding: 40px 10px 10px;
|
|
||||||
background: rgba(0,0,0,0.9);
|
|
||||||
z-index: 50;
|
|
||||||
}
|
|
||||||
|
|
||||||
.warn {
|
.warn {
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
@@ -225,6 +214,16 @@ td, tr{
|
|||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.settings {
|
||||||
|
position: fixed;
|
||||||
|
top: 60px;
|
||||||
|
left: 10px;
|
||||||
|
right: 10px;
|
||||||
|
padding: 10px;
|
||||||
|
border: 1px solid;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
.project.list td:not(.actions){
|
.project.list td:not(.actions){
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
@@ -476,16 +475,6 @@ table{
|
|||||||
bottom: 0;
|
bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.properties{
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.properties .clone{
|
|
||||||
position: absolute;
|
|
||||||
right: 10px;
|
|
||||||
top: 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.version > a{
|
.version > a{
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,10 +67,6 @@ tr:hover .taglist .tag button {
|
|||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
.code{
|
|
||||||
color: black;
|
|
||||||
}
|
|
||||||
|
|
||||||
.error {
|
.error {
|
||||||
background-color: red;
|
background-color: red;
|
||||||
color: black;
|
color: black;
|
||||||
|
|||||||
@@ -91,26 +91,6 @@ td, tr{
|
|||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 0;
|
|
||||||
right: 0;
|
|
||||||
font-size: 14px;
|
|
||||||
z-index: 200;
|
|
||||||
padding: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.overlay {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
bottom: 0;
|
|
||||||
right: 0;
|
|
||||||
left: 0;
|
|
||||||
padding: 40px 10px 10px;
|
|
||||||
background: rgba(255,255,255,0.9);
|
|
||||||
z-index: 50;
|
|
||||||
}
|
|
||||||
|
|
||||||
.warn {
|
.warn {
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
@@ -142,6 +122,16 @@ td, tr{
|
|||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.settings {
|
||||||
|
position: fixed;
|
||||||
|
top: 60px;
|
||||||
|
left: 10px;
|
||||||
|
right: 10px;
|
||||||
|
padding: 10px;
|
||||||
|
border: 1px solid;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
.project.list td:not(.actions){
|
.project.list td:not(.actions){
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
@@ -245,7 +235,6 @@ textarea{
|
|||||||
.message.settings label{
|
.message.settings label{
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.message.settings td{
|
.message.settings td{
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user