From 86296b67aabf15804f48da58c74e3c2d5dd5ceb5 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Mon, 13 Apr 2020 10:04:14 +0100 Subject: [PATCH] Plugin Chooser: Distinguish between install, reinstall, update and downgrade --- core/language/en-GB/ControlPanel.multids | 4 +++- core/ui/ControlPanel/Modals/AddPlugins.tid | 18 +++++++++++++++--- core/ui/ControlPanel/Plugins/Add/Updates.tid | 16 ++++++++-------- themes/tiddlywiki/vanilla/base.tid | 7 +++++++ 4 files changed, 33 insertions(+), 12 deletions(-) diff --git a/core/language/en-GB/ControlPanel.multids b/core/language/en-GB/ControlPanel.multids index dc42ac156..86d352202 100644 --- a/core/language/en-GB/ControlPanel.multids +++ b/core/language/en-GB/ControlPanel.multids @@ -70,6 +70,7 @@ Plugins/Caption: Plugins Plugins/Disable/Caption: disable Plugins/Disable/Hint: Disable this plugin when reloading page Plugins/Disabled/Status: (disabled) +Plugins/Downgrade/Caption: downgrade Plugins/Empty/Hint: None Plugins/Enable/Caption: enable Plugins/Enable/Hint: Enable this plugin when reloading page @@ -87,9 +88,10 @@ Plugins/Plugins/Hint: Plugins Plugins/Reinstall/Caption: reinstall Plugins/Themes/Caption: Themes Plugins/Themes/Hint: Theme plugins +Plugins/Update/Caption: update Plugins/Updates/Caption: Updates Plugins/Updates/Hint: Available updates to installed plugins -Plugins/Updates/UpdateAll/Caption: Update <> plugins +Plugins/Updates/UpdateAll/Caption: Update <> plugins Plugins/SubPluginPrompt: With <> sub-plugins available Saving/Caption: Saving Saving/DownloadSaver/AutoSave/Description: Permit automatic saving for the download saver diff --git a/core/ui/ControlPanel/Modals/AddPlugins.tid b/core/ui/ControlPanel/Modals/AddPlugins.tid index 6b267f6b9..dfbde44e3 100644 --- a/core/ui/ControlPanel/Modals/AddPlugins.tid +++ b/core/ui/ControlPanel/Modals/AddPlugins.tid @@ -14,15 +14,27 @@ subtitle: {{$:/core/images/download-button}} {{$:/language/ControlPanel/Plugins/ \define install-plugin-button()
-<$button actions=<> class={{{ [get[original-title]get[version]then[tc-reinstall]] tc-btn-invisible tc-install-plugin +[join[ ]] }}}> +<$set name="libraryVersion" value={{{ [get[version]] }}}> +<$set name="installedVersion" value={{{ [get[original-title]get[version]] }}}> +<$set name="reinstall-type" value={{{ [compare:version:eqthen[tc-reinstall]] [compare:version:gtthen[tc-reinstall-upgrade]] [compare:version:ltthen[tc-reinstall-downgrade]] }}}> +<$button actions=<> class={{{ [get[original-title]has[version]then] tc-btn-invisible tc-install-plugin +[join[ ]] }}}> {{$:/core/images/download-button}} -<$list filter="[get[original-title]get[version]]" variable="installedVersion" emptyMessage="""{{$:/language/ControlPanel/Plugins/Install/Caption}}"""> -{{$:/language/ControlPanel/Plugins/Reinstall/Caption}} +<$list filter="[get[original-title]get[version]]" variable="ignore" emptyMessage="{{$:/language/ControlPanel/Plugins/Install/Caption}}"> +<$list filter="[compare:version:gt]" variable="ignore" emptyMessage=""" +<$list filter="[compare:version:lt]" variable="ignore" emptyMessage="{{$:/language/ControlPanel/Plugins/Reinstall/Caption}}"> +{{$:/language/ControlPanel/Plugins/Downgrade/Caption}} + +"""> +{{$:/language/ControlPanel/Plugins/Update/Caption}} +
<$reveal stateTitle=<> stateField="requires-reload" type="match" text="yes">{{$:/language/ControlPanel/Plugins/PluginWillRequireReload}} + + +
\end diff --git a/core/ui/ControlPanel/Plugins/Add/Updates.tid b/core/ui/ControlPanel/Plugins/Add/Updates.tid index 7976f3f49..218f1552e 100644 --- a/core/ui/ControlPanel/Plugins/Add/Updates.tid +++ b/core/ui/ControlPanel/Plugins/Add/Updates.tid @@ -1,7 +1,7 @@ title: $:/core/ui/ControlPanel/Plugins/Add/Updates -caption: <$importvariables filter="$:/core/ui/ControlPanel/Plugins/Add/Updates">{{$:/language/ControlPanel/Plugins/Updates/Caption}} (<>) +caption: <$importvariables filter="$:/core/ui/ControlPanel/Plugins/Add/Updates">{{$:/language/ControlPanel/Plugins/Updates/Caption}} (<>) -\define each-upgradeable-plugin(body) +\define each-updateable-plugin(body) <$list filter="[all[tiddlers+shadows]tag[$:/tags/RemoteAssetInfo]server-url{!!url}sort[title]]" variable="assetInfo"> <$set name="libraryVersion" value={{{ [get[version]] }}}> <$list filter="[get[original-title]has[version]!version]" variable="ignore"> @@ -15,17 +15,17 @@ $body$ \end -\define upgrade-all-actions() -<$macrocall $name="each-upgradeable-plugin" body=""" +\define update-all-actions() +<$macrocall $name="each-updateable-plugin" body=""" <> """/> \end -\define upgrade-count() -<$wikify name="count-filter" text=<>/>]]">>><$count filter=<>/> +\define update-count() +<$wikify name="count-filter" text=<>/>]]">>><$count filter=<>/> \end -<$button actions=<> class="tc-btn-invisible tc-install-plugin"> +<$button actions=<> class="tc-btn-invisible tc-install-plugin"> {{$:/core/images/download-button}} {{||$:/language/ControlPanel/Plugins/Updates/UpdateAll/Caption}} @@ -45,7 +45,7 @@ Available Install -<$macrocall $name="each-upgradeable-plugin" body=""" +<$macrocall $name="each-updateable-plugin" body=""" <$text text={{{ [get[name]] ~[get[original-title]split[/]last[1]] }}}/>: <$view tiddler=<> field="description"/>
diff --git a/themes/tiddlywiki/vanilla/base.tid b/themes/tiddlywiki/vanilla/base.tid index 07e9d2046..0ca784c76 100644 --- a/themes/tiddlywiki/vanilla/base.tid +++ b/themes/tiddlywiki/vanilla/base.tid @@ -2237,10 +2237,17 @@ a.tc-tiddlylink.tc-plugin-info:hover .tc-plugin-info > .tc-plugin-info-chunk > s padding: 3px; } +.tc-install-plugin.tc-reinstall-downgrade { + background: red; +} + .tc-install-plugin.tc-reinstall { background: blue; } +.tc-install-plugin.tc-reinstall-upgrade { + background: orange; +} .tc-check-list { line-height: 2em;