Skip to content

Commit

Permalink
Merge pull request #1140 from luanwenfei-venus/develop_issue_1109_ui
Browse files Browse the repository at this point in the history
【bug】URL配置错误,请求后端失败,修改请求的URL
  • Loading branch information
robotLJW authored Mar 23, 2023
2 parents 8162edb + 6f9ca2b commit e56e893
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<el-table-column prop="address" label="操作">
<template #default="scope">
<el-button size="large" @click="editWebHook(scope.row)">编辑</el-button>
<el-button size="large">测试连接</el-button>
<el-button size="large" @click="testWebHook(scope.row)">测试连接</el-button>
</template>
</el-table-column>
</el-table>
Expand Down Expand Up @@ -78,23 +78,14 @@ onBeforeMount(() => {
const getWebHooks = () => {
axios
.get(`http://192.168.95.193:8900/sermant/event/webhooks`)
.get(`${window.location.origin}/sermant/event/webhooks`)
.then(function (response) {
const data = response.data;
for (let index = 0; index < data.webhooks.length; index++) {
webhooks[data.webhooks[index].id].url = data.webhooks[index].url;
webhooks[data.webhooks[index].id].enable = data.webhooks[index].enable;
}
});
// axios
// .get(`http://${window.location.origin}/sermant/event/webhooks`)
// .then(function (response) {
// const data = response.data;
// for (let index = 0; index < data.webhooks.length; index++) {
// webhooks[data.webhooks[index].id].url = data.webhooks[index].url;
// webhooks[data.webhooks[index].id].enable = data.webhooks[index].enable;
// }
// });
};
const editWebHook = (webhook) => {
Expand All @@ -109,7 +100,7 @@ const setWebHook = (webhook) => {
console.log(webhook);
webhook.canEdit = false;
axios
.put(`http://${window.location.origin}/sermant/event/webhooks/` + webhook.id, {
.put(`${window.location.origin}/sermant/event/webhooks/` + webhook.id, {
url: webhook.url,
enable: webhook.enable,
})
Expand All @@ -120,7 +111,7 @@ const setWebHook = (webhook) => {
const testWebHook = (webhook) => {
axios
.post(`http://${window.location.origin}/sermant/event/webhooks/test`, {
.post(`${window.location.origin}/sermant/event/webhooks/test`, {
id: webhook.id,
})
.catch(function (error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ const requestParam = reactive({
const pageChange = (pageNubmber: number) => {
axios
.get(`http://${window.location.origin}/sermant/event/events/page`, {
.get(`${window.location.origin}/sermant/event/events/page`, {
params: { page: pageNubmber },
})
.then(function (response) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@
</el-input>
<div>
<el-table :data="state.tableData" style="width: 100%" :border="true" stripe>
<el-table-column label="状态" prop="health">
<el-table-column label="状态" prop="health" width="100">
<template #default="scope">
<div class="dot normal-dot" v-if="scope.row.health"></div>
<div class="dot abnormal-dot" v-if="!scope.row.health"></div>
</template>
</el-table-column>
<el-table-column prop="service" label="服务" width="100"> </el-table-column>
<el-table-column prop="service" label="服务" width="120"> </el-table-column>
<el-table-column prop="instanceId" label="实例ID" width="320"> </el-table-column>
<el-table-column prop="version" label="版本" width="100"> </el-table-column>
<el-table-column prop="version" label="版本" width="120"> </el-table-column>
<el-table-column prop="ipAddress" label="IP" width="180"> </el-table-column>
<el-table-column prop="heartbeatTime" label="心跳时间" width="180">
</el-table-column>
Expand Down Expand Up @@ -164,18 +164,22 @@ const versionTag = reactive([]);
const handleCloseApplicationTag = (tag: string) => {
applicationTag.splice(applicationTag.indexOf(tag), 1);
search();
};
const handleCloseServiceTag = (tag: string) => {
serviceTag.splice(serviceTag.indexOf(tag), 1);
search();
};
const handleCloseIpTag = (tag: string) => {
ipTag.splice(ipTag.indexOf(tag), 1);
search();
};
const handleCloseVersionTag = (tag: string) => {
versionTag.splice(versionTag.indexOf(tag), 1);
search();
};
const handleInputConfirm = () => {
Expand Down Expand Up @@ -259,31 +263,31 @@ async function getTableData() {
const res = await axios.get(`${window.location.origin}/sermant/getPluginsInfo`);
// 清理统计服务
tagCount.serviceCount = [];
http: innerData = res.data;
innerData = res.data;
innerData.forEach((item) => {
if (item.health) {
state.normalCount++;
} else {
state.abnormalCount++;
}
// 统计服务数
if (tagCount.serviceCount.indexOf(item.service) === -1) {
tagCount.serviceCount.push(item.service);
}
});
// 统计服务数
if (tagCount.serviceCount.indexOf(item.service) === -1) {
tagCount.serviceCount.push(item.service);
}
showData = JSON.parse(JSON.stringify(res.data));
state.total = showData.length;
const result = JSON.parse(JSON.stringify(showData.slice(0, state.pageSize)));
state.tableData = handle(result);
} catch (err) {
console.log(err);
} finally {
state.loading = false;
}
}
function handle(result: any[]) {
result.forEach((item: any) => {
if (item.ip instanceof Array) {
// item.ip = item.ip.join(",");
item.ipAddress = item.ip.join(",");
}
const heartbeatDate = new Date(item.heartbeatTime);
Expand Down Expand Up @@ -318,10 +322,6 @@ function search() {
// 筛选服务
if (serviceTag.length !== 0) {
isMatch = isMatch && serviceTag.indexOf(item.service) !== -1;
// 统计服务数
if (tagCount.serviceCount.indexOf(item.service) === -1) {
tagCount.serviceCount.push(item.service);
}
}
// 筛选IP
if (ipTag.length !== 0) {
Expand All @@ -339,6 +339,10 @@ function search() {
isMatch = isMatch && versionTag.indexOf(item.version) !== -1;
}
if (isMatch) {
// 统计服务数
if (tagCount.serviceCount.indexOf(item.service) === -1) {
tagCount.serviceCount.push(item.service);
}
showData.push(item);
}
});
Expand Down

0 comments on commit e56e893

Please sign in to comment.