Skip to content
Snippets Groups Projects
Unverified Commit f59e1b87 authored by Tom Robinson's avatar Tom Robinson
Browse files

Add minute time grouping, week filtering, and tweak date operator/oeriod select chevron

parent 2a0d1216
No related branches found
No related tags found
No related merge requests found
......@@ -39,7 +39,7 @@ export default class TimeGroupingPopover extends Component {
static defaultProps = {
groupingOptions: [
// "default",
// "minute",
"minute",
"hour",
"day",
"week",
......
......@@ -35,7 +35,7 @@ export default class DateOperatorSelector extends Component {
>
<h3>{operator && titleCase(operator)}</h3>
<Icon
name='chevrondown'
name={expanded ? 'chevronup' : 'chevrondown'}
width="12"
height="12"
className="ml1"
......
import React, { Component, PropTypes } from "react";
import { pluralize, titleCase } from "humanize-plus";
import { pluralize, titleCase, capitalize } from "humanize-plus";
import cx from "classnames";
import Icon from "metabase/components/Icon";
import NumericInput from "./NumericInput.jsx";
const PERIODS = [
"minute",
"hour",
"day",
"week",
"month",
"year"
];
export default class RelativeDatePicker extends Component {
constructor () {
super();
......@@ -57,7 +66,7 @@ export const UnitPicker = ({ open, value, onChange, togglePicker, intervals, for
>
<h3>{pluralize(formatter(intervals) || 1, titleCase(value))}</h3>
<Icon
name='chevrondown'
name={open ? 'chevronup' : 'chevrondown'}
width="12"
height="12"
className="ml1"
......@@ -70,17 +79,17 @@ export const UnitPicker = ({ open, value, onChange, togglePicker, intervals, for
overflow: 'hidden'
}}
>
{ ['Minute', 'Hour', 'Day', 'Month', 'Year',].map((unit, index) =>
{ PERIODS.map((unit, index) =>
<li
className={cx(
'List-item cursor-pointer p1',
{ 'List-item--selected': unit === value }
)}
key={index}
onClick={ () => onChange(unit.toLowerCase()) }
onClick={ () => onChange(unit) }
>
<h4 className="List-item-title">
{pluralize(formatter(intervals) || 1, unit)}
{capitalize(pluralize(formatter(intervals) || 1, unit))}
</h4>
</li>
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment