re-ordering methods
This commit is contained in:
@@ -30,30 +30,6 @@
|
||||
let stateList = {};
|
||||
$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) {
|
||||
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){
|
||||
let task = dragged;
|
||||
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(){
|
||||
try {
|
||||
eventSource = eventStream(handleUpdateEvent);
|
||||
@@ -182,52 +192,39 @@
|
||||
}
|
||||
}
|
||||
|
||||
function processTask(task){
|
||||
if (task.no_index) return;
|
||||
|
||||
let state = +task.status;
|
||||
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 == 'ASSIGNEE') assignee = +user_id;
|
||||
}
|
||||
if (!assignee) assignee = owner;
|
||||
task.assignee = assignee;
|
||||
if (!tasks[assignee]) tasks[assignee] = {};
|
||||
if (!tasks[assignee][state]) tasks[assignee][state] = {};
|
||||
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();
|
||||
}
|
||||
|
||||
function processTask(task){
|
||||
if (task.no_index) return;
|
||||
|
||||
let state = +task.status;
|
||||
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 == 'ASSIGNEE') assignee = +user_id;
|
||||
}
|
||||
if (!assignee) assignee = owner;
|
||||
task.assignee = assignee;
|
||||
if (!tasks[assignee]) tasks[assignee] = {};
|
||||
if (!tasks[assignee][state]) tasks[assignee][state] = {};
|
||||
tasks[assignee][state][task.id] = task;
|
||||
}
|
||||
|
||||
|
||||
async function save_bookmark(){
|
||||
const user_ids = Object.values(project.members).map(member => member.user.id);
|
||||
const data = {
|
||||
url: location.href,
|
||||
tags: ['Kanban', project.name, filter_input],
|
||||
comment: `${project.name}: ${filter_input}`,
|
||||
share: user_ids
|
||||
url : location.href,
|
||||
tags : ['Kanban', project.name, filter_input],
|
||||
comment : `${project.name}: ${filter_input}`,
|
||||
share : user_ids
|
||||
}
|
||||
const url = api('bookmark');
|
||||
const url = api('bookmark');
|
||||
const resp = await fetch(url,{
|
||||
credentials : 'include',
|
||||
method : 'POST',
|
||||
@@ -241,12 +238,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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(() => {
|
||||
if (eventSource) eventSource.close();
|
||||
});
|
||||
onMount(load);
|
||||
|
||||
|
||||
onDestroy(() => {
|
||||
if (eventSource) eventSource.close();
|
||||
});
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
|
||||
Reference in New Issue
Block a user