fix: plugin task

pull/12372/head
StyleZhang 2 years ago
parent a0758dc2fc
commit bc927868f4

@ -34,11 +34,14 @@ const PluginTasks = () => {
handleClearErrorPlugin, handleClearErrorPlugin,
} = usePluginTaskStatus() } = usePluginTaskStatus()
const { getIconUrl } = useGetIcon() const { getIconUrl } = useGetIcon()
const runningPluginsLength = runningPlugins.length
const errorPluginsLength = errorPlugins.length
const successPluginsLength = successPlugins.length
const isInstalling = runningPlugins.length > 0 && errorPlugins.length === 0 && successPlugins.length === 0 const isInstalling = runningPluginsLength > 0 && errorPluginsLength === 0
const isInstallingWithError = errorPlugins.length > 0 && errorPlugins.length < totalPluginsLength const isInstallingWithError = runningPluginsLength > 0 && errorPluginsLength > 0
const isSuccess = successPlugins.length === totalPluginsLength && totalPluginsLength > 0 const isSuccess = successPluginsLength === totalPluginsLength && totalPluginsLength > 0
const isFailed = errorPlugins.length === totalPluginsLength && totalPluginsLength > 0 const isFailed = runningPluginsLength === 0 && (errorPluginsLength + successPluginsLength) === totalPluginsLength && totalPluginsLength > 0
const tip = useMemo(() => { const tip = useMemo(() => {
if (isInstalling) if (isInstalling)
@ -72,7 +75,7 @@ const PluginTasks = () => {
<div <div
className={cn( className={cn(
'relative flex items-center justify-center w-8 h-8 rounded-lg border-[0.5px] border-components-button-secondary-border bg-components-button-secondary-bg shadow-xs hover:bg-components-button-secondary-bg-hover', 'relative flex items-center justify-center w-8 h-8 rounded-lg border-[0.5px] border-components-button-secondary-border bg-components-button-secondary-bg shadow-xs hover:bg-components-button-secondary-bg-hover',
(isInstallingWithError || isFailed) && 'border-components-button-destructive-secondary-border-hover bg-state-destructive-hover hover:bg-state-destructive-hover-alt', (isInstallingWithError || isFailed) && 'border-components-button-destructive-secondary-border-hover bg-state-destructive-hover hover:bg-state-destructive-hover-alt cursor-pointer',
)} )}
> >
<RiInstallLine <RiInstallLine
@ -115,7 +118,9 @@ const PluginTasks = () => {
</PortalToFollowElemTrigger> </PortalToFollowElemTrigger>
<PortalToFollowElemContent className='z-10'> <PortalToFollowElemContent className='z-10'>
<div className='p-1 pb-2 w-[320px] rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur shadow-lg'> <div className='p-1 pb-2 w-[320px] rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur shadow-lg'>
<div className='flex items-center px-2 pt-1 h-7 system-sm-semibold-uppercase'>{t('plugin.task.installedError')}</div> <div className='flex items-center px-2 pt-1 h-7 system-sm-semibold-uppercase'>
{t('plugin.task.installedError', { errorLength: errorPlugins.length })}
</div>
{ {
errorPlugins.map(errorPlugin => ( errorPlugins.map(errorPlugin => (
<div <div

Loading…
Cancel
Save