DEV: add plugin outlets to the admin plugins list (#27974)

This commit is contained in:
Neil Lalonde 2024-07-18 16:12:51 -04:00 committed by GitHub
parent 4b20021033
commit d54e47f373
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 84 additions and 63 deletions

View File

@ -5,6 +5,7 @@ import { action } from "@ember/object";
import { LinkTo } from "@ember/routing";
import { service } from "@ember/service";
import DToggleSwitch from "discourse/components/d-toggle-switch";
import PluginOutlet from "discourse/components/plugin-outlet";
import { popupAjaxError } from "discourse/lib/ajax-error";
import icon from "discourse-common/helpers/d-icon";
import i18n from "discourse-common/helpers/i18n";
@ -65,79 +66,99 @@ export default class AdminPluginsListItem extends Component {
}}
>
<td class="admin-plugins-list__name-details">
<div class="admin-plugins-list__name-with-badges">
<div class="admin-plugins-list__name">
{{@plugin.nameTitleized}}
</div>
<PluginOutlet
@name="admin-plugin-list-item-name-details"
@outletArgs={{hash plugin=@plugin}}
>
<div class="admin-plugins-list__name-with-badges">
<div class="admin-plugins-list__name">
{{@plugin.nameTitleized}}
</div>
<div class="badges">
{{#if @plugin.label}}
<span class="admin-plugins-list__badge">
{{@plugin.label}}
</span>
<div class="badges">
{{#if @plugin.label}}
<span class="admin-plugins-list__badge">
{{@plugin.label}}
</span>
{{/if}}
</div>
</div>
<div class="admin-plugins-list__author">
{{@plugin.author}}
</div>
<div class="admin-plugins-list__about">
{{@plugin.about}}
{{#if @plugin.linkUrl}}
<a
href={{@plugin.linkUrl}}
rel="noopener noreferrer"
target="_blank"
>
{{i18n "admin.plugins.learn_more"}}
{{icon "external-link-alt"}}
</a>
{{/if}}
</div>
</div>
<div class="admin-plugins-list__author">
{{@plugin.author}}
</div>
<div class="admin-plugins-list__about">
{{@plugin.about}}
{{#if @plugin.linkUrl}}
<a
href={{@plugin.linkUrl}}
rel="noopener noreferrer"
target="_blank"
>
{{i18n "admin.plugins.learn_more"}}
{{icon "external-link-alt"}}
</a>
{{/if}}
</div>
</PluginOutlet>
</td>
<td class="admin-plugins-list__version">
<div class="label">{{i18n "admin.plugins.version"}}</div>
{{@plugin.version}}<br />
<PluginCommitHash @plugin={{@plugin}} />
<PluginOutlet
@name="admin-plugin-list-item-version"
@outletArgs={{hash plugin=@plugin}}
>
<div class="label">{{i18n "admin.plugins.version"}}</div>
{{@plugin.version}}<br />
<PluginCommitHash @plugin={{@plugin}} />
</PluginOutlet>
</td>
<td class="admin-plugins-list__enabled">
<div class="label">{{i18n "admin.plugins.enabled"}}</div>
{{#if @plugin.enabledSetting}}
<DToggleSwitch
@state={{@plugin.enabled}}
{{on "click" (fn this.togglePluginEnabled @plugin)}}
/>
{{else}}
<DToggleSwitch @state={{@plugin.enabled}} disabled={{true}} />
{{/if}}
<PluginOutlet
@name="admin-plugin-list-item-enabled"
@outletArgs={{hash plugin=@plugin}}
>
<div class="label">{{i18n "admin.plugins.enabled"}}</div>
{{#if @plugin.enabledSetting}}
<DToggleSwitch
@state={{@plugin.enabled}}
{{on "click" (fn this.togglePluginEnabled @plugin)}}
/>
{{else}}
<DToggleSwitch @state={{@plugin.enabled}} disabled={{true}} />
{{/if}}
</PluginOutlet>
</td>
<td class="admin-plugins-list__settings">
{{#if this.showPluginSettingsButton}}
{{#if @plugin.useNewShowRoute}}
<LinkTo
class="btn btn-text btn-small"
@route="adminPlugins.show"
@model={{@plugin}}
@disabled={{this.disablePluginSettingsButton}}
title={{this.settingsButtonTitle}}
data-plugin-setting-button={{@plugin.name}}
>
{{i18n "admin.plugins.change_settings_short"}}
</LinkTo>
{{else}}
<LinkTo
class="btn btn-text btn-small"
@route="adminSiteSettingsCategory"
@model={{@plugin.settingCategoryName}}
@query={{hash filter=(concat "plugin:" @plugin.name)}}
@disabled={{this.disablePluginSettingsButton}}
title={{this.settingsButtonTitle}}
data-plugin-setting-button={{@plugin.name}}
>
{{i18n "admin.plugins.change_settings_short"}}
</LinkTo>
<PluginOutlet
@name="admin-plugin-list-item-settings"
@outletArgs={{hash plugin=@plugin}}
>
{{#if this.showPluginSettingsButton}}
{{#if @plugin.useNewShowRoute}}
<LinkTo
class="btn btn-text btn-small"
@route="adminPlugins.show"
@model={{@plugin}}
@disabled={{this.disablePluginSettingsButton}}
title={{this.settingsButtonTitle}}
data-plugin-setting-button={{@plugin.name}}
>
{{i18n "admin.plugins.change_settings_short"}}
</LinkTo>
{{else}}
<LinkTo
class="btn btn-text btn-small"
@route="adminSiteSettingsCategory"
@model={{@plugin.settingCategoryName}}
@query={{hash filter=(concat "plugin:" @plugin.name)}}
@disabled={{this.disablePluginSettingsButton}}
title={{this.settingsButtonTitle}}
data-plugin-setting-button={{@plugin.name}}
>
{{i18n "admin.plugins.change_settings_short"}}
</LinkTo>
{{/if}}
{{/if}}
{{/if}}
</PluginOutlet>
</td>
</tr>
</template>