Commit graph

304 commits

Author SHA1 Message Date
jenkins-bot 41c286c68c Merge "Rename ambiguous "add button" click handlers" 2021-08-16 11:01:36 +00:00
Thiemo Kreuz 97486b2b3d Rename and document definition of "empty" in ve.ui.MWParameterPage
I found this while working on T274551, which is all about the
definition of "empty".

In the old sidebar a parameter's name is dimmed (gray) as long as
the parameter's value is empty. This stops working entirely when
there is a default value.

My first impulse was "this is a bug". When there is a default
value, both the empty string and the default value (when the user
enters it exactly) typically trigger the same behavior: The
template uses the default value, just as if the user entered it.

But this code is correct because of the way it is used. Only
parameters that are "truly" empty should be visually marked as
such. The moment there is a default value it is either impossible
to change this back to an empty string – meaning the parameter
can never be truly empty – or the empty string is meaningful user
input.

Bug: T274551
Change-Id: I90657bfe83e56afd3942428c0dd8a47b444e39c9
2021-08-11 07:24:41 +00:00
Thiemo Kreuz f37814ba61 Rename ambiguous "add button" click handlers
Change-Id: I25fd1430443feffcc3fb17115dc4129890063c48
2021-08-05 10:51:26 +02:00
jenkins-bot 4ab5fd5c6b Merge "Add a message next to undocumented parameters" 2021-07-16 12:05:29 +00:00
Andrew Kostka f02c48ea52 Add a message next to undocumented parameters
Bug: T274550
Change-Id: I1af71150239ebc9966cc22e7d28883fbac99fdf1
2021-07-15 14:47:21 +02:00
Andrew Kostka 01d8a8c7a4 Remove trash icons from the content view
Bug: T275761
Change-Id: I8d2c1b8ebdc2e20779d0207b1a2ebe6ce36c54e7
2021-07-15 12:20:45 +02:00
Thiemo Kreuz fae6118071 Document and use mw.Api parameter defaults
Reasoning:
* format=json must be the default. Nothing else makes sense in
  the context of this code. This should not be a surprise.
* formatversion=2 is only a default when the custom
  getContentApi() is used, but not when mw.Api is used. One
  might argue that it's safer to always specify formatversion=2.
  However, this is not done in other places in this codebase.
  It should never be done or always.
* I find it confusing when the action=… is missing. Let's not
  rely on this default.

Change-Id: I6ca29f76bffc0849103c5bcff4aaf28fcaaa4c52
2021-07-12 09:13:59 +02:00
Thiemo Kreuz d68e110e67 Fixes and updates to template related JSDoc tags
Some details:
* The config is not optional in these cases.
* This patch continues to remove some comments that don't add
  any information but just repeat what the code already says.

Change-Id: I5c27cd01ad80709bb583256821d65c6b65b74b05
2021-07-08 06:36:56 +00:00
Thiemo Kreuz 137be4438f Remove unused .getWikitext() methods from transclusion classes
These methods are special in so far that they create *minimal*
wikitext where optional whitespace is not preserved. I tried
to rename the methods to reflect this, but could not find a
caller. What's used instead are the .serialize() methods.

Bug: T284895
Change-Id: Iedaa5b7efa9675151cc0553854d8aef3f9a46cbb
2021-07-06 10:58:11 +02:00
Thiemo Kreuz (WMDE) e6d3828429 Revert "Extract "show all" to placeholder class"
This reverts commit 950a5300dc.

Reason for revert: This broke several workflows. The reason is
that MWParameterPlaceholderPage & MWParameterSearchWidget both
hold references to the MWTemplateModel. This model is not
always the same. The dialog might be the same when a template
is edited multiple times. But the model might be a new one.
From this point on the MWParameterSearchWidget pulls data from
an outdated model.

