Skip to content

Commit

Permalink
feat(v2): update demo according to latest Mozaïk updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphaël Benitte committed Aug 18, 2017
1 parent 2ceb5dc commit 363b4ae
Show file tree
Hide file tree
Showing 21 changed files with 817 additions and 415 deletions.
11 changes: 9 additions & 2 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@
# rename it to .env to use it
#

# mozaik-ext-github
# @mozaik/ext-github
#
# Not required, but without it, you'll probably reach the API rate limit.
# Uncomment and set yours to use it
# Uncomment and set yours to use it.
#
#GITHUB_API_TOKEN=xxxxx

# mozaik-ext-analytics
#
# Required if you wish to use this extension.
#
#GOOGLE_SERVICE_EMAIL=<GOOGLE_SERVICE_EMAIL>
#GOOGLE_SERVICE_KEY=<GOOGLE_KEY>
File renamed without changes.
8 changes: 3 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
.DS_Store
.env
.idea
/node_modules
node_modules
/build
.env
.idea
*.log*
config-*.yml
!config-github.yml
!config-travis.yml
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: node_js
node_js:
- '6'
script:
- npm run build
- '7'
- '8'
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ This repository shows how to use Mozaïk with npm extensions.

``` sh
git clone git@github.com:plouc/mozaik-demo.git
cd mozaik-demo
git checkout mozaik-2
```

### Install packages

``` sh
cd mozaik-demo
yarn install
```

Expand All @@ -38,21 +39,22 @@ extensions demo, to run another demo, simply pass the config
file as first argument:

``` sh
node server.js config-github.yml
node server.js conf/config-github.yml
```

Just search for `config-*.yml` files to see what's available.
See `conf/` directory for available config files.

### Tweaking default theme

Several themes are loaded from
[`mozaik-themes`](https://github.com/plouc/mozaik-themes)
[`@mozaik/themes`](https://github.com/plouc/mozaik/tree/v2.x/packages/themes)
package, you can change the default theme used by
updating this line in `src/index.js`:
updating this line in `src/register_themes.js`:

``` javascript
// src/index.js
ThemeManager.defaultTheme = wine.name
// src/register_themes.js
//
ThemeManager.defaultTheme = wineTheme.name
```

### Adding environment variables
Expand All @@ -72,17 +74,16 @@ or prepend it to the command:
GITHUB_API_TOKEN="xxxxx" node server.js config-github.yml
```

or create an `.env` file if you want a more permanent solution:
or create an `.env` file if you want a more permanent solution
(you have a sample file available `.env.sample`):

``` sh
# .env
GITHUB_API_TOKEN=xxxxx
node server.js config-github.yml
```

Note that `.env` file is in `.gitignore` to prevent pushing
sensible data to GitHub.


[travis-image]: https://img.shields.io/travis/plouc/mozaik-demo.svg?style=flat-square
[travis-url]: https://travis-ci.org/plouc/mozaik-demo
109 changes: 109 additions & 0 deletions conf/config-ga.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
host: 0.0.0.0
port: 5000

# define duration between each dashboard rotation (ms)
rotationDuration: 10000

# define the interval used by Mozaïk Bus to call registered APIs
apisPollInterval: 100000

extension: &extension analytics
startDate: &startDate 300daysAgo
endDate: &endDate 288daysAgo
id: &id 96121643

dashboards:
- title: Google Analytics Demo
columns: 3
rows: 3
widgets:
-
extension: *extension
widget: Browser
id: *id
startDate: *startDate
endDate: *endDate
columns: 1
rows: 1
x: 0
y: 0
-
extension: *extension
widget: PageViews
id: *id
startDate: *startDate
endDate: *endDate
columns: 1
rows: 1
x: 1
y: 0
-
extension: *extension
widget: PageViewsLine
id: *id
startDate: *startDate
endDate: *endDate
columns: 1
rows: 1
x: 2
y: 0
-
extension: *extension
widget: TopPages
id: *id
startDate: *startDate
endDate: *endDate
columns: 1
rows: 1
x: 0
y: 1
-
extension: *extension
widget: TopPagesAvgTimeBar
id: *id
startDate: *startDate
endDate: *endDate
columns: 1
rows: 1
x: 1
y: 1
-
extension: *extension
widget: TopPagesViewsBar
id: *id
startDate: *startDate
endDate: *endDate
columns: 1
rows: 1
x: 2
y: 1
-
extension: *extension
widget: TopPagesViewsBubble
id: *id
startDate: *startDate
endDate: *endDate
columns: 1
rows: 1
x: 0
y: 2
-
extension: *extension
widget: TopPagesViewsLine
id: *id
startDate: *startDate
endDate: *endDate
columns: 1
rows: 1
x: 1
y: 2
-
extension: *extension
widget: TopPagesViewsTreeMap
id: *id
startDate: *startDate
endDate: *endDate
columns: 1
rows: 1
x: 2
y: 2
65 changes: 65 additions & 0 deletions conf/config-github-stats.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
port: 5000

# define duration between each dashboard rotation (seconds)
rotationDuration: 10
# define the interval used by Mozaïk Bus to call registered APIs
apisPollInterval: 100000

extension: &extension github
github_user: &github_user plouc
github_org: &github_org ekino
github_repo: &github_repo plouc/mozaik

dashboards:
- title: "GitHub Demo: traffic"
columns: 2
rows: 3
widgets:
-
extension: *extension
widget: RepoTrafficViewsHistogram
repository: *github_repo
rows: 1
columns: 1
x: 0
y: 0
-
extension: *extension
widget: RepoTrafficViewsLine
repository: *github_repo
rows: 1
columns: 1
x: 1
y: 0
-
extension: *extension
widget: RepoTrafficClonesHistogram
repository: *github_repo
rows: 1
columns: 1
x: 0
y: 1
-
extension: *extension
widget: RepoTrafficClonesLine
repository: *github_repo
rows: 1
columns: 1
x: 1
y: 1
-
extension: *extension
widget: RepoCommitActivityHistogram
repository: *github_repo
rows: 1
columns: 1
x: 0
y: 2
-
extension: *extension
widget: RepoCommitActivityLine
repository: *github_repo
rows: 1
columns: 1
x: 1
y: 2
14 changes: 2 additions & 12 deletions config-github.yml → conf/config-github.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
#
# mozaik-ext-github demo dashboard
#
# It's not required, but you should add this env var,
# without it, you'll probably reach the API rate limit.
#
# GITHUB_API_TOKEN=xxxxx
#
port: 5000

# define duration between each dashboard rotation (seconds)
Expand All @@ -14,14 +6,12 @@ rotationDuration: 10
apisPollInterval: 100000

extension: &extension github

# change those values of you want to use another user, organization or repo
github_user: &github_user plouc
github_org: &github_org ekino
github_repo: &github_repo plouc/mozaik

dashboards:
- title: GitHub Demo 1
- title: GitHub Dashboard Demo 1 (mozaik-ext-github)
columns: 3
rows: 3
widgets:
Expand Down Expand Up @@ -80,7 +70,7 @@ dashboards:
x: 2
y: 2

- title: GitHub Demo 2
- title: GitHub Dashboard Demo 2 (mozaik-ext-github)
columns: 3
rows: 3
widgets:
Expand Down
Loading

0 comments on commit 363b4ae

Please sign in to comment.