Skip to content

Commit 4fe9d22

Browse files
Merge branch 'master' into implement/ftr-configured-users
2 parents 0fcf2fd + e25430b commit 4fe9d22

File tree

127 files changed

+2706
-3256
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+2706
-3256
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@
314314
"@types/cheerio": "^0.22.10",
315315
"@types/chromedriver": "^2.38.0",
316316
"@types/classnames": "^2.2.9",
317+
"@types/color": "^3.0.0",
317318
"@types/d3": "^3.5.43",
318319
"@types/dedent": "^0.7.0",
319320
"@types/deep-freeze-strict": "^1.1.0",

src/legacy/core_plugins/kibana/public/dashboard/legacy_imports.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export { npSetup, npStart } from 'ui/new_platform';
2828

2929
export { KbnUrl } from 'ui/url/kbn_url';
3030
// @ts-ignore
31-
export { KbnUrlProvider, RedirectWhenMissingProvider } from 'ui/url/index';
31+
export { KbnUrlProvider } from 'ui/url/index';
3232
export { IInjector } from 'ui/chrome';
3333
export { absoluteToParsedUrl } from 'ui/url/absolute_to_parsed_url';
3434
export {

src/legacy/core_plugins/kibana/public/dashboard/np_ready/application.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import {
3535
KbnUrlProvider,
3636
PrivateProvider,
3737
PromiseServiceCreator,
38-
RedirectWhenMissingProvider,
3938
} from '../legacy_imports';
4039
// @ts-ignore
4140
import { initDashboardApp } from './legacy_app';
@@ -146,8 +145,7 @@ function createLocalIconModule() {
146145
function createLocalKbnUrlModule() {
147146
angular
148147
.module('app/dashboard/KbnUrl', ['app/dashboard/Private', 'ngRoute'])
149-
.service('kbnUrl', (Private: IPrivate) => Private(KbnUrlProvider))
150-
.service('redirectWhenMissing', (Private: IPrivate) => Private(RedirectWhenMissingProvider));
148+
.service('kbnUrl', (Private: IPrivate) => Private(KbnUrlProvider));
151149
}
152150

153151
function createLocalConfigModule(core: AppMountContext['core']) {

src/legacy/core_plugins/kibana/public/dashboard/np_ready/legacy_app.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { initDashboardAppDirective } from './dashboard_app';
2828
import { createDashboardEditUrl, DashboardConstants } from './dashboard_constants';
2929
import {
3030
createKbnUrlStateStorage,
31+
redirectWhenMissing,
3132
InvalidJSONProperty,
3233
SavedObjectNotFound,
3334
} from '../../../../../../plugins/kibana_utils/public';
@@ -136,7 +137,7 @@ export function initDashboardApp(app, deps) {
136137
});
137138
},
138139
resolve: {
139-
dash: function($rootScope, $route, redirectWhenMissing, kbnUrl, history) {
140+
dash: function($rootScope, $route, kbnUrl, history) {
140141
return ensureDefaultIndexPattern(deps.core, deps.data, $rootScope, kbnUrl).then(() => {
141142
const savedObjectsClient = deps.savedObjectsClient;
142143
const title = $route.current.params.title;
@@ -171,14 +172,18 @@ export function initDashboardApp(app, deps) {
171172
controller: createNewDashboardCtrl,
172173
requireUICapability: 'dashboard.createNew',
173174
resolve: {
174-
dash: function(redirectWhenMissing, $rootScope, kbnUrl) {
175+
dash: function($rootScope, kbnUrl, history) {
175176
return ensureDefaultIndexPattern(deps.core, deps.data, $rootScope, kbnUrl)
176177
.then(() => {
177178
return deps.savedDashboards.get();
178179
})
179180
.catch(
180181
redirectWhenMissing({
181-
dashboard: DashboardConstants.LANDING_PAGE_PATH,
182+
history,
183+
mapping: {
184+
dashboard: DashboardConstants.LANDING_PAGE_PATH,
185+
},
186+
toastNotifications: deps.core.notifications.toasts,
182187
})
183188
);
184189
},
@@ -189,7 +194,7 @@ export function initDashboardApp(app, deps) {
189194
template: dashboardTemplate,
190195
controller: createNewDashboardCtrl,
191196
resolve: {
192-
dash: function($rootScope, $route, redirectWhenMissing, kbnUrl, history) {
197+
dash: function($rootScope, $route, kbnUrl, history) {
193198
const id = $route.current.params.id;
194199

195200
return ensureDefaultIndexPattern(deps.core, deps.data, $rootScope, kbnUrl)
@@ -207,7 +212,7 @@ export function initDashboardApp(app, deps) {
207212
.catch(error => {
208213
// A corrupt dashboard was detected (e.g. with invalid JSON properties)
209214
if (error instanceof InvalidJSONProperty) {
210-
deps.toastNotifications.addDanger(error.message);
215+
deps.core.notifications.toasts.addDanger(error.message);
211216
kbnUrl.redirect(DashboardConstants.LANDING_PAGE_PATH);
212217
return;
213218
}
@@ -221,7 +226,7 @@ export function initDashboardApp(app, deps) {
221226
pathname: DashboardConstants.CREATE_NEW_DASHBOARD_URL,
222227
});
223228

224-
deps.toastNotifications.addWarning(
229+
deps.core.notifications.toasts.addWarning(
225230
i18n.translate('kbn.dashboard.urlWasRemovedInSixZeroWarningMessage', {
226231
defaultMessage:
227232
'The url "dashboard/create" was removed in 6.0. Please update your bookmarks.',
@@ -234,7 +239,11 @@ export function initDashboardApp(app, deps) {
234239
})
235240
.catch(
236241
redirectWhenMissing({
237-
dashboard: DashboardConstants.LANDING_PAGE_PATH,
242+
history,
243+
mapping: {
244+
dashboard: DashboardConstants.LANDING_PAGE_PATH,
245+
},
246+
toastNotifications: deps.core.notifications.toasts,
238247
})
239248
);
240249
},

src/legacy/core_plugins/kibana/public/discover/build_services.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
* specific language governing permissions and limitations
1717
* under the License.
1818
*/
19+
import { createHashHistory, History } from 'history';
20+
1921
import {
2022
Capabilities,
2123
ChromeStart,
@@ -46,6 +48,7 @@ export interface DiscoverServices {
4648
data: DataPublicPluginStart;
4749
docLinks: DocLinksStart;
4850
docViewsRegistry: DocViewsRegistry;
51+
history: History;
4952
theme: ChartsPluginStart['theme'];
5053
filterManager: FilterManager;
5154
indexPatterns: IndexPatternsContract;
@@ -79,6 +82,7 @@ export async function buildServices(
7982
data: plugins.data,
8083
docLinks: core.docLinks,
8184
docViewsRegistry,
85+
history: createHashHistory(),
8286
theme: plugins.charts.theme,
8387
filterManager: plugins.data.query.filterManager,
8488
getSavedSearchById: async (id: string) => savedObjectService.get(id),

src/legacy/core_plugins/kibana/public/discover/get_inner_angular.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { CoreStart, LegacyCoreStart, IUiSettingsClient } from 'kibana/public';
2727
// @ts-ignore
2828
import { StateManagementConfigProvider } from 'ui/state_management/config_provider';
2929
// @ts-ignore
30-
import { KbnUrlProvider, RedirectWhenMissingProvider } from 'ui/url';
30+
import { KbnUrlProvider } from 'ui/url';
3131
import { DataPublicPluginStart } from '../../../../../plugins/data/public';
3232
import { Storage } from '../../../../../plugins/kibana_utils/public';
3333
import { NavigationPublicPluginStart as NavigationStart } from '../../../../../plugins/navigation/public';
@@ -173,8 +173,7 @@ export function initializeInnerAngularModule(
173173
function createLocalKbnUrlModule() {
174174
angular
175175
.module('discoverKbnUrl', ['discoverPrivate', 'ngRoute'])
176-
.service('kbnUrl', (Private: IPrivate) => Private(KbnUrlProvider))
177-
.service('redirectWhenMissing', (Private: IPrivate) => Private(RedirectWhenMissingProvider));
176+
.service('kbnUrl', (Private: IPrivate) => Private(KbnUrlProvider));
178177
}
179178

180179
function createLocalConfigModule(uiSettings: IUiSettingsClient) {

src/legacy/core_plugins/kibana/public/discover/kibana_services.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export { intervalOptions } from 'ui/agg_types';
5959
export { subscribeWithScope } from '../../../../../plugins/kibana_legacy/public';
6060
// @ts-ignore
6161
export { timezoneProvider } from 'ui/vis/lib/timezone';
62-
export { unhashUrl } from '../../../../../plugins/kibana_utils/public';
62+
export { unhashUrl, redirectWhenMissing } from '../../../../../plugins/kibana_utils/public';
6363
export {
6464
ensureDefaultIndexPattern,
6565
formatMsg,

src/legacy/core_plugins/kibana/public/discover/np_ready/angular/discover.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,15 @@ import {
5050
tabifyAggResponse,
5151
getAngularModule,
5252
ensureDefaultIndexPattern,
53+
redirectWhenMissing,
5354
} from '../../kibana_services';
5455

5556
const {
5657
core,
5758
chrome,
5859
data,
5960
docTitle,
61+
history,
6062
indexPatterns,
6163
filterManager,
6264
share,
@@ -113,10 +115,10 @@ app.config($routeProvider => {
113115
template: indexTemplate,
114116
reloadOnSearch: false,
115117
resolve: {
116-
savedObjects: function(redirectWhenMissing, $route, kbnUrl, Promise, $rootScope) {
118+
savedObjects: function($route, kbnUrl, Promise, $rootScope) {
117119
const savedSearchId = $route.current.params.id;
118120
return ensureDefaultIndexPattern(core, data, $rootScope, kbnUrl).then(() => {
119-
const { appStateContainer } = getState({});
121+
const { appStateContainer } = getState({ history });
120122
const { index } = appStateContainer.getState();
121123
return Promise.props({
122124
ip: indexPatterns.getCache().then(indexPatternList => {
@@ -151,9 +153,13 @@ app.config($routeProvider => {
151153
})
152154
.catch(
153155
redirectWhenMissing({
154-
search: '/discover',
155-
'index-pattern':
156-
'/management/kibana/objects/savedSearches/' + $route.current.params.id,
156+
history,
157+
mapping: {
158+
search: '/discover',
159+
'index-pattern':
160+
'/management/kibana/objects/savedSearches/' + $route.current.params.id,
161+
},
162+
toastNotifications,
157163
})
158164
),
159165
});
@@ -207,6 +213,7 @@ function discoverController(
207213
} = getState({
208214
defaultAppState: getStateDefaults(),
209215
storeInSessionStorage: config.get('state:storeInSessionStorage'),
216+
history,
210217
});
211218
if (appStateContainer.getState().index !== $scope.indexPattern.id) {
212219
//used index pattern is different than the given by url/state which is invalid

src/legacy/core_plugins/kibana/public/discover/np_ready/angular/discover_state.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ describe('Test discover state', () => {
3030
history.push('/');
3131
state = getState({
3232
defaultAppState: { index: 'test' },
33-
hashHistory: history,
33+
history,
3434
});
3535
await state.replaceUrlAppState({});
3636
await state.startSync();

src/legacy/core_plugins/kibana/public/discover/np_ready/angular/discover_state.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* under the License.
1818
*/
1919
import { isEqual } from 'lodash';
20-
import { createHashHistory, History } from 'history';
20+
import { History } from 'history';
2121
import {
2222
createStateContainer,
2323
createKbnUrlStateStorage,
@@ -65,9 +65,9 @@ interface GetStateParams {
6565
*/
6666
storeInSessionStorage?: boolean;
6767
/**
68-
* Browser history used for testing
68+
* Browser history
6969
*/
70-
hashHistory?: History;
70+
history: History;
7171
}
7272

7373
export interface GetStateReturn {
@@ -121,11 +121,11 @@ const APP_STATE_URL_KEY = '_a';
121121
export function getState({
122122
defaultAppState = {},
123123
storeInSessionStorage = false,
124-
hashHistory,
124+
history,
125125
}: GetStateParams): GetStateReturn {
126126
const stateStorage = createKbnUrlStateStorage({
127127
useHash: storeInSessionStorage,
128-
history: hashHistory ? hashHistory : createHashHistory(),
128+
history,
129129
});
130130

131131
const appStateFromUrl = stateStorage.get(APP_STATE_URL_KEY) as AppState;

0 commit comments

Comments
 (0)