Skip to content
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

UI: Fix rendering of DAS interstitial components #10094

Merged
merged 2 commits into from
Mar 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ BUG FIXES:
* api: Added missing devices block to AllocatedTaskResources [[GH-10064](https://github.com/hashicorp/nomad/pull/10064)]
* cli: Fixed a bug where non-int proxy port would panic CLI [[GH-10072](https://github.com/hashicorp/nomad/issues/10072)]
* cli: Fixed a bug where `nomad operator debug` incorrectly parsed https Consul API URLs. [[GH-10082](https://github.com/hashicorp/nomad/pull/10082)]
* ui: Fixed the rendering of interstitial components shown after processing a dynamic application sizing recommendation. [[GH-10094](https://github.com/hashicorp/nomad/pull/10094)]

## 1.0.4 (February 24, 2021)

Expand Down
2 changes: 1 addition & 1 deletion ui/app/components/das/recommendation-card.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
...attributes
data-test-task-group-recommendations
class='recommendation-card'
{{will-destroy this.recommendationCardDestroying}}
{{did-insert this.cardInserted}}
>

<h2 class="top overview inner-container">Resource Recommendation</h2>
Expand Down
22 changes: 18 additions & 4 deletions ui/app/components/das/recommendation-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export default class DasRecommendationCardComponent extends Component {

@tracked activeTaskToggleRowIndex = 0;

element = null;

@tracked cardHeight;
@tracked interstitialComponent;
@tracked error;
Expand Down Expand Up @@ -166,9 +168,13 @@ export default class DasRecommendationCardComponent extends Component {

@action
accept() {
this.storeCardHeight();
this.args.summary
.save()
.then(() => this.onApplied.perform(), e => this.onError.perform(e))
.then(
() => this.onApplied.perform(),
e => this.onError.perform(e)
)
.catch(e => {
if (!didCancel(e)) {
throw e;
Expand All @@ -178,10 +184,14 @@ export default class DasRecommendationCardComponent extends Component {

@action
dismiss() {
this.storeCardHeight();
this.args.summary.excludedRecommendations.pushObjects(this.args.summary.recommendations);
this.args.summary
.save()
.then(() => this.onDismissed.perform(), e => this.onError.perform(e))
.then(
() => this.onDismissed.perform(),
e => this.onError.perform(e)
)
.catch(e => {
if (!didCancel(e)) {
throw e;
Expand Down Expand Up @@ -237,8 +247,12 @@ export default class DasRecommendationCardComponent extends Component {
}

@action
recommendationCardDestroying(element) {
this.cardHeight = element.clientHeight;
cardInserted(element) {
this.element = element;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do something like this in multiple places. It might be worth looking into something like ember-ref-bucket at some point.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed! This whole thing is more clunky than I’d like 😞


storeCardHeight() {
this.cardHeight = this.element.clientHeight;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could technically go boom, but not with how storeCardHeight is currently called.

}
}

Expand Down