Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/add requestgroups pages #4

Merged
merged 19 commits into from Aug 27, 2020
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
a5ea86c
Archive authentication, start on request detail page
eheinrich Aug 18, 2020
ae7abae
Add requestgroup detail page
eheinrich Aug 19, 2020
78b50e9
Add request detail
eheinrich Aug 19, 2020
95fdc4f
Fix a few issues with the request details page
eheinrich Aug 20, 2020
68301c4
Add compose page
eheinrich Aug 20, 2020
749adae
Fix some issues with the sidenav from the newer version of bootstrap vue
eheinrich Aug 20, 2020
7d42f51
Only add csrf token in header for unsafe methods and to the observati…
eheinrich Aug 20, 2020
467a819
Refactor the request and requestgroups detail pages to use the same c…
eheinrich Aug 20, 2020
345bf34
Fix loading in drafts
eheinrich Aug 20, 2020
5d9bf3a
Some minor fixes
eheinrich Aug 21, 2020
0587829
Add a navigation guard that checks if a route required auth, and redi…
eheinrich Aug 21, 2020
d205a29
Update request id when switching between request detail pages while s…
eheinrich Aug 24, 2020
b78886d
Added recommended vue eslint configuration, and a couple of other esl…
eheinrich Aug 25, 2020
a9e0430
Use prettier for code style and fixed issues
eheinrich Aug 25, 2020
84c8b9a
Update an alert message to be more descriptive, add a comment clarify…
eheinrich Aug 26, 2020
234dde4
update some type checks
eheinrich Aug 26, 2020
249d96c
Merge branch 'feature/add-requestgroups-pages' into feature/cleanup-c…
eheinrich Aug 27, 2020
9e01965
Fix lint error
eheinrich Aug 27, 2020
1e6e40a
Merge pull request #5 from LCOGT/feature/cleanup-code-formatting
eheinrich Aug 27, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
132 changes: 132 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions package.json
Expand Up @@ -11,16 +11,20 @@
},
"dependencies": {
"bootstrap": "^4.3.1",
"bootstrap-table": "^1.14.2",
"bootstrap-vue": "^2.15.0",
"core-js": "^3.6.5",
"chart.js": "^2.8.0",
"chartjs-plugin-annotation": "^0.5.7",
"jquery": "^3.5.0",
"jquery-file-download": "^1.4.6",
"lodash": "^4.17.13",
"moment": "^2.22.1",
"popper.js": "^1.16.1",
"vis": "4.19.1",
"vue": "^2.6.11",
"vue-router": "^3.2.0",
"vue-ctk-date-time-picker": "^2.0.9",
"vuex": "^3.4.0"
},
"devDependencies": {
Expand Down
4 changes: 3 additions & 1 deletion public/config/urls.json
@@ -1,5 +1,7 @@
{
"observationPortalApiUrl": "http://127.0.0.1:8000",
"archiveApiUrl": "http://127.0.0.1:8000",
"simbadServiceUrl": "http://127.0.0.1:8000"
"archiveClientUrl": "http://127.0.0.1:8000",
"simbadServiceUrl": "http://127.0.0.1:8000",
"thumbnailServiceUrl": "http://127.0.0.1:8000"
}
39 changes: 39 additions & 0 deletions src/archive.js
@@ -0,0 +1,39 @@
import $ from 'jquery';
import 'jquery-file-download';

export { downloadZip, downloadAll, getLatestFrame };

function downloadZip(frameIds, archiveRoot, archiveToken) {
let postData = {};
for (let i = 0; i < frameIds.length; i++) {
postData['frame_ids[' + i + ']'] = frameIds[i];
jnation3406 marked this conversation as resolved.
Show resolved Hide resolved
}
postData['auth_token'] = archiveToken;
$.fileDownload(archiveRoot + '/frames/zip/', {
httpMethod: 'POST',
data: postData,
});
}

function downloadAll(requestId, archiveRoot, archiveClientUrl, archiveToken) {
$.getJSON(archiveRoot + '/frames/?limit=1000&REQNUM=' + requestId, function(data) {
if (data.count > 1000) {
alert('Over 1000 products found. Please use ' + archiveClientUrl + ' to download your data');
return false;
}
let frameIds = [];
for (let i = 0; i < data.results.length; i++) {
frameIds.push(data.results[i].id);
}
downloadZip(frameIds, archiveRoot, archiveToken);
});
}

function getLatestFrame(requestId, archiveRoot, callback) {
$.ajax({
url: archiveRoot + '/frames/?ordering=-id&limit=1&REQNUM=' + requestId,
dataType: 'json',
}).done(function(response) {
callback(response.results[0]);
});
}