forked from MapComplete/MapComplete
		
	Add mime type, rename to DownloadPanel
This commit is contained in:
		
							parent
							
								
									13b2c1b572
								
							
						
					
					
						commit
						c44db2a219
					
				
					 2 changed files with 17 additions and 15 deletions
				
			
		| 
						 | 
					@ -10,7 +10,7 @@ import {GeoOperations} from "../../Logic/GeoOperations";
 | 
				
			||||||
import Toggle from "../Input/Toggle";
 | 
					import Toggle from "../Input/Toggle";
 | 
				
			||||||
import Title from "../Base/Title";
 | 
					import Title from "../Base/Title";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export class ExportDataButton extends Toggle {
 | 
					export class DownloadPanel extends Toggle {
 | 
				
			||||||
    constructor() {
 | 
					    constructor() {
 | 
				
			||||||
        const t = Translations.t.general.download
 | 
					        const t = Translations.t.general.download
 | 
				
			||||||
        const somethingLoaded = State.state.featurePipeline.features.map(features => features.length > 0);
 | 
					        const somethingLoaded = State.state.featurePipeline.features.map(features => features.length > 0);
 | 
				
			||||||
| 
						 | 
					@ -23,7 +23,9 @@ export class ExportDataButton extends Toggle {
 | 
				
			||||||
                const geojson = FeatureSourceUtils.extractGeoJson(State.state.featurePipeline, {metadata: metaisIncluded.data})
 | 
					                const geojson = FeatureSourceUtils.extractGeoJson(State.state.featurePipeline, {metadata: metaisIncluded.data})
 | 
				
			||||||
                const name = State.state.layoutToUse.data.id;
 | 
					                const name = State.state.layoutToUse.data.id;
 | 
				
			||||||
                Utils.offerContentsAsDownloadableFile(JSON.stringify(geojson),
 | 
					                Utils.offerContentsAsDownloadableFile(JSON.stringify(geojson),
 | 
				
			||||||
                    `MapComplete_${name}_export_${new Date().toISOString().substr(0,19)}.geojson`);
 | 
					                    `MapComplete_${name}_export_${new Date().toISOString().substr(0, 19)}.geojson`, {
 | 
				
			||||||
 | 
					                        mimetype: "application/vnd.geo+json"
 | 
				
			||||||
 | 
					                    });
 | 
				
			||||||
            })
 | 
					            })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const buttonCSV = new SubtleButton(Svg.floppy_ui(), new Combine(
 | 
					        const buttonCSV = new SubtleButton(Svg.floppy_ui(), new Combine(
 | 
				
			||||||
| 
						 | 
					@ -35,8 +37,8 @@ export class ExportDataButton extends Toggle {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                Utils.offerContentsAsDownloadableFile(csv,
 | 
					                Utils.offerContentsAsDownloadableFile(csv,
 | 
				
			||||||
                    `MapComplete_${name}_export_${new Date().toISOString().substr(0,19)}.csv`,{
 | 
					                    `MapComplete_${name}_export_${new Date().toISOString().substr(0, 19)}.csv`, {
 | 
				
			||||||
                    mimetype:"text/csv"
 | 
					                        mimetype: "text/csv"
 | 
				
			||||||
                    });
 | 
					                    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,7 +7,7 @@ import Translations from "../i18n/Translations";
 | 
				
			||||||
import {UIEventSource} from "../../Logic/UIEventSource";
 | 
					import {UIEventSource} from "../../Logic/UIEventSource";
 | 
				
			||||||
import BaseUIElement from "../BaseUIElement";
 | 
					import BaseUIElement from "../BaseUIElement";
 | 
				
			||||||
import Toggle from "../Input/Toggle";
 | 
					import Toggle from "../Input/Toggle";
 | 
				
			||||||
import {ExportDataButton} from "./ExportDataButton";
 | 
					import {DownloadPanel} from "./DownloadPanel";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default class LayerControlPanel extends ScrollableFullScreen {
 | 
					export default class LayerControlPanel extends ScrollableFullScreen {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -37,7 +37,7 @@ export default class LayerControlPanel extends ScrollableFullScreen {
 | 
				
			||||||
        ))
 | 
					        ))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        elements.push(new Toggle(
 | 
					        elements.push(new Toggle(
 | 
				
			||||||
            new ExportDataButton(),
 | 
					            new DownloadPanel(),
 | 
				
			||||||
            undefined,
 | 
					            undefined,
 | 
				
			||||||
            State.state.featureSwitchEnableExport
 | 
					            State.state.featureSwitchEnableExport
 | 
				
			||||||
        ))
 | 
					        ))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue