This repository has been archived by the owner on Jan 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
58 changed files
with
18,943 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[*] | ||
charset=utf-8 | ||
end_of_line=lf | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
indent_style=space | ||
indent_size=4 | ||
|
||
[*.json] | ||
indent_style=space | ||
indent_size=2 | ||
|
||
[*.sass] | ||
indent_style=space | ||
indent_size=4 | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Set the default behavior, in case people don't have core.autocrlf set. | ||
* text=auto | ||
|
||
# Explicitly declare text files you want to always be normalized and converted | ||
# to native line endings on checkout. | ||
*.ts text eol=lf | ||
*.js text eol=lf | ||
*.css text eol=lf | ||
*.scss text eol=lf | ||
*.json text eol=lf | ||
*.xml text eol=lf | ||
*.md text eol=lf | ||
*.gitattributes eol=lf | ||
*.gitignore eol=lf | ||
|
||
# Denote all files that are truly binary and should not be modified. | ||
*.png binary | ||
*.jpg binary | ||
*.gif binary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.idea/* | ||
dist/ | ||
localSettings.js | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
sudo: required | ||
dist: trusty | ||
language: node_js | ||
node_js: | ||
- "8" | ||
addons: | ||
apt: | ||
sources: | ||
- google-chrome | ||
packages: | ||
- google-chrome-stable | ||
before_install: | ||
- npm i -g npm | ||
- npm install grunt-cli -g | ||
- export CHROME_BIN=chromium-browser | ||
- export DISPLAY=:99.0 | ||
- sh -e /etc/init.d/xvfb start | ||
- wget -q -O - http://opensource.wandisco.com/wandisco-debian.gpg | sudo apt-key add | ||
- sudo sh -c "echo 'deb http://opensource.wandisco.com/debian/ wheezy svn17' > /etc/apt/sources.list.d/wandisco-subversion.list" | ||
- sudo apt-get -qq update | ||
- sudo apt-get install -y --allow-downgrades subversion=1.7.22-1+WANdisco libsvn1=1.7.22-1+WANdisco | ||
- svn --version | ||
- npm --version | ||
after_success: | ||
- bash <(curl -s https://codecov.io/bash) | ||
cache: | ||
directories: | ||
- node_modules | ||
env: | ||
global: | ||
- MX_APP_NAME=leafletmaps | ||
- MX_BRANCH_NAME=trunk | ||
- MX_PROJECT_ID=b16057e9-012a-4d19-8484-34caebdc3eb2 | ||
- MX_ENVIRONMENT=Sandbox | ||
- MX_USER=ci@flockofbirds.org | ||
deploy: | ||
provider: releases | ||
api_key: $GITHUB_KEY | ||
file_glob: true | ||
file: dist/release/* | ||
skip_cleanup: true | ||
on: | ||
repo: $TRAVIS_REPO_SLUG | ||
tags: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
"use strict"; | ||
const webpack = require("webpack"); | ||
const webpackConfig = require("./webpack.config"); | ||
const merge = require("webpack-merge"); | ||
const ExtractTextPlugin = require("extract-text-webpack-plugin"); | ||
const packageJson = require("./package.json"); | ||
const widgetName = packageJson.widgetName; | ||
|
||
const webpackConfigRelease = webpackConfig.map(config => merge(config, { | ||
devtool: false, | ||
mode: "production" | ||
})); | ||
|
||
webpackConfigRelease[0].plugins.push(new ExtractTextPlugin({ | ||
filename: `./widgets/com/mendix/widget/custom/${widgetName}/ui/${widgetName}.css` | ||
})); | ||
|
||
webpackConfigRelease[0].module.rules[1] = { | ||
test: /\.css$/, loader: ExtractTextPlugin.extract({ | ||
fallback: "style-loader", | ||
use: [ "css-loader", "sass-loader" ] | ||
}) | ||
}; | ||
|
||
module.exports = function(grunt) { | ||
const pkg = grunt.file.readJSON("package.json"); | ||
grunt.initConfig({ | ||
watch: { | ||
updateWidgetFiles: { | ||
files: [ "./src/**/*" ], | ||
tasks: [ "webpack:develop", "file_append", "compress:dist", "copy:distDeployment", "copy:mpk" ], | ||
options: { | ||
debounceDelay: 250, | ||
livereload: true | ||
} | ||
} | ||
}, | ||
|
||
compress: { | ||
dist: { | ||
options: { | ||
archive: "./dist/" + pkg.version + "/" + pkg.widgetName + ".mpk", | ||
mode: "zip" | ||
}, | ||
files: [ { | ||
expand: true, | ||
date: new Date(), | ||
store: false, | ||
cwd: "./dist/tmp/widgets", | ||
src: [ "**/*" ] | ||
} ] | ||
} | ||
}, | ||
|
||
copy: { | ||
distDeployment: { | ||
files: [ { | ||
dest: "./dist/MxTestProject/deployment/web/widgets", | ||
cwd: "./dist/tmp/widgets/", | ||
src: [ "**/*" ], | ||
expand: true | ||
} ] | ||
}, | ||
mpk: { | ||
files: [ { | ||
dest: "./dist/MxTestProject/widgets", | ||
cwd: "./dist/" + pkg.version + "/", | ||
src: [ pkg.widgetName + ".mpk" ], | ||
expand: true | ||
} ] | ||
} | ||
}, | ||
|
||
file_append: { | ||
addSourceURL: { | ||
files: [ { | ||
append: `\n\n//# sourceURL=${pkg.widgetName}.webmodeler.js\n`, | ||
input: `dist/tmp/widgets/${pkg.widgetName}.webmodeler.js` | ||
} ] | ||
} | ||
}, | ||
|
||
webpack: { | ||
develop: webpackConfig, | ||
release: webpackConfigRelease | ||
}, | ||
|
||
clean: { | ||
build: [ | ||
"./dist/" + pkg.version + "/" + pkg.widgetName + "/*", | ||
"./dist/tmp/**/*", | ||
"./dist/MxTestProject/deployment/web/widgets/" + pkg.widgetName + "/*", | ||
"./dist/MxTestProject/widgets/" + pkg.widgetName + ".mpk", | ||
"./dist/wdio/**/*" | ||
] | ||
}, | ||
|
||
checkDependencies: { | ||
this: {} | ||
} | ||
}); | ||
|
||
grunt.loadNpmTasks("grunt-check-dependencies"); | ||
grunt.loadNpmTasks("grunt-contrib-clean"); | ||
grunt.loadNpmTasks("grunt-contrib-compress"); | ||
grunt.loadNpmTasks("grunt-contrib-copy"); | ||
grunt.loadNpmTasks("grunt-contrib-watch"); | ||
grunt.loadNpmTasks("grunt-file-append"); | ||
grunt.loadNpmTasks("grunt-webpack"); | ||
|
||
grunt.registerTask("default", [ "clean build", "watch" ]); | ||
grunt.registerTask( | ||
"clean build", | ||
"Compiles all the assets and copies the files to the dist directory.", | ||
[ "checkDependencies", "clean:build", "webpack:develop", "file_append", "compress:dist", "copy" ] | ||
); | ||
grunt.registerTask( | ||
"release", | ||
"Compiles all the assets and copies the files to the dist directory. Minified without source mapping", | ||
[ "checkDependencies", "clean:build", "webpack:release", "file_append", "compress:dist", "copy:mpk" ] | ||
); | ||
grunt.registerTask("build", [ "clean build" ]); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,96 @@ | ||
# maps | ||
Maps widget | ||
[![Build Status](https://travis-ci.org/mendix/maps.svg?branch=master)](https://travis-ci.org/mendix/maps) | ||
[![Dependency Status](https://david-dm.org/mendix/maps.svg)](https://david-dm.org/mendix/maps) | ||
[![Dev Dependency Status](https://david-dm.org/mendix/maps.svg#info=devDependencies)](https://david-dm.org/mendix/maps#info=devDependencies) | ||
[![codecov](https://codecov.io/gh/mendix/maps/branch/master/graph/badge.svg)](https://codecov.io/gh/mendix/maps) | ||
![badge](https://img.shields.io/badge/mendix-7.18.0-green.svg) | ||
|
||
# Maps | ||
* Show locations on maps | ||
|
||
## Available map types | ||
* Google maps | ||
* Open street maps | ||
* Map box | ||
* Here maps | ||
|
||
## Features | ||
* Show location on a map based on coordinates | ||
* Show list of coordinates on the map | ||
* Data sources Context, Static, XPath or Microflow | ||
* Support for Multiple data sources | ||
* Addresses are not supported | ||
* Support actions when a marker is clicked: | ||
* Open Page | ||
* Call Microflow | ||
* Call Nanoflow | ||
* Customize the display of the marker. If the marker can not be found from the custom markers. The widget will use | ||
the specified custom markers else it will use the widget bundled marker. | ||
|
||
## Limitations | ||
* Context and static datasource are Offline capable with Mendix data, however you still need to be online to view the map | ||
* Addresses are not supported for the **Maps** widget | ||
* For all Map types except **open street maps** you need to have a token inorder to view the map. You can get the tokens from here | ||
[Mapbox](https://www.mapbox.com) | ||
[Here maps](https://www.here.com/) | ||
[Google maps](https://cloud.google.com/maps-platform/) | ||
* Google maps uses [Google Maps API v3](https://developers.google.com/maps/). So the [Limitations](https://developers.google.com/maps/premium/usage-limits) | ||
from Google apply. | ||
|
||
## Dependencies | ||
Mendix 7.18.0 | ||
|
||
## How it Works | ||
|
||
* Locations are displayed based on coordinates. if there are multiple locations, the Map will center to a position in which all markers are visible | ||
* If there is one location, the Map will center to that location | ||
* If no locations available, a default center location of the mendix offices is provided in case default center coordinates are not specified | ||
* If autozoom is enabled the Map will use bounds zoom otherwise it will use a custom zoom level specified | ||
* Min Zoom level is 2 and the Maximum is 20 | ||
|
||
## Demo Project | ||
|
||
[https://leafletmaps.mxapps.io/](https://leafletmaps.mxapps.io/) | ||
|
||
![Running google maps widget](/assets/maps-google.png) | ||
|
||
## Usage | ||
- To add basic a map to your application select **new** under the **Map properties** tab | ||
- Under the **Data source** tab Select data source **context** | ||
- Select the **Locations entity**, **latitude** and **longitude** attributes | ||
- Under the **Map properties** tab, select a **Map provider** | ||
- Add Access token if **Map provider** is not **Open street** | ||
- Run the application and add some locations | ||
- For **Here maps** add **app ID, app code** respectively. | ||
|
||
![Locations](/assets/maps-locations.png) | ||
### Data source: Static | ||
- On the **Map properties** tab, select **new** on the **locations** option | ||
- Under **Data source** tab, Select **Static** | ||
- On the **Static** tab add new static locations | ||
|
||
![static](/assets/maps-static.png) | ||
|
||
### Data source: Xpath | ||
- On the **Map properties** tab, select **new** on the **locations** option | ||
- Select **Database**, Add the **locations** entity | ||
- Add the **Latitude** and **Longitude** attributes | ||
- Add an **XPath Constraint** `Optional` | ||
|
||
### Custom Markers | ||
- It is used to configure how the marker icon should be look. | ||
- Under **locations** option on the **Map properties** tab, select the **Markers** tab | ||
- For the **Default** option, the widget bundled marker will be displayed | ||
- For the **Static** option, upload a static image | ||
- For the **System image** option, add a **system image path**, which is a reference to the locations enity. The entity selected should inherit from **System.Image** otherwise it will display an error. | ||
- Upload an image into the database to view the **system image** marker at runtime | ||
- Markers can also be created based on enumeration. Select the **Marker list** option, then add an enumeration containing the name and caption of the markers to your project and assign that enumeration to the `Locations entity`. | ||
![Markers](/assets/maps-markers.png) | ||
From the `Marker image list` tab, the enumeration key and image is then specified under `Images` | ||
![Enumeration markers](/assets/markers.png) | ||
|
||
## Issues, suggestions and feature requests | ||
We are actively maintaining this widget, please report any issues or suggestion for improvement at | ||
[https://github.com/mendix/maps/issues](https://github.com/mendix/maps/issues). | ||
|
||
## Development | ||
See [here](/development.md) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Development and contribution | ||
Prerequisite: Install git, node package manager, webpack CLI, grunt CLI, Karma CLI | ||
|
||
To contribute, fork and clone. | ||
|
||
> git clone https://github.com/mendix/maps.git | ||
|
||
The code is in typescript. Use a typescript IDE of your choice, like Visual Studio Code or WebStorm. | ||
|
||
To set up the development environment, run: | ||
|
||
> npm install | ||
|
||
Create a folder named `dist` in the project root. | ||
|
||
Create a Mendix test project in the dist folder and rename its root folder to `dist/MxTestProject`. Changes to the widget code shall be automatically pushed to this test project. | ||
Or get the test project from [https://github.com/mendix/maps/releases/latest](https://github.com/mendix/maps/releases/latest) | ||
|
||
To automatically compile, bundle and push code changes to the running test project, run: | ||
|
||
> npm start | ||
|
||
To run the project unit tests with code coverage, results can be found at `dist/testresults/coverage/index.html`, run: | ||
|
||
> npm run test:unit | ||
|
||
Run the unit test continuously during development: | ||
|
||
> npm run test:dev | ||
|
||
Run the end to end test during development: | ||
|
||
> npm run test:e2e:dev | ||
|
||
## Scripts | ||
While developing, you will probably rely mostly on `npm start`; however, there are additional scripts at your disposal: | ||
|
||
|`npm run <script>`|Description| | ||
|------------------|-----------| | ||
|`start`|Build the project and monitor source and config for changes and rebuild.| | ||
|`test`|Runs lint, build, unit tests with Karma and generates a coverage report, deploy and run e2e test| | ||
|`test:dev`|Runs Karma and watches for changes to re-run tests; does not generate coverage reports.| | ||
|`test:unit`|Runs unit tests with Karma and generates a coverage report.| | ||
|`test:e2e`|Runs end 2 end tests with remote.| | ||
|`test:e2e:dev`|Runs end 2 end tests with locally on localhost:8080| | ||
|`deploy`|Use latest widget build to update the Mendix project update the application to Mendix node.| | ||
|`build:prod`|Build widget optimized for production| | ||
|`build:dev`|Build widget optimized for debugging.| | ||
|`lint`|Lint all `.js` files.| | ||
|`lint:fix`|Lint and fix all `.ts` files.| | ||
|
||
# CI and remote testing | ||
To enable the continues integration services. | ||
Copy the `node_modules/mendix-widget-build-script/dist/localSettings.js` | ||
to your project root, and update the settings to run the update deployment from local source. | ||
|
||
**Do not forget** to exclude this file in the `.gitignore` as it contains sensitive data. | ||
``` | ||
exports.settings = { | ||
appName: "appName", | ||
key: "xxxxxxxx-xxxx-xxxx-xxxxx-xxxxxxxxxxxx", | ||
password: "secret", | ||
projectId: "xxxxxxxx-xxxx-xxxx-xxxxx-xxxxxxxxxxxx", | ||
user: "ci@example.com" | ||
}; | ||
``` | ||
|
||
More information about the [Mendix widget build script](https://github.com/FlockOfBirds/mendix-widget-build-script). |
Oops, something went wrong.