mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-16 20:15:44 +00:00
Add config option to fully disable installing plugins (#6535)
* [FR] Add config option to fully disable installing plugins Fixes #6531 * also restrict uninstalling * Added test * diff cleanup * extend api to show if install was disabled * PUI disable install buttons * CUI disable install button if not available * add config option * Rephrase
This commit is contained in:
@ -8,6 +8,7 @@ export const emptyServerAPI = {
|
||||
worker_running: null,
|
||||
worker_pending_tasks: null,
|
||||
plugins_enabled: null,
|
||||
plugins_install_disabled: null,
|
||||
active_plugins: [],
|
||||
email_configured: null,
|
||||
debug_mode: null,
|
||||
|
@ -34,6 +34,7 @@ export interface ServerAPIProps {
|
||||
worker_running: null | boolean;
|
||||
worker_pending_tasks: null | number;
|
||||
plugins_enabled: null | boolean;
|
||||
plugins_install_disabled: null | boolean;
|
||||
active_plugins: PluginProps[];
|
||||
email_configured: null | boolean;
|
||||
debug_mode: null | boolean;
|
||||
|
@ -14,6 +14,7 @@ export type RowAction = {
|
||||
icon: ReactNode;
|
||||
onClick?: () => void;
|
||||
hidden?: boolean;
|
||||
disabled?: boolean;
|
||||
};
|
||||
|
||||
// Component for duplicating a row in a table
|
||||
@ -129,6 +130,7 @@ export function RowActions({
|
||||
|
||||
setOpened(false);
|
||||
}}
|
||||
disabled={action.disabled || false}
|
||||
>
|
||||
{action.title}
|
||||
</Menu.Item>
|
||||
|
@ -271,8 +271,11 @@ export default function PluginListTable() {
|
||||
const navigate = useNavigate();
|
||||
const user = useUserState();
|
||||
|
||||
const pluginsEnabled = useServerApiState(
|
||||
(state) => state.server.plugins_enabled
|
||||
const [pluginsEnabled, plugins_install_disabled] = useServerApiState(
|
||||
(state) => [
|
||||
state.server.plugins_enabled,
|
||||
state.server.plugins_install_disabled
|
||||
]
|
||||
);
|
||||
|
||||
const pluginTableColumns: TableColumn[] = useMemo(
|
||||
@ -457,7 +460,8 @@ export default function PluginListTable() {
|
||||
onClick: () => {
|
||||
setSelectedPlugin(record.pk);
|
||||
uninstallPluginModal.open();
|
||||
}
|
||||
},
|
||||
disabled: plugins_install_disabled || false
|
||||
});
|
||||
}
|
||||
|
||||
@ -592,6 +596,7 @@ export default function PluginListTable() {
|
||||
setPluginPackage('');
|
||||
installPluginModal.open();
|
||||
}}
|
||||
disabled={plugins_install_disabled || false}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user