Skip to content

Commit

Permalink
针对nginx+keeplived的vip映射管理方案 (#154)
Browse files Browse the repository at this point in the history
* fixed environment indicator display overlay & edit not obtain newest data

* finished environment operation sync

* fix: environment indicator display overflow not ellipsis

---------

Co-authored-by: 0xJacky <me@jackyu.cn>
  • Loading branch information
quanbisen and 0xJacky authored Aug 21, 2023
1 parent 477bec0 commit 6ede443
Show file tree
Hide file tree
Showing 23 changed files with 586 additions and 159 deletions.
5 changes: 3 additions & 2 deletions frontend/src/api/domain.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import Curd from '@/api/curd'
import http from '@/lib/http'
import {AxiosRequestConfig} from "axios/index";

class Domain extends Curd {
enable(name: string) {
return http.post(this.baseUrl + '/' + name + '/enable')
enable(name: string, config: AxiosRequestConfig) {
return http.post(this.baseUrl + '/' + name + '/enable', undefined, config)
}

disable(name: string) {
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/EnvIndicator/EnvIndicator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,11 @@ watch(node_id, async () => {
justify-content: space-between;
.env-name {
max-width: 50px;
max-width: 85px;
text-overflow: ellipsis;
white-space: nowrap;
line-height: 1em;
overflow: hidden;
}
.ant-tag {
Expand Down
10 changes: 9 additions & 1 deletion frontend/src/components/StdDataEntry/StdDataEntry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@ export default defineComponent({
return () => {
const template: any = []
props.dataList.forEach((v: any) => {
if (v.edit.type) {
let show = true
if (v.edit.show) {
if (typeof v.edit.show === "boolean") {
show = v.edit.show
} else if (typeof v.edit.show === "function") {
show = v.edit.show(props.dataSource)
}
}
if (v.edit.type && show) {
template.push(
<StdFormItem dataIndex={v.dataIndex} label={v.title()} extra={v.extra} error={props.error}>
{v.edit.type(v.edit, props.dataSource, v.dataIndex)}
Expand Down
14 changes: 12 additions & 2 deletions frontend/src/components/StdDataEntry/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import StdDataEntry from './StdDataEntry.js'
import {h} from 'vue'
import {Input, InputNumber, Textarea} from 'ant-design-vue'
import {Input, InputNumber, Textarea, Switch} from 'ant-design-vue'
import StdSelector from './components/StdSelector.vue'
import StdSelect from './components/StdSelect.vue'
import StdPassword from './components/StdPassword.vue'
Expand Down Expand Up @@ -110,14 +110,24 @@ function selector(edit: IEdit, dataSource: any, dataIndex: any) {
/>
}

function antSwitch(edit: IEdit, dataSource: any, dataIndex: any) {
return h(Switch, {
checked: dataSource?.[dataIndex],
'onUpdate:checked': value => {
dataSource[dataIndex] = value
}
})
}

export {
readonly,
input,
textarea,
select,
selector,
password,
inputNumber
inputNumber,
antSwitch
}

export default StdDataEntry
46 changes: 32 additions & 14 deletions frontend/src/language/en/app.po
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ msgstr ""

#: src/views/cert/Cert.vue:74 src/views/cert/DNSCredential.vue:31
#: src/views/config/config.ts:35 src/views/domain/DomainList.vue:47
#: src/views/environment/Environment.vue:61 src/views/user/User.vue:43
#: src/views/environment/Environment.vue:92 src/views/user/User.vue:43
msgid "Action"
msgstr "Action"

Expand Down Expand Up @@ -604,6 +604,7 @@ msgid "Enabled"
msgstr "Enabled"

#: src/views/domain/components/RightSettings.vue:26
#: src/views/domain/components/SiteDuplicate.vue:85
#: src/views/domain/DomainAdd.vue:49 src/views/domain/DomainList.vue:59
msgid "Enabled successfully"
msgstr "Enabled successfully"
Expand Down Expand Up @@ -926,7 +927,11 @@ msgstr ""
msgid "Next"
msgstr "Next"

#: src/views/preference/NginxLogSettings.vue:3
#: src/views/preference/Preference.vue:8
msgid "Nginx"
msgstr ""

#: src/views/preference/NginxSettings.vue:3
msgid "Nginx Access Log Path"
msgstr ""

Expand All @@ -941,12 +946,11 @@ msgstr "Configuration Name"
msgid "Nginx Control"
msgstr ""

#: src/views/preference/NginxLogSettings.vue:6
#: src/views/preference/NginxSettings.vue:6
msgid "Nginx Error Log Path"
msgstr ""

#: src/routes/index.ts:110 src/views/nginx_log/NginxLog.vue:2
#: src/views/preference/Preference.vue:8
msgid "Nginx Log"
msgstr ""

Expand Down Expand Up @@ -998,7 +1002,7 @@ msgstr ""
#: src/components/NodeSelector/NodeSelector.vue:11
#: src/views/dashboard/Environments.vue:15
#: src/views/dashboard/Environments.vue:16
#: src/views/environment/Environment.vue:48
#: src/views/environment/Environment.vue:79
msgid "Offline"
msgstr ""

Expand All @@ -1022,14 +1026,18 @@ msgstr ""
#: src/components/NodeSelector/NodeSelector.vue:9
#: src/views/dashboard/Environments.vue:14
#: src/views/dashboard/Environments.vue:15
#: src/views/environment/Environment.vue:45
#: src/views/environment/Environment.vue:76
msgid "Online"
msgstr ""

#: src/views/preference/Preference.vue:11
msgid "OpenAI"
msgstr ""

#: src/views/environment/Environment.vue:38
msgid "OperationSync"
msgstr ""

#: src/views/system/Upgrade.vue:14 src/views/system/Upgrade.vue:15
#: src/views/system/Upgrade.vue:19 src/views/system/Upgrade.vue:23
#: src/views/system/Upgrade.vue:27
Expand Down Expand Up @@ -1249,7 +1257,7 @@ msgid "Save error %{msg}"
msgstr "Save error %{msg}"

#: src/components/StdDataDisplay/StdBatchEdit.vue:39
#: src/views/preference/Preference.vue:60
#: src/views/preference/Preference.vue:66
#, fuzzy
msgid "Save successfully"
msgstr "Saved successfully"
Expand Down Expand Up @@ -1281,7 +1289,7 @@ msgstr "Send"
#: src/components/StdDataDisplay/StdTable.vue:343
#: src/components/StdDataDisplay/StdTable.vue:463
#: src/views/config/ConfigEdit.vue:41 src/views/domain/DomainList.vue:83
#: src/views/other/Install.vue:71 src/views/preference/Preference.vue:62
#: src/views/other/Install.vue:71 src/views/preference/Preference.vue:68
#: src/views/system/Upgrade.vue:54
msgid "Server error"
msgstr "Server error"
Expand Down Expand Up @@ -1348,7 +1356,7 @@ msgstr "Certificate Status"
msgid "Stable"
msgstr "Enabled"

#: src/views/domain/DomainList.vue:24 src/views/environment/Environment.vue:38
#: src/views/domain/DomainList.vue:24 src/views/environment/Environment.vue:69
msgid "Status"
msgstr "Status"

Expand All @@ -1364,10 +1372,20 @@ msgstr "Storage"
msgid "Subject Name: %{name}"
msgstr "Subject Name: %{name}"

#: src/views/environment/Environment.vue:67
msgid ""
"Such as Reload and Configs, regex can configure as `/api/nginx/reload|/api/"
"nginx/test|/api/config/.+`, please see system api"
msgstr ""

#: src/views/dashboard/ServerAnalytic.vue:40
msgid "Swap"
msgstr "Swap"

#: src/views/environment/Environment.vue:55
msgid "SyncApiRegex"
msgstr ""

#: src/routes/index.ts:157
msgid "System"
msgstr ""
Expand Down Expand Up @@ -1435,18 +1453,14 @@ msgid ""
"continue?"
msgstr ""

#: src/views/environment/Environment.vue:30
msgid "Token"
msgstr ""

#: src/views/config/config.ts:13
msgid "Type"
msgstr ""

#: src/views/cert/Cert.vue:68 src/views/cert/DNSCredential.vue:25
#: src/views/config/config.ts:28 src/views/config/ConfigEdit.vue:31
#: src/views/domain/components/RightSettings.vue:11
#: src/views/domain/DomainList.vue:41 src/views/environment/Environment.vue:55
#: src/views/domain/DomainList.vue:41 src/views/environment/Environment.vue:86
#: src/views/user/User.vue:37
msgid "Updated at"
msgstr "Updated at"
Expand Down Expand Up @@ -1520,6 +1534,10 @@ msgid ""
"Nginx. Are you sure you want to continue?"
msgstr ""

#: src/views/environment/Environment.vue:45
msgid "Whether config api regex that will redo on this environment"
msgstr ""

#: src/views/dashboard/ServerAnalytic.vue:104
#: src/views/dashboard/ServerAnalytic.vue:29
msgid "Writes"
Expand Down
50 changes: 36 additions & 14 deletions frontend/src/language/es/app.po
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ msgstr "Registros de acceso"

#: src/views/cert/Cert.vue:74 src/views/cert/DNSCredential.vue:31
#: src/views/config/config.ts:35 src/views/domain/DomainList.vue:47
#: src/views/environment/Environment.vue:61 src/views/user/User.vue:43
#: src/views/environment/Environment.vue:92 src/views/user/User.vue:43
msgid "Action"
msgstr "Acción"

Expand Down Expand Up @@ -588,6 +588,7 @@ msgid "Enabled"
msgstr "Habilitado"

#: src/views/domain/components/RightSettings.vue:26
#: src/views/domain/components/SiteDuplicate.vue:85
#: src/views/domain/DomainAdd.vue:49 src/views/domain/DomainList.vue:59
msgid "Enabled successfully"
msgstr "Habilitado con éxito"
Expand Down Expand Up @@ -901,7 +902,12 @@ msgstr "Se liberó una nueva versión"
msgid "Next"
msgstr "Siguiente"

#: src/views/preference/NginxLogSettings.vue:3
#: src/views/preference/Preference.vue:8
#, fuzzy
msgid "Nginx"
msgstr "Registro Nginx"

#: src/views/preference/NginxSettings.vue:3
msgid "Nginx Access Log Path"
msgstr "Ruta de registro de acceso de Nginx"

Expand All @@ -915,12 +921,11 @@ msgstr "Error de análisis de configuración de Nginx"
msgid "Nginx Control"
msgstr "Control de Nginx"

#: src/views/preference/NginxLogSettings.vue:6
#: src/views/preference/NginxSettings.vue:6
msgid "Nginx Error Log Path"
msgstr "Ruta de registro de errores de Nginx"

#: src/routes/index.ts:110 src/views/nginx_log/NginxLog.vue:2
#: src/views/preference/Preference.vue:8
msgid "Nginx Log"
msgstr "Registro Nginx"

Expand Down Expand Up @@ -969,7 +974,7 @@ msgstr "Obteniendo certificado"
#: src/components/NodeSelector/NodeSelector.vue:11
#: src/views/dashboard/Environments.vue:15
#: src/views/dashboard/Environments.vue:16
#: src/views/environment/Environment.vue:48
#: src/views/environment/Environment.vue:79
msgid "Offline"
msgstr "Desconectado"

Expand All @@ -993,14 +998,18 @@ msgstr "OK"
#: src/components/NodeSelector/NodeSelector.vue:9
#: src/views/dashboard/Environments.vue:14
#: src/views/dashboard/Environments.vue:15
#: src/views/environment/Environment.vue:45
#: src/views/environment/Environment.vue:76
msgid "Online"
msgstr "Conectado"

#: src/views/preference/Preference.vue:11
msgid "OpenAI"
msgstr "OpenAI"

#: src/views/environment/Environment.vue:38
msgid "OperationSync"
msgstr ""

#: src/views/system/Upgrade.vue:14 src/views/system/Upgrade.vue:15
#: src/views/system/Upgrade.vue:19 src/views/system/Upgrade.vue:23
#: src/views/system/Upgrade.vue:27
Expand Down Expand Up @@ -1226,7 +1235,7 @@ msgid "Save error %{msg}"
msgstr "Error al guardar %{msg}"

#: src/components/StdDataDisplay/StdBatchEdit.vue:39
#: src/views/preference/Preference.vue:60
#: src/views/preference/Preference.vue:66
msgid "Save successfully"
msgstr "Guardado con éxito"

Expand Down Expand Up @@ -1256,7 +1265,7 @@ msgstr "Enviado"
#: src/components/StdDataDisplay/StdTable.vue:343
#: src/components/StdDataDisplay/StdTable.vue:463
#: src/views/config/ConfigEdit.vue:41 src/views/domain/DomainList.vue:83
#: src/views/other/Install.vue:71 src/views/preference/Preference.vue:62
#: src/views/other/Install.vue:71 src/views/preference/Preference.vue:68
#: src/views/system/Upgrade.vue:54
msgid "Server error"
msgstr "Error del servidor"
Expand Down Expand Up @@ -1317,7 +1326,7 @@ msgstr "Contenido de la llave del certificado SSL"
msgid "Stable"
msgstr "Estable"

#: src/views/domain/DomainList.vue:24 src/views/environment/Environment.vue:38
#: src/views/domain/DomainList.vue:24 src/views/environment/Environment.vue:69
msgid "Status"
msgstr "Estado"

Expand All @@ -1333,10 +1342,20 @@ msgstr "Almacenamiento"
msgid "Subject Name: %{name}"
msgstr "Nombre del asunto: %{name}"

#: src/views/environment/Environment.vue:67
msgid ""
"Such as Reload and Configs, regex can configure as `/api/nginx/reload|/api/"
"nginx/test|/api/config/.+`, please see system api"
msgstr ""

#: src/views/dashboard/ServerAnalytic.vue:40
msgid "Swap"
msgstr "Swap"

#: src/views/environment/Environment.vue:55
msgid "SyncApiRegex"
msgstr ""

#: src/routes/index.ts:157
msgid "System"
msgstr "Sistema"
Expand Down Expand Up @@ -1406,18 +1425,14 @@ msgstr ""
"de la autoridad al backend, y debemos guardar este archivo y volver a cargar "
"Nginx. ¿Estás seguro de que quieres continuar?"

#: src/views/environment/Environment.vue:30
msgid "Token"
msgstr "Token"

#: src/views/config/config.ts:13
msgid "Type"
msgstr "Tipo"

#: src/views/cert/Cert.vue:68 src/views/cert/DNSCredential.vue:25
#: src/views/config/config.ts:28 src/views/config/ConfigEdit.vue:31
#: src/views/domain/components/RightSettings.vue:11
#: src/views/domain/DomainList.vue:41 src/views/environment/Environment.vue:55
#: src/views/domain/DomainList.vue:41 src/views/environment/Environment.vue:86
#: src/views/user/User.vue:37
msgid "Updated at"
msgstr "Actualizado a"
Expand Down Expand Up @@ -1490,6 +1505,10 @@ msgstr ""
"Eliminaremos la configuración de HTTPChallenge de este archivo y "
"recargaremos Nginx. ¿Estás seguro de que quieres continuar?"

#: src/views/environment/Environment.vue:45
msgid "Whether config api regex that will redo on this environment"
msgstr ""

#: src/views/dashboard/ServerAnalytic.vue:104
#: src/views/dashboard/ServerAnalytic.vue:29
msgid "Writes"
Expand Down Expand Up @@ -1521,3 +1540,6 @@ msgstr "Puede consultar la actualización de Nginx UI en esta página."
msgctxt "Project"
msgid "License"
msgstr "Licencia"

#~ msgid "Token"
#~ msgstr "Token"
Loading

0 comments on commit 6ede443

Please sign in to comment.