Commit graph

214 commits

Author SHA1 Message Date
Thiemo Kreuz 4766216948 Remove small pieces of unused code
Mostly unused variable initializations. Note I'm inlining some
`var` keywords in this patch. This is in line with the current
style guides. See for example the discussion in I4f198e2 (search
for "hoisted" in the comments). However, I'm not changing the
entire codebase, as this is not the goal of this patch and also
just not necessary at this point.

Change-Id: Ibd80566c44584851ee2530d6b16dd28eb3db6bfe
2021-08-28 12:10:22 +02:00
jenkins-bot 73d5a6504d Merge "Change param duplicate numbering to start with 2" 2021-07-30 14:17:47 +00:00
jenkins-bot ffeaea6921 Merge "Fix handling of duplicate parameter names" 2021-07-30 14:11:09 +00:00
Thiemo Kreuz f6e1004720 Various minor JSDoc/PHPDoc documentation fixes
Change-Id: I537bf4086058a7e18c9118f7433090c4bfaf98e7
2021-07-12 11:47:55 +02:00
Ed Sanders f567bb1b51 Avoid fit-content, not supported by all browsers
Bug: T282285
Change-Id: I59e4f5aaa3f4bdd1d97d90fcb671454b00777922
2021-06-03 21:53:40 +01:00
WMDE-Fisch 75ca02c746 Inline fix for suggested values on unkown paramter types
Follow up to I33625eb38047fdbd2ca9d026c056f263e228e7df implementing
Thiemo's suggestion.

Bug: T280688
Change-Id: I63e804e2b122d7471a2f1c603b9734f820820e72
2021-04-23 10:14:01 +02:00
Andrew Kostka 6fd0857012 Fix suggested values not being shown when the param's type isn't specified
Bug: T280688
Change-Id: I33625eb38047fdbd2ca9d026c056f263e228e7df
2021-04-22 10:18:44 +02:00
Adam Wight 7b32bcefb4 Add suggested values parameter
Parameters may include a `suggestedvalues` property, which is rendered
in the UI for some parameter types.

TemplateData editor UI elements are implemented behind the
TemplateDataSuggestedValuesEditor feature flag.

Bug: T271897
Change-Id: I14012c79b3fa0d48c58fd8999584cc03ec03575e
2021-04-09 12:05:37 +02:00
Adam Wight e9e1b8ff48 Send title without namespace
These are a mess and hard to de-localize.  Also, the schema is
already documented as not including the namespace in this field.

A proper migration would be very difficult, so we'll have to remember
that our data includes this glitch and manually strip namespace
prefixes before the deployment date, as needed.

Change-Id: If2a4dd865b95458dc63162460f252500fd52436e
2021-02-18 18:27:53 +01:00
WMDE-Fisch 43e3043bab Allow input fields for parameter values to expand
Adding a new widget that inherits from MultilineTextInputWidget but
is initialized with only one row and prevents using the return key
to add new lines.

Bug: T263533
Change-Id: I5423f5f04075d21abd7acf09b622fd6444feeeb2
2021-02-17 17:27:54 +01:00
jenkins-bot e474d1632d Merge "Update a few confusing variable names in editor code" 2021-02-13 17:24:02 +00:00
Andrew Kostka d81226fdf7 Bucket the user's edit count before logging an event
Bug: T272569
Change-Id: I5313a3808b266bb60644b40bdb192db77208774a
2021-01-21 13:52:28 +01:00
Thiemo Kreuz 563a44ca72 Change param duplicate numbering to start with 2
… instead of 0. Conditionally add a dash in front as well to
avoid confusing results like '1' + sequence number = '12'.

Change-Id: I345704b00ba3812c4905f85e35cf21a6dfd05437
2021-01-08 14:50:04 +00:00
Thiemo Kreuz 954211d8ba Fix handling of duplicate parameter names
I looks like the Model.params data structure is build in a way
that it allows mismatching parameter "keys" and "names". E.g.

{
    "a": { "name": "a" },
    "a0": { "name": "a" },
}

There are comments in the code that suggest this is
intentional.

I found code that confused these two values and tries to use
the name as a key, for example. This fails, messes up the
paramOrder, and such.

This should not have much, if any effect for users because
users are blocked from doing this anyway, e.g. buttons get
disabled.

