mirror of
https://github.com/pterodactyl/panel.git
synced 2026-12-04 21:35:47 -05:00
Disable reinstall action during normal server status if "skip egg install scripts" setting is enabled (#5696)
### Description You're able to enable a "skip egg install scripts" per server, while still being able to reinstall a server. With this setting enabled, reinstalling a server has no functional use, the server is locked and shutdown, then simply unlocked immediately afterwards after a success signal from wings. This PR disables the reinstall button when skip install scripts is enabled for both the user and admin, with a little component telling you why you cannot reinstall. The reinstall button is not disabled if the server is in a status that reinstall could resolve (eg. failed install). ### Resolved issues: 1. [x] resolves pterodactyl/panel#5306
This commit is contained in:
@@ -58,6 +58,7 @@ export interface Server {
|
||||
backups: number;
|
||||
};
|
||||
isTransferring: boolean;
|
||||
skipScripts: boolean;
|
||||
variables: ServerEggVariable[];
|
||||
allocations: Allocation[];
|
||||
}
|
||||
@@ -83,6 +84,7 @@ export const rawDataToServerObject = ({ attributes: data }: FractalResponseData)
|
||||
eggFeatures: data.egg_features || [],
|
||||
featureLimits: { ...data.feature_limits },
|
||||
isTransferring: data.is_transferring,
|
||||
skipScripts: data.skip_scripts,
|
||||
variables: ((data.relationships?.variables as FractalResponseList | undefined)?.data || []).map(
|
||||
rawDataToServerEggVariable
|
||||
),
|
||||
|
||||
@@ -11,6 +11,7 @@ import { Dialog } from '@/components/elements/dialog';
|
||||
|
||||
export default () => {
|
||||
const uuid = ServerContext.useStoreState((state) => state.server.data!.uuid);
|
||||
const skipScripts = ServerContext.useStoreState((state) => state.server.data!.skipScripts);
|
||||
const [modalVisible, setModalVisible] = useState(false);
|
||||
const { addFlash, clearFlashes } = useStoreActions((actions: Actions<ApplicationStore>) => actions.flashes);
|
||||
|
||||
@@ -36,6 +37,17 @@ export default () => {
|
||||
clearFlashes();
|
||||
}, []);
|
||||
|
||||
if (skipScripts) {
|
||||
return (
|
||||
<TitledGreyBox title={'Reinstall Server'}>
|
||||
<p css={tw`text-sm`}>
|
||||
Reinstalling this server has been disabled because it is configured to skip its egg's install
|
||||
script. If you would like to reinstall this server, contact a server administrator.
|
||||
</p>
|
||||
</TitledGreyBox>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<TitledGreyBox title={'Reinstall Server'} css={tw`relative`}>
|
||||
<Dialog.Confirm
|
||||
|
||||
Reference in New Issue
Block a user