Skip to content

Store workspace id in hash - #5

Open
SuZhou-Joe wants to merge 28 commits into
mainfrom
feature/stateful_url_hash
Open

Store workspace id in hash#5
SuZhou-Joe wants to merge 28 commits into
mainfrom
feature/stateful_url_hash

Conversation

@SuZhou-Joe

Copy link
Copy Markdown
Owner

Description

Issues Resolved

Screenshot

Testing the changes

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

ruanyl and others added 21 commits October 7, 2023 15:11
The core workspace module(WorkspaceService) is a foundational component
that enables the implementation of workspace features within OSD
plugins. The purpose of the core workspace module is to provide
a framework for workspace implementations.

This module does not implement specific workspace
functionality but provides the essential infrastructure for plugins to
extend and customize workspace features, it maintains a shared
workspace state(observables) across the entire application to ensure
a consistent and up-to-date view of workspace-related information to
all parts of the application.

---------

Signed-off-by: Yulong Ruan <ruanyl@amazon.com>
Signed-off-by: Yulong Ruan <ruanyl@amazon.com>
Signed-off-by: Yulong Ruan <ruanyl@amazon.com>
Signed-off-by: Yulong Ruan <ruanyl@amazon.com>
Signed-off-by: Yulong Ruan <ruanyl@amazon.com>
Co-authored-by: Miki <amoo_miki@yahoo.com>
Signed-off-by: Yulong Ruan <ruanyu1@gmail.com>
Signed-off-by: Yulong Ruan <ruanyl@amazon.com>
Signed-off-by: Yulong Ruan <ruanyl@amazon.com>
Signed-off-by: Yulong Ruan <ruanyl@amazon.com>
Signed-off-by: Yulong Ruan <ruanyl@amazon.com>
Signed-off-by: Yulong Ruan <ruanyl@amazon.com>
* Discover: Fixes state persistence after nav
* Fixed breadcrumbs and navigation
* fixes mobile view

---------

Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>
Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
@codecov-commenter

codecov-commenter commented Oct 7, 2023

Copy link
Copy Markdown

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (1e980fa) 66.78% compared to head (05fda74) 66.79%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main       #5      +/-   ##
==========================================
+ Coverage   66.78%   66.79%   +0.01%     
==========================================
  Files        3284     3286       +2     
  Lines       63092    63126      +34     
  Branches    10048    10052       +4     
==========================================
+ Hits        42134    42164      +30     
- Misses      18486    18488       +2     
- Partials     2472     2474       +2     
Flag Coverage Δ
Linux_1 35.25% <26.66%> (-0.01%) ⬇️
Linux_2 55.29% <94.11%> (+0.05%) ⬆️
Linux_3 43.82% <26.66%> (-0.03%) ⬇️
Linux_4 35.35% <26.66%> (-0.01%) ⬇️
Windows_1 35.27% <26.66%> (-0.01%) ⬇️
Windows_2 55.26% <94.11%> (+0.05%) ⬆️
Windows_3 43.83% <26.66%> (-0.02%) ⬇️
Windows_4 35.35% <26.66%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...lication/capabilities/capabilities_service.mock.ts 100.00% <ø> (ø)
src/core/public/core_system.test.mocks.ts 100.00% <100.00%> (ø)
src/core/public/core_system.ts 91.95% <100.00%> (+0.38%) ⬆️
src/core/public/mocks.ts 59.09% <ø> (ø)
src/core/public/plugins/plugin_context.ts 44.44% <ø> (ø)
...c/core/public/workspace/workspaces_service.mock.ts 100.00% <100.00%> (ø)
...e/server/capabilities/capabilities_service.mock.ts 75.00% <ø> (ø)
...c/core/server/capabilities/capabilities_service.ts 100.00% <ø> (ø)
src/core/public/workspace/workspaces_service.ts 88.88% <88.88%> (ø)

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
SuZhou-Joe pushed a commit that referenced this pull request Jun 11, 2026
…ch-project#12168)

* feat: Add Create alert rule button to Metrics page

Adds a 'Create alert rule' entry point at the top of the Metrics page
that opens a flyout pre-populated with all current PromQL queries.
Each query becomes a separate Cortex alerting rule with configurable
threshold, operator, and for-duration.

- Add CreateMetricsRuleFlyout component
- Add button to metrics_page_tabs toolbar (visible in both Explore/Query tabs)
- Read queries from QueryStringManager (no Update click required)
- Support multi-query rule group creation via POST /api/alerting/prometheus/{dsId}/rules

Signed-off-by: Riya Saxena <riysaxen@amazon.com>

* fix: Fix deriveRuleName for wrapped PromQL and test timer handling

- deriveRuleName now extracts inner metric name from function wrappers
  (e.g., rate(http_requests_total[5m]) -> http_requests_total)
- Tests use fake timers to handle async save/poll/close flow
- Add http.get mock for polling logic

Signed-off-by: Riyaz Saxena <riysaxen@amazon.com>

* test: Add dedicated unit tests for deriveRuleName regex patterns

- Export deriveRuleName for direct testing
- Add parameterized tests covering: function-wrapped metrics,
  simple metric names, label selectors, nested functions, and fallback

Signed-off-by: Riyaz Saxena <riysaxen@amazon.com>

* fix: Read selected metric from Explore tab for alert rule creation

When on the Explore tab, parsedQueries now falls back to reading
metricsExploreState.metric from Redux state, so the Create alert rule
flyout pre-populates with the selected metric name instead of showing
'No queries to create rules from'.

Signed-off-by: Riyaz Saxena <riysaxen@amazon.com>

* test: Add Explore tab integration tests for flyout

- Verify single metric from Explore tab renders one rule card
- Verify plain metric name derives correct rule name

Signed-off-by: Riyaz Saxena <riysaxen@amazon.com>

* fix: Simplify flyout save states - show 'Creating in Prometheus...' throughout

- Remove separate 'Confirming rule creation...' state from button
- Show 'Creating in Prometheus...' for the entire save duration
- Toast now says 'N alert rule(s) created successfully' (matches Rules tab UX)

Signed-off-by: Riyaz Saxena <riysaxen@amazon.com>

* fix: Pass addToast to flyout so success/error toasts are shown

Wire services.notifications.toasts to the CreateMetricsRuleFlyout
addToast prop so users see 'N alert rule(s) created successfully'
toast on save, matching the Rules tab UX.

Signed-off-by: Riyaz Saxena <riysaxen@amazon.com>

* fix: Remove 90s polling from Metrics page flyout — close immediately on success

Match the optimistic pattern from the Rules tab: POST rules, show success
toast, close flyout immediately. Removed 'confirming' state, http.get
prop (no longer needed for polling), and the 18x5s polling loop.

Signed-off-by: Riyaz Saxena <riysaxen@amazon.com>

* fix: Address lezzago + joshuali925 review comments

- Deduplicate rule names to prevent Cortex group overwrites (lezzago)
- Prevent flyout close during active save (lezzago)
- Fix threshold input to allow decimals/negatives (joshuali925 #3)
- Use splitMultiQueries helper instead of hand-rolled splitter (joshuali925 #2)
- Remove 'as any' cast on http prop (joshuali925 #5)

Signed-off-by: Riyaz Saxena <riysaxen@amazon.com>

---------

Signed-off-by: Riya Saxena <riysaxen@amazon.com>
Signed-off-by: Riyaz Saxena <riysaxen@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants