This is an automated email from the ASF dual-hosted git repository.

benjobs pushed a commit to branch notify_message
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git


The following commit(s) were added to refs/heads/notify_message by this push:
     new 45437b12f [Improve] notify message improvement
45437b12f is described below

commit 45437b12fa4254fb2a18b3b2a894f75f3d3f460b
Author: benjobs <[email protected]>
AuthorDate: Mon Aug 5 20:59:26 2024 +0800

    [Improve] notify message improvement
---
 .../core/service/impl/AppBuildPipeServiceImpl.java |  1 +
 .../default/header/components/notify/index.vue     | 42 ++++------------------
 2 files changed, 7 insertions(+), 36 deletions(-)

diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/AppBuildPipeServiceImpl.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/AppBuildPipeServiceImpl.java
index a0868ef10..1d4edd7cd 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/AppBuildPipeServiceImpl.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/AppBuildPipeServiceImpl.java
@@ -256,6 +256,7 @@ public class AppBuildPipeServiceImpl
                       app.getJobName().concat(" release failed"),
                       Utils.stringifyException(snapshot.error().exception()),
                       NoticeType.EXCEPTION);
+              messageService.save(message);
               app.setRelease(ReleaseState.FAILED.get());
               app.setOptionState(OptionState.NONE.getValue());
               app.setBuild(true);
diff --git 
a/streampark-console/streampark-console-webapp/src/layouts/default/header/components/notify/index.vue
 
b/streampark-console/streampark-console-webapp/src/layouts/default/header/components/notify/index.vue
index ca016fdee..f840cf825 100644
--- 
a/streampark-console/streampark-console-webapp/src/layouts/default/header/components/notify/index.vue
+++ 
b/streampark-console/streampark-console-webapp/src/layouts/default/header/components/notify/index.vue
@@ -33,20 +33,17 @@
   </div>
 </template>
 <script lang="ts">
-  import { computed, defineComponent, ref, unref, watch, h } from 'vue';
-
+  import { computed, defineComponent, ref, unref, h } from 'vue';
   import { Popover, Tabs, Badge, Spin } from 'ant-design-vue';
   import { BellOutlined } from '@ant-design/icons-vue';
   import NoticeList from './NoticeList.vue';
   import { useDesign } from '/@/hooks/web/useDesign';
   import { fetchNotify, fetchNotifyDelete } from '/@/api/system/notify';
   import { NotifyItem } from '/@/api/system/model/notifyModel';
-  import { useWebSocket } from '@vueuse/core';
-  import { useUserStoreWithOut } from '/@/store/modules/user';
   import { useMessage } from '/@/hooks/web/useMessage';
-  import { isObject } from '/@/utils/is';
   import { useI18n } from '/@/hooks/web/useI18n';
   const { t } = useI18n();
+
   export interface TabItem {
     key: number;
     name: string;
@@ -58,8 +55,7 @@
     components: { Popover, BellOutlined, Tabs, TabPane: Tabs.TabPane, Badge, 
NoticeList, Spin },
     setup() {
       const { prefixCls } = useDesign('header-notify');
-      const userStore = useUserStoreWithOut();
-      const { createMessage, createConfirm } = useMessage();
+      const { createConfirm } = useMessage();
       const notifyType = ref(1);
       const currentPage = ref(1);
       const notifyVisible = ref(false);
@@ -75,6 +71,7 @@
         }
         return count;
       });
+
       /* View notification messages */
       async function handleNotifyInfo(record: NotifyItem) {
         notifyVisible.value = false;
@@ -112,6 +109,7 @@
           notifyLoading.value = false;
         }
       }
+
       /* Process notification message data */
       function handleNotifyMessage(type: number, data: NotifyItem[]) {
         /* The abnormal alarm */
@@ -122,36 +120,8 @@
         }
       }
 
-      const wbSocketUrl = `${window.location.origin}${
-        import.meta.env.VITE_GLOB_API_URL + 
(import.meta.env.VITE_GLOB_API_URL_PREFIX || '')
-      }/websocket/${userStore.getUserInfo.userId}`;
+      setInterval(() => getNotifyList(1), 5000);
 
-      const { data } = useWebSocket(wbSocketUrl.replace(/http/, 'ws'), {
-        autoReconnect: {
-          retries: 3,
-          delay: 1000,
-          onFailed() {
-            createMessage.warning('Message server connection failed!');
-          },
-        },
-      });
-
-      watch([data, currentPage], ([newData]: [NotifyItem], [newPage]) => {
-        if (newData && isObject(newData)) {
-          /* The abnormal alarm */
-          if (unref(notifyType) === 1) {
-            listData.value[0].list.push(newData);
-          } else {
-            listData.value[1].list.push(newData);
-          }
-          handleNotifyInfo(newData);
-        }
-        if (newPage) {
-          getNotifyList(unref(notifyType));
-        }
-      });
-      getNotifyList(1);
-      getNotifyList(2);
       return {
         prefixCls,
         listData,

Reply via email to