Skip to content

Commit 5f8101d

Browse files
authored
Merge pull request #536 from arabcoders/dev
New Events Viewer WebUI & migrated state:progress to the new events system.
2 parents c1a47d1 + a82ebf8 commit 5f8101d

40 files changed

+1689
-870
lines changed

FAQ.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ command via CLI.
402402

403403
> [!IMPORTANT]
404404
> for environment variables that has `{TASK}` tag, you **MUST** replace it with one
405-
> of `IMPORT`, `EXPORT`, `PUSH`, `BACKUP`, `PRUNE`, `INDEXES`, `REQUESTS`. To see tasks active settings run
405+
> of `IMPORT`, `EXPORT`, `PUSH`, `BACKUP`, `PRUNE`, `INDEXES`. To see tasks active settings run
406406
407407
```bash
408408
$ docker exec -ti watchstate console system:tasks

README.md

+8
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ out of the box, this tool support `Jellyfin`, `Plex` and `Emby` media servers.
99

1010
## Updates
1111

12+
### 2024-08-18
13+
14+
We have started migrating the old events system to a new one, so far we have migrated the `progress` and `requests` to it. As such,
15+
The old tasks `state:progress` and `state:requests` are now gone. To control if you want to enable the watch progress, there is new
16+
environment variable `WS_SYNC_PROGRESS` which you can set to `true` to enable the watch progress. It's disabled by default.
17+
18+
We will continue to migrate the rest of the events to the new system, and we will keep you updated.
19+
1220
### 2024-08-10
1321

1422
I have recently added new experimental feature, to play your content directly from the WebUI. This feature is still in

bin/console

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ try {
6363
]
6464
);
6565
fwrite(STDERR, $message . PHP_EOL);
66+
fwrite(STDERR, $e->getTraceAsString() . PHP_EOL);
6667
exit(503);
6768
}
6869

config/config.php

+3-18
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99
use App\Commands\State\BackupCommand;
1010
use App\Commands\State\ExportCommand;
1111
use App\Commands\State\ImportCommand;
12-
use App\Commands\State\ProgressCommand;
1312
use App\Commands\State\PushCommand;
14-
use App\Commands\State\RequestsCommand;
1513
use App\Commands\System\IndexCommand;
1614
use App\Commands\System\PruneCommand;
1715
use App\Libs\Mappers\Import\MemoryMapper;
@@ -76,6 +74,9 @@
7674
'proxy' => (bool)env('WS_TRUST_PROXY', false),
7775
'header' => (string)env('WS_TRUST_HEADER', 'X-Forwarded-For'),
7876
],
77+
'sync' => [
78+
'progress' => (bool)env('WS_SYNC_PROGRESS', false),
79+
],
7980
];
8081

8182
$config['backends_file'] = fixPath(env('WS_BACKENDS_FILE', ag($config, 'path') . '/config/servers.yaml'));
@@ -273,14 +274,6 @@
273274
'timer' => $checkTaskTimer((string)env('WS_CRON_PUSH_AT', '*/10 * * * *'), '*/10 * * * *'),
274275
'args' => env('WS_CRON_PUSH_ARGS', '-v'),
275276
],
276-
ProgressCommand::TASK_NAME => [
277-
'command' => ProgressCommand::ROUTE,
278-
'name' => ProgressCommand::TASK_NAME,
279-
'info' => 'Send play progress to backends.',
280-
'enabled' => (bool)env('WS_CRON_PROGRESS', false),
281-
'timer' => $checkTaskTimer((string)env('WS_CRON_PROGRESS_AT', '*/45 * * * *'), '*/45 * * * *'),
282-
'args' => env('WS_CRON_PROGRESS_ARGS', '-v'),
283-
],
284277
BackupCommand::TASK_NAME => [
285278
'command' => BackupCommand::ROUTE,
286279
'name' => BackupCommand::TASK_NAME,
@@ -305,14 +298,6 @@
305298
'timer' => $checkTaskTimer((string)env('WS_CRON_INDEXES_AT', '0 3 * * 3'), '0 3 * * 3'),
306299
'args' => env('WS_CRON_INDEXES_ARGS', '-v'),
307300
],
308-
RequestsCommand::TASK_NAME => [
309-
'command' => RequestsCommand::ROUTE,
310-
'name' => RequestsCommand::TASK_NAME,
311-
'info' => 'Process queued http requests.',
312-
'enabled' => (bool)env('WS_CRON_REQUESTS', true),
313-
'timer' => $checkTaskTimer((string)env('WS_CRON_REQUESTS_AT', '*/2 * * * *'), '*/2 * * * *'),
314-
'args' => env('WS_CRON_REQUESTS_ARGS', '-v --no-stats'),
315-
],
316301
DispatchCommand::TASK_NAME => [
317302
'command' => DispatchCommand::ROUTE,
318303
'name' => DispatchCommand::TASK_NAME,

config/env.spec.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@
161161
'description' => 'All executing all commands in the console. They must be prefixed with $',
162162
'type' => 'bool',
163163
],
164+
[
165+
'key' => 'WS_SYNC_PROGRESS',
166+
'description' => 'Enable watch progress sync.',
167+
'type' => 'bool',
168+
],
164169
];
165170

166171
$validateCronExpression = function (string $value): string {
@@ -186,7 +191,7 @@
186191
};
187192

188193
// -- Do not forget to update the tasks list if you add a new task.
189-
$tasks = ['import', 'export', 'push', 'progress', 'backup', 'prune', 'indexes', 'requests'];
194+
$tasks = ['import', 'export', 'push', 'backup', 'prune', 'indexes'];
190195
$task_env = [
191196
[
192197
'key' => 'WS_CRON_{TASK}',

frontend/components/Pager.vue

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<template>
2+
<div class="field is-grouped">
3+
<div class="control">
4+
<button rel="first" class="button" v-if="page !== 1" @click="changePage(1)" :disabled="isLoading"
5+
:class="{'is-loading':isLoading}">
6+
<span class="icon"><i class="fas fa-angle-double-left"></i></span>
7+
</button>
8+
</div>
9+
<div class="control">
10+
<button rel="prev" class="button" v-if="page > 1 && (page-1) !== 1" @click="changePage(page-1)"
11+
:disabled="isLoading" :class="{'is-loading':isLoading}">
12+
<span class="icon"><i class="fas fa-angle-left"></i></span>
13+
</button>
14+
</div>
15+
<div class="control">
16+
<div class="select">
17+
<select id="pager_list" v-model="currentPage" @change="changePage(currentPage)" :disabled="isLoading">
18+
<option v-for="(item, index) in makePagination(page, last_page)" :key="`pager-${index}`"
19+
:value="item.page" :disabled="0 === item.page">
20+
{{ item.text }}
21+
</option>
22+
</select>
23+
</div>
24+
</div>
25+
<div class="control">
26+
<button rel="next" class="button" v-if="page !== last_page && ( page + 1 ) !== last_page"
27+
@click="changePage( page + 1 )" :disabled="isLoading" :class="{ 'is-loading': isLoading }">
28+
<span class="icon"><i class="fas fa-angle-right"></i></span>
29+
</button>
30+
</div>
31+
<div class="control">
32+
<button rel="last" class="button" v-if="page !== last_page" @click="changePage(last_page)"
33+
:disabled="isLoading" :class="{ 'is-loading': isLoading }">
34+
<span class="icon"><i class="fas fa-angle-double-right"></i></span>
35+
</button>
36+
</div>
37+
</div>
38+
</template>
39+
40+
<script setup>
41+
import {makePagination} from '~/utils/index'
42+
43+
const emitter = defineEmits(['navigate'])
44+
45+
const props = defineProps({
46+
page: {
47+
type: Number,
48+
required: true
49+
},
50+
last_page: {
51+
type: Number,
52+
required: true
53+
},
54+
isLoading: {
55+
type: Boolean,
56+
required: false,
57+
default: false
58+
},
59+
})
60+
61+
const changePage = p => {
62+
if (p < 1 || p > props.last_page) {
63+
return
64+
}
65+
emitter('navigate', p)
66+
currentPage.value = p
67+
}
68+
69+
const currentPage = ref(props.page)
70+
</script>

frontend/layouts/default.vue

+6-1
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,15 @@
7979
<hr class="navbar-divider">
8080

8181
<NuxtLink class="navbar-item" to="/events" @click.native="(e) => changeRoute(e)">
82-
<span class="icon"><i class="fas fa-list"></i></span>
82+
<span class="icon"><i class="fas fa-calendar-alt"></i></span>
8383
<span>Events</span>
8484
</NuxtLink>
8585

86+
<NuxtLink class="navbar-item" to="/old_events" @click.native="(e) => changeRoute(e)">
87+
<span class="icon"><i class="fas fa-list"></i></span>
88+
<span>Old Events</span>
89+
</NuxtLink>
90+
8691
<NuxtLink class="navbar-item" to="/ignore" @click.native="(e) => changeRoute(e)">
8792
<span class="icon"><i class="fas fa-ban"></i></span>
8893
<span>Ignore List</span>

0 commit comments

Comments
 (0)