Skip to content

Commit

Permalink
Remove ui/persisted_logs - Part 1 (#47225) (#47252)
Browse files Browse the repository at this point in the history
* Use npStart.core.chrome.recentlyAccessed and delete directive

* use recently accessed in ML

* re-update snapshots
  • Loading branch information
Liza Katz authored Oct 3, 2019
1 parent 9ec4e89 commit 60314da
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 49 deletions.
5 changes: 3 additions & 2 deletions src/legacy/core_plugins/kibana/public/dashboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ import { DashboardConstants, createDashboardEditUrl } from './dashboard_constant
import { InvalidJSONProperty, SavedObjectNotFound } from '../../../../../plugins/kibana_utils/public';
import { FeatureCatalogueRegistryProvider, FeatureCatalogueCategory } from 'ui/registry/feature_catalogue';
import { SavedObjectsClientProvider } from 'ui/saved_objects';
import { recentlyAccessed } from 'ui/persisted_log';
import { SavedObjectRegistryProvider } from 'ui/saved_objects/saved_object_registry';
import { DashboardListing, EMPTY_FILTER } from './listing/dashboard_listing';
import { uiModules } from 'ui/modules';
import 'ui/capabilities/route_setup';

import { npStart } from 'ui/new_platform';

// load directives
import '../../../data/public';

Expand Down Expand Up @@ -156,7 +157,7 @@ uiRoutes

return savedDashboards.get(id)
.then((savedDashboard) => {
recentlyAccessed.add(savedDashboard.getFullPath(), savedDashboard.title, id);
npStart.core.chrome.recentlyAccessed.add(savedDashboard.getFullPath(), savedDashboard.title, id);
return savedDashboard;
})
.catch((error) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import { StateProvider } from 'ui/state_management/state';
import { migrateLegacyQuery } from 'ui/utils/migrate_legacy_query';
import { subscribeWithScope } from 'ui/utils/subscribe_with_scope';
import { getFilterGenerator } from 'ui/filter_manager';
import { recentlyAccessed } from 'ui/persisted_log';

import { getDocLink } from 'ui/documentation_links';
import '../components/fetch_error';
import { getPainlessError } from './get_painless_error';
Expand All @@ -72,6 +72,7 @@ import { buildVislibDimensions } from 'ui/visualize/loader/pipeline_helpers/buil
import 'ui/capabilities/route_setup';

import { setup as data } from '../../../../../core_plugins/data/public/legacy';
import { npStart } from 'ui/new_platform';

const { savedQueryService } = data.search.services;

Expand Down Expand Up @@ -149,7 +150,7 @@ uiRoutes
return savedSearches.get(savedSearchId)
.then((savedSearch) => {
if (savedSearchId) {
recentlyAccessed.add(
npStart.core.chrome.recentlyAccessed.add(
savedSearch.getFullPath(),
savedSearch.title,
savedSearchId);
Expand Down
4 changes: 2 additions & 2 deletions src/legacy/core_plugins/kibana/public/home/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import { uiModules } from 'ui/modules';
import {
HomeApp
} from './components/home_app';
import { recentlyAccessed } from 'ui/persisted_log';
import { i18n } from '@kbn/i18n';
import { npStart } from 'ui/new_platform';

const app = uiModules.get('apps/home', []);
app.directive('homeApp', function (reactDirective) {
Expand All @@ -41,7 +41,7 @@ function getRoute() {
template,
controller($scope, Private) {
$scope.directories = Private(FeatureCatalogueRegistryProvider).inTitleOrder;
$scope.recentlyAccessed = recentlyAccessed.get().map(item => {
$scope.recentlyAccessed = npStart.core.chrome.recentlyAccessed.get().map(item => {
item.link = chrome.addBasePath(item.link);
return item;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ import { KibanaParsedUrl } from 'ui/url/kibana_parsed_url';
import { absoluteToParsedUrl } from 'ui/url/absolute_to_parsed_url';
import { migrateLegacyQuery } from 'ui/utils/migrate_legacy_query';
import { subscribeWithScope } from 'ui/utils/subscribe_with_scope';
import { recentlyAccessed } from 'ui/persisted_log';
import { timefilter } from 'ui/timefilter';
import { getVisualizeLoader } from '../../../../../ui/public/visualize/loader';
import { showShareContextMenu, ShareContextMenuExtensionsRegistryProvider } from 'ui/share';
Expand Down Expand Up @@ -98,7 +97,7 @@ uiRoutes
savedVis: function (savedVisualizations, redirectWhenMissing, $route) {
return savedVisualizations.get($route.current.params.id)
.then((savedVis) => {
recentlyAccessed.add(
npStart.core.chrome.recentlyAccessed.add(
savedVis.getFullPath(),
savedVis.title,
savedVis.id);
Expand Down
4 changes: 2 additions & 2 deletions src/legacy/core_plugins/timelion/public/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import { docTitle } from 'ui/doc_title';
import { SavedObjectRegistryProvider } from 'ui/saved_objects/saved_object_registry';
import { fatalError, toastNotifications } from 'ui/notify';
import { timezoneProvider } from 'ui/vis/lib/timezone';
import { recentlyAccessed } from 'ui/persisted_log';
import { timefilter } from 'ui/timefilter';
import { npStart } from 'ui/new_platform';
import { getSavedSheetBreadcrumbs, getCreateBreadcrumbs } from './breadcrumbs';

// import the uiExports that we want to "use"
Expand Down Expand Up @@ -97,7 +97,7 @@ require('ui/routes')
return savedSheets.get($route.current.params.id)
.then((savedSheet) => {
if ($route.current.params.id) {
recentlyAccessed.add(
npStart.core.chrome.recentlyAccessed.add(
savedSheet.getFullPath(),
savedSheet.title,
savedSheet.id);
Expand Down
26 changes: 0 additions & 26 deletions src/legacy/ui/public/persisted_log/directive.js

This file was deleted.

3 changes: 0 additions & 3 deletions src/legacy/ui/public/persisted_log/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,5 @@
* under the License.
*/

// @ts-ignore
import './directive';

export { PersistedLog } from './persisted_log';
export { recentlyAccessed } from './recently_accessed';
4 changes: 2 additions & 2 deletions src/legacy/ui/public/saved_objects/saved_object.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import { SearchSourceProvider } from '../courier/search_source';
import { findObjectByTitle } from './find_object_by_title';
import { SavedObjectsClientProvider } from './saved_objects_client_provider';
import { migrateLegacyQuery } from '../utils/migrate_legacy_query';
import { recentlyAccessed } from '../persisted_log';
import { npStart } from 'ui/new_platform';
import { i18n } from '@kbn/i18n';

/**
Expand Down Expand Up @@ -512,7 +512,7 @@ export function SavedObjectProvider(Promise, Private, confirmModalPromise, index
})
.then(() => {
if (this.showInRecentlyAccessed && this.getFullPath) {
recentlyAccessed.add(this.getFullPath(), this.title, this.id);
npStart.core.chrome.recentlyAccessed.add(this.getFullPath(), this.title, this.id);
}
this.isSaving = false;
this.lastSavedTitle = this.title;
Expand Down
14 changes: 11 additions & 3 deletions x-pack/legacy/plugins/canvas/public/state/reducers/workpad.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { handleActions } from 'redux-actions';
import { recentlyAccessed } from 'ui/persisted_log';
import { npStart } from 'ui/new_platform';
import { getDefaultWorkpad } from '../defaults';
import {
setWorkpad,
Expand All @@ -22,7 +22,11 @@ import { APP_ROUTE_WORKPAD } from '../../../common/lib/constants';
export const workpadReducer = handleActions(
{
[setWorkpad]: (workpadState, { payload }) => {
recentlyAccessed.add(`${APP_ROUTE_WORKPAD}/${payload.id}`, payload.name, payload.id);
npStart.core.chrome.recentlyAccessed.add(
`${APP_ROUTE_WORKPAD}/${payload.id}`,
payload.name,
payload.id
);
return payload;
},

Expand All @@ -35,7 +39,11 @@ export const workpadReducer = handleActions(
},

[setName]: (workpadState, { payload }) => {
recentlyAccessed.add(`${APP_ROUTE_WORKPAD}/${workpadState.id}`, payload, workpadState.id);
npStart.core.chrome.recentlyAccessed.add(
`${APP_ROUTE_WORKPAD}/${workpadState.id}`,
payload,
workpadState.id
);
return { ...workpadState, name: payload };
},

Expand Down
4 changes: 2 additions & 2 deletions x-pack/legacy/plugins/maps/public/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import './angular/map_controller';
import listingTemplate from './angular/listing_ng_wrapper.html';
import mapTemplate from './angular/map.html';
import { MapListing } from './components/map_listing';
import { recentlyAccessed } from 'ui/persisted_log';
import { npStart } from 'ui/new_platform';

const app = uiModules.get('app/maps', ['ngRoute', 'react']);

Expand Down Expand Up @@ -105,7 +105,7 @@ routes
const id = $route.current.params.id;
return gisMapSavedObjectLoader.get(id)
.then((savedMap) => {
recentlyAccessed.add(savedMap.getFullPath(), savedMap.title, id);
npStart.core.chrome.recentlyAccessed.add(savedMap.getFullPath(), savedMap.title, id);
docTitle.change(savedMap.title);
return savedMap;
})
Expand Down
1 change: 0 additions & 1 deletion x-pack/legacy/plugins/ml/public/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import 'uiExports/savedObjectTypes';

import 'ui/courier';
import 'ui/angular-bootstrap';
import 'ui/persisted_log';
import 'ui/autoload/all';
import 'ui/kbn_top_nav';

Expand Down
4 changes: 2 additions & 2 deletions x-pack/legacy/plugins/ml/public/util/recently_accessed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

// utility functions for managing which links get added to kibana's recently accessed list

import { recentlyAccessed } from 'ui/persisted_log';
import { npStart } from 'ui/new_platform';
import { i18n } from '@kbn/i18n';

export function addItemToRecentlyAccessed(page: string, itemId: string, url: string) {
Expand Down Expand Up @@ -38,5 +38,5 @@ export function addItemToRecentlyAccessed(page: string, itemId: string, url: str

url = `ml#/${page}/${url}`;

recentlyAccessed.add(url, `ML - ${itemId} - ${pageLabel}`, id);
npStart.core.chrome.recentlyAccessed.add(url, `ML - ${itemId} - ${pageLabel}`, id);
}

0 comments on commit 60314da

Please sign in to comment.