Skip to content

Commit f5c0c89

Browse files
adliusbp-cosfuta-ikeda
authored
Feature/cedar integration (#2143)
* [ENG-4908] Prototype CEE (#2050) * prototype CEEE * CR followup * fix args names * [ENG-4843] [ENG-5056] [ENG-5057] [ENG-5058] [ENG-5059] Feature/cedar integration (#2091) * Added the cedar metadata template model * Added the new models for cedar-metadata-template and record * Fixed some linting issues * Added the adapters and serializers for cedar metadata template and record * Fixed some typos and ignorance with serializers, api-contracts, etc * Fixed the namespace * Fixed the all the relationships * [ENG-4845] Updates to convert the currect guid-metadata to tab based (#2093) * Updates to convert the currect guid-metadata to tab based * Added the tabbing system to the metadata page * Initial commit for geting the mirage serializers to work for cedar-metadata-records * Updates from PR comments * [ENG-5065] Add a new metadata details (view only) component (#2095) * Added the initial metadata-detail component * Added some more touches to the detail template * Removed unnecessary mobile styling and actually the component. * Much cleaner look and feel for the read-only view * Added more randomness * Inital metadata add route * Added more information to select a schema * Added missing files * Fixed the pagination on read-only templates * Fixed some tests * Fixed a typo * Updates per PR comments * Updates per PR requests * Initial commit to add the cedar template * Added a new component to handle the cedar editor * Styling of the cedar editor * For debugging added the configuration to the component * Template rendering * Added more cedar templates and updated the config * Fixes per the PR * Updates based on the PR * Removed the unnecessary metadata-select component and passed in isMobile * Added metadata information to the tabs * Fixed the title * add cedar assets (#2104) * artifact viewer prototype * Added biosample record, removed unnecessary components and hooked up the initial editor post on save * fixed the types by adding singular and plurals and updated the save to work for create and patch * Updates from the PR based on comments. Much better with consistent naming of variables * Updates for PR * Updates for the PR * Added a loading indicator, disabled the button and redirected the route * Router changes for Yuhuai * modify route structure * Added a draft status * Added visualization for draft metadata * Added better text for published metadata and analytics * Added the final touch to get the recordId and display the correct record * Fixed two tests * Fixed another test * Initial PR comment updates * Additional PR comment updates * The last of the PR comments * Updates from PR requests * Added visualization for draft metadata * Added more edit flow components * Additional updates * Updates to make a better flow and have the editor display persisted data * Finishing touches on the edit flow * Added a toast message to handle saving errors * Added a cancel button * Editted a merge mistake * A linting issue * Updates for the linter and PR comments * Additional updates * Updates based on the PR * Removed the async * Added a better isPersisting handler * Update to the cedar metadata editor flow * update versions (#2114) * Initial updates to port node::metadata to registration * Updated the routes * Initial commit for registrations and mirage scenarios * Updates to some files, mostly mirage * Moved metadata components to osf-components, removed the guid-node metadata components, generized some components * Added a component for the detail page * Converted the metadata add page to be a component * Fixed a test * Fixed additional tests * Fixed a flaky test * Okay ... to similar tests * Refactored based on PR comments * One last PR Suggestions * Initial conversion to add cedar metadata to files * More component creation * Updates to get files to work * fix relationship * The tabs are displaying and the cedar artifact viewer is working * Typo for a test failue * Updates for the PR * Fixed a camel-case class names * Added the ability to add a cedar template to a file * Added updates for navigation, scenarios and mobile * Additional mobile formatting * Fixed two tests * Removed a test that did nothing * Updates for the PR * Added everything to fix publish * Hopeful fix for the tests * Added permissions * Updated the if statement for permissions * Another quick update to make mirage scenarios more realistic * Updates for PR suggestions * Missed a suggestion * Updates for Yuhuais comments * New flow for downloading a cedar template * Updates to flow, css and verbiage * One more tooltip * Updates to fix the guid-file tabs * Added initial update for guid-file * Added the title updates to registries * Updates to display the name of the file * add terminologyIntegratedSearchUrl (#2126) * Change `findAll` to `query` to hide inactive templates (#2128) * change findAll to query * use schema:description and fallback to description when schema:description is not available * use schema:description and fallback to description when schema:description is not available--amend * metadataDownload to metadata_download * Added a share icon and fixed the routing to reflect the current tab (#2127) * Added a share icon and fixed the routing to reflect the current tab * Removed from files * Style updates based on PR suggestions from Futa * Fixed for an issue between mirage and BE * Fixes for the file page overrunning * Fixed a translations for a notion issue * Updates to translations * upgrade CEE to 1.0.15 * Fixed some issues * Another quick fix for mobile * Another quick mobile css fix * Another quick mobile css fix * Quick naming convention fix * Oops missing translation update * A late addition to fix a flow issue when adding * Removed the async/await on the cancel button * upgrade CEE to 1.0.16 (#2135) * Updates for Cedar Requests from Product (#2136) * Moved the "Select a different template" button * Fixed a typo on including a component * Added the async on route transition * Updates to disable adding a duplicate record * Added select disable functionality to registries * Finished the disable feature for files and fixed some other nuisances * Added sorting and moved the selected tab to the first * upgrade CEE to 1.1.0 * Fixed the persist because the parent route was not run on an add or edit * Add an aria label * Fix color contrast issue * Enabled the embedding of templates on cedar records (#2141) * Enabled the embedding of templates on cedar records * Fixed a discepancy on the tab views * More one fix for consistency * Overwrite white-space rule for tooltips from cedar (#2146) * Go to page not found when encountering errors. (#2147) * fixes * fix test errors * Update styling (#2149) * Upgrade cee version to 1.2.1. Listen to more events to trigger validation (#2150) * upgrade cee version. listen to more events to trigger validation * change to pointerover --------- Co-authored-by: Lord Business <[email protected]> Co-authored-by: Brian Pilati <[email protected]> Co-authored-by: Futa Ikeda <[email protected]> Co-authored-by: futa-ikeda <[email protected]>
1 parent f7db71a commit f5c0c89

File tree

135 files changed

+42417
-770
lines changed

Some content is hidden

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

135 files changed

+42417
-770
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import OsfAdapter from './osf-adapter';
2+
3+
export default class CedarMetadataRecordAdapter extends OsfAdapter {
4+
namespace = '_';
5+
}
6+
7+
declare module 'ember-data/types/registries/adapter' {
8+
export default interface AdapterRegistry {
9+
'cedar-metadata-record': CedarMetadataRecordAdapter;
10+
} // eslint-disable-line semi
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import OsfAdapter from './osf-adapter';
2+
3+
export default class CedarMetadataTemplateAdapter extends OsfAdapter {
4+
namespace = '_';
5+
}
6+
7+
declare module 'ember-data/types/registries/adapter' {
8+
export default interface AdapterRegistry {
9+
'cedar-metadata-template': CedarMetadataTemplateAdapter;
10+
} // eslint-disable-line semi
11+
}

app/config/environment.d.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ declare const config: {
2121
WATER_BUTLER_ENABLED: boolean;
2222
plauditWidgetUrl: string,
2323
environment: any;
24+
cedarConfig: any;
2425
lintOnBuild: boolean;
2526
testsEnabled: boolean;
2627
sourcemapsEnabled: boolean;
@@ -31,6 +32,39 @@ declare const config: {
3132
assetsPrefix: string;
3233
sentryDSN: string | null;
3334
googleTagManagerId: string | null;
35+
cedarConfig: {
36+
viewerConfig: {
37+
showHeader: boolean,
38+
showFooter: boolean,
39+
expandedSampleTemplateLinks: boolean,
40+
showSampleTemplateLinks: boolean,
41+
defaultLanguage: string,
42+
showTemplateData: boolean,
43+
showInstanceData: boolean,
44+
}
45+
editorConfig: {
46+
sampleTemplateLocationPrefix: string,
47+
loadSampleTemplateName: string,
48+
expandedSampleTemplateLinks: boolean,
49+
showTemplateRenderingRepresentation: boolean,
50+
showMultiInstanceInfo: boolean,
51+
expandedInstanceDataFull: boolean,
52+
expandedInstanceDataCore: boolean,
53+
expandedMultiInstanceInfo: boolean,
54+
expandedTemplateRenderingRepresentation: boolean,
55+
showInstanceDataFull: boolean,
56+
showTemplateSourceData: boolean,
57+
expandedTemplateSourceData: boolean,
58+
collapseStaticComponents: boolean,
59+
showStaticText: boolean,
60+
showInstanceDataCore: boolean,
61+
showHeader: boolean,
62+
showFooter: boolean,
63+
showInstanceDataFull: boolean,
64+
showTemplateSourceData: boolean,
65+
terminologyIntegratedSearchUrl: string,
66+
},
67+
}
3468
sentryOptions: {
3569
release?: string;
3670
ignoreErrors: string[];

app/guid-file/-components/file-detail-layout/styles.scss

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,30 @@
1+
// stylelint-disable max-nesting-depth, selector-max-compound-selectors
2+
13
.container {
24
display: flex;
35
flex-direction: row;
46
flex-grow: 1;
57
}
68

79
.main-column {
8-
flex-grow: 3;
910
z-index: 1;
11+
width: 70%;
12+
min-width: 300px;
13+
14+
&.mobile {
15+
width: 100%;
16+
}
17+
18+
&.is-closed {
19+
flex: 1;
20+
width: calc(100% - 72px);
21+
}
1022

1123
h3 {
1224
text-overflow: ellipsis;
1325
overflow: hidden;
1426
white-space: nowrap;
15-
max-width: 70vw;
27+
width: 70%;
1628
}
1729
}
1830

@@ -22,25 +34,28 @@
2234
flex-basis: 300px;
2335
flex-direction: column;
2436
flex-grow: 1;
25-
width: 28vw;
37+
width: calc(30% - 72px);
38+
min-width: 400px;
2639

2740
&.is-closed {
2841
display: none;
2942
}
3043
}
3144

3245
.right-buttons {
33-
@media (max-width: 767px) {
34-
display: flex;
35-
flex-direction: row;
36-
justify-content: space-evenly;
37-
border-top: 1px solid #ddd;
38-
}
3946
flex-grow: 0;
4047
display: flex;
4148
flex-direction: column;
4249
border-left: 1px solid #ddd;
4350
z-index: 1;
51+
width: 72px;
52+
min-width: 72px;
53+
54+
&.mobile {
55+
flex-direction: row;
56+
width: 100%;
57+
margin-bottom: 10px;
58+
}
4459
}
4560

4661
.slide-in {

app/guid-file/-components/file-detail-layout/template.hbs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<div local-class='container'>
22
{{#if @isMobile}}
3-
<div local-class='main-column'>
3+
<div local-class='main-column mobile'>
44
{{yield to='header'}}
5-
<div local-class='right-buttons'>
5+
<div local-class='right-buttons mobile'>
66
{{yield to='rightButtons'}}
77
</div>
88
<div>
@@ -14,7 +14,8 @@
1414
</div>
1515
</div>
1616
{{else}}
17-
<div local-class='main-column'>
17+
18+
<div local-class='main-column {{if @rightColumnClosed 'is-closed'}}'>
1819
{{yield to='header'}}
1920
{{yield to='body'}}
2021
</div>
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// stylelint-disable max-nesting-depth, selector-max-compound-selectors
2+
3+
.file-header-container {
4+
width: 100%;
5+
6+
.flex-container-row {
7+
width: 100%;
8+
display: flex;
9+
flex-direction: row;
10+
justify-content: space-between;
11+
padding: 0 20px 20px;
12+
13+
h2 {
14+
height: 40px;
15+
width: 70%;
16+
overflow: hidden;
17+
text-overflow: ellipsis;
18+
white-space: nowrap;
19+
}
20+
21+
.return-container {
22+
width: 30%;
23+
height: 70px;
24+
display: flex;
25+
flex-direction: row;
26+
justify-content: flex-end;
27+
align-items: center;
28+
}
29+
}
30+
31+
.project-link-header {
32+
padding-bottom: 5px;
33+
34+
.project-link {
35+
margin: 20px;
36+
}
37+
}
38+
39+
&.mobile {
40+
padding: 0;
41+
42+
.flex-container-row {
43+
padding: 0;
44+
flex-direction: column;
45+
46+
h2,
47+
.return-container {
48+
width: 100%;
49+
height: fit-content;
50+
justify-content: flex-start;
51+
}
52+
53+
h2 {
54+
margin-top: 0;
55+
}
56+
}
57+
58+
.project-link-header {
59+
.project-link {
60+
margin: 0;
61+
}
62+
}
63+
}
64+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<div local-class='file-header-container {{if @isMobile 'mobile'}}'>
2+
<h3 local-class='project-link-header'>
3+
<OsfLink
4+
data-test-project-link
5+
data-analytics-name='Linked project'
6+
local-class='project-link'
7+
@route={{if (eq @model.fileModel.target.type 'registrations') 'guid-registration' 'guid-node'}}
8+
@models={{array @model.fileModel.target.id}}
9+
>
10+
{{@model.fileModel.target.title}}
11+
</OsfLink>
12+
</h3>
13+
<div local-class='flex-container-row'>
14+
<h2 data-test-filename>
15+
{{@model.displayName}}
16+
{{#if @viewedVersion}}
17+
({{t 'general.version'}}: {{@viewedVersion}})
18+
{{/if}}
19+
</h2>
20+
<div local-class='return-container'>
21+
{{#if @displayFileActions}}
22+
<FileActionsMenu
23+
@item={{@model}}
24+
@onDelete={{@onDelete}}
25+
@allowRename={{false}}
26+
@addonsEnabled={{@model.fileModel.target.addonsEnabled}}
27+
/>
28+
{{else}}
29+
<OsfLink
30+
data-test-return-to-metadata
31+
data-analytics-name='Return from cedar metadata template selection'
32+
@route='guid-file.index'
33+
@models={{array @model.fileModel.id}}
34+
>
35+
{{ t 'file-detail.metadata.return-to-file' fileName=@model.displayName}}
36+
</OsfLink>
37+
{{/if}}
38+
</div>
39+
</div>
40+
</div>
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ export default class GuidFile extends Controller {
4040

4141
@action
4242
toggleRevisions() {
43-
if (!this.model.waterButlerRevisions) {
44-
taskFor(this.model.getRevisions).perform();
43+
if (!this.model.file.waterButlerRevisions) {
44+
taskFor(this.model.file.getRevisions).perform();
4545
}
4646
if (this.isMobile) {
4747
this.revisionsOpened = true;
@@ -113,6 +113,6 @@ export default class GuidFile extends Controller {
113113

114114
@action
115115
onDelete() {
116-
this.router.transitionTo('guid-node.files', this.model.fileModel.target.get('id'));
116+
this.router.transitionTo('guid-node.files', this.model.file.fileModel.target.get('id'));
117117
}
118118
}

app/guid-file/index/route.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import Store from '@ember-data/store';
2+
import Route from '@ember/routing/route';
3+
import RouterService from '@ember/routing/router-service';
4+
import { inject as service } from '@ember/service';
5+
import CedarMetadataRecordModel from 'ember-osf-web/models/cedar-metadata-record';
6+
import CedarMetadataTemplateModel from 'ember-osf-web/models/cedar-metadata-template';
7+
8+
9+
export default class MetadataDetailRoute extends Route {
10+
@service store!: Store;
11+
@service router!: RouterService;
12+
13+
async model() {
14+
const file = this.modelFor('guid-file');
15+
const defaultIndex = 0;
16+
const cedarMetadataRecords = await file.fileModel.queryHasMany('cedarMetadataRecords', {
17+
'page[size]': 20,
18+
});
19+
20+
for(const cedarMetadataRecord of cedarMetadataRecords) {
21+
const template = await cedarMetadataRecord.template as CedarMetadataTemplateModel;
22+
template.recordCreated = true;
23+
cedarMetadataRecord.templateName = template.schemaName;
24+
}
25+
26+
cedarMetadataRecords.sort(
27+
(a: CedarMetadataRecordModel, b: CedarMetadataRecordModel) =>
28+
a.templateName > b.templateName ? 1 : -1,
29+
);
30+
31+
32+
return {
33+
file,
34+
cedarMetadataRecords,
35+
defaultIndex,
36+
};
37+
}
38+
}

0 commit comments

Comments
 (0)