|
1 | 1 | <script> |
2 | 2 | import { onMount } from 'svelte'; |
3 | 3 | import { Card, CardBody, Input, Button } from '@sveltestrap/sveltestrap'; |
4 | | - import { getAgentEventRuleOptions } from '$lib/services/agent-service'; |
| 4 | + import { getAgentRuleOptions } from '$lib/services/agent-service'; |
5 | 5 |
|
6 | 6 | const limit = 5; |
7 | 7 | const textLimit = 50; |
8 | 8 |
|
9 | 9 | /** @type {import('$agentTypes').AgentModel} */ |
10 | 10 | export let agent; |
11 | 11 |
|
12 | | - export const fetchEventRules = () => { |
| 12 | + export const fetchRules = () => { |
13 | 13 | const candidates = innerRules?.filter(x => !!x.name)?.map(x => { |
14 | 14 | return { |
15 | 15 | name: x.name, |
|
19 | 19 | }; |
20 | 20 | }); |
21 | 21 |
|
22 | | - /** @type {import('$agentTypes').AgentEventRule[]} */ |
| 22 | + /** @type {import('$agentTypes').AgentRule[]} */ |
23 | 23 | const rules = []; |
24 | 24 | const unique = new Set(); |
25 | 25 | candidates.forEach(x => { |
|
36 | 36 | /** @type {any[]} */ |
37 | 37 | let ruleOptions = []; |
38 | 38 |
|
39 | | - /** @type {import('$agentTypes').AgentEventRule[]} */ |
| 39 | + /** @type {import('$agentTypes').AgentRule[]} */ |
40 | 40 | let innerRules = []; |
41 | 41 |
|
42 | 42 | onMount(async () =>{ |
43 | | - getAgentEventRuleOptions().then(data => { |
| 43 | + getAgentRuleOptions().then(data => { |
44 | 44 | const list = data?.map(x => { |
45 | 45 | return { |
46 | 46 | name: x.name, |
|
56 | 56 | }); |
57 | 57 |
|
58 | 58 | function init() { |
59 | | - const list = agent.event_rules?.map(x => { |
| 59 | + const list = agent.rules?.map(x => { |
60 | 60 | return { |
61 | 61 | ...x, |
62 | 62 | displayName: "", |
|
128 | 128 | } |
129 | 129 |
|
130 | 130 |
|
131 | | - /** @param {import('$agentTypes').AgentEventRule[]} list */ |
| 131 | + /** @param {import('$agentTypes').AgentRule[]} list */ |
132 | 132 | function refresh(list) { |
133 | 133 | innerRules = list?.map(x => { |
134 | 134 | return { |
|
146 | 146 | <Card> |
147 | 147 | <CardBody> |
148 | 148 | <div class="text-center"> |
149 | | - <h5 class="mt-1 mb-3">Event Rules</h5> |
| 149 | + <h5 class="mt-1 mb-3">Rules</h5> |
150 | 150 | </div> |
151 | 151 |
|
152 | 152 | <div class="agent-utility-container"> |
153 | 153 | {#each innerRules as rule, uid (uid)} |
154 | 154 | <div class="utility-wrapper"> |
155 | 155 | <div class="utility-row utility-row-primary"> |
156 | 156 | <div class="utility-label fw-bold"> |
157 | | - <div class="line-align-center">{`Collection #${uid + 1}`}</div> |
| 157 | + <div class="line-align-center">{`Rule #${uid + 1}`}</div> |
158 | 158 | <div class="utility-tooltip"> |
159 | 159 | <div class="line-align-center"> |
160 | 160 | <Input |
|
247 | 247 | <Button color="primary" on:click={() => addRule()}> |
248 | 248 | <span> |
249 | 249 | <i class="bx bx-plus" /> |
250 | | - <span>Add Event Rule</span> |
| 250 | + <span>Add Rule</span> |
251 | 251 | </span> |
252 | 252 | </Button> |
253 | 253 | </div> |
|
0 commit comments