This repository has been archived by the owner on Mar 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
generated texts from the plugin settings and passed the same to gener… (
#3619) * generated texts from the plugin settings and passed the same to generate index * show the plugin section in the sidebar when its filtered by the search * refreshed plugin cache on new plugin or admin definition * removed the unnecessary code * changed to strict not equals * fixed lint issues * fix review comments * fix review comments, changed the method signature. * fix lint error * ignored the markdown link text using strip markdown util * test label field text extraction * removed stripmarkdown from label and display_name. added stripmarkdown to header and footer * changed the require to import for consistency * added the enable plugin setting by default * renamed EnablePluginSrtting to snake case * index the enable plugin setting by default * updated snapshot after merge
- Loading branch information
1 parent
949fb24
commit 8d18a02
Showing
11 changed files
with
1,202 additions
and
26 deletions.
There are no files selected for viewing
745 changes: 745 additions & 0 deletions
745
components/admin_console/admin_sidebar/__snapshots__/admin_sidebar.test.jsx.snap
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
components/admin_console/custom_plugin_settings/enable_plugin_setting.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. | ||
// See LICENSE.txt for license information. | ||
import {Constants} from '../../../utils/constants'; | ||
import {t} from '../../../utils/i18n'; | ||
import SchemaAdminSettings from '../schema_admin_settings'; | ||
|
||
export default function getEnablePluginSetting(plugin) { | ||
const escapedPluginId = SchemaAdminSettings.escapePathPart(plugin.id); | ||
const pluginEnabledConfigKey = 'PluginSettings.PluginStates.' + escapedPluginId + '.Enable'; | ||
|
||
return { | ||
type: Constants.SettingsTypes.TYPE_BOOL, | ||
key: pluginEnabledConfigKey, | ||
label: t('admin.plugin.enable_plugin'), | ||
label_default: 'Enable Plugin: ', | ||
help_text: t('admin.plugin.enable_plugin.help'), | ||
help_text_default: 'When true, this plugin is enabled.', | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
tests/helpers/admin_console_plugin_index_sample_pluings.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. | ||
// See LICENSE.txt for license information. | ||
export const samplePlugin1 = { | ||
id: 'mattermost-autolink', | ||
name: 'Autolink', | ||
description: 'Automatically rewrite text matching a regular expression into a Markdown link.', | ||
version: '1.1.0', | ||
settings_schema: { | ||
header: 'Configure this plugin directly in the config.json file. Learn more [in our documentation](https://github.com/mattermost/mattermost-plugin-autolink/blob/master/README.md).\n\nTo report an issue, make a suggestion or a contribution, [check the plugin repository](https://github.com/mattermost/mattermost-plugin-autolink).', | ||
footer: '', | ||
settings: [ | ||
{ | ||
key: 'EnableAdminCommand', | ||
display_name: 'Enable administration with /autolink command', | ||
type: 'bool', | ||
help_text: '', | ||
placeholder: '', | ||
default: false, | ||
}, | ||
], | ||
}, | ||
active: true, | ||
}; | ||
|
||
export const samplePlugin2 = { | ||
id: 'Some-random-plugin', | ||
name: 'Random', | ||
description: 'Automatically generate random numbers', | ||
version: '1.1.0', | ||
settings_schema: { | ||
footer: 'random plugin footer', | ||
settings: [ | ||
{ | ||
key: 'GenerateRandomNumber', | ||
display_name: 'Generate with /generateRand command', | ||
type: 'bool', | ||
help_text: '/generateRand 10', | ||
placeholder: '', | ||
default: false, | ||
}, | ||
{ | ||
key: 'setRange', | ||
display_name: 'set range with /setRange command', | ||
type: 'bool', | ||
help_text: '', | ||
placeholder: '', | ||
default: false, | ||
}, | ||
], | ||
}, | ||
active: true, | ||
}; | ||
|
||
export const samplePlugin3 = { | ||
id: 'plugin-with-markdown', | ||
name: 'markdown', | ||
description: 'click [here](http:https://localhost:8080)', | ||
version: '1.1.0', | ||
settings_schema: { | ||
settings: [ | ||
{ | ||
label: 'Markdown plugin label', | ||
key: 'Markdown plugin', | ||
display_name: 'Markdown', | ||
type: 'bool', | ||
help_text: 'click [here](http:https://localhost:8080)', | ||
placeholder: '', | ||
default: false, | ||
}, | ||
], | ||
}, | ||
active: true, | ||
}; |
Oops, something went wrong.