Commit graph

207 commits

Author SHA1 Message Date
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
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
Thiemo Kreuz a5fe1bfbb9 Move "Unknown" type to the top of the dropdown
"Unknown" is the special, default value when nothing else is
specified. It feels wrong to find this in alphabetical order
between all the other values, as if "Unknown" is something I'm
expected to pick. While this is possible, it's almost never
necessary. "Unknown" is the default anyway. If I'm fine with
that, I never change it. But if I want to pick something else,
I typically expect the list to show the "nothing selected yet"
default first so I can easily avoid it.

Change-Id: I283a1b0545efba208af777a0b2056740263dfc32
2020-08-19 17:30:05 +02:00
Siddharth VP 512911b92e Make getRawParams() ignore parameters in comments and nowiki tags
This is used by the includeMissingTitles option of API action=templatedata.
Parameter syntax existing within nowiki tags or comments will not be valid
for the template.

Bug: T237195
Change-Id: Ibbfa3e21488f2a37fc494862e929baf50607d4c9
2020-08-17 00:33:06 +00:00
Ed Sanders 71b27ed1ba Set import button to display:block, fixing text overflow
Bug: T259348
Change-Id: Ibbe2ccef8062275a20200445279033e084ca12aa
2020-07-31 14:19:43 +01:00
adham-khatean c4ca729ed5 Make the maps object editable from the TemplateData dialog
- Enable multiline.
- Enable updating the model with user changes if user clicks "Done".
- Disable "Done" button if the user inserts invalid JSON to handle JSON errors the
user might cause, and "Done" is enabled again if the JSON is valid.
- Create "cancel" button/action which will be for maps panel only, to
discard all changes made by the user.

Bug: T257503
Change-Id: Icd495290bae0b1684f8cd53864904a35e60fffe7
2020-07-24 16:07:04 +02:00
jenkins-bot 821c3b5af2 Merge "Create initial UI for maps panel in TemplateData GUI" 2020-07-09 19:12:27 +00:00
adham-khatean e719555d30 Create initial UI for maps panel in TemplateData GUI
Adding maps object to TemplateData GUI. By adding mapPanelButton to the
main panel and creating the map panel which contains multiline input
widget to show and insert the map info.

Bug: T254478
Change-Id: Iacff86812cbc448fcdbae24e7eeffb0384781dd5
2020-07-09 19:13:29 +02:00
Ed Sanders bf67ec6d52 build: Update eslint-config-wikimedia to 0.16.2
Change-Id: Ib53aa55795f228768a6226eebfdb5734d8a976d1
2020-07-08 13:08:35 +01:00