diff --git a/web/public/js/components/dns/dns-resolvers-config-box.js b/web/public/js/components/dns/dns-resolvers-config-box.js new file mode 100644 index 00000000..2b360a8c --- /dev/null +++ b/web/public/js/components/dns/dns-resolvers-config-box.js @@ -0,0 +1,83 @@ +Vue.component("dns-resolvers-config-box", { + props: ["value", "name"], + data: function () { + let resolvers = this.value + if (resolvers == null) { + resolvers = [] + } + + let name = this.name + if (name == null || name.length == 0) { + name = "dnsResolversJSON" + } + + return { + formName: name, + resolvers: resolvers, + + host: "", + + isAdding: false + } + }, + methods: { + add: function () { + this.isAdding = true + let that = this + setTimeout(function () { + that.$refs.hostRef.focus() + }) + }, + confirm: function () { + let host = this.host.trim() + if (host.length == 0) { + let that = this + setTimeout(function () { + that.$refs.hostRef.focus() + }) + return + } + this.resolvers.push({ + host: host, + port: 0, // TODO + protocol: "" // TODO + }) + this.cancel() + }, + cancel: function () { + this.isAdding = false + this.host = "" + this.port = 0 + this.protocol = "" + }, + remove: function (index) { + this.resolvers.$remove(index) + } + }, + template: `
+ +
+
+ {{resolver.protocol}}{{resolver.host}}:{{resolver.port}} +   + +
+
+ +
+
+
+ +
+
+ +   +
+
+
+ +
+ +
+
` +}) \ No newline at end of file