Files
waf-platform/EdgeUser/web/views/@default/httpdns/apps/domains.js
2026-03-02 20:07:53 +08:00

74 lines
2.1 KiB
JavaScript

Tea.context(function () {
var that = this;
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 () {
that.keyword = String(that.keywordInput || "").trim();
};
this.clearSearch = function () {
that.keywordInput = "";
that.keyword = "";
};
this.filteredDomains = function () {
let keyword = (that.keyword || "").trim().toLowerCase();
if (keyword.length == 0) {
return that.domains || [];
}
return (that.domains || []).filter(function (domain) {
let name = (domain.name || "").toLowerCase();
return name.indexOf(keyword) >= 0;
});
};
this.bindDomain = function () {
teaweb.popup("/httpdns/apps/domains/createPopup?appId=" + that.app.id, {
height: "12em",
width: "36em",
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();
});
};
});