You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by "peachisai (via GitHub)" <gi...@apache.org> on 2025/09/06 13:21:25 UTC

[PR] Fix bugs time query range will not automatically update and add some new time query ranges [skywalking-banyandb]

peachisai opened a new pull request, #757:
URL: https://github.com/apache/skywalking-banyandb/pull/757

   <!--
       ⚠️ Please make sure to read this template first, pull requests that don't accord with this template
       maybe closed without notice.
       Texts surrounded by `<` and `>` are meant to be replaced by you, e.g. <framework name>, <issue number>.
       Put an `x` in the `[ ]` to mark the item as CHECKED. `[x]`
   -->
   
   <!-- ==== 🐛 Remove this line WHEN AND ONLY WHEN you're fixing a bug, follow the checklist 👇 ====
   ### Fix <bug description or the bug issue number or bug issue link>
   - [ ] Add a unit test to verify that the fix works.
   - [ ] Explain briefly why the bug exists and how to fix it.
        ==== 🐛 Remove this line WHEN AND ONLY WHEN you're fixing a bug, follow the checklist 👆 ==== -->
   
   <!-- ==== 🆕 Remove this line WHEN AND ONLY WHEN you're adding a new feature, follow the checklist 👇 ====
   ### <Feature description>
   - [ ] If this is non-trivial feature, paste the links/URLs to the design doc.
   - [ ] Update the documentation to include this new feature.
   - [ ] Tests(including UT, IT, E2E) are added to verify the new feature.
   - [ ] If it's UI related, attach the screenshots below.
        ==== 🆕 Remove this line WHEN AND ONLY WHEN you're adding a new feature, follow the checklist 👆 ==== -->
   
   - [x] If this pull request closes/resolves/fixes an existing issue, replace the issue number. Fixes apache/skywalking#<issue number>.
   - [ ] Update the [`CHANGES` log](https://github.com/apache/skywalking-banyandb/blob/main/CHANGES.md).
   
   https://github.com/apache/skywalking/issues/13476
   <img width="2258" height="749" alt="image" src="https://github.com/user-attachments/assets/5a95a509-be09-49ef-a8f1-b0e1e86304c5" />
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix bugs time query range will not automatically update and add some new time query ranges [skywalking-banyandb]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #757:
URL: https://github.com/apache/skywalking-banyandb/pull/757#discussion_r2328685735


##########
ui/src/components/common/data.js:
##########
@@ -17,27 +17,51 @@
 
 export const Last15Minutes = 900 * 1000;
 
-const LastWeek = 3600 * 1000 * 24 * 7;
+export const Last30Minutes = 1800 * 1000;
 
-const LastMonth = 3600 * 1000 * 24 * 30;
+export const LastHour = 3600 * 1000;
 
-const Last3Months = 3600 * 1000 * 24 * 90;
+export const LastDay = 3600 * 1000 * 24;
+
+export const LastWeek = 3600 * 1000 * 24 * 7;
+
+export const LastMonth = 3600 * 1000 * 24 * 30;
+
+export const Last3Months = 3600 * 1000 * 24 * 90;
 
 export const Shortcuts = [
   {
     text: 'Last 15 minutes',
-    value: [new Date(new Date().getTime() - Last15Minutes), new Date()],
+    value: () => createRange(Last15Minutes),
+  },
+  {
+    text: 'Last 30 minutes',
+    value: () => createRange(Last30Minutes),
+  },
+  {
+    text: 'Last hour',
+    value: () => createRange(LastHour),
+  },
+  {
+    text: 'Last day',
+    value: () => createRange(LastDay),
   },
   {
     text: 'Last week',
-    value: [new Date(new Date().getTime() - LastWeek), new Date()],
+    value: () => createRange(LastWeek),
   },
   {
     text: 'Last month',
-    value: [new Date(new Date().getTime() - LastMonth), new Date()],
+    value: () => createRange(LastMonth),
   },
   {
     text: 'Last 3 months',
-    value: [new Date(new Date().getTime() - Last3Months), new Date()],
+    value: () => createRange(Last3Months),
   },
 ];
+
+function createRange(duration) {
+  const end = new Date();
+  const start = new Date(end.getTime() - duration);
+  return [start, end];
+}

Review Comment:
   The `createRange` function lacks documentation. Add a JSDoc comment explaining its purpose, parameters, and return value to improve code maintainability.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix bugs time query range will not automatically update and add some new time query ranges [skywalking-banyandb]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #757:
URL: https://github.com/apache/skywalking-banyandb/pull/757#discussion_r2327397286


##########
ui/src/components/common/data.js:
##########
@@ -17,27 +17,73 @@
 
 export const Last15Minutes = 900 * 1000;
 
+const Last30Minutes = 1800 * 1000;
+
+const LastHour = 3600 * 1000;
+
+const LastDay = 3600 * 1000 * 24;

Review Comment:
   These new constants should be exported for consistency with the existing `Last15Minutes` export on line 18. Consider adding `export` keyword to make them available for use in other modules.



##########
ui/src/components/common/data.js:
##########
@@ -17,27 +17,73 @@
 
 export const Last15Minutes = 900 * 1000;
 
+const Last30Minutes = 1800 * 1000;
+
+const LastHour = 3600 * 1000;
+
+const LastDay = 3600 * 1000 * 24;
+
 const LastWeek = 3600 * 1000 * 24 * 7;
 
 const LastMonth = 3600 * 1000 * 24 * 30;
 
 const Last3Months = 3600 * 1000 * 24 * 90;
 
 export const Shortcuts = [
-  {
-    text: 'Last 15 minutes',
-    value: [new Date(new Date().getTime() - Last15Minutes), new Date()],
-  },
-  {
-    text: 'Last week',
-    value: [new Date(new Date().getTime() - LastWeek), new Date()],
-  },
-  {
-    text: 'Last month',
-    value: [new Date(new Date().getTime() - LastMonth), new Date()],
-  },
-  {
-    text: 'Last 3 months',
-    value: [new Date(new Date().getTime() - Last3Months), new Date()],
-  },
+    {
+        text: 'Last 15 minutes',
+        value: () => {
+            const end = new Date();
+            const start = new Date(end.getTime() - Last15Minutes);
+            return [start, end];
+        },
+    },
+    {
+        text: 'Last 30 minutes',
+        value: () => {
+            const end = new Date();
+            const start = new Date(end.getTime() - Last30Minutes);
+            return [start, end];
+        },
+    },
+    {
+        text: 'Last hour',
+        value: () => {
+            const end = new Date();
+            const start = new Date(end.getTime() - LastHour);
+            return [start, end];
+        },
+    },
+    {
+        text: 'Last day',
+        value: () => {
+            const end = new Date();
+            const start = new Date(end.getTime() - LastDay);
+            return [start, end];
+        },
+    },
+    {
+        text: 'Last week',
+        value: () => {
+            const end = new Date();
+            const start = new Date(end.getTime() - LastWeek);
+            return [start, end];
+        },
+    },
+    {
+        text: 'Last month',
+        value: () => {
+            const end = new Date();
+            const start = new Date(end.getTime() - LastMonth);
+            return [start, end];
+        },
+    },
+    {
+        text: 'Last 3 months',
+        value: () => {
+            const end = new Date();
+            const start = new Date(end.getTime() - Last3Months);
+            return [start, end];
+        },

Review Comment:
   The same pattern of creating `end` and `start` dates is repeated across all shortcuts. Consider extracting this logic into a helper function to reduce code duplication.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix bugs time query range will not automatically update and add some new time query ranges [skywalking-banyandb]

Posted by "Fine0830 (via GitHub)" <gi...@apache.org>.
Fine0830 merged PR #757:
URL: https://github.com/apache/skywalking-banyandb/pull/757


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org