Change-Id: I2067024ad8d5b8e985a4f162cf6875f523777a6c
2021-01-08 15:48:55 +01:00
Andrew Kostka dfa86a7c71 The parameter-type-change event should also fire if type was initially undefined
Bug: T260343
Change-Id: I26f50dfd6b4b747b1ef88d619df6aff5278d412a
2021-01-08 14:09:34 +00:00
jenkins-bot fe3ee9ab6b Merge "Track parameter property changes" 2020-12-09 10:41:03 +00:00
jenkins-bot 248d4dfd9e Merge "Drop unnecessary top-level closures" 2020-12-07 15:34:32 +00:00
Thiemo Kreuz d08a6448e9 Track when (relevant) changes are made to <templatedata> tags
Bug: T267926
Change-Id: I55f72500b7bad7e648238560b516e870bc9130c8
2020-12-07 15:34:13 +01:00
Adam Wight 93b7bc0756 Drop unnecessary top-level closures
Change-Id: Ie8fbde864cd08f0657e4239f525ef9dd087aee41
2020-12-07 15:24:31 +01:00
Adam Wight 80021704d4 Track parameter property changes
This is temporary interaction tracking to better understand how the
dialog is used.

Bug: T260343
Change-Id: I14afa89e18676818f88c142059128a9f62dcadcb
2020-12-07 14:39:05 +01:00
Adam Wight eb6b61b3a7 Rename "property" variable for clarity
"props" sounds plural, but it is the name of a single property.

Change-Id: I62184d00d03e297568e1c335f31c961aa6983406
2020-12-04 18:44:48 +00:00
Adam Wight 5206188129 Assign reused dependentField value to a variable
Change-Id: Ie77fd61d5bb7d886ab069472d0294daf4039d4e2
2020-12-04 18:44:40 +00:00
Adam Wight 8e65e4d8fb Assign reused propertyInput value to a variable
Change-Id: Ic8ea8ae283112801266303eb1d2520931e47a418
2020-12-04 18:44:32 +00:00
Adam Wight 415286e377 Send metrics for template property interactions
Bug: T260343
Change-Id: I050eb4b87ccb9c8910847b929b86c3b3cb269b8a
2020-12-04 18:44:01 +00:00
Adam Wight 1d108b5104 Send metrics when applying changes
Bug: T260343
Change-Id: I6fea4195107baf301dd8f66967c86e9c7a762bd1
2020-12-04 18:43:30 +00:00
Adam Wight d8e418671d Send metrics when opening the dialog
Distinguish between create and edit.

Bug: T260343
Change-Id: I5cd29dff0c4db7e024395a9090c465a01527f079
2020-12-04 18:43:23 +00:00
Adam Wight a9a4485b22 Higher-level distinction when creating new TemplateData
This is needed for metrics collection.

The patch shifts responsibility for filling out an empty record when
there is no existing TemplateData, or it's corrupt.

We could clean up further by making logic robust to missing `params`
in the original templatedata, so that an empty structure is simply
`{}`.

Bug: T260343
Change-Id: I6ddc2660257890290cd40c54f9c8507ab5206d6c
2020-12-04 18:43:09 +00:00
Adam Wight b7fee749ab Migrate to package files: ext.templateDataGenerator.editTemplatePage
Change-Id: Ie03284701c1870b06116b7ce6a8ca1759c28d03b
2020-12-04 19:41:50 +01:00
Adam Wight bda6215309 Migrate to package files: ext.templateDataGenerator.data
Bug: T260343
Change-Id: Ifd171b40de704bff8c063da46b711a384238a0f5
2020-12-04 19:41:30 +01:00
Adam Wight 1010e6fb78 Migrate from jsduck to jsdoc
Bug: T138401
Change-Id: Iae74fdcae5e8c2541416d8cec8de8221cfc282ef
2020-11-30 21:56:30 +01:00
jenkins-bot 2a477094b9 Merge "Add progressive flags to various buttons" 2020-10-09 14:38:33 +00:00
jenkins-bot bb8e099e4a Merge "Remove unused "changesBooleanValue" property" 2020-10-07 17:04:52 +00:00
jenkins-bot 27e9916941 Merge "Use OutlineSelectWidget/OutlineOptionWidget for maps editing" 2020-10-07 10:06:55 +00:00
jenkins-bot 86a6865512 Merge "Fix parameter extraction from wikitext source" 2020-10-06 23:07:23 +00:00
jenkins-bot a0f98a1ea4 Merge "Also add padding to add parameter panel" 2020-10-06 23:02:38 +00:00
Marielle Volz 8a4e0ec984 Also add padding to add parameter panel
Follow up to Ica6bed595d8

