-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RUI race condition fix #1101
Merged
Merged
RUI race condition fix #1101
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
3 changes: 1 addition & 2 deletions
3
projects/ccf-eui/src/app/shared/components/checkbox/checkbox.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -141,17 +141,21 @@ export class RegistrationState extends NgxsImmutableDataRepository<RegistrationS | |
this.tags = this.injector.get(AnatomicalStructureTagState); | ||
this.refData = this.injector.get(ReferenceDataState); | ||
|
||
this.globalConfig.config$.pipe( | ||
take(1), | ||
tap(({ useDownload, register }) => this.ctx.patchState({ | ||
useRegistrationCallback: !!(!useDownload && register) | ||
})) | ||
).subscribe(); | ||
|
||
this.globalConfig.getOption('editRegistration').pipe( | ||
filterNulls(), | ||
tap(reg => this.editRegistration(reg as SpatialEntityJsonLd)) | ||
).subscribe(); | ||
this.refData.getSourceDB().subscribe(db => { | ||
this.refData.setState(db); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Already done in the reference data state |
||
|
||
this.globalConfig.config$.pipe( | ||
take(1), | ||
tap(({ useDownload, register }) => this.ctx.patchState({ | ||
useRegistrationCallback: !!(!useDownload && register) | ||
})) | ||
).subscribe(); | ||
|
||
this.globalConfig.getOption('editRegistration').pipe( | ||
filterNulls(), | ||
tap(reg => this.editRegistration(reg as SpatialEntityJsonLd)) | ||
).subscribe(); | ||
}); | ||
} | ||
|
||
async editRegistration(reg: SpatialEntityJsonLd): Promise<void> { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
projects/ccf-rui/src/webcomponent-async-inject-example.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>HuBMAP CCF Registration User Interface (CCF-RUI)</title> | ||
<base href="/"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<link rel="icon" type="image/x-icon" href="favicon.ico"> | ||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500&display=swap" rel="stylesheet"> | ||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons|Material+Icons+Outlined" rel="stylesheet"> | ||
<script> | ||
// To test embedded mode, from the console paste: | ||
// localStorage.setItem('TEST_EMBEDDED', true); | ||
if (localStorage['TEST_EMBEDDED'] === 'true') { | ||
const sampleRegistration = { | ||
"@context": "https://hubmapconsortium.github.io/ccf-ontology/ccf-context.jsonld", | ||
"@id": "http://purl.org/ccf/1.5/523ad946-115b-433a-bd1d-ba4b75f8c493", | ||
"@type": "SpatialEntity", | ||
"creator": "Jane Doe", | ||
"creator_first_name": "Jane", | ||
"creator_last_name": "Doe", | ||
"creation_date": "2023-08-29", | ||
"ccf_annotations": [ | ||
"http://purl.obolibrary.org/obo/UBERON_0002015", | ||
"http://purl.obolibrary.org/obo/UBERON_0008716", | ||
"http://purl.obolibrary.org/obo/UBERON_0000362", | ||
"http://purl.obolibrary.org/obo/UBERON_0001228", | ||
"http://purl.obolibrary.org/obo/UBERON_0004200", | ||
"http://purl.obolibrary.org/obo/UBERON_0001225", | ||
"http://purl.obolibrary.org/obo/UBERON_0001284", | ||
"http://purl.obolibrary.org/obo/UBERON_0002189" | ||
], | ||
"slice_thickness": 1, | ||
"slice_count": 2, | ||
"x_dimension": 16, | ||
"y_dimension": 12, | ||
"z_dimension": 14, | ||
"dimension_units": "millimeter", | ||
"placement": { | ||
"@context": "https://hubmapconsortium.github.io/ccf-ontology/ccf-context.jsonld", | ||
"@id": "http://purl.org/ccf/1.5/523ad946-115b-433a-bd1d-ba4b75f8c493_placement", | ||
"@type": "SpatialPlacement", | ||
"target": "http://purl.org/ccf/latest/ccf.owl#VHFLeftKidneyV1.1", | ||
"placement_date": "2023-08-29", | ||
"x_scaling": 1, | ||
"y_scaling": 1, | ||
"z_scaling": 1, | ||
"scaling_units": "ratio", | ||
"x_rotation": 10, | ||
"y_rotation": 25, | ||
"z_rotation": 32, | ||
"rotation_order": "XYZ", | ||
"rotation_units": "degree", | ||
"x_translation": 25.866, | ||
"y_translation": 94.635, | ||
"z_translation": 38.79, | ||
"translation_units": "millimeter" | ||
} | ||
}; | ||
|
||
window.addEventListener('DOMContentLoaded', () => { | ||
const rui = document.createElement("ccf-rui"); | ||
rui.baseHref = 'https://cdn.jsdelivr.net/gh/hubmapconsortium/ccf-ui@staging/rui/'; | ||
rui.useDownload = true; | ||
|
||
setTimeout(() => { | ||
rui.user = {firstName: 'Jane', lastName: 'Doe'}; | ||
rui.organ = { name: 'kidney', side: 'left', sex: 'female' }; | ||
rui.editRegistration = sampleRegistration; | ||
document.body.appendChild(rui); | ||
}, 2000); | ||
}); | ||
} | ||
</script> | ||
</head> | ||
|
||
<body class="mat-typography"> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this may cause the database to be loaded twice. Instead listen to the refData state (or part of it) and then subscribe to that.