From c62d12abc7d951c9381a5bc67cdf6f9dd1c7b42d Mon Sep 17 00:00:00 2001 From: Vadim Ogievetsky Date: Thu, 24 Dec 2015 16:13:13 -0800 Subject: [PATCH] works well with npm3 --- README.md | 3 ++ package.json | 2 +- .../components/header-bar/header-bar.tsx | 39 +++++++++++++------ .../pivot-application/pivot-application.tsx | 12 +++++- src/client/pivot-entry.ts | 4 +- .../visualizations/bar-chart/bar-chart.tsx | 4 +- src/server/app.ts | 17 +++++--- src/server/config.ts | 6 +++ 8 files changed, 63 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index bbf1b1bb1..d77150b63 100644 --- a/README.md +++ b/README.md @@ -125,6 +125,7 @@ Then you are ready to **Recent improvements:** +- Better comparison behavior and legend interaction - Support for query time lookups (ex. `$language.lookup('wikipedia-language-lookup')`) - Support for the extract function (ex. `resourceVersion: $resource.extract("(\d+\.\d+\.\d+)")`) - Custom dimensions (ex. `$user.substr(0,1)`) @@ -135,6 +136,8 @@ Then you are ready to - Additional visualizations (bar chart, geo, heatmap) - Exclusion filters - Better time selection +- String / RegExp filters +- Better time selection with date picker - Various additions, improvements and fixes to make the app more complete ## Questions & Support diff --git a/package.json b/package.json index 07431e81e..b5cc6c9d9 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "gulp": "3.9.0", "gulp-watch": "4.3.5", "jsdom": "7.2.1", - "laborer": "2.4.4", + "laborer": "2.4.5", "mkdirp": "0.5.1", "mocha": "2.3.4", "react-addons-test-utils": "0.14.3", diff --git a/src/client/components/header-bar/header-bar.tsx b/src/client/components/header-bar/header-bar.tsx index 9806a3e17..4ee3a36f5 100644 --- a/src/client/components/header-bar/header-bar.tsx +++ b/src/client/components/header-bar/header-bar.tsx @@ -1,4 +1,3 @@ -import MouseEventHandler = __React.MouseEventHandler; 'use strict'; require('./header-bar.css'); @@ -8,14 +7,12 @@ import { SvgIcon } from '../svg-icon/svg-icon'; import { $, Expression, Datum, Dataset } from 'plywood'; import { Essence } from "../../../common/models/index"; -function panic() { - window.location.assign(Essence.getBaseURL()); -} - export interface HeaderBarProps extends React.Props { essence: Essence; - onNavClick: MouseEventHandler; + onNavClick: React.MouseEventHandler; showLastUpdated?: boolean; + hideGitHubIcon?: boolean; + color?: string; } export interface HeaderBarState { @@ -28,8 +25,16 @@ export class HeaderBar extends React.Component { //this.state = {} } + onPanicClick(e: MouseEvent) { + if (e.altKey) { + console.log(this.props.essence.dataSource.toJS()); + return; + } + window.location.assign(Essence.getBaseURL()); + } + render() { - var { essence, onNavClick, showLastUpdated } = this.props; + var { essence, onNavClick, showLastUpdated, hideGitHubIcon, color } = this.props; var { dataSource } = essence; var updated: JSX.Element = null; @@ -40,22 +45,32 @@ export class HeaderBar extends React.Component { } } - return
+ var gitHubIcon: JSX.Element = null; + if (!hideGitHubIcon) { + gitHubIcon = + + ; + } + + var headerStyle: React.CSSProperties = null; + if (color) { + headerStyle = { background: color }; + } + + return
{dataSource.title}
{updated} -
+
- - - + {gitHubIcon}
; } diff --git a/src/client/components/pivot-application/pivot-application.tsx b/src/client/components/pivot-application/pivot-application.tsx index 7e3e50aed..8d14e2cdf 100644 --- a/src/client/components/pivot-application/pivot-application.tsx +++ b/src/client/components/pivot-application/pivot-application.tsx @@ -30,6 +30,8 @@ export interface PivotApplicationProps extends React.Props { maxFilters?: number; maxSplits?: number; showLastUpdated?: boolean; + hideGitHubIcon?: boolean; + headerColor?: string; } export interface PivotApplicationState { @@ -276,7 +278,7 @@ export class PivotApplication extends React.Component - +
); } - return Resolve.ready(8); - //return Resolve.manual(0, 'The Bar Chart visualization is not ready, please select another visualization.', []); + //return Resolve.ready(8); + return Resolve.manual(0, 'The Bar Chart visualization is not ready, please select another visualization.', []); } public mounted: boolean; diff --git a/src/server/app.ts b/src/server/app.ts index 629ab6606..3cb158ddf 100644 --- a/src/server/app.ts +++ b/src/server/app.ts @@ -17,7 +17,7 @@ if (!WallTime.rules) { WallTime.init(tzData.rules, tzData.zones); } -import { VERSION, DATA_SOURCE_MANAGER } from './config'; +import { VERSION, DATA_SOURCE_MANAGER, HIDE_GITHUB_ICON, HEADER_COLOR } from './config'; import * as plywoodRoutes from './routes/plywood/plywood'; var app = express(); @@ -45,13 +45,18 @@ app.use(bodyParser.json()); app.get('/', (req: Request, res: Response, next: Function) => { DATA_SOURCE_MANAGER.getQueryableDataSources().then((dataSources) => { if (dataSources.length) { + var config: any = { + version: VERSION, + dataSources: dataSources.map((ds) => ds.toClientDataSource()), + //homeLink: '/', + }; + + if (HIDE_GITHUB_ICON) config.hideGitHubIcon = HIDE_GITHUB_ICON; + if (HEADER_COLOR) config.headerColor = HEADER_COLOR; + res.render('pivot', { version: VERSION, - config: JSON.stringify({ - version: VERSION, - dataSources: dataSources.map((ds) => ds.toClientDataSource()) - //homeLink: '/' - }), + config: JSON.stringify(config), title: 'Pivot' }); } else { diff --git a/src/server/config.ts b/src/server/config.ts index 8f4ae7296..d98af6814 100644 --- a/src/server/config.ts +++ b/src/server/config.ts @@ -16,6 +16,9 @@ export interface PivotConfig { sourceListScan?: string; sourceListRefreshInterval?: number; dataSources?: DataSourceJS[]; + + hideGitHubIcon?: boolean; + headerColor?: string; } var packageObj = loadFileSync(path.join(__dirname, '../../package.json'), 'json') || {}; @@ -161,6 +164,9 @@ export const USE_SEGMENT_METADATA = Boolean(parsedArgs["use-segment-metadata"] | export const SOURCE_LIST_SCAN = START_SERVER ? config.sourceListScan : 'disable'; export const SOURCE_LIST_REFRESH_INTERVAL = START_SERVER ? (parseInt(config.sourceListRefreshInterval, 10) || 10000) : 0; +export const HIDE_GITHUB_ICON = Boolean(config.hideGitHubIcon); +export const HEADER_COLOR: string = config.headerColor || null; + if (SOURCE_LIST_REFRESH_INTERVAL && SOURCE_LIST_REFRESH_INTERVAL < 1000) { errorExit(new Error('can not refresh more often than once per second')); }