Merge branch 'develop' of github.com:pietervdvn/MapComplete into develop
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 370 KiB |
Before Width: | Height: | Size: 123 KiB After Width: | Height: | Size: 125 KiB |
Before Width: | Height: | Size: 280 KiB After Width: | Height: | Size: 282 KiB |
Before Width: | Height: | Size: 370 KiB After Width: | Height: | Size: 372 KiB |
Before Width: | Height: | Size: 903 KiB After Width: | Height: | Size: 904 KiB |
Before Width: | Height: | Size: 98 KiB After Width: | Height: | Size: 99 KiB |
Before Width: | Height: | Size: 106 KiB After Width: | Height: | Size: 104 KiB |
Before Width: | Height: | Size: 126 KiB After Width: | Height: | Size: 125 KiB |
Before Width: | Height: | Size: 227 KiB After Width: | Height: | Size: 222 KiB |
Before Width: | Height: | Size: 99 KiB After Width: | Height: | Size: 98 KiB |
|
@ -5,13 +5,17 @@ import Link from "../Base/Link";
|
||||||
import {FixedUiElement} from "../Base/FixedUiElement";
|
import {FixedUiElement} from "../Base/FixedUiElement";
|
||||||
import CheckBoxes from "../Input/Checkboxes";
|
import CheckBoxes from "../Input/Checkboxes";
|
||||||
import Title from "../Base/Title";
|
import Title from "../Base/Title";
|
||||||
|
import {SubtleButton} from "../Base/SubtleButton";
|
||||||
|
import Svg from "../../Svg";
|
||||||
|
import {Utils} from "../../Utils";
|
||||||
|
import LayerConfig from "../../Models/ThemeConfig/LayerConfig";
|
||||||
|
|
||||||
export class ConfirmProcess<T> extends Combine implements FlowStep<T> {
|
export class ConfirmProcess extends Combine implements FlowStep<{ features: any[], layer: LayerConfig }> {
|
||||||
|
|
||||||
public IsValid: UIEventSource<boolean>
|
public IsValid: UIEventSource<boolean>
|
||||||
public Value: UIEventSource<T>
|
public Value: UIEventSource<{ features: any[], layer: LayerConfig }>
|
||||||
|
|
||||||
constructor(v: T) {
|
constructor(v: { features: any[], layer: LayerConfig }) {
|
||||||
|
|
||||||
const toConfirm = [
|
const toConfirm = [
|
||||||
new Combine(["I have read the ", new Link("import guidelines on the OSM wiki", "https://wiki.openstreetmap.org/wiki/Import_guidelines", true)]),
|
new Combine(["I have read the ", new Link("import guidelines on the OSM wiki", "https://wiki.openstreetmap.org/wiki/Import_guidelines", true)]),
|
||||||
|
@ -23,10 +27,21 @@ export class ConfirmProcess<T> extends Combine implements FlowStep<T> {
|
||||||
const licenseClear = new CheckBoxes(toConfirm)
|
const licenseClear = new CheckBoxes(toConfirm)
|
||||||
super([
|
super([
|
||||||
new Title("Did you go through the import process?"),
|
new Title("Did you go through the import process?"),
|
||||||
licenseClear
|
licenseClear,
|
||||||
|
new FixedUiElement("Alternatively, you can download the dataset to import directly"),
|
||||||
|
new SubtleButton(Svg.download_svg(), "Download geojson").OnClickWithLoading("Preparing your download",
|
||||||
|
async ( ) => {
|
||||||
|
const geojson = {
|
||||||
|
type:"FeatureCollection",
|
||||||
|
features: v.features
|
||||||
|
}
|
||||||
|
Utils.offerContentsAsDownloadableFile(JSON.stringify(geojson), "prepared_import_"+v.layer.id+".geojson",{
|
||||||
|
mimetype: "application/vnd.geo+json"
|
||||||
|
})
|
||||||
|
})
|
||||||
]);
|
]);
|
||||||
this.SetClass("link-underline")
|
this.SetClass("link-underline")
|
||||||
this.IsValid = licenseClear.GetValue().map(selected => toConfirm.length == selected.length)
|
this.IsValid = licenseClear.GetValue().map(selected => toConfirm.length == selected.length)
|
||||||
this.Value = new UIEventSource<T>(v)
|
this.Value = new UIEventSource<{ features: any[], layer: LayerConfig }>(v)
|
||||||
}
|
}
|
||||||
}
|
}
|
2
Utils.ts
|
@ -661,7 +661,7 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
|
||||||
* Triggers a 'download file' popup which will download the contents
|
* Triggers a 'download file' popup which will download the contents
|
||||||
*/
|
*/
|
||||||
public static offerContentsAsDownloadableFile(contents: string | Blob, fileName: string = "download.txt",
|
public static offerContentsAsDownloadableFile(contents: string | Blob, fileName: string = "download.txt",
|
||||||
options?: { mimetype: string }) {
|
options?: { mimetype: string | "text/plain" | "text/csv" | "application/vnd.geo+json" | "{gpx=application/gpx+xml}"}) {
|
||||||
const element = document.createElement("a");
|
const element = document.createElement("a");
|
||||||
let file;
|
let file;
|
||||||
if (typeof (contents) === "string") {
|
if (typeof (contents) === "string") {
|
||||||
|
|
|
@ -379,6 +379,14 @@
|
||||||
"then": "isOpen"
|
"then": "isOpen"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"label": {
|
||||||
|
"mappings": [
|
||||||
|
{
|
||||||
|
"if": "name~*",
|
||||||
|
"then": "<div style='background: white; padding: 0.25em; border-radius:0.5em'>{name}</div>"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"iconSize": {
|
"iconSize": {
|
||||||
"render": "40,40,center"
|
"render": "40,40,center"
|
||||||
},
|
},
|
||||||
|
@ -396,4 +404,4 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,8 @@
|
||||||
"prepare-deploy": "./scripts/build.sh",
|
"prepare-deploy": "./scripts/build.sh",
|
||||||
"gittag": "ts-node scripts/printVersion.ts | bash",
|
"gittag": "ts-node scripts/printVersion.ts | bash",
|
||||||
"lint": "tslint --project . -c tslint.json '**.ts' ",
|
"lint": "tslint --project . -c tslint.json '**.ts' ",
|
||||||
"clean": "rm -rf .cache/ && (find . -type f -name \"*.doctest.ts\" | xargs rm) && (find *.html | grep -v \"\\(404\\|index\\|land\\|test\\|preferences\\|customGenerator\\|professional\\|automaton\\|import_helper\\|import_viewer\\|theme\\).html\" | xargs rm) && (ls | grep \"^index_[a-zA-Z_]\\+\\.ts$\" | xargs rm) && (ls | grep \".*.webmanifest$\" | xargs rm)",
|
"clean:tests": "(find . -type f -name \"*.doctest.ts\" | xargs rm)",
|
||||||
|
"clean": "rm -rf .cache/ && (find *.html | grep -v \"\\(404\\|index\\|land\\|test\\|preferences\\|customGenerator\\|professional\\|automaton\\|import_helper\\|import_viewer\\|theme\\).html\" | xargs rm) && (ls | grep \"^index_[a-zA-Z_]\\+\\.ts$\" | xargs rm) && (ls | grep \".*.webmanifest$\" | xargs rm)",
|
||||||
"generate:dependency-graph": "node_modules/.bin/depcruise --exclude \"^node_modules\" --output-type dot Logic/State/MapState.ts > dependencies.dot && dot dependencies.dot -T svg -o dependencies.svg && rm dependencies.dot",
|
"generate:dependency-graph": "node_modules/.bin/depcruise --exclude \"^node_modules\" --output-type dot Logic/State/MapState.ts > dependencies.dot && dot dependencies.dot -T svg -o dependencies.svg && rm dependencies.dot",
|
||||||
"script": "ts-node"
|
"script": "ts-node"
|
||||||
},
|
},
|
||||||
|
|