Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix UI of dokuwiki (hostname and first configuration only) #22

Merged
merged 8 commits into from
Mar 14, 2024
3 changes: 2 additions & 1 deletion imageroot/actions/configure-module/validate-input.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
"host": {
"type": "string",
"description": "Host name for the wiki, like 'wiki.nethserver.org'",
"format": "idn-hostname"
"format": "hostname",
"pattern": "\\."
andre8244 marked this conversation as resolved.
Show resolved Hide resolved
},
"lets_encrypt": {
"type": "boolean",
Expand Down
4 changes: 4 additions & 0 deletions ui/public/i18n/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"admin_email": "Administrator email address",
"admin_full_name": "Administrator full name",
"wiki_fqdn": "Wiki FQDN",
"host_pattern": "Must be a valid fully qualified domain name",
"show_password": "Show password",
"hide_password": "Hide password",
"save": "Save",
Expand All @@ -39,6 +40,9 @@
"disabled": "Disabled",
"instance_configuration": "Configure {instance}",
"configuring": "Configuring...",
"dokuwiki_note": "Note",
"must_be_configured_inside_dokuwiki": "You can configure only Dokuwiki FQDN in this page. To configure other setting go to Dokuwiki webapp",
"go_to_dokuwiki": "Go to Dokuwiki",
"email_format": "Invalid email address"
},
"about": {
Expand Down
37 changes: 32 additions & 5 deletions ui/src/views/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@
/>
</div>
</div>
<div v-if="already_set" class="bx--row">
<div class="bx--col">
<NsInlineNotification
kind="info"
:title="$t('settings.dokuwiki_note')"
:description="$t('settings.must_be_configured_inside_dokuwiki')"
:showCloseButton="false"
@click="goToDokuwikiWebapp"
:actionLabel="$t('settings.go_to_dokuwiki')"
/>
</div>
</div>
<div class="bx--row">
<div class="bx--col-lg-16">
<cv-tile :light="true">
Expand All @@ -24,7 +36,7 @@
v-model.trim="wikiName"
class="mg-bottom"
:invalid-message="$t(error.wiki_name)"
:disabled="loading.getConfiguration || loading.configureModule"
:disabled="loading.getConfiguration || loading.configureModule || already_set"
ref="wikiName"
>
</cv-text-input>
Expand All @@ -33,7 +45,7 @@
v-model.trim="username"
class="mg-bottom"
:invalid-message="$t(error.username)"
:disabled="loading.getConfiguration || loading.configureModule"
:disabled="loading.getConfiguration || loading.configureModule || already_set"
ref="username"
>
</cv-text-input>
Expand All @@ -45,7 +57,7 @@
:password-hide-label="$t('settings.hide_password')"
class="mg-bottom"
:invalid-message="$t(error.password)"
:disabled="loading.getConfiguration || loading.configureModule"
:disabled="loading.getConfiguration || loading.configureModule || already_set"
ref="password"
>
</cv-text-input>
Expand All @@ -55,7 +67,7 @@
v-model.trim="email"
class="mg-bottom"
:invalid-message="$t(error.email)"
:disabled="loading.getConfiguration || loading.configureModule"
:disabled="loading.getConfiguration || loading.configureModule || already_set"
ref="email"
>
</cv-text-input>
Expand All @@ -64,7 +76,7 @@
v-model.trim="userFullName"
class="mg-bottom"
:invalid-message="$t(error.user_full_name)"
:disabled="loading.getConfiguration || loading.configureModule"
:disabled="loading.getConfiguration || loading.configureModule || already_set"
ref="userFullName"
>
</cv-text-input>
Expand Down Expand Up @@ -152,6 +164,7 @@ export default {
page: "settings",
},
urlCheckInterval: null,
already_set: false,
wikiName: "",
username: "",
password: "",
Expand Down Expand Up @@ -195,6 +208,9 @@ export default {
next();
},
methods: {
goToDokuwikiWebapp() {
window.open(`https://${this.host}`, "_blank");
},
async getConfiguration() {
this.loading.getConfiguration = true;
this.error.getConfiguration = "";
Expand Down Expand Up @@ -248,6 +264,17 @@ export default {
this.isLetsEncryptEnabled = config.lets_encrypt;
this.isHttpToHttpsEnabled = config.http2https;
this.loading.getConfiguration = false;
// set already_set to true if the configuration is not empty
if (
this.wikiName &&
this.username &&
this.password &&
this.userFullName &&
this.email
) {
this.already_set = true;
}

this.focusElement("wikiName");
},
validateConfigureModule() {
Expand Down
Loading