From 0cdd77d696d4f14d814592824b3a736626f1cffd Mon Sep 17 00:00:00 2001 From: Toby Murray Date: Sun, 22 Oct 2017 17:25:19 -0500 Subject: [PATCH 1/6] Adding field presets for transformers Addresses #4442 --- data/presets/fields/devices.json | 6 ++++++ data/presets/fields/phases.json | 6 ++++++ data/presets/fields/rating.json | 6 ++++++ data/presets/fields/transformer.json | 17 +++++++++++++++++ data/presets/fields/voltage/primary.json | 6 ++++++ data/presets/fields/voltage/secondary.json | 6 ++++++ data/presets/fields/voltage/tertiary.json | 6 ++++++ data/presets/fields/windings.json | 6 ++++++ data/presets/fields/windings/configuration.json | 16 ++++++++++++++++ data/presets/presets/power/transformer.json | 12 ++++++++++++ 10 files changed, 87 insertions(+) create mode 100644 data/presets/fields/devices.json create mode 100644 data/presets/fields/phases.json create mode 100644 data/presets/fields/rating.json create mode 100644 data/presets/fields/transformer.json create mode 100644 data/presets/fields/voltage/primary.json create mode 100644 data/presets/fields/voltage/secondary.json create mode 100644 data/presets/fields/voltage/tertiary.json create mode 100644 data/presets/fields/windings.json create mode 100644 data/presets/fields/windings/configuration.json diff --git a/data/presets/fields/devices.json b/data/presets/fields/devices.json new file mode 100644 index 000000000..0327c5878 --- /dev/null +++ b/data/presets/fields/devices.json @@ -0,0 +1,6 @@ +{ + "key": "devices", + "type": "number", + "label": "Number of devices", + "placeholder": "2" +} diff --git a/data/presets/fields/phases.json b/data/presets/fields/phases.json new file mode 100644 index 000000000..c4f4cd2c9 --- /dev/null +++ b/data/presets/fields/phases.json @@ -0,0 +1,6 @@ +{ + "key": "phases", + "type": "number", + "label": "Number of phases", + "placeholder": "3" +} diff --git a/data/presets/fields/rating.json b/data/presets/fields/rating.json new file mode 100644 index 000000000..b6122b52b --- /dev/null +++ b/data/presets/fields/rating.json @@ -0,0 +1,6 @@ +{ + "key": "rating", + "type": "number", + "label": "VA Rating", + "placeholder": "32000" +} diff --git a/data/presets/fields/transformer.json b/data/presets/fields/transformer.json new file mode 100644 index 000000000..6c5d18d03 --- /dev/null +++ b/data/presets/fields/transformer.json @@ -0,0 +1,17 @@ +{ + "key": "transformer", + "type": "combo", + "label": "Type of transformer", + "strings": { + "options": { + "distribution": "Distribution", + "generator": "Generator", + "converter": "Converter", + "traction": "Traction", + "auto": "Autotransformer", + "phase_angle_regulator": "Phase angle regulator", + "auxiliary": "Auxiliarty", + "yes": "Unknown" + } + } +} diff --git a/data/presets/fields/voltage/primary.json b/data/presets/fields/voltage/primary.json new file mode 100644 index 000000000..6c5396682 --- /dev/null +++ b/data/presets/fields/voltage/primary.json @@ -0,0 +1,6 @@ +{ + "key": "voltage:primary", + "type": "number", + "label": "Primary Voltage", + "placeholder": "225000" +} \ No newline at end of file diff --git a/data/presets/fields/voltage/secondary.json b/data/presets/fields/voltage/secondary.json new file mode 100644 index 000000000..f75b30c53 --- /dev/null +++ b/data/presets/fields/voltage/secondary.json @@ -0,0 +1,6 @@ +{ + "key": "voltage:secondary", + "type": "number", + "label": "Secondary Voltage", + "placeholder": "225000" +} \ No newline at end of file diff --git a/data/presets/fields/voltage/tertiary.json b/data/presets/fields/voltage/tertiary.json new file mode 100644 index 000000000..589c10a91 --- /dev/null +++ b/data/presets/fields/voltage/tertiary.json @@ -0,0 +1,6 @@ +{ + "key": "voltage:tertiary", + "type": "number", + "label": "Tertiary Voltage", + "placeholder": "225000" +} \ No newline at end of file diff --git a/data/presets/fields/windings.json b/data/presets/fields/windings.json new file mode 100644 index 000000000..1b641d7a9 --- /dev/null +++ b/data/presets/fields/windings.json @@ -0,0 +1,6 @@ +{ + "key": "windings", + "type": "number", + "label": "Number of windings", + "placeholder": "3" +} diff --git a/data/presets/fields/windings/configuration.json b/data/presets/fields/windings/configuration.json new file mode 100644 index 000000000..e5806da47 --- /dev/null +++ b/data/presets/fields/windings/configuration.json @@ -0,0 +1,16 @@ +{ + "key": "windings:configuration", + "type": "combo", + "label": "Windings configuration", + "strings": { + "options": { + "star": "Star", + "delta": "Delta", + "open-delta": "Open delta", + "zigzag": "Zig zag", + "open": "Open", + "scott": "Scott", + "leblanc": "Leblanc" + } + } +} diff --git a/data/presets/presets/power/transformer.json b/data/presets/presets/power/transformer.json index aa1bb5104..2f2a3e8a6 100644 --- a/data/presets/presets/power/transformer.json +++ b/data/presets/presets/power/transformer.json @@ -1,5 +1,17 @@ { "icon": "poi-power", + "fields": [ + "transformer", + "location", + "phases", + "voltage/primary", + "voltage/secondary", + "voltage/tertiary", + "windings", + "windings/configuration", + "rating", + "devices" + ], "geometry": [ "point", "vertex", From 48f2b598fb1bd1e3b19d0f69d3e1a11ef7ce5098 Mon Sep 17 00:00:00 2001 From: Toby Murray Date: Mon, 23 Oct 2017 23:10:45 -0500 Subject: [PATCH 2/6] Tweaking transformer presets Title casing labels and adding the frequency field --- data/presets/fields/devices.json | 2 +- data/presets/fields/frequency.json | 6 ++++++ data/presets/fields/phases.json | 2 +- data/presets/fields/transformer.json | 4 ++-- data/presets/fields/voltage/secondary.json | 2 +- data/presets/fields/voltage/tertiary.json | 2 +- data/presets/fields/windings.json | 2 +- data/presets/fields/windings/configuration.json | 6 +++--- data/presets/presets/power/transformer.json | 1 + 9 files changed, 17 insertions(+), 10 deletions(-) create mode 100644 data/presets/fields/frequency.json diff --git a/data/presets/fields/devices.json b/data/presets/fields/devices.json index 0327c5878..95f33fa9e 100644 --- a/data/presets/fields/devices.json +++ b/data/presets/fields/devices.json @@ -1,6 +1,6 @@ { "key": "devices", "type": "number", - "label": "Number of devices", + "label": "Number of Devices", "placeholder": "2" } diff --git a/data/presets/fields/frequency.json b/data/presets/fields/frequency.json new file mode 100644 index 000000000..a5460f8dc --- /dev/null +++ b/data/presets/fields/frequency.json @@ -0,0 +1,6 @@ +{ + "key": "frequency", + "type": "number", + "label": "Operating Frequency", + "placeholder": "50" +} diff --git a/data/presets/fields/phases.json b/data/presets/fields/phases.json index c4f4cd2c9..0c7ae5c6b 100644 --- a/data/presets/fields/phases.json +++ b/data/presets/fields/phases.json @@ -1,6 +1,6 @@ { "key": "phases", "type": "number", - "label": "Number of phases", + "label": "Number of Phases", "placeholder": "3" } diff --git a/data/presets/fields/transformer.json b/data/presets/fields/transformer.json index 6c5d18d03..b4f877ffc 100644 --- a/data/presets/fields/transformer.json +++ b/data/presets/fields/transformer.json @@ -1,7 +1,7 @@ { "key": "transformer", "type": "combo", - "label": "Type of transformer", + "label": "Type of Transformer", "strings": { "options": { "distribution": "Distribution", @@ -9,7 +9,7 @@ "converter": "Converter", "traction": "Traction", "auto": "Autotransformer", - "phase_angle_regulator": "Phase angle regulator", + "phase_angle_regulator": "Phase Angle Regulator", "auxiliary": "Auxiliarty", "yes": "Unknown" } diff --git a/data/presets/fields/voltage/secondary.json b/data/presets/fields/voltage/secondary.json index f75b30c53..f0cf632e3 100644 --- a/data/presets/fields/voltage/secondary.json +++ b/data/presets/fields/voltage/secondary.json @@ -2,5 +2,5 @@ "key": "voltage:secondary", "type": "number", "label": "Secondary Voltage", - "placeholder": "225000" + "placeholder": "400" } \ No newline at end of file diff --git a/data/presets/fields/voltage/tertiary.json b/data/presets/fields/voltage/tertiary.json index 589c10a91..8e733d541 100644 --- a/data/presets/fields/voltage/tertiary.json +++ b/data/presets/fields/voltage/tertiary.json @@ -2,5 +2,5 @@ "key": "voltage:tertiary", "type": "number", "label": "Tertiary Voltage", - "placeholder": "225000" + "placeholder": "20000" } \ No newline at end of file diff --git a/data/presets/fields/windings.json b/data/presets/fields/windings.json index 1b641d7a9..7de9817dd 100644 --- a/data/presets/fields/windings.json +++ b/data/presets/fields/windings.json @@ -1,6 +1,6 @@ { "key": "windings", "type": "number", - "label": "Number of windings", + "label": "Number of Windings", "placeholder": "3" } diff --git a/data/presets/fields/windings/configuration.json b/data/presets/fields/windings/configuration.json index e5806da47..7b682d4b7 100644 --- a/data/presets/fields/windings/configuration.json +++ b/data/presets/fields/windings/configuration.json @@ -1,13 +1,13 @@ { "key": "windings:configuration", "type": "combo", - "label": "Windings configuration", + "label": "Windings Configuration", "strings": { "options": { "star": "Star", "delta": "Delta", - "open-delta": "Open delta", - "zigzag": "Zig zag", + "open-delta": "Open Delta", + "zigzag": "Zig Zag", "open": "Open", "scott": "Scott", "leblanc": "Leblanc" diff --git a/data/presets/presets/power/transformer.json b/data/presets/presets/power/transformer.json index 2f2a3e8a6..303eeb10a 100644 --- a/data/presets/presets/power/transformer.json +++ b/data/presets/presets/power/transformer.json @@ -4,6 +4,7 @@ "transformer", "location", "phases", + "frequency", "voltage/primary", "voltage/secondary", "voltage/tertiary", From 983b2468c2a52b22393a3d80e18596cc30dad514 Mon Sep 17 00:00:00 2001 From: Toby Murray Date: Mon, 23 Oct 2017 23:17:37 -0500 Subject: [PATCH 3/6] Adding transformer presets to generated files --- data/presets.yaml | 78 +++++++++++++++++++++++++++++++++++++ data/presets/fields.json | 81 +++++++++++++++++++++++++++++++++++++++ data/presets/presets.json | 13 +++++++ dist/locales/en.json | 57 +++++++++++++++++++++++++++ 4 files changed, 229 insertions(+) diff --git a/data/presets.yaml b/data/presets.yaml index e2237c081..533ac8d9d 100644 --- a/data/presets.yaml +++ b/data/presets.yaml @@ -450,6 +450,11 @@ en: description: # description=* label: Description + devices: + # devices=* + label: Number of Devices + # devices field placeholder + placeholder: '2' diaper: # diaper=* label: Diaper Changing Available @@ -546,6 +551,11 @@ en: label: Type # ford field placeholder placeholder: Default + frequency: + # frequency=* + label: Operating Frequency + # frequency field placeholder + placeholder: '50' fuel: # fuel=* label: Fuel @@ -977,6 +987,11 @@ en: payment_multi: # 'payment:=*' label: Payment Types + phases: + # phases=* + label: Number of Phases + # phases field placeholder + placeholder: '3' phone: # phone=* label: Phone @@ -1078,6 +1093,11 @@ en: railway: # railway=* label: Type + rating: + # rating=* + label: VA Rating + # rating field placeholder + placeholder: '32000' recycling_accepts: # 'recycling:=*' label: Accepts @@ -1443,6 +1463,26 @@ en: 'no': 'No: pathless, excellent orientation skills required' # trail_visibility field placeholder placeholder: 'Excellent, Good, Bad...' + transformer: + # transformer=* + label: Type of Transformer + options: + # transformer=auto + auto: Autotransformer + # transformer=auxiliary + auxiliary: Auxiliarty + # transformer=converter + converter: Converter + # transformer=distribution + distribution: Distribution + # transformer=generator + generator: Generator + # transformer=phase_angle_regulator + phase_angle_regulator: Phase Angle Regulator + # transformer=traction + traction: Traction + # transformer=yes + 'yes': Unknown trees: # trees=* label: Trees @@ -1484,6 +1524,21 @@ en: shield: Shield # 'volcano:type=stratovolcano' stratovolcano: Stratovolcano + voltage/primary: + # 'voltage:primary=*' + label: Primary Voltage + # voltage/primary field placeholder + placeholder: '225000' + voltage/secondary: + # 'voltage:secondary=*' + label: Secondary Voltage + # voltage/secondary field placeholder + placeholder: '400' + voltage/tertiary: + # 'voltage:tertiary=*' + label: Tertiary Voltage + # voltage/tertiary field placeholder + placeholder: '20000' wall: # wall=* label: Type @@ -1513,6 +1568,29 @@ en: wikipedia: # 'wikipedia=*, wikidata=*' label: Wikipedia + windings: + # windings=* + label: Number of Windings + # windings field placeholder + placeholder: '3' + windings/configuration: + # 'windings:configuration=*' + label: Windings Configuration + options: + # 'windings:configuration=delta' + delta: Delta + # 'windings:configuration=leblanc' + leblanc: Leblanc + # 'windings:configuration=open' + open: Open + # 'windings:configuration=open-delta' + open-delta: Open Delta + # 'windings:configuration=scott' + scott: Scott + # 'windings:configuration=star' + star: Star + # 'windings:configuration=zigzag' + zigzag: Zig Zag presets: address: # 'addr:*=*' diff --git a/data/presets/fields.json b/data/presets/fields.json index 5ed5f7172..0948c1ad5 100644 --- a/data/presets/fields.json +++ b/data/presets/fields.json @@ -594,6 +594,12 @@ "label": "Description", "universal": true }, + "devices": { + "key": "devices", + "type": "number", + "label": "Number of Devices", + "placeholder": "2" + }, "diaper": { "key": "diaper", "type": "combo", @@ -740,6 +746,12 @@ "label": "Type", "placeholder": "Default" }, + "frequency": { + "key": "frequency", + "type": "number", + "label": "Operating Frequency", + "placeholder": "50" + }, "fuel_multi": { "key": "fuel:", "type": "multiCombo", @@ -1316,6 +1328,12 @@ "type": "multiCombo", "label": "Payment Types" }, + "phases": { + "key": "phases", + "type": "number", + "label": "Number of Phases", + "placeholder": "3" + }, "phone": { "key": "phone", "type": "tel", @@ -1435,6 +1453,12 @@ "type": "typeCombo", "label": "Type" }, + "rating": { + "key": "rating", + "type": "number", + "label": "VA Rating", + "placeholder": "32000" + }, "recycling_accepts": { "key": "recycling:", "type": "multiCombo", @@ -1964,6 +1988,23 @@ } } }, + "transformer": { + "key": "transformer", + "type": "combo", + "label": "Type of Transformer", + "strings": { + "options": { + "distribution": "Distribution", + "generator": "Generator", + "converter": "Converter", + "traction": "Traction", + "auto": "Autotransformer", + "phase_angle_regulator": "Phase Angle Regulator", + "auxiliary": "Auxiliarty", + "yes": "Unknown" + } + } + }, "trees": { "key": "trees", "type": "semiCombo", @@ -2016,6 +2057,24 @@ } } }, + "voltage/primary": { + "key": "voltage:primary", + "type": "number", + "label": "Primary Voltage", + "placeholder": "225000" + }, + "voltage/secondary": { + "key": "voltage:secondary", + "type": "number", + "label": "Secondary Voltage", + "placeholder": "400" + }, + "voltage/tertiary": { + "key": "voltage:tertiary", + "type": "number", + "label": "Tertiary Voltage", + "placeholder": "20000" + }, "wall": { "key": "wall", "type": "combo", @@ -2076,6 +2135,28 @@ "icon": "wikipedia", "universal": true, "label": "Wikipedia" + }, + "windings": { + "key": "windings", + "type": "number", + "label": "Number of Windings", + "placeholder": "3" + }, + "windings/configuration": { + "key": "windings:configuration", + "type": "combo", + "label": "Windings Configuration", + "strings": { + "options": { + "star": "Star", + "delta": "Delta", + "open-delta": "Open Delta", + "zigzag": "Zig Zag", + "open": "Open", + "scott": "Scott", + "leblanc": "Leblanc" + } + } } } } \ No newline at end of file diff --git a/data/presets/presets.json b/data/presets/presets.json index 1a2bf1834..faaac37b6 100644 --- a/data/presets/presets.json +++ b/data/presets/presets.json @@ -11978,6 +11978,19 @@ }, "power/transformer": { "icon": "poi-power", + "fields": [ + "transformer", + "location", + "phases", + "frequency", + "voltage/primary", + "voltage/secondary", + "voltage/tertiary", + "windings", + "windings/configuration", + "rating", + "devices" + ], "geometry": [ "point", "vertex", diff --git a/dist/locales/en.json b/dist/locales/en.json index 27fc61168..b9c038fae 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -1472,6 +1472,10 @@ "description": { "label": "Description" }, + "devices": { + "label": "Number of Devices", + "placeholder": "2" + }, "diaper": { "label": "Diaper Changing Available" }, @@ -1553,6 +1557,10 @@ "label": "Type", "placeholder": "Default" }, + "frequency": { + "label": "Operating Frequency", + "placeholder": "50" + }, "fuel_multi": { "label": "Fuel Types" }, @@ -1911,6 +1919,10 @@ "payment_multi": { "label": "Payment Types" }, + "phases": { + "label": "Number of Phases", + "placeholder": "3" + }, "phone": { "label": "Phone", "placeholder": "+31 42 123 4567" @@ -1990,6 +2002,10 @@ "railway": { "label": "Type" }, + "rating": { + "label": "VA Rating", + "placeholder": "32000" + }, "recycling_accepts": { "label": "Accepts" }, @@ -2299,6 +2315,19 @@ "no": "No: pathless, excellent orientation skills required" } }, + "transformer": { + "label": "Type of Transformer", + "options": { + "distribution": "Distribution", + "generator": "Generator", + "converter": "Converter", + "traction": "Traction", + "auto": "Autotransformer", + "phase_angle_regulator": "Phase Angle Regulator", + "auxiliary": "Auxiliarty", + "yes": "Unknown" + } + }, "trees": { "label": "Trees" }, @@ -2333,6 +2362,18 @@ "scoria": "Scoria" } }, + "voltage/primary": { + "label": "Primary Voltage", + "placeholder": "225000" + }, + "voltage/secondary": { + "label": "Secondary Voltage", + "placeholder": "400" + }, + "voltage/tertiary": { + "label": "Tertiary Voltage", + "placeholder": "20000" + }, "wall": { "label": "Type" }, @@ -2360,6 +2401,22 @@ }, "wikipedia": { "label": "Wikipedia" + }, + "windings": { + "label": "Number of Windings", + "placeholder": "3" + }, + "windings/configuration": { + "label": "Windings Configuration", + "options": { + "star": "Star", + "delta": "Delta", + "open-delta": "Open Delta", + "zigzag": "Zig Zag", + "open": "Open", + "scott": "Scott", + "leblanc": "Leblanc" + } } }, "presets": { From c40f242b825c4a721db1ff417ad6e9c3cdace073 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Tue, 24 Oct 2017 15:38:52 -0400 Subject: [PATCH 4/6] Depend on bhousel/node-diff3 which includes fix for hunk sorting bug (closes #3544, closes #3058) --- modules/actions/merge_remote_changes.js | 6 +- modules/util/diff3.js | 421 ------------------------ package.json | 1 + test/index.html | 1 - test/spec/lib/diff3.js | 90 ----- 5 files changed, 4 insertions(+), 515 deletions(-) delete mode 100644 modules/util/diff3.js delete mode 100644 test/spec/lib/diff3.js diff --git a/modules/actions/merge_remote_changes.js b/modules/actions/merge_remote_changes.js index b842f3322..71412bf00 100644 --- a/modules/actions/merge_remote_changes.js +++ b/modules/actions/merge_remote_changes.js @@ -9,10 +9,10 @@ import _union from 'lodash-es/union'; import _uniq from 'lodash-es/uniq'; import _without from 'lodash-es/without'; +import { diff3Merge } from 'node-diff3'; import { t } from '../util/locale'; import { actionDeleteMultiple } from './delete_multiple'; import { osmEntity } from '../osm'; -import { diff3_merge } from '../util/diff3'; import { dataDiscarded } from '../../data'; @@ -57,7 +57,7 @@ export function actionMergeRemoteChanges(id, localGraph, remoteGraph, formatUser a = target.nodes || [], b = remote.nodes || [], nodes = [], - hunks = diff3_merge(a, o, b, true); + hunks = diff3Merge(a, o, b, true); for (var i = 0; i < hunks.length; i++) { var hunk = hunks[i]; @@ -65,7 +65,7 @@ export function actionMergeRemoteChanges(id, localGraph, remoteGraph, formatUser nodes.push.apply(nodes, hunk.ok); } else { // for all conflicts, we can assume c.a !== c.b - // because `diff3_merge` called with `true` option to exclude false conflicts.. + // because `diff3Merge` called with `true` option to exclude false conflicts.. var c = hunk.conflict; if (_isEqual(c.o, c.a)) { // only changed remotely nodes.push.apply(nodes, c.b); diff --git a/modules/util/diff3.js b/modules/util/diff3.js deleted file mode 100644 index d36371a14..000000000 --- a/modules/util/diff3.js +++ /dev/null @@ -1,421 +0,0 @@ -// Copyright (c) 2006, 2008 Tony Garnock-Jones -// Copyright (c) 2006, 2008 LShift Ltd. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation files -// (the "Software"), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -// source: https://bitbucket.org/lshift/synchrotron/src -export function longest_common_subsequence(file1, file2) { - /* Text diff algorithm following Hunt and McIlroy 1976. - * J. W. Hunt and M. D. McIlroy, An algorithm for differential file - * comparison, Bell Telephone Laboratories CSTR #41 (1976) - * http://www.cs.dartmouth.edu/~doug/ - * - * Expects two arrays of strings. - */ - var equivalenceClasses; - var file2indices; - var newCandidate; - var candidates; - var line; - var c, i, j, jX, r, s; - - equivalenceClasses = {}; - for (j = 0; j < file2.length; j++) { - line = file2[j]; - if (equivalenceClasses[line]) { - equivalenceClasses[line].push(j); - } else { - equivalenceClasses[line] = [j]; - } - } - - candidates = [{file1index: -1, - file2index: -1, - chain: null}]; - - for (i = 0; i < file1.length; i++) { - line = file1[i]; - file2indices = equivalenceClasses[line] || []; - - r = 0; - c = candidates[0]; - - for (jX = 0; jX < file2indices.length; jX++) { - j = file2indices[jX]; - - for (s = 0; s < candidates.length; s++) { - if ((candidates[s].file2index < j) && - ((s === candidates.length - 1) || - (candidates[s + 1].file2index > j))) - break; - } - - if (s < candidates.length) { - newCandidate = {file1index: i, - file2index: j, - chain: candidates[s]}; - if (r === candidates.length) { - candidates.push(c); - } else { - candidates[r] = c; - } - r = s + 1; - c = newCandidate; - if (r === candidates.length) { - break; // no point in examining further (j)s - } - } - } - - candidates[r] = c; - } - - // At this point, we know the LCS: it's in the reverse of the - // linked-list through .chain of - // candidates[candidates.length - 1]. - - return candidates[candidates.length - 1]; -} - -export function diff_comm(file1, file2) { - // We apply the LCS to build a "comm"-style picture of the - // differences between file1 and file2. - - var result = []; - var tail1 = file1.length; - var tail2 = file2.length; - var common = {common: []}; - - function processCommon() { - if (common.common.length) { - common.common.reverse(); - result.push(common); - common = {common: []}; - } - } - - for (var candidate = longest_common_subsequence(file1, file2); - candidate !== null; - candidate = candidate.chain) - { - var different = {file1: [], file2: []}; - - while (--tail1 > candidate.file1index) { - different.file1.push(file1[tail1]); - } - - while (--tail2 > candidate.file2index) { - different.file2.push(file2[tail2]); - } - - if (different.file1.length || different.file2.length) { - processCommon(); - different.file1.reverse(); - different.file2.reverse(); - result.push(different); - } - - if (tail1 >= 0) { - common.common.push(file1[tail1]); - } - } - - processCommon(); - - result.reverse(); - return result; -} - -export function diff_patch(file1, file2) { - // We apply the LCD to build a JSON representation of a - // diff(1)-style patch. - - var result = []; - var tail1 = file1.length; - var tail2 = file2.length; - - function chunkDescription(file, offset, length) { - var chunk = []; - for (var i = 0; i < length; i++) { - chunk.push(file[offset + i]); - } - return {offset: offset, - length: length, - chunk: chunk}; - } - - for (var candidate = longest_common_subsequence(file1, file2); - candidate !== null; - candidate = candidate.chain) - { - var mismatchLength1 = tail1 - candidate.file1index - 1; - var mismatchLength2 = tail2 - candidate.file2index - 1; - tail1 = candidate.file1index; - tail2 = candidate.file2index; - - if (mismatchLength1 || mismatchLength2) { - result.push({file1: chunkDescription(file1, - candidate.file1index + 1, - mismatchLength1), - file2: chunkDescription(file2, - candidate.file2index + 1, - mismatchLength2)}); - } - } - - result.reverse(); - return result; -} - -export function strip_patch(patch) { - // Takes the output of Diff3.diff_patch(), and removes - // information from it. It can still be used by patch(), - // below, but can no longer be inverted. - var newpatch = []; - for (var i = 0; i < patch.length; i++) { - var chunk = patch[i]; - newpatch.push({file1: {offset: chunk.file1.offset, - length: chunk.file1.length}, - file2: {chunk: chunk.file2.chunk}}); - } - return newpatch; -} - -export function invert_patch (patch) { - // Takes the output of Diff3.diff_patch(), and inverts the - // sense of it, so that it can be applied to file2 to give - // file1 rather than the other way around. - - for (var i = 0; i < patch.length; i++) { - var chunk = patch[i]; - var tmp = chunk.file1; - chunk.file1 = chunk.file2; - chunk.file2 = tmp; - } -} - -export function patch (file, patch) { - // Applies a patch to a file. - // - // Given file1 and file2, Diff3.patch(file1, - // Diff3.diff_patch(file1, file2)) should give file2. - - var result = []; - var commonOffset = 0; - - function copyCommon(targetOffset) { - while (commonOffset < targetOffset) { - result.push(file[commonOffset]); - commonOffset++; - } - } - - for (var chunkIndex = 0; chunkIndex < patch.length; chunkIndex++) { - var chunk = patch[chunkIndex]; - copyCommon(chunk.file1.offset); - for (var lineIndex = 0; lineIndex < chunk.file2.chunk.length; lineIndex++) { - result.push(chunk.file2.chunk[lineIndex]); - } - commonOffset += chunk.file1.length; - } - - copyCommon(file.length); - return result; -} - -export function diff_indices(file1, file2) { - // We apply the LCS to give a simple representation of the - // offsets and lengths of mismatched chunks in the input - // files. This is used by diff3_merge_indices below. - - var result = []; - var tail1 = file1.length; - var tail2 = file2.length; - - for (var candidate = longest_common_subsequence(file1, file2); - candidate !== null; - candidate = candidate.chain) - { - var mismatchLength1 = tail1 - candidate.file1index - 1; - var mismatchLength2 = tail2 - candidate.file2index - 1; - tail1 = candidate.file1index; - tail2 = candidate.file2index; - - if (mismatchLength1 || mismatchLength2) { - result.push({file1: [tail1 + 1, mismatchLength1], - file2: [tail2 + 1, mismatchLength2]}); - } - } - - result.reverse(); - return result; -} - -export function diff3_merge_indices (a, o, b) { - // Given three files, A, O, and B, where both A and B are - // independently derived from O, returns a fairly complicated - // internal representation of merge decisions it's taken. The - // interested reader may wish to consult - // - // Sanjeev Khanna, Keshav Kunal, and Benjamin C. Pierce. "A - // Formal Investigation of Diff3." In Arvind and Prasad, - // editors, Foundations of Software Technology and Theoretical - // Computer Science (FSTTCS), December 2007. - // - // (http://www.cis.upenn.edu/~bcpierce/papers/diff3-short.pdf) - var i; - - var m1 = diff_indices(o, a); - var m2 = diff_indices(o, b); - - var hunks = []; - function addHunk(h, side) { - hunks.push([h.file1[0], side, h.file1[1], h.file2[0], h.file2[1]]); - } - for (i = 0; i < m1.length; i++) { addHunk(m1[i], 0); } - for (i = 0; i < m2.length; i++) { addHunk(m2[i], 2); } - hunks.sort(); - - var result = []; - var commonOffset = 0; - function copyCommon(targetOffset) { - if (targetOffset > commonOffset) { - result.push([1, commonOffset, targetOffset - commonOffset]); - commonOffset = targetOffset; - } - } - - for (var hunkIndex = 0; hunkIndex < hunks.length; hunkIndex++) { - var firstHunkIndex = hunkIndex; - var hunk = hunks[hunkIndex]; - var regionLhs = hunk[0]; - var regionRhs = regionLhs + hunk[2]; - while (hunkIndex < hunks.length - 1) { - var maybeOverlapping = hunks[hunkIndex + 1]; - var maybeLhs = maybeOverlapping[0]; - if (maybeLhs > regionRhs) break; - regionRhs = maybeLhs + maybeOverlapping[2]; - hunkIndex++; - } - - copyCommon(regionLhs); - if (firstHunkIndex === hunkIndex) { - // The "overlap" was only one hunk long, meaning that - // there's no conflict here. Either a and o were the - // same, or b and o were the same. - if (hunk[4] > 0) { - result.push([hunk[1], hunk[3], hunk[4]]); - } - } else { - // A proper conflict. Determine the extents of the - // regions involved from a, o and b. Effectively merge - // all the hunks on the left into one giant hunk, and - // do the same for the right; then, correct for skew - // in the regions of o that each side changed, and - // report appropriate spans for the three sides. - var regions = { - 0: [a.length, -1, o.length, -1], - 2: [b.length, -1, o.length, -1] - }; - for (i = firstHunkIndex; i <= hunkIndex; i++) { - hunk = hunks[i]; - var side = hunk[1]; - var r = regions[side]; - var oLhs = hunk[0]; - var oRhs = oLhs + hunk[2]; - var abLhs = hunk[3]; - var abRhs = abLhs + hunk[4]; - r[0] = Math.min(abLhs, r[0]); - r[1] = Math.max(abRhs, r[1]); - r[2] = Math.min(oLhs, r[2]); - r[3] = Math.max(oRhs, r[3]); - } - var aLhs = regions[0][0] + (regionLhs - regions[0][2]); - var aRhs = regions[0][1] + (regionRhs - regions[0][3]); - var bLhs = regions[2][0] + (regionLhs - regions[2][2]); - var bRhs = regions[2][1] + (regionRhs - regions[2][3]); - result.push([-1, - aLhs, aRhs - aLhs, - regionLhs, regionRhs - regionLhs, - bLhs, bRhs - bLhs]); - } - commonOffset = regionRhs; - } - - copyCommon(o.length); - return result; -} - -export function diff3_merge (a, o, b, excludeFalseConflicts) { - // Applies the output of Diff3.diff3_merge_indices to actually - // construct the merged file; the returned result alternates - // between "ok" and "conflict" blocks. - - var result = []; - var files = [a, o, b]; - var indices = diff3_merge_indices(a, o, b); - - var okLines = []; - function flushOk() { - if (okLines.length) { - result.push({ok: okLines}); - } - okLines = []; - } - function pushOk(xs) { - for (var j = 0; j < xs.length; j++) { - okLines.push(xs[j]); - } - } - - function isTrueConflict(rec) { - if (rec[2] !== rec[6]) return true; - var aoff = rec[1]; - var boff = rec[5]; - for (var j = 0; j < rec[2]; j++) { - if (a[j + aoff] !== b[j + boff]) return true; - } - return false; - } - - for (var i = 0; i < indices.length; i++) { - var x = indices[i]; - var side = x[0]; - if (side === -1) { - if (excludeFalseConflicts && !isTrueConflict(x)) { - pushOk(files[0].slice(x[1], x[1] + x[2])); - } else { - flushOk(); - result.push({conflict: {a: a.slice(x[1], x[1] + x[2]), - aIndex: x[1], - o: o.slice(x[3], x[3] + x[4]), - oIndex: x[3], - b: b.slice(x[5], x[5] + x[6]), - bIndex: x[5]}}); - } - } else { - pushOk(files[side].slice(x[1], x[1] + x[2])); - } - } - - flushOk(); - return result; -} diff --git a/package.json b/package.json index 57b4e1727..0803814e9 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "diacritics": "1.3.0", "lodash-es": "4.17.4", "marked": "0.3.6", + "node-diff3": "bhousel/node-diff3.git#v0.1.0", "osm-auth": "1.0.2", "rbush": "2.0.1", "wmf-sitematrix": "0.1.4" diff --git a/test/index.html b/test/index.html index 4d4ca1b70..c391ca88e 100644 --- a/test/index.html +++ b/test/index.html @@ -77,7 +77,6 @@ - diff --git a/test/spec/lib/diff3.js b/test/spec/lib/diff3.js deleted file mode 100644 index 588b5bbdf..000000000 --- a/test/spec/lib/diff3.js +++ /dev/null @@ -1,90 +0,0 @@ -/* global Diff3:false */ -describe('diff3', function() { - function split(s) { - return s ? s.split(/ /) : []; - } - - it('performs diff3 merge', function() { - var o = split('AA ZZ 00 M 99'), - a = split('AA a b c ZZ new 00 a a M 99'), - b = split('AA a d c ZZ 11 M z z 99'), - res = Diff3.diff3_merge(a, o, b); - - /* - AA - <<<<<<< a - a - b - c - ||||||| o - ======= - a - d - c - >>>>>>> b - ZZ - <<<<<<< a - new - 00 - a - a - ||||||| o - 00 - ======= - 11 - >>>>>>> b - M - z - z - 99 - */ - - expect(res[0].ok).to.eql(['AA']); - expect(res[0].conflict).to.be.undefined; - - expect(res[1].ok).to.be.undefined; - expect(res[1].conflict.o).to.eql([]); - expect(res[1].conflict.a).to.eql(['a', 'b', 'c']); - expect(res[1].conflict.b).to.eql(['a', 'd', 'c']); - - expect(res[2].ok).to.eql(['ZZ']); - expect(res[2].conflict).to.be.undefined; - - expect(res[3].ok).to.be.undefined; - expect(res[3].conflict.o).to.eql(['00']); - expect(res[3].conflict.a).to.eql(['new', '00', 'a', 'a']); - expect(res[3].conflict.b).to.eql(['11']); - - expect(res[4].ok).to.eql(['M', 'z', 'z', '99']); - expect(res[4].conflict).to.be.undefined; - }); - - it('can include false conflicts', function() { - var o = split('AA ZZ'), - a = split('AA a b c ZZ'), - b = split('AA a b c ZZ'), - res = Diff3.diff3_merge(a, o, b, false); - - expect(res[0].ok).to.eql(['AA']); - expect(res[0].conflict).to.be.undefined; - - expect(res[1].ok).to.be.undefined; - expect(res[1].conflict.o).to.eql([]); - expect(res[1].conflict.a).to.eql(['a', 'b', 'c']); - expect(res[1].conflict.b).to.eql(['a', 'b', 'c']); - - expect(res[2].ok).to.eql(['ZZ']); - expect(res[2].conflict).to.be.undefined; - }); - - it('can exclude false conflicts', function() { - var o = split('AA ZZ'), - a = split('AA a b c ZZ'), - b = split('AA a b c ZZ'), - res = Diff3.diff3_merge(a, o, b, true); - - expect(res[0].ok).to.eql(['AA', 'a', 'b', 'c', 'ZZ']); - expect(res[0].conflict).to.be.undefined; - }); - -}); From 6ce617916664359e1c14000aa731a37bd9ad1b2e Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Tue, 24 Oct 2017 16:54:21 -0400 Subject: [PATCH 5/6] Rename label from "Star" -> "Star / Wye" --- data/presets.yaml | 2 +- data/presets/fields.json | 2 +- data/presets/fields/windings/configuration.json | 2 +- dist/locales/en.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/data/presets.yaml b/data/presets.yaml index e50b8b0a2..28fd481ae 100644 --- a/data/presets.yaml +++ b/data/presets.yaml @@ -1588,7 +1588,7 @@ en: # 'windings:configuration=scott' scott: Scott # 'windings:configuration=star' - star: Star + star: Star / Wye # 'windings:configuration=zigzag' zigzag: Zig Zag presets: diff --git a/data/presets/fields.json b/data/presets/fields.json index 0948c1ad5..93eae8bf9 100644 --- a/data/presets/fields.json +++ b/data/presets/fields.json @@ -2148,7 +2148,7 @@ "label": "Windings Configuration", "strings": { "options": { - "star": "Star", + "star": "Star / Wye", "delta": "Delta", "open-delta": "Open Delta", "zigzag": "Zig Zag", diff --git a/data/presets/fields/windings/configuration.json b/data/presets/fields/windings/configuration.json index 7b682d4b7..defe3ec2c 100644 --- a/data/presets/fields/windings/configuration.json +++ b/data/presets/fields/windings/configuration.json @@ -4,7 +4,7 @@ "label": "Windings Configuration", "strings": { "options": { - "star": "Star", + "star": "Star / Wye", "delta": "Delta", "open-delta": "Open Delta", "zigzag": "Zig Zag", diff --git a/dist/locales/en.json b/dist/locales/en.json index 40a3b10ad..c8518620f 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -2409,7 +2409,7 @@ "windings/configuration": { "label": "Windings Configuration", "options": { - "star": "Star", + "star": "Star / Wye", "delta": "Delta", "open-delta": "Open Delta", "zigzag": "Zig Zag", From be02b1c530fa70eb8c13478a2ad95db34f1395c4 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Tue, 24 Oct 2017 22:30:07 -0400 Subject: [PATCH 6/6] Better placeholders for electrical fields, switch some to combo --- data/presets.yaml | 18 +++--------- data/presets/fields.json | 32 +++++++++------------ data/presets/fields/devices.json | 2 +- data/presets/fields/frequency.json | 5 ++-- data/presets/fields/phases.json | 2 +- data/presets/fields/rating.json | 6 ++-- data/presets/fields/voltage/primary.json | 7 ++--- data/presets/fields/voltage/secondary.json | 7 ++--- data/presets/fields/voltage/tertiary.json | 7 ++--- data/presets/fields/windings.json | 2 +- data/presets/presets.json | 6 ++-- data/presets/presets/power/transformer.json | 6 ++-- dist/locales/en.json | 21 ++++++-------- modules/services/taginfo.js | 2 +- 14 files changed, 50 insertions(+), 73 deletions(-) diff --git a/data/presets.yaml b/data/presets.yaml index 28fd481ae..891e47e5f 100644 --- a/data/presets.yaml +++ b/data/presets.yaml @@ -454,7 +454,7 @@ en: # devices=* label: Number of Devices # devices field placeholder - placeholder: '2' + placeholder: '1, 2, 3...' diaper: # diaper=* label: Diaper Changing Available @@ -554,8 +554,6 @@ en: frequency: # frequency=* label: Operating Frequency - # frequency field placeholder - placeholder: '50' fuel: # fuel=* label: Fuel @@ -991,7 +989,7 @@ en: # phases=* label: Number of Phases # phases field placeholder - placeholder: '3' + placeholder: '1, 2, 3...' phone: # phone=* label: Phone @@ -1095,9 +1093,7 @@ en: label: Type rating: # rating=* - label: VA Rating - # rating field placeholder - placeholder: '32000' + label: Power Rating recycling_accepts: # 'recycling:=*' label: Accepts @@ -1527,18 +1523,12 @@ en: voltage/primary: # 'voltage:primary=*' label: Primary Voltage - # voltage/primary field placeholder - placeholder: '225000' voltage/secondary: # 'voltage:secondary=*' label: Secondary Voltage - # voltage/secondary field placeholder - placeholder: '400' voltage/tertiary: # 'voltage:tertiary=*' label: Tertiary Voltage - # voltage/tertiary field placeholder - placeholder: '20000' wall: # wall=* label: Type @@ -1572,7 +1562,7 @@ en: # windings=* label: Number of Windings # windings field placeholder - placeholder: '3' + placeholder: '1, 2, 3...' windings/configuration: # 'windings:configuration=*' label: Windings Configuration diff --git a/data/presets/fields.json b/data/presets/fields.json index 93eae8bf9..a71ff70ef 100644 --- a/data/presets/fields.json +++ b/data/presets/fields.json @@ -598,7 +598,7 @@ "key": "devices", "type": "number", "label": "Number of Devices", - "placeholder": "2" + "placeholder": "1, 2, 3..." }, "diaper": { "key": "diaper", @@ -748,9 +748,8 @@ }, "frequency": { "key": "frequency", - "type": "number", - "label": "Operating Frequency", - "placeholder": "50" + "type": "combo", + "label": "Operating Frequency" }, "fuel_multi": { "key": "fuel:", @@ -1332,7 +1331,7 @@ "key": "phases", "type": "number", "label": "Number of Phases", - "placeholder": "3" + "placeholder": "1, 2, 3..." }, "phone": { "key": "phone", @@ -1455,9 +1454,9 @@ }, "rating": { "key": "rating", - "type": "number", - "label": "VA Rating", - "placeholder": "32000" + "type": "combo", + "label": "Power Rating", + "snake_case": false }, "recycling_accepts": { "key": "recycling:", @@ -2059,21 +2058,18 @@ }, "voltage/primary": { "key": "voltage:primary", - "type": "number", - "label": "Primary Voltage", - "placeholder": "225000" + "type": "combo", + "label": "Primary Voltage" }, "voltage/secondary": { "key": "voltage:secondary", - "type": "number", - "label": "Secondary Voltage", - "placeholder": "400" + "type": "combo", + "label": "Secondary Voltage" }, "voltage/tertiary": { "key": "voltage:tertiary", - "type": "number", - "label": "Tertiary Voltage", - "placeholder": "20000" + "type": "combo", + "label": "Tertiary Voltage" }, "wall": { "key": "wall", @@ -2140,7 +2136,7 @@ "key": "windings", "type": "number", "label": "Number of Windings", - "placeholder": "3" + "placeholder": "1, 2, 3..." }, "windings/configuration": { "key": "windings:configuration", diff --git a/data/presets/fields/devices.json b/data/presets/fields/devices.json index 95f33fa9e..d2f35f22e 100644 --- a/data/presets/fields/devices.json +++ b/data/presets/fields/devices.json @@ -2,5 +2,5 @@ "key": "devices", "type": "number", "label": "Number of Devices", - "placeholder": "2" + "placeholder": "1, 2, 3..." } diff --git a/data/presets/fields/frequency.json b/data/presets/fields/frequency.json index a5460f8dc..97246994d 100644 --- a/data/presets/fields/frequency.json +++ b/data/presets/fields/frequency.json @@ -1,6 +1,5 @@ { "key": "frequency", - "type": "number", - "label": "Operating Frequency", - "placeholder": "50" + "type": "combo", + "label": "Operating Frequency" } diff --git a/data/presets/fields/phases.json b/data/presets/fields/phases.json index 0c7ae5c6b..5b32604d5 100644 --- a/data/presets/fields/phases.json +++ b/data/presets/fields/phases.json @@ -2,5 +2,5 @@ "key": "phases", "type": "number", "label": "Number of Phases", - "placeholder": "3" + "placeholder": "1, 2, 3..." } diff --git a/data/presets/fields/rating.json b/data/presets/fields/rating.json index b6122b52b..334552d14 100644 --- a/data/presets/fields/rating.json +++ b/data/presets/fields/rating.json @@ -1,6 +1,6 @@ { "key": "rating", - "type": "number", - "label": "VA Rating", - "placeholder": "32000" + "type": "combo", + "label": "Power Rating", + "snake_case": false } diff --git a/data/presets/fields/voltage/primary.json b/data/presets/fields/voltage/primary.json index 6c5396682..b8f7af86f 100644 --- a/data/presets/fields/voltage/primary.json +++ b/data/presets/fields/voltage/primary.json @@ -1,6 +1,5 @@ { "key": "voltage:primary", - "type": "number", - "label": "Primary Voltage", - "placeholder": "225000" -} \ No newline at end of file + "type": "combo", + "label": "Primary Voltage" +} diff --git a/data/presets/fields/voltage/secondary.json b/data/presets/fields/voltage/secondary.json index f0cf632e3..676c2cf0f 100644 --- a/data/presets/fields/voltage/secondary.json +++ b/data/presets/fields/voltage/secondary.json @@ -1,6 +1,5 @@ { "key": "voltage:secondary", - "type": "number", - "label": "Secondary Voltage", - "placeholder": "400" -} \ No newline at end of file + "type": "combo", + "label": "Secondary Voltage" +} diff --git a/data/presets/fields/voltage/tertiary.json b/data/presets/fields/voltage/tertiary.json index 8e733d541..f3a516e0d 100644 --- a/data/presets/fields/voltage/tertiary.json +++ b/data/presets/fields/voltage/tertiary.json @@ -1,6 +1,5 @@ { "key": "voltage:tertiary", - "type": "number", - "label": "Tertiary Voltage", - "placeholder": "20000" -} \ No newline at end of file + "type": "combo", + "label": "Tertiary Voltage" +} diff --git a/data/presets/fields/windings.json b/data/presets/fields/windings.json index 7de9817dd..2c123b0a7 100644 --- a/data/presets/fields/windings.json +++ b/data/presets/fields/windings.json @@ -2,5 +2,5 @@ "key": "windings", "type": "number", "label": "Number of Windings", - "placeholder": "3" + "placeholder": "1, 2, 3..." } diff --git a/data/presets/presets.json b/data/presets/presets.json index 5686e8dde..d33cf9512 100644 --- a/data/presets/presets.json +++ b/data/presets/presets.json @@ -12005,15 +12005,15 @@ "fields": [ "transformer", "location", + "rating", + "devices", "phases", "frequency", "voltage/primary", "voltage/secondary", "voltage/tertiary", "windings", - "windings/configuration", - "rating", - "devices" + "windings/configuration" ], "geometry": [ "point", diff --git a/data/presets/presets/power/transformer.json b/data/presets/presets/power/transformer.json index 303eeb10a..f1af8a2ec 100644 --- a/data/presets/presets/power/transformer.json +++ b/data/presets/presets/power/transformer.json @@ -3,15 +3,15 @@ "fields": [ "transformer", "location", + "rating", + "devices", "phases", "frequency", "voltage/primary", "voltage/secondary", "voltage/tertiary", "windings", - "windings/configuration", - "rating", - "devices" + "windings/configuration" ], "geometry": [ "point", diff --git a/dist/locales/en.json b/dist/locales/en.json index c8518620f..21a176f12 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -1474,7 +1474,7 @@ }, "devices": { "label": "Number of Devices", - "placeholder": "2" + "placeholder": "1, 2, 3..." }, "diaper": { "label": "Diaper Changing Available" @@ -1558,8 +1558,7 @@ "placeholder": "Default" }, "frequency": { - "label": "Operating Frequency", - "placeholder": "50" + "label": "Operating Frequency" }, "fuel_multi": { "label": "Fuel Types" @@ -1921,7 +1920,7 @@ }, "phases": { "label": "Number of Phases", - "placeholder": "3" + "placeholder": "1, 2, 3..." }, "phone": { "label": "Phone", @@ -2003,8 +2002,7 @@ "label": "Type" }, "rating": { - "label": "VA Rating", - "placeholder": "32000" + "label": "Power Rating" }, "recycling_accepts": { "label": "Accepts" @@ -2363,16 +2361,13 @@ } }, "voltage/primary": { - "label": "Primary Voltage", - "placeholder": "225000" + "label": "Primary Voltage" }, "voltage/secondary": { - "label": "Secondary Voltage", - "placeholder": "400" + "label": "Secondary Voltage" }, "voltage/tertiary": { - "label": "Tertiary Voltage", - "placeholder": "20000" + "label": "Tertiary Voltage" }, "wall": { "label": "Type" @@ -2404,7 +2399,7 @@ }, "windings": { "label": "Number of Windings", - "placeholder": "3" + "placeholder": "1, 2, 3..." }, "windings/configuration": { "label": "Windings Configuration", diff --git a/modules/services/taginfo.js b/modules/services/taginfo.js index 50b4e2c34..2149b37a3 100644 --- a/modules/services/taginfo.js +++ b/modules/services/taginfo.js @@ -264,7 +264,7 @@ export default { // A few OSM keys expect values to contain uppercase values (see #3377). // This is not an exhaustive list (e.g. `name` also has uppercase values) // but these are the fields where taginfo value lookup is most useful. - var re = /network|taxon|genus|species|brand|grape_variety|_hours|_times/; + var re = /network|taxon|genus|species|brand|grape_variety|rating|:output|_hours|_times/; var allowUpperCase = (params.key.match(re) !== null); var f = filterValues(allowUpperCase);