-
Notifications
You must be signed in to change notification settings - Fork 34
feat: templated external links (draft) #1910
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
base: master
Are you sure you want to change the base?
feat: templated external links (draft) #1910
Conversation
Catching up to main repo
Catching up to home base
… of color assignment for headers in dataset details.
…of the other header colors, keeping the same hue.
… my walk through the rest of the codebase.
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.
Hey @GBirkel - I've reviewed your changes - here's some feedback:
- I noticed the SCSS class names for published data headers are spelled “pubishedata-” instead of “publisheddata-” – please fix these typos to avoid broken styles.
- The new Links table in the template has a lot of repetitive blocks; consider refactoring these into a small reusable component or using an *ngFor over a link-config array to make the template more maintainable.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- I noticed the SCSS class names for published data headers are spelled “pubishedata-” instead of “publisheddata-” – please fix these typos to avoid broken styles.
- The new Links table in the template has a lot of repetitive <tr> blocks; consider refactoring these into a small reusable component or using an *ngFor over a link-config array to make the template more maintainable.
## Individual Comments
### Comment 1
<location> `src/app/publisheddata/publisheddata-details/_publisheddata-details-theme.scss:12` </location>
<code_context>
$accent: map.get($color-config, "accent");
$header-2: map.get($color-config, "header-2");
mat-card {
- .status-header {
+ .pubishedata-status-header {
background-color: mat.m2-get-color-from-palette($warn, "lighter");
}
- .general-header {
+ .pubishedata-general-header {
background-color: mat.m2-get-color-from-palette($primary, "lighter");
}
- .creator-header {
+ .pubishedata-creator-header {
background-color: mat.m2-get-color-from-palette($header-1, "lighter");
}
- .file-header {
- background-color: mat.m2-get-color-from-palette($accent, "lighter");
+ .pubishedata-file-header {
+ background-color: mat.m2-get-color-from-palette($header-2, "lighter");
}
- .related-header {
- background-color: mat.m2-get-color-from-palette($header-2, "lighter");
+ .pubishedata-related-header {
</code_context>
<issue_to_address>
Typo in class name: 'pubishedata' should be 'publisheddata'.
Using 'pubishedata' instead of 'publisheddata' may cause confusion and inconsistency. Please update the class names to 'publisheddata-*' for clarity.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
.pubishedata-status-header {
background-color: mat.m2-get-color-from-palette($warn, "lighter");
}
.pubishedata-general-header {
background-color: mat.m2-get-color-from-palette($primary, "lighter");
}
.pubishedata-creator-header {
background-color: mat.m2-get-color-from-palette($header-1, "lighter");
}
.pubishedata-file-header {
background-color: mat.m2-get-color-from-palette($header-2, "lighter");
}
.pubishedata-related-header {
background-color: mat.m2-get-color-from-palette($accent, "lighter");
}
=======
.publisheddata-status-header {
background-color: mat.m2-get-color-from-palette($warn, "lighter");
}
.publisheddata-general-header {
background-color: mat.m2-get-color-from-palette($primary, "lighter");
}
.publisheddata-creator-header {
background-color: mat.m2-get-color-from-palette($header-1, "lighter");
}
.publisheddata-file-header {
background-color: mat.m2-get-color-from-palette($header-2, "lighter");
}
.publisheddata-related-header {
background-color: mat.m2-get-color-from-palette($accent, "lighter");
}
>>>>>>> REPLACE
</suggested_fix>
### Comment 2
<location> `src/app/publisheddata/publisheddata-details/publisheddata-details.component.html:4` </location>
<code_context>
<div fxLayout="row" fxLayout.xs="column" *ngIf="publishedData">
<div fxFlex="60">
<mat-card>
- <mat-card-header class="status-header">
+ <mat-card-header class="pubishedata-status-header">
<div mat-card-avatar class="section-icon">
</code_context>
<issue_to_address>
Class name typo: 'pubishedata' should likely be 'publisheddata'.
Using the correct spelling will improve consistency and make it easier to locate related styles.
Suggested implementation:
```
<mat-card-header class="publisheddata-status-header">
```
```
<mat-card-header class="publisheddata-general-header">
```
</issue_to_address>
### Comment 3
<location> `src/styles.scss:213` </location>
<code_context>
warn-2: $warn-2,
header-1: $header-1,
header-2: $header-2,
- header-3: $header-4,
+ header-3: $header-3,
header-4: $header-4,
</code_context>
<issue_to_address>
Potential previous bug: header-3 was mapped to header-4.
This change should correct any color inconsistencies. Please verify all usages to confirm the issue is fully resolved.
Suggested implementation:
```
header-3: $header-3,
```
You should also:
1. Search for all usages of the `header-3` color variable in your codebase (e.g., `color: map-get($theme-colors, header-3)` or similar).
2. Verify that these usages now display the correct color as defined by `$header-3`.
3. If you find any components or styles that were relying on the previous (incorrect) mapping to `$header-4`, update them to use the correct color variable as intended.
No further changes are needed in `src/styles.scss` itself, but you may need to update other files if you find usages that were depending on the old mapping.
</issue_to_address>
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
src/app/publisheddata/publisheddata-details/_publisheddata-details-theme.scss
Outdated
Show resolved
Hide resolved
src/app/publisheddata/publisheddata-details/publisheddata-details.component.html
Show resolved
Hide resolved
Hi I see you have changed some theme colors, could you provide screenshots and explain why the theme color change is needed |
Certainly! Currently, SciCat's styling is configured to define four header styles, 1 through 4, except style 3 and 4 are mapped to the same thing: Line 213 in 5f56da2
This change was introduced about four years ago during what appears to be an unrelated refactor: 0e4720b#diff-23fad3928bf3e71585eb4a6e3b2ff72dae02c3ed5a44d2f0deb1d49f0cb3b1a3R207 If anyone has insight into why, I'd be very interested to know. Right now it just looks like a copy-paste error. Anyway, as a result of that, for four years we've had two header subsections with the same color. Check out "File Information" and "Derived Data": When I changed header 3 to actually point to header style 3, the color that appeared had a luminance value that was quite different from the other header colors. It was much brighter. I also noticed that the current ordering of the header colors went across the spectrum out-of-order, instead of consistently from one end of the spectrum to the other. So I dialed down the luminance of the newly revealed color and changed the order: We still don't have enough colors to make every subsection different, but there's one more to work with at least. This is important because I'm adding another section: "Links", visible (with junk content) in the above screenshot. |
…h API spec directly from within Docker due to "backend.localhost" mapping.)
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.
Once the changes requested are addressed, I will be happy to approve it
// Jasmine testing framework descriptions for Angular component TableComponent | ||
|
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.
Do we really need this comment here?
// Accessory types and definition for Angular component TableComponent | ||
|
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.
Do we need the comment?
// NgModule declaration for Angular component TableComponent | ||
|
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.
Do we need the comment?
src/app/theme.ts
Outdated
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.
Are we changing the colors in the vanilla version of SciCat?
src/assets/theme.json
Outdated
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.
Same as above, are we changing the color of the vanilla version of SciCat?
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.
Can we remove the comments?
<table> | ||
<tr *ngIf="dataset['proposalId'] && proposal"> | ||
<th>{{ "Proposal" | translate }}</th> | ||
<td> | ||
<a (click)="onClickProposal(proposal.proposalId)">{{ | ||
proposal.title | ||
}}</a> | ||
</td> | ||
</tr> | ||
<tr | ||
*ngIf=" | ||
dataset['proposalId'] && | ||
!proposal && | ||
appConfig.datasetDetailsShowMissingProposalId | ||
" | ||
> | ||
<th>{{ "Proposal Id" | translate }}</th> | ||
<td>{{ dataset["proposalId"] }}</td> | ||
</tr> | ||
<tr *ngIf="dataset['sampleId'] && sample"> | ||
<th>{{ "Sample" | translate }}</th> | ||
<td> | ||
<a (click)="onClickSample(sample.sampleId)"> | ||
<span>{{ sample.description }}</span> | ||
</a> | ||
</td> | ||
</tr> | ||
<tr *ngIf="dataset['instrumentId'] && instrument"> | ||
<th>{{ "Instrument" | translate }}</th> | ||
<td> | ||
<a (click)="onClickInstrument(instrument.pid)"> | ||
{{ instrument.name }} | ||
</a> | ||
</td> | ||
</tr> | ||
<tr *ngIf="dataset['creationLocation'] as value"> | ||
<th>{{ "Creation Location" | translate }}</th> | ||
<td>{{ value }}</td> | ||
</tr> | ||
<tr *ngIf="dataset.techniques && dataset.techniques.length > 0"> | ||
<th>{{ "Techniques" | translate }}</th> | ||
<td> | ||
<div *ngFor="let technique of dataset.techniques"> | ||
<span> | ||
{{ technique.name }} | ||
</span> | ||
<span | ||
*ngIf=" | ||
dataset.techniques.indexOf(technique) < | ||
dataset.techniques.length - 1 | ||
" | ||
>, | ||
</span> | ||
</div> | ||
</td> | ||
</tr> |
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'm not sure I understand why we added these fields here as they should be already present in other section of the dataset detail template.
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.
We should make this code more robust.
Please read my comments below and see if they make sense.
scripts/generate-nestjs-sdk.bash
Outdated
USING_SCICAT_LIVE=0 | ||
while [[ "$#" -gt 0 ]]; do | ||
case "$1" in | ||
--scicatlive) | ||
USING_SCICAT_LIVE=1 | ||
shift | ||
;; | ||
*) | ||
echo "Unknown argument: $1" | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
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 would change this section of the code like below. This way we have a default, but we do not hardcode the all the other possible values, but we provide the user the option to specify the correct URL, including the case where the backend is running on a different port or different url.
SWAGGER_API_URL="http://localhost:3000/explorer-json"
while [[ "$#" -gt 0 ]]; do
case "$1" in
--swagger-url)
shift
SWAGGER_API_URL=$1
shift
;;
*)
echo "Unknown argument: $1"
exit 1
;;
esac
done
scripts/generate-nestjs-sdk.bash
Outdated
if [ $USING_SCICAT_LIVE -eq 1 ]; | ||
then | ||
# For when developing with SciCat Live: | ||
curl http://backend.localhost/explorer-json > local-api-for-generator.json | ||
else | ||
# For when developing with a backend running directly on localhost: | ||
curl http://host.docker.internal:3000/explorer-json > local-api-for-generator.json | ||
fi |
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.
change the code to:
curl ${SWAGGER_API_URL} > local-api-for-generator.json
@GBirkel is this a draft PR or is it ready to be reviewed? |
Ah, yes, this is a draft. Sorry for the confusion. |
Description
Add a field for generating dataset links based on admin-configured templates.
See SciCatProject/scicat-backend-next#689 for details.
This has a companion PR for the back end: SciCatProject/scicat-backend-next#2097 .
Motivation
We get a lot of requests from users and researchers to provide a variety of different types of web-based tools that related directly to datasets. These can be pages that display visualization, pages that provide analysis tools (including AI/ML) and jupyter notebooks on particular JupyterHub instance. In all cases, we would want to take the user to the page with the dataset in context.
Fixes:
Please provide a list of the fixes implemented in this PR
Changes:
Please provide a list of the changes implemented by this PR
Tests included
Documentation
official documentation info
If you have updated the official documentation, please provide PR # and URL of the pages where the updates are included
Backend version
Summary by Sourcery
Add a new “Links” section to dataset detail and unify header styling across various components by renaming CSS classes and updating theme color mappings
New Features:
Enhancements: