Skip to content

Commit

Permalink
#7086: remove unnecessary warning messages (#7128) (#7156)
Browse files Browse the repository at this point in the history
Co-authored-by: ashraf-alsamman <[email protected]>
  • Loading branch information
offtherailz and ashraf-alsamman authored Jul 27, 2021
1 parent f2de41b commit a6712bd
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 51 deletions.
36 changes: 0 additions & 36 deletions web/client/actions/__tests__/map-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import {
MOUSE_MOVE,
MOUSE_OUT,
zoomToPoint,
errorLoadingFont,
changeMapView,
clickOnMap,
changeMousePointer,
Expand All @@ -52,7 +51,6 @@ import {
MAP_PLUGIN_LOAD
} from '../map';

import { SHOW_NOTIFICATION } from '../notifications';

describe('Test correctness of the map actions', () => {

Expand Down Expand Up @@ -92,40 +90,6 @@ describe('Test correctness of the map actions', () => {
expect(retval.point).toBe(testVal);
});

it('test errorLoadingFont', () => {
const err = {family: "FontAwesome"};
let {type, values, title, message, autoDismiss, position } = errorLoadingFont(err);

expect(type).toBe(SHOW_NOTIFICATION);
expect(values).toExist();
expect(values.family).toExist();
expect(title).toExist();
expect(message).toExist();
expect(position).toExist();
expect(autoDismiss).toExist();
expect(values.family).toBe("FontAwesome");
expect(title).toBe("warning");
expect(message).toBe("map.errorLoadingFont");
expect(position).toBe("tc");
expect(autoDismiss).toBe(10);
});

it('test errorLoadingFont default', () => {
let {type, values, title, message, autoDismiss, position } = errorLoadingFont();

expect(type).toBe(SHOW_NOTIFICATION);
expect(values).toExist();
expect(title).toExist();
expect(message).toExist();
expect(position).toExist();
expect(autoDismiss).toExist();
expect(values.family).toBe("");
expect(title).toBe("warning");
expect(message).toBe("map.errorLoadingFont");
expect(position).toBe("tc");
expect(autoDismiss).toBe(10);

});

it('set a new mouse pointer', () => {
const testVal = 'pointer';
Expand Down
10 changes: 0 additions & 10 deletions web/client/actions/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* LICENSE file in the root directory of this source tree.
*/

import { error } from './notifications';

export const CHANGE_MAP_VIEW = 'CHANGE_MAP_VIEW';
export const CLICK_ON_MAP = 'CLICK_ON_MAP';
Expand All @@ -31,15 +30,6 @@ export const MOUSE_MOVE = 'MOUSE_MOVE';
export const MOUSE_OUT = 'MOUSE_OUT';
export const MAP_PLUGIN_LOAD = 'MAP:MAP_PLUGIN_LOAD';

export function errorLoadingFont(err = {family: ""}) {
return error({
title: "warning",
message: "map.errorLoadingFont",
values: err,
position: "tc",
autoDismiss: 10
});
}

/**
* Event triggered when loading a different map type plugins (code for the specific implementation)
Expand Down
7 changes: 2 additions & 5 deletions web/client/plugins/Map.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Spinner from 'react-spinkit';
import './map/css/map.css';
import Message from '../components/I18N/Message';
import ConfigUtils from '../utils/ConfigUtils';
import { errorLoadingFont, setMapResolutions, mapPluginLoad } from '../actions/map';
import { setMapResolutions, mapPluginLoad } from '../actions/map';
import { isString } from 'lodash';
import selector from './map/selector';
import mapReducer from "../reducers/map";
Expand Down Expand Up @@ -202,7 +202,6 @@ class MapPlugin extends React.Component {
mapOptions: PropTypes.object,
projectionDefs: PropTypes.array,
toolsOptions: PropTypes.object,
onFontError: PropTypes.func,
onResolutionsChange: PropTypes.func,
actions: PropTypes.object,
features: PropTypes.array,
Expand Down Expand Up @@ -250,7 +249,6 @@ class MapPlugin extends React.Component {
additionalLayers: [],
shouldLoadFont: false,
elevationEnabled: false,
onFontError: () => {},
onResolutionsChange: () => {},
items: [],
onLoadingMapPlugins: () => {},
Expand All @@ -272,7 +270,7 @@ class MapPlugin extends React.Component {
loadFont(f, {
timeoutAfter: 5000 // 5 seconds in milliseconds
}).catch(() => {
this.props.onFontError({family: f});
console.warn("Fonts loading check for map style responded slowly or with an error. Fonts in map may not be rendered correctly. This is not necessarily an issue.", error); // eslint-disable-line
}
))
).then(() => {
Expand Down Expand Up @@ -446,7 +444,6 @@ class MapPlugin extends React.Component {

export default createPlugin('Map', {
component: connect(selector, {
onFontError: errorLoadingFont,
onResolutionsChange: setMapResolutions,
onMapTypeLoaded: mapPluginLoad
})(withScalesDenominators(MapPlugin)),
Expand Down

0 comments on commit a6712bd

Please sign in to comment.