|
489 | 489 | <h3>Files to Download</h3>
|
490 | 490 | <ul>
|
491 | 491 | <li
|
492 |
| - v-for="artifact in returnedUnmodifiedArtifacts.artifacts" |
| 492 | + v-for="(artifact) in filteredDownloadArtifacts(returnedUnmodifiedArtifacts.artifacts)" |
493 | 493 | :key="artifact.identifier+'Download'"
|
494 | 494 | >
|
495 | 495 | <a
|
@@ -1426,7 +1426,50 @@ export default {
|
1426 | 1426 | },
|
1427 | 1427 | filteredArtifacts(artifactsArray) {
|
1428 | 1428 | const availableMIMEtypes = ['text/plain', 'text/uri-list', 'application/json', 'image/png', 'image/jpeg', 'application/x-vgf', 'application/x-vgf3', 'application/x-vgfc', 'text/csv', 'application/vnd.kitware'];
|
1429 |
| - const filtered = artifactsArray.filter((artifact) => (availableMIMEtypes.indexOf(artifact.MIMEtype) > -1)); |
| 1429 | + let filenamefilter = []; |
| 1430 | + // TODO replace with es2020 syntax |
| 1431 | + if (typeof this.json.metadata !== 'undefined') { |
| 1432 | + if (typeof this.json.metadata.output !== 'undefined') { |
| 1433 | + if (typeof this.json.metadata.output.ignore !== 'undefined') { |
| 1434 | + if (typeof this.json.metadata.output.ignore.visualization !== 'undefined') { |
| 1435 | + filenamefilter = this.json.metadata.output.ignore.visualization.map(filename => { |
| 1436 | + let w = filename.replace(/[.+^${}()|[\]\\]/g, '\\$&'); // regexp escape |
| 1437 | + return new RegExp(`^${w.replace(/\*/g,'.*').replace(/\?/g,'.')}$`); |
| 1438 | + } |
| 1439 | + ); |
| 1440 | + } |
| 1441 | + } |
| 1442 | + } |
| 1443 | + } |
| 1444 | + const filtered = artifactsArray.filter((artifact) => (availableMIMEtypes.indexOf(artifact.MIMEtype) > -1)).filter(artifact => { |
| 1445 | + let valid = true; |
| 1446 | + filenamefilter.forEach(filterregex => (valid = valid && !filterregex.test(artifact.path))); |
| 1447 | + return valid; |
| 1448 | + }); |
| 1449 | + return filtered; |
| 1450 | + }, |
| 1451 | +
|
| 1452 | + filteredDownloadArtifacts(artifactsArray) { |
| 1453 | + let filenamefilter = []; |
| 1454 | + // TODO replace with es2020 syntax |
| 1455 | + if (typeof this.json.metadata !== 'undefined') { |
| 1456 | + if (typeof this.json.metadata.output !== 'undefined') { |
| 1457 | + if (typeof this.json.metadata.output.ignore !== 'undefined') { |
| 1458 | + if (typeof this.json.metadata.output.ignore.download !== 'undefined') { |
| 1459 | + filenamefilter = this.json.metadata.output.ignore.download.map(filename => { |
| 1460 | + let w = filename.replace(/[.+^${}()|[\]\\]/g, '\\$&'); // regexp escape |
| 1461 | + return new RegExp(`^${w.replace(/\*/g,'.*').replace(/\?/g,'.')}$`); |
| 1462 | + } |
| 1463 | + ); |
| 1464 | + } |
| 1465 | + } |
| 1466 | + } |
| 1467 | + } |
| 1468 | + const filtered = artifactsArray.filter(artifact => { |
| 1469 | + let valid = true; |
| 1470 | + filenamefilter.forEach(filterregex => (valid = valid && !filterregex.test(artifact.path))); |
| 1471 | + return valid; |
| 1472 | + }); |
1430 | 1473 | return filtered;
|
1431 | 1474 | },
|
1432 | 1475 | },
|
|
0 commit comments