diff --git a/api/routes/task.ts b/api/routes/task.ts
index 3b7207b33..4980de312 100644
--- a/api/routes/task.ts
+++ b/api/routes/task.ts
@@ -57,7 +57,7 @@ export default async function router(schema: Schema, config: Config) {
})
}, async (req, res) => {
try {
- await Auth.as_user(config, req, { admin: true });
+ await Auth.as_user(config, req);
const list = await config.models.Task.list({
limit: req.query.limit,
@@ -75,6 +75,29 @@ export default async function router(schema: Schema, config: Config) {
}
});
+ await schema.post('/task', {
+ name: 'Create Task',
+ group: 'Task',
+ description: 'Create Registered Task',
+ body: Type.Object({
+ name: Type.String(),
+ prefix: Type.String(),
+ repo: Type.Optional(Type.String()),
+ readme: Type.Optional(Type.String()),
+ }),
+ res: TaskResponse
+ }, async (req, res) => {
+ try {
+ await Auth.as_user(config, req);
+
+ const task = await config.models.Task.generate(req.body);
+
+ return res.json(task);
+ } catch (err) {
+ return Err.respond(err, res);
+ }
+ });
+
await schema.get('/task/raw', {
name: 'List Tasks',
group: 'RawTask',
@@ -85,7 +108,7 @@ export default async function router(schema: Schema, config: Config) {
})
}, async (req, res) => {
try {
- await Auth.as_user(config, req, { admin: true });
+ await Auth.as_user(config, req);
const { total, tasks } = await listTasks();
@@ -111,7 +134,7 @@ export default async function router(schema: Schema, config: Config) {
})
}, async (req, res) => {
try {
- await Auth.as_user(config, req, { admin: true });
+ await Auth.as_user(config, req);
// Stuck with this approach for now - https://github.com/aws/containers-roadmap/issues/418
const { tasks } = await listTasks();
@@ -136,7 +159,7 @@ export default async function router(schema: Schema, config: Config) {
res: StandardResponse
}, async (req, res) => {
try {
- await Auth.as_user(config, req, { admin: true });
+ await Auth.as_user(config, req);
const { tasks } = await listTasks();
@@ -164,4 +187,33 @@ export default async function router(schema: Schema, config: Config) {
return Err.respond(err, res);
}
});
+
+ await schema.get('/task/prefix/:prefix/readme', {
+ name: 'Task README',
+ group: 'Task',
+ description: 'Return README Contents',
+ params: Type.Object({
+ prefix: Type.String()
+ }),
+ res: Type.Object({
+ body: Type.String()
+ })
+ }, async (req, res) => {
+ try {
+ await Auth.as_user(config, req);
+
+ const task = await config.models.Task.from(req.params.prefix);
+
+ if (task.readme) {
+ const readmeres = await fetch(task.readme);
+ return res.json({
+ body: await readmeres.text()
+ })
+ } else {
+ return res.json({ body: '' });
+ }
+ } catch (err) {
+ return Err.respond(err, res);
+ }
+ });
}
diff --git a/api/web/src/components/Admin.vue b/api/web/src/components/Admin.vue
index 0da01ffbe..74574acf8 100644
--- a/api/web/src/components/Admin.vue
+++ b/api/web/src/components/Admin.vue
@@ -51,6 +51,14 @@
}'
@click='$router.push(`/admin/config`)'
>Settings
+ ETL Containers
ETL Tasks
+ >Registered Tasks
+
+
+
+
+
+
+ ETL Task Containers
+
+
+
+
+
+
+
+
+
+
diff --git a/api/web/src/components/Admin/AdminTasks.vue b/api/web/src/components/Admin/AdminTasks.vue
index c1f6b88a5..4a29d1d54 100644
--- a/api/web/src/components/Admin/AdminTasks.vue
+++ b/api/web/src/components/Admin/AdminTasks.vue
@@ -1,87 +1,88 @@