Skip to content

Commit

Permalink
Merge pull request #379 from keen/feat/timeframe
Browse files Browse the repository at this point in the history
feat: 🎸 timeframe for query creator
  • Loading branch information
maciejrybaniec authored Jul 30, 2020
2 parents bb4c3fc + fbb872a commit 41c49da
Show file tree
Hide file tree
Showing 85 changed files with 1,137 additions and 432 deletions.
27 changes: 27 additions & 0 deletions lib/css/index.css
Original file line number Diff line number Diff line change
@@ -1,2 +1,29 @@
@import '../../node_modules/react-dates/lib/css/_datepicker.css';
@import '../../node_modules/rc-time-picker/assets/index.css';

.keen-time-picker.rc-time-picker-panel {
font-family: 'Lato Regular', sans-serif;

.rc-time-picker-panel-input-wrap {
border: none;
padding: 0;
}

.rc-time-picker-panel-input {
display: none;
}

.rc-time-picker-panel-inner {
margin-top: 42px;
}

.rc-time-picker-panel-select li {
outline: none;
}

.rc-time-picker-panel-select li:hover,
.rc-time-picker-panel-select-option-selected {
background: rgba(156,192,162,0.2);
}

}
6 changes: 3 additions & 3 deletions lib/js/app/components/Browser/Browser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import { getSavedQuery } from '../../modules/savedQuery';
import { AppState } from '../../modules/types';

type Props = {
query: Object;
query: Record<string, any>;
onEditQuery: (queryName: string) => void;
onSelectQuery: (queryName: string, settings: Object) => void;
onSelectQuery: (queryName: string, settings: Record<string, any>) => void;
onRunQuery: () => void;
queryResults?: Object;
queryResults?: Record<string, any>;
};

