working on better user ordering
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -21,9 +21,10 @@
|
||||
let filter = $derived(filter_input.toLowerCase());
|
||||
let project = $state(null);
|
||||
let tasks = $state({});
|
||||
let users = {};
|
||||
let users = [];
|
||||
let columns = $derived(project.allowed_states?Object.keys(project.allowed_states).length+1:1);
|
||||
|
||||
let stateList = {};
|
||||
$effect(() => updateUrl(filter_input));
|
||||
|
||||
async function do_archive(ex){
|
||||
@@ -118,12 +119,15 @@
|
||||
const resp = await fetch(url,{credentials:'include'});
|
||||
if (resp.ok){
|
||||
project = await resp.json();
|
||||
users[user.id] = user.name;
|
||||
users.push(user);
|
||||
if (!tasks[user.id]) tasks[user.id] = tasks[user.id] = {};
|
||||
for (var uid of Object.keys(project.members)){
|
||||
let member = project.members[uid];
|
||||
users[uid] = member.user.name;
|
||||
users.push(member.user);
|
||||
if (!tasks[uid]) tasks[uid] = {};
|
||||
for (var state of Object.keys(project.allowed_states)) {
|
||||
tasks[uid][state] = [];
|
||||
}
|
||||
}
|
||||
yikes();
|
||||
} else {
|
||||
@@ -144,6 +148,7 @@
|
||||
var json = await resp.json();
|
||||
for (var task_id of Object.keys(json)) {
|
||||
let task = json[task_id];
|
||||
|
||||
if (task.no_index) continue;
|
||||
let state = task.status;
|
||||
let owner = null;
|
||||
@@ -156,8 +161,8 @@
|
||||
}
|
||||
if (!assignee) assignee = owner;
|
||||
task.assignee = assignee;
|
||||
if (!tasks[assignee]) tasks[assignee] = {};
|
||||
if (!tasks[assignee][state]) tasks[assignee][state] = {};
|
||||
// if (!tasks[assignee]) tasks[assignee] = {};
|
||||
// if (!tasks[assignee][state]) tasks[assignee][state] = {};
|
||||
tasks[assignee][state][task_id] = task;
|
||||
}
|
||||
} else {
|
||||
@@ -233,11 +238,11 @@
|
||||
<div class="head">{sid%10?state:t('state_'+state.toLowerCase())}</div>
|
||||
{/each}
|
||||
{/if}
|
||||
{#each Object.entries(tasks) as [uid,stateList]}
|
||||
<div class="user">{users[uid]}</div>
|
||||
{#each users as u}
|
||||
<div class="user">{u.name} ({u.id})</div>
|
||||
{#each Object.entries(project.allowed_states) as [state,name]}
|
||||
<div class={['state_'+state, highlight.user == uid && highlight.state == state ? 'highlight':'']} ondragover={ev => hover(ev,uid,state)} ondragleave={e => delete highlight.user} ondrop={ev => drop(uid,state)} >
|
||||
{#if stateList[state]}
|
||||
<div class={['state_'+state, highlight.user == u.id && highlight.state == state ? 'highlight':'']} ondragover={ev => hover(ev,u.id,state)} ondragleave={e => delete highlight.user} ondrop={ev => drop(u.id,state)} >
|
||||
{#if stateList && stateList[state]}
|
||||
{#each Object.values(stateList[state]).sort((a,b) => a.name.localeCompare(b.name)) as task}
|
||||
{#if !filter || task.name.toLowerCase().includes(filter) || (task.tags && task.tags.filter(tag => tag.toLowerCase().includes(filter)).length)}
|
||||
<Card onclick={e => openTask(task.id)} ondragstart={ev => dragged=task} {task} tag_colors={project.tag_colors} />
|
||||
@@ -256,3 +261,6 @@
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<pre>
|
||||
{JSON.stringify({project,users,tasks},null,2)}
|
||||
</pre>
|
||||
Reference in New Issue
Block a user