Bug: T284636
Bug: T285571
Change-Id: I7b9ea8cab8f17705ec8020f07e3732da6ba0e73c
2021-06-28 14:04:12 +02:00
Thiemo Kreuz 2529d33f51 Better name for spec.isParameterKnown() method
This reflects much better how this method is meant to behave.

Note I will continue to remove documentation that doesn't
explain anything in addition to what the code already says.

Bug: T285483
Change-Id: I81fa8a5d9d0752f3aeac4015c9a27b50e054d4df
2021-06-24 18:05:14 +02:00
Thiemo Kreuz 4367235dcc Inline many var declarations in the code below
This makes the code more readable and easier to reason about.
The ESLint rule responsible for this code style was removed
just recently.

Notes:
* I focus on classes that are relevant for what the WMDE team
  does right now.
* I merge multiple `var` keywords only when the variables are
  strongly connected.
* Caching the length in a for loop makes the code hard to
  read, but not really faster when it's a trivial property
  access anyway.

Bug: T284895
Change-Id: I621fed61d894a83dc95f58129bbe679d82b0f5f5
2021-06-23 09:02:24 +00:00
jenkins-bot 6d101fb9d7 Merge "Extract "show all" to placeholder class" 2021-06-16 12:25:55 +00:00
jenkins-bot ab47e5ff9a Merge "Small code cleanups for the MWDismissibleMessageWidget" 2021-06-16 11:11:47 +00:00
jenkins-bot 2a74f10909 Merge "Dismissible feedback message for the template search" 2021-06-16 11:02:50 +00:00
Thiemo Kreuz feb902aba0 Small code cleanups for the MWDismissibleMessageWidget
* Re-focus the input field after closing the message.
* Store only the message key. That's all that's needed.
* Avoid a class property that's not needed.
* Use the config object instead of calling .setLabel() manually.

Bug: T284742
Change-Id: If8e8bb6460fa5aea8ddd46c2e27b5f08b7772896
2021-06-16 10:32:08 +02:00
Andrew Kostka 13d1c4d2ac Dismissible feedback message for the template search
Bug: T284742
Change-Id: I5dc32521b899c3c9d35d1bf77d346384e4cc87e6
2021-06-16 10:03:04 +02:00
Adam Wight 950a5300dc Extract "show all" to placeholder class
We can skip all the up and down message passing by persisting the
parameter placeholders for each template dialog.  If the parameter
list is expanded then the placeholder is deleted, on being created
again it will still have state.

To test: create a transclusion with two templates, each having many
parameters.  "Add more information" to add parameters, expand the
list by clicking "Show <num> more fields", then delete the parameter
placeholder using the trash cans.  Try different permutations to fool
the cache or collide with another template.

This is preparation for other template sidebar dialog work.

Bug: T284636
Change-Id: I23bdd38b173114c2a9afafc7465c4beb92d25869
2021-06-14 18:09:26 +02:00
Thiemo Kreuz c2017f74b2 Remove @param/@return docs that literally repeat the code
These don't add any knowledge but make the code harder to read
and maintain, and are an additional source of errors.

Change-Id: Ied57741a3f985e355adfddb4e75378d5c497faa9
2021-06-14 15:44:51 +02:00
jenkins-bot 3f4cfb0fd8 Merge "Rename "value" to "wikitext" in TransclusionContent… classes" 2021-06-11 14:10:24 +00:00
Andrew Kostka 0c310d03d3 Use a new tab when linking to the project page for feedback
Bug: T284560
Change-Id: I13e7461299ccd1a584e0f661a5506e7b52b8fe4b
2021-06-10 13:06:35 +02:00
Svantje Lilienthal 1a707e2aad Add message linking to project page for feedback
Bug: T284560
Change-Id: I8ac45db4844c8ccb65595e8bfe3fb68be9bb02ee
2021-06-10 11:28:42 +02:00
jenkins-bot eca1ef82f2 Merge "Rewrite MWParameterPlaceholderPage.onParameterChoose() for readability" 2021-06-08 19:35:17 +00:00
Thiemo Kreuz 8d7c55aa71 Rename "value" to "wikitext" in TransclusionContent… classes
This class represents a raw wikitext snippet. There is also no
base class that would require us to follow a generic
getValue/setValue naming scheme.

