-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: rename probe status check operation
- Loading branch information
1 parent
69abbdc
commit 5363f1a
Showing
19 changed files
with
54 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
3 changes: 2 additions & 1 deletion
3
src/extensions/migrations/20231213GP-add-adopted-probes-status-cron-handler.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/extensions/migrations/20250218GP-rename-probe-status-operation.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { FLOW_ID } from './20231213GP-add-adopted-probes-status-cron-handler.js'; | ||
|
||
export async function up (knex) { | ||
await knex('directus_operations').where({ type: 'adopted-probes-status-cron-handler' }).update({ | ||
name: 'Probes status CRON handler', | ||
key: 'probes_status_cron_handler', | ||
type: 'probes-status-cron-handler', | ||
}); | ||
|
||
await knex('directus_flows').where({ id: FLOW_ID }).update({ | ||
name: 'Probes status CRON', | ||
description: 'Checks online status of the probes', | ||
}); | ||
|
||
console.log('Renamed probe status check operation'); | ||
} | ||
|
||
export async function down () { | ||
console.log('There is no down operation for that migration.'); | ||
} |
10 changes: 0 additions & 10 deletions
10
...tensions/operations/adopted-probes-status-cron-handler/src/actions/check-online-status.ts
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...d-probes-status-cron-handler/package.json → ...s/probes-status-cron-handler/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/extensions/operations/probes-status-cron-handler/src/actions/check-online-status.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import type { OperationContext } from '@directus/extensions'; | ||
import { getProbes, increaseOnlineTimes } from '../repositories/directus.js'; | ||
|
||
export const checkOnlineStatus = async (context: OperationContext) => { | ||
const probes = await getProbes(context); | ||
const onlineProbes = probes.filter(({ status }) => status === 'ready'); | ||
|
||
const updatedIds = await increaseOnlineTimes(onlineProbes, context); | ||
return updatedIds; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...ted-probes-status-cron-handler/src/app.ts → ...ons/probes-status-cron-handler/src/app.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { defineOperationApp } from '@directus/extensions-sdk'; | ||
|
||
export default defineOperationApp({ | ||
id: 'adopted-probes-status-cron-handler', | ||
name: 'Adopted probes status CRON handler', | ||
id: 'probes-status-cron-handler', | ||
name: 'Probes status CRON handler', | ||
icon: 'schedule', | ||
description: 'CRON job to check if adopted probes are online.', | ||
description: 'CRON job to check if probes are online.', | ||
overview: () => [], | ||
options: [], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.