Files
waf-platform/EdgeUser/web/views/@default/httpdns/apps/domains.js
2026-02-28 18:55:33 +08:00

73 lines
2.1 KiB
JavaScript

Tea.context(function () {
if (typeof this.keywordInput == "undefined" || this.keywordInput == null) {
this.keywordInput = "";
}
if (typeof this.keyword == "undefined" || this.keyword == null) {
this.keyword = "";
}
if (typeof this.domains == "undefined" || this.domains == null) {
this.domains = [];
}
this.keywordInput = String(this.keyword);
this.doSearch = function () {
this.keyword = String(this.keywordInput || "").trim();
};
this.clearSearch = function () {
this.keywordInput = "";
this.keyword = "";
};
this.filteredDomains = function () {
let domains = Array.isArray(this.domains) ? this.domains : [];
let keyword = String(this.keyword || "").trim().toLowerCase();
if (keyword.length == 0) {
return domains;
}
return domains.filter(function (domain) {
let name = (domain.name || "").toLowerCase();
return name.indexOf(keyword) >= 0;
});
};
this.bindDomain = function () {
teaweb.popup("/httpdns/apps/domains/createPopup?appId=" + this.app.id, {
height: "24em",
width: "46em",
title: "添加域名",
callback: function () {
teaweb.success("保存成功", function () {
teaweb.reload();
});
}
});
};
this.deleteApp = function () {
let that = this;
teaweb.confirm("确定要删除当前应用吗?", function () {
that.$post("/httpdns/apps/delete")
.params({
appId: that.app.id
})
.success(function () {
window.location = "/httpdns/apps";
});
});
};
this.deleteDomain = function (domainId) {
let that = this;
teaweb.confirm("确定要解绑这个域名吗?", function () {
that.$post("/httpdns/apps/domains/delete")
.params({
domainId: domainId
})
.refresh();
});
};
});