Skip to content

Commit

Permalink
[MM-12167] Bring back the settings button in the plugin admin page (m…
Browse files Browse the repository at this point in the history
…attermost#1731)

* bring back the settings button in the plugin admin  page

* update tests
  • Loading branch information
cpanato committed Sep 24, 2018
1 parent a7fc923 commit 1e42942
Show file tree
Hide file tree
Showing 3 changed files with 594 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ const PluginItem = ({
handleDisable,
handleRemove,
showInstances,
hasSettings,
}) => {
let activateButton;
const activating = pluginStatus.state === PluginState.PLUGIN_STATE_STARTING;
Expand Down Expand Up @@ -193,8 +194,8 @@ const PluginItem = ({
);
}

let settingsButton;
if (pluginStatus.settings_schema) {
let settingsButton = null;
if (hasSettings) {
settingsButton = (
<span>
{' - '}
Expand Down Expand Up @@ -383,12 +384,14 @@ PluginItem.propTypes = {
handleDisable: PropTypes.func.isRequired,
handleRemove: PropTypes.func.isRequired,
showInstances: PropTypes.bool.isRequired,
hasSettings: PropTypes.bool.isRequired,
};

export default class PluginManagement extends React.Component {
static propTypes = {
config: PropTypes.object.isRequired,
pluginStatuses: PropTypes.object.isRequired,
plugins: PropTypes.object.isRequired,
actions: PropTypes.shape({
uploadPlugin: PropTypes.func.isRequired,
removePlugin: PropTypes.func.isRequired,
Expand Down Expand Up @@ -563,6 +566,7 @@ export default class PluginManagement extends React.Component {

return 0;
});

pluginsList = plugins.map((pluginStatus) => (
<PluginItem
key={pluginStatus.id}
Expand All @@ -572,6 +576,7 @@ export default class PluginManagement extends React.Component {
handleDisable={this.handleDisable}
handleRemove={this.handleRemove}
showInstances={showInstances}
hasSettings={Boolean(this.props.plugins[pluginStatus.id] && this.props.plugins[pluginStatus.id].settings_schema)}
/>
));

Expand Down
Loading

0 comments on commit 1e42942

Please sign in to comment.