You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampark.apache.org by be...@apache.org on 2022/10/31 12:29:53 UTC

[incubator-streampark] branch dev updated: [Improve]: change alert style and fix suggestion bug (#1934)

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

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


The following commit(s) were added to refs/heads/dev by this push:
     new 089b3f71d [Improve]: change alert style and fix suggestion bug (#1934)
089b3f71d is described below

commit 089b3f71d63893d6ddf2942900d9435bc041b7db
Author: Sizhu Wang <39...@users.noreply.github.com>
AuthorDate: Mon Oct 31 20:29:45 2022 +0800

    [Improve]: change alert style and fix suggestion bug (#1934)
    
    * [Improve]: change alert style and fix suggestion bug
    
    * [Improve] Adjusting the variable query interface
---
 .../streampark-console-newui/src/api/system/variable.ts  | 10 +++++-----
 .../streampark-console-newui/src/hooks/web/useMonaco.ts  |  5 +++--
 .../src/views/flink/app/hooks/useCreateAndEditSchema.ts  | 16 ++++++++--------
 .../src/views/flink/app/hooks/useFlinkRender.tsx         |  5 ++---
 .../src/views/flink/app/hooks/useFlinkSchema.ts          | 14 +++++++-------
 .../src/views/flink/app/hooks/useLog.ts                  | 13 ++++++++++---
 .../src/views/flink/setting/components/AlertSetting.vue  |  4 ++--
 7 files changed, 37 insertions(+), 30 deletions(-)

diff --git a/streampark-console/streampark-console-newui/src/api/system/variable.ts b/streampark-console/streampark-console-newui/src/api/system/variable.ts
index 54e1341a7..04d74a2da 100644
--- a/streampark-console/streampark-console-newui/src/api/system/variable.ts
+++ b/streampark-console/streampark-console-newui/src/api/system/variable.ts
@@ -21,14 +21,14 @@ import { BasicTableParams } from '../model/baseModel';
 import { VariableDeleteParam, VariableListRecord, VariableParam } from './model/variableModel';
 
 enum VARIABLE_API {
-  LIST = '/variable/page',
+  PAGE = '/variable/page',
   DEPEND = '/variable/dependApps',
   UPDATE = '/variable/update',
   POST = '/variable/post',
   DELETE = '/variable/delete',
   SELECT = '/variable/select',
   CHECK_CODE = '/variable/check/code',
-  ALL = '/variable/all',
+  LIST = '/variable/list',
 }
 /**
  * get variable list
@@ -36,7 +36,7 @@ enum VARIABLE_API {
  * @returns
  */
 export function fetchVariableList(data: BasicTableParams): Promise<VariableListRecord[]> {
-  return defHttp.post({ url: VARIABLE_API.LIST, data });
+  return defHttp.post({ url: VARIABLE_API.PAGE, data });
 }
 
 /**
@@ -96,6 +96,6 @@ export function fetchVariableContent(data: Recordable): Promise<any> {
  * get all variable
  * @returns {Promise<any>}
  */
-export function fetchVariableAll(data?: { key: string }): Promise<VariableListRecord[]> {
-  return defHttp.post({ url: VARIABLE_API.ALL, data });
+export function fetchVariableAll(data?: { keyword: string }): Promise<VariableListRecord[]> {
+  return defHttp.post({ url: VARIABLE_API.LIST, data });
 }
diff --git a/streampark-console/streampark-console-newui/src/hooks/web/useMonaco.ts b/streampark-console/streampark-console-newui/src/hooks/web/useMonaco.ts
index ea12e1d22..025d27f77 100644
--- a/streampark-console/streampark-console-newui/src/hooks/web/useMonaco.ts
+++ b/streampark-console/streampark-console-newui/src/hooks/web/useMonaco.ts
@@ -49,7 +49,7 @@ export function useMonaco(
   let editor: Editor.IStandaloneCodeEditor;
   let monacoInstance: any;
   const registerCompletionMap = new Map();
-
+  let disposable;
   const setContent = async (content: string) => {
     await until(isSetup).toBeTruthy();
     if (editor) editor.setValue(content);
@@ -109,7 +109,7 @@ export function useMonaco(
       }
       registerCompletionMap.set(languageId, 1);
 
-      monaco.languages.registerCompletionItemProvider(languageId, {
+      disposable = monaco.languages.registerCompletionItemProvider(languageId, {
         // triggerCharacters: ['${'],
         triggerCharacters: ['$', '{'],
         provideCompletionItems: async (model, position: Recordable) => {
@@ -211,6 +211,7 @@ export function useMonaco(
   tryOnUnmounted(() => {
     stop();
     disposeInstance();
+    disposable?.dispose();
   });
 
   return {
diff --git a/streampark-console/streampark-console-newui/src/views/flink/app/hooks/useCreateAndEditSchema.ts b/streampark-console/streampark-console-newui/src/views/flink/app/hooks/useCreateAndEditSchema.ts
index d35e8c9b2..c3f64d31a 100644
--- a/streampark-console/streampark-console-newui/src/views/flink/app/hooks/useCreateAndEditSchema.ts
+++ b/streampark-console/streampark-console-newui/src/views/flink/app/hooks/useCreateAndEditSchema.ts
@@ -374,14 +374,6 @@ export const useCreateAndEditSchema = (
         component: 'InputNumber',
         componentProps: { placeholder: 'restart max size', ...commonInputNum },
       },
-      {
-        field: 'checkPointFailure',
-        label: 'CheckPoint Failure Options',
-        component: 'InputNumber',
-        renderColContent: renderInputGroup,
-        show: ({ values }) =>
-          edit?.mode == 'flink' ? true : ![5, 6].includes(values.executionMode),
-      },
       {
         field: 'alertId',
         label: 'Fault Alert Template',
@@ -392,6 +384,14 @@ export const useCreateAndEditSchema = (
           fieldNames: { label: 'alertName', value: 'id', options: 'options' },
         },
       },
+      {
+        field: 'checkPointFailure',
+        label: 'CheckPoint Failure Options',
+        component: 'InputNumber',
+        renderColContent: renderInputGroup,
+        show: ({ values }) =>
+          edit?.mode == 'flink' ? true : ![5, 6].includes(values.executionMode),
+      },
       ...getConfigSchemas(),
       {
         field: 'totalOptions',
diff --git a/streampark-console/streampark-console-newui/src/views/flink/app/hooks/useFlinkRender.tsx b/streampark-console/streampark-console-newui/src/views/flink/app/hooks/useFlinkRender.tsx
index 275b7be30..e577bb26a 100644
--- a/streampark-console/streampark-console-newui/src/views/flink/app/hooks/useFlinkRender.tsx
+++ b/streampark-console/streampark-console-newui/src/views/flink/app/hooks/useFlinkRender.tsx
@@ -88,14 +88,13 @@ export function handleCheckCheckpoint(values: Recordable) {
   const { cpMaxFailureInterval, cpFailureRateInterval, cpFailureAction } = values.checkPointFailure;
   if (cpMaxFailureInterval != null && cpFailureRateInterval != null && cpFailureAction != null) {
     if (cpFailureAction === 1) {
-      const alertEmail = values.alertEmail;
-      if (alertEmail == null) {
+      if (values.alertId == null) {
         // this.form.setFields({
         //   alertEmail: {
         //     errors: [new Error('checkPoint failure trigger is alert,email must not be empty')],
         //   },
         // });
-        return Promise.reject('trigger action is alert,email must not be empty');
+        return Promise.reject('trigger action is alert,Fault Alert Template must not be empty');
       } else {
         return Promise.resolve();
       }
diff --git a/streampark-console/streampark-console-newui/src/views/flink/app/hooks/useFlinkSchema.ts b/streampark-console/streampark-console-newui/src/views/flink/app/hooks/useFlinkSchema.ts
index a78bd026e..0f805aae8 100644
--- a/streampark-console/streampark-console-newui/src/views/flink/app/hooks/useFlinkSchema.ts
+++ b/streampark-console/streampark-console-newui/src/views/flink/app/hooks/useFlinkSchema.ts
@@ -254,13 +254,6 @@ export const useFlinkSchema = (editModel?: string) => {
         class: '!w-full',
       },
     },
-    {
-      field: 'checkPointFailure',
-      label: 'CheckPoint Failure Options',
-      component: 'InputNumber',
-      renderColContent: renderInputGroup,
-      show: ({ values }) => (editModel == 'flink' ? true : ![5, 6].includes(values.executionMode)),
-    },
     {
       field: 'alertId',
       label: 'Fault Alert Template',
@@ -271,6 +264,13 @@ export const useFlinkSchema = (editModel?: string) => {
         fieldNames: { label: 'alertName', value: 'id', options: 'options' },
       },
     },
+    {
+      field: 'checkPointFailure',
+      label: 'CheckPoint Failure Options',
+      component: 'InputNumber',
+      renderColContent: renderInputGroup,
+      show: ({ values }) => (editModel == 'flink' ? true : ![5, 6].includes(values.executionMode)),
+    },
     ...getConfigSchemas(),
     {
       field: 'totalOptions',
diff --git a/streampark-console/streampark-console-newui/src/views/flink/app/hooks/useLog.ts b/streampark-console/streampark-console-newui/src/views/flink/app/hooks/useLog.ts
index 8fee7c5b8..e4596fa87 100644
--- a/streampark-console/streampark-console-newui/src/views/flink/app/hooks/useLog.ts
+++ b/streampark-console/streampark-console-newui/src/views/flink/app/hooks/useLog.ts
@@ -49,8 +49,10 @@ export const useLog = () => {
     monaco.languages.setMonarchTokensProvider('log', {
       tokenizer: {
         root: [
-          [/\[20\d+-\d+-\d+\s+\d+:\d+:\d+\d+|.\d+]/, 'log-date'],
-          [/\[[a-zA-Z 0-9:]+]/, 'log-date'],
+          [/\[error.*/, 'custom-error'],
+          [/\[notice.*/, 'custom-notice'],
+          [/\[info.*/, 'custom-info'],
+          [/\[[a-zA-Z 0-9:]+\]/, 'custom-date'],
         ],
       },
     });
@@ -59,7 +61,12 @@ export const useLog = () => {
       base: unref(isDark) ? 'vs-dark' : 'vs',
       inherit: true,
       colors: {},
-      rules: [{ token: 'log-date', foreground: '008800', fontStyle: 'bold' }],
+      rules: [
+        { token: 'custom-info', foreground: '808080' },
+        { token: 'custom-error', foreground: 'ff0000', fontStyle: 'bold' },
+        { token: 'custom-notice', foreground: 'FFA500' },
+        { token: 'custom-date', foreground: '008800' },
+      ],
     });
   }
   return { setContent, logRef };
diff --git a/streampark-console/streampark-console-newui/src/views/flink/setting/components/AlertSetting.vue b/streampark-console/streampark-console-newui/src/views/flink/setting/components/AlertSetting.vue
index 1536bd48c..5cb9a7a6c 100644
--- a/streampark-console/streampark-console-newui/src/views/flink/setting/components/AlertSetting.vue
+++ b/streampark-console/streampark-console-newui/src/views/flink/setting/components/AlertSetting.vue
@@ -172,8 +172,8 @@
 </script>
 
 <template>
-  <div v-auth="'project:create'" class="bg-white p-10px">
-    <a-button type="dashed" style="width: 100%; margin-top: 20px" @click="openAlertModal(true, {})">
+  <div v-auth="'project:create'" class="bg-white pt-10px px-24px">
+    <a-button type="dashed" style="width: 100%; margin-top: 10px" @click="openAlertModal(true, {})">
       <PlusOutlined />
       {{ t('common.add') }}
     </a-button>