Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
d893a36a47 |
@@ -0,0 +1,3 @@
|
||||
import listWatches from './list-watches/index.js';
|
||||
|
||||
export default [listWatches];
|
@@ -0,0 +1,24 @@
|
||||
export default {
|
||||
name: 'List watches',
|
||||
key: 'listWatches',
|
||||
|
||||
async run($) {
|
||||
const watches = {
|
||||
data: [],
|
||||
};
|
||||
|
||||
const { data } = await $.http.get('/v1/watch');
|
||||
const watchIds = Object.keys(data);
|
||||
|
||||
if (watchIds?.length) {
|
||||
for (const watchId of watchIds) {
|
||||
watches.data.push({
|
||||
value: watchId,
|
||||
name: data[watchId].url,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return watches;
|
||||
},
|
||||
};
|
@@ -3,6 +3,8 @@ import addAuthHeader from './common/add-auth-header.js';
|
||||
import auth from './auth/index.js';
|
||||
import setBaseUrl from './common/set-base-url.js';
|
||||
import actions from './actions/index.js';
|
||||
import dynamicData from './dynamic-data/index.js';
|
||||
import triggers from './triggers/index.js';
|
||||
|
||||
export default defineApp({
|
||||
name: 'Changedetection',
|
||||
@@ -16,4 +18,6 @@ export default defineApp({
|
||||
beforeRequest: [setBaseUrl, addAuthHeader],
|
||||
auth,
|
||||
actions,
|
||||
dynamicData,
|
||||
triggers,
|
||||
});
|
||||
|
@@ -0,0 +1,43 @@
|
||||
import defineTrigger from '../../../../helpers/define-trigger.js';
|
||||
|
||||
export default defineTrigger({
|
||||
name: 'Changed watch',
|
||||
key: 'changedWatch',
|
||||
pollInterval: 15,
|
||||
description: 'Triggers when any changes detected.',
|
||||
arguments: [
|
||||
{
|
||||
label: 'Watch',
|
||||
key: 'watchId',
|
||||
type: 'dropdown',
|
||||
required: true,
|
||||
description: '',
|
||||
variables: true,
|
||||
source: {
|
||||
type: 'query',
|
||||
name: 'getDynamicData',
|
||||
arguments: [
|
||||
{
|
||||
name: 'key',
|
||||
value: 'listWatches',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
async run($) {
|
||||
const watchId = $.step.parameters.watchId;
|
||||
|
||||
const { data } = await $.http.get(`v1/watch/${watchId}`);
|
||||
|
||||
if (Object.keys(data).length !== 0) {
|
||||
$.pushTriggerItem({
|
||||
raw: data,
|
||||
meta: {
|
||||
internalId: `${watchId}-${data.last_changed}`,
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
@@ -0,0 +1,3 @@
|
||||
import changedWatch from './changed-watch/index.js';
|
||||
|
||||
export default [changedWatch];
|
@@ -46,6 +46,8 @@ export default defineConfig({
|
||||
collapsible: true,
|
||||
collapsed: true,
|
||||
items: [
|
||||
{ text: 'Triggers', link: '/apps/changedetection/triggers' },
|
||||
{ text: 'Actions', link: '/apps/changedetection/actions' },
|
||||
{ text: 'Connection', link: '/apps/changedetection/connection' },
|
||||
],
|
||||
},
|
||||
|
12
packages/docs/pages/apps/changedetection/triggers.md
Normal file
12
packages/docs/pages/apps/changedetection/triggers.md
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
favicon: /favicons/changedetection.svg
|
||||
items:
|
||||
- name: Changed watch
|
||||
desc: Triggers when any changes detected.
|
||||
---
|
||||
|
||||
<script setup>
|
||||
import CustomListing from '../../components/CustomListing.vue'
|
||||
</script>
|
||||
|
||||
<CustomListing />
|
Reference in New Issue
Block a user