Skip to content
Open
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
3 changes: 1 addition & 2 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"presets": [
"es2015",
"react"
"@mozaik/babel-preset"
]
}
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
root = true

[src/**.js]
indent_style = space
indent_size = 4
59 changes: 0 additions & 59 deletions .eslintrc

This file was deleted.

13 changes: 13 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
parser: babel-eslint
parserOptions:
ecmaVersion: 6
sourceType: module
ecmaFeatures:
jsx: true
env:
browser: true
node: true
es6: true
extends:
- eslint:recommended
- plugin:react/recommended
102 changes: 56 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,22 @@ Extension for [Mozaïk](http://mozaik.rocks/) that allows to place *multiple wid
npm install --save mozaik-ext-switch
```

- Rebuild dasbboard: `npm run build-assets`
- Configure widgets in dashboard ``config.js`` (see usage)
- Register extension in dashboard `src/register_extensions.js`
```javascript
// Import extension
import switcher from 'mozaik-ext-switch'

Registry.addExtensions({
github,
gitlab,
time,
travis,
// Add into extension with name 'switch'
switch: switcher,
})
```
- Rebuild dasbboard: `yarn build`
- Configure widgets in dashboard ``config.yml`` (see usage)
- Done.

## Widget: Widgets
Expand All @@ -22,59 +36,55 @@ Switch between widgets

### parameters

key | required | description
--------------|----------|---------------
`duration` | no | *Duration how long to show each widget. Defaults to 8000*
key | required | description
--------------------|----------|---------------
`duration` | no | *Duration how long to show each widget in milliseconds. Defaults to 5000*
`transitionDuration`| no | *Duration how long it takes to tranform between widgets in milliseconds. Keep shorter than duration. Defaults to 500*

### usage

Create `switch.widgets` widget and place widgets within `widgets` parameter:

```javascript
dashboards: [
// First dashboard view
{
columns: 1,
rows: 1,
widgets: [
// 1st row
{
type: 'switch.widgets',
columns: 1, rows: 1,
x: 0, y: 0,
// Duration how long to show each widget
duration: 8000,
// Structure within widgets is same normally
// with widgets. Naturally the size and placement
// comes from switch.widgets
widgets: [
{
type: 'time.clock',
timezone: 'America/Los_Angeles',
info: 'date',
title: 'Los Angeles'
},
{
type: 'weather.weather',
city: 'Helsinki',
country: 'FI',
lang: 'en',
},
{
type: 'time.clock',
info: 'time',
timezone: 'Asia/Tokyo',
title: 'Tokyo'
}
]
}
]
}
]
```yml
dashboards:
- columns: 1
rows: 1
title: Simple
widgets:
-
extension: switch
widget: Widgets
columns: 1
rows: 1
x: 0
y: 0
widgets:
-
extension: github
widget: OrgBadge
organization: ekino
columns: 1
rows: 1
-
extension: github
widget: OrgBadge
organization: juhamust
columns: 1
rows: 1
```

## Changelog

#### Release 2.0.0-dev

- Compatible with [Mozaik 2.x](http://mozaik.rocks/)
- Added support for setting transition duration

#### Release 1.0.0

- First stable release
- No changes since prev version

#### Release 0.4.0

- Added support for switch transition
Expand Down
1 change: 0 additions & 1 deletion components.js

This file was deleted.

104 changes: 62 additions & 42 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{
"name": "mozaik-ext-switch",
"version": "0.4.0",
"version": "2.0.0-dev.1",
"description": "Mozaïk extension for switching between widgets within same dashboard",
"author": "Juha Mustonen",
"license": "MIT",
"engineStrict": true,
"engines": {
"node": "4.0.x"
"node": ">=6.0.0",
"npm": ">=3.0.0"
},
"repository": {
"type": "git",
Expand All @@ -15,52 +17,70 @@
"url": "https://github.com/juhamust/mozaik-ext-switch/issues"
},
"dependencies": {
"babel-core": "6.7.6",
"babel-preset-es2015": "6.6.0",
"babel-preset-react": "6.5.0",
"babelify": "7.2.0",
"bluebird": "3.3.5",
"chalk": "^1.1.3",
"classnames": "^2.2.5",
"convict": "^0.6.1",
"json5": "^0.5.0",
"lodash": "^4.10.0",
"moment": "^2.9.0",
"reflux": "0.4.1"
"chalk": "1.1.3",
"convict": "^2.0.0",
"moment": "^2.17.1",
"moment-duration-format": "1.3.0",
"prop-types": "^15.5.10",
"react-icons": "^2.2.5",
"request": "^2.79.0",
"request-promise-native": "^1.0.3"
},
"main": "./components.js",
"main": "./lib/components/index.js",
"module": "es/components/index.js",
"jsnext:main": "es/components/index.js",
"devDependencies": {
"ava": "^0.16.0",
"babel-eslint": "6.0.2",
"babel-register": "6.7.2",
"eslint": "^3.5.0",
"eslint-plugin-react": "^6.3.0",
"proxyquire": "^1.7.10",
"react": "^0.13.3",
"react-mixin": "3.0.4"
"@mozaik/babel-preset": "^1.0.0-alpha.6",
"@mozaik/ui": "^2.0.0-alpha.11",
"ava": "^0.17.0",
"babel-cli": "^6.24.1",
"babel-eslint": "^7.2.3",
"babel-jest": "^20.0.3",
"coveralls": "^2.11.15",
"cross-env": "^5.0.1",
"enzyme": "^2.9.1",
"eslint": "^4.2.0",
"eslint-plugin-react": "^7.1.0",
"husky": "^0.14.3",
"jest": "^20.0.4",
"lint-staged": "^4.0.2",
"nivo": "^1.0.0-alpha.8",
"nock": "^9.0.2",
"nyc": "^10.0.0",
"prettier": "^1.5.3",
"react": "^15.6.1",
"react-dom": "^15.6.1",
"react-test-renderer": "^15.6.1",
"styled-components": "^2.2.4",
"watch": "^1.0.2"
},
"peerDependencies": {
"mozaik": ">=1.4.2",
"react": "^0.13.3"
},
"browserify": {
"transform": [
"babelify"
]
"@mozaik/ui": "^2.0.0-alpha.11",
"nivo": "^1.0.0-alpha.8",
"react": "^15.6.1"
},
"scripts": {
"test": "ava",
"lint": "eslint --ext .js --ext .jsx ./src/** ./test/**"
"lint": "eslint ./src/** ./test/**",
"lint:fix": "eslint --fix ./src/** ./test/**",
"test": "jest --verbose",
"test:cover": "jest --verbose --coverage",
"coverage": "cat ./coverage/lcov.info | coveralls",
"build:commonjs": "cross-env BABEL_ENV=commonjs babel src --out-dir lib",
"build:es": "cross-env BABEL_ENV=es babel src --out-dir es",
"build": "npm run build:commonjs && npm run build:es",
"fmt": "prettier --print-width=100 --tab-width=4 --bracket-spacing --no-semi --trailing-comma es5 --single-quote --color --write \"{src,test}/**/*.js\" 'client.js'",
"fmt:check": "prettier --print-width=100 --tab-width=4 --bracket-spacing --no-semi --trailing-comma es5 --single-quote --list-different \"{src,test}/**/*.js\" 'client.js'",
"prepublishOnly": "npm run lint && npm test && npm run build",
"version": "echo ${npm_package_version}",
"precommit": "lint-staged",
"watch": "watch 'npm run build' src"
},
"ava": {
"files": [
"tests/*.test.js"
],
"tap": false,
"failFast": true,
"require": [
"babel-register"
],
"babel": "inherit"
"lint-staged": {
"*.js": [
"lint:fix",
"fmt",
"git add",
"jest --bail --findRelatedTests"
]
}
}
Loading