Compare commits

...

5 Commits

Author SHA1 Message Date
9a52262e2b Added updated to running and waiting jobs 2023-09-02 16:16:29 +02:00
c2b01c8961 Added CancelJob 2023-09-02 15:05:45 +02:00
63ed4fdda5 Added API calls for startjob, deleteJob 2023-09-02 14:14:18 +02:00
82f2d4636d Changed SampleManga in preview and Task -> Job 2023-09-02 14:13:58 +02:00
506ddf03e3 Sample Manga 2023-09-02 13:48:23 +02:00
4 changed files with 76 additions and 40 deletions

View File

@ -176,4 +176,9 @@ function UpdateLunaSea(lunaseaWebhook){
function RemoveJob(jobId){ function RemoveJob(jobId){
var uri = `${apiUri}/Jobs?jobId=${jobId}`; var uri = `${apiUri}/Jobs?jobId=${jobId}`;
DeleteData(uri); DeleteData(uri);
}
function CancelJob(jobId){
var uri = `${apiUri}/Jobs/Cancel?jobId=${jobId}`;
PostData(uri);
} }

View File

@ -27,8 +27,8 @@
<publication onclick="ShowNewMangaSearch()"> <publication onclick="ShowNewMangaSearch()">
<img alt="cover" src="media/cover.jpg"> <img alt="cover" src="media/cover.jpg">
<publication-information> <publication-information>
<connector-name class="pill">MangaDex</connector-name> <connector-name class="pill">Sample</connector-name>
<publication-name>Tensei Pandemic</publication-name> <publication-name>Best Manga there is</publication-name>
</publication-information> </publication-information>
</publication> </publication>
</content> </content>
@ -93,19 +93,18 @@
<publication-viewer> <publication-viewer>
<img id="pubviewcover" src="media/cover.jpg" alt="cover"> <img id="pubviewcover" src="media/cover.jpg" alt="cover">
<publication-information> <publication-information>
<publication-name id="publicationViewerName">Tensei Pandemic</publication-name> <publication-name id="publicationViewerName">Best Manga there is</publication-name>
<publication-tags id="publicationViewerTags"></publication-tags> <publication-tags id="publicationViewerTags">A Manga</publication-tags>
<publication-author id="publicationViewerAuthor">Imamura Hinata</publication-author> <publication-author id="publicationViewerAuthor">Glax</publication-author>
<publication-description id="publicationViewerDescription">Imamura Hinata is a high school boy with a cute appearance. <publication-description id="publicationViewerDescription">
Since his trauma with the first love, he wanted to be more manly than anybody else. But one day he woke up to something different… An interesting description. The description is very intriguing, yet wholesome.
The total opposite of his ideal male body!
Pandemic love comedy!
</publication-description> </publication-description>
<publication-interactions> <publication-interactions>
<publication-starttask>Start Task ▶️</publication-starttask> <publication-starttask id="startJobButton">Start Job ▶️</publication-starttask>
<publication-delete>Delete Task ❌</publication-delete> <publication-canceltask id="cancelJobButton">Cancel Job ❌</publication-canceltask>
<publication-add id="createMonitorTaskButton">Monitor </publication-add> <publication-delete id="deleteJobButton">Delete Job 🗑️</publication-delete>
<publication-add id="createDownloadChapterTaskButton">Download Chapter </publication-add> <publication-add id="createMonitorJobButton">Monitor </publication-add>
<publication-add id="createDownloadChapterJobButton">Download Chapter 📥</publication-add>
</publication-interactions> </publication-interactions>
</publication-information> </publication-information>
</publication-viewer> </publication-viewer>
@ -113,11 +112,11 @@
</viewport> </viewport>
<footer> <footer>
<div onclick="ShowTasksQueue();"> <div onclick="ShowJobQueue();">
<img src="media/running.svg" alt="running"><div id="tasksRunningTag">0</div> <img src="media/running.svg" alt="running"><div id="jobsRunningTag">0</div>
</div> </div>
<div onclick="ShowTasksQueue();"> <div onclick="ShowJobQueue();">
<img src="media/queue.svg" alt="queue"><div id="tasksQueuedTag">0</div> <img src="media/queue.svg" alt="queue"><div id="jobsQueuedTag">0</div>
</div> </div>
<p id="madeWith">Made with Blåhaj 🦈</p> <p id="madeWith">Made with Blåhaj 🦈</p>
</footer> </footer>

View File

@ -2,13 +2,17 @@
let notificationConnectorTypes = []; let notificationConnectorTypes = [];
let libraryConnectorTypes = []; let libraryConnectorTypes = [];
let selectedManga; let selectedManga;
let selectedJob;
const searchBox = document.querySelector("#searchbox"); const searchBox = document.querySelector("#searchbox");
const settingsPopup = document.querySelector("#settingsPopup"); const settingsPopup = document.querySelector("#settingsPopup");
const settingsCog = document.querySelector("#settingscog"); const settingsCog = document.querySelector("#settingscog");
const tasksContent = document.querySelector("content"); const tasksContent = document.querySelector("content");
const createMonitorTaskButton = document.querySelector("#createMonitorTaskButton"); const createMonitorTaskButton = document.querySelector("#createMonitoJobButton");
const createDownloadChapterTaskButton = document.querySelector("#createDownloadChapterTaskButton"); const createDownloadChapterTaskButton = document.querySelector("#createDownloadChapterJobButton");
const startJobButton = document.querySelector("#startJobButton");
const cancelJobButton = document.querySelector("#cancelJobButton");
const deleteJobButton = document.querySelector("#deleteJobButton");
const mangaViewerPopup = document.querySelector("#publicationViewerPopup"); const mangaViewerPopup = document.querySelector("#publicationViewerPopup");
const mangaViewerWindow = document.querySelector("publication-viewer"); const mangaViewerWindow = document.querySelector("publication-viewer");
const mangaViewerDescription = document.querySelector("#publicationViewerDescription"); const mangaViewerDescription = document.querySelector("#publicationViewerDescription");
@ -16,8 +20,6 @@ const mangaViewerName = document.querySelector("#publicationViewerName");
const mangaViewerTags = document.querySelector("#publicationViewerTags"); const mangaViewerTags = document.querySelector("#publicationViewerTags");
const mangaViewerAuthor = document.querySelector("#publicationViewerAuthor"); const mangaViewerAuthor = document.querySelector("#publicationViewerAuthor");
const mangaViewCover = document.querySelector("#pubviewcover"); const mangaViewCover = document.querySelector("#pubviewcover");
const publicationDelete = document.querySelector("publication-delete");
const publicationTaskStart = document.querySelector("publication-starttask");
const settingDownloadLocation = document.querySelector("#downloadLocation"); const settingDownloadLocation = document.querySelector("#downloadLocation");
const settingKomgaUrl = document.querySelector("#komgaUrl"); const settingKomgaUrl = document.querySelector("#komgaUrl");
const settingKomgaUser = document.querySelector("#komgaUsername"); const settingKomgaUser = document.querySelector("#komgaUsername");
@ -37,6 +39,8 @@ const newMangaPopup = document.querySelector("#newMangaPopup");
const newMangaConnector = document.querySelector("#newMangaConnector"); const newMangaConnector = document.querySelector("#newMangaConnector");
const newMangaTitle = document.querySelector("#newMangaTitle"); const newMangaTitle = document.querySelector("#newMangaTitle");
const newMangaResult = document.querySelector("#newMangaResult"); const newMangaResult = document.querySelector("#newMangaResult");
const jobsRunningTag = document.querySelector("#jobsRunningTag");
const jobsQueuedTag = document.querySelector("#jobsQueuedTag");
function Setup(){ function Setup(){
GetAvailableNotificationConnectors().then((json) => { GetAvailableNotificationConnectors().then((json) => {
@ -99,7 +103,7 @@ function GetNewMangaItems(){
var mangaElement = CreateManga(result, newMangaConnector.value) var mangaElement = CreateManga(result, newMangaConnector.value)
newMangaResult.appendChild(mangaElement); newMangaResult.appendChild(mangaElement);
mangaElement.addEventListener("click", (event) => { mangaElement.addEventListener("click", (event) => {
ShowMangaWindow(result, event, true); ShowMangaWindow(null, result, event, true);
}); });
}); });
@ -127,17 +131,28 @@ function CreateManga(manga, connector){
return mangaElement; return mangaElement;
} }
createMonitorTaskButton.addEventListener("click", () => { createMonitorJobButton.addEventListener("click", () => {
NewMonitorJob();
mangaViewerPopup.style.display = "none";
});
function NewMonitorJob(){
CreateMonitorJob(newMangaConnector.value, selectedManga.internalId); CreateMonitorJob(newMangaConnector.value, selectedManga.internalId);
UpdateJobs(); UpdateJobs();
} mangaViewerPopup.style.display = "none";
});
startJobButton.addEventListener("click", () => {
StartJob(selectedJob.id);
mangaViewerPopup.style.display = "none";
});
cancelJobButton.addEventListener("click", () => {
CancelJob(selectedJob.id);
mangaViewerPopup.style.display = "none";
});
deleteJobButton.addEventListener("click", () => {
RemoveJob(selectedJob.id);
UpdateJobs();
mangaViewerPopup.style.display = "none";
});
function ShowMangaWindow(manga, event, add){ function ShowMangaWindow(job, manga, event, add){
selectedManga = manga; selectedManga = manga;
selectedJob = job;
//Show popup //Show popup
mangaViewerPopup.style.display = "block"; mangaViewerPopup.style.display = "block";
@ -162,16 +177,18 @@ function ShowMangaWindow(manga, event, add){
//Check what action should be listed //Check what action should be listed
if(add){ if(add){
createMonitorTaskButton.style.display = "initial"; createMonitorJobButton.style.display = "initial";
createDownloadChapterTaskButton.style.display = "initial"; createDownloadChapterJobButton.style.display = "initial";
publicationDelete.style.display = "none"; cancelJobButton.style.display = "none";
publicationTaskStart.style.display = "none"; startJobButton.style.display = "none";
deleteJobButton.style.display = "none";
} }
else{ else{
createMonitorTaskButton.style.display = "none"; createMonitorJobButton.style.display = "none";
createDownloadChapterTaskButton.style.display = "none"; createDownloadChapterJobButton.style.display = "none";
publicationDelete.style.display = "initial"; cancelJobButton.style.display = "initial";
publicationTaskStart.style.display = "initial"; startJobButton.style.display = "initial";
deleteJobButton.style.display = "initial";
} }
} }
@ -180,7 +197,6 @@ function HidePublicationPopup(){
} }
searchBox.addEventListener("keyup", () => FilterResults()); searchBox.addEventListener("keyup", () => FilterResults());
//Filter shown jobs //Filter shown jobs
function FilterResults(){ function FilterResults(){
if(searchBox.value.length > 0){ if(searchBox.value.length > 0){
@ -329,13 +345,25 @@ setInterval(() => {
function UpdateJobs(){ function UpdateJobs(){
GetMonitorJobs().then((json) => { GetMonitorJobs().then((json) => {
ResetContent(); ResetContent();
console.log(json); //console.log(json);
json.forEach(job => { json.forEach(job => {
var mangaView = CreateManga(job.manga, job.mangaConnector.name); var mangaView = CreateManga(job.manga, job.mangaConnector.name);
mangaView.addEventListener("click", (event) => { mangaView.addEventListener("click", (event) => {
ShowMangaWindow(job.manga, event, false); ShowMangaWindow(job, job.manga, event, false);
}); });
tasksContent.appendChild(mangaView); tasksContent.appendChild(mangaView);
}); });
}); });
GetRunningJobs().then((json) => {
console.log("Running");
console.log(json);
jobsRunningTag.innerText = json.length;
});
GetWaitingJobs().then((json) => {
console.log("Waiting");
console.log(json);
jobsQueuedTag.innerText = json.length;
});
} }

View File

@ -462,6 +462,10 @@ publication-viewer publication-information publication-interactions publication-
color: red; color: red;
} }
publication-view publication-information publication-interactions publication-canceltask {
color: yellow;
}
publication-viewer publication-information publication-interactions publication-add { publication-viewer publication-information publication-interactions publication-add {
color: limegreen; color: limegreen;
} }