Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/2.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Nov 22, 2018
2 parents 3c65477 + 0ca6a05 commit 7d8b4f2
Show file tree
Hide file tree
Showing 10 changed files with 160 additions and 150 deletions.
212 changes: 101 additions & 111 deletions buildtools/webpack.commons.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const path = require('path');
const webpack = require('webpack');
const SassPlugin = require('./webpack.plugin.js');
const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');

const devMode = process.env.NODE_ENV !== 'production';

Expand All @@ -23,38 +24,6 @@ const babelPresets = [['@babel/preset-env', {
'loose': true,
}]];

const ngeoRule = {
test: /\/ngeo\/(?!node_modules\/).*\.js$/,
use: {
loader: 'babel-loader',
options: {
babelrc: false,
comments: false,
cacheDirectory: true,
presets: babelPresets,
plugins: ['@camptocamp/babel-plugin-angularjs-annotate'],
}
}
};


const otherRule = {
test: /\/node_modules\/(?!ngeo\/|angular\/).*\.js$/,
use: {
loader: 'babel-loader',
options: {
babelrc: false,
comments: false,
cacheDirectory: true,
presets: babelPresets,
plugins: [
'@babel/plugin-syntax-object-rest-spread',
'@babel/plugin-transform-spread',
]
}
}
};

