Skip to content

Commit

Permalink
Merge branch 'main' into refactor-remove-routing.transition-methods-d…
Browse files Browse the repository at this point in the history
…eprecation
  • Loading branch information
jaredgalanis authored Jun 27, 2024
2 parents 85d88dc + 7a83889 commit 9d5c2a3
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 11 deletions.
9 changes: 6 additions & 3 deletions app/adapters/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ export default class ApplicationAdapter extends JSONAPIAdapter {

namespace = ENV.passApi.namespace;

headers = {
withCredentials: true,
};
get headers() {
return {
withCredentials: true,
'X-XSRF-TOKEN': document.cookie.match(/XSRF-TOKEN\=([^;]*)/)['1'],
};
}

// Camel case instead of pluralize model types for our API
pathForType(type) {
Expand Down
4 changes: 4 additions & 0 deletions app/adapters/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ export default class FileAdapter extends ApplicationAdapter {
}
return fetch(url, {
method: 'DELETE',
credentials: 'same-origin',
headers: {
'X-XSRF-TOKEN': document.cookie.match(/XSRF-TOKEN\=([^;]*)/)['1'],
},
}).then((response) => {
if (!response.ok) {
throw new Error('Delete request to the file service failed');
Expand Down
7 changes: 6 additions & 1 deletion app/components/workflow-files/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,12 @@ export default class WorkflowFiles extends Component {
@action
async uploadFile(FileUpload) {
try {
const response = await FileUpload.upload(ENV.fileServicePath);
const response = await FileUpload.upload(ENV.fileServicePath, {
withCredentials: true,
headers: {
'X-XSRF-TOKEN': document.cookie.match(/XSRF-TOKEN\=([^;]*)/)['1'],
},
});

const file = await response.json();

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/grants/detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default class GrantDetailsController extends Controller {
propertyName: 'submittedDate',
title: 'Submitted Date',
className: 'date-column',
component: 'date-cell',
component: 'dateCell',
},
{
propertyName: 'submissionStatus',
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/grants/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ export default class GrantsIndexController extends Controller {
title: 'Start',
disableFiltering: true,
className: 'date-column',
component: 'date-cell',
component: 'dateCell',
},
{
propertyName: 'grant.endDate',
title: 'End',
disableFiltering: true,
className: 'date-column',
component: 'date-cell',
component: 'dateCell',
},
{
propertyName: 'grant.awardStatus',
Expand Down Expand Up @@ -100,7 +100,7 @@ export default class GrantsIndexController extends Controller {
title: 'End Date',
disableFiltering: true,
className: 'date-column',
component: 'date-cell',
component: 'dateCell',
},
{
propertyName: 'submissions.length',
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/submissions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default class SubmissionsIndex extends Controller {
propertyName: 'submittedDate',
title: 'Submitted Date',
className: 'date-column',
component: 'date-cell',
component: 'dateCell',
},
{
propertyName: 'submissionStatus',
Expand Down Expand Up @@ -107,7 +107,7 @@ export default class SubmissionsIndex extends Controller {
propertyName: 'submittedDate',
title: 'Submitted Date',
className: 'date-column',
component: 'date-cell',
component: 'dateCell',
},
{
propertyName: 'submissionStatus',
Expand Down
1 change: 1 addition & 0 deletions app/services/doi.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export default class DoiService extends Service {
headers: {
Accept: 'application/json; charset=utf-8',
withCredentials: 'include',
'X-XSRF-TOKEN': document.cookie.match(/XSRF-TOKEN\=([^;]*)/)['1'],
},
});

Expand Down
1 change: 1 addition & 0 deletions app/templates/grants/detail.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
submissionsStatusCell=(component "submissions-status-cell")
submissionsRepoidCell=(component "submissions-repoid-cell")
submissionActionCell=(component "submission-action-cell")
dateCell=(component "date-cell")
}}
@themeInstance={{this.themeInstance}}
@showColumnsDropdown={{false}}
Expand Down
1 change: 1 addition & 0 deletions app/templates/grants/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
piListCell=(component "pi-list-cell")
grantSubmissionCell=(component "grant-submission-cell")
grantActionCell=(component "grant-action-cell")
dateCell=(component "date-cell")
}}
@themeInstance={{this.themeInstance}}
@showColumnsDropdown={{false}}
Expand Down
1 change: 1 addition & 0 deletions app/templates/submissions/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
submissionsStatusCell=(component "submissions-status-cell")
submissionsRepoidCell=(component "submissions-repoid-cell")
submissionActionCell=(component "submission-action-cell")
dateCell=(component "date-cell")
}}
@themeInstance={{this.themeInstance}}
@showColumnsDropdown={{false}}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pass-ui",
"version": "1.7.0-SNAPSHOT",
"version": "1.8.0-SNAPSHOT",
"private": true,
"description": "The user interface for the eclipse-pass project",
"license": "MIT",
Expand Down
3 changes: 3 additions & 0 deletions tests/test-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ setupSinon();
setup(QUnit.assert);

start();

// Set a fake CSRF token
document.cookie = 'XSRF-TOKEN=moo';

0 comments on commit 9d5c2a3

Please sign in to comment.