Browse Source

working on user-defined states

feature/entityId
Stephan Richter 3 months ago
parent
commit
c57da0a891
  1. 2
      frontend/src/Components/LineEditor.svelte
  2. 9
      frontend/src/routes/project/Kanban.svelte
  3. 2
      frontend/src/routes/project/View.svelte
  4. 19
      frontend/src/routes/task/ListTask.svelte
  5. 11
      frontend/src/routes/task/View.svelte
  6. 3
      translations/src/main/resources/de.json

2
frontend/src/Components/LineEditor.svelte

@ -83,5 +83,5 @@ @@ -83,5 +83,5 @@
{#if editable && editing}
<input bind:value={editValue} onkeyup={typed} autofocus />
{:else}
<svelte:element this={type} href="" {onclick} {onmousedown} {onmouseup} {ontouchstart} {ontouchend} class={{editable}} title={t('double_click_to_edit')} >{value}</svelte:element>
<svelte:element this={type} href="#" {onclick} {onmousedown} {onmouseup} {ontouchstart} {ontouchend} class={{editable}} title={t('long_click_to_edit')} >{value}</svelte:element>
{/if}

9
frontend/src/routes/project/Kanban.svelte

@ -56,7 +56,8 @@ @@ -56,7 +56,8 @@
let task = dragged;
dragged = null;
highlight = {};
if (task.assignee == user_id && task.status.code == state) return; // no change
console.log(state);
if (task.assignee == user_id && task.status == state) return; // no change
let patch = {members:{},status:+state}
patch.members[user_id] = 'ASSIGNEE';
@ -67,7 +68,7 @@ @@ -67,7 +68,7 @@
body : JSON.stringify(patch)
});
if (resp.ok){
delete tasks[task.assignee][task.status.code][task.id]
delete tasks[task.assignee][task.status][task.id]
if (!tasks[user_id]) tasks[user_id] = {}
if (!tasks[user_id][state]) tasks[user_id][state] = {}
tasks[user_id][state][task.id] = task;
@ -147,7 +148,7 @@ @@ -147,7 +148,7 @@
var json = await resp.json();
for (var task_id of Object.keys(json)) {
let task = json[task_id];
let state = task.status.code;
let state = task.status;
let owner = null;
let assignee = null;
for (var user_id of Object.keys(task.members)){
@ -198,7 +199,7 @@ @@ -198,7 +199,7 @@
{#each Object.entries(tasks) as [uid,stateList]}
<div class="user">{users[uid]}</div>
{#each Object.entries(states) as [state,name]}
<div class={[state, highlight.user == uid && highlight.state == state ? 'highlight':'']} ondragover={ev => hover(ev,uid,state)} ondrop={ev => drop(uid,state)} >
<div class={['state_'+state, highlight.user == uid && highlight.state == state ? 'highlight':'']} ondragover={ev => hover(ev,uid,state)} ondrop={ev => drop(uid,state)} >
{#if 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)}

2
frontend/src/routes/project/View.svelte

@ -205,7 +205,7 @@ @@ -205,7 +205,7 @@
</th>
<td class="tasks">
{#if tasks}
<TaskList {tasks} {estimated_time} states={project.allowed_states} show_closed={project.show_closed} />
<TaskList {tasks} {estimated_time} states={project?.allowed_states} show_closed={project.show_closed} />
{/if}
</td>
</tr>

19
frontend/src/routes/task/ListTask.svelte

@ -110,6 +110,13 @@ @@ -110,6 +110,13 @@
patchTask({name:newName});
}
function map_state(tx){
for (let [code,name] of Object.entries(states)){
if (tx == name) return {status:+code};
}
return {state:0};
}
if (task.estimated_time){
estimated_time.sum += task.estimated_time;
}
@ -118,25 +125,25 @@ @@ -118,25 +125,25 @@
</script>
{#if !deleted}
<li draggable="true" {ondrop} ondragover={e => e.preventDefault()} {ondragstart} class="task {states[task.status].toLowerCase()}">
<li draggable="true" {ondrop} ondragover={e => e.preventDefault()} {ondragstart} class="task {states[task.status]?.toLowerCase()}">
<LineEditor bind:value={task.name} onclick={openTask} editable={true} onSet={setName} type="a" />
{#if task.estimated_time}
<span class="estimated_time">({+task.estimated_time}&nbsp;h)</span>
{/if}
{#if states[task.status] != 'PENDING'}
<button class="symbol" title={t('do_open')} onclick={() => patchTask({status:'PENDING'})}></button>
<button class="symbol" title={t('postpone')} onclick={() => patchTask(map_state('PENDING'))}></button>
{/if}
{#if states[task.status] != 'OPEN'}
<button class="symbol" title={t('do_open')} onclick={() => patchTask({status:'OPEN'})}></button>
<button class="symbol" title={t('do_open')} onclick={() => patchTask(map_state('OPEN'))}></button>
{/if}
{#if states[task.status] != 'STARTED'}
<button class="symbol" title={t('started')} onclick={() => patchTask({status:'STARTED'})}></button>
<button class="symbol" title={t('started')} onclick={() => patchTask(map_state('STARTED'))}></button>
{/if}
{#if states[task.status] != 'COMPLETE'}
<button class="symbol" title={t('complete')} onclick={() => patchTask({status:'COMPLETE'})}></button>
<button class="symbol" title={t('complete')} onclick={() => patchTask(map_state('COMPLETE'))}></button>
{/if}
{#if states[task.status] != 'CANCELLED'}
<button class="symbol" title={t('abort')} onclick={() => patchTask({status:'CANCELLED'})} ></button>
<button class="symbol" title={t('abort')} onclick={() => patchTask(map_state('CANCELED'))} ></button>
{/if}
<button class="symbol" title={t('delete_task')} onclick={deleteTask} ></button>
<button class="symbol" title={t('add_subtask')} onclick={addSubtask}></button>

11
frontend/src/routes/task/View.svelte

@ -44,6 +44,7 @@ @@ -44,6 +44,7 @@
function updateOn(id){
task = null;
loadTask();
}
@ -162,13 +163,17 @@ @@ -162,13 +163,17 @@
{#if project}
<tr>
<th>{t('project')}</th>
<td class="project"><a href="" onclick={gotoProject}>{project.name}</a></td>
<td class="project">
<a href="#" onclick={gotoProject}>{project.name}</a>
</td>
</tr>
{/if}
{#if task.parent}
<tr>
<th>{t('parent_task')}</th>
<td class="parent" onclick={gotoParent}>{task.parent.name}</td>
<td class="parent">
<a href="#" onclick={gotoParent}>{task.parent.name}</a>
</td>
</tr>
{/if}
<tr>
@ -282,7 +287,7 @@ @@ -282,7 +287,7 @@
</th>
<td class="children">
{#if children}
<TaskList tasks={children} {estimated_time} show_closed={task.show_closed} />
<TaskList states={project?.allowed_states} tasks={children} {estimated_time} show_closed={task.show_closed} />
{/if}
</td>
</tr>

3
translations/src/main/resources/de.json

@ -15,7 +15,6 @@ @@ -15,7 +15,6 @@
"bookmark": "Lesezeichen",
"by": "von",
"client_id": "Client-ID",
"client_secret": "Client-Geheimnis",
"close_settings": "Einstellungen schließen",
@ -57,7 +56,6 @@ @@ -57,7 +56,6 @@
"do_login" : "anmelden",
"do_open" : "öffnen",
"do_send" : "versenden",
"double_click_to_edit": "Doppel-klicken zum Bearbeiten",
"due_date": "Fälligkeitsdatum",
"edit": "Bearbeiten",
@ -106,6 +104,7 @@ @@ -106,6 +104,7 @@
"login" : "Anmeldung",
"login_services": "Login-Services",
"logout": "Abmelden",
"long_click_to_edit": "lang klicken zum Bearbeiten",
"MANAGE_LOGIN_SERVICES": "Login-Services verwalten",
"members": "Mitarbeiter",

Loading…
Cancel
Save