Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/wincloud_gateway/node_modules/strapi-admin/admin/src/containers/MarketplacePage/ drwxr-xr-x | |
| Viewing file: Select action/file-type: import React, { useEffect, useRef } from 'react';
import { LoadingIndicatorPage, useGlobalContext, request } from 'strapi-helper-plugin';
import { Header } from '@buffetjs/custom';
import { useHistory } from 'react-router-dom';
import { useFetchPluginsFromMarketPlace } from '../../hooks';
import PageTitle from '../../components/PageTitle';
import PluginCard from './PluginCard';
import Wrapper from './Wrapper';
import MarketplaceBanner from './MarketplaceBanner';
const MarketPlacePage = () => {
const history = useHistory();
const { autoReload, emitEvent, currentEnvironment, formatMessage, plugins } = useGlobalContext();
const { error, isLoading, data } = useFetchPluginsFromMarketPlace();
const emitEventRef = useRef(emitEvent);
useEffect(() => {
emitEventRef.current('didGoToMarketplace');
}, []);
if (isLoading || error) {
return <LoadingIndicatorPage />;
}
const handleDownloadPlugin = async pluginId => {
emitEvent('willInstallPlugin', { plugin: pluginId });
// Force the Overlayblocker to be displayed
const overlayblockerParams = {
enabled: true,
title: 'app.components.InstallPluginPage.Download.title',
description: 'app.components.InstallPluginPage.Download.description',
};
// Lock the app
strapi.lockApp(overlayblockerParams);
try {
const opts = {
method: 'POST',
body: {
plugin: pluginId,
port: window.location.port,
},
};
const response = await request('/admin/plugins/install', opts, overlayblockerParams);
if (response.ok) {
emitEvent('didInstallPlugin', { plugin: pluginId });
// Reload the app
window.location.reload();
}
} catch (err) {
strapi.unlockApp();
strapi.notification.toggle({
type: 'warning',
message: { id: 'notification.error' },
});
}
};
return (
<div>
<PageTitle
title={formatMessage({
id: 'app.components.InstallPluginPage.helmet',
})}
/>
<Wrapper>
<Header
title={{
label: formatMessage({
id: 'app.components.InstallPluginPage.title',
}),
}}
content={formatMessage({
id: 'app.components.InstallPluginPage.description',
})}
/>
<MarketplaceBanner />
<div className="row" style={{ paddingTop: '4.1rem' }}>
{data.map(plugin => {
return (
<PluginCard
autoReload={autoReload}
currentEnvironment={currentEnvironment}
downloadPlugin={handleDownloadPlugin}
key={plugin.id}
history={history}
plugin={plugin}
showSupportUsButton={false}
isAlreadyInstalled={plugins[plugin.id] !== undefined}
/>
);
})}
</div>
</Wrapper>
</div>
);
};
export default MarketPlacePage;
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0286 ]-- |