File tree Expand file tree Collapse file tree
routes/page/agent/[agentId]/agent-components/rules Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -115,6 +115,17 @@ export async function getAgentRuleOptions() {
115115 return response . data ;
116116}
117117
118+ /**
119+ * Get agent rule options by agent id
120+ * @param {string } agentId
121+ * @returns {Promise<import('$agentTypes').AgentRule[]> }
122+ */
123+ export async function getAgentRuleOptionsById ( agentId ) {
124+ const url = endpoints . agentRuleOptionsByIdUrl . replace ( "{agentId}" , agentId ) ; ;
125+ const response = await axios . get ( url ) ;
126+ return response . data ;
127+ }
128+
118129/**
119130 * Get agent rule config options
120131 * @returns {Promise<any> }
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ export const endpoints = {
4040 agentCreateUrl : `${ host } /agent` ,
4141 agentUtilityOptionsUrl : `${ host } /agent/utility/options` ,
4242 agentRuleOptionsUrl : `${ host } /rule/triggers` ,
43+ agentRuleOptionsByIdUrl : `${ host } /rule/triggers/{agentId}` ,
4344 agentRuleConfigOptionsUrl : `${ host } /rule/config/options` ,
4445 agentLabelsUrl : `${ host } /agent/labels` ,
4546
Original file line number Diff line number Diff line change 11<script >
22 import { onMount } from ' svelte' ;
3- import { getAgentRuleOptions , getAgentRuleConfigOptions } from ' $lib/services/agent-service' ;
3+ import { getAgentRuleOptionsById , getAgentRuleConfigOptions } from ' $lib/services/agent-service' ;
44 import LoadingToComplete from ' $lib/common/spinners/LoadingToComplete.svelte' ;
55 import { scrollToBottom } from ' $lib/helpers/utils/common' ;
66 import AgentRuleItem from ' ./agent-rule-item.svelte' ;
8989
9090 function loadAgentRuleOptions () {
9191 return new Promise ((resolve ) => {
92- getAgentRuleOptions ( ).then (data => {
92+ getAgentRuleOptionsById ( agent . id ).then (data => {
9393 const list = data? .map (x => {
9494 return {
9595 name: x .trigger_name ,
You can’t perform that action at this time.
0 commit comments