code cleanup
This commit is contained in:
@@ -1,8 +1,10 @@
|
|||||||
<script>
|
<script>
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
|
import { Router, Route } from 'svelte-tiny-router';
|
||||||
|
|
||||||
import { loadTranslation } from './translations.svelte.js';
|
import { loadTranslation } from './translations.svelte.js';
|
||||||
import { user } from './user.svelte.js';
|
import { user } from './user.svelte.js';
|
||||||
import { Router, Route } from 'svelte-tiny-router';
|
|
||||||
import AddDoc from "./routes/document/Add.svelte";
|
import AddDoc from "./routes/document/Add.svelte";
|
||||||
import AddTask from "./routes/task/Add.svelte";
|
import AddTask from "./routes/task/Add.svelte";
|
||||||
import Callback from "./routes/user/OidcCallback.svelte";
|
import Callback from "./routes/user/OidcCallback.svelte";
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { useTinyRouter } from 'svelte-tiny-router';
|
import { useTinyRouter } from 'svelte-tiny-router';
|
||||||
|
|
||||||
import { api } from '../urls.svelte.js';
|
|
||||||
import { logout, user } from '../user.svelte.js';
|
import { logout, user } from '../user.svelte.js';
|
||||||
import { t } from '../translations.svelte.js';
|
import { t } from '../translations.svelte.js';
|
||||||
|
|
||||||
@@ -10,7 +9,7 @@ const router = useTinyRouter();
|
|||||||
const modules = $state([]);
|
const modules = $state([]);
|
||||||
|
|
||||||
async function fetchModules(){
|
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'});
|
const resp = await fetch(url,{credentials:'include'});
|
||||||
if (resp.ok){
|
if (resp.ok){
|
||||||
const arr = await resp.json();
|
const arr = await resp.json();
|
||||||
|
|||||||
@@ -11,9 +11,9 @@
|
|||||||
|
|
||||||
let error = null;
|
let error = null;
|
||||||
let companies = {};
|
let companies = {};
|
||||||
|
let router = useTinyRouter();
|
||||||
let company_id = +router.query.company_id;
|
let company_id = +router.query.company_id;
|
||||||
let documents = null;
|
let documents = null;
|
||||||
let router = useTinyRouter();
|
|
||||||
let docType = 0;
|
let docType = 0;
|
||||||
let selected_company = null;
|
let selected_company = null;
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
|
|
||||||
async function deleteDoc(ev,doc){
|
async function deleteDoc(ev,doc){
|
||||||
if (confirm(t('really_delete',doc.number))){
|
if (confirm(t('really_delete',doc.number))){
|
||||||
const url = api(`document/${doc.id}`;
|
const url = api(`document/${doc.id}`);
|
||||||
const resp = await fetch(url,{
|
const resp = await fetch(url,{
|
||||||
credentials: 'include',
|
credentials: 'include',
|
||||||
method: 'DELETE'
|
method: 'DELETE'
|
||||||
|
|||||||
@@ -2,14 +2,14 @@
|
|||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { useTinyRouter } from 'svelte-tiny-router';
|
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 { t } from '../../translations.svelte.js';
|
||||||
|
|
||||||
import Position from './Position.svelte';
|
import Position from './Position.svelte';
|
||||||
|
|
||||||
var {
|
var {
|
||||||
document = $bindable(null),
|
document = $bindable(null),
|
||||||
error = $bindable(null)
|
error = $bindable(null),
|
||||||
submit = (key,newVal) => {},
|
submit = (key,newVal) => {},
|
||||||
} = $props();
|
} = $props();
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function movePos(number,step){
|
async function movePos(number,step){
|
||||||
const url = api(`document/${document.id}/position`;
|
const url = api(`document/${document.id}/position`);
|
||||||
const resp = await fetch(url,{
|
const resp = await fetch(url,{
|
||||||
method : 'PATCH',
|
method : 'PATCH',
|
||||||
credentials: 'include',
|
credentials: 'include',
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
async function drop(number){
|
async function drop(number){
|
||||||
let confirmed = confirm(t('confirm_deletion').replace('{pos}',document.positions[number].item));
|
let confirmed = confirm(t('confirm_deletion').replace('{pos}',document.positions[number].item));
|
||||||
if (!confirmed) return;
|
if (!confirmed) return;
|
||||||
const url = api(`document/${document.id}/position`;
|
const url = api(`document/${document.id}/position`);
|
||||||
const resp = await fetch(url,{
|
const resp = await fetch(url,{
|
||||||
method : 'DELETE',
|
method : 'DELETE',
|
||||||
credentials: 'include',
|
credentials: 'include',
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
let times = $state(null);
|
let times = $state(null);
|
||||||
|
|
||||||
async function loadProjects(){
|
async function loadProjects(){
|
||||||
const url = api'project/list');
|
const url = api('project/list');
|
||||||
let data = { company_id: company_id };
|
let data = { company_id: company_id };
|
||||||
const resp = await fetch(url,{
|
const resp = await fetch(url,{
|
||||||
credentials : 'include',
|
credentials : 'include',
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
|
|
||||||
async function loadDoc(){
|
async function loadDoc(){
|
||||||
const url = api(`document/${id}`;
|
const url = api(`document/${id}`);
|
||||||
const resp = await fetch(url,{credentials:'include'});
|
const resp = await fetch(url,{credentials:'include'});
|
||||||
if (resp.ok){
|
if (resp.ok){
|
||||||
doc = await resp.json();
|
doc = await resp.json();
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
data[parts.pop()] = inner;
|
data[parts.pop()] = inner;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const url = api(`document/${doc.id}`;
|
const url = api(`document/${doc.id}`);
|
||||||
const resp = await fetch(url,{
|
const resp = await fetch(url,{
|
||||||
credentials : 'include',
|
credentials : 'include',
|
||||||
method : 'PATCH',
|
method : 'PATCH',
|
||||||
@@ -74,7 +74,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function addPosition(selected){
|
async function addPosition(selected){
|
||||||
const url = api(`document/${doc.id}/position`;
|
const url = api(`document/${doc.id}/position`);
|
||||||
const resp = await fetch(url,{
|
const resp = await fetch(url,{
|
||||||
method : 'POST',
|
method : 'POST',
|
||||||
credentials : 'include',
|
credentials : 'include',
|
||||||
@@ -91,7 +91,7 @@
|
|||||||
async function render(ev){
|
async function render(ev){
|
||||||
pdfDisabled = true;
|
pdfDisabled = true;
|
||||||
|
|
||||||
const url = api(`document/${doc.id}/pdf`;
|
const url = api(`document/${doc.id}/pdf`);
|
||||||
const resp = await fetch(url,{credentials:'include'});
|
const resp = await fetch(url,{credentials:'include'});
|
||||||
if (resp.ok){
|
if (resp.ok){
|
||||||
error = null;
|
error = null;
|
||||||
|
|||||||
@@ -1,15 +1,20 @@
|
|||||||
<script>
|
<script>
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
|
|
||||||
import { api } from '../../urls.svelte.js';
|
import { api } from '../../urls.svelte.js';
|
||||||
import { t } from '../../translations.svelte.js';
|
import { t } from '../../translations.svelte.js';
|
||||||
import { user } from '../../user.svelte.js';
|
import { user } from '../../user.svelte.js';
|
||||||
|
|
||||||
import Editor from '../../Components/MarkdownEditor.svelte';
|
import Editor from '../../Components/MarkdownEditor.svelte';
|
||||||
|
|
||||||
|
let authors = $state(null);
|
||||||
let error = $state(null);
|
let error = $state(null);
|
||||||
let { module = null, entity_id = null } = $props();
|
|
||||||
let note = $state({source:null,rendered:null});
|
let note = $state({source:null,rendered:null});
|
||||||
let notes = $state(null);
|
let notes = $state(null);
|
||||||
let authors = $state(null);
|
let {
|
||||||
|
module = null,
|
||||||
|
entity_id = null
|
||||||
|
} = $props();
|
||||||
|
|
||||||
async function saveNote(){
|
async function saveNote(){
|
||||||
const url = api(`notes/${module}/${entity_id}`);
|
const url = api(`notes/${module}/${entity_id}`);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { useTinyRouter } from 'svelte-tiny-router';
|
import { useTinyRouter } from 'svelte-tiny-router';
|
||||||
|
|
||||||
|
import { api } from '../../urls.svelte.js';
|
||||||
import { t } from '../../translations.svelte.js';
|
import { t } from '../../translations.svelte.js';
|
||||||
|
|
||||||
import CompanySelector from '../../Components/CompanySelector.svelte';
|
import CompanySelector from '../../Components/CompanySelector.svelte';
|
||||||
@@ -16,15 +17,13 @@
|
|||||||
let project = $state({
|
let project = $state({
|
||||||
name : '',
|
name : '',
|
||||||
description : { source : '', rendered : '' },
|
description : { source : '', rendered : '' },
|
||||||
settings:{
|
settings : { show_closed:false },
|
||||||
show_closed:false
|
|
||||||
},
|
|
||||||
tags : []
|
tags : []
|
||||||
});
|
});
|
||||||
|
|
||||||
async function onsubmit(ev){
|
async function onsubmit(ev){
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/project`;
|
const url = api('project');
|
||||||
var resp = await fetch(url,{
|
var resp = await fetch(url,{
|
||||||
credentials : 'include',
|
credentials : 'include',
|
||||||
method : 'POST',
|
method : 'POST',
|
||||||
|
|||||||
@@ -14,15 +14,14 @@
|
|||||||
let dragged = null;
|
let dragged = null;
|
||||||
let error = $state(null);
|
let error = $state(null);
|
||||||
let highlight = $state({});
|
let highlight = $state({});
|
||||||
|
let filter_input = $state('');
|
||||||
|
let filter = $derived(filter_input.toLowerCase());
|
||||||
let project = $state(null);
|
let project = $state(null);
|
||||||
let ready = $state(false);
|
let ready = $state(false);
|
||||||
let router = useTinyRouter();
|
let router = useTinyRouter();
|
||||||
let states = $state(null);
|
let states = $state(null);
|
||||||
let tasks = $state({});
|
let tasks = $state({});
|
||||||
let filter_input = $state('');
|
|
||||||
let filter = $derived(filter_input.toLowerCase());
|
|
||||||
let users = {};
|
let users = {};
|
||||||
|
|
||||||
let columns = $derived(states?Object.keys(states).length+1:1);
|
let columns = $derived(states?Object.keys(states).length+1:1);
|
||||||
|
|
||||||
async function create(name,user_id,state){
|
async function create(name,user_id,state){
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<script>
|
<script>
|
||||||
import { useTinyRouter } from 'svelte-tiny-router';
|
|
||||||
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';
|
||||||
|
|
||||||
const router = useTinyRouter();
|
const router = useTinyRouter();
|
||||||
let error = $state(null);
|
let error = $state(null);
|
||||||
|
|||||||
@@ -13,13 +13,13 @@
|
|||||||
import Tags from '../tags/TagList.svelte';
|
import Tags from '../tags/TagList.svelte';
|
||||||
import TaskList from '../task/TaskList.svelte';
|
import TaskList from '../task/TaskList.svelte';
|
||||||
|
|
||||||
let router = useTinyRouter();
|
|
||||||
let { id } = $props();
|
let { id } = $props();
|
||||||
let project = $state(null);
|
|
||||||
let error = $state(null);
|
let error = $state(null);
|
||||||
let tasks = $state(null);
|
|
||||||
let estimated_time = $state({sum:0});
|
let estimated_time = $state({sum:0});
|
||||||
|
let project = $state(null);
|
||||||
|
let router = useTinyRouter();
|
||||||
let showSettings = $state(false);
|
let showSettings = $state(false);
|
||||||
|
let tasks = $state(null);
|
||||||
|
|
||||||
async function addMember(entry){
|
async function addMember(entry){
|
||||||
const ids = Object.keys(entry);
|
const ids = Object.keys(entry);
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
async function getCandidates(text){
|
async function getCandidates(text){
|
||||||
const url = api('user/search');
|
const url = api('user/search');
|
||||||
var resp = await fetch(url,{
|
const resp = await fetch(url,{
|
||||||
credentials : 'include',
|
credentials : 'include',
|
||||||
method : 'POST',
|
method : 'POST',
|
||||||
body : text
|
body : text
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
<script>
|
<script>
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
|
|
||||||
import { t } from '../../translations.svelte.js';
|
import { t } from '../../translations.svelte.js';
|
||||||
|
|
||||||
let key = "";
|
|
||||||
let fulltext = false;
|
let fulltext = false;
|
||||||
let html = "";
|
let html = "";
|
||||||
|
let key = "";
|
||||||
|
|
||||||
async function doSearch(ev){
|
async function doSearch(ev){
|
||||||
if (ev) ev.preventDefault();
|
if (ev) ev.preventDefault();
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { useTinyRouter } from 'svelte-tiny-router';
|
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 { user } from '../../user.svelte.js';
|
import { user } from '../../user.svelte.js';
|
||||||
|
|
||||||
import MarkdownEditor from '../../Components/MarkdownEditor.svelte';
|
import MarkdownEditor from '../../Components/MarkdownEditor.svelte';
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function loadProject(){
|
async function loadProject(){
|
||||||
var url = api(`project/${project_id}`);
|
const url = api(`project/${project_id}`);
|
||||||
const resp = await fetch(url,{credentials:'include'});
|
const resp = await fetch(url,{credentials:'include'});
|
||||||
if (resp.ok){
|
if (resp.ok){
|
||||||
project = await resp.json();
|
project = await resp.json();
|
||||||
@@ -98,7 +98,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function saveTask(){
|
async function saveTask(){
|
||||||
var url = api('task/add');
|
const url = api('task/add');
|
||||||
const resp = await fetch(url,{
|
const resp = await fetch(url,{
|
||||||
credentials : 'include',
|
credentials : 'include',
|
||||||
method : 'POST',
|
method : 'POST',
|
||||||
|
|||||||
@@ -2,18 +2,18 @@
|
|||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { useTinyRouter } from 'svelte-tiny-router';
|
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 TaskList from './TaskList.svelte';
|
||||||
import LineEditor from '../../Components/LineEditor.svelte';
|
import LineEditor from '../../Components/LineEditor.svelte';
|
||||||
|
|
||||||
const router = useTinyRouter();
|
|
||||||
let { estimated_time, show_closed, task } = $props();
|
let { estimated_time, show_closed, task } = $props();
|
||||||
let children = $state(null);
|
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(){
|
function addSubtask(){
|
||||||
router.navigate(`/task/${task.id}/add_subtask`);
|
router.navigate(`/task/${task.id}/add_subtask`);
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
async function loadChildren(){
|
async function loadChildren(){
|
||||||
const url = api('task/list');
|
const url = api('task/list');
|
||||||
var data = {
|
const data = {
|
||||||
parent_task_id : +task.id,
|
parent_task_id : +task.id,
|
||||||
show_closed : show_closed
|
show_closed : show_closed
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { useTinyRouter } from 'svelte-tiny-router';
|
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 MarkdownEditor from '../../Components/MarkdownEditor.svelte';
|
||||||
@@ -13,15 +13,15 @@
|
|||||||
import TagList from '../tags/TagList.svelte';
|
import TagList from '../tags/TagList.svelte';
|
||||||
import TaskList from './TaskList.svelte';
|
import TaskList from './TaskList.svelte';
|
||||||
|
|
||||||
const router = useTinyRouter();
|
|
||||||
let { id } = $props();
|
let { id } = $props();
|
||||||
let task = $state(null);
|
|
||||||
let project = $state(null);
|
|
||||||
let error = $state(null);
|
|
||||||
let children = $state(null);
|
let children = $state(null);
|
||||||
let estimated_time = $state({sum:0});
|
|
||||||
let dummy = $derived(updateOn(id));
|
let dummy = $derived(updateOn(id));
|
||||||
|
let error = $state(null);
|
||||||
|
let estimated_time = $state({sum:0});
|
||||||
|
let project = $state(null);
|
||||||
|
const router = useTinyRouter();
|
||||||
let showSettings = $state(false);
|
let showSettings = $state(false);
|
||||||
|
let task = $state(null);
|
||||||
|
|
||||||
$effect(() => updateOn(id));
|
$effect(() => updateOn(id));
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
|
|
||||||
async function loadChildren(){
|
async function loadChildren(){
|
||||||
const url = api('task/list');
|
const url = api('task/list');
|
||||||
var data = {
|
const data = {
|
||||||
parent_task_id : +task.id,
|
parent_task_id : +task.id,
|
||||||
show_closed : task.show_closed
|
show_closed : task.show_closed
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
<script>
|
<script>
|
||||||
|
import { onMount } from 'svelte';
|
||||||
|
|
||||||
|
import { api } from '../../urls.svelte.js';
|
||||||
import { t } from '../../translations.svelte.js';
|
import { t } from '../../translations.svelte.js';
|
||||||
import { user } from '../../user.svelte.js';
|
import { user } from '../../user.svelte.js';
|
||||||
import { onMount } from 'svelte';
|
|
||||||
|
|
||||||
let connections = $state([]);
|
let connections = $state([]);
|
||||||
|
|
||||||
async function loadConnections(){
|
async function loadConnections(){
|
||||||
let url = `${location.protocol}//${location.host.replace('5173','8080')}/api/user/oidc/connected`;
|
const url = api('/user/oidc/connected');
|
||||||
|
const resp = await fetch(url,{credentials:'include'});
|
||||||
let resp = await fetch(url,{credentials:'include'});
|
|
||||||
if (resp.ok){
|
if (resp.ok){
|
||||||
const arr = await resp.json();
|
const arr = await resp.json();
|
||||||
while (connections.length) connections.pop();
|
while (connections.length) connections.pop();
|
||||||
@@ -19,7 +20,7 @@
|
|||||||
onMount(loadConnections);
|
onMount(loadConnections);
|
||||||
|
|
||||||
async function unlink(connection){
|
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,{
|
const resp = await fetch(url,{
|
||||||
method : 'DELETE',
|
method : 'DELETE',
|
||||||
credentials : 'include',
|
credentials : 'include',
|
||||||
|
|||||||
@@ -1,18 +1,17 @@
|
|||||||
<script>
|
<script>
|
||||||
|
import { api } from '../../urls.svelte.js';
|
||||||
import { t } from '../../translations.svelte.js';
|
import { t } from '../../translations.svelte.js';
|
||||||
|
|
||||||
let { editPassword = $bindable() } = $props();
|
let { editPassword = $bindable() } = $props();
|
||||||
|
|
||||||
let oldPass = $state("");
|
|
||||||
let newPass = $state("");
|
|
||||||
let repeat = $state("");
|
|
||||||
let caption = $state(t('update'));
|
let caption = $state(t('update'));
|
||||||
|
|
||||||
let oldEmpty = $derived(!/\S/.test(oldPass));
|
|
||||||
let newEmpty = $derived(!/\S/.test(newPass));
|
|
||||||
let mismatch = $derived(newPass != repeat);
|
|
||||||
|
|
||||||
let error = $state("");
|
let error = $state("");
|
||||||
|
let newPass = $state("");
|
||||||
|
let mismatch = $derived(newPass != repeat);
|
||||||
|
let newEmpty = $derived(!/\S/.test(newPass));
|
||||||
|
let oldPass = $state("");
|
||||||
|
let oldEmpty = $derived(!/\S/.test(oldPass));
|
||||||
|
let repeat = $state("");
|
||||||
let sent = $state(false);
|
let sent = $state(false);
|
||||||
|
|
||||||
function abort(){
|
function abort(){
|
||||||
|
|||||||
@@ -1,17 +1,19 @@
|
|||||||
<script>
|
<script>
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { t } from '../../translations.svelte.js';
|
|
||||||
import { useTinyRouter } from 'svelte-tiny-router';
|
import { useTinyRouter } from 'svelte-tiny-router';
|
||||||
|
|
||||||
let { serviceName } = $props();
|
import { api } from '../../urls.svelte.js'
|
||||||
let service = $state({})
|
import { t } from '../../translations.svelte.js';
|
||||||
|
|
||||||
let caption = $state(t('save_service'));
|
let caption = $state(t('save_service'));
|
||||||
|
let disabled = $state(false);
|
||||||
|
let service = $state({})
|
||||||
|
let { serviceName } = $props();
|
||||||
let message = $state(t('loading_data'));
|
let message = $state(t('loading_data'));
|
||||||
let router = useTinyRouter();
|
let router = useTinyRouter();
|
||||||
let disabled = $state(false);
|
|
||||||
|
|
||||||
onMount(async () => {
|
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'});
|
const resp = await fetch(url,{credentials:'include'});
|
||||||
if (resp.ok){
|
if (resp.ok){
|
||||||
const json = await resp.json();
|
const json = await resp.json();
|
||||||
@@ -24,7 +26,7 @@
|
|||||||
|
|
||||||
async function update(){
|
async function update(){
|
||||||
caption = t('data_sent');
|
caption = t('data_sent');
|
||||||
const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/user/oidc/${serviceName}`;
|
const url = api(`user/oidc/${serviceName}`);
|
||||||
const resp = await fetch(url,{
|
const resp = await fetch(url,{
|
||||||
credentials : 'include',
|
credentials : 'include',
|
||||||
method : 'PATCH',
|
method : 'PATCH',
|
||||||
|
|||||||
@@ -1,19 +1,18 @@
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
import { t } from '../../translations.svelte.js';
|
|
||||||
import { useTinyRouter } from 'svelte-tiny-router';
|
import { useTinyRouter } from 'svelte-tiny-router';
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { checkUser } from '../../user.svelte.js';
|
|
||||||
|
|
||||||
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 { user_id } = $props();
|
||||||
|
|
||||||
let editUser = $state(null);
|
|
||||||
let options = $state([]);
|
|
||||||
let sent = $state(false);
|
|
||||||
let caption = $state(t('save_user'));
|
let caption = $state(t('save_user'));
|
||||||
|
let editUser = $state(null);
|
||||||
let message = $state(t('loading_data'));
|
let message = $state(t('loading_data'));
|
||||||
|
let options = $state([]);
|
||||||
|
const router = useTinyRouter();
|
||||||
|
let sent = $state(false);
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
let url = `${location.protocol}//${location.host.replace('5173','8080')}/themes.json`;
|
let url = `${location.protocol}//${location.host.replace('5173','8080')}/themes.json`;
|
||||||
@@ -28,7 +27,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (user_id) {
|
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'});
|
resp = await fetch(url,{credentials:'include'});
|
||||||
if (resp.ok) {
|
if (resp.ok) {
|
||||||
editUser = await resp.json();
|
editUser = await resp.json();
|
||||||
@@ -48,9 +47,9 @@
|
|||||||
let method = 'PATCH';
|
let method = 'PATCH';
|
||||||
let url = null;
|
let url = null;
|
||||||
if (user_id) {
|
if (user_id) {
|
||||||
url = `${location.protocol}//${location.host.replace('5173','8080')}/api/user/${user_id}`;
|
url = api(`user/${user_id}`);
|
||||||
} else {
|
} else {
|
||||||
url = `${location.protocol}//${location.host.replace('5173','8080')}/api/user/create`;
|
url = api('user/create');
|
||||||
method = 'POST';
|
method = 'POST';
|
||||||
}
|
}
|
||||||
let resp = await fetch(url,{
|
let resp = await fetch(url,{
|
||||||
|
|||||||
@@ -1,24 +1,25 @@
|
|||||||
<script>
|
<script>
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { t } from '../../translations.svelte.js';
|
|
||||||
import { useTinyRouter } from 'svelte-tiny-router';
|
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 { user } from '../../user.svelte.js';
|
||||||
|
|
||||||
const router = useTinyRouter();
|
const router = useTinyRouter();
|
||||||
|
|
||||||
let users = $state([]);
|
let users = $state([]);
|
||||||
|
|
||||||
onMount(async () => {
|
async function listUsers(){
|
||||||
const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/user/list`;
|
const url = api('user/list');
|
||||||
const resp = await fetch(url,{credentials:'include'});
|
const resp = await fetch(url,{credentials:'include'});
|
||||||
if (resp.ok){
|
if (resp.ok){
|
||||||
const json = await resp.json();
|
const json = await resp.json();
|
||||||
for (let u of json) users.push(u);
|
for (let u of json) users.push(u);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
async function impersonate(userId){
|
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,{
|
const resp = await fetch(url,{
|
||||||
method : 'POST',
|
method : 'POST',
|
||||||
credentials : 'include'
|
credentials : 'include'
|
||||||
@@ -29,6 +30,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onMount(listUsers);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<fieldset tabindex="0">
|
<fieldset tabindex="0">
|
||||||
|
|||||||
@@ -1,27 +1,16 @@
|
|||||||
<script>
|
<script>
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { t } from '../../translations.svelte.js';
|
|
||||||
import { useTinyRouter } from 'svelte-tiny-router';
|
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 { user } from '../../user.svelte.js';
|
||||||
|
|
||||||
const router = useTinyRouter();
|
const router = useTinyRouter();
|
||||||
|
|
||||||
let services = $state([]);
|
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){
|
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'});
|
const resp = await fetch(url,{credentials:'include'});
|
||||||
if (resp.ok){
|
if (resp.ok){
|
||||||
var json = await resp.json();
|
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){
|
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,{
|
const resp = await fetch(url,{
|
||||||
credentials : 'include',
|
credentials : 'include',
|
||||||
method : 'DELETE'
|
method : 'DELETE'
|
||||||
});
|
});
|
||||||
if (resp.ok) loadButtons();
|
if (resp.ok) loadButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onMount(loadButtons);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<fieldset tabindex="0">
|
<fieldset tabindex="0">
|
||||||
|
|||||||
@@ -1,17 +1,19 @@
|
|||||||
<script>
|
<script>
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { t } from '../../translations.svelte.js';
|
|
||||||
import { useTinyRouter } from 'svelte-tiny-router';
|
import { useTinyRouter } from 'svelte-tiny-router';
|
||||||
|
|
||||||
|
import { api } from '../../urls.svelte.js';
|
||||||
|
import { t } from '../../translations.svelte.js';
|
||||||
import { checkUser } from '../../user.svelte.js';
|
import { checkUser } from '../../user.svelte.js';
|
||||||
|
|
||||||
const router = useTinyRouter();
|
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);
|
let params = new URLSearchParams(location.search);
|
||||||
|
|
||||||
if (params.get('code')){
|
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,{
|
const resp = await fetch(url,{
|
||||||
method : 'POST',
|
method : 'POST',
|
||||||
body : JSON.stringify(Object.fromEntries(params)),
|
body : JSON.stringify(Object.fromEntries(params)),
|
||||||
@@ -27,7 +29,9 @@
|
|||||||
if (!message) message = t(resp);
|
if (!message) message = t(resp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
|
onMount(process);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{message}
|
{message}
|
||||||
@@ -1,14 +1,15 @@
|
|||||||
<script>
|
<script>
|
||||||
import { t } from '../../translations.svelte.js';
|
|
||||||
import { user } from '../../user.svelte.js';
|
|
||||||
import { useTinyRouter } from 'svelte-tiny-router';
|
import { useTinyRouter } from 'svelte-tiny-router';
|
||||||
|
|
||||||
|
import { t } from '../../translations.svelte.js';
|
||||||
|
import { user } from '../../user.svelte.js';
|
||||||
|
|
||||||
import EditPassword from './EditPassword.svelte';
|
import EditPassword from './EditPassword.svelte';
|
||||||
|
|
||||||
const router = useTinyRouter();
|
const router = useTinyRouter();
|
||||||
|
|
||||||
let editPassword = false;
|
let editPassword = false;
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>
|
<legend>
|
||||||
{t('your_profile')}
|
{t('your_profile')}
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
<script>
|
<script>
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { t } from '../../translations.svelte.js';
|
|
||||||
import { useTinyRouter } from 'svelte-tiny-router';
|
import { useTinyRouter } from 'svelte-tiny-router';
|
||||||
|
|
||||||
let mail = "";
|
import { api } from '../../urls.svelte.js';
|
||||||
|
import { t } from '../../translations.svelte.js';
|
||||||
|
|
||||||
let caption = t('send_mail');
|
let caption = t('send_mail');
|
||||||
let error = null;
|
let error = null;
|
||||||
|
let mail = "";
|
||||||
const router = useTinyRouter();
|
const router = useTinyRouter();
|
||||||
|
|
||||||
async function submit(ev){
|
async function submit(ev){
|
||||||
ev.preventDefault();
|
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,{
|
const resp = await fetch(url,{
|
||||||
method : 'POST',
|
method : 'POST',
|
||||||
body : mail
|
body : mail
|
||||||
@@ -26,7 +28,7 @@
|
|||||||
const urlParams = new URLSearchParams(window.location.search);
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
const token = urlParams.get('token');
|
const token = urlParams.get('token');
|
||||||
if (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,{
|
const resp = await fetch(url,{
|
||||||
credentials: 'include'
|
credentials: 'include'
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script>
|
<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 LoginServiceList from './LoginServices.svelte';
|
||||||
@@ -9,9 +9,7 @@
|
|||||||
|
|
||||||
let params = new URLSearchParams(location.search);
|
let params = new URLSearchParams(location.search);
|
||||||
let redirect = params.get('returnTo');
|
let redirect = params.get('returnTo');
|
||||||
if (redirect && user.name){
|
if (redirect && user.name) location.href = redirect;
|
||||||
location.href = redirect;
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<h1>{t('user_module')}</h1>
|
<h1>{t('user_module')}</h1>
|
||||||
|
|||||||
Reference in New Issue
Block a user