mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-14 10:37:00 +02:00
* adds development workflow to mirage config * adds mirage handler and factory for mfa workflow * adds mfa handling to auth service and cluster adapter * moves auth success logic from form to controller * adds mfa form component * shows delayed auth message for all methods * adds new code delay to mfa form * adds error views * fixes merge conflict * adds integration tests for mfa-form component * fixes auth tests * updates mfa response handling to align with backend * updates mfa-form to handle multiple methods and constraints * adds noDefault arg to Select component * updates mirage mfa handler to align with backend and adds generator for various mfa scenarios * adds tests * flaky test fix attempt * reverts test fix attempt * adds changelog entry * updates comments for todo items * removes faker from mfa mirage factory and handler * adds number to word helper * fixes tests * Revert "Merge branch 'main' into ui/mfa" This reverts commit8ee6a6aaa1
, reversing changes made to2428dd6cca
. * format-ttl helper fix from main
43 lines
1.2 KiB
JavaScript
43 lines
1.2 KiB
JavaScript
import Component from '@glimmer/component';
|
|
import { action } from '@ember/object';
|
|
import { tracked } from '@glimmer/tracking';
|
|
|
|
/**
|
|
* @module DateDropdown
|
|
* DateDropdown components are used to display a dropdown of months and years to handle date selection
|
|
*
|
|
* @example
|
|
* ```js
|
|
* <DateDropdown @handleDateSelection={this.actionFromParent} @name={{"startTime"}}/>
|
|
* ```
|
|
* @param {function} handleDateSelection - is the action from the parent that the date picker triggers
|
|
* @param {string} [name] - optional argument passed from date dropdown to parent function
|
|
*/
|
|
|
|
export default class DateDropdown extends Component {
|
|
@tracked startMonth = null;
|
|
@tracked startYear = null;
|
|
|
|
months = Array.from({ length: 12 }, (item, i) => {
|
|
return new Date(0, i).toLocaleString('en-US', { month: 'long' });
|
|
});
|
|
years = Array.from({ length: 5 }, (item, i) => {
|
|
return new Date().getFullYear() - i;
|
|
});
|
|
|
|
@action
|
|
selectStartMonth(month) {
|
|
this.startMonth = month;
|
|
}
|
|
|
|
@action
|
|
selectStartYear(year) {
|
|
this.startYear = year;
|
|
}
|
|
|
|
@action
|
|
saveDateSelection() {
|
|
this.args.handleDateSelection(this.startMonth, this.startYear, this.args.name);
|
|
}
|
|
}
|