-
Notifications
You must be signed in to change notification settings - Fork 450
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 #423 from emqx/dev/1.4.2
- Loading branch information
Showing
56 changed files
with
1,669 additions
and
436 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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,21 @@ | ||
/** | ||
* Simulated temperature and humidity reporting | ||
* @return Return a simulated temperature and humidity JSON data - { "temperature": 23, "humidity": 40 } | ||
* @param value, MQTT Payload - {} | ||
*/ | ||
|
||
function random(min, max) { | ||
return Math.round(Math.random() * (max - min)) + min | ||
} | ||
|
||
function handlePayload(value) { | ||
let _value = value | ||
if (typeof value === 'string') { | ||
_value = JSON.parse(value) | ||
} | ||
_value.temperature = random(10, 30) | ||
_value.humidity = random(20, 40) | ||
return JSON.stringify(_value, null, 2) | ||
} | ||
|
||
execute(handlePayload) |
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,18 @@ | ||
/** | ||
* Convert timestamp to normal time. | ||
* @return Return the UTC time - { "time": "2020-12-17 14:18:07" } | ||
* @param value, MQTT Payload - { "time": 1608185887 } | ||
*/ | ||
|
||
function handleTimestamp(value) { | ||
let _value = value | ||
if (typeof value === 'string') { | ||
_value = JSON.parse(value) | ||
} | ||
// East Eight District needs an additional 8 hours | ||
const date = new Date(_value.time * 1000 + 8 * 3600 * 1000) | ||
_value.time = date.toJSON().substr(0, 19).replace('T', ' ') | ||
return JSON.stringify(_value, null, 2) | ||
} | ||
|
||
execute(handleTimestamp) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,5 @@ | ||
const IN_PRODUCTION = process.env.NODE_ENV === 'production' | ||
|
||
module.exports = { | ||
plugins: [ | ||
IN_PRODUCTION && require('@fullhuman/postcss-purgecss')({ | ||
content: [`./public/**/*.html`, `./src/**/*.vue`, `./src/**/*.scss`], | ||
defaultExtractor (content) { | ||
const contentWithoutStyleBlocks = content.replace(/<style[^]+?<\/style>/gi, '') | ||
return contentWithoutStyleBlocks.match(/[A-Za-z0-9-_/:]*[A-Za-z0-9-_/]+/g) || [] | ||
}, | ||
whitelist: [], | ||
whitelistPatterns: [ /-(leave|enter|appear)(|-(to|from|active))$/, /^(?!(|.*?:)cursor-move).+-move$/, /^router-link(|-exact)-active$/, /data-v-.*/ ], | ||
}) | ||
], | ||
plugins: { | ||
autoprefixer: {}, | ||
}, | ||
} |
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,22 @@ | ||
import db from '@/database/index' | ||
import { ScriptModel } from '@/views/script/types' | ||
|
||
export const createScript = (data: ScriptModel): ScriptModel => { | ||
return db.insert<ScriptModel>('scripts', data) | ||
} | ||
|
||
export const loadScripts = (): ScriptModel[] | [] => { | ||
return db.get<ScriptModel[] | []>('scripts') | ||
} | ||
|
||
export const deleteScript = (id: string): ScriptModel => { | ||
return db.remove<ScriptModel>('scripts', id) | ||
} | ||
|
||
export const updateScript = (id: string, data: ScriptModel): ScriptModel => { | ||
return db.update<ScriptModel>('scripts', id, data) | ||
} | ||
|
||
export const loadScript = (id: string): ScriptModel => { | ||
return db.find<ScriptModel>('scripts', id) | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.