code cleanup
This commit is contained in:
@@ -1,28 +1,30 @@
|
||||
<script>
|
||||
import { onMount } from 'svelte';
|
||||
import { Router, Route } from 'svelte-tiny-router';
|
||||
|
||||
import { loadTranslation } from './translations.svelte.js';
|
||||
import { user } from './user.svelte.js';
|
||||
import { Router, Route } from 'svelte-tiny-router';
|
||||
import AddDoc from "./routes/document/Add.svelte";
|
||||
import AddTask from "./routes/task/Add.svelte";
|
||||
import Callback from "./routes/user/OidcCallback.svelte";
|
||||
import DocList from "./routes/document/List.svelte";
|
||||
|
||||
import AddDoc from "./routes/document/Add.svelte";
|
||||
import AddTask from "./routes/task/Add.svelte";
|
||||
import Callback from "./routes/user/OidcCallback.svelte";
|
||||
import DocList from "./routes/document/List.svelte";
|
||||
import EditService from "./routes/user/EditService.svelte";
|
||||
import EditUser from "./routes/user/EditUser.svelte";
|
||||
import Footer from "./Components/Footer.svelte";
|
||||
import Kanban from "./routes/project/Kanban.svelte";
|
||||
import Login from "./Components/Login.svelte";
|
||||
import Messages from "./routes/message/Messages.svelte";
|
||||
import Menu from "./Components/Menu.svelte";
|
||||
import EditUser from "./routes/user/EditUser.svelte";
|
||||
import Footer from "./Components/Footer.svelte";
|
||||
import Kanban from "./routes/project/Kanban.svelte";
|
||||
import Login from "./Components/Login.svelte";
|
||||
import Messages from "./routes/message/Messages.svelte";
|
||||
import Menu from "./Components/Menu.svelte";
|
||||
import ProjectList from "./routes/project/List.svelte";
|
||||
import ProjectAdd from "./routes/project/Create.svelte";
|
||||
import ResetPw from "./routes/user/ResetPw.svelte";
|
||||
import Search from "./routes/search/Search.svelte";
|
||||
import SendDoc from "./routes/document/Send.svelte";
|
||||
import User from "./routes/user/User.svelte";
|
||||
import ViewDoc from "./routes/document/View.svelte";
|
||||
import ViewPrj from "./routes/project/View.svelte";
|
||||
import ViewTask from "./routes/task/View.svelte";
|
||||
import ProjectAdd from "./routes/project/Create.svelte";
|
||||
import ResetPw from "./routes/user/ResetPw.svelte";
|
||||
import Search from "./routes/search/Search.svelte";
|
||||
import SendDoc from "./routes/document/Send.svelte";
|
||||
import User from "./routes/user/User.svelte";
|
||||
import ViewDoc from "./routes/document/View.svelte";
|
||||
import ViewPrj from "./routes/project/View.svelte";
|
||||
import ViewTask from "./routes/task/View.svelte";
|
||||
|
||||
let translations_ready = $state(false);
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
import { onMount } from 'svelte';
|
||||
import { useTinyRouter } from 'svelte-tiny-router';
|
||||
|
||||
import { api } from '../urls.svelte.js';
|
||||
import { logout, user } from '../user.svelte.js';
|
||||
import { t } from '../translations.svelte.js';
|
||||
|
||||
@@ -10,7 +9,7 @@ const router = useTinyRouter();
|
||||
const modules = $state([]);
|
||||
|
||||
async function fetchModules(){
|
||||
const url = api('/legacy/modules');
|
||||
const url = `${location.protocol}//${location.host.replace('5173','8080')}/legacy/modules`;
|
||||
const resp = await fetch(url,{credentials:'include'});
|
||||
if (resp.ok){
|
||||
const arr = await resp.json();
|
||||
|
||||
@@ -11,14 +11,14 @@
|
||||
|
||||
let error = null;
|
||||
let companies = {};
|
||||
let router = useTinyRouter();
|
||||
let company_id = +router.query.company_id;
|
||||
let documents = null;
|
||||
let router = useTinyRouter();
|
||||
let docType = 0;
|
||||
let selected_company = null;
|
||||
|
||||
async function loadCompanies(){
|
||||
const url = api('company/list');
|
||||
const url = api('company/list');
|
||||
const resp = await fetch(url,{ credentials: 'include'});
|
||||
if (resp.ok){
|
||||
companies = await resp.json();
|
||||
@@ -40,7 +40,7 @@
|
||||
async function load(company){
|
||||
router.navigate(`/document?company_id=${company.id}`);
|
||||
selected_company = company;
|
||||
const url = api('document/list');
|
||||
const url = api('document/list');
|
||||
const resp = await fetch(url,{
|
||||
credentials: 'include',
|
||||
method: 'POST',
|
||||
@@ -63,7 +63,7 @@
|
||||
|
||||
async function deleteDoc(ev,doc){
|
||||
if (confirm(t('really_delete',doc.number))){
|
||||
const url = api(`document/${doc.id}`;
|
||||
const url = api(`document/${doc.id}`);
|
||||
const resp = await fetch(url,{
|
||||
credentials: 'include',
|
||||
method: 'DELETE'
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
import { onMount } from 'svelte';
|
||||
import { useTinyRouter } from 'svelte-tiny-router';
|
||||
|
||||
import { api } from '../../urls.svelte-js';
|
||||
import { api } from '../../urls.svelte.js';
|
||||
import { t } from '../../translations.svelte.js';
|
||||
|
||||
import Position from './Position.svelte';
|
||||
|
||||
var {
|
||||
document = $bindable(null),
|
||||
error = $bindable(null)
|
||||
error = $bindable(null),
|
||||
submit = (key,newVal) => {},
|
||||
} = $props();
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
}
|
||||
|
||||
async function movePos(number,step){
|
||||
const url = api(`document/${document.id}/position`;
|
||||
const url = api(`document/${document.id}/position`);
|
||||
const resp = await fetch(url,{
|
||||
method : 'PATCH',
|
||||
credentials: 'include',
|
||||
@@ -39,7 +39,7 @@
|
||||
async function drop(number){
|
||||
let confirmed = confirm(t('confirm_deletion').replace('{pos}',document.positions[number].item));
|
||||
if (!confirmed) return;
|
||||
const url = api(`document/${document.id}/position`;
|
||||
const url = api(`document/${document.id}/position`);
|
||||
const resp = await fetch(url,{
|
||||
method : 'DELETE',
|
||||
credentials: 'include',
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
let times = $state(null);
|
||||
|
||||
async function loadProjects(){
|
||||
const url = api'project/list');
|
||||
const url = api('project/list');
|
||||
let data = { company_id: company_id };
|
||||
const resp = await fetch(url,{
|
||||
credentials : 'include',
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
|
||||
async function loadDoc(){
|
||||
const url = api(`document/${id}`;
|
||||
const url = api(`document/${id}`);
|
||||
const resp = await fetch(url,{credentials:'include'});
|
||||
if (resp.ok){
|
||||
doc = await resp.json();
|
||||
@@ -61,7 +61,7 @@
|
||||
data[parts.pop()] = inner;
|
||||
}
|
||||
try {
|
||||
const url = api(`document/${doc.id}`;
|
||||
const url = api(`document/${doc.id}`);
|
||||
const resp = await fetch(url,{
|
||||
credentials : 'include',
|
||||
method : 'PATCH',
|
||||
@@ -74,7 +74,7 @@
|
||||
}
|
||||
|
||||
async function addPosition(selected){
|
||||
const url = api(`document/${doc.id}/position`;
|
||||
const url = api(`document/${doc.id}/position`);
|
||||
const resp = await fetch(url,{
|
||||
method : 'POST',
|
||||
credentials : 'include',
|
||||
@@ -91,7 +91,7 @@
|
||||
async function render(ev){
|
||||
pdfDisabled = true;
|
||||
|
||||
const url = api(`document/${doc.id}/pdf`;
|
||||
const url = api(`document/${doc.id}/pdf`);
|
||||
const resp = await fetch(url,{credentials:'include'});
|
||||
if (resp.ok){
|
||||
error = null;
|
||||
|
||||
@@ -1,29 +1,34 @@
|
||||
<script>
|
||||
import { onMount } from 'svelte';
|
||||
import { api } from '../../urls.svelte.js';
|
||||
import { t } from '../../translations.svelte.js';
|
||||
import { user } from '../../user.svelte.js';
|
||||
|
||||
import { api } from '../../urls.svelte.js';
|
||||
import { t } from '../../translations.svelte.js';
|
||||
import { user } from '../../user.svelte.js';
|
||||
|
||||
import Editor from '../../Components/MarkdownEditor.svelte';
|
||||
|
||||
let error = $state(null);
|
||||
let { module = null, entity_id = null } = $props();
|
||||
let note = $state({source:null,rendered:null});
|
||||
let notes = $state(null);
|
||||
let authors = $state(null);
|
||||
let error = $state(null);
|
||||
let note = $state({source:null,rendered:null});
|
||||
let notes = $state(null);
|
||||
let {
|
||||
module = null,
|
||||
entity_id = null
|
||||
} = $props();
|
||||
|
||||
async function saveNote(){
|
||||
const url = api(`notes/${module}/${entity_id}`);
|
||||
const url = api(`notes/${module}/${entity_id}`);
|
||||
const resp = await fetch(url,{
|
||||
credentials:'include',
|
||||
method:'POST',
|
||||
body:note.source
|
||||
credentials : 'include',
|
||||
method : 'POST',
|
||||
body : note.source
|
||||
});
|
||||
if (resp.ok){
|
||||
let newNote = await resp.json();
|
||||
authors[user.id] = user;
|
||||
let newNote = await resp.json();
|
||||
authors[user.id] = user;
|
||||
notes[newNote.id] = newNote;
|
||||
note = {source:'',rendered:''};
|
||||
error = null;
|
||||
note = {source:'',rendered:''};
|
||||
error = null;
|
||||
return true;
|
||||
} else {
|
||||
error = await resp.text();
|
||||
@@ -32,12 +37,12 @@
|
||||
}
|
||||
|
||||
async function load(){
|
||||
const url = api(`notes/${module}/${entity_id}`);
|
||||
const url = api(`notes/${module}/${entity_id}`);
|
||||
const resp = await fetch(url,{credentials:'include'});
|
||||
if (resp.ok){
|
||||
const data = await resp.json();
|
||||
notes = data.notes;
|
||||
authors = data.authors;
|
||||
notes = data.notes;
|
||||
authors = data.authors;
|
||||
} else {
|
||||
error = await resp.text();
|
||||
}
|
||||
@@ -51,10 +56,10 @@
|
||||
position: relative;
|
||||
}
|
||||
legend.time{
|
||||
position: absolute;
|
||||
top: -19px;
|
||||
right: 20px;
|
||||
background: black;
|
||||
position : absolute;
|
||||
top : -19px;
|
||||
right : 20px;
|
||||
background : black;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
@@ -1,34 +1,33 @@
|
||||
<script>
|
||||
import { useTinyRouter } from 'svelte-tiny-router';
|
||||
|
||||
import { t } from '../../translations.svelte.js';
|
||||
import { api } from '../../urls.svelte.js';
|
||||
import { t } from '../../translations.svelte.js';
|
||||
|
||||
import CompanySelector from '../../Components/CompanySelector.svelte';
|
||||
import MarkdownEditor from '../../Components/MarkdownEditor.svelte';
|
||||
import Settings from './Settings.svelte';
|
||||
import Tags from '../tags/TagList.svelte';
|
||||
import CompanySelector from '../../Components/CompanySelector.svelte';
|
||||
import MarkdownEditor from '../../Components/MarkdownEditor.svelte';
|
||||
import Settings from './Settings.svelte';
|
||||
import Tags from '../tags/TagList.svelte';
|
||||
|
||||
let error = $state(null);
|
||||
let ready = $derived(!!project.name.trim())
|
||||
const router = useTinyRouter();
|
||||
let error = $state(null);
|
||||
let ready = $derived(!!project.name.trim())
|
||||
const router = useTinyRouter();
|
||||
let showSettings = $state(false);
|
||||
|
||||
let project = $state({
|
||||
name:'',
|
||||
name : '',
|
||||
description : { source : '', rendered : '' },
|
||||
settings:{
|
||||
show_closed:false
|
||||
},
|
||||
tags: []
|
||||
settings : { show_closed:false },
|
||||
tags : []
|
||||
});
|
||||
|
||||
async function onsubmit(ev){
|
||||
ev.preventDefault();
|
||||
const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/project`;
|
||||
var resp = await fetch(url,{
|
||||
credentials: 'include',
|
||||
method: 'POST',
|
||||
body: JSON.stringify(project)
|
||||
const url = api('project');
|
||||
var resp = await fetch(url,{
|
||||
credentials : 'include',
|
||||
method : 'POST',
|
||||
body : JSON.stringify(project)
|
||||
});
|
||||
if (resp.ok){
|
||||
var newProject = await resp.json();
|
||||
|
||||
@@ -1,48 +1,47 @@
|
||||
<script>
|
||||
import { onMount } from 'svelte';
|
||||
import { onMount } from 'svelte';
|
||||
import { useTinyRouter } from 'svelte-tiny-router';
|
||||
|
||||
import { api } from '../../urls.svelte.js';
|
||||
import { t } from '../../translations.svelte.js';
|
||||
import { user } from '../../user.svelte.js';
|
||||
import { api } from '../../urls.svelte.js';
|
||||
import { t } from '../../translations.svelte.js';
|
||||
import { user } from '../../user.svelte.js';
|
||||
|
||||
import Card from './KanbanCard.svelte';
|
||||
import LineEditor from '../../Components/LineEditor.svelte';
|
||||
|
||||
let { id } = $props();
|
||||
|
||||
let dragged = null;
|
||||
let error = $state(null);
|
||||
let highlight = $state({});
|
||||
let project = $state(null);
|
||||
let ready = $state(false);
|
||||
let router = useTinyRouter();
|
||||
let states = $state(null);
|
||||
let tasks = $state({});
|
||||
let dragged = null;
|
||||
let error = $state(null);
|
||||
let highlight = $state({});
|
||||
let filter_input = $state('');
|
||||
let filter = $derived(filter_input.toLowerCase());
|
||||
let users = {};
|
||||
|
||||
let columns = $derived(states?Object.keys(states).length+1:1);
|
||||
let filter = $derived(filter_input.toLowerCase());
|
||||
let project = $state(null);
|
||||
let ready = $state(false);
|
||||
let router = useTinyRouter();
|
||||
let states = $state(null);
|
||||
let tasks = $state({});
|
||||
let users = {};
|
||||
let columns = $derived(states?Object.keys(states).length+1:1);
|
||||
|
||||
async function create(name,user_id,state){
|
||||
var url = api('task/add');
|
||||
let task = {
|
||||
description: '',
|
||||
members : {},
|
||||
name: name,
|
||||
project_id: +id,
|
||||
status : { code : +state}
|
||||
description : '',
|
||||
members : {},
|
||||
name : name,
|
||||
project_id : +id,
|
||||
status : { code : +state}
|
||||
}
|
||||
task.members[user_id] = { permission: { name : 'ASSIGNEE' }};
|
||||
task.members[user.id] = { permission: { name : 'OWNER' }};
|
||||
const resp = await fetch(url,{
|
||||
credentials:'include',
|
||||
method:'POST',
|
||||
body: JSON.stringify(task)
|
||||
const resp = await fetch(url,{
|
||||
credentials : 'include',
|
||||
method : 'POST',
|
||||
body : JSON.stringify(task)
|
||||
});
|
||||
if (resp.ok) {
|
||||
task = await resp.json();
|
||||
task = await resp.json();
|
||||
task.assignee = user_id;
|
||||
if (!tasks[user_id]) tasks[user_id] = {};
|
||||
if (!tasks[user_id][state]) tasks[user_id][state] = {};
|
||||
@@ -54,18 +53,18 @@
|
||||
}
|
||||
|
||||
async function drop(user_id,state){
|
||||
let task = dragged;
|
||||
dragged = null;
|
||||
let task = dragged;
|
||||
dragged = null;
|
||||
highlight = {};
|
||||
if (task.assignee == user_id && task.status.code == state) return; // no change
|
||||
let patch = {members:{},status:+state}
|
||||
let patch = {members:{},status:+state}
|
||||
patch.members[user_id] = 'ASSIGNEE';
|
||||
|
||||
const url = api(`task/${task.id}`);
|
||||
const resp = await fetch(url,{
|
||||
credentials: 'include',
|
||||
method: 'PATCH',
|
||||
body: JSON.stringify(patch)
|
||||
credentials : 'include',
|
||||
method : 'PATCH',
|
||||
body : JSON.stringify(patch)
|
||||
});
|
||||
if (resp.ok){
|
||||
delete tasks[task.assignee][task.status.code][task.id]
|
||||
@@ -73,8 +72,8 @@
|
||||
if (!tasks[user_id][state]) tasks[user_id][state] = {}
|
||||
tasks[user_id][state][task.id] = task;
|
||||
task.assignee = user_id;
|
||||
task.status = {code:state,name:states[state]};
|
||||
error = null;
|
||||
task.status = {code:state,name:states[state]};
|
||||
error = null;
|
||||
} else {
|
||||
error = await resp.text();
|
||||
}
|
||||
@@ -89,7 +88,7 @@
|
||||
}
|
||||
|
||||
async function loadProject(){
|
||||
const url = api(`project/${id}`);
|
||||
const url = api(`project/${id}`);
|
||||
const resp = await fetch(url,{credentials:'include'});
|
||||
if (resp.ok){
|
||||
project = await resp.json();
|
||||
@@ -105,18 +104,18 @@
|
||||
}
|
||||
|
||||
async function loadStates(){
|
||||
const url = api(`project/${id}/states`);
|
||||
const url = api(`project/${id}/states`);
|
||||
const resp = await fetch(url,{credentials:'include'});
|
||||
if (resp.ok){
|
||||
states = await resp.json();
|
||||
error = null;
|
||||
error = null;
|
||||
} else {
|
||||
error = await resp.text();
|
||||
}
|
||||
}
|
||||
|
||||
async function loadTag(task){
|
||||
const url = api(`tags/task/${task.id}`);
|
||||
const url = api(`tags/task/${task.id}`);
|
||||
const resp = await fetch(url,{credentials:'include'});
|
||||
if (resp.ok) {
|
||||
const tags = await resp.json();
|
||||
@@ -136,24 +135,24 @@
|
||||
}
|
||||
|
||||
async function loadTasks(selector){
|
||||
const url = api('task/list');
|
||||
const url = api('task/list');
|
||||
selector.show_closed = true;
|
||||
selector.no_index = true;
|
||||
selector.no_index = true;
|
||||
var resp = await fetch(url,{
|
||||
credentials: 'include',
|
||||
method:'POST',
|
||||
body:JSON.stringify(selector)
|
||||
credentials : 'include',
|
||||
method : 'POST',
|
||||
body : JSON.stringify(selector)
|
||||
});
|
||||
if (resp.ok){
|
||||
var json = await resp.json();
|
||||
for (var task_id of Object.keys(json)) {
|
||||
let task = json[task_id];
|
||||
let state = task.status.code;
|
||||
let owner = null;
|
||||
let task = json[task_id];
|
||||
let state = task.status.code;
|
||||
let owner = null;
|
||||
let assignee = null;
|
||||
for (var user_id of Object.keys(task.members)){
|
||||
var member = task.members[user_id];
|
||||
if (member.permission.name == 'OWNER') owner = user_id;
|
||||
if (member.permission.name == 'OWNER') owner = user_id;
|
||||
if (member.permission.name == 'ASSIGNEE') assignee = user_id;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
<script>
|
||||
import { onMount } from 'svelte';
|
||||
import { useTinyRouter } from 'svelte-tiny-router';
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
import { t } from '../../translations.svelte.js';
|
||||
import { api } from '../../urls.svelte.js';
|
||||
import { api } from '../../urls.svelte.js';
|
||||
import { t } from '../../translations.svelte.js';
|
||||
|
||||
const router = useTinyRouter();
|
||||
let error = $state(null);
|
||||
let projects = $state(null);
|
||||
let companies = $state(null);
|
||||
const router = useTinyRouter();
|
||||
let error = $state(null);
|
||||
let projects = $state(null);
|
||||
let companies = $state(null);
|
||||
let showClosed = $state(router.query.closed == "show");
|
||||
|
||||
let sortedProjects = $derived.by(() => Object.values(projects).sort((a, b) => a.name.localeCompare(b.name)));
|
||||
|
||||
async function loadProjects(){
|
||||
let url = api('company/list');
|
||||
let url = api('company/list');
|
||||
let resp = await fetch(url,{credentials:'include'});
|
||||
if (resp.ok){
|
||||
companies = await resp.json();
|
||||
url = `${location.protocol}//${location.host.replace('5173','8080')}/api/project/list`;
|
||||
url = `${location.protocol}//${location.host.replace('5173','8080')}/api/project/list`;
|
||||
resp = await fetch(url,{
|
||||
credentials:'include',
|
||||
method:'POST',
|
||||
body:JSON.stringify({show_closed:showClosed})
|
||||
credentials : 'include',
|
||||
method : 'POST',
|
||||
body : JSON.stringify({show_closed:showClosed})
|
||||
});
|
||||
if (resp.ok){
|
||||
projects = await resp.json();
|
||||
@@ -35,14 +35,14 @@
|
||||
}
|
||||
|
||||
async function setState(pid,state_name){
|
||||
const url = api(`project/${pid}`);
|
||||
const url = api(`project/${pid}`);
|
||||
const resp = await fetch(url,{
|
||||
credentials:'include',
|
||||
method:'PATCH',
|
||||
body:JSON.stringify({status:state_name})
|
||||
credentials : 'include',
|
||||
method : 'PATCH',
|
||||
body : JSON.stringify({status:state_name})
|
||||
});
|
||||
if (resp.ok){
|
||||
var prj = await resp.json();
|
||||
var prj = await resp.json();
|
||||
projects[prj.id].status = prj.status;
|
||||
} else {
|
||||
error = await resp.text();
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
<script>
|
||||
import { onMount } from 'svelte';
|
||||
import { onMount } from 'svelte';
|
||||
import { useTinyRouter } from 'svelte-tiny-router';
|
||||
|
||||
import { api } from '../../urls.svelte.js';
|
||||
import { t } from '../../translations.svelte.js';
|
||||
import { api } from '../../urls.svelte.js';
|
||||
import { t } from '../../translations.svelte.js';
|
||||
|
||||
import LineEditor from '../../Components/LineEditor.svelte';
|
||||
import MarkdownEditor from '../../Components/MarkdownEditor.svelte';
|
||||
import MemberEditor from '../../Components/MemberEditor.svelte';
|
||||
import Notes from '../notes/List.svelte';
|
||||
import StateSelector from '../../Components/StateSelector.svelte';
|
||||
import Tags from '../tags/TagList.svelte';
|
||||
import TaskList from '../task/TaskList.svelte';
|
||||
import LineEditor from '../../Components/LineEditor.svelte';
|
||||
import MarkdownEditor from '../../Components/MarkdownEditor.svelte';
|
||||
import MemberEditor from '../../Components/MemberEditor.svelte';
|
||||
import Notes from '../notes/List.svelte';
|
||||
import StateSelector from '../../Components/StateSelector.svelte';
|
||||
import Tags from '../tags/TagList.svelte';
|
||||
import TaskList from '../task/TaskList.svelte';
|
||||
|
||||
let router = useTinyRouter();
|
||||
let { id } = $props();
|
||||
let project = $state(null);
|
||||
let error = $state(null);
|
||||
let tasks = $state(null);
|
||||
let { id } = $props();
|
||||
let error = $state(null);
|
||||
let estimated_time = $state({sum:0});
|
||||
let showSettings = $state(false);
|
||||
let project = $state(null);
|
||||
let router = useTinyRouter();
|
||||
let showSettings = $state(false);
|
||||
let tasks = $state(null);
|
||||
|
||||
async function addMember(entry){
|
||||
const ids = Object.keys(entry);
|
||||
@@ -40,11 +40,11 @@
|
||||
}
|
||||
|
||||
async function getCandidates(text){
|
||||
const url = api('user/search');
|
||||
var resp = await fetch(url,{
|
||||
credentials: 'include',
|
||||
method: 'POST',
|
||||
body: text
|
||||
const url = api('user/search');
|
||||
const resp = await fetch(url,{
|
||||
credentials : 'include',
|
||||
method : 'POST',
|
||||
body : text
|
||||
});
|
||||
if (resp.ok){
|
||||
var json = await resp.json();
|
||||
@@ -59,11 +59,11 @@
|
||||
}
|
||||
|
||||
async function loadProject(){
|
||||
const url = api(`project/${id}`);
|
||||
const url = api(`project/${id}`);
|
||||
const resp = await fetch(url,{credentials:'include'});
|
||||
if (resp.ok){
|
||||
project = await resp.json();
|
||||
error = null;
|
||||
error = null;
|
||||
loadTasks();
|
||||
} else {
|
||||
error = await resp.text();
|
||||
@@ -71,35 +71,35 @@
|
||||
}
|
||||
|
||||
async function loadTasks(){
|
||||
const url = api('task/list');
|
||||
const url = api('task/list');
|
||||
const data = {
|
||||
project_id:+id,
|
||||
show_closed:project.show_closed
|
||||
}
|
||||
const resp = await fetch(url,{
|
||||
credentials:'include',
|
||||
method:'POST',
|
||||
body:JSON.stringify(data)
|
||||
credentials : 'include',
|
||||
method : 'POST',
|
||||
body : JSON.stringify(data)
|
||||
});
|
||||
if (resp.ok){
|
||||
tasks = {};
|
||||
tasks = {};
|
||||
estimated_time.sum = 0;
|
||||
tasks = await resp.json();
|
||||
error = null;
|
||||
tasks = await resp.json();
|
||||
error = null;
|
||||
} else {
|
||||
error = await resp.text();
|
||||
}
|
||||
}
|
||||
|
||||
async function update(data){
|
||||
const url = api(`project/${id}`);
|
||||
const url = api(`project/${id}`);
|
||||
const resp = await fetch(url,{
|
||||
credentials:'include',
|
||||
method:'PATCH',
|
||||
body:JSON.stringify(data)
|
||||
credentials : 'include',
|
||||
method : 'PATCH',
|
||||
body : JSON.stringify(data)
|
||||
});
|
||||
if (resp.ok){
|
||||
error = null;
|
||||
error = null;
|
||||
project = await resp.json();
|
||||
return true;
|
||||
} else {
|
||||
@@ -114,7 +114,7 @@
|
||||
|
||||
|
||||
function updatePermission(user_id,permission){
|
||||
let members = {};
|
||||
let members = {};
|
||||
members[user_id] = permission.code;
|
||||
update({members:members});
|
||||
}
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
<script>
|
||||
import { onMount } from 'svelte';
|
||||
import {t} from '../../translations.svelte.js';
|
||||
|
||||
let key = "";
|
||||
import { t } from '../../translations.svelte.js';
|
||||
|
||||
let fulltext = false;
|
||||
let html = "";
|
||||
let html = "";
|
||||
let key = "";
|
||||
|
||||
async function doSearch(ev){
|
||||
if (ev) ev.preventDefault();
|
||||
const url = `${location.protocol}//${location.host.replace('5173','8080')}/legacy/search`;
|
||||
const url = `${location.protocol}//${location.host.replace('5173','8080')}/legacy/search`;
|
||||
const resp = await fetch(url,{
|
||||
credentials:'include',
|
||||
method : 'POST',
|
||||
body: JSON.stringify({key:key,fulltext:fulltext?'on':'off'})
|
||||
credentials : 'include',
|
||||
method : 'POST',
|
||||
body : JSON.stringify({key:key,fulltext:fulltext?'on':'off'})
|
||||
});
|
||||
if (resp.ok){
|
||||
html = await resp.text();
|
||||
@@ -22,7 +23,7 @@
|
||||
|
||||
onMount(() => {
|
||||
let params = new URLSearchParams(location.search);
|
||||
key = params.get('key');
|
||||
key = params.get('key');
|
||||
if (key) doSearch();
|
||||
});
|
||||
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
<script>
|
||||
import {onMount} from 'svelte';
|
||||
|
||||
import {api} from '../../urls.svelte.js';
|
||||
import {t} from '../../translations.svelte.js';
|
||||
import {user} from '../../user.svelte.js'
|
||||
import { api } from '../../urls.svelte.js';
|
||||
import { t } from '../../translations.svelte.js';
|
||||
import { user } from '../../user.svelte.js'
|
||||
|
||||
import Editor from '../../Components/LineEditor.svelte';
|
||||
import Editor from '../../Components/LineEditor.svelte';
|
||||
|
||||
let {
|
||||
id = null,
|
||||
id = null,
|
||||
module,
|
||||
tags = $bindable([]),
|
||||
tags = $bindable([]),
|
||||
user_list = [],
|
||||
} = $props();
|
||||
let error = $state(null);
|
||||
let error = $state(null);
|
||||
let newTag = $state('');
|
||||
|
||||
async function addTag(tag){
|
||||
@@ -25,14 +25,14 @@
|
||||
}
|
||||
const url = api(`tags/${module}/${id}`);
|
||||
const resp = await fetch(url,{
|
||||
credentials:'include',
|
||||
method:'POST',
|
||||
body: JSON.stringify({tag:tag,user_list:user_list})
|
||||
credentials : 'include',
|
||||
method : 'POST',
|
||||
body : JSON.stringify({tag:tag,user_list:user_list})
|
||||
});
|
||||
if (resp.ok){
|
||||
tag = await resp.text();
|
||||
tags.push(tag);
|
||||
tags = tags.sort();
|
||||
tags = tags.sort();
|
||||
error = null;
|
||||
} else {
|
||||
error = await resp.text();
|
||||
@@ -47,12 +47,12 @@
|
||||
}
|
||||
const url = api(`tags/${module}/${id}`);
|
||||
const resp = await fetch(url,{
|
||||
credentials:'include',
|
||||
method:'DELETE',
|
||||
body: tag
|
||||
credentials : 'include',
|
||||
method : 'DELETE',
|
||||
body : tag
|
||||
});
|
||||
if (resp.ok){
|
||||
tag = await resp.text();
|
||||
tag = await resp.text();
|
||||
tags = tags.filter(item => item !== tag);
|
||||
} else {
|
||||
error = await resp.text();
|
||||
@@ -62,7 +62,7 @@
|
||||
|
||||
async function loadTags(entityId){
|
||||
if (!entityId) return; // when crating elements, they dont`t have an id, yet.
|
||||
const url = api(`tags/${module}/${entityId}`);
|
||||
const url = api(`tags/${module}/${entityId}`);
|
||||
const resp = await fetch(url,{credentials:'include'});
|
||||
if (resp.ok) {
|
||||
tags = await resp.json();
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
<script>
|
||||
import { onMount } from 'svelte';
|
||||
import { onMount } from 'svelte';
|
||||
import { useTinyRouter } from 'svelte-tiny-router';
|
||||
|
||||
import { t } from '../../translations.svelte.js';
|
||||
import { api } from '../../urls.svelte.js';
|
||||
import { user } from '../../user.svelte.js';
|
||||
import { api } from '../../urls.svelte.js';
|
||||
import { t } from '../../translations.svelte.js';
|
||||
import { user } from '../../user.svelte.js';
|
||||
|
||||
import MarkdownEditor from '../../Components/MarkdownEditor.svelte';
|
||||
import MemberEditor from '../../Components/MemberEditor.svelte';
|
||||
import Tags from '../tags/TagList.svelte';
|
||||
import MarkdownEditor from '../../Components/MarkdownEditor.svelte';
|
||||
import MemberEditor from '../../Components/MemberEditor.svelte';
|
||||
import Tags from '../tags/TagList.svelte';
|
||||
|
||||
let { project_id = null, parent_task_id } = $props();
|
||||
let error = $state(null);
|
||||
let project = $state(null);
|
||||
let error = $state(null);
|
||||
let project = $state(null);
|
||||
let extendedSettings = $state(false);
|
||||
let parent_task = $state(null);
|
||||
let parent_task = $state(null);
|
||||
let task = $state({
|
||||
name : '',
|
||||
description : { source : '', rendered : '' },
|
||||
due_date: null,
|
||||
estimated_time: null,
|
||||
no_index: false,
|
||||
members : {},
|
||||
show_closed: false,
|
||||
start_date: null,
|
||||
tags: []
|
||||
name : '',
|
||||
description : { source : '', rendered : '' },
|
||||
due_date : null,
|
||||
estimated_time : null,
|
||||
no_index : false,
|
||||
members : {},
|
||||
show_closed : false,
|
||||
start_date : null,
|
||||
tags : []
|
||||
});
|
||||
let router = useTinyRouter();
|
||||
|
||||
@@ -44,28 +44,28 @@
|
||||
}
|
||||
|
||||
async function loadParent(){
|
||||
const url = api(`task/${parent_task_id}`);
|
||||
const url = api(`task/${parent_task_id}`);
|
||||
const resp = await fetch(url,{credentials:'include'});
|
||||
if (resp.ok){
|
||||
parent_task = await resp.json();
|
||||
parent_task = await resp.json();
|
||||
task.parent_task_id = +parent_task_id;
|
||||
project_id = parent_task.project_id;
|
||||
error = null;
|
||||
project = null; // TODO
|
||||
project_id = parent_task.project_id;
|
||||
error = null;
|
||||
project = null; // TODO
|
||||
} else {
|
||||
error = await resp.text();
|
||||
}
|
||||
}
|
||||
|
||||
async function loadProject(){
|
||||
var url = api(`project/${project_id}`);
|
||||
const url = api(`project/${project_id}`);
|
||||
const resp = await fetch(url,{credentials:'include'});
|
||||
if (resp.ok){
|
||||
project = await resp.json();
|
||||
task.project_id = +project_id;
|
||||
project = await resp.json();
|
||||
task.project_id = +project_id;
|
||||
let member_source = parent_task?parent_task.members:project.members;
|
||||
task.members = JSON.parse(JSON.stringify(member_source)); // deep copy
|
||||
error = null;
|
||||
task.members = JSON.parse(JSON.stringify(member_source)); // deep copy
|
||||
error = null;
|
||||
} else {
|
||||
error = await resp.text();
|
||||
}
|
||||
@@ -98,11 +98,11 @@
|
||||
}
|
||||
|
||||
async function saveTask(){
|
||||
var url = api('task/add');
|
||||
const url = api('task/add');
|
||||
const resp = await fetch(url,{
|
||||
credentials:'include',
|
||||
method:'POST',
|
||||
body: JSON.stringify(task)
|
||||
credentials : 'include',
|
||||
method : 'POST',
|
||||
body : JSON.stringify(task)
|
||||
});
|
||||
if (resp.ok) {
|
||||
task = await resp.json();
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
<script>
|
||||
import { onMount } from 'svelte';
|
||||
import { onMount } from 'svelte';
|
||||
import { useTinyRouter } from 'svelte-tiny-router';
|
||||
|
||||
import { t } from '../../translations.svelte.js';
|
||||
import { api } from '../../urls.svelte.js';
|
||||
import { api } from '../../urls.svelte.js';
|
||||
import { t } from '../../translations.svelte.js';
|
||||
|
||||
import TaskList from './TaskList.svelte';
|
||||
import LineEditor from '../../Components/LineEditor.svelte';
|
||||
import TaskList from './TaskList.svelte';
|
||||
import LineEditor from '../../Components/LineEditor.svelte';
|
||||
|
||||
const router = useTinyRouter();
|
||||
let { estimated_time, show_closed, task } = $props();
|
||||
let children = $state(null);
|
||||
let error = $state(null);
|
||||
let start = 0;
|
||||
let deleted = $state(false);
|
||||
let deleted = $state(false);
|
||||
let error = $state(null);
|
||||
const router = useTinyRouter();
|
||||
let start = 0;
|
||||
|
||||
function addSubtask(){
|
||||
router.navigate(`/task/${task.id}/add_subtask`);
|
||||
@@ -21,10 +21,10 @@
|
||||
|
||||
async function deleteTask(){
|
||||
if (confirm(t('confirm_delete',{element:task.name}))){
|
||||
const url = api(`task/${task.id}`);
|
||||
const url = api(`task/${task.id}`);
|
||||
const resp = await fetch(url,{
|
||||
credentials:'include',
|
||||
method:'DELETE'
|
||||
credentials : 'include',
|
||||
method : 'DELETE'
|
||||
});
|
||||
if (resp.ok){
|
||||
deleted = true;
|
||||
@@ -35,20 +35,20 @@
|
||||
}
|
||||
|
||||
async function loadChildren(){
|
||||
const url = api('task/list');
|
||||
var data = {
|
||||
parent_task_id:+task.id,
|
||||
show_closed: show_closed
|
||||
const url = api('task/list');
|
||||
const data = {
|
||||
parent_task_id : +task.id,
|
||||
show_closed : show_closed
|
||||
};
|
||||
if (task.show_closed) data.show_closed = true;
|
||||
const resp = await fetch(url,{
|
||||
credentials:'include',
|
||||
method:'POST',
|
||||
body:JSON.stringify(data)
|
||||
credentials : 'include',
|
||||
method : 'POST',
|
||||
body : JSON.stringify(data)
|
||||
});
|
||||
if (resp.ok){
|
||||
children = await resp.json();
|
||||
error = null;
|
||||
error = null;
|
||||
} else {
|
||||
error = await resp.text();
|
||||
}
|
||||
@@ -59,11 +59,11 @@
|
||||
}
|
||||
|
||||
async function patchTask(changeset){
|
||||
const url = api(`task/${task.id}`);
|
||||
const url = api(`task/${task.id}`);
|
||||
const resp = await fetch(url,{
|
||||
credentials:'include',
|
||||
method: 'PATCH',
|
||||
body: JSON.stringify(changeset)
|
||||
credentials : 'include',
|
||||
method : 'PATCH',
|
||||
body : JSON.stringify(changeset)
|
||||
});
|
||||
if (resp.ok){
|
||||
task = await resp.json();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script>
|
||||
import { t } from '../../translations.svelte.js';
|
||||
import { t } from '../../translations.svelte.js';
|
||||
import ListTask from './ListTask.svelte';
|
||||
|
||||
let { estimated_time, show_closed, tasks } = $props();
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
<script>
|
||||
import { onMount } from 'svelte';
|
||||
import { onMount } from 'svelte';
|
||||
import { useTinyRouter } from 'svelte-tiny-router';
|
||||
|
||||
import { t } from '../../translations.svelte.js';
|
||||
import { api } from '../../urls.svelte.js';
|
||||
import { api } from '../../urls.svelte.js';
|
||||
import { t } from '../../translations.svelte.js';
|
||||
|
||||
import LineEditor from '../../Components/LineEditor.svelte';
|
||||
import LineEditor from '../../Components/LineEditor.svelte';
|
||||
import MarkdownEditor from '../../Components/MarkdownEditor.svelte';
|
||||
import MemberEditor from '../../Components/MemberEditor.svelte';
|
||||
import Notes from '../notes/List.svelte';
|
||||
import StateSelector from '../../Components/StateSelector.svelte';
|
||||
import TagList from '../tags/TagList.svelte';
|
||||
import TaskList from './TaskList.svelte';
|
||||
import MemberEditor from '../../Components/MemberEditor.svelte';
|
||||
import Notes from '../notes/List.svelte';
|
||||
import StateSelector from '../../Components/StateSelector.svelte';
|
||||
import TagList from '../tags/TagList.svelte';
|
||||
import TaskList from './TaskList.svelte';
|
||||
|
||||
const router = useTinyRouter();
|
||||
let { id } = $props();
|
||||
let task = $state(null);
|
||||
let project = $state(null);
|
||||
let error = $state(null);
|
||||
let children = $state(null);
|
||||
let { id } = $props();
|
||||
let children = $state(null);
|
||||
let dummy = $derived(updateOn(id));
|
||||
let error = $state(null);
|
||||
let estimated_time = $state({sum:0});
|
||||
let dummy = $derived(updateOn(id));
|
||||
let showSettings = $state(false);
|
||||
let project = $state(null);
|
||||
const router = useTinyRouter();
|
||||
let showSettings = $state(false);
|
||||
let task = $state(null);
|
||||
|
||||
$effect(() => updateOn(id));
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
}
|
||||
|
||||
async function getCandidates(text){
|
||||
const origin = task.parent ? task.parent.members : project.members;
|
||||
const origin = task.parent ? task.parent.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]);
|
||||
@@ -52,37 +52,37 @@
|
||||
}
|
||||
|
||||
async function loadChildren(){
|
||||
const url = api('task/list');
|
||||
var data = {
|
||||
parent_task_id:+task.id,
|
||||
show_closed: task.show_closed
|
||||
const url = api('task/list');
|
||||
const data = {
|
||||
parent_task_id : +task.id,
|
||||
show_closed : task.show_closed
|
||||
};
|
||||
const resp = await fetch(url,{
|
||||
credentials:'include',
|
||||
method:'POST',
|
||||
credentials : 'include',
|
||||
method : 'POST',
|
||||
body:JSON.stringify(data)
|
||||
});
|
||||
if (resp.ok){
|
||||
children = await resp.json();
|
||||
error = null;
|
||||
error = null;
|
||||
} else {
|
||||
error = await resp.text();
|
||||
}
|
||||
}
|
||||
|
||||
async function loadProject(){
|
||||
const url = api(`project/${task.project_id}`);
|
||||
const url = api(`project/${task.project_id}`);
|
||||
const resp = await fetch(url,{credentials:'include'});
|
||||
if (resp.ok){
|
||||
project = await resp.json();
|
||||
error = null;
|
||||
error = null;
|
||||
} else {
|
||||
error = await resp.text();
|
||||
}
|
||||
}
|
||||
|
||||
async function loadParent(){
|
||||
const url = api(`task/${task.parent_task_id}`);
|
||||
const url = api(`task/${task.parent_task_id}`);
|
||||
const resp = await fetch(url,{credentials:'include'});
|
||||
if (resp.ok){
|
||||
task.parent = await resp.json();
|
||||
@@ -92,12 +92,12 @@
|
||||
}
|
||||
|
||||
async function loadTask(){
|
||||
const url = api(`task/${id}`);
|
||||
const url = api(`task/${id}`);
|
||||
const resp = await fetch(url,{credentials:'include'});
|
||||
if (resp.ok){
|
||||
task = await resp.json();
|
||||
error = null;
|
||||
project = null;
|
||||
task = await resp.json();
|
||||
error = null;
|
||||
project = null;
|
||||
children = null;
|
||||
loadChildren();
|
||||
if (task.project_id) loadProject();
|
||||
@@ -122,15 +122,15 @@
|
||||
}
|
||||
|
||||
async function update(data){
|
||||
const url = api(`task/${id}`);
|
||||
const url = api(`task/${id}`);
|
||||
const resp = await fetch(url,{
|
||||
credentials:'include',
|
||||
method:'PATCH',
|
||||
body:JSON.stringify(data)
|
||||
credentials : 'include',
|
||||
method : 'PATCH',
|
||||
body : JSON.stringify(data)
|
||||
});
|
||||
if (resp.ok){
|
||||
error = null;
|
||||
task = await resp.json();
|
||||
task = await resp.json();
|
||||
return true;
|
||||
} else {
|
||||
error = await resp.text();
|
||||
@@ -147,7 +147,7 @@
|
||||
}
|
||||
|
||||
function updatePermission(user_id,permission){
|
||||
let members = {};
|
||||
let members = {};
|
||||
members[user_id] = permission.code;
|
||||
update({members:members});
|
||||
}
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
<script>
|
||||
import { t } from '../../translations.svelte.js';
|
||||
import { user } from '../../user.svelte.js';
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
import { api } from '../../urls.svelte.js';
|
||||
import { t } from '../../translations.svelte.js';
|
||||
import { user } from '../../user.svelte.js';
|
||||
|
||||
let connections = $state([]);
|
||||
|
||||
async function loadConnections(){
|
||||
let url = `${location.protocol}//${location.host.replace('5173','8080')}/api/user/oidc/connected`;
|
||||
|
||||
let resp = await fetch(url,{credentials:'include'});
|
||||
const url = api('/user/oidc/connected');
|
||||
const resp = await fetch(url,{credentials:'include'});
|
||||
if (resp.ok){
|
||||
const arr = await resp.json();
|
||||
while (connections.length) connections.pop();
|
||||
@@ -19,11 +20,11 @@
|
||||
onMount(loadConnections);
|
||||
|
||||
async function unlink(connection){
|
||||
const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/user/oidc/connected`;
|
||||
const url = api('user/oidc/connected');
|
||||
const resp = await fetch(url,{
|
||||
method: 'DELETE',
|
||||
credentials: 'include',
|
||||
body: JSON.stringify(connection)
|
||||
method : 'DELETE',
|
||||
credentials : 'include',
|
||||
body : JSON.stringify(connection)
|
||||
});
|
||||
if (resp.ok){
|
||||
loadConnections();
|
||||
|
||||
@@ -1,35 +1,34 @@
|
||||
<script>
|
||||
import { t } from '../../translations.svelte.js';
|
||||
import { api } from '../../urls.svelte.js';
|
||||
import { t } from '../../translations.svelte.js';
|
||||
|
||||
let { editPassword = $bindable() } = $props();
|
||||
|
||||
let oldPass = $state("");
|
||||
let newPass = $state("");
|
||||
let repeat = $state("");
|
||||
let caption = $state(t('update'));
|
||||
|
||||
let oldEmpty = $derived(!/\S/.test(oldPass));
|
||||
let newEmpty = $derived(!/\S/.test(newPass));
|
||||
let caption = $state(t('update'));
|
||||
let error = $state("");
|
||||
let newPass = $state("");
|
||||
let mismatch = $derived(newPass != repeat);
|
||||
|
||||
let error = $state("");
|
||||
let sent = $state(false);
|
||||
let newEmpty = $derived(!/\S/.test(newPass));
|
||||
let oldPass = $state("");
|
||||
let oldEmpty = $derived(!/\S/.test(oldPass));
|
||||
let repeat = $state("");
|
||||
let sent = $state(false);
|
||||
|
||||
function abort(){
|
||||
editPassword = false;
|
||||
}
|
||||
|
||||
async function submit(){
|
||||
caption = t('data_sent');
|
||||
const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/user/password`;
|
||||
caption = t('data_sent');
|
||||
const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/user/password`;
|
||||
const data = {
|
||||
old: oldPass,
|
||||
new: newPass
|
||||
old : oldPass,
|
||||
new : newPass
|
||||
};
|
||||
const resp = await fetch(url,{
|
||||
method: 'PATCH',
|
||||
body: JSON.stringify(data),
|
||||
credentials: 'include'
|
||||
method : 'PATCH',
|
||||
body : JSON.stringify(data),
|
||||
credentials : 'include'
|
||||
});
|
||||
|
||||
if (resp.ok){
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
<script>
|
||||
import { onMount } from 'svelte';
|
||||
import { t } from '../../translations.svelte.js';
|
||||
import { onMount } from 'svelte';
|
||||
import { useTinyRouter } from 'svelte-tiny-router';
|
||||
|
||||
import { api } from '../../urls.svelte.js'
|
||||
import { t } from '../../translations.svelte.js';
|
||||
|
||||
let caption = $state(t('save_service'));
|
||||
let disabled = $state(false);
|
||||
let service = $state({})
|
||||
let { serviceName } = $props();
|
||||
let service = $state({})
|
||||
let caption = $state(t('save_service'));
|
||||
let message = $state(t('loading_data'));
|
||||
let router = useTinyRouter();
|
||||
let disabled = $state(false);
|
||||
let message = $state(t('loading_data'));
|
||||
let router = useTinyRouter();
|
||||
|
||||
onMount(async () => {
|
||||
const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/user/oidc/${serviceName}`;
|
||||
const url = api(`user/oidc/${serviceName}`);
|
||||
const resp = await fetch(url,{credentials:'include'});
|
||||
if (resp.ok){
|
||||
const json = await resp.json();
|
||||
@@ -23,12 +25,12 @@
|
||||
});
|
||||
|
||||
async function update(){
|
||||
caption = t('data_sent');
|
||||
const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/user/oidc/${serviceName}`;
|
||||
caption = t('data_sent');
|
||||
const url = api(`user/oidc/${serviceName}`);
|
||||
const resp = await fetch(url,{
|
||||
credentials: 'include',
|
||||
method: 'PATCH',
|
||||
body: JSON.stringify(service)
|
||||
credentials : 'include',
|
||||
method : 'PATCH',
|
||||
body : JSON.stringify(service)
|
||||
});
|
||||
if (resp.ok){
|
||||
caption = t('saved');
|
||||
|
||||
@@ -1,34 +1,33 @@
|
||||
<script>
|
||||
|
||||
import { t } from '../../translations.svelte.js';
|
||||
import { useTinyRouter } from 'svelte-tiny-router';
|
||||
import { onMount } from 'svelte';
|
||||
import { checkUser } from '../../user.svelte.js';
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
const router = useTinyRouter();
|
||||
import { api } from '../../urls.svelte.js'
|
||||
import { checkUser } from '../../user.svelte.js';
|
||||
import { t } from '../../translations.svelte.js';
|
||||
|
||||
let { user_id } = $props();
|
||||
|
||||
let editUser = $state(null);
|
||||
let options = $state([]);
|
||||
let sent = $state(false);
|
||||
let caption = $state(t('save_user'));
|
||||
let message = $state(t('loading_data'));
|
||||
let caption = $state(t('save_user'));
|
||||
let editUser = $state(null);
|
||||
let message = $state(t('loading_data'));
|
||||
let options = $state([]);
|
||||
const router = useTinyRouter();
|
||||
let sent = $state(false);
|
||||
|
||||
onMount(async () => {
|
||||
let url = `${location.protocol}//${location.host.replace('5173','8080')}/themes.json`;
|
||||
let url = `${location.protocol}//${location.host.replace('5173','8080')}/themes.json`;
|
||||
let resp = await fetch(url);
|
||||
if (resp.ok){
|
||||
const arr = await resp.json();
|
||||
for (let entry of arr){
|
||||
const value = entry.value;
|
||||
const value = entry.value;
|
||||
const caption = entry.caption ? entry.caption : value;
|
||||
options.push({caption:caption,value:value})
|
||||
}
|
||||
}
|
||||
|
||||
if (user_id) {
|
||||
url = `${location.protocol}//${location.host.replace('5173','8080')}/api/user/${user_id}`;
|
||||
url = api(`user/${user_id}`);
|
||||
resp = await fetch(url,{credentials:'include'});
|
||||
if (resp.ok) {
|
||||
editUser = await resp.json();
|
||||
@@ -43,20 +42,20 @@
|
||||
|
||||
async function save(ev){
|
||||
ev.preventDefault();
|
||||
sent = true;
|
||||
caption = t('data_sent');
|
||||
sent = true;
|
||||
caption = t('data_sent');
|
||||
let method = 'PATCH';
|
||||
let url = null;
|
||||
let url = null;
|
||||
if (user_id) {
|
||||
url = `${location.protocol}//${location.host.replace('5173','8080')}/api/user/${user_id}`;
|
||||
url = api(`user/${user_id}`);
|
||||
} else {
|
||||
url = `${location.protocol}//${location.host.replace('5173','8080')}/api/user/create`;
|
||||
url = api('user/create');
|
||||
method = 'POST';
|
||||
}
|
||||
let resp = await fetch(url,{
|
||||
method: method,
|
||||
credentials: 'include',
|
||||
body: JSON.stringify(editUser)
|
||||
method : method,
|
||||
credentials : 'include',
|
||||
body : JSON.stringify(editUser)
|
||||
});
|
||||
if (resp.ok){
|
||||
caption = t('saved');
|
||||
|
||||
@@ -1,27 +1,28 @@
|
||||
<script>
|
||||
import { onMount } from 'svelte';
|
||||
import { t } from '../../translations.svelte.js';
|
||||
import { onMount } from 'svelte';
|
||||
import { useTinyRouter } from 'svelte-tiny-router';
|
||||
import { user } from '../../user.svelte.js';
|
||||
|
||||
import { api } from '../../urls.svelte.js';
|
||||
import { t } from '../../translations.svelte.js';
|
||||
import { user } from '../../user.svelte.js';
|
||||
|
||||
const router = useTinyRouter();
|
||||
let users = $state([]);
|
||||
|
||||
let users = $state([]);
|
||||
|
||||
onMount(async () => {
|
||||
const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/user/list`;
|
||||
async function listUsers(){
|
||||
const url = api('user/list');
|
||||
const resp = await fetch(url,{credentials:'include'});
|
||||
if (resp.ok){
|
||||
const json = await resp.json();
|
||||
for (let u of json) users.push(u);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function impersonate(userId){
|
||||
const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/user/${userId}/impersonate`;
|
||||
const url = api(`user/${userId}/impersonate`);
|
||||
const resp = await fetch(url,{
|
||||
method: 'POST',
|
||||
credentials: 'include'
|
||||
method : 'POST',
|
||||
credentials : 'include'
|
||||
});
|
||||
if (resp.ok){
|
||||
const json = await resp.json();
|
||||
@@ -29,6 +30,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
onMount(listUsers);
|
||||
</script>
|
||||
|
||||
<fieldset tabindex="0">
|
||||
|
||||
@@ -1,27 +1,16 @@
|
||||
<script>
|
||||
import { onMount } from 'svelte';
|
||||
import { t } from '../../translations.svelte.js';
|
||||
import { onMount } from 'svelte';
|
||||
import { useTinyRouter } from 'svelte-tiny-router';
|
||||
import { user } from '../../user.svelte.js';
|
||||
|
||||
import { api } from '../../urls.svelte.js';
|
||||
import { t } from '../../translations.svelte.js';
|
||||
import { user } from '../../user.svelte.js';
|
||||
|
||||
const router = useTinyRouter();
|
||||
|
||||
let services = $state([]);
|
||||
|
||||
async function loadButtons(){
|
||||
const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/user/oidc/buttons`;
|
||||
const resp = await fetch(url,{credentials:'include'});
|
||||
if (resp.ok){
|
||||
const json = await resp.json();
|
||||
while (services.length) services.pop();
|
||||
for (let service of json) services.push(service);
|
||||
}
|
||||
}
|
||||
|
||||
onMount(loadButtons);
|
||||
|
||||
async function connect(service){
|
||||
const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/user/oidc/redirect/${service}`;
|
||||
const url = api(`user/oidc/redirect/${service}`);
|
||||
const resp = await fetch(url,{credentials:'include'});
|
||||
if (resp.ok){
|
||||
var json = await resp.json();
|
||||
@@ -33,14 +22,26 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function loadButtons(){
|
||||
const url = api(`user/oidc/buttons`);
|
||||
const resp = await fetch(url,{credentials:'include'});
|
||||
if (resp.ok){
|
||||
const json = await resp.json();
|
||||
while (services.length) services.pop();
|
||||
for (let service of json) services.push(service);
|
||||
}
|
||||
}
|
||||
|
||||
async function drop(service){
|
||||
const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/user/oidc/${service}`;
|
||||
const url = api(`user/oidc/${service}`);
|
||||
const resp = await fetch(url,{
|
||||
credentials: 'include',
|
||||
method: 'DELETE'
|
||||
credentials : 'include',
|
||||
method : 'DELETE'
|
||||
});
|
||||
if (resp.ok) loadButtons();
|
||||
}
|
||||
|
||||
onMount(loadButtons);
|
||||
</script>
|
||||
|
||||
<fieldset tabindex="0">
|
||||
|
||||
@@ -1,24 +1,26 @@
|
||||
<script>
|
||||
import { onMount } from 'svelte';
|
||||
import { t } from '../../translations.svelte.js';
|
||||
import { onMount } from 'svelte';
|
||||
import { useTinyRouter } from 'svelte-tiny-router';
|
||||
import { checkUser } from '../../user.svelte.js';
|
||||
|
||||
import { api } from '../../urls.svelte.js';
|
||||
import { t } from '../../translations.svelte.js';
|
||||
import { checkUser } from '../../user.svelte.js';
|
||||
|
||||
const router = useTinyRouter();
|
||||
let message = $state(t('processing_code'));
|
||||
|
||||
let message = $state(t('processing_code'));
|
||||
onMount(async () => {
|
||||
async function process(){
|
||||
let params = new URLSearchParams(location.search);
|
||||
|
||||
if (params.get('code')){
|
||||
const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/user/oidc/token`;
|
||||
const url = api('user/oidc/token');
|
||||
const resp = await fetch(url,{
|
||||
method : 'POST',
|
||||
body: JSON.stringify(Object.fromEntries(params)),
|
||||
credentials: 'include'
|
||||
method : 'POST',
|
||||
body : JSON.stringify(Object.fromEntries(params)),
|
||||
credentials : 'include'
|
||||
});
|
||||
if (resp.ok){
|
||||
let json = await resp.json();
|
||||
let json = await resp.json();
|
||||
const redirect = json.redirect ? json.redirect : '/user';
|
||||
checkUser();
|
||||
router.navigate(redirect);
|
||||
@@ -27,7 +29,9 @@
|
||||
if (!message) message = t(resp);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onMount(process);
|
||||
</script>
|
||||
|
||||
{message}
|
||||
@@ -1,14 +1,15 @@
|
||||
<script>
|
||||
import { t } from '../../translations.svelte.js';
|
||||
import { user } from '../../user.svelte.js';
|
||||
import { useTinyRouter } from 'svelte-tiny-router';
|
||||
|
||||
import EditPassword from './EditPassword.svelte';
|
||||
const router = useTinyRouter();
|
||||
import { t } from '../../translations.svelte.js';
|
||||
import { user } from '../../user.svelte.js';
|
||||
|
||||
import EditPassword from './EditPassword.svelte';
|
||||
|
||||
const router = useTinyRouter();
|
||||
let editPassword = false;
|
||||
|
||||
</script>
|
||||
|
||||
<fieldset>
|
||||
<legend>
|
||||
{t('your_profile')}
|
||||
|
||||
@@ -1,19 +1,21 @@
|
||||
<script>
|
||||
import { onMount } from 'svelte';
|
||||
import { t } from '../../translations.svelte.js';
|
||||
import { onMount } from 'svelte';
|
||||
import { useTinyRouter } from 'svelte-tiny-router';
|
||||
|
||||
let mail = "";
|
||||
let caption = t('send_mail');
|
||||
let error = null;
|
||||
import { api } from '../../urls.svelte.js';
|
||||
import { t } from '../../translations.svelte.js';
|
||||
|
||||
let caption = t('send_mail');
|
||||
let error = null;
|
||||
let mail = "";
|
||||
const router = useTinyRouter();
|
||||
|
||||
async function submit(ev){
|
||||
ev.preventDefault();
|
||||
const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/user/reset_pw`;
|
||||
const url = api(`user/reset_pw`);
|
||||
const resp = await fetch(url,{
|
||||
method : 'POST',
|
||||
body : mail
|
||||
body : mail
|
||||
});
|
||||
if (resp.ok) {
|
||||
caption = t('data_sent');
|
||||
@@ -24,9 +26,9 @@
|
||||
|
||||
async function checkToken(){
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const token = urlParams.get('token');
|
||||
const token = urlParams.get('token');
|
||||
if (token) {
|
||||
const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/user/validate/${token}`;
|
||||
const url = api(`user/validate/${token}`);
|
||||
const resp = await fetch(url,{
|
||||
credentials: 'include'
|
||||
});
|
||||
@@ -46,13 +48,13 @@
|
||||
<style>
|
||||
label{display:block}
|
||||
fieldset{
|
||||
display: block;
|
||||
position: relative;
|
||||
left: 50%;
|
||||
width: 200px;
|
||||
margin-left: -100px;
|
||||
margin-bottom: 30px;
|
||||
text-align: center;
|
||||
display : block;
|
||||
position : relative;
|
||||
left : 50%;
|
||||
width : 200px;
|
||||
margin-left : -100px;
|
||||
margin-bottom : 30px;
|
||||
text-align : center;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
<script>
|
||||
import { t } from '../../translations.svelte.js';
|
||||
import { user } from '../../user.svelte.js';
|
||||
import { user } from '../../user.svelte.js';
|
||||
import { t } from '../../translations.svelte.js';
|
||||
|
||||
import Services from './ConnectedServices.svelte';
|
||||
import Services from './ConnectedServices.svelte';
|
||||
import LoginServiceList from './LoginServices.svelte';
|
||||
import Profile from './Profile.svelte';
|
||||
import UserList from './List.svelte';
|
||||
import Profile from './Profile.svelte';
|
||||
import UserList from './List.svelte';
|
||||
|
||||
let params = new URLSearchParams(location.search);
|
||||
let params = new URLSearchParams(location.search);
|
||||
let redirect = params.get('returnTo');
|
||||
if (redirect && user.name){
|
||||
location.href = redirect;
|
||||
}
|
||||
if (redirect && user.name) location.href = redirect;
|
||||
</script>
|
||||
|
||||
<h1>{t('user_module')}</h1>
|
||||
|
||||
Reference in New Issue
Block a user