diff --git a/app.py b/app.py index 7615ee6..19a5755 100644 --- a/app.py +++ b/app.py @@ -43,6 +43,15 @@ def get_tasks(): }) return jsonify(task_list) +@app.route('/remove_task', methods=['DELETE']) +def remove_task(): + data = request.json + task = Task.get(Task.name == data['name']) + if task.running: + stop_specific_task(task.name) + task.delete_instance() + return jsonify({'message': 'Task removed successfully'}) + @app.route('/stop_scheduler', methods=['GET']) def stop(): stop_scheduler() diff --git a/scheduler-frontend/.gitignore b/scheduler-frontend/.gitignore new file mode 100644 index 0000000..403adbc --- /dev/null +++ b/scheduler-frontend/.gitignore @@ -0,0 +1,23 @@ +.DS_Store +node_modules +/dist + + +# local env files +.env.local +.env.*.local + +# Log files +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* + +# Editor directories and files +.idea +.vscode +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/scheduler-frontend/README.md b/scheduler-frontend/README.md new file mode 100644 index 0000000..ffae5af --- /dev/null +++ b/scheduler-frontend/README.md @@ -0,0 +1,24 @@ +# scheduler-frontend + +## Project setup +``` +yarn install +``` + +### Compiles and hot-reloads for development +``` +yarn serve +``` + +### Compiles and minifies for production +``` +yarn build +``` + +### Lints and fixes files +``` +yarn lint +``` + +### Customize configuration +See [Configuration Reference](https://cli.vuejs.org/config/). diff --git a/scheduler-frontend/babel.config.js b/scheduler-frontend/babel.config.js new file mode 100644 index 0000000..e955840 --- /dev/null +++ b/scheduler-frontend/babel.config.js @@ -0,0 +1,5 @@ +module.exports = { + presets: [ + '@vue/cli-plugin-babel/preset' + ] +} diff --git a/scheduler-frontend/jsconfig.json b/scheduler-frontend/jsconfig.json new file mode 100644 index 0000000..4aafc5f --- /dev/null +++ b/scheduler-frontend/jsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "target": "es5", + "module": "esnext", + "baseUrl": "./", + "moduleResolution": "node", + "paths": { + "@/*": [ + "src/*" + ] + }, + "lib": [ + "esnext", + "dom", + "dom.iterable", + "scripthost" + ] + } +} diff --git a/scheduler-frontend/package.json b/scheduler-frontend/package.json new file mode 100644 index 0000000..880b83e --- /dev/null +++ b/scheduler-frontend/package.json @@ -0,0 +1,45 @@ +{ + "name": "scheduler-frontend", + "version": "0.1.0", + "private": true, + "scripts": { + "serve": "vue-cli-service serve", + "build": "vue-cli-service build", + "lint": "vue-cli-service lint" + }, + "dependencies": { + "axios": "^1.7.2", + "core-js": "^3.8.3", + "vue": "^3.2.13", + "vue-axios": "^3.5.2" + }, + "devDependencies": { + "@babel/core": "^7.12.16", + "@babel/eslint-parser": "^7.12.16", + "@vue/cli-plugin-babel": "~5.0.0", + "@vue/cli-plugin-eslint": "~5.0.0", + "@vue/cli-service": "~5.0.0", + "eslint": "^7.32.0", + "eslint-plugin-vue": "^8.0.3" + }, + "eslintConfig": { + "root": true, + "env": { + "node": true + }, + "extends": [ + "plugin:vue/vue3-essential", + "eslint:recommended" + ], + "parserOptions": { + "parser": "@babel/eslint-parser" + }, + "rules": {} + }, + "browserslist": [ + "> 1%", + "last 2 versions", + "not dead", + "not ie 11" + ] +} diff --git a/scheduler-frontend/public/favicon.ico b/scheduler-frontend/public/favicon.ico new file mode 100644 index 0000000..df36fcf Binary files /dev/null and b/scheduler-frontend/public/favicon.ico differ diff --git a/scheduler-frontend/public/index.html b/scheduler-frontend/public/index.html new file mode 100644 index 0000000..3e5a139 --- /dev/null +++ b/scheduler-frontend/public/index.html @@ -0,0 +1,17 @@ + + +
+ + + + +{{ task.curl }}
+Interval: {{ task.interval }} seconds
+Status: {{ task.running ? 'Running' : 'Stopped' }}
+Last Result: {{ task.result }}
+ + +
+ For a guide and recipes on how to configure / customize this project,
+ check out the
+ vue-cli documentation.
+