OpenSearch-Dashboards icon indicating copy to clipboard operation
OpenSearch-Dashboards copied to clipboard

DeAngularize Discover Plugin

Open ananzh opened this issue 3 years ago • 1 comments

This project is part of Remove AngularJS project https://github.com/opensearch-project/OpenSearch-Dashboards/issues/1560

Scope

  • de-angularize discover
  • re-construct the discover plugin path
  • clean/add tests

Tasks

Prepare

  • convert remaining js files to ts

Deangularize context

  • create a react component context_app.tsx (context_app.html)

    • move osd-top-nav out
      • use navigation to create a react component
    • move doc-table out
      • reuse create_doc_table_react.tsx
    • move context-error-message
      • reuse context_error_message.tsx → polish to use react hooks
    • move context-action-bar
      • reuse action_bar.tsx → polish to use react hooks
  • clean up:

    • add missing types
    • transfer remaining js files to ts
    • add missing tests

Deangularize controller

Deangularize controller

  • controller variables
    • $timeout → change to await wait
    • $element → change to document.getElementById
    • uiCapacities → change to capacities
    • promise → remove
  • scope variables
    • $scope.searchSource
      • $scope.searchSource.index
      • $scope.searchSource.highlightAll
      • $scope.searchSource.version
      • $scope.searchSource.setPreferredSearchStrategyId
      • $scope.searchSource.setParent
      • $scope.searchSource.createCopy
      • $scope.searchSource.getField
      • $scope.searchSource.getOwnField
      • $scope.searchSource.getSearchRequestBody
    • $scope.indexPattern
      • $scope.indexPattern.fields
      • $scope.indexPattern.metaFields
      • $scope.indexPattern.timeFieldName
      • $scope.indexPattern.id
    • $scope.fetchCounter
    • $scope.fetchError
    • $scope.fetchStatus
    • $scope.fieldCounts
    • $scope.state
      • $scope.state.columns
      • $scope.state.filter
      • $scope.state.index
      • $scope.state.sort
    • $scope.opts
      • $scope.opts.sampleSize
    • $scope.minimumVisibleRows
    • $scope.topNavMenu
    • $scope.timeRange
    • $scope.hits
  • scope functions
    • state functions
      • $scope.setIndexPattern
      • $scope.showSaveQuery
      • $scope.updateTime
      • $scope.changeInterval
      • $scope.toMoment
      • $scope.resetQuery
      • $scope.setSortOrder
      • $scope.filterQuery
      • $scope.addColumn
      • $scope.removeColumn
      • $scope.moveColumn
    • data functions
      • scope.updateDataSource
      • $scope.timefilterUpdateHandler
      • $scope.fetch
      • $scope.$watchMulti ??
    • visualization functions
    • other
      • $scope.onSkipBottomButtonClick
      • $scope.newQuery
      • $scope.scrollToTop → remove??
  • Other variables
    • pageTitleSuffix
    • discoverBreadcrumbsTitle → put in a discover breadcrumbs react component?
    • searchFields
    • selectedFields
    • timeFieldName
    • hideTimeColumn
  • Other functions:
    • getTopNavLinks → react component for top navigation link buttons
      • newSearch
      • saveSearch
      • openSearch
      • shareSearch
      • inspectSearch
    • setupVisualization
    • saveDataSource
    • resolveIndexPatternLoading
    • getFieldCounts
    • getSharingDataFields
    • getSharingData
    • shouldSearchOnPageLoad
    • addFatalError
    • getStateDefaults
    • subscribeWithScope
    • logInspectorRequest

Deangularize Router

  • create route components
    • create main route (main_app_route.tsx) to handler all the route work in discover
    • create sub route components
      • context_app_route.tsx to handle context route
      • doc route
      • error page route
  • sanity test to make sure all routes working
  • clean and add missing tests

Deangularize components

  • clean doc views (issue: https://github.com/opensearch-project/OpenSearch-Dashboards/issues/1717, PR: https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2075)
  • clean doc table
  • ...

How to de-angularize

ananzh avatar Aug 04 '22 23:08 ananzh

Is this the meta tracking issue for deangularize discover?

ashwin-pc avatar Aug 09 '22 02:08 ashwin-pc

I see reworking Discover as an opportunity to consolidate some of our similar experiences across OpenSearch Dashboards. For example, event explorer in observability can be used for similar use cases and it has some additional features. The inverse is also true where Discover has some features not available in event explorer. It would be worth exploring what it would take to have a "Discover 2.0" that could be used for all of OpenSearch Dashboards document exploration use cases and then reuse that component in relevant experiences. I'll create an issue to start tracking.

elfisher avatar Dec 09 '22 17:12 elfisher

I created an issue for a proposal place holder regarding my comment https://github.com/opensearch-project/OpenSearch-Dashboards/issues/3056

elfisher avatar Dec 09 '22 17:12 elfisher

@elfisher I agree with the idea but undertaking something like that will set back the deangularization project significantly since we now will not only have to worry about deangularizing it, but also making sure that such a combined experience does not break existing functionality. And it may also be a breaking change. Since we have set expectations to deangularize in the first half of Q1 for security reasons, cant we combine the experiences after the deangiularization?

ashwin-pc avatar Dec 09 '22 20:12 ashwin-pc

We decide to replace Discover. So we don't need to do de-angular work for discover. Close it now.

ananzh avatar Apr 11 '23 21:04 ananzh