Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: opensearch-project/OpenSearch-Dashboards
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: raintygao/OpenSearch-Dashboards
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: feat-remove-switch
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.

Commits on Aug 3, 2023

  1. setup workspace plugin project skeleton

    Signed-off-by: Yulong Ruan <ruanyl@amazon.com>
    ruanyl committed Aug 3, 2023
    Copy the full SHA
    912b6d2 View commit details
  2. test: add unit tests

    add license header
    
    Signed-off-by: Yulong Ruan <ruanyl@amazon.com>
    ruanyl committed Aug 3, 2023
    Copy the full SHA
    b774c50 View commit details
  3. workspace template init commit

    Signed-off-by: Hailong Cui <ihailong@amazon.com>
    Hailong-am authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    56a314c View commit details
  4. refacter workspace template into hooks

    Signed-off-by: Hailong Cui <ihailong@amazon.com>
    Hailong-am authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    327498c View commit details
  5. refacter workspace template hooks

    Signed-off-by: Hailong Cui <ihailong@amazon.com>
    Hailong-am authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    ff1645a View commit details
  6. update coverImage comments

    Signed-off-by: Hailong Cui <ihailong@amazon.com>
    Hailong-am authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    f1d0a35 View commit details
  7. feature: add public/workspaces service

    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    SuZhou-Joe authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    168ba7f View commit details
  8. feat: add interfaces for workspaces client

    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    SuZhou-Joe authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    7d3f24c View commit details
  9. feat: add interfaces for workspaces client

    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    SuZhou-Joe authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    c6f9a47 View commit details
  10. feat: add interfaces for workspaces client

    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    SuZhou-Joe authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    e82777f View commit details
  11. feat: implement workspaces service

    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    SuZhou-Joe authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    2c96331 View commit details
  12. feat: changes to client type interface

    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    SuZhou-Joe authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    5ec3feb View commit details
  13. feat: changes to client implement

    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    SuZhou-Joe authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    0477076 View commit details
  14. feat: implement more for workspaces service

    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    SuZhou-Joe authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    0c07b79 View commit details
  15. feat: implement more for workspaces service

    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    SuZhou-Joe authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    7767933 View commit details
  16. feat: implement more for workspaces service

    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    SuZhou-Joe authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    ef1a245 View commit details
  17. feat: add workspace creator page (#5)

    * feat: add workspace creator page
    
    Signed-off-by: Lin Wang <wonglam@amazon.com>
    
    * feat: integrate with application workspace template
    
    Signed-off-by: Lin Wang <wonglam@amazon.com>
    
    * feat: add max-width and remove image wrapper if not exists
    
    Signed-off-by: Lin Wang <wonglam@amazon.com>
    
    * feat: update filter condition to align with collapsible nav
    
    Signed-off-by: Lin Wang <wonglam@amazon.com>
    
    ---------
    
    Signed-off-by: Lin Wang <wonglam@amazon.com>
    wanglam authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    dce7d76 View commit details
  18. Add validation when load page (#8)

    * fix: validation & query
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    * feat: modify file name to reduce confusion
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    * feat: add landing logic to retrive workspace id
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    * feat: add worklist observable
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    * feat: add worklist observable
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    * feat: add worklist observable
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    * fix: type error
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    * fix: type error
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    * feat: make client more robust
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    * feat: use Subject
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    ---------
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    SuZhou-Joe authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    6117c8f View commit details
  19. feat: use BehaviorObject and optimize code (#14)

    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    SuZhou-Joe authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    a21d0c2 View commit details
  20. feat: integrate with workspace create API (#13)

    * feat: integrate with workspace create API
    
    Signed-off-by: Lin Wang <wonglam@amazon.com>
    
    * feat: update to i18n text for toast
    
    Signed-off-by: Lin Wang <wonglam@amazon.com>
    
    ---------
    
    Signed-off-by: Lin Wang <wonglam@amazon.com>
    wanglam authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    e9b5c3b View commit details
  21. Add currentWorkspace$ (#15)

    * feat: add currentWorkspace$
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    * fix: type error
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    * feat: add emit on currentWorkspace$
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    ---------
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    SuZhou-Joe authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    704520a View commit details
  22. register plugin with workspace template (#16)

    Signed-off-by: Hailong Cui <ihailong@amazon.com>
    Hailong-am authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    5074400 View commit details
  23. workspace dropdown list (#9)

    Add workspace dropdown list 
    
    ---------
    
    Signed-off-by: zhichao-aws <zhichaog@amazon.com>
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    Signed-off-by: suzhou <suzhou@amazon.com>
    Co-authored-by: SuZhoue-Joe <suzhou@amazon.com>
    2 people authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    cf16249 View commit details
  24. init workspace menu stage 1 (#12)

    * feat: init workspace menu stage 1
    
    Signed-off-by: tygao <tygao@amazon.com>
    
    * fix: remove port diff
    
    Signed-off-by: tygao <tygao@amazon.com>
    
    * feat: update menu logic
    
    Signed-off-by: tygao <tygao@amazon.com>
    
    ---------
    
    Signed-off-by: tygao <tygao@amazon.com>
    raintygao authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    42d1a51 View commit details
  25. Fix template registration import error (#21)

    * fix import error
    
    Signed-off-by: Hailong Cui <ihailong@amazon.com>
    
    * fix osd bootstrap failure
    
    Signed-off-by: Hailong Cui <ihailong@amazon.com>
    
    ---------
    
    Signed-off-by: Hailong Cui <ihailong@amazon.com>
    Hailong-am authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    d7e740b View commit details
  26. Add workspace overview page (#19)

    * feat: add workspace overview page
    
    Signed-off-by: Lin Wang <wonglam@amazon.com>
    
    * refactor: move paths to common constants
    
    Signed-off-by: Lin Wang <wonglam@amazon.com>
    
    * feat: add workspace overview item by custom nav in start phase
    
    Signed-off-by: Lin Wang <wonglam@amazon.com>
    
    * refactor: change to currentWorkspace$ in workspace client
    
    Signed-off-by: Lin Wang <wonglam@amazon.com>
    
    ---------
    
    Signed-off-by: Lin Wang <wonglam@amazon.com>
    wanglam authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    6f93c2f View commit details
  27. feat: navigate to workspace create page after button clicked (#23)

    Signed-off-by: Lin Wang <wonglam@amazon.com>
    wanglam authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    43c1bb6 View commit details
  28. fix failed test snapshots (#22)

    fix failed test snapshots
    
    temporary fix: fetch functional test from main branch
    
    fixed git error which cannot find ref due to feature branch `workspace`
    not exists on repo opensearch-dashboards-functional-test
    
    Signed-off-by: Yulong Ruan <ruanyl@amazon.com>
    
    ---------
    
    Signed-off-by: Yulong Ruan <ruanyl@amazon.com>
    ruanyl committed Aug 3, 2023
    Copy the full SHA
    e9d2571 View commit details
  29. change to currentWorkspace, wrap title using i18n (#20)

    * change to currentWorkspace, wrap title using i18n
    
    Signed-off-by: zhichao-aws <zhichaog@amazon.com>
    
    * change import
    
    Signed-off-by: zhichao-aws <zhichaog@amazon.com>
    
    * directly return [] if currentWorkspace is null
    
    Signed-off-by: zhichao-aws <zhichaog@amazon.com>
    
    ---------
    
    Signed-off-by: zhichao-aws <zhichaog@amazon.com>
    zhichao-aws authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    e0170ca View commit details
  30. add workspace switch (#17)

    * feat: update workspace switch
    
    Signed-off-by: tygao <tygao@amazon.com>
    
    * fix: fix switch error
    
    Signed-off-by: tygao <tygao@amazon.com>
    
    * fix: fix prettier after merge
    
    Signed-off-by: tygao <tygao@amazon.com>
    
    * chore: remove extra code after merge
    
    Signed-off-by: tygao <tygao@amazon.com>
    
    ---------
    
    Signed-off-by: tygao <tygao@amazon.com>
    raintygao authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    a28e12d View commit details
  31. Add update workspace page (#25)

    Signed-off-by: gaobinlong <gbinlong@amazon.com>
    gaobinlong authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    763eddb View commit details
  32. Delete Workspace (#24)

    * add delete workspace modal
    
    Signed-off-by: yuye-aws <yuyezhu@amazon.com>
    
    * implement delete on workspace overview page
    
    Signed-off-by: yuye-aws <yuyezhu@amazon.com>
    
    * fix export on delete workspace modal
    
    Signed-off-by: yuye-aws <yuyezhu@amazon.com>
    
    * add try catch to handle errors for workspace delete
    
    Signed-off-by: yuye-aws <yuyezhu@amazon.com>
    
    * move visibility control to workspace overview page exlusively
    
    Signed-off-by: yuye-aws <yuyezhu@amazon.com>
    
    * remove unused import
    
    Signed-off-by: yuye-aws <yuyezhu@amazon.com>
    
    ---------
    
    Signed-off-by: yuye-aws <yuyezhu@amazon.com>
    yuye-aws authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    b56117d View commit details
  33. feat: redirect to overview page after workspace switch (#26)

    Signed-off-by: Lin Wang <wonglam@amazon.com>
    wanglam authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    6024e9a View commit details
  34. update menu filter logic (#28)

    * feat: update menu logic
    
    Signed-off-by: tygao <tygao@amazon.com>
    
    * fix: use navLinks to filter
    
    Signed-off-by: tygao <tygao@amazon.com>
    
    ---------
    
    Signed-off-by: tygao <tygao@amazon.com>
    raintygao authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    9f60da9 View commit details
  35. feat: redirect to workspace overview page after created success (#29)

    Signed-off-by: Lin Wang <wonglam@amazon.com>
    wanglam authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    1097a89 View commit details
  36. [Feature] Complied saved_objects create/find (#18)

    * temp: save
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    * feat: make create/find support workspaces
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    * feat: extract management code
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    * fix: type check
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    * fix: build error
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    * feat: enable workspaces on saved client server side
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    * feat: some optimization
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    * feat: extract management code
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    * feat: merge fix
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    * feat: optimize code
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    * feat: reuse common function
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    * feat: optimize code when create
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    * feat: remove useless test code
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    ---------
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    SuZhou-Joe authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    33af728 View commit details
  37. Copy the full SHA
    e21dcf3 View commit details
  38. Move delete button to update page (#27)

    * add delete workspace modal
    
    Signed-off-by: yuye-aws <yuyezhu@amazon.com>
    
    * implement delete on workspace overview page
    
    Signed-off-by: yuye-aws <yuyezhu@amazon.com>
    
    * fix export on delete workspace modal
    
    Signed-off-by: yuye-aws <yuyezhu@amazon.com>
    
    * add try catch to handle errors for workspace delete
    
    Signed-off-by: yuye-aws <yuyezhu@amazon.com>
    
    * move visibility control to workspace overview page exlusively
    
    Signed-off-by: yuye-aws <yuyezhu@amazon.com>
    
    * remove unused import
    
    Signed-off-by: yuye-aws <yuyezhu@amazon.com>
    
    * change workspace overview route to workspace update
    
    Signed-off-by: yuye-aws <yuyezhu@amazon.com>
    
    * move delete button from workspace overview page to update page
    
    Signed-off-by: yuye-aws <yuyezhu@amazon.com>
    
    * remove update button from workspace overview page
    
    Signed-off-by: yuye-aws <yuyezhu@amazon.com>
    
    * recover router to workspace overview page
    
    Signed-off-by: yuye-aws <yuyezhu@amazon.com>
    
    * change navigation url for workspace overview button on left side panel
    
    Signed-off-by: yuye-aws <yuyezhu@amazon.com>
    
    ---------
    
    Signed-off-by: yuye-aws <yuyezhu@amazon.com>
    yuye-aws authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    14e03da View commit details
  39. fix: linting error

    Signed-off-by: Yulong Ruan <ruanyl@amazon.com>
    ruanyl committed Aug 3, 2023
    Copy the full SHA
    5e7b548 View commit details
  40. remove duplicate EuiPage (#34)

    * remove duplicate EuiPage
    
    Signed-off-by: Hailong Cui <ihailong@amazon.com>
    
    * fix: remove duplicate workspace template
    
    Signed-off-by: Hailong Cui <ihailong@amazon.com>
    
    ---------
    
    Signed-off-by: Hailong Cui <ihailong@amazon.com>
    Hailong-am authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    7cf1227 View commit details
  41. remove clear button, add the width of create button (#33)

    Signed-off-by: zhichao-aws <zhichaog@amazon.com>
    zhichao-aws authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    1f76aa2 View commit details
  42. rename OpenSearch Plugins to OpenSearch Features

    this is a temporary fix just for demo, should be reverted later
    
    Signed-off-by: Yulong Ruan <ruanyl@amazon.com>
    ruanyl committed Aug 3, 2023
    Copy the full SHA
    29fccee View commit details
  43. Add some logic check when overwrite a saved object (#32)

    * feat: add some logic check when overwrite a saved object
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    * fix: type check
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    * feat: update
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    ---------
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    SuZhou-Joe authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    274c96d View commit details
  44. Add color, icon and defaultVISTheme for workspace (#36)

    * feat: add color, icon and defaultVISTheme field for workspace saved object
    
    Signed-off-by: Lin Wang <wonglam@amazon.com>
    
    * add new fields to workspace form
    
    Signed-off-by: Lin Wang <wonglam@amazon.com>
    
    * feat: remove feature or group name hack
    
    Signed-off-by: Lin Wang <wonglam@amazon.com>
    
    ---------
    
    Signed-off-by: Lin Wang <wonglam@amazon.com>
    wanglam authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    d983d14 View commit details
  45. feat: add workspace list (#39)

    Signed-off-by: tygao <tygao@amazon.com>
    raintygao authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    ad0c47b View commit details
  46. Feature/menu change (#37)

    * feat: register library menus
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    * feat: some update
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    * feat: optimize code
    
    Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
    
    * feat: optimize code
    
    Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
    
    ---------
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
    SuZhou-Joe authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    bf5528f View commit details
  47. feat: different left menu and exit workspace (#38)

    * Exit workspace from left menu
    
    Signed-off-by: yuye-aws <yuyezhu@amazon.com>
    
    * Show exit workspace button with small window size
    
    Signed-off-by: yuye-aws <yuyezhu@amazon.com>
    
    * Remove recently viewed and workspace overview on left menu
    
    Signed-off-by: yuye-aws <yuyezhu@amazon.com>
    
    * Add buttons for outside, inside workspace case
    
    Signed-off-by: yuye-aws <yuyezhu@amazon.com>
    
    * Implement home button and workspace over view button on left menu
    
    Signed-off-by: yuye-aws <yuyezhu@amazon.com>
    
    * Implement workspace dropdown list in left menu
    
    Signed-off-by: yuye-aws <yuyezhu@amazon.com>
    
    * Add props on recently accessed and custom nav link
    
    Signed-off-by: yuye-aws <yuyezhu@amazon.com>
    
    * Add three props to mock props for collapsible nav: exitWorkspace, getWorkspaceUrl, workspaceList$
    
    Signed-off-by: yuye-aws <yuyezhu@amazon.com>
    
    * Add three props to mock props for header: exitWorkspace, getWorkspaceUrl, workspaceList$
    
    Signed-off-by: yuye-aws <yuyezhu@amazon.com>
    
    * Fix bugs for function createWorkspaceNavLink
    
    Signed-off-by: yuye-aws <yuyezhu@amazon.com>
    
    * Remove unused constants
    
    Signed-off-by: yuye-aws <yuyezhu@amazon.com>
    
    * Reuse method getWorkspaceUrl
    
    Signed-off-by: yuye-aws <yuyezhu@amazon.com>
    
    * Remove recently accessed and custom nav props in test
    
    Signed-off-by: yuye-aws <yuyezhu@amazon.com>
    
    * Revert "Remove recently accessed and custom nav props in test"
    
    This reverts commit 7895e5c.
    
    * Wrap title with i18n
    
    Signed-off-by: yuye-aws <yuyezhu@amazon.com>
    
    * Add redirect for workspace app
    
    Signed-off-by: yuye-aws <yuyezhu@amazon.com>
    
    * Enable users to go to workspace lists page via see more under workspaces in left menu
    
    Signed-off-by: yuye-aws <yuyezhu@amazon.com>
    
    ---------
    
    Signed-off-by: yuye-aws <yuyezhu@amazon.com>
    yuye-aws authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    1aafbd6 View commit details
  48. feat: make url stateful (#35)

    * feat: make url stateful
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    * feat: optimize code
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    * feat: remove useless change
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    * feat: optimize url listener
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    * feat: make formatUrlWithWorkspaceId extensible
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    * feat: modify to related components
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    * feat: modify the async format to be sync function
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    * feat: modify the async format to be sync function
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    * fix: type check
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    
    * feat: use path to maintain workspace info
    
    Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
    
    * feat: optimize code
    
    Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
    
    * feat: optimize code
    
    Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
    
    * feat: optimize code
    
    Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
    
    * feat: optimize code
    
    Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
    
    * feat: optimize code
    
    Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
    
    * feat: optimize code
    
    Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
    
    ---------
    
    Signed-off-by: SuZhoue-Joe <suzhou@amazon.com>
    Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
    SuZhou-Joe authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    0184a77 View commit details
  49. Fix build error and part of test error (#42)

    * fix: fix build error and some ut
    
    Signed-off-by: tygao <tygao@amazon.com>
    
    * chore: remove saved object client test diff
    
    Signed-off-by: tygao <tygao@amazon.com>
    
    ---------
    
    Signed-off-by: tygao <tygao@amazon.com>
    raintygao authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    8337f9f View commit details
  50. feat: optimize code (#40)

    Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
    SuZhou-Joe authored and ruanyl committed Aug 3, 2023
    Copy the full SHA
    1d20134 View commit details
Showing with 14,252 additions and 3,368 deletions.
  1. +4 −3 .github/workflows/cypress_workflow.yml
  2. +3 −0 config/opensearch_dashboards.yml
  3. +13 −0 src/core/public/application/types.ts
  4. +2 −0 src/core/public/chrome/chrome_service.mock.ts
  5. +2 −0 src/core/public/chrome/chrome_service.test.ts
  6. +7 −4 src/core/public/chrome/chrome_service.tsx
  7. +8 −1 src/core/public/chrome/nav_links/nav_link.ts
  8. +37 −2 src/core/public/chrome/nav_links/nav_links_service.ts
  9. +5,090 −2,270 src/core/public/chrome/ui/header/__snapshots__/collapsible_nav.test.tsx.snap
  10. +1,399 −615 src/core/public/chrome/ui/header/__snapshots__/header.test.tsx.snap
  11. +18 −0 src/core/public/chrome/ui/header/__snapshots__/header_logo.test.tsx.snap
  12. +5 −2 src/core/public/chrome/ui/header/collapsible_nav.test.tsx
  13. +107 −135 src/core/public/chrome/ui/header/collapsible_nav.tsx
  14. +42 −0 src/core/public/chrome/ui/header/collapsible_nav_header.tsx
  15. +2 −1 src/core/public/chrome/ui/header/header.test.tsx
  16. +6 −1 src/core/public/chrome/ui/header/header.tsx
  17. +30 −27 src/core/public/chrome/ui/header/nav_link.tsx
  18. +9 −0 src/core/public/core_system.ts
  19. +19 −9 src/core/public/http/base_path.ts
  20. +9 −1 src/core/public/http/http_service.ts
  21. +20 −5 src/core/public/http/types.ts
  22. +17 −0 src/core/public/index.ts
  23. +4 −0 src/core/public/mocks.ts
  24. +2 −0 src/core/public/plugins/plugin_context.ts
  25. +3 −0 src/core/public/plugins/plugins_service.test.ts
  26. +16 −9 src/core/public/saved_objects/saved_objects_client.test.ts
  27. +48 −3 src/core/public/saved_objects/saved_objects_client.ts
  28. +1 −0 src/core/public/saved_objects/saved_objects_service.mock.ts
  29. +5 −4 src/core/public/ui_settings/ui_settings_service.mock.ts
  30. +2 −0 src/core/public/utils/index.ts
  31. +17 −0 src/core/public/utils/workspace.ts
  32. +10 −0 src/core/public/workspace/index.ts
  33. +36 −0 src/core/public/workspace/workspaces_service.mock.ts
  34. +97 −0 src/core/public/workspace/workspaces_service.ts
  35. +1 −0 src/core/server/http/index.ts
  36. +2 −2 src/core/server/http/integration_tests/core_services.test.ts
  37. +15 −2 src/core/server/index.ts
  38. +1 −0 src/core/server/legacy/legacy_service.ts
  39. +1 −0 src/core/server/plugins/plugin_context.ts
  40. +6 −0 src/core/server/saved_objects/constants.ts
  41. +6 −0 src/core/server/saved_objects/export/get_sorted_objects_for_export.test.ts
  42. +8 −1 src/core/server/saved_objects/export/get_sorted_objects_for_export.ts
  43. +3 −0 src/core/server/saved_objects/import/check_conflicts.ts
  44. +4 −1 src/core/server/saved_objects/import/create_saved_objects.ts
  45. +10 −1 src/core/server/saved_objects/import/import_saved_objects.ts
  46. +38 −1 src/core/server/saved_objects/import/regenerate_ids.ts
  47. +2 −0 src/core/server/saved_objects/import/types.ts
  48. +4 −0 src/core/server/saved_objects/index.ts
  49. +8 −0 src/core/server/saved_objects/migrations/core/__snapshots__/build_active_mappings.test.ts.snap
  50. +23 −0 src/core/server/saved_objects/migrations/core/build_active_mappings.ts
  51. +12 −0 src/core/server/saved_objects/migrations/core/index_migrator.test.ts
  52. +4 −0 ...bjects/migrations/opensearch_dashboards/__snapshots__/opensearch_dashboards_migrator.test.ts.snap
  53. +168 −0 src/core/server/saved_objects/permission_control/acl.test.ts
  54. +249 −0 src/core/server/saved_objects/permission_control/acl.ts
  55. +14 −0 src/core/server/saved_objects/permission_control/client.mock.ts
  56. +146 −0 src/core/server/saved_objects/permission_control/client.ts
  57. +22 −0 src/core/server/saved_objects/permission_control/routes/index.ts
  58. +33 −0 src/core/server/saved_objects/permission_control/routes/principals.ts
  59. +40 −0 src/core/server/saved_objects/permission_control/routes/validate.ts
  60. +10 −1 src/core/server/saved_objects/routes/bulk_create.ts
  61. +82 −0 src/core/server/saved_objects/routes/copy.ts
  62. +10 −2 src/core/server/saved_objects/routes/create.ts
  63. +10 −1 src/core/server/saved_objects/routes/export.ts
  64. +5 −0 src/core/server/saved_objects/routes/find.ts
  65. +8 −0 src/core/server/saved_objects/routes/import.ts
  66. +5 −0 src/core/server/saved_objects/routes/index.ts
  67. +102 −0 src/core/server/saved_objects/routes/share.ts
  68. +0 −1 src/core/server/saved_objects/routes/utils.ts
  69. +2 −0 src/core/server/saved_objects/saved_objects_service.mock.ts
  70. +20 −1 src/core/server/saved_objects/saved_objects_service.ts
  71. +7 −1 src/core/server/saved_objects/serialization/serializer.ts
  72. +5 −0 src/core/server/saved_objects/serialization/types.ts
  73. +1 −0 src/core/server/saved_objects/service/lib/repository.mock.ts
  74. +11 −3 src/core/server/saved_objects/service/lib/repository.test.js
  75. +248 −39 src/core/server/saved_objects/service/lib/repository.ts
  76. +47 −2 src/core/server/saved_objects/service/lib/search_dsl/query_params.ts
  77. +6 −0 src/core/server/saved_objects/service/lib/search_dsl/search_dsl.ts
  78. +7 −0 src/core/server/saved_objects/service/lib/utils.ts
  79. +33 −1 src/core/server/saved_objects/service/saved_objects_client.ts
  80. +3 −0 src/core/server/saved_objects/types.ts
  81. +1 −0 src/core/types/index.ts
  82. +3 −0 src/core/types/saved_objects.ts
  83. +14 −0 src/core/types/workspace.ts
  84. +18 −0 src/core/utils/constants.ts
  85. +0 −1 src/core/utils/default_app_categories.ts
  86. +6 −0 src/core/utils/index.ts
  87. +6 −0 src/plugins/advanced_settings/public/management_app/components/page_wrapper/index.ts
  88. +21 −0 src/plugins/advanced_settings/public/management_app/components/page_wrapper/page_wrapper.tsx
  89. +36 −20 src/plugins/advanced_settings/public/management_app/mount_management_section.tsx
  90. +12 −8 src/plugins/advanced_settings/public/plugin.ts
  91. +6 −0 .../dashboard/public/application/embeddable/empty/__snapshots__/dashboard_empty_screen.test.tsx.snap
  92. +1 −5 src/plugins/data/common/index_patterns/index_patterns/index_patterns.ts
  93. +3 −5 src/plugins/data/public/index_patterns/index_patterns/redirect_no_index_pattern.tsx
  94. +2 −6 src/plugins/data/server/saved_objects/index_patterns.ts
  95. +1 −1 src/plugins/data_source_management/opensearch_dashboards.json
  96. +6 −0 src/plugins/data_source_management/public/components/page_wrapper/index.ts
  97. +21 −0 src/plugins/data_source_management/public/components/page_wrapper/page_wrapper.tsx
  98. +1 −1 src/plugins/data_source_management/public/management_app/index.ts
  99. +40 −29 src/plugins/data_source_management/public/management_app/mount_management_section.tsx
  100. +19 −16 src/plugins/data_source_management/public/plugin.ts
  101. +5 −0 src/plugins/data_source_management/public/types.ts
  102. +27 −18 src/plugins/index_pattern_management/public/management_app/mount_management_section.tsx
  103. +42 −7 src/plugins/index_pattern_management/public/plugin.ts
  104. +2 −2 ...dashboards_overview/public/components/getting_started/__snapshots__/getting_started.test.tsx.snap
  105. +1 −5 src/plugins/opensearch_dashboards_overview/public/components/getting_started/getting_started.tsx
  106. +43 −0 src/plugins/saved_objects_management/public/constants.ts
  107. +27 −0 src/plugins/saved_objects_management/public/lib/copy_saved_objects.ts
  108. +3 −1 src/plugins/saved_objects_management/public/lib/fetch_export_by_type_and_search.ts
  109. +3 −1 src/plugins/saved_objects_management/public/lib/fetch_export_objects.ts
  110. +3 −2 src/plugins/saved_objects_management/public/lib/get_saved_object_counts.ts
  111. +21 −0 src/plugins/saved_objects_management/public/lib/get_workspaces_with_write_permission.ts
  112. +2 −2 src/plugins/saved_objects_management/public/lib/import_file.ts
  113. +2 −0 src/plugins/saved_objects_management/public/lib/index.ts
  114. +7 −0 src/plugins/saved_objects_management/public/lib/parse_query.ts
  115. +27 −14 src/plugins/saved_objects_management/public/management_section/mount_section.tsx
  116. +13 −2 ...anagement/public/management_section/objects_table/__snapshots__/saved_objects_table.test.tsx.snap
  117. +2 −0 ..._management/public/management_section/objects_table/components/__snapshots__/flyout.test.tsx.snap
  118. +16 −7 ..._management/public/management_section/objects_table/components/__snapshots__/header.test.tsx.snap
  119. +2 −2 ...ment/public/management_section/objects_table/components/__snapshots__/relationships.test.tsx.snap
  120. +14 −4 ...s_management/public/management_section/objects_table/components/__snapshots__/table.test.tsx.snap
  121. +348 −0 ...lugins/saved_objects_management/public/management_section/objects_table/components/copy_modal.tsx
  122. +6 −2 src/plugins/saved_objects_management/public/management_section/objects_table/components/flyout.tsx
  123. +20 −6 src/plugins/saved_objects_management/public/management_section/objects_table/components/header.tsx
  124. +1 −0 ...ved_objects_management/public/management_section/objects_table/components/import_mode_control.tsx
  125. +4 −4 ...aved_objects_management/public/management_section/objects_table/components/relationships.test.tsx
  126. +4 −4 ...lugins/saved_objects_management/public/management_section/objects_table/components/table.test.tsx
  127. +10 −2 src/plugins/saved_objects_management/public/management_section/objects_table/components/table.tsx
  128. +16 −6 ...ins/saved_objects_management/public/management_section/objects_table/saved_objects_table.test.tsx
  129. +208 −11 src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.tsx
  130. +13 −6 src/plugins/saved_objects_management/public/management_section/saved_objects_table_page.tsx
  131. +74 −1 src/plugins/saved_objects_management/public/plugin.ts
  132. +4 −0 src/plugins/saved_objects_management/server/routes/find.ts
  133. +23 −1 src/plugins/saved_objects_management/server/routes/scroll_count.ts
  134. +2 −0 ...try_management_section/public/components/__snapshots__/telemetry_management_section.test.tsx.snap
  135. +0 −1 src/plugins/visualize/public/plugin.ts
  136. +32 −0 src/plugins/workspace/common/constants.ts
  137. +25 −0 src/plugins/workspace/config.ts
  138. +11 −0 src/plugins/workspace/opensearch_dashboards.json
  139. +93 −0 src/plugins/workspace/public/application.tsx
  140. +71 −0 src/plugins/workspace/public/components/delete_workspace_modal/delete_workspace_modal.tsx
  141. +6 −0 src/plugins/workspace/public/components/delete_workspace_modal/index.ts
  142. +41 −0 src/plugins/workspace/public/components/routes.ts
  143. +53 −0 src/plugins/workspace/public/components/utils/feature.test.ts
  144. +60 −0 src/plugins/workspace/public/components/utils/feature.ts
  145. +18 −0 src/plugins/workspace/public/components/utils/path.test.ts
  146. +17 −0 src/plugins/workspace/public/components/utils/path.ts
  147. +23 −0 src/plugins/workspace/public/components/utils/workspace.ts
  148. +53 −0 src/plugins/workspace/public/components/utils/workspace_column.tsx
  149. +6 −0 src/plugins/workspace/public/components/workspace_creator/index.tsx
  150. +84 −0 src/plugins/workspace/public/components/workspace_creator/workspace_creator.tsx
  151. +479 −0 src/plugins/workspace/public/components/workspace_creator/workspace_form.tsx
  152. +36 −0 src/plugins/workspace/public/components/workspace_creator/workspace_icon_selector.tsx
  153. +303 −0 src/plugins/workspace/public/components/workspace_creator/workspace_permission_setting_panel.tsx
  154. +35 −0 src/plugins/workspace/public/components/workspace_creator_app.tsx
  155. +6 −0 src/plugins/workspace/public/components/workspace_fatal_error/index.ts
  156. +67 −0 src/plugins/workspace/public/components/workspace_fatal_error/workspace_fatal_error.tsx
  157. +127 −0 src/plugins/workspace/public/components/workspace_list/index.tsx
  158. +35 −0 src/plugins/workspace/public/components/workspace_list_app.tsx
  159. +224 −0 src/plugins/workspace/public/components/workspace_menu/workspace_menu.tsx
  160. +32 −0 src/plugins/workspace/public/components/workspace_overview.tsx
  161. +35 −0 src/plugins/workspace/public/components/workspace_overview_app.tsx
  162. +6 −0 src/plugins/workspace/public/components/workspace_updater/index.tsx
  163. +219 −0 src/plugins/workspace/public/components/workspace_updater/workspace_updater.tsx
  164. +35 −0 src/plugins/workspace/public/components/workspace_updater_app.tsx
  165. +19 −0 src/plugins/workspace/public/hooks.ts
  166. +10 −0 src/plugins/workspace/public/index.ts
  167. +261 −0 src/plugins/workspace/public/plugin.ts
  168. +23 −0 src/plugins/workspace/public/render_workspace_menu.tsx
  169. +9 −0 src/plugins/workspace/public/types.ts
  170. +93 −0 src/plugins/workspace/public/utils.test.ts
  171. +81 −0 src/plugins/workspace/public/utils.ts
  172. +350 −0 src/plugins/workspace/public/workspace_client.ts
  173. +18 −0 src/plugins/workspace/server/index.ts
  174. +233 −0 src/plugins/workspace/server/plugin.ts
  175. +285 −0 src/plugins/workspace/server/routes/index.ts
  176. +7 −0 src/plugins/workspace/server/saved_objects/index.ts
  177. +41 −0 src/plugins/workspace/server/saved_objects/workspace.ts
  178. +519 −0 src/plugins/workspace/server/saved_objects/workspace_saved_objects_client_wrapper.ts
  179. +83 −0 src/plugins/workspace/server/types.ts
  180. +21 −0 src/plugins/workspace/server/utils.test.ts
  181. +13 −0 src/plugins/workspace/server/utils.ts
  182. +203 −0 src/plugins/workspace/server/workspace_client.ts
  183. +2 −4 test/api_integration/apis/saved_objects_management/find.ts
  184. +4 −8 test/api_integration/apis/saved_objects_management/relationships.ts
  185. +1 −1 test/functional/apps/management/_index_pattern_create_delete.js
7 changes: 4 additions & 3 deletions .github/workflows/cypress_workflow.yml
Original file line number Diff line number Diff line change
@@ -55,7 +55,8 @@ jobs:
with:
path: ${{ env.FTR_PATH }}
repository: opensearch-project/opensearch-dashboards-functional-test
ref: '${{ github.base_ref }}'
# revert this to '${{ github.base_ref }}'
ref: 'main'

- name: Get Cypress version
id: cypress_version
@@ -88,7 +89,7 @@ jobs:
name: ftr-cypress-screenshots
path: ${{ env.FTR_PATH }}/cypress/screenshots
retention-days: 1

- uses: actions/upload-artifact@v3
if: always()
with:
@@ -101,4 +102,4 @@ jobs:
with:
name: ftr-cypress-results
path: ${{ env.FTR_PATH }}/cypress/results
retention-days: 1
retention-days: 1
3 changes: 3 additions & 0 deletions config/opensearch_dashboards.yml
Original file line number Diff line number Diff line change
@@ -268,3 +268,6 @@
# Set the value of this setting to true to enable plugin augmentation on Dashboard
# vis_augmenter.pluginAugmentationEnabled: true

# Set the backend roles, whoever has the backend roles defined in this config will be regard as dashboard admin.
# Dashboard admin will have the access to all the workspaces and objects inside OpenSearch Dashboards.
# workspace.dashboardAdmin.backendRoles: ["dashboard_admin"]
13 changes: 13 additions & 0 deletions src/core/public/application/types.ts
Original file line number Diff line number Diff line change
@@ -47,6 +47,7 @@ import { IUiSettingsClient } from '../ui_settings';
import { SavedObjectsStart } from '../saved_objects';
import { AppCategory } from '../../types';
import { ScopedHistory } from './scoped_history';
import { WorkspaceStart } from '../workspace';

/**
* Accessibility status of an application.
@@ -244,6 +245,16 @@ export interface App<HistoryLocationState = unknown> {
* ```
*/
exactRoute?: boolean;

/**
* The dependencies of one application, required feature will be automatic select and can't
* be unselect in the workspace configuration.
*/
dependencies?: {
[key: string]: {
type: 'required' | 'optional';
};
};
}

/**
@@ -334,6 +345,8 @@ export interface AppMountContext {
injectedMetadata: {
getInjectedVar: (name: string, defaultValue?: any) => unknown;
};
/** {@link WorkspaceService} */
workspaces: WorkspaceStart;
};
}

2 changes: 2 additions & 0 deletions src/core/public/chrome/chrome_service.mock.ts
Original file line number Diff line number Diff line change
@@ -37,6 +37,8 @@ const createStartContractMock = () => {
getHeaderComponent: jest.fn(),
navLinks: {
getNavLinks$: jest.fn(),
getFilteredNavLinks$: jest.fn(),
setFilteredNavLinks: jest.fn(),
has: jest.fn(),
get: jest.fn(),
getAll: jest.fn(),
2 changes: 2 additions & 0 deletions src/core/public/chrome/chrome_service.test.ts
Original file line number Diff line number Diff line change
@@ -41,6 +41,7 @@ import { notificationServiceMock } from '../notifications/notifications_service.
import { uiSettingsServiceMock } from '../ui_settings/ui_settings_service.mock';
import { ChromeService } from './chrome_service';
import { getAppInfo } from '../application/utils';
import { workspacesServiceMock } from '../workspace/workspaces_service.mock';

class FakeApp implements App {
public title = `${this.id} App`;
@@ -67,6 +68,7 @@ function defaultStartDeps(availableApps?: App[]) {
injectedMetadata: injectedMetadataServiceMock.createStartContract(),
notifications: notificationServiceMock.createStartContract(),
uiSettings: uiSettingsServiceMock.createStartContract(),
workspaces: workspacesServiceMock.createStartContract(),
};

if (availableApps) {
11 changes: 7 additions & 4 deletions src/core/public/chrome/chrome_service.tsx
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ import { FormattedMessage } from '@osd/i18n/react';
import { BehaviorSubject, combineLatest, merge, Observable, of, ReplaySubject } from 'rxjs';
import { flatMap, map, takeUntil } from 'rxjs/operators';
import { EuiLink } from '@elastic/eui';
import { mountReactNode } from '../utils/mount';
import { mountReactNode } from '../utils';
import { InternalApplicationStart } from '../application';
import { DocLinksStart } from '../doc_links';
import { HttpStart } from '../http';
@@ -48,7 +48,7 @@ import { ChromeNavLinks, NavLinksService, ChromeNavLink } from './nav_links';
import { ChromeRecentlyAccessed, RecentlyAccessedService } from './recently_accessed';
import { Header } from './ui';
import { ChromeHelpExtensionMenuLink } from './ui/header/header_help_menu';
import { Branding } from '../';
import { Branding, WorkspaceStart } from '../';
export { ChromeNavControls, ChromeRecentlyAccessed, ChromeDocTitle };

const IS_LOCKED_KEY = 'core.chrome.isLocked';
@@ -99,6 +99,7 @@ interface StartDeps {
injectedMetadata: InjectedMetadataStart;
notifications: NotificationsStart;
uiSettings: IUiSettingsClient;
workspaces: WorkspaceStart;
}

/** @internal */
@@ -152,6 +153,7 @@ export class ChromeService {
injectedMetadata,
notifications,
uiSettings,
workspaces,
}: StartDeps): Promise<InternalChromeStart> {
this.initVisibility(application);

@@ -243,15 +245,15 @@ export class ChromeService {
badge$={badge$.pipe(takeUntil(this.stop$))}
basePath={http.basePath}
breadcrumbs$={breadcrumbs$.pipe(takeUntil(this.stop$))}
customNavLink$={customNavLink$.pipe(takeUntil(this.stop$))}
opensearchDashboardsDocLink={docLinks.links.opensearchDashboards.introduction}
forceAppSwitcherNavigation$={navLinks.getForceAppSwitcherNavigation$()}
helpExtension$={helpExtension$.pipe(takeUntil(this.stop$))}
helpSupportUrl$={helpSupportUrl$.pipe(takeUntil(this.stop$))}
homeHref={http.basePath.prepend('/app/home')}
isVisible$={this.isVisible$}
opensearchDashboardsVersion={injectedMetadata.getOpenSearchDashboardsVersion()}
navLinks$={navLinks.getNavLinks$()}
navLinks$={navLinks.getFilteredNavLinks$()}
customNavLink$={customNavLink$.pipe(takeUntil(this.stop$))}
recentlyAccessed$={recentlyAccessed.get$()}
navControlsLeft$={navControls.getLeft$()}
navControlsCenter$={navControls.getCenter$()}
@@ -262,6 +264,7 @@ export class ChromeService {
isLocked$={getIsNavDrawerLocked$}
branding={injectedMetadata.getBranding()}
survey={injectedMetadata.getSurvey()}
workspaces={workspaces}
/>
),

9 changes: 8 additions & 1 deletion src/core/public/chrome/nav_links/nav_link.ts
Original file line number Diff line number Diff line change
@@ -93,15 +93,22 @@ export interface ChromeNavLink {
* Disables a link from being clickable.
*
* @internalRemarks
* This is only used by the ML and Graph plugins currently. They use this field
* This is used by the ML and Graph plugins. They use this field
* to disable the nav link when the license is expired.
* This is also used by recently visited category in left menu
* to disable "No recently visited items".
*/
readonly disabled?: boolean;

/**
* Hides a link from the navigation.
*/
readonly hidden?: boolean;

/**
* Links can be navigated through url.
*/
readonly externalLink?: boolean;
}

/** @public */
39 changes: 37 additions & 2 deletions src/core/public/chrome/nav_links/nav_links_service.ts
Original file line number Diff line number Diff line change
@@ -53,6 +53,16 @@ export interface ChromeNavLinks {
*/
getNavLinks$(): Observable<Array<Readonly<ChromeNavLink>>>;

/**
* Set an observable for a sorted list of filtered navlinks.
*/
getFilteredNavLinks$(): Observable<Array<Readonly<ChromeNavLink>>>;

/**
* Set filtered navlinks.
*/
setFilteredNavLinks(filteredNavLinks: ReadonlyMap<string, ChromeNavLink>): void;

/**
* Get the state of a navlink at this point in time.
* @param id
@@ -116,6 +126,9 @@ type LinksUpdater = (navLinks: Map<string, NavLinkWrapper>) => Map<string, NavLi

export class NavLinksService {
private readonly stop$ = new ReplaySubject(1);
private filteredNavLinks$ = new BehaviorSubject<ReadonlyMap<string, ChromeNavLink> | undefined>(
undefined
);

public start({ application, http }: StartDeps): ChromeNavLinks {
const appLinks$ = application.applications$.pipe(
@@ -140,8 +153,8 @@ export class NavLinksService {
return linkUpdaters.reduce((links, updater) => updater(links), appLinks);
})
)
.subscribe((navlinks) => {
navLinks$.next(navlinks);
.subscribe((navLinks) => {
navLinks$.next(navLinks);
});

const forceAppSwitcherNavigation$ = new BehaviorSubject(false);
@@ -151,6 +164,21 @@ export class NavLinksService {
return navLinks$.pipe(map(sortNavLinks), takeUntil(this.stop$));
},

setFilteredNavLinks: (filteredNavLinks: ReadonlyMap<string, ChromeNavLink>) => {
this.filteredNavLinks$.next(filteredNavLinks);
},

getFilteredNavLinks$: () => {
return combineLatest([navLinks$, this.filteredNavLinks$]).pipe(
map(([navLinks, filteredNavLinks]) =>
filteredNavLinks === undefined
? sortNavLinks(navLinks)
: sortChromeNavLinks(filteredNavLinks)
),
takeUntil(this.stop$)
);
},

get(id: string) {
const link = navLinks$.value.get(id);
return link && link.properties;
@@ -215,3 +243,10 @@ function sortNavLinks(navLinks: ReadonlyMap<string, NavLinkWrapper>) {
'order'
);
}

function sortChromeNavLinks(chromeNavLinks: ReadonlyMap<string, ChromeNavLink>) {
return sortBy(
[...chromeNavLinks.values()].map((link) => link as Readonly<ChromeNavLink>),
'order'
);
}
Loading