Skip to content

Commit 761f468

Browse files
committed
change icons
1 parent 7879faa commit 761f468

File tree

10 files changed

+47
-28
lines changed

10 files changed

+47
-28
lines changed

src/client/components/simple-table/simple-table.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export class SimpleTable extends React.Component<SimpleTableProps, SimpleTableSt
128128

129129
labelizer(column: SimpleTableColumn): (row: any) => any {
130130
if (typeof column.field === 'string') {
131-
return (row: any) => row[column.field as string];
131+
return (row: any) => '' + row[column.field as string];
132132
}
133133

134134
return column.field as (row: any) => any;
@@ -141,7 +141,7 @@ export class SimpleTable extends React.Component<SimpleTableProps, SimpleTableSt
141141
for (let i = 0; i < columns.length; i++) {
142142
let col = columns[i];
143143

144-
let icon = col.cellIcon ? <SvgIcon svg={require(`../../icons/${col.cellIcon}.svg`)}/> : null;
144+
let icon = col.cellIcon ? <SvgIcon svg={col.cellIcon}/> : null;
145145

146146
items.push(<div
147147
className={classNames('cell', {'has-icon': !!col.cellIcon})}

src/client/icons/data.svg

Lines changed: 3 additions & 0 deletions
Loading

src/client/icons/measure.svg

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/client/icons/measures.svg

Lines changed: 3 additions & 0 deletions
Loading

src/client/views/settings-view/clusters/clusters.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export class Clusters extends React.Component<ClustersProps, ClustersState> {
103103
if (!newSettings.clusters.length) return this.renderEmpty();
104104

105105
const columns: SimpleTableColumn[] = [
106-
{label: 'Title', field: 'title', width: 200, cellIcon: 'full-cluster'},
106+
{label: 'Title', field: 'title', width: 200, cellIcon: require(`../../../icons/full-cluster.svg`) },
107107
{label: 'Host', field: 'host', width: 200},
108108
{label: 'Type', field: 'type', width: 300}
109109
];

src/client/views/settings-view/data-cube-edit/data-cube-edit.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ export interface Modal extends Nameable {
6969

7070
export class DataCubeEdit extends React.Component<DataCubeEditProps, DataCubeEditState> {
7171
private tabs: Tab[] = [
72-
{ label: 'General', value: 'general', render: this.renderGeneral, icon: 'full-settings' },
73-
{ label: 'Data', value: 'data', render: this.renderData, icon: '' },
74-
{ label: 'Dimensions', value: 'dimensions', render: this.renderDimensions, icon: 'full-cube' },
75-
{ label: 'Measures', value: 'measures', render: this.renderMeasures, icon: 'measure' },
76-
{ label: 'Options', value: 'options', render: this.renderOptions, icon: '' }
72+
{ label: 'General', value: 'general', render: this.renderGeneral, icon: require(`../../../icons/full-settings.svg`) },
73+
{ label: 'Data', value: 'data', render: this.renderData, icon: require(`../../../icons/data.svg`) },
74+
{ label: 'Dimensions', value: 'dimensions', render: this.renderDimensions, icon: require(`../../../icons/full-cube.svg`) },
75+
{ label: 'Measures', value: 'measures', render: this.renderMeasures, icon: require(`../../../icons/measures.svg`) },
76+
{ label: 'Options', value: 'options', render: this.renderOptions, icon: require(`../../../icons/full-more.svg`) }
7777
];
7878

7979
private modals: Modal[] = [
@@ -125,7 +125,7 @@ export class DataCubeEdit extends React.Component<DataCubeEditProps, DataCubeEdi
125125
className={classNames({active: activeTab.value === tab.value})}
126126
title={tab.label}
127127
type="primary"
128-
svg={tab.icon ? require(`../../../icons/${tab.icon}.svg`) : null}
128+
svg={tab.icon}
129129
key={tab.value}
130130
onClick={this.selectTab.bind(this, tab)}
131131
/>;

src/client/views/settings-view/data-cubes/data-cubes.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export class DataCubes extends React.Component<DataCubesProps, DataCubesState> {
103103
if (!newSettings.dataCubes.length) return this.renderEmpty();
104104

105105
const columns: SimpleTableColumn[] = [
106-
{label: 'Name', field: 'title', width: 170, cellIcon: 'full-cube'},
106+
{label: 'Name', field: 'title', width: 170, cellIcon: require(`../../../icons/full-cube.svg`) },
107107
{label: 'Source', field: 'source', width: 400},
108108
{label: 'Dimensions', field: (cube: DataCube) => cube.dimensions.size, width: 120},
109109
{label: 'Measures', field: (cube: DataCube) => cube.measures.size, width: 80}
@@ -125,7 +125,7 @@ export class DataCubes extends React.Component<DataCubesProps, DataCubesState> {
125125
rows={newSettings.dataCubes}
126126
actions={actions}
127127
onRowClick={this.editCube.bind(this)}
128-
></SimpleTable>
128+
/>
129129
</div>
130130
</div>;
131131
}

src/client/views/settings-view/data-table/data-table.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ export class DataTable extends React.Component<DataTableProps, DataTableState> {
8181
}
8282
})
8383
.then(
84-
(dataset: Dataset) => {
84+
(resp: any) => {
8585
if (!this.mounted) return;
8686
this.setState({
87-
dataset,
87+
dataset: Dataset.fromJS(resp.dataset),
8888
loading: false
8989
});
9090
},
@@ -159,7 +159,7 @@ export class DataTable extends React.Component<DataTableProps, DataTableState> {
159159
return {
160160
label: a.name,
161161
data: a,
162-
field: name,
162+
field: a.name,
163163
width: 170,
164164
render: this.renderHeader.bind(this, a, isPrimary)
165165
};

src/common/models/data-cube/data-cube.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,7 @@ export class DataCube implements Instance<DataCubeValue, DataCubeJS> {
609609
externalValue.rollup = this.rollup;
610610
externalValue.introspectionStrategy = cluster.getIntrospectionStrategy();
611611
externalValue.allowSelectQueries = true;
612+
externalValue.allowEternity = !this.getPrimaryTimeAttribute();
612613

613614
if (options.druidTimeAttributeName) {
614615
externalValue.timeAttribute = options.druidTimeAttributeName;

src/server/utils/settings-manager/settings-manager.ts

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
*/
1616

1717
import * as Q from 'q';
18-
import { $, Executor, basicExecutorFactory, find, Attributes, Dataset } from 'plywood';
18+
import { Timezone, day } from 'chronoshift';
19+
import { $, Executor, basicExecutorFactory, find, Attributes, Dataset, TimeRange } from 'plywood';
1920
import { Logger } from 'logger-tracker';
2021
import { TimeMonitor } from "../../../common/utils/time-monitor/time-monitor";
2122
import { AppSettings, Timekeeper, Cluster, DataCube } from '../../../common/models/index';
@@ -24,6 +25,11 @@ import { FileManager } from '../file-manager/file-manager';
2425
import { ClusterManager } from '../cluster-manager/cluster-manager';
2526
import { updater } from '../updater/updater';
2627

28+
const LOTS_OF_TIME = TimeRange.fromJS({
29+
start: new Date('1000-01-01Z'),
30+
end: new Date('4000-01-01Z')
31+
});
32+
2733
export interface SettingsManagerOptions {
2834
logger: Logger;
2935
verbose?: boolean;
@@ -376,7 +382,25 @@ export class SettingsManager {
376382
var clusterManager = this.getClusterManagerFor(clusterName);
377383
if (!clusterManager) throw new Error(`no cluster manager for ${clusterName}`);
378384
var context: any = { temp: dataCube.toExternal(clusterManager.cluster, clusterManager.requester) };
379-
return $('temp').compute(context) as any;
385+
386+
var primaryTimeExpression = dataCube.getPrimaryTimeExpression();
387+
if (primaryTimeExpression) {
388+
return $('temp')
389+
.filter(primaryTimeExpression.in(LOTS_OF_TIME))
390+
.max(primaryTimeExpression)
391+
.compute(context)
392+
.then((maxTime: Date) => {
393+
maxTime = new Date(maxTime);
394+
if (isNaN(maxTime as any)) throw new Error('invalid maxTime');
395+
var lastTwoWeeks = TimeRange.fromJS({
396+
start: day.move(maxTime, Timezone.UTC, -14),
397+
end: maxTime
398+
});
399+
return $('temp').filter(primaryTimeExpression.in(lastTwoWeeks)).limit(20).compute(context) as any;
400+
});
401+
} else {
402+
return $('temp').limit(20).compute(context) as any;
403+
}
380404
});
381405
}
382406
}

0 commit comments

Comments
 (0)