Skip to content

Commit c2793b5

Browse files
committed
Set up for Workspaces
1 parent b9a9274 commit c2793b5

5 files changed

Lines changed: 74 additions & 99 deletions

File tree

Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM node as builder
2+
3+
WORKDIR /app/
4+
COPY . .
5+
RUN npm install
6+
RUN npm run all
7+
8+
FROM nginx
9+
10+
COPY --from=builder /app/dist /usr/share/nginx/html/
11+
RUN chown -R nginx:nginx /usr/share/nginx/html/

data/pathwaysFields.json

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,31 @@
1-
{
1+
{
2+
"comment": {
3+
"key": "comment",
4+
"type": "textarea",
5+
"usage": "changeset"
6+
},
7+
"source": {
8+
"key": "source",
9+
"type": "semiCombo",
10+
"universal": true,
11+
"snake_case": false,
12+
"caseSensitive": true,
13+
"autoSuggestions": false,
14+
"options": [
15+
"survey",
16+
"local knowledge",
17+
"aerial imagery",
18+
"gps",
19+
"streetlevel imagery",
20+
"osm notes"
21+
]
22+
},
23+
"hashtags": {
24+
"key": "hashtags",
25+
"type": "semiCombo",
26+
"usage": "changeset",
27+
"caseSensitive": true
28+
},
229
"testField": {
330
"key": "testField",
431
"type": "combo",
@@ -114,4 +141,4 @@
114141
"key": "platform_code",
115142
"type": "text"
116143
}
117-
}
144+
}

data/presets_fields.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"comment": {
3+
"key": "comment",
4+
"type": "textarea",
5+
"usage": "changeset"
6+
},
7+
"source": {
8+
"key": "source",
9+
"type": "semiCombo",
10+
"universal": true,
11+
"snake_case": false,
12+
"caseSensitive": true,
13+
"autoSuggestions": false,
14+
"options": [
15+
"survey",
16+
"local knowledge",
17+
"aerial imagery",
18+
"gps",
19+
"streetlevel imagery",
20+
"osm notes"
21+
]
22+
},
23+
"hashtags": {
24+
"key": "hashtags",
25+
"type": "semiCombo",
26+
"usage": "changeset",
27+
"caseSensitive": true
28+
}
29+
}

modules/services/osm.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,7 @@ function wrapcb(thisArg, callback, cid) {
542542

543543

544544
export default {
545+
oauthClient: oauth,
545546

546547
init: function() {
547548
utilRebind(this, dispatch, 'on');

modules/ui/tools/save.js

Lines changed: 4 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
import { interpolateRgb as d3_interpolateRgb } from 'd3-interpolate';
22

33
import { t } from '../../core/localizer';
4-
import { modeSave, modeBrowse } from '../../modes';
4+
import { modeSave } from '../../modes';
55
import { svgIcon } from '../../svg';
66
import { uiCmd } from '../cmd';
77
import { uiTooltip } from '../tooltip';
8-
import { JXON } from '../../util/jxon';
9-
import { actionDiscardTags } from '../../actions/discard_tags';
10-
import { osmChangeset, osmNode, osmWay } from '../../osm';
11-
import { fileFetcher } from '../../core/file_fetcher';
8+
129

1310
export function uiToolSave(context) {
1411

@@ -32,102 +29,10 @@ export function uiToolSave(context) {
3229
return _numChanges === 0 || isSaving();
3330
}
3431

35-
var _discardTags = {};
36-
fileFetcher.get('discarded')
37-
.then(function(d) { _discardTags = d; })
38-
.catch(function() { /* ignore */ });
39-
4032
function save(d3_event) {
4133
d3_event.preventDefault();
4234
if (!context.inIntro() && !isSaving() && history.hasChanges()) {
4335
context.enter(modeSave(context));
44-
45-
const graph = context.graph();
46-
47-
// Retrieve all nodes and ways from the graph's entities
48-
const nodes = Object.values(graph.entities).filter(entity => entity instanceof osmNode);
49-
const ways = Object.values(graph.entities).filter(entity => entity instanceof osmWay);
50-
51-
var nodeFeatures = [];
52-
var wayFeatures = [];
53-
54-
55-
if (nodes) {
56-
// Convert nodes to GeoJSON Point features
57-
nodeFeatures = nodes.map(node => {
58-
const feature = {
59-
type: 'Feature',
60-
geometry: {
61-
type: 'Point',
62-
coordinates: node.loc,
63-
},
64-
properties: {
65-
stop_id: node.id.substring(1),
66-
...node.tags,
67-
},
68-
};
69-
return feature;
70-
});
71-
}
72-
73-
if (ways) {
74-
// Convert ways to GeoJSON LineString features
75-
wayFeatures = ways.map(way => {
76-
const feature = {
77-
type: 'Feature',
78-
geometry: {
79-
type: 'LineString',
80-
coordinates: way.nodes.map(nodeId => graph.entity(nodeId).loc),
81-
},
82-
properties: {
83-
pathway_id: way.id.substring(1),
84-
...way.tags,
85-
},
86-
};
87-
return feature;
88-
});
89-
}
90-
91-
// Create a FeatureCollection combining nodeFeatures and wayFeatures
92-
const featureCollection = {
93-
type: 'FeatureCollection',
94-
features: [...nodeFeatures, ...wayFeatures],
95-
};
96-
97-
// Convert the featureCollection to GeoJSON string
98-
const geoJSONString = JSON.stringify(featureCollection);
99-
100-
// Create a Blob object from the GeoJSON string
101-
const blob = new Blob([geoJSONString], { type: 'application/json' });
102-
103-
// Create a download link for the Blob object
104-
const downloadLink = document.createElement('a');
105-
downloadLink.href = URL.createObjectURL(blob);
106-
downloadLink.download = 'data.geojson'; // Set the desired file name
107-
108-
// Programmatically click the download link to trigger the download
109-
document.body.appendChild(downloadLink);
110-
downloadLink.click();
111-
document.body.removeChild(downloadLink);
112-
113-
// Download changeset link
114-
var changeset = new osmChangeset().update({ id: undefined });
115-
var changes = history.changes(actionDiscardTags(history.difference(), _discardTags));
116-
117-
delete changeset.id; // Export without chnageset_id
118-
119-
var data = JXON.stringify(changeset.osmChangeJXON(changes));
120-
var blob2 = new Blob([data], {type: 'text/xml;charset=utf-8;'});
121-
122-
const link = document.createElement('a');
123-
link.href = URL.createObjectURL(blob2);
124-
link.download = 'changeset.osc';
125-
link.click();
126-
127-
// Clean up the created URL object
128-
URL.revokeObjectURL(link.href);
129-
130-
context.enter(modeBrowse(context));
13136
}
13237
}
13338

@@ -166,6 +71,7 @@ export function uiToolSave(context) {
16671
}
16772
}
16873

74+
16975
tool.render = function(selection) {
17076
tooltipBehavior = uiTooltip()
17177
.placement('bottom')
@@ -248,3 +154,4 @@ export function uiToolSave(context) {
248154

249155
return tool;
250156
}
157+

0 commit comments

Comments
 (0)