Delete Task
This commit is contained in:
parent
201773af50
commit
c557389967
@ -46,7 +46,6 @@
|
|||||||
</window-titlebar>
|
</window-titlebar>
|
||||||
<window-content>
|
<window-content>
|
||||||
<addtask-settings>
|
<addtask-settings>
|
||||||
<addtask-setting><label for="taskTypes">TaskType</label><select id="taskTypes"></select></addtask-setting>
|
|
||||||
<addtask-setting><label for="selectReccurrence">Recurrence</label><input id="selectReccurrence" type="time" value="01:00" step="3600"></addtask-setting>
|
<addtask-setting><label for="selectReccurrence">Recurrence</label><input id="selectReccurrence" type="time" value="01:00" step="3600"></addtask-setting>
|
||||||
<addtask-setting><label for="connectors">Connector</label>
|
<addtask-setting><label for="connectors">Connector</label>
|
||||||
<select id="connectors">
|
<select id="connectors">
|
||||||
|
@ -20,6 +20,7 @@ const slideOutRightTiming = {
|
|||||||
|
|
||||||
let publications = [];
|
let publications = [];
|
||||||
let tasks = [];
|
let tasks = [];
|
||||||
|
let toRemoveId;
|
||||||
|
|
||||||
const taskTypesSelect = document.querySelector("#taskTypes")
|
const taskTypesSelect = document.querySelector("#taskTypes")
|
||||||
const searchPublicationQuery = document.querySelector("#searchPublicationQuery");
|
const searchPublicationQuery = document.querySelector("#searchPublicationQuery");
|
||||||
@ -40,9 +41,11 @@ const publicationDelete = document.querySelector("publication-delete");
|
|||||||
const closetaskpopup = document.querySelector("#closePopupImg");
|
const closetaskpopup = document.querySelector("#closePopupImg");
|
||||||
|
|
||||||
settingsCog.addEventListener("click", () => slide());
|
settingsCog.addEventListener("click", () => slide());
|
||||||
closetaskpopup.addEventListener("click", () => HidePopup())
|
closetaskpopup.addEventListener("click", () => HidePopup());
|
||||||
document.querySelector("blur-background").addEventListener("click", () => HidePopup());
|
document.querySelector("blur-background").addEventListener("click", () => HidePopup());
|
||||||
|
publicationDelete.addEventListener("click", () => DeleteTaskClick());
|
||||||
|
|
||||||
|
/*
|
||||||
let availableTaskTypes;
|
let availableTaskTypes;
|
||||||
GetTaskTypes()
|
GetTaskTypes()
|
||||||
.then(json => availableTaskTypes = json)
|
.then(json => availableTaskTypes = json)
|
||||||
@ -52,7 +55,7 @@ GetTaskTypes()
|
|||||||
option.value = taskType;
|
option.value = taskType;
|
||||||
option.innerText = taskType;
|
option.innerText = taskType;
|
||||||
taskTypesSelect.appendChild(option);
|
taskTypesSelect.appendChild(option);
|
||||||
}));
|
}));*/
|
||||||
|
|
||||||
let availableConnectors;
|
let availableConnectors;
|
||||||
GetAvailableControllers()
|
GetAvailableControllers()
|
||||||
@ -76,7 +79,7 @@ searchPublicationQuery.addEventListener("keypress", (event) => {
|
|||||||
json.forEach(publication => {
|
json.forEach(publication => {
|
||||||
var option = CreatePublication(publication, connectorSelect.value);
|
var option = CreatePublication(publication, connectorSelect.value);
|
||||||
option.addEventListener("click", () => {
|
option.addEventListener("click", () => {
|
||||||
CreateTask(taskTypesSelect.value, selectRecurrence.value, connectorSelect.value, publication.internalId, "en");
|
CreateTask("DownloadNewChapters", selectRecurrence.value, connectorSelect.value, publication.internalId, "en");
|
||||||
selectPublication.replaceChildren();
|
selectPublication.replaceChildren();
|
||||||
});
|
});
|
||||||
selectPublication.appendChild(option);
|
selectPublication.appendChild(option);
|
||||||
@ -105,8 +108,21 @@ function CreatePublication(publication, connector){
|
|||||||
return publicationElement;
|
return publicationElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
function DeleteTask(taskType, connectorName, publicationId){
|
function DeleteTaskClick(){
|
||||||
|
taskToDelete = tasks.filter(tTask => tTask.publication.internalId === toRemoveId)[0];
|
||||||
|
DeleteTask("DownloadNewChapters", taskToDelete.connectorName, toRemoveId);
|
||||||
|
ResetContent();
|
||||||
|
GetTasks()
|
||||||
|
//.then(json => console.log(json))
|
||||||
|
.then(json => json.forEach(task => {
|
||||||
|
var publication = CreatePublication(task.publication, task.connectorName);
|
||||||
|
publication.addEventListener("click", (event) => ShowPublicationViewerWindow(task.publication.internalId, event));
|
||||||
|
tasksContent.appendChild(publication);
|
||||||
|
|
||||||
|
if(tasks.filter(tTask => tTask.publication.internalId === task.publication.internalId) < 1)
|
||||||
|
tasks.push(task);
|
||||||
|
}));
|
||||||
|
HidePopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
var slideIn = true;
|
var slideIn = true;
|
||||||
@ -134,7 +150,6 @@ function ShowPopup(){
|
|||||||
generalPopup.animate(fadeIn, fadeInTiming);
|
generalPopup.animate(fadeIn, fadeInTiming);
|
||||||
}
|
}
|
||||||
|
|
||||||
let toRemoveId;
|
|
||||||
function ShowPublicationViewerWindow(publicationId, event){
|
function ShowPublicationViewerWindow(publicationId, event){
|
||||||
publicationViewer.style.top = `${event.clientY - 60}px`;
|
publicationViewer.style.top = `${event.clientY - 60}px`;
|
||||||
publicationViewer.style.left = `${event.clientX}px`;
|
publicationViewer.style.left = `${event.clientX}px`;
|
||||||
@ -144,6 +159,7 @@ function ShowPublicationViewerWindow(publicationId, event){
|
|||||||
publicationViewerDescription.innerText = publication.description;
|
publicationViewerDescription.innerText = publication.description;
|
||||||
publicationViewerAuthor.innerText = publication.author;
|
publicationViewerAuthor.innerText = publication.author;
|
||||||
pubviewcover.src = publication.posterUrl;
|
pubviewcover.src = publication.posterUrl;
|
||||||
|
toRemoveId = publicationId;
|
||||||
|
|
||||||
toRemoveId = publicationId;
|
toRemoveId = publicationId;
|
||||||
publicationViewer.style.display = "block";
|
publicationViewer.style.display = "block";
|
||||||
@ -179,8 +195,8 @@ GetTasks()
|
|||||||
var publication = CreatePublication(task.publication, task.connectorName);
|
var publication = CreatePublication(task.publication, task.connectorName);
|
||||||
publication.addEventListener("click", (event) => ShowPublicationViewerWindow(task.publication.internalId, event));
|
publication.addEventListener("click", (event) => ShowPublicationViewerWindow(task.publication.internalId, event));
|
||||||
tasksContent.appendChild(publication);
|
tasksContent.appendChild(publication);
|
||||||
|
|
||||||
if(tasks.filter(task => task.publication.internalId === publication.internalId) < 1)
|
if(tasks.filter(tTask => tTask.publication.internalId === task.publication.internalId) < 1)
|
||||||
tasks.push(task);
|
tasks.push(task);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@ -193,7 +209,7 @@ setInterval(() => {
|
|||||||
publication.addEventListener("click", (event) => ShowPublicationViewerWindow(task.publication.internalId, event));
|
publication.addEventListener("click", (event) => ShowPublicationViewerWindow(task.publication.internalId, event));
|
||||||
tasksContent.appendChild(publication);
|
tasksContent.appendChild(publication);
|
||||||
|
|
||||||
if(tasks.filter(task => task.publication.internalId === publication.internalId) < 1)
|
if(tasks.filter(tTask => tTask.publication.internalId === task.publication.internalId) < 1)
|
||||||
tasks.push(task);
|
tasks.push(task);
|
||||||
}));
|
}));
|
||||||
}, 5000);
|
}, 5000);
|
Loading…
Reference in New Issue
Block a user