实现HTTP部分功能
This commit is contained in:
14
web/public/js/components/common/more-options-angle.js
Normal file
14
web/public/js/components/common/more-options-angle.js
Normal file
@@ -0,0 +1,14 @@
|
||||
Vue.component("more-options-angle", {
|
||||
data: function () {
|
||||
return {
|
||||
isVisible: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
show: function () {
|
||||
this.isVisible = !this.isVisible
|
||||
this.$emit("change", this.isVisible)
|
||||
}
|
||||
},
|
||||
template: `<a href="" @click.prevent="show()"><span v-if="!isVisible">更多选项</span><span v-if="isVisible">收起选项</span><i class="icon angle" :class="{down:!isVisible, up:isVisible}"></i></a>`
|
||||
})
|
||||
@@ -53,7 +53,7 @@ Vue.component("http-header-policy-box", {
|
||||
responseDeletingHeaders = responsePolicy.deleteHeaders
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
type: type,
|
||||
typeName: (type == "request") ? "请求" : "响应",
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
Vue.component("http-pages-and-shutdown-box", {
|
||||
props: ["v-pages", "v-shutdown-config"],
|
||||
props: ["v-pages", "v-shutdown-config", "v-is-location"],
|
||||
data: function () {
|
||||
let pages = []
|
||||
if (this.vPages != null) {
|
||||
pages = this.vPages
|
||||
}
|
||||
let shutdownConfig = {
|
||||
isPrior: false,
|
||||
isOn: false,
|
||||
url: "",
|
||||
status: 0
|
||||
@@ -84,25 +85,33 @@ Vue.component("http-pages-and-shutdown-box", {
|
||||
<td>临时关闭页面</td>
|
||||
<td>
|
||||
<div>
|
||||
<div class="ui checkbox">
|
||||
<input type="checkbox" value="1" v-model="shutdownConfig.isOn" />
|
||||
<label></label>
|
||||
</div>
|
||||
<div v-show="shutdownConfig.isOn">
|
||||
<table class="ui table selectable definition">
|
||||
<table class="ui table selectable definition">
|
||||
<prior-checkbox :v-config="shutdownConfig" v-if="vIsLocation"></prior-checkbox>
|
||||
<tbody v-show="!vIsLocation || shutdownConfig.isPrior">
|
||||
<tr>
|
||||
<td class="title">是否开启</td>
|
||||
<td>
|
||||
<div class="ui checkbox">
|
||||
<input type="checkbox" value="1" v-model="shutdownConfig.isOn" />
|
||||
<label></label>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody v-show="(!vIsLocation || shutdownConfig.isPrior) && shutdownConfig.isOn">
|
||||
<tr>
|
||||
<td class="title">页面URL</td>
|
||||
<td>
|
||||
<input type="text" v-model="shutdownConfig.url" placeholder="页面文件路径或一个完整URL"/>
|
||||
<p class="comment">页面文件是相对于节点安装目录的页面文件比如web/pages/40x.html,或者一个完整的URL。</p>
|
||||
<p class="comment">页面文件是相对于节点安装目录的页面文件比如pages/40x.html,或者一个完整的URL。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>状态码</td>
|
||||
<td><input type="text" size="3" maxlength="3" name="shutdownStatus" style="width:5.2em" placeholder="状态码" v-model="shutdownStatus"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="comment">开启临时关闭页面时,所有请求的响应都会显示此页面。可用于临时升级网站使用。</p>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
@@ -5,11 +5,41 @@ Vue.component("http-redirect-to-https-box", {
|
||||
if (redirectToHttpsConfig == null) {
|
||||
redirectToHttpsConfig = {
|
||||
isPrior: false,
|
||||
isOn: false
|
||||
isOn: false,
|
||||
host: "",
|
||||
port: 0,
|
||||
status: 0
|
||||
}
|
||||
}
|
||||
return {
|
||||
redirectToHttpsConfig: redirectToHttpsConfig
|
||||
redirectToHttpsConfig: redirectToHttpsConfig,
|
||||
portString: (redirectToHttpsConfig.port > 0) ? redirectToHttpsConfig.port.toString() : "",
|
||||
moreOptionsVisible: false,
|
||||
statusOptions: [
|
||||
{"code": 301, "text": "Moved Permanently"},
|
||||
{"code": 308, "text": "Permanent Redirect"},
|
||||
{"code": 302, "text": "Found"},
|
||||
{"code": 303, "text": "See Other"},
|
||||
{"code": 307, "text": "Temporary Redirect"}
|
||||
]
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
"redirectToHttpsConfig.status": function () {
|
||||
this.redirectToHttpsConfig.status = parseInt(this.redirectToHttpsConfig.status)
|
||||
},
|
||||
portString: function (v) {
|
||||
let port = parseInt(v)
|
||||
if (!isNaN(port)) {
|
||||
this.redirectToHttpsConfig.port = port
|
||||
} else {
|
||||
this.redirectToHttpsConfig.port = 0
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
changeMoreOptions: function (isVisible) {
|
||||
this.moreOptionsVisible = isVisible
|
||||
}
|
||||
},
|
||||
template: `<div>
|
||||
@@ -26,9 +56,36 @@ Vue.component("http-redirect-to-https-box", {
|
||||
<input type="checkbox" v-model="redirectToHttpsConfig.isOn"/>
|
||||
<label></label>
|
||||
</div>
|
||||
<p class="comment">开启后,所有HTTP的请求都会自动跳转到对应的HTTPS URL上。</p>
|
||||
<p class="comment">开启后,所有HTTP的请求都会自动跳转到对应的HTTPS URL上,<more-options-angle @change="changeMoreOptions"></more-options-angle></p>
|
||||
|
||||
<!-- TODO 如果已经设置了特殊设置,需要在界面上显示 -->
|
||||
<table class="ui table" v-show="moreOptionsVisible">
|
||||
<tr>
|
||||
<td class="title">状态码</td>
|
||||
<td>
|
||||
<select class="ui dropdown auto-width" v-model="redirectToHttpsConfig.status">
|
||||
<option value="0">[使用默认]</option>
|
||||
<option v-for="option in statusOptions" :value="option.code">{{option.code}} {{option.text}}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>域名或IP地址</td>
|
||||
<td>
|
||||
<input type="text" name="host" v-model="redirectToHttpsConfig.host"/>
|
||||
<p class="comment">默认和用户正在访问的域名或IP地址一致。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>端口</td>
|
||||
<td>
|
||||
<input type="text" name="port" v-model="portString" maxlength="5" style="width:6em"/>
|
||||
<p class="comment">默认端口为443。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -38,7 +95,34 @@ Vue.component("http-redirect-to-https-box", {
|
||||
<input type="checkbox" v-model="redirectToHttpsConfig.isOn"/>
|
||||
<label></label>
|
||||
</div>
|
||||
<p class="comment">开启后,所有HTTP的请求都会自动跳转到对应的HTTPS URL上。</p>
|
||||
<p class="comment">开启后,所有HTTP的请求都会自动跳转到对应的HTTPS URL上,<more-options-angle @change="changeMoreOptions"></more-options-angle></p>
|
||||
|
||||
<!-- TODO 如果已经设置了特殊设置,需要在界面上显示 -->
|
||||
<table class="ui table" v-show="moreOptionsVisible">
|
||||
<tr>
|
||||
<td class="title">状态码</td>
|
||||
<td>
|
||||
<select class="ui dropdown auto-width" v-model="redirectToHttpsConfig.status">
|
||||
<option value="0">[使用默认]</option>
|
||||
<option v-for="option in statusOptions" :value="option.code">{{option.code}} {{option.text}}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>域名或IP地址</td>
|
||||
<td>
|
||||
<input type="text" name="host" v-model="redirectToHttpsConfig.host"/>
|
||||
<p class="comment">默认和用户正在访问的域名或IP地址一致。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>端口</td>
|
||||
<td>
|
||||
<input type="text" name="port" v-model="portString" maxlength="5" style="width:6em"/>
|
||||
<p class="comment">默认端口为443。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="margin"></div>
|
||||
</div>`
|
||||
|
||||
@@ -38,11 +38,21 @@ Tea.context(function () {
|
||||
*/
|
||||
this.checkClusterChanges = function () {
|
||||
this.$get("/common/changedClusters")
|
||||
.params({
|
||||
isNotifying: (this.globalChangedClusters.length > 0) ? 1 : 0
|
||||
})
|
||||
.timeout(60)
|
||||
.success(function (resp) {
|
||||
this.globalChangedClusters = resp.data.clusters;
|
||||
}).fail(function () {
|
||||
this.globalChangedClusters = [];
|
||||
})
|
||||
})
|
||||
.fail(function () {
|
||||
this.globalChangedClusters = [];
|
||||
})
|
||||
.done(function () {
|
||||
this.$delay(function () {
|
||||
this.checkClusterChanges()
|
||||
}, 3000)
|
||||
})
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,6 +17,16 @@
|
||||
<option value="2">未安装</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="ui field">
|
||||
在线状态:
|
||||
</div>
|
||||
<div class="ui field">
|
||||
<select class="ui dropdown" name="activeState" v-model="activeState">
|
||||
<option value="0">[全部]</option>
|
||||
<option value="1">在线</option>
|
||||
<option value="2">不在线</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="ui field">
|
||||
<button class="ui button" type="submit">搜索</button>
|
||||
</div>
|
||||
@@ -63,7 +73,10 @@
|
||||
</td>
|
||||
<td>
|
||||
<div v-if="node.isInstalled">
|
||||
<span v-if="node.status.isActive"><span class="green">运行中</span></span>
|
||||
<div v-if="node.status.isActive">
|
||||
<span v-if="!node.isSynced" class="red">同步中</span>
|
||||
<span v-else class="green">运行中</span>
|
||||
</div>
|
||||
<span v-else-if="node.status.updatedAt > 0" class="red">已断开</span>
|
||||
<span v-else-if="node.status.updatedAt == 0" class="red">未连接</span>
|
||||
</div>
|
||||
|
||||
@@ -8,13 +8,21 @@
|
||||
<tr>
|
||||
<th>集群名称</th>
|
||||
<th>节点数量</th>
|
||||
<th>在线节点数量</th>
|
||||
<th>默认认证</th>
|
||||
<th class="two op">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr v-for="cluster in clusters">
|
||||
<td>{{cluster.name}}</td>
|
||||
<td>{{cluster.countNodes}}</td>
|
||||
<td>
|
||||
<a :href="'/clusters/cluster?clusterId=' + cluster.id" v-if="cluster.countAllNodes > 0">{{cluster.countAllNodes}}</a>
|
||||
<span class="disabled" v-else="">-</span>
|
||||
</td>
|
||||
<td>
|
||||
<a :href="'/clusters/cluster?clusterId=' + cluster.id + '&activeState=1'" v-if="cluster.countActiveNodes > 0"><span class="green">{{cluster.countActiveNodes}}</span></a>
|
||||
<span class="disabled" v-else>-</span>
|
||||
</td>
|
||||
<td>
|
||||
<span v-if="cluster.hasGrant" class="green">Y</span>
|
||||
<span v-else class="disabled">N</span>
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
<div>
|
||||
{$template "/menu"}
|
||||
|
||||
|
||||
<div class="form-box">
|
||||
<form class="ui form" data-tea-action="$" data-tea-before="submitBefore" data-tea-done="submitDone" data-tea-success="submitSuccess" autocomplete="off">
|
||||
<input type="hidden" name="password" v-model="passwordMd5"/>
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
<th>服务名称</th>
|
||||
<th>服务类型</th>
|
||||
<th>部署集群</th>
|
||||
<th>运行节点数</th>
|
||||
<th>未运行节点数</th>
|
||||
<th>端口</th>
|
||||
<th>状态</th>
|
||||
<th class="two op">操作</th>
|
||||
@@ -18,13 +20,17 @@
|
||||
<td>{{server.name}}</td>
|
||||
<td>{{server.serverTypeName}}</td>
|
||||
<td>{{server.cluster.name}}</td>
|
||||
<td><span class="disabled">[暂无]</span></td>
|
||||
<td><span class="disabled">[暂无]</span></td>
|
||||
<td>
|
||||
<span v-if="server.ports.length == 0">-</span>
|
||||
<div v-for="port in server.ports" class="ui label small">
|
||||
{{port.portRange}}<span class="small">({{port.protocol}})</span>
|
||||
</div>
|
||||
</td>
|
||||
<td></td>
|
||||
<td>
|
||||
<span class="disabled">[暂无]</span>
|
||||
</td>
|
||||
<td>
|
||||
<a :href="'/servers/server?serverId=' + server.id">详情</a>
|
||||
</td>
|
||||
|
||||
@@ -6,7 +6,9 @@ Tea.context(function () {
|
||||
"serverId": serverId
|
||||
})
|
||||
.success(function () {
|
||||
teaweb.successURL("删除成功", "/servers")
|
||||
teaweb.success("删除成功", function () {
|
||||
window.location = "/servers"
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
{$layout "layout_popup"}
|
||||
<h3>添加特殊页面</h3>
|
||||
<form class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<table class="ui table selectable definition">
|
||||
<tr>
|
||||
<td class="title">响应状态码 *</td>
|
||||
<td>
|
||||
<input type="text" name="status" size="3" placeholder="状态码" maxlength="3" style="width:5.2em" ref="focus"/>
|
||||
<p class="comment">比如404,或者50x。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>URL *</td>
|
||||
<td>
|
||||
<input type="text" name="url" maxlength="500" placeholder="页面文件路径或者完整的URL"/>
|
||||
<p class="comment">页面文件是相对于节点安装目录的页面文件比如web/pages/40x.html,或者一个完整的URL。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>新状态码</td>
|
||||
<td>
|
||||
<input type="text" name="newStatus" size="3" placeholder="状态码" maxlength="3" style="width:5.2em"/>
|
||||
<p class="comment">可以用来修改响应的状态码,不填表示不改变原有状态码。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
@@ -1,3 +0,0 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyPopup
|
||||
})
|
||||
@@ -9,7 +9,7 @@
|
||||
<div class="right-box tiny">
|
||||
<form class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<input type="hidden" name="webId" :value="webId"/>
|
||||
<http-pages-and-shutdown-box :v-pages="pages" :v-shutdown-config="shutdownConfig"></http-pages-and-shutdown-box>
|
||||
<http-pages-and-shutdown-box :v-pages="pages" :v-shutdown-config="shutdownConfig" :v-is-location="true"></http-pages-and-shutdown-box>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
{$layout "layout_popup"}
|
||||
<h3>修改特殊页面</h3>
|
||||
<form class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<input type="hidden" name="pageId" :value="pageConfig.id"/>
|
||||
<table class="ui table selectable definition">
|
||||
<tr>
|
||||
<td class="title">响应状态码 *</td>
|
||||
<td>
|
||||
<input type="text" name="status" size="3" placeholder="状态码" maxlength="3" style="width:5.2em" ref="focus" v-model="pageConfig.status"/>
|
||||
<p class="comment">比如404,或者50x。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>URL *</td>
|
||||
<td>
|
||||
<input type="text" name="url" maxlength="500" placeholder="页面文件路径或者完整的URL" v-model="pageConfig.url"/>
|
||||
<p class="comment">页面文件是相对于节点安装目录的页面文件比如web/pages/40x.html,或者一个完整的URL。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>新状态码</td>
|
||||
<td>
|
||||
<input type="text" name="newStatus" size="3" placeholder="状态码" maxlength="3" style="width:5.2em" v-model="newStatus"/>
|
||||
<p class="comment">可以用来修改响应的状态码,不填表示不改变原有状态码。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
@@ -1,8 +0,0 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyPopup
|
||||
|
||||
this.newStatus = ""
|
||||
if (this.pageConfig.newStatus > 0) {
|
||||
this.newStatus = this.pageConfig.newStatus
|
||||
}
|
||||
})
|
||||
@@ -13,7 +13,7 @@
|
||||
<tr>
|
||||
<td class="title">Web目录</td>
|
||||
<td>
|
||||
<input type="text" name="root" v-model="webConfig.root"/>
|
||||
<input type="text" name="root" v-model="webConfig.root" ref="focus"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<tr>
|
||||
<td class="title">Web目录</td>
|
||||
<td>
|
||||
<input type="text" name="root" v-model="webConfig.root"/>
|
||||
<input type="text" name="root" v-model="webConfig.root" ref="focus"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user