diff --git a/php/src/app/Http/Controllers/ApiController.php b/php/src/app/Http/Controllers/ApiController.php
new file mode 100644
index 0000000..ebecd0c
--- /dev/null
+++ b/php/src/app/Http/Controllers/ApiController.php
@@ -0,0 +1,31 @@
+ $artist->id,
+ 'name' => $artist->name,
+ 'url_remote' => $artist->url_remote,
+ 'state' => $artist->state,
+ 'thumbnail' => $artist->thumbnail,
+ ];
+ }
+
+ \Log::info('=======================');
+ $response = json_encode( array('data' => $data));
+ \Log::info($response);
+ return $response;
+ }
+}
diff --git a/php/src/app/Models/ArtistQueue.php b/php/src/app/Models/ArtistQueue.php
new file mode 100644
index 0000000..f31943f
--- /dev/null
+++ b/php/src/app/Models/ArtistQueue.php
@@ -0,0 +1,11 @@
+id();
+ $table->timestamps();
+ $table->foreignId('artist_id')->constrained('artists');
+ $table->foreignId('album_id')->nullable()->constrained('albums');
+ $table->enum('state', [
+ 'pending',
+ 'in_progress',
+ 'done',
+ ])->default('pending');
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::dropIfExists('artist_queues');
+ }
+};
diff --git a/php/src/public/js/app.js b/php/src/public/js/app.js
index fee44e6..8dec7b1 100644
--- a/php/src/public/js/app.js
+++ b/php/src/public/js/app.js
@@ -57,6 +57,7 @@ $('#download_btn').on('click', () => {
let icon = 'error';
let title = 'What the flip?!';
+ // Send request to server
setTimeout(() => {
if (artist) {
console.log('Sending search request...');
@@ -85,7 +86,7 @@ $('#download_btn').on('click', () => {
proc_notification(icon, title, 'You need to add an artist, c\'mon man!');
loader.fadeOut(700);
}
- }, 100);
+ }, 10);
});
@@ -96,7 +97,7 @@ document.addEventListener('alpine:init', () => {
// TODO: Poll for artists and queue
this.Artists = [];
this.Queue = [];
- this.ArtistResults = []
+ this.ArtistResults = [];
},
Artists: [], // Rendered in the 'Artists' modal
@@ -108,3 +109,28 @@ document.addEventListener('alpine:init', () => {
$("#loader-wrapper").fadeOut(900);
});
+
+$(document).ready(function () {
+ let ArtistTable = $('#artistsCatalogDatatable').DataTable({
+ ajax: '/api/artists',
+ type: 'get',
+ dataType: 'json',
+ columns: [
+ {data: 'thumbnail', render: (data) => { return ``}},
+ {data: 'name'},
+ {title: 'Channel', data: 'url_remote', render: (data) => {return ``}},
+ {data: 'state'},
+ {data: 'id', render: (data, row) => {
+ let stateDiable = row.state === 'in_progress' ? 'disabled': '';
+ let stateClass = row.state === 'in_progress' ? '': 'btn-primary';
+ return ``}
+ }
+ ],
+ });
+
+ // const getArtistTableInterval = setInterval(function() {
+ // table.ajax.reload();
+ // }, 5000);
+
+});
+
diff --git a/php/src/resources/views/modals/modal-catalog.blade.php b/php/src/resources/views/modals/modal-catalog.blade.php
index e8b2bcb..87b6769 100644
--- a/php/src/resources/views/modals/modal-catalog.blade.php
+++ b/php/src/resources/views/modals/modal-catalog.blade.php
@@ -5,13 +5,37 @@
class="modal-dialog modal-dialog-centered modal-fullscreen modal-dialog-scrollable modal-fullscreen-md-down modal-fullscreen-sm-down">