const Browser: FC<Props> = ({
Expand Down
2 changes: 1 addition & 1 deletion lib/js/app/components/Creator/Creator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { AppContext } from '../../contexts';
import { queryEditorMounted } from '../../modules/app';

type Props = {
onUpdateQuery: (query: Object) => void;
onUpdateQuery: (query: Record<string, any>) => void;
};

const Creator: FC<Props> = ({ onUpdateQuery }) => {
Expand Down
4 changes: 3 additions & 1 deletion lib/js/app/components/DataViz/Dataviz.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { CONTAINER_ID } from './constants';

type Props = {
/** Query execution results */
analysisResults: Object;
analysisResults: Record<string, any>;
/** Type of visualization */
visualization: string;
};
Expand All @@ -32,4 +32,6 @@ const Dataviz = forwardRef<HTMLDivElement, Props>(
}
);

Dataviz.displayName = 'Dataviz';

export default Dataviz;
4 changes: 2 additions & 2 deletions lib/js/app/components/Editor/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import { setViewMode } from '../../modules/app';

type Props = {
/** Query definition */
query: Object;
query: Record<string, any>;
/** Query update handler */
onUpdateQuery: (query: Object) => void;
onUpdateQuery: (query: Record<string, any>) => void;
/** Run query event handler */
onRunQuery: () => void;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { NEW_QUERY_EVENT } from '../../queryCreator';

type Props = {
/** Query definition */
query: Object;
query: Record<string, any>;
};

const EditorNavigation: FC<Props> = ({ query }) => {
Expand Down
2 changes: 1 addition & 1 deletion lib/js/app/components/EmbedWidget/EmbedWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type Props = {
/** Widget type */
widget: string;
/** Query definition */
query: Object;
query: Record<string, any>;
};

const EmbedWidget: FC<Props> = ({ widget, query }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const createCodeSnippet = ({
readKey,
}: {
widget: string;
query: Object;
query: Record<string, any>;
projectId: string;
readKey: string;
}) => `
Expand Down
2 changes: 1 addition & 1 deletion lib/js/app/components/JSONView/JSONView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Container } from './JSONView.styles';

type Props = {
/** Query execution results */
analysisResults: Object;
analysisResults: Record<string, any>;
};

const JSONView: FC<Props> = ({ analysisResults }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import { DEFAULT_FILENAME } from './constants';

type Props = {
/** Query definition */
query: Object;
query: Record<string, any>;
/** Analysis results */
queryResults: Object;
queryResults: Record<string, any>;
};

const QueryVisualization: FC<Props> = ({ queryResults, query }) => {
Expand Down
5 changes: 2 additions & 3 deletions lib/js/app/components/QueryVisualization/utils/exportToCsv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ const convertToCSV = (
lineDelimiter = '\n'
) => {
let result: string;
let keys: string[];
let ctr: number;

if (data === null || !data.length) {
return null;
}

keys = Object.keys(data[0]);
const keys = Object.keys(data[0]);

result = '';
result += keys.join(columnDelimiter);
Expand All @@ -38,7 +37,7 @@ const convertToCSV = (
return result;
};

export const exportToCsv = (data: Object, filename: string) => {
export const exportToCsv = (data: Record<string, any>, filename: string) => {
let downloadFileName = filename;
const hasExtension = filename.includes('.csv');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { download } from './download';

export const exportToJson = (data: Object, filename: string) => {
export const exportToJson = (data: Record<string, any>, filename: string) => {
let downloadFileName = filename;
const hasExtension = filename.includes('.json');

Expand Down
1 change: 1 addition & 0 deletions lib/js/app/components/RunQuery/utils/runQueryLabel.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/camelcase */
export const runQueryLabel = (query: any) => {
const { analysis_type, email } = query;
if (analysis_type === 'extraction' && email) return 'Extract to email';
Expand Down
75 changes: 0 additions & 75 deletions lib/js/app/components/explorer/shared/FilteredList.tsx

This file was deleted.

21 changes: 0 additions & 21 deletions lib/js/app/components/explorer/shared/Option.tsx

This file was deleted.

25 changes: 0 additions & 25 deletions lib/js/app/components/explorer/shared/ReactSelect.tsx

This file was deleted.

6 changes: 3 additions & 3 deletions lib/js/app/modules/app/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const editQuery = (queryName: string): AppActions => ({
},
});

export const updateQueryCreator = (query: Object): AppActions => ({
export const updateQueryCreator = (query: Record<string, any>): AppActions => ({
type: UPDATE_QUERY_CREATOR,
payload: { query },
});
Expand All @@ -40,8 +40,8 @@ export const createNewQuery = (): AppActions => ({
});

export const copyShareUrl = (
query: Object,
savedQuery: Object
query: Record<string, any>,
savedQuery: Record<string, any>
): AppActions => ({
type: COPY_SHARE_URL,
payload: {
Expand Down
2 changes: 2 additions & 0 deletions lib/js/app/modules/app/saga.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/camelcase */

import { takeLatest, put, take, select, getContext } from 'redux-saga/effects';

import { setViewMode, updateQueryCreator } from './actions';
Expand Down
6 changes: 3 additions & 3 deletions lib/js/app/modules/app/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ export type ReducerState = {
export interface CopyShareUrlAction {
type: typeof COPY_SHARE_URL;
payload: {
query: Object;
savedQuery: Object;
query: Record<string, any>;
savedQuery: Record<string, any>;
};
}

Expand All @@ -53,7 +53,7 @@ export interface QueryEditorMountedAction {

export interface UpdateQueryCreatorAction {
type: typeof UPDATE_QUERY_CREATOR;
payload: { query: Object };
payload: { query: Record<string, any> };
}

export interface SetViewModeAction {
Expand Down
10 changes: 5 additions & 5 deletions lib/js/app/modules/queries/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ export const setQueryCacheLimitError = (error: Error): QueriesActions => ({
payload: { error },
});

export const saveQuery = (name: string, body: Object): QueriesActions => ({
export const saveQuery = (name: string, body: Record<string, any>): QueriesActions => ({
type: SAVE_QUERY,
payload: { name, body },
});

export const saveQuerySuccess = (
queryName: string,
body: Object
body: Record<string, any>
): QueriesActions => ({
type: SAVE_QUERY_SUCCESS,
payload: {
Expand Down Expand Up @@ -73,7 +73,7 @@ export const getSavedQueries = (): QueriesActions => ({
type: GET_SAVED_QUERIES,
});

export const getSavedQueriesSuccess = (queries: Object[]): QueriesActions => ({
export const getSavedQueriesSuccess = (queries: Record<string, any>[]): QueriesActions => ({
type: GET_SAVED_QUERIES_SUCCESS,
payload: { queries },
});
Expand All @@ -83,12 +83,12 @@ export const getSavedQueriesError = (error: Error): QueriesActions => ({
payload: { error },
});

export const runQuery = (body: Object): QueriesActions => ({
export const runQuery = (body: Record<string, any>): QueriesActions => ({
type: RUN_QUERY,
payload: { body },
});

export const runQuerySuccess = (results: Object): QueriesActions => ({
export const runQuerySuccess = (results: Record<string, any>): QueriesActions => ({
type: RUN_QUERY_SUCCESS,
payload: { results },
});
Expand Down
2 changes: 2 additions & 0 deletions lib/js/app/modules/queries/saga.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/camelcase */

import { takeLatest, getContext, take, put } from 'redux-saga/effects';

import {
Expand Down
Loading

0 comments on commit 41c49da

Please sign in to comment.