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 filter = $derived(filter_input.toLowerCase());
|
||||||
let project = $state(null);
|
let project = $state(null);
|
||||||
let tasks = $state({});
|
let tasks = $state({});
|
||||||
let users = {};
|
let users = [];
|
||||||
let columns = $derived(project.allowed_states?Object.keys(project.allowed_states).length+1:1);
|
let columns = $derived(project.allowed_states?Object.keys(project.allowed_states).length+1:1);
|
||||||
|
|
||||||
|
let stateList = {};
|
||||||
$effect(() => updateUrl(filter_input));
|
$effect(() => updateUrl(filter_input));
|
||||||
|
|
||||||
async function do_archive(ex){
|
async function do_archive(ex){
|
||||||
@@ -118,12 +119,15 @@
|
|||||||
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();
|
||||||
users[user.id] = user.name;
|
users.push(user);
|
||||||
if (!tasks[user.id]) tasks[user.id] = tasks[user.id] = {};
|
if (!tasks[user.id]) tasks[user.id] = tasks[user.id] = {};
|
||||||
for (var uid of Object.keys(project.members)){
|
for (var uid of Object.keys(project.members)){
|
||||||
let member = project.members[uid];
|
let member = project.members[uid];
|
||||||
users[uid] = member.user.name;
|
users.push(member.user);
|
||||||
if (!tasks[uid]) tasks[uid] = {};
|
if (!tasks[uid]) tasks[uid] = {};
|
||||||
|
for (var state of Object.keys(project.allowed_states)) {
|
||||||
|
tasks[uid][state] = [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
yikes();
|
yikes();
|
||||||
} else {
|
} else {
|
||||||
@@ -144,6 +148,7 @@
|
|||||||
var json = await resp.json();
|
var json = await resp.json();
|
||||||
for (var task_id of Object.keys(json)) {
|
for (var task_id of Object.keys(json)) {
|
||||||
let task = json[task_id];
|
let task = json[task_id];
|
||||||
|
|
||||||
if (task.no_index) continue;
|
if (task.no_index) continue;
|
||||||
let state = task.status;
|
let state = task.status;
|
||||||
let owner = null;
|
let owner = null;
|
||||||
@@ -156,8 +161,8 @@
|
|||||||
}
|
}
|
||||||
if (!assignee) assignee = owner;
|
if (!assignee) assignee = owner;
|
||||||
task.assignee = assignee;
|
task.assignee = assignee;
|
||||||
if (!tasks[assignee]) tasks[assignee] = {};
|
// if (!tasks[assignee]) tasks[assignee] = {};
|
||||||
if (!tasks[assignee][state]) tasks[assignee][state] = {};
|
// if (!tasks[assignee][state]) tasks[assignee][state] = {};
|
||||||
tasks[assignee][state][task_id] = task;
|
tasks[assignee][state][task_id] = task;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -233,11 +238,11 @@
|
|||||||
<div class="head">{sid%10?state:t('state_'+state.toLowerCase())}</div>
|
<div class="head">{sid%10?state:t('state_'+state.toLowerCase())}</div>
|
||||||
{/each}
|
{/each}
|
||||||
{/if}
|
{/if}
|
||||||
{#each Object.entries(tasks) as [uid,stateList]}
|
{#each users as u}
|
||||||
<div class="user">{users[uid]}</div>
|
<div class="user">{u.name} ({u.id})</div>
|
||||||
{#each Object.entries(project.allowed_states) as [state,name]}
|
{#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)} >
|
<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[state]}
|
{#if stateList && stateList[state]}
|
||||||
{#each Object.values(stateList[state]).sort((a,b) => a.name.localeCompare(b.name)) as task}
|
{#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)}
|
{#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} />
|
<Card onclick={e => openTask(task.id)} ondragstart={ev => dragged=task} {task} tag_colors={project.tag_colors} />
|
||||||
@@ -256,3 +261,6 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
{JSON.stringify({project,users,tasks},null,2)}
|
||||||
|
</pre>
|
||||||
Reference in New Issue
Block a user