Skip to content

Commit

Permalink
Merge pull request #1155 from luanwenfei-venus/develop_issue_1109_ui
Browse files Browse the repository at this point in the history
【feature】新增各请求成功和失败提示
  • Loading branch information
robotLJW authored Mar 30, 2023
2 parents b586ff2 + e995e82 commit 2c21bf3
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 10 deletions.
2 changes: 1 addition & 1 deletion sermant-backend/src/main/webapp/frontend/auto-imports.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
// Generated by unplugin-auto-import
export {}
declare global {

const ElMessage: typeof import('element-plus/es')['ElMessage']
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const getAssetsImge = (url: string) => {
<el-menu class="el-menu-demo" mode="horizontal">
<el-image
style="width: 15vh; margin-left: 10px"
:src="getAssetsImge('Sermant.png')"
:src="getAssetsImge('Sermant-logo.png')"
:fit="'scale-down'"
>
</el-image>
Expand Down
2 changes: 2 additions & 0 deletions sermant-backend/src/main/webapp/frontend/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import 'uno.css'

import "element-plus/theme-chalk/src/message.scss"

console.log("欢迎加入Sermant社区: https://sermant.io");

const app = createApp(App);

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,14 @@ const webhooks = reactive([
enable: false,
canEdit: false,
},
{
id: 2,
name: "welink",
url: "",
enable: false,
canEdit: false,
},
// 暂不支持welink
// {
// id: 2,
// name: "welink",
// url: "",
// enable: false,
// canEdit: false,
// },
]);
const goBack = () => {
Expand All @@ -80,11 +81,22 @@ const getWebHooks = () => {
axios
.get(`${window.location.origin}/sermant/event/webhooks`)
.then(function (response) {
ElMessage({
message: "获取WebHook配置成功",
type: "success",
});
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;
}
})
.catch(function (error) {
ElMessage({
message: "获取WebHook配置失败",
type: "error",
});
console.log(error);
});
};
Expand All @@ -104,17 +116,46 @@ const setWebHook = (webhook) => {
url: webhook.url,
enable: webhook.enable,
})
.then(function (response) {
const data = response.data;
if (data) {
ElMessage({
message: "设置成功",
type: "success",
});
} else {
ElMessage({
message: "设置失败",
type: "error",
});
}
})
.catch(function (error) {
ElMessage({
message: "设置失败",
type: "error",
});
console.log(error);
});
getWebHooks();
};
const testWebHook = (webhook) => {
axios
.post(`${window.location.origin}/sermant/event/webhooks/test`, {
id: webhook.id,
})
.then(function (response) {
ElMessage({
message: "发起WebHook测试成功",
type: "success",
});
})
.catch(function (error) {
ElMessage({
message: "发起WebHook测试失败",
type: "error",
});
console.log(error);
});
};
Expand Down
19 changes: 19 additions & 0 deletions sermant-backend/src/main/webapp/frontend/src/views/EventsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -405,9 +405,17 @@ const autoRefreshTimer = ref(0);
const changeAutoRefreshState = () => {
if (autoRefresh.value) {
ElMessage({
message: "关闭自动刷新",
type: "info",
});
autoRefresh.value = false;
clearAutoRefreshTimer();
} else {
ElMessage({
message: "开启自动刷新",
type: "info",
});
autoRefresh.value = true;
createAutoRefreshTimer();
}
Expand Down Expand Up @@ -557,6 +565,17 @@ const getEvents = () => {
eventCount.normal = data.eventCount.normal;
events.events = data.events;
displayState.totalPage = data.totalPage;
ElMessage({
message: "获取事件成功",
type: "success",
});
})
.catch(function (error) {
console.log(error);
ElMessage({
message: "获取事件失败",
type: "error",
});
});
};
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,21 @@ const state: {
async function getTableData() {
try {
state.loading = true;
const res = await axios.get(`${window.location.origin}/sermant/getPluginsInfo`);
const res = await axios
.get(`${window.location.origin}/sermant/getPluginsInfo`)
.then(function (response) {
ElMessage({
message: "获取实例数据成功",
type: "success",
});
})
.catch(function (error) {
ElMessage({
message: "获取实例数据失败",
type: "error",
});
console.log(error);
});
// 清理统计服务
tagCount.serviceCount = [];
innerData = res.data;
Expand Down

0 comments on commit 2c21bf3

Please sign in to comment.