mirror of https://github.com/apache/superset.git
addressing PR comments
This commit is contained in:
parent
c11e9c8b67
commit
a4597afee0
|
@ -15,8 +15,8 @@
|
||||||
"dev-server": "webpack-dev-server --mode=development --progress",
|
"dev-server": "webpack-dev-server --mode=development --progress",
|
||||||
"prod": "node --max_old_space_size=4096 webpack --mode=production --colors --progress",
|
"prod": "node --max_old_space_size=4096 webpack --mode=production --colors --progress",
|
||||||
"build": "NODE_ENV=production webpack --mode=production --colors --progress",
|
"build": "NODE_ENV=production webpack --mode=production --colors --progress",
|
||||||
"lint": "eslint --ignore-path=.eslintignore --ext .js,.jsx . && tslint -c tslint.json ./src/**/*.ts{,x}",
|
"lint": "eslint --ignore-path=.eslintignore --ext .js,.jsx . && tslint -c tslint.json ./{src,spec}/**/*.ts{,x}",
|
||||||
"lint-fix": "eslint --fix --ignore-path=.eslintignore --ext .js,.jsx . && tslint -c tslint.json --fix ./src/**/*.ts{,x}",
|
"lint-fix": "eslint --fix --ignore-path=.eslintignore --ext .js,.jsx . && tslint -c tslint.json --fix ./{src,spec}/**/*.ts{,x}",
|
||||||
"sync-backend": "babel-node --presets env src/syncBackend.js",
|
"sync-backend": "babel-node --presets env src/syncBackend.js",
|
||||||
"cypress": "cypress",
|
"cypress": "cypress",
|
||||||
"cypress-debug": "cypress open --config watchForFileChanges=true"
|
"cypress-debug": "cypress open --config watchForFileChanges=true"
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
import { AdhocMetric, Aggregate, ExpressionType, Metrics } from 'src/query/Metric';
|
import { ColumnType } from 'src/query/Column';
|
||||||
|
import {
|
||||||
|
AdhocMetric, Aggregate, ExpressionType, LABEL_MAX_LENGTH, Metrics,
|
||||||
|
} from 'src/query/Metric';
|
||||||
|
|
||||||
describe('Metrics', () => {
|
describe('Metrics', () => {
|
||||||
let metrics: Metrics;
|
let metrics: Metrics;
|
||||||
|
@ -22,7 +25,7 @@ describe('Metrics', () => {
|
||||||
column: {
|
column: {
|
||||||
columnName: 'sum_girls',
|
columnName: 'sum_girls',
|
||||||
id: 5,
|
id: 5,
|
||||||
type: 'BIGINT',
|
type: ColumnType.BIGINT,
|
||||||
},
|
},
|
||||||
expressionType: ExpressionType.SIMPLE,
|
expressionType: ExpressionType.SIMPLE,
|
||||||
};
|
};
|
||||||
|
@ -35,7 +38,7 @@ describe('Metrics', () => {
|
||||||
column: {
|
column: {
|
||||||
columnName: 'sum_girls',
|
columnName: 'sum_girls',
|
||||||
id: 5,
|
id: 5,
|
||||||
type: 'BIGINT',
|
type: ColumnType.BIGINT,
|
||||||
},
|
},
|
||||||
expressionType: 'SIMPLE',
|
expressionType: 'SIMPLE',
|
||||||
label: 'AVG(sum_girls)',
|
label: 'AVG(sum_girls)',
|
||||||
|
@ -87,6 +90,6 @@ describe('Metrics', () => {
|
||||||
...formData,
|
...formData,
|
||||||
metric: adhocMetric,
|
metric: adhocMetric,
|
||||||
});
|
});
|
||||||
expect(metrics.getLabels()).toEqual(['COUNT(verrrrrrrrry_loooooooooooooooooooo...']);
|
expect(metrics.getLabels()[0].length).toBeLessThanOrEqual(LABEL_MAX_LENGTH);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,7 +8,7 @@ describe('queryObjectBuilder', () => {
|
||||||
expect(query.granularity).toEqual('ds');
|
expect(query.granularity).toEqual('ds');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should build granularity for sql alchemy datasources', () => {
|
it('should build granularity for sql druid datasources', () => {
|
||||||
query = build({datasource: '5__druid', granularity: 'ds'});
|
query = build({datasource: '5__druid', granularity: 'ds'});
|
||||||
expect(query.granularity).toEqual('ds');
|
expect(query.granularity).toEqual('ds');
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,24 @@
|
||||||
|
export enum ColumnType {
|
||||||
|
DOUBLE = 'DOUBLE',
|
||||||
|
FLOAT = 'FLOAT',
|
||||||
|
INT = 'INT',
|
||||||
|
BIGINT = 'BIGINT',
|
||||||
|
LONG = 'LONG',
|
||||||
|
REAL = 'REAL',
|
||||||
|
NUMERIC = 'NUMERIC',
|
||||||
|
DECIMAL = 'DECIMAL',
|
||||||
|
MONEY = 'MONEY',
|
||||||
|
DATE = 'DATE',
|
||||||
|
TIME = 'TIME',
|
||||||
|
DATETIME = 'DATETIME',
|
||||||
|
VARCHAR = 'VARCHAR',
|
||||||
|
STRING = 'STRING',
|
||||||
|
CHAR = 'CHAR',
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: fill out additional fields of the Column interface
|
// TODO: fill out additional fields of the Column interface
|
||||||
export default interface Column {
|
export default interface Column {
|
||||||
id: number;
|
id: number;
|
||||||
type: string;
|
type: ColumnType;
|
||||||
columnName: string;
|
columnName: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import Column from './Column';
|
import Column from './Column';
|
||||||
import FormData from './FormData';
|
import FormData from './FormData';
|
||||||
|
|
||||||
|
export const LABEL_MAX_LENGTH = 43;
|
||||||
|
|
||||||
export enum MetricKey {
|
export enum MetricKey {
|
||||||
METRIC = 'metric',
|
METRIC = 'metric',
|
||||||
METRICS = 'metrics',
|
METRICS = 'metrics',
|
||||||
|
@ -90,6 +92,7 @@ export class Metrics {
|
||||||
} else {
|
} else {
|
||||||
label = metric.sqlExpression;
|
label = metric.sqlExpression;
|
||||||
}
|
}
|
||||||
return label.length < 43 ? label : `${label.substring(0, 40)}...`;
|
return label.length <= LABEL_MAX_LENGTH ? label :
|
||||||
|
`${label.substring(0, LABEL_MAX_LENGTH - 3)}...`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue