Skip to content

Commit

Permalink
Add Private Data List
Browse files Browse the repository at this point in the history
  • Loading branch information
ingalls committed Feb 7, 2024
1 parent 18ba0d5 commit bb7947d
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 11 deletions.
2 changes: 1 addition & 1 deletion api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"build": "tsc --outDir . && rm ./routes/*.ts",
"prod": "NODE_OPTIONS='--max-old-space-size=6144' forever index.js",
"lint": "eslint index.ts lib/**.ts test/**.ts",
"loaddb": "echo 'DROP DATABASE tak_ps_etl' | psql && echo 'CREATE DATABASE tak_ps_etl' | psql && psql tak_ps_etl < wftak-staging-etl-latest.dump",
"loaddb": "echo 'DROP DATABASE tak_ps_etl' | psql && echo 'CREATE DATABASE tak_ps_etl' | psql && psql tak_ps_etl < coe-etl-latest.dump",
"dev": "nodemon -i schema/ -i web/ --esm index.ts --noevents --nosinks --nometrics --unsafe"
},
"repository": {
Expand Down
28 changes: 28 additions & 0 deletions api/routes/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,34 @@ import DataMission from '../lib/data-mission.js';
import { AuthResourceAccess } from '@tak-ps/blueprint-login';

export default async function router(schema: any, config: Config) {
await schema.get('/data', {
private: true,
name: 'Internal List Data',
group: 'Data',
auth: 'user',
description: `
Used by the frontend UI to list data packages that the user can visualize
`,
query: 'req.query.ListData.json',
res: 'res.ListData.json'
}, async (req: AuthRequest, res: Response) => {
try {
await Auth.is_auth(config.models, req);

const list = await config.models.Data.list({
limit: Number(req.query.limit),
page: Number(req.query.page),
order: String(req.query.order),
sort: String(req.query.sort),
where: sql`name ~* ${req.query.filter}`
});

res.json(list);
} catch (err) {
return Err.respond(err, res);
}
});

await schema.get('/data/:dataid', {
private: true,
name: 'Internal Get Data',
Expand Down
2 changes: 1 addition & 1 deletion api/schema/profile_overlays/id.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"type": "number",
"description": "",
"$comment": "int4"
"$comment": "int8"
}
2 changes: 1 addition & 1 deletion api/schema/profile_overlays/mode.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"type": "string",
"description": "",
"$comment": "varchar"
"$comment": "text"
}
2 changes: 1 addition & 1 deletion api/schema/profile_overlays/name.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"type": "string",
"description": "",
"$comment": "varchar"
"$comment": "text"
}
2 changes: 1 addition & 1 deletion api/schema/profile_overlays/opacity.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"type": "number",
"description": "",
"$comment": "int4"
"$comment": "float8"
}
2 changes: 1 addition & 1 deletion api/schema/profile_overlays/type.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"type": "string",
"description": "",
"$comment": "varchar"
"$comment": "text"
}
2 changes: 1 addition & 1 deletion api/schema/profile_overlays/url.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"type": "string",
"description": "",
"$comment": "varchar"
"$comment": "text"
}
7 changes: 5 additions & 2 deletions api/schema/profile_overlays/username.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"type": "string",
"type": [
"string",
"null"
],
"description": "",
"$comment": "varchar"
"$comment": "text"
}
4 changes: 2 additions & 2 deletions api/web/src/components/CloudTAK/Menu/Datas.vue
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export default {
a.visible = false;
} else {
a.visible = true;
const url = window.stdurl(`/api/data/${this.data.id}/asset/${a.visualized}/tile`);
const url = window.stdurl(`/api/connection/${this.data.connection}/data/${this.data.id}/asset/${a.visualized}/tile`);
url.searchParams.append('token', localStorage.token);
await this.createOverlay(id, url, a)
Expand Down Expand Up @@ -241,7 +241,7 @@ export default {
},
fetchAssetList: async function() {
this.loading = true;
const url = window.stdurl(`/api/data/${this.data.id}/asset`);
const url = window.stdurl(`/api/connection/${this.data.connection}/data/${this.data.id}/asset`);
if (this.query && this.paging.filter) url.searchParams.append('filter', this.paging.filter);
url.searchParams.append('limit', this.paging.limit);
url.searchParams.append('page', this.paging.page);
Expand Down

0 comments on commit bb7947d

Please sign in to comment.