Commit 9c682ec3 authored by jfriedli's avatar jfriedli
Browse files

Merge branch 'develop' into 'master'

Time Remaining & updates

See merge request !376
parents 210fde6e 15d06f0e
Pipeline #50375 passed with stages
in 18 minutes and 48 seconds
......@@ -33,5 +33,6 @@
"label": "Bezeichnung",
"value": "Wert",
"of": "von",
"records_per_page": "Einträge pro Seite"
"records_per_page": "Einträge pro Seite",
"timed_out": "Download abgelaufen"
}
......@@ -33,5 +33,6 @@
"label": "Label",
"value": "Value",
"of": "of",
"records_per_page": "Records per page"
"records_per_page": "Records per page",
"timed_out": "Download expired"
}
......@@ -33,5 +33,6 @@
"label": "Etiqueta",
"value": "Valor",
"of": "de",
"records_per_page": "Registros por página"
"records_per_page": "Registros por página",
"timed_out": "La descarga expiró"
}
......@@ -33,5 +33,6 @@
"label": "Étiquette",
"value": "Valeur",
"of": "de",
"records_per_page": "Enregistrements par page"
"records_per_page": "Enregistrements par page",
"timed_out": "Téléchargement expiré"
}
......@@ -33,5 +33,5 @@
"label": "Etichetta",
"value": "Valore",
"of": "di",
"records_per_page": "Record per pagina"
"records_per_page": "Scarica scaduto"
}
......@@ -167,7 +167,10 @@ export default {
data: function () {
return {
deactivatedMap: {},
activeMetadataModal: ''
activeMetadataModal: '',
downloadTimeSeconds: 0,
maxDownloadTimeSeconds: null,
downloadTimer: null
}
},
computed: {
......@@ -184,6 +187,11 @@ export default {
} else if (this.cleanedFiles?.successful?.length > 1) {
this.triggerBulkDownload()
}
this.initRemainingDownloadTimer()
},
beforeRouteLeave (to, from, next) {
this.resetDownloadTimer()
next()
},
methods: {
deactivate (key) {
......@@ -219,6 +227,38 @@ export default {
this.$router.push('/error')
}
}
},
resetDownloadTimer () {
if (this.downloadTimer) {
clearInterval(this.downloadTimer)
}
this.downloadTimer = null
},
incrementSeconds () {
this.downloadTimeSeconds += 1
if (this.downloadTimeSeconds > this.maxDownloadTimeSeconds) {
this.resetDownloadTimer()
this.$q.notify({
color: 'warning',
position: 'top',
message: this.$t('timed_out'),
icon: 'report_problem'
})
this.$router.push('/')
}
},
initRemainingDownloadTimer () {
if (this.cleanedFiles?.successful?.length > 0) {
let min = this.cleanedFiles.successful[0].response?.data['inactive_after_sec']
this.cleanedFiles.successful.forEach((cleanedFile) => {
if (min > cleanedFile.inactive_after_sec) {
min = cleanedFile.inactive_after_sec
}
})
this.maxDownloadTimeSeconds = min
this.downloadTimeSeconds = 0
this.downloadTimer = setInterval(this.incrementSeconds, 1000)
}
}
}
}
......
import 'cypress-file-upload'
describe('Upload page download timer', () => {
beforeEach(() => {
cy.unregisterServiceWorkers()
})
it('should redirect to start page after expiring', () => {
cy.server()
cy.route({
method: 'GET',
url: '/api/extension',
response: ['.png', '.txt']
}).as('supportedExtensions')
cy.visit('/')
cy.route({
method: 'POST',
url: '/api/upload',
status: 201,
response: {
inactive_after_sec: 2,
output_filename: 'txt0.cleaned.txt',
mime: 'text/plain',
key: 'cb2d44b5f75b98cf3ff9b6bdc8ee673f244983387491db3b18cf20514217cfe9',
secret: 'e4701206f4821993f0d54f9c6f2531aaa307e4f89c97a8679ba455e26aa3fc74',
meta: {},
meta_after: {},
download_link: 'https://api.matweb.info/api/download/cb2d44b5f75b98cf3ff9b6bdc8ee673f244983387491db3b18cf20514217cfe9/e4701206f4821993f0d54f9c6f2531aaa307e4f89c97a8679ba455e26aa3fc74/txt0.cleaned.txt'
}
}).as('postFile')
cy.get('.uppy-Dashboard-input').attachFile('a-very-long-name-for-a-very-small-text-file-to-truncate.txt')
cy.get('.uppy-StatusBar-actions > button').click()
cy.wait('@postFile')
cy.wait(3000)
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/')
})
})
it('should not redirect after leaving the page', () => {
cy.server()
cy.route({
method: 'GET',
url: '/api/extension',
response: ['.png', '.txt']
}).as('supportedExtensions')
cy.visit('/')
cy.route({
method: 'POST',
url: '/api/upload',
status: 201,
response: {
inactive_after_sec: 2,
output_filename: 'txt0.cleaned.txt',
mime: 'text/plain',
key: 'cb2d44b5f75b98cf3ff9b6bdc8ee673f244983387491db3b18cf20514217cfe9',
secret: 'e4701206f4821993f0d54f9c6f2531aaa307e4f89c97a8679ba455e26aa3fc74',
meta: {},
meta_after: {},
download_link: 'https://api.matweb.info/api/download/cb2d44b5f75b98cf3ff9b6bdc8ee673f244983387491db3b18cf20514217cfe9/e4701206f4821993f0d54f9c6f2531aaa307e4f89c97a8679ba455e26aa3fc74/txt0.cleaned.txt'
}
}).as('postFile')
cy.get('.uppy-Dashboard-input').attachFile('a-very-long-name-for-a-very-small-text-file-to-truncate.txt')
cy.get('.uppy-StatusBar-actions > button').click()
cy.wait('@postFile')
cy.visit('/info')
cy.wait(3000)
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/info')
})
})
})
......@@ -1329,10 +1329,10 @@
resolved "https://registry.yarnpkg.com/@positron/stack-trace/-/stack-trace-1.0.0.tgz#14fcc712a530038ef9be1ce6952315a839f466a8"
integrity sha1-FPzHEqUwA475vhzmlSMVqDn0Zqg=
 
