Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.7][Maps]Remove dark mode and default to kuery #30007

Merged
merged 2 commits into from
Feb 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions x-pack/plugins/maps/public/angular/get_initial_query.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
* you may not use this file except in compliance with the Elastic License.
*/

import chrome from 'ui/chrome';

const settings = chrome.getUiSettingsClient();

export function getInitialQuery({
mapStateJSON,
appState = {},
Expand All @@ -27,6 +23,6 @@ export function getInitialQuery({

return {
query: '',
language: userQueryLanguage || settings.get('search:queryLanguage')
language: userQueryLanguage || 'kuery'
};
}
37 changes: 0 additions & 37 deletions x-pack/plugins/maps/public/angular/map_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import React from 'react';
import { I18nContext } from 'ui/i18n';
import { render, unmountComponentAtNode } from 'react-dom';
import { uiModules } from 'ui/modules';
import { applyTheme } from 'ui/theme';
import { timefilter } from 'ui/timefilter';
import { Provider } from 'react-redux';
import { getStore } from '../store/store';
Expand All @@ -22,7 +21,6 @@ import {
setQuery,
} from '../actions/store_actions';
import {
getIsDarkTheme,
enableFullScreen,
getIsFullScreen,
updateFlyout,
Expand All @@ -33,7 +31,6 @@ import { Inspector } from 'ui/inspector';
import { inspectorAdapters, indexPatternService } from '../kibana_services';
import { SavedObjectSaveModal } from 'ui/saved_objects/components/saved_object_save_modal';
import { showSaveModal } from 'ui/saved_objects/show_saved_object_save_modal';
import { showOptionsPopover } from '../components/top_nav/show_options_popover';
import { toastNotifications } from 'ui/notify';
import { getInitialLayers } from './get_initial_layers';
import { getInitialQuery } from './get_initial_query';
Expand All @@ -48,7 +45,6 @@ const app = uiModules.get('app/maps', []);
app.controller('GisMapController', ($scope, $route, config, kbnUrl, localStorage, AppState, globalState) => {

const savedMap = $scope.map = $route.current.locals.map;
let isDarkTheme;
let unsubscribe;

inspectorAdapters.requests.reset();
Expand Down Expand Up @@ -177,14 +173,6 @@ app.controller('GisMapController', ($scope, $route, config, kbnUrl, localStorage

$scope.isFullScreen = false;
function handleStoreChanges(store) {
const state = store.getState();

// theme changes must triggered in digest cycle because top nav is still angular
if (isDarkTheme !== getIsDarkTheme(state)) {
isDarkTheme = getIsDarkTheme(state);
updateTheme();
}

const nextIsFullScreen = getIsFullScreen(store.getState());
if (nextIsFullScreen !== $scope.isFullScreen) {
// Must trigger digest cycle for angular top nav to redraw itself when isFullScreen changes
Expand Down Expand Up @@ -269,13 +257,6 @@ app.controller('GisMapController', ($scope, $route, config, kbnUrl, localStorage
run() {
Inspector.open(inspectorAdapters, {});
}
}, {
key: 'options',
description: 'Options',
testId: 'optionsButton',
run: async (menuItem, navController, anchorElement) => {
showOptionsPopover(anchorElement);
}
}, {
key: 'save',
description: 'Save map',
Expand Down Expand Up @@ -310,22 +291,4 @@ app.controller('GisMapController', ($scope, $route, config, kbnUrl, localStorage
showSaveModal(saveModal);
}
}];

function updateTheme() {
$scope.$evalAsync(() => {
isDarkTheme ? setDarkTheme() : setLightTheme();
});
}

function setDarkTheme() {
chrome.removeApplicationClass(['theme-light']);
chrome.addApplicationClass('theme-dark');
applyTheme('dark');
}

function setLightTheme() {
chrome.removeApplicationClass(['theme-dark']);
chrome.addApplicationClass('theme-light');
applyTheme('light');
}
});
5 changes: 1 addition & 4 deletions x-pack/plugins/maps/public/angular/services/saved_gis_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
getRefreshConfig,
getQuery,
} from '../../selectors/map_selectors';
import { getIsDarkTheme } from '../../store/ui';
import { convertMapExtentToPolygon } from '../../elasticsearch_geo_utils';

const module = uiModules.get('app/maps');
Expand Down Expand Up @@ -84,9 +83,7 @@ module.factory('SavedGisMap', function (Private) {
query: _.omit(getQuery(state), 'queryLastTriggeredAt'),
});

this.uiStateJSON = JSON.stringify({
isDarkMode: getIsDarkTheme(state),
});
this.uiStateJSON = JSON.stringify({});

this.bounds = convertMapExtentToPolygon(getMapExtent(state));
};
Expand Down
40 changes: 0 additions & 40 deletions x-pack/plugins/maps/public/components/top_nav/options_menu.js

This file was deleted.

This file was deleted.

This file was deleted.

11 changes: 0 additions & 11 deletions x-pack/plugins/maps/public/store/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { RESET_LAYER_LOAD } from '../actions/ui_actions';
export const UPDATE_FLYOUT = 'UPDATE_FLYOUT';
export const CLOSE_SET_VIEW = 'CLOSE_SET_VIEW';
export const OPEN_SET_VIEW = 'OPEN_SET_VIEW';
export const UPDATE_IS_DARK_THEME = 'UPDATE_IS_DARK_THEME';
export const SET_FULL_SCREEN = 'SET_FULL_SCREEN';
export const FLYOUT_STATE = {
NONE: 'NONE',
Expand All @@ -26,7 +25,6 @@ export const LAYER_LOAD_STATE = {

const INITIAL_STATE = {
flyoutDisplay: FLYOUT_STATE.NONE,
isDarkTheme: false,
layerLoad: {
status: LAYER_LOAD_STATE.inactive,
time: Date()
Expand All @@ -48,8 +46,6 @@ function ui(state = INITIAL_STATE, action) {
time: Date() } };
case UPDATE_FLYOUT:
return { ...state, flyoutDisplay: action.display };
case UPDATE_IS_DARK_THEME:
return { ...state, isDarkTheme: action.isDarkTheme };
case CLOSE_SET_VIEW:
return { ...state, isSetViewOpen: false };
case OPEN_SET_VIEW:
Expand Down Expand Up @@ -78,12 +74,6 @@ export function openSetView() {
type: OPEN_SET_VIEW,
};
}
export function updateIsDarkTheme(isDarkTheme) {
return {
type: UPDATE_IS_DARK_THEME,
isDarkTheme
};
}
export function exitFullScreen() {
return {
type: SET_FULL_SCREEN,
Expand All @@ -100,7 +90,6 @@ export function enableFullScreen() {
// Selectors
export const getFlyoutDisplay = ({ ui }) => ui && ui.flyoutDisplay
|| INITIAL_STATE.flyoutDisplay;
export const getIsDarkTheme = ({ ui }) => _.get(ui, 'isDarkTheme', INITIAL_STATE.isDarkTheme);
export const getIsSetViewOpen = ({ ui }) => _.get(ui, 'isSetViewOpen', false);
export const getIsFullScreen = ({ ui }) => _.get(ui, 'isFullScreen', false);

Expand Down