Skip to content

Client Count Calendar Widget for 1.10 #13613

Merged
Monkeychip merged 7 commits intomainfrom
ui/calendar-widget-2
Jan 11, 2022
Merged

Client Count Calendar Widget for 1.10 #13613
Monkeychip merged 7 commits intomainfrom
ui/calendar-widget-2

Conversation

@Monkeychip
Copy link
Copy Markdown
Contributor

@Monkeychip Monkeychip commented Jan 10, 2022

This is hidden under the Dashboard component, which is commented out.

This PR adds the calendar widget that helps users select an endDate, single Month, or the billing period. Outside of the widget, on the Dashboard component, this PR adds another modal that allows the user to pick the startMonth. This layout/set-up is very specific to the Client Counts data and billing periods for 1.10. Though not wired up in this PR, the billing startDate will init with the startDate under the license endpoint.

Once a start and end date is selected, a network request will be fired off (when the API is ready) to return the data.

Here is a video of the modal and calendar-widget. Note, no data is sent, though the structure is partially in place. You'll also notice that you cannot select an endDate from the calendar-widget that comes before the startDate.

Screen.Recording.2022-01-10.at.11.55.48.AM.mp4

Comment thread ui/app/components/clients/dashboard.js
import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';

// ARG TODO documentation takes start and end for handQuery
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this component will eventually have functions passed down from the parent which is why I left the TODO comment there.

constructor() {
super(...arguments);
// ARG TODO we need to return the config's duration if not default to 12 months to calculate, now it's 12 months
let date = new Date();
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

right now I'm calculating the startDate based on today, but the next PR will pull the startDate from the license endpoint and send it to the component as a param. This component is only in charge of endDates or singleMonth or saying, just go back to the default billing period.

resetData() {
this.barChartSelection = false;
this.selectedNamespace = null;
selectStartMonth(month) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

these are fired off from the modal that sets the startMonth. Right now, they do nothing but set a param, when it's wired up they'll fire off a network request.

Comment thread ui/app/styles/components/calendar-widget.scss
text-shadow: 0 1px 1px rgba($black, 0.25);
}

&.is-link {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We need the button we use to look like a link because we were told it should be a button even if it doesn't look like one for accessibility reasons.

</div>
{{/if}}

{{#if this.showSingleMonth}}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is essentially a copy of the above calendar chunk with a different instance and id names. The reason I did this, even though it's a copy is because the widget needs to know what calendar we're looking at. They behave differently even if they look identical.

Comment thread ui/app/components/calendar-widget.js Outdated
currentMonth = parseInt(format(this.currentDate, 'M')) - 1; // integer and zero index

@tracked allMonthsNodeList = [];
@tracked displayYear = this.currentYear; // init to currentYear and then changes as a user clicks on the chevrons
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for these comments! 😍

Comment thread ui/app/components/calendar-widget.js
this.endDateDisplay = format(date, 'MMMM yyyy');
}

// HELPER FUNCTIONS (alphabetically) //
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

alphabetically 👏 👏 👏 😻

Copy link
Copy Markdown
Contributor

@hashishaw hashishaw left a comment

Choose a reason for hiding this comment

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

So excited for the slick calendar widget 😻

element.classList.add(classString);
}

isCurrentYear() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Any reason this and isObsoleteYear aren't getters? (eg. formatted like get isObsoleteYear() {...})

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@chelshaw likely a dumb question. What is the benefit of making these getters?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pretty sure it does a similar thing as computed did, where it will be updated each time and stay up to date. No such guarantees if it's not a getter, but if you're calling it explicitly each time it might not matter 🤷

Comment thread ui/app/components/calendar-widget.js Outdated
Comment thread ui/app/components/clients/dashboard.js Outdated
Comment thread ui/app/styles/components/calendar-widget.scss
Comment thread ui/app/styles/core/title.scss Outdated
Comment thread ui/app/templates/components/calendar-widget.hbs Outdated
];
@tracked selectedNamespace = null;
// For startDate Modal
months = Array.from({ length: 12 }, (item, i) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We could use the const DATE_MAPPING here if it was in a util file - might make sense if there are other shared functions between files

@vercel vercel bot temporarily deployed to Preview – vault January 11, 2022 00:05 Inactive
Copy link
Copy Markdown
Contributor

@hashishaw hashishaw left a comment

Choose a reason for hiding this comment

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

🚀

@Monkeychip Monkeychip merged commit c567279 into main Jan 11, 2022
@Monkeychip Monkeychip deleted the ui/calendar-widget-2 branch January 11, 2022 18:05
heppu pushed a commit to heppu/vault that referenced this pull request Jan 13, 2022
* cherry pick my changes over

* clean up

* styling fix

* clean up

* address pr comments

* rename

* update comment
pull bot pushed a commit to Reality2byte/vault that referenced this pull request Apr 6, 2026
…corp#13622)

* Fix pkiexternalca feature bugs in vault agent

* Add changelog

* Add regression tests

Co-authored-by: Zlaticanin <60530402+Zlaticanin@users.noreply.github.com>
MochaCaffe pushed a commit to kosmos-education/vault that referenced this pull request Apr 15, 2026
…corp#13623) (hashicorp#13625)

* Fix pkiexternalca feature bugs in vault agent

* Add changelog

* Add regression tests

Co-authored-by: Zlaticanin <60530402+Zlaticanin@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants