mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-07-17 16:50:53 +00:00
Fix legacy plugin actions missing events
Some checks are pending
CI Pipeline / prepare (push) Waiting to run
CI Pipeline / docker (amd64, ubuntu-24.04) (push) Blocked by required conditions
CI Pipeline / docker (arm64, ubuntu-24.04-arm) (push) Blocked by required conditions
CI Pipeline / create-manifest (push) Blocked by required conditions
Build and Push Multi-Arch Docker Image / build-and-push (push) Waiting to run
Frontend Tests / test (push) Waiting to run
Some checks are pending
CI Pipeline / prepare (push) Waiting to run
CI Pipeline / docker (amd64, ubuntu-24.04) (push) Blocked by required conditions
CI Pipeline / docker (arm64, ubuntu-24.04-arm) (push) Blocked by required conditions
CI Pipeline / create-manifest (push) Blocked by required conditions
Build and Push Multi-Arch Docker Image / build-and-push (push) Waiting to run
Frontend Tests / test (push) Waiting to run
Treat action.events as optional ([] by default) and guard UI rendering so Plugin cards no longer crash.
This commit is contained in:
parent
e0e195da92
commit
03c8d55ab9
1 changed files with 39 additions and 32 deletions
|
|
@ -37,38 +37,45 @@ const PluginActionList = ({
|
|||
runningActionId,
|
||||
handlePluginRun,
|
||||
}) => {
|
||||
return plugin.actions.map((action) => (
|
||||
<Group key={action.id} justify="space-between">
|
||||
<div>
|
||||
<Text>{action.label}</Text>
|
||||
{action.description && (
|
||||
<Text size="sm" c="dimmed">
|
||||
{action.description}
|
||||
</Text>
|
||||
)}
|
||||
<Text size="xs" style={{ paddingTop: 10 }}>
|
||||
Event Triggers
|
||||
</Text>
|
||||
{action.events.map((event) => (
|
||||
<Badge size="sm" variant="light" color="green">
|
||||
{SUBSCRIPTION_EVENTS[event] || event}
|
||||
</Badge>
|
||||
))}
|
||||
</div>
|
||||
<Button
|
||||
loading={runningActionId === action.id}
|
||||
disabled={!enabled || runningActionId === action.id}
|
||||
onClick={() => handlePluginRun(action)}
|
||||
size="xs"
|
||||
variant={action.button_variant || 'filled'}
|
||||
color={action.button_color}
|
||||
>
|
||||
{runningActionId === action.id
|
||||
? 'Running…'
|
||||
: action.button_label || 'Run'}
|
||||
</Button>
|
||||
</Group>
|
||||
));
|
||||
return plugin.actions.map((action) => {
|
||||
const events = Array.isArray(action?.events) ? action.events : [];
|
||||
return (
|
||||
<Group key={action.id} justify="space-between">
|
||||
<div>
|
||||
<Text>{action.label}</Text>
|
||||
{action.description && (
|
||||
<Text size="sm" c="dimmed">
|
||||
{action.description}
|
||||
</Text>
|
||||
)}
|
||||
{events.length > 0 && (
|
||||
<>
|
||||
<Text size="xs" style={{ paddingTop: 10 }}>
|
||||
Event Triggers
|
||||
</Text>
|
||||
{events.map((event) => (
|
||||
<Badge key={`${action.id}:${event}`} size="sm" variant="light" color="green">
|
||||
{SUBSCRIPTION_EVENTS[event] || event}
|
||||
</Badge>
|
||||
))}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
<Button
|
||||
loading={runningActionId === action.id}
|
||||
disabled={!enabled || runningActionId === action.id}
|
||||
onClick={() => handlePluginRun(action)}
|
||||
size="xs"
|
||||
variant={action.button_variant || 'filled'}
|
||||
color={action.button_color}
|
||||
>
|
||||
{runningActionId === action.id
|
||||
? 'Running…'
|
||||
: action.button_label || 'Run'}
|
||||
</Button>
|
||||
</Group>
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
const PluginActionStatus = ({ running, lastResult }) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue