-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #188 from looker-open-source/lookml-dashboards
LookML Dashboard support
- Loading branch information
Showing
9 changed files
with
253 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
__tests__/dummy-projects/28-lookml-dashboards/index.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
const lams = require('../../../index.js') | ||
const mocks = require('../../../lib/mocks.js') | ||
const path= require('path') | ||
const options = { | ||
reporting:"no", | ||
cwd:__dirname, | ||
source:"{manifest.lkml,*.model.lkml,*.dashboard.lookml}" | ||
}; | ||
require('../../../lib/expect-to-contain-message'); | ||
const log = x=>console.log(x) | ||
const testProjectName = __dirname.split(path.sep).slice(-1)[0]; | ||
|
||
describe('Projects', () => { | ||
describe(testProjectName + " (needs js-yaml optional dependency)", () => { | ||
let {spies, process, console} = mocks() | ||
let messages | ||
beforeAll( async () => { | ||
messages = await lams(options,{process, console}) | ||
}) | ||
it("should not error out", ()=> { | ||
expect(console.error).not.toHaveBeenCalled() | ||
}); | ||
it("it should not contain any unexpected parser (P0) errors", ()=> { | ||
expect({messages}).not.toContainMessage({ | ||
rule: "P0", | ||
level: "error" | ||
}); | ||
}); | ||
it("it should not contain any parser syntax (P1) errors", ()=> { | ||
expect({messages}).not.toContainMessage({ | ||
rule: "P1", | ||
level: "error" | ||
}); | ||
}); | ||
|
||
it("it should match DASH_1 (3 match, 0 exempt, 1 error)", ()=> { | ||
expect({messages}).toContainMessage({ | ||
rule: "DASH_1", | ||
level: "info", | ||
description: "Rule DASH_1 summary: 3 matches, 0 matches exempt, and 1 errors" | ||
}); | ||
}); | ||
|
||
it("it should error on DASH_1", ()=> { | ||
expect({messages}).toContainMessage({ | ||
rule: "DASH_1", | ||
level: "error" | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#LAMS | ||
#rule: DASH_1 { | ||
# description: "`model` attribute should not be set (allow inheritance based on model inclusion)" | ||
# match: "$.model.*.dashboard.*[0].elements.*" | ||
# expr_rule: | ||
# (=== ::match:model undefined) | ||
# ;; | ||
#} |
97 changes: 97 additions & 0 deletions
97
__tests__/dummy-projects/28-lookml-dashboards/test.dashboard.lookml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
- dashboard: user_segments | ||
title: User segments | ||
layout: newspaper | ||
embed_style: | ||
background_color: "#ff4141" | ||
show_title: false | ||
title_color: "#3a4245" | ||
show_filters_bar: true | ||
tile_text_color: "#3a4245" | ||
text_tile_text_color: "#caff37" | ||
elements: | ||
- name: User segments | ||
title: User segments | ||
model: thelook | ||
explore: users | ||
type: looker_pie | ||
fields: | ||
- users.gender | ||
- users.count | ||
filters: | ||
users.state: '' | ||
sorts: | ||
- users.count desc | ||
limit: 500 | ||
column_limit: 50 | ||
query_timezone: America/Los_Angeles | ||
value_labels: legend | ||
label_type: labPer | ||
stacking: '' | ||
show_value_labels: false | ||
label_density: 25 | ||
legend_position: center | ||
x_axis_gridlines: false | ||
y_axis_gridlines: true | ||
show_view_names: true | ||
limit_displayed_rows: false | ||
y_axis_combined: true | ||
show_y_axis_labels: true | ||
show_y_axis_ticks: true | ||
y_axis_tick_density: default | ||
y_axis_tick_density_custom: 5 | ||
show_x_axis_label: true | ||
show_x_axis_ticks: true | ||
x_axis_scale: auto | ||
y_axis_scale_mode: linear | ||
ordering: none | ||
show_null_labels: false | ||
show_totals_labels: false | ||
show_silhouette: false | ||
totals_color: "#808080" | ||
series_types: {} | ||
listen: | ||
State: users.state | ||
row: 0 | ||
col: 0 | ||
width: 12 | ||
height: 8 | ||
- name: Markdown | ||
type: text | ||
title_text: Markdown | ||
body_text: "Inline-style: \n![alt text](https://wwwstatic-a.lookercdn.com/homepage/new_home/looker.svg)\n\ | ||
\nReference-style: \n![alt text][logo]\n\n[logo]: https://wwwstatic-a.lookercdn.com/homepage/new_home/looker.svg" | ||
row: 0 | ||
col: 12 | ||
width: 12 | ||
height: 6 | ||
- name: Md | ||
type: text | ||
title_text: Md | ||
body_text: "Inline-style: \n![alt text](https://wwwstatic-a.lookercdn.com/homepage/new_home/looker.svg)\n\ | ||
\nReference-style: \n![alt text][logo]\n\n[logo]: https://wwwstatic-a.lookercdn.com/homepage/new_home/looker.svg" | ||
row: 8 | ||
col: 0 | ||
width: 24 | ||
height: 8 | ||
filters: | ||
- name: State | ||
title: State | ||
type: field_filter | ||
default_value: | ||
model: thelook | ||
explore: orderss | ||
field: users.state | ||
listens_to_filters: [] | ||
allow_multiple_values: true | ||
required: false | ||
- name: City | ||
title: City | ||
type: field_filter | ||
default_value: '' | ||
model: thelook | ||
explore: orders | ||
field: users.city | ||
listens_to_filters: | ||
- State | ||
allow_multiple_values: true | ||
required: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include: "*.dashboard" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.