feat(automationPlugin): add warning box for plugin usage and clear default rules

This commit is contained in:
Johannes Millan 2025-11-27 17:00:41 +01:00
parent 870b22fbf8
commit 3a8ffb8b5d
3 changed files with 25 additions and 50 deletions

View file

@ -125,3 +125,19 @@ table {
[data-theme='dark'] .app-header {
border-bottom-color: #444;
}
/* Warning box styles */
.warning-box {
background-color: #fff3cd;
color: #856404;
padding: 1rem;
margin-bottom: 2rem;
border-radius: var(--pico-border-radius);
border: 1px solid #ffeeba;
}
[data-theme='dark'] .warning-box {
background-color: rgba(255, 193, 7, 0.15);
color: #ffca28;
border-color: rgba(255, 193, 7, 0.3);
}

View file

@ -12,10 +12,15 @@ interface RuleListProps {
export function RuleList(props: RuleListProps) {
return (
<div class="rule-list-container">
<div class="grid">
<div className="grid">
<div>
<h2>Automation Rules</h2>
</div>
<div className="warning-box">
<strong>Warning:</strong> The plugin is very powerful and using it can destroy your data.
Use at your own risk!
</div>
<div style={{ 'text-align': 'right' }}>
<button class="outline" onClick={props.onCreate}>
+ New Rule
@ -23,19 +28,6 @@ export function RuleList(props: RuleListProps) {
</div>
</div>
<div
style={{
'background-color': 'var(--pico-color-amber-100)',
color: 'var(--pico-color-amber-900)',
padding: '1rem',
'margin-bottom': '1rem',
'border-radius': 'var(--pico-border-radius)',
border: '1px solid var(--pico-color-amber-200)',
}}
>
<strong>Warning:</strong> The plugin is very powerful and using it can destroy ones data
</div>
<figure>
<table role="grid">
<thead>
@ -61,7 +53,7 @@ export function RuleList(props: RuleListProps) {
<tr>
<td>{rule.name}</td>
<td>{rule.trigger.type}</td>
<td>
<td style={{ 'text-align': 'right', 'white-space': 'nowrap' }}>
<label>
<input
type="checkbox"
@ -71,7 +63,7 @@ export function RuleList(props: RuleListProps) {
{rule.isEnabled ? ' Enabled' : ' Disabled'}
</label>
</td>
<td style={{ 'text-align': 'right' }}>
<td style={{ 'text-align': 'right', 'white-space': 'nowrap' }}>
<button
class="outline"
onClick={() => props.onEdit(rule)}

View file

@ -27,40 +27,7 @@ export class RuleRegistry {
private initDefaultRules() {
// Hardcoded example rules for MVP
this.rules = [
{
id: '1',
name: 'Automatic Onboarding Tasks',
isEnabled: true,
trigger: { type: 'taskCreated' },
conditions: [{ type: 'titleContains', value: 'feature' }],
actions: [{ type: 'createTask', value: 'Write acceptance criteria' }],
},
{
id: '2',
name: 'Tag Newly Created Tasks Automatically',
isEnabled: true,
trigger: { type: 'taskCreated' },
conditions: [{ type: 'projectIs', value: 'General Inbox' }],
actions: [{ type: 'addTag', value: 'inbox' }],
},
{
id: '3',
name: 'Automatically Follow Up Changes',
isEnabled: true,
trigger: { type: 'taskUpdated' },
conditions: [{ type: 'titleContains', value: 'urgent' }],
actions: [{ type: 'addTag', value: 'prioritized' }],
},
{
id: '4',
name: 'Turn Task Updates Into Workflows',
isEnabled: true,
trigger: { type: 'taskUpdated' },
conditions: [{ type: 'hasTag', value: 'review' }],
actions: [{ type: 'createTask', value: 'Check notes before finishing' }],
},
];
this.rules = [];
}
async saveRules() {