Change-Id: I0891a2f6c0ae0121429a47c39221e99b9653e8e3
2021-06-08 09:27:47 +02:00
Thiemo Kreuz 6f72b7a391 Move initialization of optional elements into if block
This does have a few advantages:
* Less code is executed and less memory consumed when these
  elements are not needed.
* Code that belongs together is together.
* No local class properties are created when they are not
  needed in the code below.

This patch is kind of a proof of concept. It touches only a few
classes we currently actively work with. If this change is fine
we can change some of the other classes the same way.

Change-Id: I9f548765034f1f69799fff41aeb6c147ff28b82d
2021-06-07 20:53:34 +00:00
Thiemo Kreuz cdafea5663 Rewrite MWParameterPlaceholderPage.onParameterChoose() for readability
The main motivation for this patch is actually the comment. The
so called "spec" contains all parameters that are present in a
template, no matter if they are present in the TemplateData
documentation or not. This is critical here.

Change-Id: I5e1c79e3859a27562a9dea1d450cec196aa572ed
2021-06-04 12:49:53 +02:00
Andrew Kostka 2fe6094099 Update the delete button's feature flag in the tranclusion context menu
Bug: T274263
Change-Id: If805ce9dfc44be34e07ec79179837f12898e626e
2021-05-21 09:24:14 +00:00
Andrew Kostka e0bbf0b979 Show a delete button only in the transclusion context menu
Bug: T274263
Change-Id: Ifd81994c212cd03c1318c5fd762251ce828d9195
2021-05-17 12:26:37 +02:00
WMDE-Fisch 42b557ff80 Use add template when adding a new transclusion part
We have two cases now that we want to cover here:
- Either we're inserting a new template and start a "fresh"
  transclusion, then we want to use "search" in the headlines
- Or we're adding a new template to an exsisting
  transclusion, then we want to use "add" in the headlines

Bug: T277028
Change-Id: I9fa294cf732598d58f848c75b353d2e1742eb4e8
2021-05-11 13:13:44 +02:00
Svantje Lilienthal 2665734b10 Renaming temporary config variable and splitting it from cirrus search lookup
This allows using the config variable independendly from the cirrus search extension.
This way it can be used for all subtickets of T271802.

Bug: T277028
Change-Id: I1b3bdda5fa6fbfe5c531c3b51c2c8e2a28ed1faf
2021-05-10 14:47:31 +02:00
Adam Wight f89301bedf Optional verbose template search
Renames "Add a template" to "Template Search" in most cases and
provides inline help for the workflow.

Bug: T277028
Change-Id: I3fee87cb89b5044e785596e71ef3f1a18f2694ce
2021-05-10 12:45:12 +00:00
Andrew Kostka c1d36072ea Add collapsible descriptions to the transclusion dialog
Bug: T273426
Change-Id: I793a66f5c5877451b70058e9388dd86b3fcaadd7
2021-05-10 11:18:17 +00:00
Adam Wight d5b5300fc1 Container as a local field
We're about to replace this jQuery element by a OOUI container, and
can take an initial step by reducing its lexical scope.

Change-Id: I4123c8d22c01040fc2f61180304254498b21f5fd
2021-05-04 16:25:45 +02:00
Adam Wight cd60daf072 Internally rename container for parameter docs
The name "description" conflicts with the TemplateData field name,
which is only one of several documentation fields.

Change-Id: I0942701204fe8499e8890740585b9a02c1d14c63
2021-05-04 16:24:07 +02:00
Adam Wight abdbb7d7ff Internally rename container for adding an undocumented paramter
The internal name "more" conflicts with new collapsible buttons.

TODO: looks like TemplatePage has an analogous field?

