Skip to content

Commit 225fd12

Browse files
Update requirements.txt to point towards fork, Changes raw data api url to read from env variable , Moved mbtiles to top
1 parent 88c48c4 commit 225fd12

File tree

9 files changed

+24
-15
lines changed

9 files changed

+24
-15
lines changed

docs/setup-development.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ Most of these environment variables have reasonable default settings.
111111
- `GARMIN_CONFIG`, `GARMIN_MKGMAP` absolute paths to garmin JARs
112112
- `OVERPASS_API_URL` url of Overpass api endpoint
113113

114-
- `RAW_DATA_API_URL` url of Galaxy api endpoint
114+
- `RAW_DATA_API_URL` url of Raw data api endpoint
115115

116116
- `DATABASE_URL` Database URL. Defaults to `postgres:///exports`
117117
- `DEBUG` Whether to enable debug mode. Defaults to `False` (production).

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ mercantile~=0.10.0
1111
psycopg2
1212
python3-openid==3.2.0
1313
social-auth-app-django==5.4.0
14-
social-auth-core==4.4.2 ### Upgrade this to include oauth2
14+
social-auth-core @ git+https://github.com/kshitijrajsharma/social-core.git ### Upgrade this to include osm oauth2 when released
1515
pytz
1616
pyyaml>=5.3
1717
raven

ui/app/actions/exports.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ export const getOverpassTimestamp = () => (dispatch, getState) => {
170170

171171
export const getGalaxyTimestamp = () => (dispatch, getState) => {
172172
return axios({
173-
baseURL: "https://api-prod.raw-data.hotosm.org/v1",
174-
url: "/status/"
173+
baseURL: window.RAW_DATA_API_URL,
174+
url: "v1/status/"
175175
})
176176
.then(response =>
177177
dispatch({

ui/app/actions/meta.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ if (window.location.port) {
1010
hostname += `:${window.location.port}`;
1111
}
1212

13+
if (window.RAW_DATA_API_URL == null) {
14+
window.RAW_DATA_API_URL = process.env.RAW_DATA_API_URL;
15+
}
16+
1317
if (window.EXPORTS_API_URL == null) {
1418
window.EXPORTS_API_URL = process.env.EXPORTS_API_URL;
1519

ui/app/components/ExportForm.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export class ExportForm extends Component {
129129
}
130130

131131
async fetchData(geometry) {
132-
const url = "https://api-prod.raw-data.hotosm.org/v1/stats/polygon/";
132+
const url = window.RAW_DATA_API_URL + "v1/stats/polygon/";
133133
try {
134134
const response = await axios.post(url, {
135135
geometry: geometry
@@ -155,7 +155,7 @@ export class ExportForm extends Component {
155155

156156
renderFetchedInfo() {
157157
const { fetchedInfo } = this.state;
158-
158+
if (!this.props.formValues.the_geom) return null;
159159
if (!fetchedInfo) return null;
160160

161161
// Function to trigger the download of the raw data as a JSON file
@@ -172,7 +172,7 @@ export class ExportForm extends Component {
172172
};
173173

174174
return (
175-
<Panel style={{ marginTop: "5px" }}>
175+
<Panel style={{ marginTop: "10px" }}>
176176
<div>
177177
<div>
178178
<strong style={{ fontSize: "smaller" }}>Buildings:</strong>
@@ -365,7 +365,7 @@ export class ExportForm extends Component {
365365
<Panel style={{ marginTop: "20px" }}>
366366
<FormattedMessage
367367
id="ui.overpass_last_updated"
368-
defaultMessage="Img/pbf/obf/ updated {overpassLastUpdated}, Rest of other formats updated {galaxyLastUpdated} "
368+
defaultMessage="Img/pbf/obf updated {overpassLastUpdated}, Rest of other formats updated {galaxyLastUpdated} "
369369
values={{ overpassLastUpdated, galaxyLastUpdated }}
370370
/>
371371
</Panel>

ui/app/components/utils.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ export const AVAILABLE_EXPORT_FORMATS = {
5858
SQL <code>.sql</code>
5959
</span>
6060
),
61+
mbtiles: (
62+
<span key="mbtiles">
63+
MBTiles <code>.mbtiles</code>
64+
</span>
65+
),
6166
garmin_img: (
6267
<span key="garmin_img">
6368
Garmin <code>.img</code>
@@ -83,11 +88,6 @@ export const AVAILABLE_EXPORT_FORMATS = {
8388
OsmAnd <code>.obf</code>
8489
</span>
8590
),
86-
mbtiles: (
87-
<span key="osmand_obf">
88-
MBTiles <code>.mbtiles</code>
89-
</span>
90-
),
9191
bundle: (
9292
<span key="bundle">
9393
<a href="http://posm.io/">POSM</a> bundle

ui/templates/ui/v3.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
<script>
3131
var EXPORTS_API_URL = "{{ request.scheme }}://{{ request.get_host }}";
3232
var OAUTH_CLIENT_ID = "{{ client_id }}";
33+
var RAW_DATA_API_URL = "{{ RAW_DATA_API_URL }}";
3334
</script>
3435
<script src="{% static 'ui/js/bundle.js' %}"></script>
3536
</body>

ui/views.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ def v3(request, *args, **kwargs):
5656
skip_authorization=True,
5757
)
5858

59-
context = dict(client_id=ui_app.client_id)
59+
context = dict(
60+
client_id=ui_app.client_id, RAW_DATA_API_URL=settings.RAW_DATA_API_URL
61+
)
6062
if settings.MATOMO_URL is not None and settings.MATOMO_SITEID is not None:
6163
context.update(
6264
{"MATOMO_URL": settings.MATOMO_URL, "MATOMO_SITEID": settings.MATOMO_SITEID}

ui/webpack.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ const config = {
9393
plugins: [new webpack.DefinePlugin({
9494
"process.env": {
9595
CLIENT_ID: JSON.stringify(process.env.CLIENT_ID),
96-
EXPORTS_API_URL: JSON.stringify(process.env.EXPORTS_API_URL)
96+
EXPORTS_API_URL: JSON.stringify(process.env.EXPORTS_API_URL),
97+
RAW_DATA_API_URL: JSON.stringify(process.env.RAW_DATA_API_URL)
9798
}
9899
}), new webpack.NamedModulesPlugin(), new WriteFilePlugin()],
99100
resolve: {
@@ -110,6 +111,7 @@ if (process.env.NODE_ENV === "production") {
110111
"process.env": {
111112
CLIENT_ID: JSON.stringify(process.env.CLIENT_ID),
112113
EXPORTS_API_URL: JSON.stringify(process.env.EXPORTS_API_URL),
114+
RAW_DATA_API_URL: JSON.stringify(process.env.RAW_DATA_API_URL),
113115
NODE_ENV: JSON.stringify("production")
114116
}
115117
}),

0 commit comments

Comments
 (0)