Skip to content

Commit 530a834

Browse files
adliusbrianjgeigerfuta-ikedachth0n1x
authored
Merge Feature/files page redesign into develop (#1462)
* Sunset quickfiles (#1387) * remove file-list and file-list-item (#1392) * [ENG-3516] Create HTML for Registration Files List page (#1389) * Add logic to show/hide metadata panel * Add the registration file-list route and template * Remove untranslated string * Update tests and add aria-label * Add rudimentary test for files list page * [No ticket] Add guid-file route (#1393) - Ticket: n/a - Feature flag: n/a ## Purpose Add the route for guid-files so we can do programatic things on the guid-file page. ## Summary of Changes 1. Add route 2. Add minimal controller 3. Add tests 4. Add mirage for a guid-addressable file 5. Fix meta-tags service to use the correct current URL ## Side Effects No, new code. ## QA Notes This is not testable in isolation. Testable stories coming soon. * FileBrowser with File, OsfStorageFile and OsfStorageManager (#1394) * OsfStorageManager prototype * file-browser foundation? * bug fixes and CR followup * fix tests * Make 'download all from here' link work (#1399) - Ticket: [ENG-3527](https://openscience.atlassian.net/browse/ENG-3527) - Feature flag: n/a ## Purpose Enable the "Download all files" link. ## Summary of Changes 1. Add folder download links to `File.links` 2. Change Download all files from button to link and adjust styling 3. Add href to the Download all files link 4. Test ## Side Effects This gives all folders download links, which will be different links than what Mirage provides, since the OSF API doesn't provide download-as-zip links for folders, while Mirage does. ## QA Notes Make sure it downloads the right things, mostly. * [ENG-3521][ENG-3525][ENG-3526][ENG-3528] Add navigation back to parentFolder; Componentize items (#1397) * add navigation back to parentFolder * Share icons * add download links * add file-item and folder-item; add folderLineage array to keep track of folders * [ENG-3523] Filespage/filter file list (#1400) - Ticket: [ENG-3523](https://openscience.atlassian.net/browse/ENG-3523) - Feature flag: n/a ## Purpose Enable filtering for Files page. Note that this does not yet include tests, because I'm waiting on a change to mirage that @futa-ikeda is working on that will affect how tests are setup. ## Summary of Changes 1. Change filter query parameter to filter on filename 2. Have input box perform filter update 3. Add debouncing to filtering 4. Clear out the current results if currentPage=1 5. Fix file view in mirage so that it filters ## Side Effects No ## QA Notes Filtering should work on file name after this. * Sort, filter, loading indicator (#1401) * sort, filter, loading indicator * make isRunning work * close dropdown after clicking on sort options * remove unused tracked property * Add providers list to the leftnav when on registries file route (#1395) * infinite scrolling with new InfiniteList component (#1403) * Add styling for mobile view (#1405) * [ENG-3585] Filespage/fix download provider (#1406) - Ticket: [ENG-3585](https://openscience.atlassian.net/browse/ENG-3585) - Feature flag: n/a ## Purpose Root folders are incomplete and buggy in the OSF API. For OSF Storage, they provide a url that is incompatible with waterbutler. For other storage providers, it's not implemented. So, instead of using the root folder, this PR uses the storage provider's files relationship, which provides the same info in a way that's complete and functional across providers. This should also allow the download provider as zip functionality to work. ## Summary of Changes 1. Add mirage for provider files relationship 2. Add provider files relationship to model 3. Create provider-file and osfstorage-provider-file 4. Make osfstorage manager use the osfstorage-provider-file when appropriate 5. Fix download as zip test 6. Don't embed region, because the osf api *hates* it ## Side Effects Shouldn't be side effects. This should function just as it did before, just better. ## QA Notes Nothing different from what should have been happening all along. * Add view file link to file-item (#1409) * [ENG-3590] Move registration files-list route (#1402) * Create new route for registration file providers * Add provider mapper to get appropriate storage manager * Fix tests * Move logic to show/hide file list * make file list page more better (#1410) * [ENG-3609] Filespage/breadcrumbs (#1411) * Add breadcrumbs to file browser * Make breadcrumbs functional for travel between folders * Improve accessibility * Make css not silly * Don't link the current folder * HTML for File Detail Page (#1391) * added beginning html skeletal structure for file detail page. * updated side nav html list, troublshooting hbs file rendering. * added tab one view for starter html. * added html for file detail tab one, updated guid file hbs template, translation for checkout button. * updated version, added unordered list for file type, converted placeholder divs to buttons and added some bootstrap formatting. * corrected file title, changed formatting, placed powerselect. * added data test selectors for testing. * updated page changes off of design, began to add CSS, troubleshooting divs. * updated translation files for file detail page. * vertically aligned side nav buttons, updated grid layout for unclicked sidenav logic. * removed non-translated strings, code clean-up. * updated to ResponsiveDropdown for hidden buttons. * updated file detail route to newer html, added method calls for button navigation on side nav, updated hbs to use osf layout. * updated controller logic for sidenav slide, duplicated and moved x inside revisions, entering debug for revision dropdown, adding css. * updated logic for navbar slide to display revisions and tag panels properly. * added hidden attribute to version and tag slide hbs file to obscure elements on page load. * updated html rows for bootstrap div alignment, added css flexbox properties to properly display slide, simplified and updated JS for slide display and transition. * added data test selectors, analytics names, removed unused code. * Removing file-detail.html file Removing file-detail.html file * Deleting file-detail-new-tab.html Deleting file-detail-new-tab.html * removed rouge space from registration link on L9. * added yarn.lock file with updated dependencies. * reverted translation file's methods and measures back to original, corrected template string for file renderer. * removed em element tags, updated css for font-weight, entering troubleshoot for font-weight, updated tags slide for positioning, file name header tags and padding for file name. * Removed unused strings for the File Viewer Removed unused strings for the File Viewer * Removing unused strings for File Detail Removing unused strings for File Detail * Removed unnecessary space Removed unnecessary space * Removed show url bar unused string Removed show url bar unused string * Readding toast_events Readding toast_events * updating controller.ts file to remove unused methods, properties. * resolved merge conflicts. Co-authored-by: Ashley Robinson <ashley@cos.io> * [ENG-3531] Add file renderer to file detail page (#1415) * Add file renderer to file detail page * Add test and test selectors * [ENG-3532][ENG-3535] Download and share files from file detail page (#1416) * Make file-actions-menu and add it to file detail page * Clean up * More clean up * [ENG-3629] Link back to target registration/node (#1417) * Link back to target registration/node * Use routes instead of href for link * Add test assertion * Added FileDetailLayout (#1418) * Added FileDetailLayout * mobile view * some minor fix * small fixes * make the logic smoother * fix copy pasta * add a min-width to right column * fix whitepace * [ENG-3533] File detail revisions (#1424) * Rewrite file-version component * Use revamped file-version component in guid-file route. Gut test * Making fetch happen * Move WBRevision fetching/storing to abstract class * CR feedback * Get file versions directly from WB * [ENG-3536] Add file-embed-menu to file-actions-menu (#1419) * Add file-embed-menu to file-actions-menu * Don't duplicate css and other CR fixes * Fix long name behavior (#1431) * fix long name behavior * fix long folder names * [ENG-3652] Add tests for file revisions (#1429) * Add tests for file revisions * Remove unused wb mirage endpoint * [ENG-3534] Add tags widget (#1421) * Add tegs widget * Restrict tag editing to proper permissions * add tests for file and folder items (#1434) * Change text of download all action * [ENG-3649] Fileslist a11y fixes (#1433) * Remove no outline rules, and allow ResponsiveDropdown to look like a button * Remove nested button in dropdown trigger * Add aria-label to filter textbox * Remove nested interactive elements in file-actions-menu * Reroute users to page-not-found for invalid file providers (#1412) * Reroute to page-not-found for invalid file-provider names * Remove unused import and add test * Show an error message for invalid file providers * Fix tests * add moar file-browser tests (#1436) * new PR from 1432, added translation for iframe in translation file. * decreased font weight, increased font-size. * [ENG-3649] Fix bugs: fix mfr iFrame height (#1425) * added hardcoded value for mfr iframe height, entering testing non-hardcoded value. * made FileRenderer class tagless to remove auto-generated wrapper, removed hard-coded value for iframe height. * updated styles for iframe height, removed height selector from component class. * added default height of 100% back, removed media query and applied height to wrapper div. * removed FileRender iFrame height CSS selector. Co-authored-by: Ashley Robinson <ashley@cos.io> * Add labels to filter and sort * fix button for long filenames * Increase color contrast for form-control placeholders (and other places using $color-text-gray) * Fix wrong color reference * use feature flags for links * Revert "Use feature flags for overview page file link" * Align download button to center * Remove LinkedIn from sharing icons * Revert "Revert "Use feature flags for overview page file link"" This reverts commit 84bf4f3. * fix overview tests * Properly set query parameter * Remove nested interactable elemenets * Append query params properly * fix feature flag * Revert "[ENG-3649] Fix versions feature in VOL" * Simplify setting parameters * Simplify param setting in other usages * Use more flex-basis instead of min-width. Update revisions tab styling to match tags * Render files related dropdowns in place * Styling updates for dropdowns rendered in place * Hide user name from revisions (needed for AVOLs) * Make sharing dropdown tab-navigable * Sort by date_modified rather than modified * Route withdrawn file to registration overview page for tombstone * CR feedback * Mobile: remove excess padding for file sort dropdown * Revert "[ENG-3649] Sort by date_modified rather than modified" * add currentUser service when initializing File instances (#1460) * Handle proxy better * [ENG-3530] Add file help modal (#1461) * Add file help modal * the rest of the owl * Break up some text Co-authored-by: Brian J. Geiger <bgeiger@cos.io> Co-authored-by: futa-ikeda <51409893+futa-ikeda@users.noreply.github.com> Co-authored-by: chth0n1x <82047646+chth0n1x@users.noreply.github.com> Co-authored-by: Ashley Robinson <ashley@cos.io> Co-authored-by: Futa Ikeda <futa.ikeda@gmail.com> Co-authored-by: Brian J. Geiger <bgeiger@pobox.com>
1 parent a61f0b7 commit 530a834

File tree

128 files changed

+2585
-572
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+2585
-572
lines changed

app/application/styles.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@
77

88
.Application__page {
99
flex: 1 0 auto;
10+
display: flex;
11+
flex-direction: column;
1012
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
.Container {
2+
display: flex;
3+
flex-direction: row;
4+
flex-grow: 1;
5+
}
6+
7+
.MainColumn {
8+
flex-grow: 3;
9+
}
10+
11+
.RightColumn {
12+
flex-grow: 1;
13+
border-left: 1px solid #ddd;
14+
flex-basis: 300px;
15+
16+
&.is-closed {
17+
display: none;
18+
}
19+
}
20+
21+
.RightButtons {
22+
@media (max-width: 767px) {
23+
display: flex;
24+
flex-direction: row;
25+
justify-content: space-evenly;
26+
border-top: 1px solid #ddd;
27+
}
28+
flex-grow: 0;
29+
display: flex;
30+
flex-direction: column;
31+
border-left: 1px solid #ddd;
32+
z-index: 1;
33+
}
34+
35+
.Slider {
36+
position: absolute;
37+
width: 100%;
38+
height: 100%;
39+
transform: translateX(-100%);
40+
}
41+
42+
.slide-in {
43+
animation: slide-in 0.5s forwards;
44+
}
45+
46+
.slide-out {
47+
animation: slide-out 0.5s forwards;
48+
}
49+
50+
@keyframes slide-in {
51+
100% { transform: translateX(0%); }
52+
}
53+
54+
@keyframes slide-out {
55+
0% { transform: translateX(0%); }
56+
100% { transform: translateX(-100%); }
57+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<div local-class='Container'>
2+
{{#if @isMobile}}
3+
<div local-class='MainColumn'>
4+
{{yield to='header'}}
5+
<div local-class='RightButtons'>
6+
{{yield to='rightButtons'}}
7+
</div>
8+
<div>
9+
{{#if @rightColumnClosed}}
10+
{{yield to='body'}}
11+
{{else}}
12+
{{yield to='right'}}
13+
{{/if}}
14+
</div>
15+
</div>
16+
{{else}}
17+
<div local-class='MainColumn'>
18+
{{yield to='header'}}
19+
{{yield to='body'}}
20+
</div>
21+
<div local-class='RightColumn {{if @rightColumnClosed 'is-closed'}}'>
22+
{{yield to='right'}}
23+
</div>
24+
<div local-class='RightButtons'>
25+
{{yield to='rightButtons'}}
26+
</div>
27+
{{/if}}
28+
</div>

app/guid-file/controller.ts

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import Controller from '@ember/controller';
2+
import { action } from '@ember/object';
3+
import { inject as service } from '@ember/service';
4+
import { tracked } from '@glimmer/tracking';
5+
import { taskFor } from 'ember-concurrency-ts';
6+
import Media from 'ember-responsive';
7+
import Toast from 'ember-toastr/services/toast';
8+
9+
export default class GuidFile extends Controller {
10+
@service media!: Media;
11+
@service toast!: Toast;
12+
13+
@tracked revisionsOpened = false;
14+
@tracked tagsOpened = false;
15+
16+
@tracked viewedVersion?: number;
17+
18+
get rightColumnClosed() {
19+
return !(this.revisionsOpened || this.tagsOpened);
20+
}
21+
22+
get isMobile() {
23+
return this.media.isMobile;
24+
}
25+
26+
get isTablet() {
27+
return this.media.isTablet;
28+
}
29+
30+
@action
31+
changeVersion(version: number) {
32+
this.viewedVersion = version;
33+
}
34+
35+
@action
36+
toggleRevisions() {
37+
if (!this.model.waterButlerRevisions) {
38+
taskFor(this.model.getRevisions).perform();
39+
}
40+
if (this.isMobile) {
41+
this.revisionsOpened = true;
42+
this.tagsOpened = false;
43+
} else {
44+
if (this.tagsOpened) {
45+
this.tagsOpened = false;
46+
}
47+
this.toggleProperty('revisionsOpened');
48+
}
49+
}
50+
51+
@action
52+
toggleTags() {
53+
if (this.isMobile) {
54+
this.tagsOpened = true;
55+
this.revisionsOpened = false;
56+
} else {
57+
if (this.revisionsOpened) {
58+
this.revisionsOpened = false;
59+
}
60+
this.toggleProperty('tagsOpened');
61+
}
62+
}
63+
64+
@action
65+
toggleFileRenderer() {
66+
if (this.isMobile) {
67+
this.tagsOpened = false;
68+
this.revisionsOpened = false;
69+
} else {
70+
if (this.rightColumnClosed) {
71+
this.revisionsOpened = true;
72+
this.tagsOpened = false;
73+
} else {
74+
this.revisionsOpened = false;
75+
this.tagsOpened = false;
76+
}
77+
}
78+
}
79+
}

app/guid-file/route.ts

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import { action } from '@ember/object';
2+
import Route from '@ember/routing/route';
3+
import { inject as service } from '@ember/service';
4+
import { waitFor } from '@ember/test-waiters';
5+
import HeadTagsService from 'ember-cli-meta-tags/services/head-tags';
6+
import { task } from 'ember-concurrency';
7+
import { taskFor } from 'ember-concurrency-ts';
8+
import moment from 'moment';
9+
10+
import Institution from 'ember-osf-web/models/institution';
11+
import Analytics from 'ember-osf-web/services/analytics';
12+
import MetaTags, { HeadTagDef } from 'ember-osf-web/services/meta-tags';
13+
import Ready from 'ember-osf-web/services/ready';
14+
import OsfStorageFile from 'ember-osf-web/packages/files/osf-storage-file';
15+
import CurrentUserService from 'ember-osf-web/services/current-user';
16+
import RegistrationModel from 'ember-osf-web/models/registration';
17+
18+
export default class GuidFile extends Route {
19+
@service analytics!: Analytics;
20+
@service('head-tags') headTagsService!: HeadTagsService;
21+
@service metaTags!: MetaTags;
22+
@service ready!: Ready;
23+
@service currentUser!: CurrentUserService;
24+
25+
headTags?: HeadTagDef[];
26+
27+
@task
28+
@waitFor
29+
async setHeadTags(model: any) {
30+
const blocker = this.ready.getBlocker();
31+
const dateCreated = model.dateCreated;
32+
const dateModified = model.dateModified;
33+
const institutions = await model.target.get('affiliatedInstitutions');
34+
const metaTagsData = {
35+
title: model.name,
36+
identifier: model.guid,
37+
publishedDate: dateCreated ? moment(dateCreated).format('YYYY-MM-DD') : undefined,
38+
modifiedDate: dateModified ? moment(dateModified).format('YYYY-MM-DD') : undefined,
39+
institution: institutions.map((institution: Institution) => institution.get('name')),
40+
};
41+
this.set('headTags', this.metaTags.getHeadTags(metaTagsData));
42+
this.headTagsService.collectHeadTags();
43+
blocker.done();
44+
}
45+
46+
async model(params: { guid: string }) {
47+
const { guid } = params;
48+
try {
49+
const file = await this.store.findRecord('file', guid, {include: 'target'});
50+
const target = await file.target as unknown as RegistrationModel;
51+
if (target.withdrawn === true) {
52+
this.transitionTo('guid-registration', target.id);
53+
}
54+
const osfStorageFile = new OsfStorageFile(this.currentUser, file);
55+
return osfStorageFile;
56+
} catch (error) {
57+
this.transitionTo('not-found', guid);
58+
throw error;
59+
}
60+
}
61+
62+
afterModel(model: any) {
63+
taskFor(this.setHeadTags).perform(model.fileModel);
64+
}
65+
66+
@action
67+
didTransition() {
68+
this.analytics.trackPage(true, 'files');
69+
}
70+
}

app/guid-file/styles.scss

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
.ContentBackground {
2+
display: flex;
3+
flex-grow: 1;
4+
z-index: 1;
5+
justify-content: center;
6+
position: relative;
7+
}
8+
9+
.MainColumn {
10+
display: flex;
11+
flex-direction: column;
12+
}
13+
14+
.FlexContainerRow {
15+
display: flex;
16+
flex-direction: row;
17+
align-items: end;
18+
justify-content: space-between;
19+
padding: 0 20px 20px;
20+
}
21+
22+
.ProjectLink {
23+
margin: 20px;
24+
}
25+
26+
.FileRenderer {
27+
padding: 0 20px 20px;
28+
height: 90vh;
29+
margin-bottom: 15px;
30+
}
31+
32+
.SlideButtons {
33+
margin: 20px 20px 0;
34+
border: 0;
35+
color: $color-link-dark;
36+
background-color: $color-bg-white;
37+
38+
@media (max-width: 767px) {
39+
margin: 0;
40+
}
41+
42+
&.Active {
43+
@media (max-width: 767px) {
44+
background-color: $color-bg-white;
45+
color: $color-bg-black;
46+
}
47+
background-color: $color-bg-gray-light;
48+
}
49+
}
50+
51+
.FileDetail__revisions {
52+
max-height: 100vh;
53+
overflow-y: auto;
54+
}
55+
56+
.FileDetail__right-section-heading {
57+
margin-left: 20px;
58+
}
59+
60+
.FileDetail__revision-list {
61+
list-style-position: inside;
62+
padding-inline: 20px;
63+
}
64+
65+
.FileDetail__no-revisions {
66+
padding: 20px;
67+
text-align: center;
68+
}
69+
70+
.RightContainer {
71+
margin: 0 20px;
72+
73+
h2 {
74+
margin-bottom: 20px;
75+
}
76+
}

0 commit comments

Comments
 (0)