"@quasar/app@2.0.7":
version "2.0.7"
resolved "https://registry.yarnpkg.com/@quasar/app/-/app-2.0.7.tgz#b7126f5ccbce66608a1bb06eef7b3323297b96ba"
integrity sha512-X2w+AH0/+F+LMPS6m+uGs05LAkM+RNus/rO+daREHryCVY69uf1DEgkXadc7CFpSzqi8bfxjboBNQk6ZqFfQTg==
"@quasar/app@2.0.8":
version "2.0.8"
resolved "https://registry.yarnpkg.com/@quasar/app/-/app-2.0.8.tgz#d7480b4d7982cb57ff40ec6689fb150f55150f8a"
integrity sha512-EHomvTxJ1coLAErceDNp0qFy9FRMI6Uw694OIWvuXQqFGB0myJdPr958u5MWaEP8zVhWUNv/lyFTYcI/R+k59Q==
dependencies:
"@quasar/babel-preset-app" "2.0.1"
"@quasar/fastclick" "1.1.4"
......@@ -1438,10 +1438,10 @@
core-js "^3.6.5"
core-js-compat "^3.6.5"
 
"@quasar/extras@1.9.4":
version "1.9.4"
resolved "https://registry.yarnpkg.com/@quasar/extras/-/extras-1.9.4.tgz#2978e45dc8cb2802172c6cddafe383b55cd46037"
integrity sha512-g0a39r4ejpTBsrygSfvc1gcZEhnGMl0Rj/xSH6kvmn42NtAwkKiORqFckhhHJ3ZsubE1c5F2jAFcpWAaaC/t8A==
"@quasar/extras@1.9.5":
version "1.9.5"
resolved "https://registry.yarnpkg.com/@quasar/extras/-/extras-1.9.5.tgz#266663cb728d71706038fa7eaaa7e6a2c97218f7"
integrity sha512-eUJrYw51qWtJfw12Ha2VBK8wBqkperHh8iaktQoMUrda4goUZ8nYpbfq/ZQdmsDiBku/kpUIrr0pPRmjzVJwkQ==
 
"@quasar/fastclick@1.1.4":
version "1.1.4"
......@@ -4550,10 +4550,10 @@ cyclist@^1.0.1:
resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-1.0.1.tgz#596e9698fd0c80e12038c2b82d6eb1b35b6224d9"
integrity sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk=
 
cypress-file-upload@4.0.7:
version "4.0.7"
resolved "https://registry.yarnpkg.com/cypress-file-upload/-/cypress-file-upload-4.0.7.tgz#1136139bb3c660b9c39a69f231ac1da7785acaae"
integrity sha512-rFFmnoZ2bWyWFpSV09AhkSUgYEiVy70pcQ6nf/mGTMTrVHvKCCCIfRu3TbgVYHbgBq+0hqjfjQrtz4IbgH7qZA==
cypress-file-upload@4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/cypress-file-upload/-/cypress-file-upload-4.1.1.tgz#952713c8104ab7008de99c65bd63f74b244fe4df"
integrity sha512-tX6UhuJ63rNgjdzxglpX+ZYf/bM6PDhFMtt1qCBljLtAgdearqyfD1AHqyh59rOHCjfM+bf6FA3o9b/mdaX6pw==
dependencies:
mime "^2.4.4"
 
......@@ -12584,10 +12584,10 @@ vscode-languageserver-types@^3.5.0:
resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.15.1.tgz#17be71d78d2f6236d414f0001ce1ef4d23e6b6de"
integrity sha512-+a9MPUQrNGRrGU630OGbYVQ+11iOIovjCkqxajPa9w57Sd5ruK8WQNsslzpa0x/QJqC8kRc2DUxWjIFwoNm4ZQ==
 
vue-code-highlight@0.7.4:
version "0.7.4"
resolved "https://registry.yarnpkg.com/vue-code-highlight/-/vue-code-highlight-0.7.4.tgz#ab7f54960978baca8fdb074a88502a06a9126a55"
integrity sha512-TmJ/WPXQnNCIugHkAwMiS3//6BM0UIiUQRyLpoRJ2g6f+coIcoyAXLeGwqP9f1lfFHjlzCRSfmX+4tus4eKhgQ==
vue-code-highlight@0.7.5:
version "0.7.5"
resolved "https://registry.yarnpkg.com/vue-code-highlight/-/vue-code-highlight-0.7.5.tgz#3eadbcd39c22f6389e68e24d574a01d107936db1"
integrity sha512-y1/3xVz2diArv51eoQT3JCb8M2N4htMtgEtG0GAPABlXJkhdkJi4aSTfi0RYFNxqj5b+P73PBAmBcth/2NV0ng==
dependencies:
prism-es6 "^1.2.0"
vue "^2.5.16"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment