mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-07 19:08:37 +03:00
moves API data to S3, allows external use (#74)
This commit is contained in:
committed by
GitHub
parent
f8e0b7554a
commit
042346a833
11
config.js
11
config.js
@@ -3,10 +3,11 @@ const one_day = 1440;
|
||||
const config = {
|
||||
title: "ukraine",
|
||||
display_title: "Civilian Harm\nin Ukraine",
|
||||
SERVER_ROOT: "https://ukraine.bellingcat.com/ukraine-server",
|
||||
EVENTS_EXT: "/api/ukraine/export_events/deeprows",
|
||||
SOURCES_EXT: "/api/ukraine/export_sources/deepids",
|
||||
ASSOCIATIONS_EXT: "/api/ukraine/export_associations/deeprows",
|
||||
SERVER_ROOT: "https://bellingcat-embeds.ams3.cdn.digitaloceanspaces.com/production/ukr",
|
||||
EVENTS_EXT: "/timemap/events.json",
|
||||
SOURCES_EXT: "/timemap/sources.json",
|
||||
ASSOCIATIONS_EXT: "/timemap/associations.json",
|
||||
API_DATA: "https://bellingcat-embeds.ams3.cdn.digitaloceanspaces.com/production/ukr/timemap/api.json",
|
||||
MAPBOX_TOKEN:
|
||||
"pk.eyJ1IjoiYmVsbGluZ2NhdC1tYXBib3giLCJhIjoiY2tleW0wbWliMDA1cTJ5bzdkbTRraHgwZSJ9.GJQkjPzj8554VhR5SPsfJg",
|
||||
// MEDIA_EXT: "/api/media",
|
||||
@@ -38,7 +39,7 @@ const config = {
|
||||
{ label: "Zoom to 1 month", duration: 31 * one_day },
|
||||
{ label: "Zoom to 6 months", duration: 6 * 31 * one_day },
|
||||
{ label: "Zoom to 1 year", duration: 12 * 31 * one_day },
|
||||
{ label: "Zoom to 1.5 years", duration: 18 * 31 * one_day },
|
||||
{ label: "Zoom to 2 years", duration: 24 * 31 * one_day },
|
||||
],
|
||||
range: {
|
||||
/**
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"dev:wsl": "vite --host",
|
||||
"test": "vitest",
|
||||
"eslint": "eslint src --ext jsx",
|
||||
|
||||
@@ -214,6 +214,10 @@
|
||||
"title": "Download events",
|
||||
"description": "Export the most recent available events in different formats.",
|
||||
"formats": {
|
||||
"api": {
|
||||
"label": "API",
|
||||
"description": "An API endpoint where you can always fetch the entire dataset in JSON format with tools like curl. Useful for integrating the data in other services and visualizaitons."
|
||||
},
|
||||
"csv": {
|
||||
"label": "CSV",
|
||||
"description": "CSV file where sources and filters are concatenated into a single column each due to data structure limitations."
|
||||
|
||||
@@ -3,11 +3,14 @@ import dayjs from "dayjs";
|
||||
import { Parser } from "@json2csv/plainjs";
|
||||
import copy from "../../common/data/copy.json";
|
||||
import { downloadAsFile } from "../../common/utilities";
|
||||
import config from "../../../config";
|
||||
|
||||
export class DownloadButton extends Component {
|
||||
onDownload(format, domain) {
|
||||
let filename = `ukr-civharm-${dayjs().format("YYYY-MM-DD")}`;
|
||||
if (format === "csv") {
|
||||
if (format === "api") {
|
||||
window.open(config["API_DATA"], '_blank');
|
||||
}else if (format === "csv") {
|
||||
let outputData = this.getCsvData(domain);
|
||||
downloadAsFile(`${filename}.csv`, outputData);
|
||||
} else if (format === "json") {
|
||||
|
||||
@@ -13,6 +13,7 @@ const DownloadPanel = ({ language, title, description, domain }) => {
|
||||
}}
|
||||
/>
|
||||
<hr />
|
||||
<DownloadButton language={language} domain={domain} format="api" />
|
||||
<DownloadButton language={language} domain={domain} format="csv" />
|
||||
<DownloadButton language={language} domain={domain} format="json" />
|
||||
</div>
|
||||
|
||||
@@ -12,6 +12,10 @@ export default defineConfig({
|
||||
"/api": {
|
||||
target: "https://ukraine.bellingcat.com/ukraine-server",
|
||||
changeOrigin: true,
|
||||
},
|
||||
"/timemap": {
|
||||
target: "https://bellingcat-embeds.ams3.cdn.digitaloceanspaces.com/production/ukr",
|
||||
changeOrigin: true,
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user