DEV: add plugin outlets to the admin plugins list (#27974)
This commit is contained in:
parent
4b20021033
commit
d54e47f373
|
@ -5,6 +5,7 @@ import { action } from "@ember/object";
|
||||||
import { LinkTo } from "@ember/routing";
|
import { LinkTo } from "@ember/routing";
|
||||||
import { service } from "@ember/service";
|
import { service } from "@ember/service";
|
||||||
import DToggleSwitch from "discourse/components/d-toggle-switch";
|
import DToggleSwitch from "discourse/components/d-toggle-switch";
|
||||||
|
import PluginOutlet from "discourse/components/plugin-outlet";
|
||||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||||
import icon from "discourse-common/helpers/d-icon";
|
import icon from "discourse-common/helpers/d-icon";
|
||||||
import i18n from "discourse-common/helpers/i18n";
|
import i18n from "discourse-common/helpers/i18n";
|
||||||
|
@ -65,79 +66,99 @@ export default class AdminPluginsListItem extends Component {
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<td class="admin-plugins-list__name-details">
|
<td class="admin-plugins-list__name-details">
|
||||||
<div class="admin-plugins-list__name-with-badges">
|
<PluginOutlet
|
||||||
<div class="admin-plugins-list__name">
|
@name="admin-plugin-list-item-name-details"
|
||||||
{{@plugin.nameTitleized}}
|
@outletArgs={{hash plugin=@plugin}}
|
||||||
</div>
|
>
|
||||||
|
<div class="admin-plugins-list__name-with-badges">
|
||||||
|
<div class="admin-plugins-list__name">
|
||||||
|
{{@plugin.nameTitleized}}
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="badges">
|
<div class="badges">
|
||||||
{{#if @plugin.label}}
|
{{#if @plugin.label}}
|
||||||
<span class="admin-plugins-list__badge">
|
<span class="admin-plugins-list__badge">
|
||||||
{{@plugin.label}}
|
{{@plugin.label}}
|
||||||
</span>
|
</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}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</PluginOutlet>
|
||||||
<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>
|
|
||||||
</td>
|
</td>
|
||||||
<td class="admin-plugins-list__version">
|
<td class="admin-plugins-list__version">
|
||||||
<div class="label">{{i18n "admin.plugins.version"}}</div>
|
<PluginOutlet
|
||||||
{{@plugin.version}}<br />
|
@name="admin-plugin-list-item-version"
|
||||||
<PluginCommitHash @plugin={{@plugin}} />
|
@outletArgs={{hash plugin=@plugin}}
|
||||||
|
>
|
||||||
|
<div class="label">{{i18n "admin.plugins.version"}}</div>
|
||||||
|
{{@plugin.version}}<br />
|
||||||
|
<PluginCommitHash @plugin={{@plugin}} />
|
||||||
|
</PluginOutlet>
|
||||||
</td>
|
</td>
|
||||||
<td class="admin-plugins-list__enabled">
|
<td class="admin-plugins-list__enabled">
|
||||||
<div class="label">{{i18n "admin.plugins.enabled"}}</div>
|
<PluginOutlet
|
||||||
{{#if @plugin.enabledSetting}}
|
@name="admin-plugin-list-item-enabled"
|
||||||
<DToggleSwitch
|
@outletArgs={{hash plugin=@plugin}}
|
||||||
@state={{@plugin.enabled}}
|
>
|
||||||
{{on "click" (fn this.togglePluginEnabled @plugin)}}
|
<div class="label">{{i18n "admin.plugins.enabled"}}</div>
|
||||||
/>
|
{{#if @plugin.enabledSetting}}
|
||||||
{{else}}
|
<DToggleSwitch
|
||||||
<DToggleSwitch @state={{@plugin.enabled}} disabled={{true}} />
|
@state={{@plugin.enabled}}
|
||||||
{{/if}}
|
{{on "click" (fn this.togglePluginEnabled @plugin)}}
|
||||||
|
/>
|
||||||
|
{{else}}
|
||||||
|
<DToggleSwitch @state={{@plugin.enabled}} disabled={{true}} />
|
||||||
|
{{/if}}
|
||||||
|
</PluginOutlet>
|
||||||
</td>
|
</td>
|
||||||
<td class="admin-plugins-list__settings">
|
<td class="admin-plugins-list__settings">
|
||||||
{{#if this.showPluginSettingsButton}}
|
<PluginOutlet
|
||||||
{{#if @plugin.useNewShowRoute}}
|
@name="admin-plugin-list-item-settings"
|
||||||
<LinkTo
|
@outletArgs={{hash plugin=@plugin}}
|
||||||
class="btn btn-text btn-small"
|
>
|
||||||
@route="adminPlugins.show"
|
{{#if this.showPluginSettingsButton}}
|
||||||
@model={{@plugin}}
|
{{#if @plugin.useNewShowRoute}}
|
||||||
@disabled={{this.disablePluginSettingsButton}}
|
<LinkTo
|
||||||
title={{this.settingsButtonTitle}}
|
class="btn btn-text btn-small"
|
||||||
data-plugin-setting-button={{@plugin.name}}
|
@route="adminPlugins.show"
|
||||||
>
|
@model={{@plugin}}
|
||||||
{{i18n "admin.plugins.change_settings_short"}}
|
@disabled={{this.disablePluginSettingsButton}}
|
||||||
</LinkTo>
|
title={{this.settingsButtonTitle}}
|
||||||
{{else}}
|
data-plugin-setting-button={{@plugin.name}}
|
||||||
<LinkTo
|
>
|
||||||
class="btn btn-text btn-small"
|
{{i18n "admin.plugins.change_settings_short"}}
|
||||||
@route="adminSiteSettingsCategory"
|
</LinkTo>
|
||||||
@model={{@plugin.settingCategoryName}}
|
{{else}}
|
||||||
@query={{hash filter=(concat "plugin:" @plugin.name)}}
|
<LinkTo
|
||||||
@disabled={{this.disablePluginSettingsButton}}
|
class="btn btn-text btn-small"
|
||||||
title={{this.settingsButtonTitle}}
|
@route="adminSiteSettingsCategory"
|
||||||
data-plugin-setting-button={{@plugin.name}}
|
@model={{@plugin.settingCategoryName}}
|
||||||
>
|
@query={{hash filter=(concat "plugin:" @plugin.name)}}
|
||||||
{{i18n "admin.plugins.change_settings_short"}}
|
@disabled={{this.disablePluginSettingsButton}}
|
||||||
</LinkTo>
|
title={{this.settingsButtonTitle}}
|
||||||
|
data-plugin-setting-button={{@plugin.name}}
|
||||||
|
>
|
||||||
|
{{i18n "admin.plugins.change_settings_short"}}
|
||||||
|
</LinkTo>
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
</PluginOutlet>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</template>
|
</template>
|
||||||
|
|
Loading…
Reference in New Issue