Skip to content

Commit

Permalink
Merge pull request #23 from compgeniuses/UI
Browse files Browse the repository at this point in the history
UI
  • Loading branch information
compgeniuses committed Dec 31, 2023
2 parents cb17864 + c4c6c3c commit ba47a9d
Show file tree
Hide file tree
Showing 9 changed files with 113 additions and 31 deletions.
2 changes: 1 addition & 1 deletion imageroot/actions/configure-module/validate-input.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"type": "string"
},
"PAPERLESS_TIME_ZONE": {
"type": "boolean"
"type": "string"
},
"PAPERLESS_OCR_LANGUAGE": {
"type": "string"
Expand Down
2 changes: 1 addition & 1 deletion imageroot/actions/get-configuration/validate-output.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"type": "string"
},
"PAPERLESS_TIME_ZONE": {
"type": "boolean"
"type": "string"
},
"PAPERLESS_OCR_LANGUAGE": {
"type": "string"
Expand Down
7 changes: 6 additions & 1 deletion ui/public/i18n/de/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
"validation_error": "Überprüfungsfehler"
},
"settings": {
"settings.paperless_fqdn": "Paperless FQDN",
"settings.paperless_admin": "Paperless Admin",
"settings.paperless_admin_password": "Paperless admin password",
"test_field": "Testfeld",
"configure_instance": "Konfiguriere {instance}",
"save": "Speichern",
Expand All @@ -36,7 +39,9 @@
"title": "Status",
"installation_node": "Installations-Knoten",
"node": "Knoten",
"no_volumes": "keine Volumen"
"no_volumes": "keine Volumen",
"status.paperless_url": "Paperless URL",
"status.open_paperless_page": "Go to Paperless"
},
"about": {
"title": "Über"
Expand Down
7 changes: 6 additions & 1 deletion ui/public/i18n/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@
"mount": "Mount",
"no_services": "No services",
"no_images": "No images",
"no_volumes": "No volumes"
"no_volumes": "No volumes",
"status.paperless_url": "Paperless URL",
"status.open_paperless_page": "Go to Paperless"
},
"settings": {
"title": "Settings",
"settings.paperless_fqdn": "Paperless FQDN",
"settings.paperless_admin": "Paperless Admin",
"settings.paperless_admin_password": "Paperless admin password",
"configure_instance": "Configure {instance}",
"save": "Save",
"test_field": "Test field"
Expand Down
7 changes: 6 additions & 1 deletion ui/public/i18n/es/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
"validation_error": "Error de validación"
},
"settings": {
"settings.paperless_fqdn": "Paperless FQDN",
"settings.paperless_admin": "Paperless Admin",
"settings.paperless_admin_password": "Paperless admin password",
"test_field": "Campo de prueba",
"configure_instance": "Configurar {instance}",
"save": "Guardar",
Expand All @@ -36,7 +39,9 @@
"title": "Estado",
"installation_node": "Nodo de instalación",
"node": "Nodo",
"no_volumes": "Sin volúmenes"
"no_volumes": "Sin volúmenes",
"status.paperless_url": "Paperless URL",
"status.open_paperless_page": "Go to Paperless"
},
"about": {
"title": "Acerca de"
Expand Down
7 changes: 6 additions & 1 deletion ui/public/i18n/it/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@
"app_instance": "Istanza app",
"app_volumes": "Volume app|Volumi app",
"installation_node": "Nodo",
"mount": "Percorso di mount"
"mount": "Percorso di mount",
"status.paperless_url": "Paperless URL",
"status.open_paperless_page": "Go to Paperless"
},
"settings": {
"settings.paperless_fqdn": "Paperless FQDN",
"settings.paperless_admin": "Paperless Admin",
"settings.paperless_admin_password": "Paperless admin password",
"save": "Salva",
"title": "Impostazioni",
"configure_instance": "Configura {instance}",
Expand Down
2 changes: 1 addition & 1 deletion ui/public/metadata.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "paperless",
"description": {
"en": "Paperless ngx"
"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."
},
"categories": ["collaboration"],
"authors": [
Expand Down
41 changes: 33 additions & 8 deletions ui/src/views/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<cv-tile :light="true">
<cv-form @submit.prevent="configureModule">
<cv-text-input
:label="$t('settings.host')"
:label="$t('settings.paperless_fqdn')"
placeholder="paperless.example.org"
v-model.trim="host"
class="mg-bottom"
Expand All @@ -29,16 +29,27 @@
ref="host"
>
</cv-text-input>
<cv-password-input
:label="$t('settings.PAPERLESS_ADMIN_PASSWORD')"
placeholder="***************"
v-model.trim="PAPERLESS_ADMIN_PASSWORD"
<cv-text-input
:label="$t('settings.paperless_admin')"
placeholder="paperlessadmin"
v-model="PAPERLESS_ADMIN_USER"
class="mg-bottom"
:invalid-message="$t(error.host)"
:invalid-message="$t(error.PAPERLESS_ADMIN_USER)"
:disabled="loading.getConfiguration || loading.configureModule"
ref="PAPERLESS_ADMIN_USER"
>
</cv-text-input>
<cv-text-input
:label="$t('settings.paperless_admin_password')"
placeholder="P@perle5$"
v-model="PAPERLESS_ADMIN_PASSWORD"
class="mg-bottom"
:invalid-message="$t(error.PAPERLESS_ADMIN_PASSWORD)"
:disabled="loading.getConfiguration || loading.configureModule"
type="password"
ref="PAPERLESS_ADMIN_PASSWORD"
>
</cv-password-input>
</cv-text-input>
<cv-toggle
value="letsEncrypt"
:label="$t('settings.lets_encrypt')"
Expand Down Expand Up @@ -114,6 +125,8 @@ export default {
},
urlCheckInterval: null,
host: "",
PAPERLESS_ADMIN_USER: "",
PAPERLESS_ADMIN_PASSWORD: "",
isLetsEncryptEnabled: false,
isHttpToHttpsEnabled: false,
loading: {
Expand All @@ -124,6 +137,7 @@ export default {
getConfiguration: "",
configureModule: "",
host: "",
PAPERLESS_ADMIN_USER: "",
PAPERLESS_ADMIN_PASSWORD: "",
lets_encrypt: "",
http2https: "",
Expand Down Expand Up @@ -192,6 +206,7 @@ export default {
getConfigurationCompleted(taskContext, taskResult) {
const config = taskResult.output;
this.host = config.host;
this.PAPERLESS_ADMIN_USER = config.PAPERLESS_ADMIN_USER;
this.PAPERLESS_ADMIN_PASSWORD = config.PAPERLESS_ADMIN_PASSWORD;
this.isLetsEncryptEnabled = config.lets_encrypt;
this.isHttpToHttpsEnabled = config.http2https;
Expand All @@ -211,6 +226,14 @@ export default {
}
isValidationOk = false;
}
if (!this.PAPERLESS_ADMIN_USER) {
this.error.PAPERLESS_ADMIN_USER = "common.required";
if (isValidationOk) {
this.focusElement("PAPERLESS_ADMIN_USER");
}
isValidationOk = false;
}
if (!this.PAPERLESS_ADMIN_PASSWORD) {
this.error.PAPERLESS_ADMIN_PASSWORD = "common.required";
Expand Down Expand Up @@ -272,6 +295,8 @@ export default {
action: taskAction,
data: {
host: this.host,
PAPERLESS_ADMIN_USER: this.PAPERLESS_ADMIN_USER,
PAPERLESS_ADMIN_PASSWORD: this.PAPERLESS_ADMIN_PASSWORD,
lets_encrypt: this.isLetsEncryptEnabled,
http2https: this.isHttpToHttpsEnabled,
},
Expand Down Expand Up @@ -312,4 +337,4 @@ export default {
.mg-bottom {
margin-bottom: $spacing-06;
}
</style>
</style>
69 changes: 53 additions & 16 deletions ui/src/views/Status.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
<!--
Copyright (C) 2023 Nethesis S.r.l.
SPDX-License-Identifier: GPL-3.0-or-later
-->
<template>
<cv-grid fullWidth>
<cv-row>
Expand Down Expand Up @@ -280,26 +276,21 @@ import {
TaskService,
IconService,
UtilService,
PageTitleService,
} from "@nethserver/ns8-ui-lib";
import Settings32 from "@carbon/icons-vue/es/settings/32";
export default {
name: "Status",
mixins: [
TaskService,
QueryParamService,
IconService,
UtilService,
PageTitleService,
],
mixins: [TaskService, QueryParamService, IconService, UtilService],
pageTitle() {
return this.$t("status.title") + " - " + this.appName;
},
data() {
return {
Settings32,
q: {
page: "status",
},
host: "",
urlCheckInterval: null,
isRedirectChecked: false,
redirectTimeout: 0,
Expand Down Expand Up @@ -366,12 +357,58 @@ export default {
created() {
this.getStatus();
this.listBackupRepositories();
this.getConfiguration();
},
methods: {
goToMattermost() {
goToPaperless() {
window.open('http://' + this.host);
},
async getConfiguration() {
this.loading.getConfiguration = true;
this.error.getConfiguration = "";
const taskAction = "get-configuration";
// register to task error
this.core.$root.$off(taskAction + "-aborted");
this.core.$root.$once(
taskAction + "-aborted",
this.getConfigurationAborted
);
// register to task completion
this.core.$root.$off(taskAction + "-completed");
this.core.$root.$once(
taskAction + "-completed",
this.getConfigurationCompleted
);
const res = await to(
this.createModuleTaskForApp(this.instanceName, {
action: taskAction,
extra: {
title: this.$t("action." + taskAction),
isNotificationHidden: true,
},
})
);
const err = res[0];
if (err) {
console.error(`error creating task ${taskAction}`, err);
this.error.getConfiguration = this.getErrorMessage(err);
this.loading.getConfiguration = false;
return;
}
},
getConfigurationAborted(taskResult, taskContext) {
console.error(`${taskContext.action} aborted`, taskResult);
this.error.getConfiguration = this.core.$t("error.generic_error");
this.loading.getConfiguration = false;
},
getConfigurationCompleted(taskContext, taskResult) {
const config = taskResult.output;
this.host = config.host;
},
async getStatus() {
this.loading.getStatus = true;
this.error.getStatus = "";
Expand Down Expand Up @@ -538,4 +575,4 @@ export default {
word-wrap: break-word;
max-width: 30vw;
}
</style>
</style>

0 comments on commit ba47a9d

Please sign in to comment.