mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-07-19 07:44:02 +02:00
feat: Add proxy clone functionality to settings and monitor forms
- Add Clone button next to Edit button in proxy settings list - Add Clone button next to Edit button in monitor proxy selection - Add showClone method to ProxyDialog component - Cloned proxy automatically has default flag set to false - Uses existing 'Clone' translation from language files Fixes: Allows users to easily duplicate proxy configurations without manually re-entering all settings
This commit is contained in:
parent
92f2484a8d
commit
65daa037ee
3 changed files with 36 additions and 2 deletions
|
@ -174,6 +174,38 @@ export default {
|
||||||
this.modal.show();
|
this.modal.show();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show dialog to clone a proxy
|
||||||
|
* @param {number} proxyID ID of proxy to clone
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
showClone(proxyID) {
|
||||||
|
if (proxyID) {
|
||||||
|
for (let proxy of this.$root.proxyList) {
|
||||||
|
if (proxy.id === proxyID) {
|
||||||
|
// Create a clone of the proxy data
|
||||||
|
this.proxy = {
|
||||||
|
protocol: proxy.protocol,
|
||||||
|
host: proxy.host,
|
||||||
|
port: proxy.port,
|
||||||
|
auth: proxy.auth,
|
||||||
|
username: proxy.username,
|
||||||
|
password: proxy.password,
|
||||||
|
active: proxy.active,
|
||||||
|
default: false, // Cloned proxy should not be default
|
||||||
|
applyExisting: false,
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set id to null to indicate this is a new proxy (clone)
|
||||||
|
this.id = null;
|
||||||
|
|
||||||
|
this.modal.show();
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Submit form data for saving
|
* Submit form data for saving
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
|
|
|
@ -13,7 +13,8 @@
|
||||||
<li v-for="(proxy, index) in $root.proxyList" :key="index" class="list-group-item">
|
<li v-for="(proxy, index) in $root.proxyList" :key="index" class="list-group-item">
|
||||||
{{ proxy.host }}:{{ proxy.port }} ({{ proxy.protocol }})
|
{{ proxy.host }}:{{ proxy.port }} ({{ proxy.protocol }})
|
||||||
<span v-if="proxy.default === true" class="badge bg-primary ms-2">{{ $t("Default") }}</span><br>
|
<span v-if="proxy.default === true" class="badge bg-primary ms-2">{{ $t("Default") }}</span><br>
|
||||||
<a href="#" @click="$refs.proxyDialog.show(proxy.id)">{{ $t("Edit") }}</a>
|
<a href="#" @click="$refs.proxyDialog.show(proxy.id)">{{ $t("Edit") }}</a> |
|
||||||
|
<a href="#" @click="$refs.proxyDialog.showClone(proxy.id)">{{ $t("Clone") }}</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
|
@ -842,7 +842,8 @@
|
||||||
|
|
||||||
<label class="form-check-label" :for="`proxy-${proxy.id}`">
|
<label class="form-check-label" :for="`proxy-${proxy.id}`">
|
||||||
{{ proxy.host }}:{{ proxy.port }} ({{ proxy.protocol }})
|
{{ proxy.host }}:{{ proxy.port }} ({{ proxy.protocol }})
|
||||||
<a href="#" @click="$refs.proxyDialog.show(proxy.id)">{{ $t("Edit") }}</a>
|
<a href="#" @click="$refs.proxyDialog.show(proxy.id)">{{ $t("Edit") }}</a> |
|
||||||
|
<a href="#" @click="$refs.proxyDialog.showClone(proxy.id)">{{ $t("Clone") }}</a>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<span v-if="proxy.default === true" class="badge bg-primary ms-2">{{ $t("default") }}</span>
|
<span v-if="proxy.default === true" class="badge bg-primary ms-2">{{ $t("default") }}</span>
|
||||||
|
|
Loading…
Add table
Reference in a new issue