const angularRule = {
test: require.resolve('angular'),
use: {
Expand Down Expand Up @@ -93,90 +62,111 @@ const htmlRule = {
use: 'ejs-loader',
};

const svgRule = {
test: /\.svg$/,
use: [
{
loader: 'svg-inline-loader',
options: {
removeSVGTagAttrs: false,
},
},
'./buildtools/svg-viewbox-loader',
'svgo-loader',
]
};
const config = function(hardSourceConfig, babelLoaderCacheDirectory) {

const ngeoRule = {
test: /\/ngeo\/(?!node_modules\/).*\.js$/,
use: {
loader: 'babel-loader',
options: {
babelrc: false,
comments: false,
cacheDirectory: babelLoaderCacheDirectory,
presets: babelPresets,
plugins: ['@camptocamp/babel-plugin-angularjs-annotate'],
}
}
};
const otherRule = {
test: /\/node_modules\/(?!ngeo\/|angular\/).*\.js$/,
use: {
loader: 'babel-loader',
options: {
babelrc: false,
comments: false,
cacheDirectory: babelLoaderCacheDirectory,
presets: babelPresets,
plugins: [
'@babel/plugin-syntax-object-rest-spread',
'@babel/plugin-transform-spread',
]
}
}
};

const config = {
context: path.resolve(__dirname, '../'),
devtool: 'source-map',
output: {
path: path.resolve(__dirname, '../dist/')
},
module: {
rules: [
angularRule,
typeaheadRule,
cssRule,
sassRule,
htmlRule,
svgRule,
ngeoRule,
otherRule,
]
},
plugins: [
providePlugin,
new SassPlugin({
filename: devMode ? '[name].css' : '[name].[hash:6].css',
assetname: '[name].[hash:6].[ext]',
//tempfile: '/tmp/t.scss',
blacklistedChunks: ['commons'],
filesOrder: (chunk, chunksFiles) => {
const files = chunksFiles.commons
? chunksFiles[chunk.name].concat(chunksFiles.commons)
: chunksFiles[chunk.name];
files.sort((f1, f2) => {
for (const reg of [
'/apps/',
'/controllers/',
'/vars.scss',
'/vars_only.scss',
'/common_dependencies.scss',
]) {
if (f1.indexOf(reg) >= 0) {
return -1;
}
if (f2.indexOf(reg) >= 0) {
return 1;
return {
context: path.resolve(__dirname, '../'),
devtool: 'source-map',
output: {
path: path.resolve(__dirname, '../dist/')
},
module: {
rules: [
angularRule,
typeaheadRule,
cssRule,
sassRule,
htmlRule,
svgRule,
ngeoRule,
otherRule,
]
},
plugins: [
providePlugin,
new SassPlugin({
filename: devMode ? '[name].css' : '[name].[hash:6].css',
assetname: '[name].[hash:6].[ext]',
//tempfile: '/tmp/t.scss',
blacklistedChunks: ['commons'],
filesOrder: (chunk, chunksFiles) => {
const files = chunksFiles.commons
? chunksFiles[chunk.name].concat(chunksFiles.commons)
: chunksFiles[chunk.name];
files.sort((f1, f2) => {
for (const reg of [
'/apps/',
'/controllers/',
'/vars.scss',
'/vars_only.scss',
'/common_dependencies.scss',
]) {
if (f1.indexOf(reg) >= 0) {
return -1;
}
if (f2.indexOf(reg) >= 0) {
return 1;
}
}
}
return 0;
});
return files;
}
}),
new webpack.IgnorePlugin(/^\.\/locale$/, /node_modules\/moment\/src\/lib\/locale$/),
],
resolve: {
modules: [
'../node_modules'
return 0;
});
return files;
}
}),
new webpack.IgnorePlugin(/^\.\/locale$/, /node_modules\/moment\/src\/lib\/locale$/),
new HardSourceWebpackPlugin(hardSourceConfig || {}),
],
mainFields: ['jsnext:main', 'main'],
alias: {
'ngeo/test': path.resolve(__dirname, '../test/spec'),
'gmf/test': path.resolve(__dirname, '../contribs/gmf/test/spec'),
'ngeo': path.resolve(__dirname, '../src'),
'gmf': path.resolve(__dirname, '../contribs/gmf/src'),
'goog/asserts': path.resolve(__dirname, '../src/goog.asserts.js'),
'goog/asserts.js': path.resolve(__dirname, '../src/goog.asserts.js'),
'jsts': 'jsts/org/locationtech/jts',
'olcs': 'ol-cesium/src/olcs',
'jquery-ui/datepicker': 'jquery-ui/ui/widgets/datepicker', // For angular-ui-date
'proj4': 'proj4/lib',
resolve: {
modules: [
'../node_modules'
],
mainFields: ['jsnext:main', 'main'],
alias: {
'ngeo/test': path.resolve(__dirname, '../test/spec'),
'gmf/test': path.resolve(__dirname, '../contribs/gmf/test/spec'),
'ngeo': path.resolve(__dirname, '../src'),
'gmf': path.resolve(__dirname, '../contribs/gmf/src'),
'goog/asserts': path.resolve(__dirname, '../src/goog.asserts.js'),
'goog/asserts.js': path.resolve(__dirname, '../src/goog.asserts.js'),
'jsts': 'jsts/org/locationtech/jts',
'ol/ol.css': 'openlayers/css/ol.css',
'ol': 'openlayers/src/ol',
'olcs': 'ol-cesium/src/olcs',
'jquery-ui/datepicker': 'jquery-ui/ui/widgets/datepicker', // For angular-ui-date
'proj4': 'proj4/lib',
}
}
}
};
};

module.exports = {
Expand Down
64 changes: 33 additions & 31 deletions buildtools/webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,37 @@ const resourcesRule = {
}
};

module.exports = {
mode: 'production',
output: {
filename: '[name].[chunkhash:6].js'
},
plugins: [
new webpack.optimize.ModuleConcatenationPlugin(),
],
module: {
rules: [
resourcesRule,
]
},
optimization: {
minimizer: [
new UglifyJsPlugin({
cache: true,
parallel: true,
sourceMap: true,
uglifyOptions: {
compress: false
}
})
]
},
resolve: {
alias: {
'goog/asserts': path.resolve(__dirname, '../src/goog.asserts.prod.js'),
'goog/asserts.js': path.resolve(__dirname, '../src/goog.asserts.prod.js'),
}
},
module.exports = function(UglifyJsPluginCache) {
return {
mode: 'production',
output: {
filename: '[name].[chunkhash:6].js'
},
plugins: [
new webpack.optimize.ModuleConcatenationPlugin(),
],
module: {
rules: [
resourcesRule,
]
},
optimization: {
minimizer: [
new UglifyJsPlugin({
cache: UglifyJsPluginCache,
parallel: true,
sourceMap: true,
uglifyOptions: {
compress: false
}
})
]
},
resolve: {
alias: {
'goog/asserts': path.resolve(__dirname, '../src/goog.asserts.prod.js'),
'goog/asserts.js': path.resolve(__dirname, '../src/goog.asserts.prod.js'),
}
},
};
};
4 changes: 2 additions & 2 deletions contribs/gmf/src/editing/editFeatureComponent.html
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ <h4 class="modal-title">
</ngeo-modal>
<ngeo-modal ng-model="efCtrl.showServerError">
<div class="modal-header">{{'Server error.' | translate}}</div>
<div class="modal-body">{{$parent.efCtrl.serverErrorType}}<br>
{{$parent.efCtrl.serverErrorMessage || ('Unexpected server error.' | translate)}}</div>
<div class="modal-body">{{efCtrl.serverErrorType}}<br>
{{efCtrl.serverErrorMessage || ('Unexpected server error.' | translate)}}</div>
</ngeo-modal>
</div>
2 changes: 0 additions & 2 deletions contribs/gmf/src/layertree/component.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@
class="gmf-layertree-layer-icon gmf-layertree-no-layer-icon"
><%=require('gmf/icons/dot.svg')%></a>

</a>

<a
href
ng-click="::gmfLayertreeCtrl.toggleActive(layertreeCtrl)"
Expand Down
5 changes: 4 additions & 1 deletion contribs/gmf/src/permalink/Permalink.js
Original file line number Diff line number Diff line change
Expand Up @@ -980,6 +980,9 @@ exports.prototype.initLayers_ = function() {
this.$timeout_(() => {
if (!this.gmfTreeManager_ || !this.gmfTreeManager_.rootCtrl) {
// we don't have any layertree
if (authenticationRequired && this.user_.role_id === null) {
this.rootScope_.$broadcast('authenticationrequired', {url: initialUri});
}
return;
}
// Enable the layers and set the opacity
Expand Down Expand Up @@ -1010,7 +1013,7 @@ exports.prototype.initLayers_ = function() {
exports.ParamPrefix.TREE_GROUP_LAYERS + treeCtrl.node.name
);
if (groupLayers !== undefined) {
const groupLayersArray = groupLayers.split(',');
const groupLayersArray = groupLayers == '' ? [] : groupLayers.split(',');
treeCtrl.traverseDepthFirst((treeCtrl) => {
if (treeCtrl.node.children === undefined) {
const enable = olArray.includes(groupLayersArray, treeCtrl.node.name);
Expand Down
1 change: 1 addition & 0 deletions contribs/gmf/src/print/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -924,6 +924,7 @@ exports.Controller_ = class {
server.imageType,
server.type
);
layer.setZIndex(-200);
} else {
console.error('Missing ogcServer:', server_name);
}
Expand Down
14 changes: 14 additions & 0 deletions contribs/gmf/src/profile/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,20 @@ exports.Controller_.prototype.getJsonProfile_ = function() {
exports.Controller_.prototype.getProfileDataSuccess_ = function(resp) {
const profileData = resp.data['profile'];
if (profileData instanceof Array) {
const nonempty_layers = [];
for (const d of profileData) {
for (const v in d['values']) {
if (nonempty_layers.indexOf(v) < 0 && d['values'][v] !== null) {
nonempty_layers.push(v);
}
}
}

this.profileOptions.linesConfiguration = {};
for (const layer of nonempty_layers) {
this.profileOptions.linesConfiguration[layer] = this.linesConfiguration_[layer];
}

this.profileData = profileData;
}
};
Expand Down
2 changes: 1 addition & 1 deletion karma-conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var isDebug = process.argv.some(function(argument) {

const webpackMerge = require('webpack-merge');
const commons = require('./buildtools/webpack.commons');
let webpackConfig = commons.config;
let webpackConfig = commons.config();
webpackConfig = webpackMerge(webpackConfig, require('./buildtools/webpack.dev'));
webpackConfig = webpackMerge(webpackConfig, {
devtool: 'inline-source-map',
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"serve-gmf-examples": "DEV_SERVER=1 TARGET=gmf-examples webpack-dev-server --https --cert=private.crt --key=private.key --port 3000 --mode development --progress --watch --bail --debug",
"serve-gmf-apps": "DEV_SERVER=1 TARGET=gmf-apps webpack-dev-server --https --cert=private.crt --key=private.key --port 3000 --mode development --progress --watch --bail --debug",
"serve-api": "webpack-dev-server --content-base api/dist/ --config buildtools/webpack.api.js --https --cert=private.crt --key=private.key --port 3000 --mode development --progress --watch --bail --debug",
"build-gmf-apps-profile": "TARGET=gmf-apps webpack --profile --json > profile.json",
"typecheck": "tsc --pretty",
"doc": "typedoc --module system --target ES6 --name ngeo --out apidoc src/ contribs/gmf/src/"
},
Expand Down Expand Up @@ -79,6 +80,7 @@
"file-saver": "2.0.0",
"floatthead": "2.1.2",
"fs-extra": "7.0.1",
"hard-source-webpack-plugin": "0.6.12",
"html-webpack-include-assets-plugin": "1.0.6",
"html-webpack-plugin": "3.2.0",
"istanbul-instrumenter-loader": "3.0.1",
Expand Down

0 comments on commit 7d8b4f2

Please sign in to comment.