Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/dashboard issues #2349

Merged
merged 3 commits into from
Feb 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions client/app/config/dashboard-grid-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const dashboardGridOptions = {
columns: 6,
pushing: true,
floating: true,
swapping: true,
swapping: false,
width: 'auto',
colWidth: 'auto',
rowHeight: 50,
Expand All @@ -12,9 +12,9 @@ const dashboardGridOptions = {
isMobile: false,
mobileBreakPoint: 800,
mobileModeEnabled: true,
minColumns: 1,
minColumns: 6,
minRows: 1,
maxRows: 100,
maxRows: 1000,
defaultSizeX: 3,
defaultSizeY: 3,
minSizeX: 1,
Expand Down
52 changes: 27 additions & 25 deletions client/app/directives/gridster-auto-height.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,36 @@ function gridsterAutoHeight($timeout) {
let destroyed = false;

function updateHeight() {
const wrapper = $element[0];
// Query element, but keep selector order
const element = _.chain(attr.gridsterAutoHeight.split(','))
.map(selector => wrapper.querySelector(selector))
.filter(_.isObject)
.first()
.value();
if (element) {
const childrenBounds = _.chain(element.children)
.map(child => child.getBoundingClientRect())
.reduce((result, bounds) => ({
left: Math.min(result.left, bounds.left),
top: Math.min(result.top, bounds.top),
right: Math.min(result.right, bounds.right),
bottom: Math.min(result.bottom, bounds.bottom),
}))
if (controller.gridster) {
const wrapper = $element[0];
// Query element, but keep selector order
const element = _.chain(attr.gridsterAutoHeight.split(','))
.map(selector => wrapper.querySelector(selector))
.filter(_.isObject)
.first()
.value();
if (element) {
const childrenBounds = _.chain(element.children)
.map(child => child.getBoundingClientRect())
.reduce((result, bounds) => ({
left: Math.min(result.left, bounds.left),
top: Math.min(result.top, bounds.top),
right: Math.min(result.right, bounds.right),
bottom: Math.min(result.bottom, bounds.bottom),
}))
.value();

const additionalHeight = 100 + _.last(controller.gridster.margins);
const contentsHeight = childrenBounds.bottom - childrenBounds.top;
$timeout(() => {
controller.sizeY = Math.ceil((contentsHeight + additionalHeight) /
controller.gridster.curRowHeight);
});
}
const additionalHeight = 100 + _.last(controller.gridster.margins);
const contentsHeight = childrenBounds.bottom - childrenBounds.top;
$timeout(() => {
controller.sizeY = Math.ceil((contentsHeight + additionalHeight) /
controller.gridster.curRowHeight);
});
}

if (!destroyed) {
requestAnimationFrame(updateHeight);
if (!destroyed) {
requestAnimationFrame(updateHeight);
}
}
}

Expand Down
7 changes: 3 additions & 4 deletions client/app/visualizations/cohort/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ const DEFAULT_OPTIONS = {
stageColumn: 'day_number',
totalColumn: 'total',
valueColumn: 'value',

defaultRows: -1,
};

function groupData(sortedData) {
Expand Down Expand Up @@ -221,16 +223,13 @@ export default function init(ngModule) {

ngModule.config((VisualizationProvider) => {
const editTemplate = '<cohort-editor></cohort-editor>';
const defaultOptions = {
timeInterval: 'daily',
};

VisualizationProvider.registerVisualization({
type: 'COHORT',
name: 'Cohort',
renderTemplate: '<cohort-renderer options="visualization.options" query-result="queryResult"></cohort-renderer>',
editorTemplate: editTemplate,
defaultOptions,
defaultOptions: DEFAULT_OPTIONS,
});
});
}
2 changes: 1 addition & 1 deletion client/app/visualizations/table/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const DISPLAY_AS_OPTIONS = [

const DEFAULT_OPTIONS = {
itemsPerPage: 15,
defaultRows: 14,
defaultRows: -1,
defaultColumns: 4,
minColumns: 2,
};
Expand Down
5 changes: 5 additions & 0 deletions client/app/visualizations/word-cloud/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,17 @@ export default function init(ngModule) {
ngModule.directive('wordCloudEditor', wordCloudEditor);
ngModule.directive('wordCloudRenderer', wordCloudRenderer);

const defaultOptions = {
defaultRows: -1,
};

ngModule.config((VisualizationProvider) => {
VisualizationProvider.registerVisualization({
type: 'WORD_CLOUD',
name: 'Word Cloud',
renderTemplate: '<word-cloud-renderer options="visualization.options" query-result="queryResult"></word-cloud-renderer>',
editorTemplate: '<word-cloud-editor></word-cloud-editor>',
defaultOptions,
});
});
}