zh-CN Update

This commit is contained in:
Donald Zou
2024-11-02 14:26:47 +06:00
parent 94b597d29a
commit 49467c906d
11 changed files with 65 additions and 45 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,7 @@
<script setup>
import {onMounted, ref} from "vue";
import dayjs from "dayjs";
import LocaleText from "@/components/text/localeText.vue";
const props = defineProps({
configurationName: String,
@@ -35,7 +36,9 @@ onMounted(() => {
</samp>
</h6>
<small class="text-muted">
{{backups.length}} {{backups.length > 1 ? "Backups": "Backup" }}
{{backups.length}}
<LocaleText t="Backups" v-if="backups.length > 1"></LocaleText>
<LocaleText t="Backup" v-else></LocaleText>
</small>
</div>
<h5 class="ms-auto mb-0 dropdownIcon text-muted" :class="{active: showBackups}">
@@ -59,7 +62,8 @@ onMounted(() => {
</small>
<small >
<i class="bi bi-database me-2"></i>
{{b.database? "Yes" : "No" }}
<LocaleText t="Yes" v-if="b.database"></LocaleText>
<LocaleText t="No" v-else></LocaleText>
</small>
<small class="text-muted ms-auto">
<i class="bi bi-chevron-right"></i>

View File

@@ -105,14 +105,14 @@ const availableIPAddress = computed(() => {
const peersCount = computed(() => {
if (props.selectedConfigurationBackup.database){
let l = props.selectedConfigurationBackup.databaseContent.split("\n")
return l.filter(x => x.search('INSERT INTO "(.*)"') >= 0).length
return l.filter(x => x.search(`INSERT INTO "${newConfiguration.ConfigurationName}"`) >= 0).length
}
return 0
})
const restrictedPeersCount = computed(() => {
if (props.selectedConfigurationBackup.database){
let l = props.selectedConfigurationBackup.databaseContent.split("\n")
return l.filter(x => x.search('INSERT INTO "(.*)_restrict_access"') >= 0).length
return l.filter(x => x.search(`INSERT INTO "${newConfiguration.ConfigurationName}_restrict_access"`) >= 0).length
}
return 0
})
@@ -136,7 +136,7 @@ const submitRestore = async () => {
<form class="d-flex flex-column gap-3">
<div class="d-flex flex-column flex-sm-row align-items-start align-items-sm-center gap-3">
<h4 class="mb-0">
<LocaleText t="Configuration File"></LocaleText>
<LocaleText t="Configuration"></LocaleText>
</h4>
</div>
<div>
@@ -220,7 +220,7 @@ const submitRestore = async () => {
<LocaleText t="IP Address/CIDR"></LocaleText>
</small>
<small class="ms-auto" :class="[availableIPAddress > 0 ? 'text-success':'text-danger']">
{{availableIPAddress}} Available IP Address
<LocaleText :t="availableIPAddress + ' Available IP Address'"></LocaleText>
</small>
</label>
<input type="text" class="form-control"
@@ -299,14 +299,16 @@ const submitRestore = async () => {
<div class="col-sm">
<div class="card text-bg-success rounded-3">
<div class="card-body">
<i class="bi bi-person-fill me-2"></i> Contain <strong>{{peersCount}}</strong> Peer{{peersCount > 1 ? 's':''}}
<i class="bi bi-person-fill me-2"></i>
<LocaleText t="Contain"></LocaleText> <strong>{{peersCount}}</strong> <LocaleText t="Peer" v-if="peersCount > 1"></LocaleText><LocaleText t="Peer" v-else></LocaleText>
</div>
</div>
</div>
<div class="col-sm">
<div class="card text-bg-warning rounded-3">
<div class="card-body">
<i class="bi bi-person-fill-lock me-2"></i> Contain <strong>{{restrictedPeersCount}}</strong> Restricted Peer{{restrictedPeersCount > 1 ? 's':''}}
<i class="bi bi-person-fill-lock me-2"></i>
<LocaleText t="Contain"></LocaleText> <strong>{{restrictedPeersCount}}</strong> <LocaleText t="Restricted Peers" v-if="restrictedPeersCount > 1" /><LocaleText t="Restricted Peers" v-else></LocaleText>
</div>
</div>
</div>
@@ -318,7 +320,8 @@ const submitRestore = async () => {
:disabled="!validateForm || loading"
@click="submitRestore()"
>
<i class="bi bi-clock-history me-2"></i> {{ !loading ? 'Restore':'Restoring...'}}
<i class="bi bi-clock-history me-2"></i>
<LocaleText :t="!loading ? 'Restore':'Restoring...'"></LocaleText>
</button>
</div>
</div>

View File

@@ -78,7 +78,7 @@ export default {
</script>
<template>
<div class="d-flex flex-column gap-2">
<form class="d-flex flex-column gap-2">
<div class="row g-2">
<div class="col-sm">
<div class="form-group">
@@ -88,6 +88,7 @@ export default {
</small></strong>
</label>
<input type="password" class="form-control"
autocomplete="current-password"
:class="{'is-invalid': showInvalidFeedback, 'is-valid': isValid}"
v-model="this.value.currentPassword"
:id="'currentPassword_' + this.uuid">
@@ -102,6 +103,7 @@ export default {
</small></strong>
</label>
<input type="password" class="form-control"
autocomplete="new-password"
:class="{'is-invalid': showInvalidFeedback, 'is-valid': isValid}"
v-model="this.value.newPassword"
:id="'newPassword_' + this.uuid">
@@ -116,6 +118,7 @@ export default {
</small></strong>
</label>
<input type="password" class="form-control"
autocomplete="new-password"
:class="{'is-invalid': showInvalidFeedback, 'is-valid': isValid}"
v-model="this.value.repeatNewPassword"
:id="'repeatNewPassword_' + this.uuid">
@@ -128,7 +131,7 @@ export default {
<i class="bi bi-save2-fill me-2"></i>
<LocaleText t="Update Password"></LocaleText>
</button>
</div>
</form>
</template>
<style scoped>

View File

@@ -45,7 +45,6 @@ export default {
handler(newValue){
if (newValue){
fetchGet("/api/getDashboardAPIKeys", {}, (res) => {
console.log(res)
if(res.status){
this.apiKeys = res.data
}else{

View File

@@ -13,13 +13,17 @@ const configurations = computed(() => {
})
const updateAutostart = async () => {
console.log(data.value)
await fetchPost("/api/updateDashboardConfigurationItem", {
section: "WireGuardConfiguration",
key: "autostart",
value: data.value
}, async (res) => {
console.log(res);
if (res.status){
store.newMessage("Server", "Start up configurations saved", "success")
data.value = res.data
}else{
store.newMessage("Server", "Start up configurations failed to save", "danger")
}
})
}
@@ -29,12 +33,8 @@ const toggle = (c) => {
}else{
data.value.push(c)
}
}
watch(data, () => {
updateAutostart()
})
}
</script>
<template>

View File

@@ -2,7 +2,6 @@ import {DashboardConfigurationStore} from "@/stores/DashboardConfigurationStore.
export const GetLocale = (key) => {
const store = DashboardConfigurationStore()
if (store.Locale === null)
return key
const reg = Object.keys(store.Locale)
@@ -10,6 +9,7 @@ export const GetLocale = (key) => {
return key.match(new RegExp('^' + x + '$', 'gi')) !== null
})
if (match.length === 0 || match.length > 1){
// console.log(`[Translation Needed] Language: ${store.Configuration.Server.dashboard_language} \nKey: ${key}`)
return key
}
return key.replace(new RegExp(match[0], 'gi'), store.Locale[match[0]])

View File

@@ -41,7 +41,9 @@ const selectedConfiguration = ref("")
<i class="bi bi-1-circle-fill"></i>
</h1>
<div>
<h4 class="mb-0">Step 1</h4>
<h4 class="mb-0">
<LocaleText t="Step 1"></LocaleText>
</h4>
<small class="text-muted">
<LocaleText t="Select a backup you want to restore" v-if="!confirm"></LocaleText>
<LocaleText t="Click to change a backup" v-else></LocaleText>
@@ -50,7 +52,9 @@ const selectedConfiguration = ref("")
</div>
<Transition name="zoomReversed">
<div class="ms-sm-auto" v-if="confirm">
<small class="text-muted">Selected Backup</small>
<small class="text-muted">
<LocaleText t="Selected Backup"></LocaleText>
</small>
<h6>
<samp>{{selectedConfigurationBackup.filename}}</samp>
</h6>
@@ -58,21 +62,7 @@ const selectedConfiguration = ref("")
</Transition>
</div>
<div id="step1Detail" v-if="!confirm">
<!-- <div class="mb-4">-->
<!-- <h5>Backup of existing WireGuard Configurations</h5>-->
<!-- <hr>-->
<!-- <div class="d-flex gap-3 flex-column">-->
<!-- <BackupGroup-->
<!-- @select="(b) => {selectedConfigurationBackup = b; selectedConfiguration = c; confirm = true}"-->
<!-- :open="selectedConfiguration === c"-->
<!-- :selectedConfigurationBackup="selectedConfigurationBackup"-->
<!-- v-for="c in Object.keys(backups.ExistingConfigurations)"-->
<!-- :configuration-name="c" :backups="backups.ExistingConfigurations[c]"></BackupGroup>-->
<!-- </div>-->
<!-- </div>-->
<div class="mb-4">
<!-- <h5>Backup of non-existing WireGuard Configurations</h5>-->
<!-- <hr>-->
<div class="d-flex gap-3 flex-column">
<BackupGroup
@select="(b) => {selectedConfigurationBackup = b; selectedConfiguration = c; confirm = true}"
@@ -83,7 +73,9 @@ const selectedConfiguration = ref("")
<div v-if="Object.keys(backups.NonExistingConfigurations).length === 0">
<div class="card rounded-3">
<div class="card-body">
<p class="mb-0">You don't have any configuration to restore</p>
<p class="mb-0">
<LocaleText t="You don't have any configuration to restore"></LocaleText>
</p>
</div>
</div>
</div>