re-ordering methods
This commit is contained in:
@@ -30,30 +30,6 @@
|
|||||||
let stateList = {};
|
let stateList = {};
|
||||||
$effect(() => updateUrl(filter_input));
|
$effect(() => updateUrl(filter_input));
|
||||||
|
|
||||||
async function do_archive(ex){
|
|
||||||
ex.preventDefault();
|
|
||||||
var task = dragged;
|
|
||||||
const url = api(`task/${task.id}`);
|
|
||||||
const resp = await fetch(url,{
|
|
||||||
credentials : 'include',
|
|
||||||
method : 'PATCH',
|
|
||||||
body : JSON.stringify({no_index:true})
|
|
||||||
});
|
|
||||||
delete highlight.archive;
|
|
||||||
if (resp.ok){
|
|
||||||
yikes();
|
|
||||||
delete tasks[task.assignee][task.status][task.id]
|
|
||||||
} else {
|
|
||||||
error(resp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateUrl(){
|
|
||||||
let url = window.location.origin + window.location.pathname;
|
|
||||||
if (filter_input) url += '?filter=' + encodeURI(filter_input);
|
|
||||||
window.history.replaceState(window.history.state, '', url);
|
|
||||||
}
|
|
||||||
|
|
||||||
function byName(a,b) {
|
function byName(a,b) {
|
||||||
return a.name.localeCompare(b.name);
|
return a.name.localeCompare(b.name);
|
||||||
}
|
}
|
||||||
@@ -88,6 +64,24 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function do_archive(ex){
|
||||||
|
ex.preventDefault();
|
||||||
|
var task = dragged;
|
||||||
|
const url = api(`task/${task.id}`);
|
||||||
|
const resp = await fetch(url,{
|
||||||
|
credentials : 'include',
|
||||||
|
method : 'PATCH',
|
||||||
|
body : JSON.stringify({no_index:true})
|
||||||
|
});
|
||||||
|
delete highlight.archive;
|
||||||
|
if (resp.ok){
|
||||||
|
yikes();
|
||||||
|
delete tasks[task.assignee][task.status][task.id]
|
||||||
|
} else {
|
||||||
|
error(resp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function drop(user_id,state){
|
async function drop(user_id,state){
|
||||||
let task = dragged;
|
let task = dragged;
|
||||||
dragged = null;
|
dragged = null;
|
||||||
@@ -131,6 +125,22 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function hover(ev,user_id,state){
|
||||||
|
ev.preventDefault();
|
||||||
|
highlight = {user:user_id,state:state};
|
||||||
|
}
|
||||||
|
|
||||||
|
function hover_archive(ev){
|
||||||
|
ev.preventDefault();
|
||||||
|
highlight.archive = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function is_custom(state){
|
||||||
|
return [10,20,40,60,100].includes(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async function load(){
|
async function load(){
|
||||||
try {
|
try {
|
||||||
eventSource = eventStream(handleUpdateEvent);
|
eventSource = eventStream(handleUpdateEvent);
|
||||||
@@ -182,6 +192,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function openTask(task_id){
|
||||||
|
window.open(`/task/${task_id}/view`, '_blank').focus();
|
||||||
|
}
|
||||||
|
|
||||||
function processTask(task){
|
function processTask(task){
|
||||||
if (task.no_index) return;
|
if (task.no_index) return;
|
||||||
|
|
||||||
@@ -201,31 +215,14 @@
|
|||||||
tasks[assignee][state][task.id] = task;
|
tasks[assignee][state][task.id] = task;
|
||||||
}
|
}
|
||||||
|
|
||||||
function hover(ev,user_id,state){
|
|
||||||
ev.preventDefault();
|
|
||||||
highlight = {user:user_id,state:state};
|
|
||||||
}
|
|
||||||
|
|
||||||
function hover_archive(ev){
|
|
||||||
ev.preventDefault();
|
|
||||||
highlight.archive = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function is_custom(state){
|
|
||||||
return [10,20,40,60,100].includes(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
function openTask(task_id){
|
|
||||||
window.open(`/task/${task_id}/view`, '_blank').focus();
|
|
||||||
}
|
|
||||||
|
|
||||||
async function save_bookmark(){
|
async function save_bookmark(){
|
||||||
const user_ids = Object.values(project.members).map(member => member.user.id);
|
const user_ids = Object.values(project.members).map(member => member.user.id);
|
||||||
const data = {
|
const data = {
|
||||||
url: location.href,
|
url : location.href,
|
||||||
tags: ['Kanban', project.name, filter_input],
|
tags : ['Kanban', project.name, filter_input],
|
||||||
comment: `${project.name}: ${filter_input}`,
|
comment : `${project.name}: ${filter_input}`,
|
||||||
share: user_ids
|
share : user_ids
|
||||||
}
|
}
|
||||||
const url = api('bookmark');
|
const url = api('bookmark');
|
||||||
const resp = await fetch(url,{
|
const resp = await fetch(url,{
|
||||||
@@ -241,12 +238,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(load);
|
|
||||||
|
|
||||||
|
function updateUrl(){
|
||||||
|
let url = window.location.origin + window.location.pathname;
|
||||||
|
if (filter_input) url += '?filter=' + encodeURI(filter_input);
|
||||||
|
window.history.replaceState(window.history.state, '', url);
|
||||||
|
}
|
||||||
|
|
||||||
onDestroy(() => {
|
onDestroy(() => {
|
||||||
if (eventSource) eventSource.close();
|
if (eventSource) eventSource.close();
|
||||||
});
|
});
|
||||||
|
onMount(load);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
|
|||||||
Reference in New Issue
Block a user