Skip to content

Commit ba47a9d

Browse files
authored
Merge pull request #23 from compgeniuses/UI
UI
2 parents cb17864 + c4c6c3c commit ba47a9d

File tree

9 files changed

+113
-31
lines changed

9 files changed

+113
-31
lines changed

imageroot/actions/configure-module/validate-input.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"type": "string"
3838
},
3939
"PAPERLESS_TIME_ZONE": {
40-
"type": "boolean"
40+
"type": "string"
4141
},
4242
"PAPERLESS_OCR_LANGUAGE": {
4343
"type": "string"

imageroot/actions/get-configuration/validate-output.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"type": "string"
3838
},
3939
"PAPERLESS_TIME_ZONE": {
40-
"type": "boolean"
40+
"type": "string"
4141
},
4242
"PAPERLESS_OCR_LANGUAGE": {
4343
"type": "string"

ui/public/i18n/de/translation.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
"validation_error": "Überprüfungsfehler"
1313
},
1414
"settings": {
15+
"settings.paperless_fqdn": "Paperless FQDN",
16+
"settings.paperless_admin": "Paperless Admin",
17+
"settings.paperless_admin_password": "Paperless admin password",
1518
"test_field": "Testfeld",
1619
"configure_instance": "Konfiguriere {instance}",
1720
"save": "Speichern",
@@ -36,7 +39,9 @@
3639
"title": "Status",
3740
"installation_node": "Installations-Knoten",
3841
"node": "Knoten",
39-
"no_volumes": "keine Volumen"
42+
"no_volumes": "keine Volumen",
43+
"status.paperless_url": "Paperless URL",
44+
"status.open_paperless_page": "Go to Paperless"
4045
},
4146
"about": {
4247
"title": "Über"

ui/public/i18n/en/translation.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,15 @@
1818
"mount": "Mount",
1919
"no_services": "No services",
2020
"no_images": "No images",
21-
"no_volumes": "No volumes"
21+
"no_volumes": "No volumes",
22+
"status.paperless_url": "Paperless URL",
23+
"status.open_paperless_page": "Go to Paperless"
2224
},
2325
"settings": {
2426
"title": "Settings",
27+
"settings.paperless_fqdn": "Paperless FQDN",
28+
"settings.paperless_admin": "Paperless Admin",
29+
"settings.paperless_admin_password": "Paperless admin password",
2530
"configure_instance": "Configure {instance}",
2631
"save": "Save",
2732
"test_field": "Test field"

ui/public/i18n/es/translation.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
"validation_error": "Error de validación"
1313
},
1414
"settings": {
15+
"settings.paperless_fqdn": "Paperless FQDN",
16+
"settings.paperless_admin": "Paperless Admin",
17+
"settings.paperless_admin_password": "Paperless admin password",
1518
"test_field": "Campo de prueba",
1619
"configure_instance": "Configurar {instance}",
1720
"save": "Guardar",
@@ -36,7 +39,9 @@
3639
"title": "Estado",
3740
"installation_node": "Nodo de instalación",
3841
"node": "Nodo",
39-
"no_volumes": "Sin volúmenes"
42+
"no_volumes": "Sin volúmenes",
43+
"status.paperless_url": "Paperless URL",
44+
"status.open_paperless_page": "Go to Paperless"
4045
},
4146
"about": {
4247
"title": "Acerca de"

ui/public/i18n/it/translation.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,14 @@
1818
"app_instance": "Istanza app",
1919
"app_volumes": "Volume app|Volumi app",
2020
"installation_node": "Nodo",
21-
"mount": "Percorso di mount"
21+
"mount": "Percorso di mount",
22+
"status.paperless_url": "Paperless URL",
23+
"status.open_paperless_page": "Go to Paperless"
2224
},
2325
"settings": {
26+
"settings.paperless_fqdn": "Paperless FQDN",
27+
"settings.paperless_admin": "Paperless Admin",
28+
"settings.paperless_admin_password": "Paperless admin password",
2429
"save": "Salva",
2530
"title": "Impostazioni",
2631
"configure_instance": "Configura {instance}",

ui/public/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "paperless",
33
"description": {
4-
"en": "Paperless ngx"
4+
"en": "Paperless-ngx is a community-supported open-source document management system that transforms your physical documents into a searchable online archive so you can keep, well, less paper."
55
},
66
"categories": ["collaboration"],
77
"authors": [

ui/src/views/Settings.vue

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<cv-tile :light="true">
2121
<cv-form @submit.prevent="configureModule">
2222
<cv-text-input
23-
:label="$t('settings.host')"
23+
:label="$t('settings.paperless_fqdn')"
2424
placeholder="paperless.example.org"
2525
v-model.trim="host"
2626
class="mg-bottom"
@@ -29,16 +29,27 @@
2929
ref="host"
3030
>
3131
</cv-text-input>
32-
<cv-password-input
33-
:label="$t('settings.PAPERLESS_ADMIN_PASSWORD')"
34-
placeholder="***************"
35-
v-model.trim="PAPERLESS_ADMIN_PASSWORD"
32+
<cv-text-input
33+
:label="$t('settings.paperless_admin')"
34+
placeholder="paperlessadmin"
35+
v-model="PAPERLESS_ADMIN_USER"
3636
class="mg-bottom"
37-
:invalid-message="$t(error.host)"
37+
:invalid-message="$t(error.PAPERLESS_ADMIN_USER)"
38+
:disabled="loading.getConfiguration || loading.configureModule"
39+
ref="PAPERLESS_ADMIN_USER"
40+
>
41+
</cv-text-input>
42+
<cv-text-input
43+
:label="$t('settings.paperless_admin_password')"
44+
placeholder="P@perle5$"
45+
v-model="PAPERLESS_ADMIN_PASSWORD"
46+
class="mg-bottom"
47+
:invalid-message="$t(error.PAPERLESS_ADMIN_PASSWORD)"
3848
:disabled="loading.getConfiguration || loading.configureModule"
49+
type="password"
3950
ref="PAPERLESS_ADMIN_PASSWORD"
4051
>
41-
</cv-password-input>
52+
</cv-text-input>
4253
<cv-toggle
4354
value="letsEncrypt"
4455
:label="$t('settings.lets_encrypt')"
@@ -114,6 +125,8 @@ export default {
114125
},
115126
urlCheckInterval: null,
116127
host: "",
128+
PAPERLESS_ADMIN_USER: "",
129+
PAPERLESS_ADMIN_PASSWORD: "",
117130
isLetsEncryptEnabled: false,
118131
isHttpToHttpsEnabled: false,
119132
loading: {
@@ -124,6 +137,7 @@ export default {
124137
getConfiguration: "",
125138
configureModule: "",
126139
host: "",
140+
PAPERLESS_ADMIN_USER: "",
127141
PAPERLESS_ADMIN_PASSWORD: "",
128142
lets_encrypt: "",
129143
http2https: "",
@@ -192,6 +206,7 @@ export default {
192206
getConfigurationCompleted(taskContext, taskResult) {
193207
const config = taskResult.output;
194208
this.host = config.host;
209+
this.PAPERLESS_ADMIN_USER = config.PAPERLESS_ADMIN_USER;
195210
this.PAPERLESS_ADMIN_PASSWORD = config.PAPERLESS_ADMIN_PASSWORD;
196211
this.isLetsEncryptEnabled = config.lets_encrypt;
197212
this.isHttpToHttpsEnabled = config.http2https;
@@ -211,6 +226,14 @@ export default {
211226
}
212227
isValidationOk = false;
213228
}
229+
if (!this.PAPERLESS_ADMIN_USER) {
230+
this.error.PAPERLESS_ADMIN_USER = "common.required";
231+
232+
if (isValidationOk) {
233+
this.focusElement("PAPERLESS_ADMIN_USER");
234+
}
235+
isValidationOk = false;
236+
}
214237
if (!this.PAPERLESS_ADMIN_PASSWORD) {
215238
this.error.PAPERLESS_ADMIN_PASSWORD = "common.required";
216239
@@ -272,6 +295,8 @@ export default {
272295
action: taskAction,
273296
data: {
274297
host: this.host,
298+
PAPERLESS_ADMIN_USER: this.PAPERLESS_ADMIN_USER,
299+
PAPERLESS_ADMIN_PASSWORD: this.PAPERLESS_ADMIN_PASSWORD,
275300
lets_encrypt: this.isLetsEncryptEnabled,
276301
http2https: this.isHttpToHttpsEnabled,
277302
},
@@ -312,4 +337,4 @@ export default {
312337
.mg-bottom {
313338
margin-bottom: $spacing-06;
314339
}
315-
</style>
340+
</style>

ui/src/views/Status.vue

Lines changed: 53 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
<!--
2-
Copyright (C) 2023 Nethesis S.r.l.
3-
SPDX-License-Identifier: GPL-3.0-or-later
4-
-->
51
<template>
62
<cv-grid fullWidth>
73
<cv-row>
@@ -280,26 +276,21 @@ import {
280276
TaskService,
281277
IconService,
282278
UtilService,
283-
PageTitleService,
284279
} from "@nethserver/ns8-ui-lib";
285-
280+
import Settings32 from "@carbon/icons-vue/es/settings/32";
286281
export default {
287282
name: "Status",
288-
mixins: [
289-
TaskService,
290-
QueryParamService,
291-
IconService,
292-
UtilService,
293-
PageTitleService,
294-
],
283+
mixins: [TaskService, QueryParamService, IconService, UtilService],
295284
pageTitle() {
296285
return this.$t("status.title") + " - " + this.appName;
297286
},
298287
data() {
299288
return {
289+
Settings32,
300290
q: {
301291
page: "status",
302292
},
293+
host: "",
303294
urlCheckInterval: null,
304295
isRedirectChecked: false,
305296
redirectTimeout: 0,
@@ -366,12 +357,58 @@ export default {
366357
created() {
367358
this.getStatus();
368359
this.listBackupRepositories();
360+
this.getConfiguration();
369361
},
370-
371362
methods: {
372-
goToMattermost() {
363+
goToPaperless() {
373364
window.open('http://' + this.host);
374365
},
366+
async getConfiguration() {
367+
this.loading.getConfiguration = true;
368+
this.error.getConfiguration = "";
369+
const taskAction = "get-configuration";
370+
371+
// register to task error
372+
this.core.$root.$off(taskAction + "-aborted");
373+
this.core.$root.$once(
374+
taskAction + "-aborted",
375+
this.getConfigurationAborted
376+
);
377+
378+
// register to task completion
379+
this.core.$root.$off(taskAction + "-completed");
380+
this.core.$root.$once(
381+
taskAction + "-completed",
382+
this.getConfigurationCompleted
383+
);
384+
385+
const res = await to(
386+
this.createModuleTaskForApp(this.instanceName, {
387+
action: taskAction,
388+
extra: {
389+
title: this.$t("action." + taskAction),
390+
isNotificationHidden: true,
391+
},
392+
})
393+
);
394+
const err = res[0];
395+
396+
if (err) {
397+
console.error(`error creating task ${taskAction}`, err);
398+
this.error.getConfiguration = this.getErrorMessage(err);
399+
this.loading.getConfiguration = false;
400+
return;
401+
}
402+
},
403+
getConfigurationAborted(taskResult, taskContext) {
404+
console.error(`${taskContext.action} aborted`, taskResult);
405+
this.error.getConfiguration = this.core.$t("error.generic_error");
406+
this.loading.getConfiguration = false;
407+
},
408+
getConfigurationCompleted(taskContext, taskResult) {
409+
const config = taskResult.output;
410+
this.host = config.host;
411+
},
375412
async getStatus() {
376413
this.loading.getStatus = true;
377414
this.error.getStatus = "";
@@ -538,4 +575,4 @@ export default {
538575
word-wrap: break-word;
539576
max-width: 30vw;
540577
}
541-
</style>
578+
</style>

0 commit comments

Comments
 (0)