You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2023/07/10 13:59:55 UTC

[skywalking] branch master updated: Allow skipping UI menu configuration (#11068)

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

wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git


The following commit(s) were added to refs/heads/master by this push:
     new a382112b23 Allow skipping UI menu configuration (#11068)
a382112b23 is described below

commit a382112b23cfd07d024836929173fb6e213dbac0
Author: kezhenxu94 <ke...@apache.org>
AuthorDate: Mon Jul 10 21:59:48 2023 +0800

    Allow skipping UI menu configuration (#11068)
---
 .../core/management/ui/menu/UIMenuInitializer.java | 24 ++++++++++++++--------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/management/ui/menu/UIMenuInitializer.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/management/ui/menu/UIMenuInitializer.java
index 4f9ba6cdc6..c8e814fca8 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/management/ui/menu/UIMenuInitializer.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/management/ui/menu/UIMenuInitializer.java
@@ -27,6 +27,7 @@ import org.apache.skywalking.oap.server.library.util.CollectionUtils;
 import org.apache.skywalking.oap.server.library.util.ResourceUtils;
 import org.yaml.snakeyaml.Yaml;
 
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.Reader;
 import java.util.List;
@@ -45,15 +46,20 @@ public class UIMenuInitializer {
     }
 
     public void start(int fetchIntervalSecond) throws IOException {
-        Reader menuReader = ResourceUtils.read("ui-initialized-templates/menu.yaml");
-        Yaml yaml = new Yaml();
-        final MenuData menuData = yaml.loadAs(menuReader, MenuData.class);
-        if (menuData == null || CollectionUtils.isEmpty(menuData.getMenus())) {
-            throw new IllegalArgumentException("cannot reading any menu items.");
-        }
+        final var menuFile = "ui-initialized-templates/menu.yaml";
+        try {
+            Reader menuReader = ResourceUtils.read(menuFile);
+            Yaml yaml = new Yaml();
+            final MenuData menuData = yaml.loadAs(menuReader, MenuData.class);
+            if (menuData == null || CollectionUtils.isEmpty(menuData.getMenus())) {
+                throw new IllegalArgumentException("cannot reading any menu items.");
+            }
 
-        // save menu and start fetch menu
-        uiMenuManagementService.saveMenuAndStartFetch(menuData.getMenus(), fetchIntervalSecond);
+            // save menu and start fetch menu
+            uiMenuManagementService.saveMenuAndStartFetch(menuData.getMenus(), fetchIntervalSecond);
+        } catch (FileNotFoundException e) {
+            log.debug("No such file of path: {}, skipping loading UI menu.", menuFile);
+        }
     }
 
     @Setter
@@ -61,4 +67,4 @@ public class UIMenuInitializer {
     public static class MenuData {
         private List<UIMenuItemSetting> menus;
     }
-}
\ No newline at end of file
+}