Change-Id: I10b24758316a6cc3fbd236c77daffa014fcdafc6
2021-05-04 16:23:53 +02:00
Thiemo Kreuz 6e08a27fc7 Use standard search API when searching for templates
Bug: T274903
Change-Id: I7de8f6cc55ab678ed741ae5ebbaad608b9a9b0db
2021-04-30 12:52:45 +00:00
WMDE-Fisch e3197a82ff Increase space between fields when using inline descriptions
Bug: T273425
Change-Id: I3bf31622dbf794e1de1fa69b4fac68114c5689f7
2021-04-20 18:27:03 +02:00
WMDE-Fisch 2920c68adf Use verbose label for the example
Bug: T273425
Change-Id: Ia56aa35f98f31859e48781848b7481ebd5e2bd1c
2021-04-20 10:34:52 +00:00
Andrew Kostka 3c2db5fba9 Relocate parameter descriptions in the transclusion dialog
Bug: T273425
Change-Id: I2044b65ba88ae00e394fb84cb8e96a218995918a
2021-04-15 13:08:53 +02:00
Andrew Kostka 43c1ec5f42 Add filtering for the suggested values combo box
Bug: T271898
Change-Id: Ifb0deb117fbe40bd43c62d8be235a239a2b37f25
2021-04-14 14:11:50 +02:00
Andrew Kostka de2f5b3055 Add a combo box for suggested values in the transclusion dialog
Bug: T271898
Change-Id: Ic637eea2cac45f79234b62c787e1b76d68b61570
2021-04-08 16:10:22 +02:00
jenkins-bot b6033895f5 Merge "Add edit count bucket to VisualEditorTemplateDialogUse events" 2021-02-01 10:22:38 +00:00
Bartosz Dziewoński 185db3a157 Remove tabindex="-1" from "Add more information" button in template dialog
This makes it button keyboard-accessible, like the other buttons.

Bug: T179136
Change-Id: Ib2824176fe861e0ad8511f755521bee941119b29
2021-01-29 21:06:12 +01:00
Adam Wight 9a1072a960 Add edit count bucket to VisualEditorTemplateDialogUse events
Bug: T269986
Change-Id: I68cc15d58a23149a6edc71cac229f6b29d33fd92
2021-01-21 13:17:03 +01:00
WMDE-Fisch 2ce9934ab9 Add tracking of template usage
The names in the schema are roughly following what's
done in Schema:TemplateWizard. The information if
templates have TemplateData will be logged seperatly.

Bug: T259705
Change-Id: Iafa7256f675dbfd6a5a6de794061901780e3c55d
2020-12-16 12:56:45 +01:00
jenkins-bot b4c26620e1 Merge "Send EventLogging when adding template parameters" 2020-12-04 17:09:28 +00:00
jenkins-bot 18be32a9dd Merge "Send EventLogging when editing parameter values" 2020-12-04 17:06:22 +00:00
Adam Wight 9925ad3a88 Send EventLogging when editing parameter values
The first edit to a parameter will cause an event to be sent,
subsequent edits to the same parameter will not send an event.

Bug: T258920
Change-Id: Ibe663ce99a8fdf85a5add17186fb44fdbd4176bf
2020-11-26 11:13:14 +01:00
Adam Wight 46dad92e7d Send an event when the template doc link is clicked
Bug: T258920
Change-Id: I579472f2f9a683f63a08abc97f69c080e84bed35
2020-11-26 11:12:20 +01:00
Adam Wight 19723ba681 Send EventLogging when adding template parameters
Record that a parameter was added, and whether it was known or
unknown--whether it's documented the TemplateData.  Note that
`.isParameterKnown` returns true after an unknown parameter is added
to the template, so we need to set up the event early.

Bug: T258920
Change-Id: I5f8d8d06226474160a0a82c2e85a7fa4e22ba8cb
2020-11-26 11:10:48 +01:00