Change-Id: I43d76ac256f18b69b556eadf5a53c20698cd860d
2020-10-06 09:37:09 +01:00
Ed Sanders c61049b8e3 Add progressive flags to various buttons
* Add '+' icon to "Add parameter" footer action
* Add "primary" action to button on add param page

Change-Id: Idc5f83afdbffb2336c6949fcd16a08a00e28a1a3
2020-10-06 08:26:43 +00:00
Ed Sanders 91214f0a6f Use OutlineSelectWidget/OutlineOptionWidget for maps editing
Change-Id: I90ab11c9a0941e8a487a7253d69f0a6cb1dc8dc5
2020-10-05 21:04:44 +00:00
Ed Sanders a990bcfc54 Move sub-page warning to dialog when opened
This is an important warning, and should not just be hidden.

Instead show it in the dialog as well in case the user ignored
it on the edit page.

Change-Id: If6f2d4b15157096a915186921d767a860edbc86a
2020-10-05 19:37:59 +01:00
Ed Sanders 39ba318938 Use MessageWidgets instead of LabelWidgets in Dialog
Change-Id: Ia9c34f446d4af7c2f56903ee83b6a57c4ef100dd
2020-10-05 19:37:59 +01:00
jenkins-bot e729bc7d84 Merge "Use a MessageWidget for the sub-page warning" 2020-10-05 14:48:20 +00:00
Ed Sanders d79e07f059 Remove default padding from panels, uses padded:true/false instead
Change-Id: Ica6bed595d8f1b2ac7cb6f30d3081536b7e8561b
2020-10-04 15:53:15 +01:00
Ed Sanders 2d55fa64b1 Use a MessageWidget for the sub-page warning
Change-Id: I8b2878a9a817d14d3a4542a083e98a9f70cfde8d
2020-10-04 14:05:26 +01:00
Thiemo Kreuz de434822b4 Fix all eslint warnings
Change-Id: I731ea4a54b001a8d30743ca32188edb1c039253e
2020-09-24 13:31:18 +01:00
Thiemo Kreuz f6de5d3493 Fix parameter extraction from wikitext source
This fixes a series of issues:
* The JS implementation had a trim() in one place that was
  missing in PHP.
* The actual parameter name in the paramNames/$params array was
  trimmed, but the "normalized" name (this is only for duplicate
  detection) was not trimmed.
* It was possible for an empty parameter to show up.

This resulted in very strange behavior, e.g. {{{ 1}}}{{{1 }}}
was detected as "1" and "10" (?), i.e. it would try to renumber
the duplicate in a strange way (string "1" plus a counter that
starts with 0).

Change-Id: I0a6371f3633b03b5b21809ecd06ea4c72d7d914d
2020-09-22 18:27:23 +02:00
Thiemo Kreuz fa7d16a373 Update a few confusing variable names in editor code
Change-Id: I8e7bc84539e62784059e0a43ca3de48c31abe6cf
2020-09-18 15:50:51 +02:00
Thiemo Kreuz 47e8249349 More canonical property order in mw.TemplateData.Model class
This does not have any effect on how this code behaves. It's
only relevant when a human reads the code. I tried to bring the
properties in an order that makes the most sense, grouping stuff
that clearly belongs together, as well as following how stuff is
ordered on
https://www.mediawiki.org/wiki/Extension:TemplateData

Change-Id: Ibbe1027023f8d87bbd0a70411882a25671918670
2020-09-01 09:10:34 +00:00
jenkins-bot c42a4afede Merge "Allow different maps to be edited separately" 2020-08-30 16:14:59 +00:00
Khatean 76cf63dad2 Allow different maps to be edited separately
Seperate different maps of maps-object into different panels that
contains text-area to edit the map, delete button to delete the map, and
can be navigated through using a side-bar, that also have "Add new map"
button at the top to add a new map.

Bug: T258820
Change-Id: Ib53a73203f6010b3fd8a5cd78c74c904be2340f2
2020-08-28 20:18:27 +02:00
Thiemo Kreuz 4853c2ae3a Remove unused "changesBooleanValue" property
Not used anywhere:
https://codesearch.wmcloud.org/search/?q=changesBooleanValue

Change-Id: I40f08f4d7164dbcb7bef58bb647607573f852f15
2020-08-25 14:18:54 +02:00