Skip to content

Commit

Permalink
Merge pull request #2984 from uktrade/feat/your-files-ordering
Browse files Browse the repository at this point in the history
Feat/your files ordering
  • Loading branch information
oliver-weare authored Feb 1, 2024
2 parents f67e4f4 + 972ab92 commit a30559d
Show file tree
Hide file tree
Showing 7 changed files with 5,843 additions and 1,641 deletions.
29 changes: 29 additions & 0 deletions cypress/e2e/your-files/your-files.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
describe("Your files list view", () => {
beforeEach(() => {
cy.intercept("GET", "http://data-workspace-localstack:4566/notebooks.dataworkspace.local*", {fixture: "your-files/buckets-response.xml"})
cy.intercept("GET", "/api/v1/aws_credentials", {fixture: "your-files/credentials-response.xml"})
cy.visit("/files/");
});

it("should order the files descending by default", () => {
cy.get("tr").as("file_rows");
cy.get("@file_rows")
.eq(3)
.should("exist")
.find("a")
.should("have.text", "second_test_file.rtf");

cy.get("@file_rows")
.eq(4)
.should("exist")
.find("a")
.should("have.text", "third_test_file.rtf");

cy.get("@file_rows")
.eq(5)
.should("exist")
.find("a")
.should("have.text", "test_file.rtf");
});
});

33 changes: 33 additions & 0 deletions cypress/fixtures/your-files/buckets-response.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Name>notebooks.analysisworkspace.dev.uktrade.io</Name>
<Prefix>user/</Prefix>
<KeyCount>4</KeyCount>
<MaxKeys>1000</MaxKeys>
<Delimiter>/</Delimiter>
<IsTruncated>false</IsTruncated>
<Contents>
<Key>/test_file.rtf</Key>
<LastModified>2012-01-30T10:03:44.000Z</LastModified>
<ETag></ETag>
<Size>220</Size>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>/second_test_file.rtf</Key>
<LastModified>2024-01-30T14:31:21.000Z</LastModified>
<ETag></ETag>
<Size>220</Size>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>/third_test_file.rtf</Key>
<LastModified>2018-01-30T12:20:10.000Z</LastModified>
<ETag></ETag>
<Size>220</Size>
<StorageClass>STANDARD</StorageClass>
</Contents>
<CommonPrefixes>
<Prefix>/testfolder/</Prefix>
</CommonPrefixes>
</ListBucketResult>
6 changes: 6 additions & 0 deletions cypress/fixtures/your-files/credentials-response.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"AccessKeyId": "Key",
"SecretAccessKey": "Secret",
"SessionToken": "Session",
"Expiration": "2024-01-30T16:24:15Z"
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,10 @@ export default class App extends React.Component {
isSelected: false,
}));

files.sort(function(a, b) {
return b.formattedDate - a.formattedDate;
});

const teamsFolders =
params.Prefix === rootPrefix
? this.props.config.teamsPrefixes.map((team) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@
"path": "visualisations.efc6a58d2f8460a240a9.js.LICENSE.txt",
"publicPath": "/__django_static/js/bundles/visualisations.efc6a58d2f8460a240a9.js.LICENSE.txt"
},
"your-files.f2770a2e3a7198bdf1e9.js": {
"name": "your-files.f2770a2e3a7198bdf1e9.js",
"path": "your-files.f2770a2e3a7198bdf1e9.js",
"publicPath": "/__django_static/js/bundles/your-files.f2770a2e3a7198bdf1e9.js"
"your-files.c14d6787674946571ec3.js": {
"name": "your-files.c14d6787674946571ec3.js",
"path": "your-files.c14d6787674946571ec3.js",
"publicPath": "/__django_static/js/bundles/your-files.c14d6787674946571ec3.js"
},
"your-files.f2770a2e3a7198bdf1e9.js.LICENSE.txt": {
"name": "your-files.f2770a2e3a7198bdf1e9.js.LICENSE.txt",
"path": "your-files.f2770a2e3a7198bdf1e9.js.LICENSE.txt",
"publicPath": "/__django_static/js/bundles/your-files.f2770a2e3a7198bdf1e9.js.LICENSE.txt"
"your-files.c14d6787674946571ec3.js.LICENSE.txt": {
"name": "your-files.c14d6787674946571ec3.js.LICENSE.txt",
"path": "your-files.c14d6787674946571ec3.js.LICENSE.txt",
"publicPath": "/__django_static/js/bundles/your-files.c14d6787674946571ec3.js.LICENSE.txt"
}
},
"chunks": {
Expand All @@ -79,7 +79,7 @@
"visualisations.efc6a58d2f8460a240a9.js"
],
"your-files": [
"your-files.f2770a2e3a7198bdf1e9.js"
"your-files.c14d6787674946571ec3.js"
]
},
"publicPath": "/__django_static/js/bundles/"
Expand Down
Loading

0 comments on commit a30559d

Please sign in to comment.