Compare commits
86 Commits
release/le
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
adeb9a8ac8 | ||
|
|
44e14891cb | ||
|
|
94c9ac0152 | ||
|
|
496f99d6ac | ||
|
|
e45e1d26ee | ||
|
|
9300f06156 | ||
|
|
a1dc4bfff4 | ||
|
|
228fff2121 | ||
|
|
eb0953e5bc | ||
|
|
35ee5ff829 | ||
|
|
c64e60ad48 | ||
|
|
5860d05e4b | ||
|
|
d24076ab5c | ||
|
|
8127734e55 | ||
|
|
fac6b63988 | ||
|
|
df7ec26063 | ||
|
|
eac3fe1a9e | ||
|
|
46e3c6c04a | ||
|
|
96880cd441 | ||
|
|
1148aa900e | ||
|
|
c88dd3d556 | ||
|
|
3b85dc80a0 | ||
|
|
d7c754cb3e | ||
|
|
4edb698dc0 | ||
|
|
e1152aa0d9 | ||
|
|
8b827b0848 | ||
|
|
4409709416 | ||
|
|
bcaa6b5245 | ||
|
|
1b3d4b54f0 | ||
|
|
be2f235a3b | ||
|
|
5378a0421c | ||
|
|
6c7aa95d5b | ||
|
|
af798708c4 | ||
|
|
17979fbb5c | ||
|
|
42ab574e5f | ||
|
|
8f7a4d3221 | ||
|
|
bb1648d108 | ||
|
|
a217b09cc5 | ||
|
|
3f86219f9e | ||
|
|
c67815b42a | ||
|
|
30cfa93a30 | ||
|
|
dd9d75e597 | ||
|
|
2e7ba1fd41 | ||
|
|
cf47987595 | ||
|
|
97550cff60 | ||
|
|
164d6f4325 | ||
|
|
f9153aaed9 | ||
|
|
020290a1b7 | ||
|
|
155eac826d | ||
|
|
abc2f151aa | ||
|
|
1f116d38a2 | ||
|
|
291e2bd05f | ||
|
|
7fa1ee419f | ||
|
|
e26d77cb5d | ||
|
|
f6facc8d21 | ||
|
|
e646bd242b | ||
|
|
047b248c01 | ||
|
|
39cacf167f | ||
|
|
d140c89e5a | ||
|
|
d5ed44c62c | ||
|
|
4249dfa8cb | ||
|
|
7198257f40 | ||
|
|
e74991445a | ||
|
|
58e89efbb0 | ||
|
|
2914f13f6e | ||
|
|
bd12b6519b | ||
|
|
ec4af50cff | ||
|
|
43f32a470a | ||
|
|
a2209e160f | ||
|
|
63ba3a9362 | ||
|
|
dd0af64115 | ||
|
|
aa2ef96469 | ||
|
|
e9b087bde2 | ||
|
|
25d5f4e4da | ||
|
|
f02e0c17e5 | ||
|
|
e406acef3a | ||
|
|
9669ccfdaf | ||
|
|
a99a14c541 | ||
|
|
b9c7d2b0f1 | ||
|
|
955d954b6f | ||
|
|
4baadc1157 | ||
|
|
e467da6b46 | ||
|
|
7f4c6af61d | ||
|
|
3e199979fd | ||
|
|
3e1384c900 | ||
|
|
3ecaf3de42 |
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"targets": {
|
||||
"chrome": "47"
|
||||
}
|
||||
}]
|
||||
]
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
version: 2
|
||||
|
||||
defaults: &defaults
|
||||
working_directory: ~/qlik-network-chart
|
||||
docker:
|
||||
- image: circleci/node:stretch
|
||||
environment:
|
||||
GITHUB_ORG: "qlik-oss"
|
||||
GITHUB_REPO: "network-vis-chart"
|
||||
PACKAGE_NAME: "qlik-network-chart"
|
||||
|
||||
jobs:
|
||||
test:
|
||||
docker:
|
||||
- image: circleci/node:stretch-browsers
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Install dependencies
|
||||
command: npm install
|
||||
- run:
|
||||
name: BlackDuck scan
|
||||
command: curl -s https://detect.synopsys.com/detect.sh | bash -s -- \
|
||||
--blackduck.url="https://qliktech.blackducksoftware.com" \
|
||||
--blackduck.trust.cert=true \
|
||||
--blackduck.username="svc-blackduck" \
|
||||
--blackduck.password=${svc_blackduck} \
|
||||
--detect.project.name="viz-bundle-qlik-network-chart"
|
||||
|
||||
bump-version:
|
||||
<<: *defaults
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Bump version
|
||||
command: scripts/bump-version.sh $GITHUB_ORG $GITHUB_REPO
|
||||
- persist_to_workspace:
|
||||
root: ~/qlik-network-chart
|
||||
paths:
|
||||
- BUMPED_VERSION
|
||||
|
||||
build:
|
||||
<<: *defaults
|
||||
steps:
|
||||
- checkout
|
||||
- attach_workspace:
|
||||
at: ~/qlik-network-chart
|
||||
- run:
|
||||
name: Install dependencies
|
||||
command: npm install
|
||||
- run:
|
||||
name: Build and package
|
||||
command: |
|
||||
export VERSION=$(scripts/get-bumped-version.sh)
|
||||
echo "Version: ${VERSION}"
|
||||
npm run build:zip
|
||||
sudo chmod +x scripts/verify-files.sh
|
||||
scripts/verify-files.sh
|
||||
environment:
|
||||
NODE_ENV: production
|
||||
- persist_to_workspace:
|
||||
root: ~/qlik-network-chart
|
||||
paths:
|
||||
- dist
|
||||
- store_artifacts:
|
||||
path: dist
|
||||
destination: dist
|
||||
deploy:
|
||||
<<: *defaults
|
||||
steps:
|
||||
- checkout
|
||||
- attach_workspace:
|
||||
at: ~/qlik-network-chart
|
||||
- run:
|
||||
name: Install ghr
|
||||
command: scripts/install-ghr.sh
|
||||
- run:
|
||||
name: Create GitHub Release
|
||||
command: |
|
||||
export VERSION=$(scripts/get-bumped-version.sh)
|
||||
echo "Version: ${VERSION}"
|
||||
scripts/create-release.sh $GITHUB_ORG $GITHUB_REPO $PACKAGE_NAME $VERSION
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
master_flow:
|
||||
jobs:
|
||||
- test
|
||||
- bump-version:
|
||||
requires:
|
||||
- test
|
||||
- build:
|
||||
requires:
|
||||
- bump-version
|
||||
- deploy:
|
||||
requires:
|
||||
- build
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
19
.codeclimate.yml
Normal file
19
.codeclimate.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
version: "2"
|
||||
checks:
|
||||
method-lines:
|
||||
config:
|
||||
threshold: 100
|
||||
method-complexity:
|
||||
config:
|
||||
threshold: 10
|
||||
similar-code:
|
||||
config:
|
||||
threshold: 65
|
||||
identical-code:
|
||||
config:
|
||||
threshold: 65
|
||||
exclude_patterns:
|
||||
- "src/**/*.test.ts"
|
||||
- "src/**/*.test.tsx"
|
||||
- "*config*"
|
||||
- "test/**/__fixtures__"
|
||||
55
.eslintrc.js
55
.eslintrc.js
@@ -3,15 +3,15 @@ module.exports = {
|
||||
ecmaVersion: 6,
|
||||
ecmaFeatures: {
|
||||
jsx: true,
|
||||
modules: true
|
||||
modules: true,
|
||||
},
|
||||
sourceType: "module"
|
||||
sourceType: "module",
|
||||
},
|
||||
parser: "babel-eslint",
|
||||
parser: "@babel/eslint-parser",
|
||||
env: {
|
||||
browser: true,
|
||||
es6: true,
|
||||
node: true
|
||||
node: true,
|
||||
},
|
||||
globals: {
|
||||
$: false,
|
||||
@@ -21,41 +21,48 @@ module.exports = {
|
||||
document: false,
|
||||
expect: false,
|
||||
it: false,
|
||||
require: false
|
||||
require: false,
|
||||
},
|
||||
rules: {
|
||||
"indent": ["error", 2, { "SwitchCase": 1 }],
|
||||
indent: ["error", 2, { SwitchCase: 1 }],
|
||||
"linebreak-style": ["error", "unix"],
|
||||
"object-curly-spacing": ["error", "always"],
|
||||
"max-lines": ["warn", 300],
|
||||
"max-len": ["warn", 120],
|
||||
"no-console": ["warn"],
|
||||
"no-mixed-operators": ["warn", {
|
||||
"groups": [
|
||||
["==", "!=", "===", "!==", ">", ">=", "<", "<="],
|
||||
["&&", "||"],
|
||||
["in", "instanceof"]
|
||||
],
|
||||
"allowSamePrecedence": true
|
||||
}],
|
||||
"no-mixed-operators": [
|
||||
"warn",
|
||||
{
|
||||
groups: [
|
||||
["==", "!=", "===", "!==", ">", ">=", "<", "<="],
|
||||
["&&", "||"],
|
||||
["in", "instanceof"],
|
||||
],
|
||||
allowSamePrecedence: true,
|
||||
},
|
||||
],
|
||||
"no-multi-spaces": ["error"],
|
||||
"no-cond-assign": ["warn"],
|
||||
"no-fallthrough": ["warn"],
|
||||
"no-undef": ["warn"],
|
||||
"no-unused-vars": ["warn"],
|
||||
"no-use-before-define": ["warn", { "functions": false, "classes": false, "variables": false }],
|
||||
"no-unused-vars": ["error"],
|
||||
"no-use-before-define": [
|
||||
"warn",
|
||||
{ functions: false, classes: false, variables: false },
|
||||
],
|
||||
"no-useless-escape": ["warn"],
|
||||
"no-useless-return": ["warn"],
|
||||
"no-underscore-dangle": ["warn", { "allow": ["_id"] }],
|
||||
"no-underscore-dangle": ["warn", { allow: ["_id"] }],
|
||||
"no-redeclare": ["warn"],
|
||||
"no-restricted-syntax": ["warn"],
|
||||
"operator-linebreak": ["warn", "before"],
|
||||
"prefer-promise-reject-errors": ["warn"],
|
||||
"padded-blocks": ["warn", { "blocks": "never", "switches": "never", "classes": "never" }],
|
||||
"semi": ["error", "always"],
|
||||
"valid-typeof": ["warn"]
|
||||
"padded-blocks": [
|
||||
"warn",
|
||||
{ blocks: "never", switches: "never", classes: "never" },
|
||||
],
|
||||
semi: ["error", "always"],
|
||||
"valid-typeof": ["warn"],
|
||||
},
|
||||
extends: [
|
||||
"eslint:recommended"
|
||||
]
|
||||
}
|
||||
extends: ["eslint:recommended"],
|
||||
};
|
||||
|
||||
11
.github/dependabot.yml
vendored
Normal file
11
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
# To get started with Dependabot version updates, you'll need to specify which
|
||||
# package ecosystems to update and where the package manifests are located.
|
||||
# Please see the documentation for all configuration options:
|
||||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "yarn" # See documentation for possible values
|
||||
directory: "/" # Location of package manifests
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
38
.github/workflows/api-gov.yml
vendored
Normal file
38
.github/workflows/api-gov.yml
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
name: "API Governance"
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
VERSION:
|
||||
type: string
|
||||
description: Version to run against
|
||||
default: ''
|
||||
SHA:
|
||||
type: string
|
||||
description: Sha of tag
|
||||
default: ''
|
||||
|
||||
jobs:
|
||||
api-gov:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Prepare API Compliance
|
||||
shell: bash
|
||||
run: |
|
||||
docker pull ghcr.io/qlik-download/api-compliance
|
||||
docker create -v /specs --name specs alpine:3.4 /bin/true
|
||||
docker cp api-specifications/properties.json specs:/specs/properties.json
|
||||
|
||||
- name: Run API Compliance
|
||||
shell: bash
|
||||
run: |
|
||||
docker run --volumes-from specs \
|
||||
-e SPEC_PATHS="${{ secrets.API_KEY }}@/specs/properties.json" \
|
||||
-e COMMIT_SHA="${{ inputs.SHA }}" \
|
||||
-e RELEASE_TAG="${{ inputs.VERSION }}" \
|
||||
-e CREDENTIALS_S3_SECRETKEY="${{ secrets.APICULTURIST_S3 }}" \
|
||||
-e CREDENTIALS_GITHUB="${{ secrets.APICULTURIST_GITHUB }}" \
|
||||
-e CREDENTIALS_COLONY="${{ secrets.APICULTURIST_TOKEN }}" \
|
||||
ghcr.io/qlik-download/api-compliance
|
||||
22
.github/workflows/build.yml
vendored
Normal file
22
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
name: Build
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
release:
|
||||
type: boolean
|
||||
required: true
|
||||
default: false
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
uses: qlik-oss/sn-gh-workflows/.github/workflows/build.yaml@v1
|
||||
secrets: inherit
|
||||
with:
|
||||
release: ${{ inputs.release || false}}
|
||||
api_specification_path: api-specifications/properties.json
|
||||
17
.github/workflows/semantic.yml
vendored
Normal file
17
.github/workflows/semantic.yml
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
name: "Semantic PR"
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types:
|
||||
- opened
|
||||
- edited
|
||||
- synchronize
|
||||
|
||||
jobs:
|
||||
main:
|
||||
name: Validate PR title
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: amannn/action-semantic-pull-request@v4
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1,3 +1,7 @@
|
||||
node_modules/
|
||||
dist/
|
||||
BUMPED_VERSION
|
||||
sn-network-chart-ext/
|
||||
core/esm
|
||||
coverage
|
||||
yarn-error.log
|
||||
|
||||
168
api-specifications/properties.json
Normal file
168
api-specifications/properties.json
Normal file
@@ -0,0 +1,168 @@
|
||||
{
|
||||
"scriptappy": "1.1.0",
|
||||
"info": {
|
||||
"name": "@nebula.js/sn-network-chart:properties",
|
||||
"description": "Network chart generic object definition",
|
||||
"version": "1.0.4",
|
||||
"license": "MIT",
|
||||
"stability": "stable",
|
||||
"x-qlik-visibility": "public"
|
||||
},
|
||||
"entries": {
|
||||
"properties": {
|
||||
"extends": [
|
||||
{
|
||||
"type": "GenericObjectProperties"
|
||||
}
|
||||
],
|
||||
"entries": {
|
||||
"version": {
|
||||
"description": "Current version of this generic object definition",
|
||||
"type": "string"
|
||||
},
|
||||
"qHyperCubeDef": {
|
||||
"description": "Extends `HyperCubeDef`, see Engine API: `HyperCubeDef`.",
|
||||
"extends": [
|
||||
{
|
||||
"type": "EngineAPI.HyperCubeDef"
|
||||
}
|
||||
],
|
||||
"kind": "object"
|
||||
},
|
||||
"showTitles": {
|
||||
"optional": true,
|
||||
"defaultValue": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"title": {
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"type": "string"
|
||||
},
|
||||
"subtitle": {
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"type": "string"
|
||||
},
|
||||
"footnote": {
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"type": "string"
|
||||
},
|
||||
"edgeType": {
|
||||
"optional": true,
|
||||
"defaultValue": "dynamic",
|
||||
"kind": "union",
|
||||
"items": [
|
||||
{
|
||||
"kind": "literal",
|
||||
"value": "'dynamic'"
|
||||
},
|
||||
{
|
||||
"kind": "literal",
|
||||
"value": "'continuous'"
|
||||
},
|
||||
{
|
||||
"kind": "literal",
|
||||
"value": "'discrete'"
|
||||
},
|
||||
{
|
||||
"kind": "literal",
|
||||
"value": "'diagonalCross'"
|
||||
},
|
||||
{
|
||||
"kind": "literal",
|
||||
"value": "'straightCross'"
|
||||
},
|
||||
{
|
||||
"kind": "literal",
|
||||
"value": "'horizontal'"
|
||||
},
|
||||
{
|
||||
"kind": "literal",
|
||||
"value": "'vertical'"
|
||||
},
|
||||
{
|
||||
"kind": "literal",
|
||||
"value": "'curvedCW'"
|
||||
},
|
||||
{
|
||||
"kind": "literal",
|
||||
"value": "'curvedCCW'"
|
||||
},
|
||||
{
|
||||
"kind": "literal",
|
||||
"value": "'cubicBezier'"
|
||||
}
|
||||
]
|
||||
},
|
||||
"displayEdgeLabel": {
|
||||
"optional": true,
|
||||
"defaultValue": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"posEdgeLabel": {
|
||||
"optional": true,
|
||||
"defaultValue": "top",
|
||||
"kind": "union",
|
||||
"items": [
|
||||
{
|
||||
"kind": "literal",
|
||||
"value": "'top'"
|
||||
},
|
||||
{
|
||||
"kind": "literal",
|
||||
"value": "'middle'"
|
||||
},
|
||||
{
|
||||
"kind": "literal",
|
||||
"value": "'bottom'"
|
||||
},
|
||||
{
|
||||
"kind": "literal",
|
||||
"value": "'horizontal'"
|
||||
}
|
||||
]
|
||||
},
|
||||
"nodeShape": {
|
||||
"optional": true,
|
||||
"defaultValue": "dot",
|
||||
"kind": "union",
|
||||
"items": [
|
||||
{
|
||||
"kind": "literal",
|
||||
"value": "'dot'"
|
||||
},
|
||||
{
|
||||
"kind": "literal",
|
||||
"value": "'square'"
|
||||
},
|
||||
{
|
||||
"kind": "literal",
|
||||
"value": "'star'"
|
||||
},
|
||||
{
|
||||
"kind": "literal",
|
||||
"value": "'triangle'"
|
||||
},
|
||||
{
|
||||
"kind": "literal",
|
||||
"value": "'triangleDown'"
|
||||
},
|
||||
{
|
||||
"kind": "literal",
|
||||
"value": "'diamond'"
|
||||
}
|
||||
]
|
||||
},
|
||||
"shadowMode": {
|
||||
"optional": true,
|
||||
"defaultValue": false,
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"kind": "object"
|
||||
}
|
||||
},
|
||||
"definitions": {}
|
||||
}
|
||||
3
babel.config.js
Normal file
3
babel.config.js
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
presets: ['@babel/preset-env'],
|
||||
};
|
||||
8
core/package.json
Normal file
8
core/package.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"module": "esm/index.js",
|
||||
"peerDependencies": {
|
||||
"@nebula.js/stardust": ">=1.1.1",
|
||||
"vis-network": "9.1.0",
|
||||
"vis-data": "^7.0.0"
|
||||
}
|
||||
}
|
||||
87
gulpfile.js
87
gulpfile.js
@@ -1,87 +0,0 @@
|
||||
var gulp = require('gulp');
|
||||
var gutil = require('gulp-util');
|
||||
var zip = require('gulp-zip');
|
||||
var del = require('del');
|
||||
var webpackConfig = require('./webpack.config');
|
||||
var webpack = require('webpack');
|
||||
var pkg = require('./package.json');
|
||||
|
||||
var DIST = './dist';
|
||||
var VERSION = process.env.VERSION || 'local-dev';
|
||||
|
||||
gulp.task('qext', function () {
|
||||
var qext = {
|
||||
name: 'Network chart',
|
||||
type: 'visualization',
|
||||
description: pkg.description + '\nVersion: ' + VERSION,
|
||||
version: VERSION,
|
||||
icon: 'bubbles',
|
||||
preview: 'network.png',
|
||||
keywords: 'qlik-sense, visualization',
|
||||
author: pkg.author,
|
||||
homepage: pkg.homepage,
|
||||
license: pkg.license,
|
||||
repository: pkg.repository,
|
||||
dependencies: {
|
||||
'qlik-sense': '>=5.5.x'
|
||||
}
|
||||
};
|
||||
if (pkg.contributors) {
|
||||
qext.contributors = pkg.contributors;
|
||||
}
|
||||
var src = require('stream').Readable({
|
||||
objectMode: true
|
||||
});
|
||||
src._read = function () {
|
||||
this.push(new gutil.File({
|
||||
cwd: '',
|
||||
base: '',
|
||||
path: pkg.name + '.qext',
|
||||
contents: Buffer.from(JSON.stringify(qext, null, 4))
|
||||
}));
|
||||
this.push(null);
|
||||
};
|
||||
return src.pipe(gulp.dest(DIST));
|
||||
});
|
||||
|
||||
gulp.task('clean', function(){
|
||||
return del([DIST], { force: true });
|
||||
});
|
||||
|
||||
gulp.task('zip-build', function(){
|
||||
return gulp.src(DIST + '/**/*')
|
||||
.pipe(zip(`${pkg.name}_${VERSION}.zip`))
|
||||
.pipe(gulp.dest(DIST));
|
||||
});
|
||||
|
||||
gulp.task('add-assets', function(){
|
||||
return gulp.src('./assets/**/*').pipe(gulp.dest(DIST));
|
||||
});
|
||||
|
||||
gulp.task('webpack-build', done => {
|
||||
webpack(webpackConfig, (error, statistics) => {
|
||||
const compilationErrors = statistics && statistics.compilation.errors;
|
||||
const hasCompilationErrors = !statistics || (compilationErrors && compilationErrors.length > 0);
|
||||
|
||||
console.log(statistics && statistics.toString({ chunks: false, colors: true })); // eslint-disable-line no-console
|
||||
|
||||
if (error || hasCompilationErrors) {
|
||||
console.log('Build has errors or eslint errors, fail it'); // eslint-disable-line no-console
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
gulp.task('build',
|
||||
gulp.series('clean', 'webpack-build', 'qext', 'add-assets')
|
||||
);
|
||||
|
||||
gulp.task('zip',
|
||||
gulp.series('build', 'zip-build')
|
||||
);
|
||||
|
||||
gulp.task('default',
|
||||
gulp.series('build')
|
||||
);
|
||||
196
jest.config.js
Normal file
196
jest.config.js
Normal file
@@ -0,0 +1,196 @@
|
||||
/*
|
||||
* For a detailed explanation regarding each configuration property and type check, visit:
|
||||
* https://jestjs.io/docs/configuration
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
// All imported modules in your tests should be mocked automatically
|
||||
// automock: false,
|
||||
|
||||
// Stop running tests after `n` failures
|
||||
// bail: 0,
|
||||
|
||||
// The directory where Jest should store its cached dependency information
|
||||
// cacheDirectory: "/private/var/folders/dc/j98t7yvj11n21psdq_xy0y8snk5538/T/jest_tq54ko",
|
||||
|
||||
// Automatically clear mock calls, instances and results before every test
|
||||
// clearMocks: false,
|
||||
|
||||
// Indicates whether the coverage information should be collected while executing the test
|
||||
collectCoverage: true,
|
||||
|
||||
// An array of glob patterns indicating a set of files for which coverage information should be collected
|
||||
// collectCoverageFrom: undefined,
|
||||
|
||||
// The directory where Jest should output its coverage files
|
||||
coverageDirectory: "coverage",
|
||||
|
||||
// An array of regexp pattern strings used to skip coverage collection
|
||||
// coveragePathIgnorePatterns: [
|
||||
// "/node_modules/"
|
||||
// ],
|
||||
|
||||
// Indicates which provider should be used to instrument code for coverage
|
||||
// coverageProvider: "babel",
|
||||
|
||||
// A list of reporter names that Jest uses when writing coverage reports
|
||||
// coverageReporters: [
|
||||
// "json",
|
||||
// "text",
|
||||
// "lcov",
|
||||
// "clover"
|
||||
// ],
|
||||
|
||||
// An object that configures minimum threshold enforcement for coverage results
|
||||
// coverageThreshold: undefined,
|
||||
|
||||
// A path to a custom dependency extractor
|
||||
// dependencyExtractor: undefined,
|
||||
|
||||
// Make calling deprecated APIs throw helpful error messages
|
||||
// errorOnDeprecated: false,
|
||||
|
||||
// Force coverage collection from ignored files using an array of glob patterns
|
||||
// forceCoverageMatch: [],
|
||||
|
||||
// A path to a module which exports an async function that is triggered once before all test suites
|
||||
// globalSetup: undefined,
|
||||
|
||||
// A path to a module which exports an async function that is triggered once after all test suites
|
||||
// globalTeardown: undefined,
|
||||
|
||||
// A set of global variables that need to be available in all test environments
|
||||
// globals: {},
|
||||
|
||||
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
|
||||
// maxWorkers: "50%",
|
||||
|
||||
// An array of directory names to be searched recursively up from the requiring module's location
|
||||
// moduleDirectories: [
|
||||
// "node_modules"
|
||||
// ],
|
||||
|
||||
// An array of file extensions your modules use
|
||||
// moduleFileExtensions: [
|
||||
// "js",
|
||||
// "jsx",
|
||||
// "ts",
|
||||
// "tsx",
|
||||
// "json",
|
||||
// "node"
|
||||
// ],
|
||||
|
||||
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
|
||||
// moduleNameMapper: {},
|
||||
|
||||
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
|
||||
// modulePathIgnorePatterns: [],
|
||||
|
||||
// Activates notifications for test results
|
||||
// notify: false,
|
||||
|
||||
// An enum that specifies notification mode. Requires { notify: true }
|
||||
// notifyMode: "failure-change",
|
||||
|
||||
// A preset that is used as a base for Jest's configuration
|
||||
// preset: undefined,
|
||||
|
||||
// Run tests from one or more projects
|
||||
// projects: undefined,
|
||||
|
||||
// Use this configuration option to add custom reporters to Jest
|
||||
// reporters: undefined,
|
||||
|
||||
// Automatically reset mock state before every test
|
||||
// resetMocks: false,
|
||||
|
||||
// Reset the module registry before running each individual test
|
||||
// resetModules: false,
|
||||
|
||||
// A path to a custom resolver
|
||||
// resolver: undefined,
|
||||
|
||||
// Automatically restore mock state and implementation before every test
|
||||
// restoreMocks: false,
|
||||
|
||||
// The root directory that Jest should scan for tests and modules within
|
||||
// rootDir: undefined,
|
||||
|
||||
// A list of paths to directories that Jest should use to search for files in
|
||||
// roots: [
|
||||
// "<rootDir>"
|
||||
// ],
|
||||
|
||||
// Allows you to use a custom runner instead of Jest's default test runner
|
||||
// runner: "jest-runner",
|
||||
|
||||
// The paths to modules that run some code to configure or set up the testing environment before each test
|
||||
// setupFiles: [],
|
||||
|
||||
// A list of paths to modules that run some code to configure or set up the testing framework before each test
|
||||
setupFilesAfterEnv: ["<rootDir>/jest/setup.js"],
|
||||
|
||||
// The number of seconds after which a test is considered as slow and reported as such in the results.
|
||||
// slowTestThreshold: 5,
|
||||
|
||||
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
|
||||
// snapshotSerializers: [],
|
||||
|
||||
// The test environment that will be used for testing
|
||||
testEnvironment: "jsdom",
|
||||
|
||||
// Options that will be passed to the testEnvironment
|
||||
// testEnvironmentOptions: {},
|
||||
|
||||
// Adds a location field to test results
|
||||
// testLocationInResults: false,
|
||||
|
||||
// The glob patterns Jest uses to detect test files
|
||||
//"**/src/**/__tests__/*.test.ts?(x)",
|
||||
testMatch: ["<rootDir>/src/_test/*.jest.test.js?(x)"],
|
||||
|
||||
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
|
||||
// testPathIgnorePatterns: [
|
||||
// "/node_modules/"
|
||||
// ],
|
||||
|
||||
// The regexp pattern or array of patterns that Jest uses to detect test files
|
||||
// testRegex: [],
|
||||
|
||||
// This option allows the use of a custom results processor
|
||||
// testResultsProcessor: undefined,
|
||||
|
||||
// This option allows use of a custom test runner
|
||||
// testRunner: "jest-circus/runner",
|
||||
|
||||
// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
|
||||
// testURL: "http://localhost",
|
||||
|
||||
// Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
|
||||
// timers: "real",
|
||||
|
||||
// A map from regular expressions to paths to transformers
|
||||
// transform: undefined,
|
||||
|
||||
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
|
||||
// transformIgnorePatterns: [
|
||||
// "/node_modules/",
|
||||
// "\\.pnp\\.[^\\/]+$"
|
||||
// ],
|
||||
|
||||
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
|
||||
// unmockedModulePathPatterns: undefined,
|
||||
|
||||
// Indicates whether each individual test should be reported during the run
|
||||
// verbose: undefined,
|
||||
|
||||
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
|
||||
// watchPathIgnorePatterns: [],
|
||||
|
||||
// Whether to use watchman for file crawling
|
||||
// watchman: true,
|
||||
|
||||
moduleNameMapper: {
|
||||
"\\.(css|less)$": "<rootDir>/src/tests/jest/mocks/css-mock.js"
|
||||
}
|
||||
};
|
||||
1
jest/setup.js
Normal file
1
jest/setup.js
Normal file
@@ -0,0 +1 @@
|
||||
import '@testing-library/jest-dom';
|
||||
21
nebula.config.js
Normal file
21
nebula.config.js
Normal file
@@ -0,0 +1,21 @@
|
||||
const path = require('path');
|
||||
const crypto = require('crypto');
|
||||
|
||||
const { name, version } = require(path.resolve(__dirname, './package.json')); // eslint-disable-line
|
||||
|
||||
const versionHash = crypto
|
||||
.createHash('md5')
|
||||
.update(`${name}@${version}`)
|
||||
.digest('hex')
|
||||
.slice(0, 4);
|
||||
|
||||
const replacementStrings = {
|
||||
'process.env.VERSION_HASH': JSON.stringify(versionHash),
|
||||
'process.env.PACKAGE_VERSION': JSON.stringify(version),
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
build: {
|
||||
replacementStrings,
|
||||
},
|
||||
};
|
||||
11695
package-lock.json
generated
11695
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
64
package.json
64
package.json
@@ -1,38 +1,48 @@
|
||||
{
|
||||
"name": "qlik-network-chart",
|
||||
"version": "0.0.1",
|
||||
"name": "@nebula.js/sn-network-chart",
|
||||
"version": "1.0.4",
|
||||
"description": "Displays hierarchical or relational dimensions as nodes and edges´, with measures to show the significance of its links.",
|
||||
"homepage": "",
|
||||
"repository": "https://github.com/qlik-oss/network-vis-chart",
|
||||
"author": "Michael Laenen (miclae76) <m.laenen@contactoffice.net>",
|
||||
"author": "QLIK",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"build": "gulp build",
|
||||
"build:zip": "gulp zip",
|
||||
"eslint": "eslint src"
|
||||
"start": "nebula serve --build false --type qlik-network-chart",
|
||||
"watch": "nebula serve --type sn-network-chart",
|
||||
"watch:legacy": "nebula serve --type qlik-network-chart",
|
||||
"build": "nebula build --core core",
|
||||
"sense": "nebula sense --meta resources/meta.json && shx cp resources/network_chart_v1.png sn-network-chart-ext",
|
||||
"eslint": "eslint src",
|
||||
"spec": "sy from-jsdoc -c ./spec-configs/props.conf.js",
|
||||
"test:unit": "jest"
|
||||
},
|
||||
"files": [
|
||||
"api-specifications",
|
||||
"dist",
|
||||
"core",
|
||||
"sn-network-chart-ext"
|
||||
],
|
||||
"main": "dist/sn-network-chart.js",
|
||||
"systemjs": "dist/sn-network-chart.systemjs.js",
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.1.5",
|
||||
"@babel/polyfill": "7.0.0",
|
||||
"@babel/preset-env": "7.1.5",
|
||||
"babel-eslint": "10.0.1",
|
||||
"babel-loader": "8.0.4",
|
||||
"css-loader": "1.0.1",
|
||||
"del": "3.0.0",
|
||||
"eslint": "5.8.0",
|
||||
"eslint-loader": "2.1.1",
|
||||
"file-loader": "2.0.0",
|
||||
"gulp": "4.0.0",
|
||||
"gulp-util": "^3.0.7",
|
||||
"gulp-zip": "4.2.0",
|
||||
"less": "3.8.1",
|
||||
"less-loader": "4.1.0",
|
||||
"style-loader": "0.23.1",
|
||||
"stylelint": "9.7.1",
|
||||
"stylelint-webpack-plugin": "0.10.5",
|
||||
"webpack": "4.25.1"
|
||||
"@nebula.js/cli": "4.0.3",
|
||||
"@nebula.js/cli-build": "4.0.3",
|
||||
"@nebula.js/cli-sense": "4.0.3",
|
||||
"@nebula.js/cli-serve": "4.0.3",
|
||||
"@nebula.js/stardust": "4.0.3",
|
||||
"@testing-library/jest-dom": "5.16.5",
|
||||
"@babel/eslint-parser": "7.21.8",
|
||||
"eslint": "8.40.0",
|
||||
"jest": "29.5.0",
|
||||
"jest-environment-jsdom": "29.5.0",
|
||||
"jest-junit": "^16.0.0",
|
||||
"@scriptappy/cli": "0.8.0",
|
||||
"@scriptappy/from-jsdoc": "0.17.0",
|
||||
"shx": "0.3.4",
|
||||
"vis-data": "7.1.6",
|
||||
"vis-network": "9.1.6"
|
||||
},
|
||||
"dependencies": {
|
||||
"vis": "4.21.0"
|
||||
"peerDependencies": {
|
||||
"@nebula.js/stardust": ">=1.7.0"
|
||||
}
|
||||
}
|
||||
|
||||
85
readme.md
85
readme.md
@@ -1,20 +1,81 @@
|
||||
# Qlik Network Chart
|
||||
This extension is part of the extension bundles for Qlik Sense. The repository is maintained and moderated by Qlik RD.
|
||||
> **Warning** This repository is now archived and will not be updated
|
||||
|
||||
Feel free to fork and suggest pull requests for improvements and bug fixes. Changes will be moderated and reviewed before inclusion in future bundle versions. Please note that emphasis is on backward compatibility, i.e. breaking changes will most likely not be approved.
|
||||
> This repository was originally published to foster collaboration and engagement with developers as they customized or developed visualizations, but due to customer feedback and usage data, it is now moved back to closed source. Moving this and other projects back to closed source will support better integration with internal build and test tooling, and free up resources for investment in these and other visualizations.
|
||||
|
||||
Usage documentation for the extension is available at https://help.qlik.com.
|
||||
|
||||
# Developing the extension
|
||||
If you want to do code changes to the extension follow these simple steps to get going.
|
||||
# sn-network-chart
|
||||
|
||||
1. Get Qlik Sense Desktop
|
||||
1. Create a new app and add Network chart to a sheet.
|
||||
2. Clone the repository
|
||||
3. Run `npm install`
|
||||
4. Run `npm run build` - to build a dev-version to the /dist folder.
|
||||
5. Move the content of the /dist folder to the extension directory. Usually in `C:/Users/<user>/Documents/Qlik/Sense/Extensions/qlik-network-chart`.
|
||||
A network chart to be used with nebula.js, built using [visjs network visualization](https://github.com/visjs/vis-network) to display networks of nodes and edges.
|
||||
|
||||
## Requirements
|
||||
|
||||
Requires `@nebula.js/stardust` version `1.7.0` or later.
|
||||
|
||||
## Installing
|
||||
|
||||
If you use npm: `npm install @nebula.js/sn-network-chart`.
|
||||
|
||||
You can also load through the script tag directly from [https://unpkg.com](https://unpkg.com/@nebula.js/sn-network-chart).
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import { embed } from '@nebula.js/stardust';
|
||||
import network from '@nebula.js/sn-network-chart';
|
||||
|
||||
// 'app' is an enigma app model
|
||||
const nuked = embed(app, {
|
||||
types: [
|
||||
{
|
||||
// register grid chart - qlik-network-chart is the default name in sense
|
||||
name: 'qlik-network-chart',
|
||||
load: () => Promise.resolve(network),
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
// Rendering a simple network chart
|
||||
nuked.render({
|
||||
element: document.querySelector('.network'),
|
||||
type: 'qlik-network-chart',
|
||||
fields: ['Source', 'Target', '=Sum(Flow)'],
|
||||
properties: {
|
||||
title: 'Visualization of network flows',
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
## Data sample
|
||||
|
||||
Check `resources/Network data.xlsx` for an example. The simplest data form is where each row represents an edge in the network. Take this example of airport connections:
|
||||
|
||||
| AirportID | AirportName | LinkToId | Volume |
|
||||
|-----------|----------------|----------|--------|
|
||||
| 0 | Soekarno-Hatta | 3 | 23000 |
|
||||
| 1 | Halim | 0 | 5460 |
|
||||
| 2 | Changi | 0 | 10870 |
|
||||
| 3 | KLCC | 1 | 2780 |
|
||||
| 4 | Don Muang | 1 | 4800 |
|
||||
| 4 | Don Muang | 2 | 7800 |
|
||||
|
||||
Sense inline load script example:
|
||||
|
||||
```
|
||||
Load * Inline [
|
||||
AirportID, AirportName, LinktoID,Volume
|
||||
0,Soekarno-Hatta,3,23000
|
||||
1,Halim,0,5460
|
||||
2,Changi,0,10870
|
||||
3,KLCC,1,2780
|
||||
4,Don Muang,1,4800
|
||||
4,Don Muang,2,7800
|
||||
];
|
||||
```
|
||||
|
||||
# Original Author
|
||||
**Michael Laenen**
|
||||
* [github.com/miclae76](https://github.com/miclae76)
|
||||
|
||||
# Contributors
|
||||
**Göran Sander**
|
||||
* [github.com/mountaindude](https://github.com/mountaindude)
|
||||
|
||||
4
readme_legacy.md
Normal file
4
readme_legacy.md
Normal file
@@ -0,0 +1,4 @@
|
||||
## Legacy build
|
||||
The chart before Nebula conversion and dependency updates can be found on the *release/legacy* branch.
|
||||
|
||||
Originally forked from [miclae76/network-vis-chart](miclae76/network-vis-chart) and has since been converted to use Nebula.
|
||||
4
resources/meta.json
Normal file
4
resources/meta.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "Network chart",
|
||||
"icon": "bubbles"
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -o errexit
|
||||
|
||||
join_by () {
|
||||
local IFS="$1"; shift; echo "$*";
|
||||
}
|
||||
|
||||
if [ "${CIRCLE_BRANCH}" == "master" ]; then
|
||||
# get version from repo
|
||||
OLD_VERSION="$(scripts/get-latest-version.sh $1 $2)"
|
||||
echo "Latest GitHub release version: ${OLD_VERSION}"
|
||||
|
||||
# split into array
|
||||
IFS='.' read -ra ARRAY_VERSION <<< "$OLD_VERSION"
|
||||
|
||||
# bump minor
|
||||
ARRAY_VERSION[1]=$((ARRAY_VERSION[1]+1))
|
||||
|
||||
# join into string
|
||||
NEW_VERSION=$(join_by . ${ARRAY_VERSION[@]})
|
||||
elif [[ ! -z "${CIRCLE_BRANCH}" && ! -z "${CIRCLE_BUILD_NUM}" ]]; then
|
||||
NEW_VERSION="$(echo ${CIRCLE_BRANCH} | sed -e 's/\//-/g')_${CIRCLE_BUILD_NUM}"
|
||||
else
|
||||
NEW_VERSION="dev"
|
||||
fi
|
||||
|
||||
echo "Bumped version: ${NEW_VERSION}"
|
||||
echo "${NEW_VERSION}" > BUMPED_VERSION
|
||||
|
||||
|
||||
# Usage
|
||||
# $ bump-version.sh qlik-oss qsSimpleKPI
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -o errexit
|
||||
|
||||
echo "Creating release for version: $VERSION"
|
||||
echo "Artifact name: ./dist/${3}_${VERSION}.zip"
|
||||
$HOME/bin/ghr -t ${ghoauth} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} ${VERSION} "./dist/${3}_${4}.zip"
|
||||
|
||||
|
||||
# Usage
|
||||
# $ create-release.sh qlik-oss qsSimpleKPI qlik-multi-kpi 0.3.1
|
||||
@@ -1,7 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -o errexit
|
||||
|
||||
echo "$(head -n 1 BUMPED_VERSION)"
|
||||
|
||||
# Usage
|
||||
# $ get-bumped-version.sh
|
||||
@@ -1,17 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -o errexit
|
||||
|
||||
VERSION=$(curl --silent "https://api.github.com/repos/$1/$2/releases/latest" | # Get latest release from GitHub api
|
||||
grep '"tag_name":' | # Get tag line
|
||||
sed -E 's/.*"([^"]+)".*/\1/') # Pluck JSON value
|
||||
|
||||
if [ -z "${VERSION}" ]; then
|
||||
VERSION="0.1.0"
|
||||
fi
|
||||
|
||||
echo "${VERSION}"
|
||||
|
||||
### Inspired by https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c
|
||||
# Usage
|
||||
# $ get-latest-version.sh qlik-oss qsSimpleKPI
|
||||
# 0.12.0
|
||||
@@ -1,12 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -o errexit -o verbose
|
||||
|
||||
URL="https://github.com/tcnksm/ghr/releases/download/v0.5.4/ghr_v0.5.4_linux_386.zip"
|
||||
echo "Version to install: $URL"
|
||||
|
||||
echo "Installing ghr"
|
||||
curl -L ${URL} > ghr.zip
|
||||
mkdir -p "$HOME/bin"
|
||||
export PATH="$HOME/bin:$PATH"
|
||||
unzip ghr.zip -d "$HOME/bin"
|
||||
rm ghr.zip
|
||||
@@ -1,25 +0,0 @@
|
||||
#!/bin/bash
|
||||
# The build script has a known race-condition that sometimes causes it to not include all files
|
||||
# in the built zip. This script verifies the that the zip contains the correct number of files.
|
||||
|
||||
set -o errexit
|
||||
|
||||
echo "Verifying built file count"
|
||||
|
||||
while read line; do
|
||||
if [[ $line =~ ^\"name\": ]]; then
|
||||
name=${line#*: \"}
|
||||
name=${name%\"*}
|
||||
fi
|
||||
done < package.json
|
||||
|
||||
expected_file_count=$(($(find dist -type f | wc -l)-1))
|
||||
zip_file_count=$(zipinfo dist/${name}_${VERSION}.zip | grep ^- | wc -l)
|
||||
|
||||
if [ "${expected_file_count}" -ne "${zip_file_count}" ]; then
|
||||
# File count is incorrect
|
||||
echo "Expected file count ${expected_file_count}, but was ${zip_file_count}"
|
||||
exit 1
|
||||
fi
|
||||
echo "File count OK"
|
||||
exit 0
|
||||
48
spec-configs/props.conf.js
Normal file
48
spec-configs/props.conf.js
Normal file
@@ -0,0 +1,48 @@
|
||||
const path = require("path");
|
||||
|
||||
const pkg = require(path.resolve(__dirname, "../package.json")); // eslint-disable-line
|
||||
|
||||
module.exports = {
|
||||
fromJsdoc: {
|
||||
glob: ["./src/extension/properties.js"],
|
||||
api: {
|
||||
stability: "stable",
|
||||
visibility: "public",
|
||||
properties: {
|
||||
"x-qlik-visibility": "public",
|
||||
},
|
||||
name: `${pkg.name}:properties`,
|
||||
version: pkg.version,
|
||||
description: "Network chart generic object definition",
|
||||
},
|
||||
output: {
|
||||
sort: {
|
||||
alpha: false,
|
||||
},
|
||||
file: "./api-specifications/properties.json",
|
||||
},
|
||||
parse: {
|
||||
types: {
|
||||
GenericObjectProperties: {
|
||||
url: "https://qlik.dev/apis/json-rpc/qix/schemas#%23%2Fdefinitions%2Fschemas%2Fentries%2FGenericObjectProperties",
|
||||
},
|
||||
undefined: {},
|
||||
"EngineAPI.ValueExpression": {
|
||||
url: "https://qlik.dev/apis/json-rpc/qix/schemas#%23%2Fdefinitions%2Fschemas%2Fentries%2FValueExpression",
|
||||
},
|
||||
"EngineAPI.HyperCubeDef": {
|
||||
url: "https://qlik.dev/apis/json-rpc/qix/schemas#%23%2Fdefinitions%2Fschemas%2Fentries%2FListObjectDef",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
toDts: {
|
||||
spec: "./api-specifications/properties.json",
|
||||
output: {
|
||||
file: "./types/index.d.ts",
|
||||
},
|
||||
dependencies: {
|
||||
references: ["qlik-engineapi"],
|
||||
},
|
||||
},
|
||||
};
|
||||
11
src/_test/tooltip.jest.test.js
Normal file
11
src/_test/tooltip.jest.test.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import { createTooltipHTML } from "../tooltip";
|
||||
|
||||
describe("createTooltipHTML", () => {
|
||||
it("Testing createTooltipHtml function - Name- GroupNumber- nodeMeasure", () => {
|
||||
expect(
|
||||
createTooltipHTML({ name: "Venice", groupNumber: 1, nodeMeasure: 2 })
|
||||
).toContainHTML(
|
||||
"<div><div><span>Name: </span><b>Venice</b></div><div><span>Group number: </span><b>1</b></div><div><span>Node measure: </span><b>2</b></div></div>"
|
||||
);
|
||||
});
|
||||
});
|
||||
34
src/extension/data.js
Normal file
34
src/extension/data.js
Normal file
@@ -0,0 +1,34 @@
|
||||
import { dimDesc, measureDesc } from './strings';
|
||||
|
||||
export default function data() {
|
||||
return {
|
||||
targets: [{
|
||||
path: '/qHyperCubeDef',
|
||||
dimensions: {
|
||||
min: 3,
|
||||
max: 4,
|
||||
description(properties, index) {
|
||||
return dimDesc[index];
|
||||
}
|
||||
/*
|
||||
1. Dimension: Node ID, numeric (Event ID or else) or String
|
||||
2. Dimension: Node Label
|
||||
3. Dimension: Node Parent ID, numeric (Event ID or else) or String
|
||||
4. Dimension: Node Cluster
|
||||
*/
|
||||
},
|
||||
measures: {
|
||||
min: 0,
|
||||
max: 3,
|
||||
description(properties, index) {
|
||||
return measureDesc[index];
|
||||
}
|
||||
/*
|
||||
1. Measure: title text for tooltip (optional)
|
||||
2. Measure: node value
|
||||
3. Measure: edge value
|
||||
*/
|
||||
}
|
||||
}]
|
||||
};
|
||||
}
|
||||
164
src/extension/ext.js
Normal file
164
src/extension/ext.js
Normal file
@@ -0,0 +1,164 @@
|
||||
import { dimLongDesc } from './strings';
|
||||
|
||||
export default function ext() {
|
||||
return {
|
||||
definition: {
|
||||
type: "items",
|
||||
component: "accordion",
|
||||
items: {
|
||||
data: {
|
||||
uses: "data",
|
||||
items:{
|
||||
dimensions:{
|
||||
disabledRef: "",
|
||||
items: {
|
||||
helpDesc: {
|
||||
component: 'text',
|
||||
style: 'qlik-network-chart-italic-property',
|
||||
label: function(properties, handler) {
|
||||
var index;
|
||||
handler.getDimensions().forEach((element, i) => {
|
||||
if(element.qDef.cId === properties.qDef.cId) {
|
||||
index = i;
|
||||
}
|
||||
});
|
||||
return dimLongDesc[index];
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
measures: {
|
||||
disabledRef: ""
|
||||
}
|
||||
}
|
||||
},
|
||||
sorting: {
|
||||
uses: "sorting"
|
||||
},
|
||||
addons: {
|
||||
uses: "addons",
|
||||
items: {
|
||||
dataHandling: {
|
||||
uses: "dataHandling"
|
||||
}
|
||||
}
|
||||
},
|
||||
settings: {
|
||||
type: "items",
|
||||
uses: 'settings',
|
||||
items: {
|
||||
presentation: {
|
||||
type: 'items',
|
||||
grouped: false,
|
||||
translation: 'properties.presentation',
|
||||
items: {
|
||||
edgeType: {
|
||||
ref: "edgeType",
|
||||
type: "string",
|
||||
component: "dropdown",
|
||||
label: "Edge Type",
|
||||
options: [
|
||||
{ value: 'dynamic' },
|
||||
{ value: 'continuous' },
|
||||
{ value: 'discrete' },
|
||||
{ value: 'diagonalCross' },
|
||||
{ value: 'straightCross' },
|
||||
{ value: 'horizontal' },
|
||||
{ value: 'vertical' },
|
||||
{ value: 'curvedCW' },
|
||||
{ value: 'curvedCCW' },
|
||||
{ value: 'cubicBezier' }
|
||||
],
|
||||
defaultValue: "dynamic"
|
||||
},
|
||||
displayEdgeLabel : {
|
||||
ref: "displayEdgeLabel",
|
||||
type: "boolean",
|
||||
component: "switch",
|
||||
label: "Display Edge Value",
|
||||
options: [{
|
||||
value: true,
|
||||
label: "On"
|
||||
}, {
|
||||
value: false,
|
||||
label: "Off"
|
||||
}],
|
||||
defaultValue: false
|
||||
},
|
||||
posEdgeLabel: {
|
||||
ref: "posEdgeLabel",
|
||||
type: "string",
|
||||
component: "dropdown",
|
||||
label: "Position Edge Label",
|
||||
options: [
|
||||
{ value: 'top' }, { value: 'middle' }, { value: 'bottom' }, { value: 'horizontal' }
|
||||
],
|
||||
defaultValue: "top"
|
||||
},
|
||||
nodeShape: {
|
||||
ref: "nodeShape",
|
||||
type: "string",
|
||||
component: "dropdown",
|
||||
label: "Node Shape",
|
||||
options: [
|
||||
{ value: 'dot' },
|
||||
{ value: 'square' },
|
||||
{ value: 'star' },
|
||||
{ value: 'triangle' },
|
||||
{ value: 'triangleDown' },
|
||||
{ value: 'diamond' }
|
||||
],
|
||||
defaultValue: "dot"
|
||||
},
|
||||
shadowMode: {
|
||||
ref: "shadowMode",
|
||||
type: "boolean",
|
||||
component: "switch",
|
||||
label: "Display Shadow",
|
||||
options: [{
|
||||
value: true,
|
||||
label: "On"
|
||||
}, {
|
||||
value: false,
|
||||
label: "Off"
|
||||
}],
|
||||
defaultValue: false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
about: {
|
||||
component: 'items',
|
||||
label: 'About',
|
||||
items: {
|
||||
header: {
|
||||
label: 'Network chart',
|
||||
style: 'header',
|
||||
component: 'text'
|
||||
},
|
||||
paragraph1: {
|
||||
label:
|
||||
`Network chart is Qlik Sense chart which
|
||||
allows you to draw a network of connected
|
||||
nodes and edges from a data set to a sheet.`,
|
||||
component: 'text'
|
||||
},
|
||||
paragraph2: {
|
||||
label: 'Network chart is based upon an extension created by Michael Laenen.',
|
||||
component: 'text'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
support: {
|
||||
export: true,
|
||||
snapshot: true,
|
||||
exportData: true
|
||||
},
|
||||
snapshot: {
|
||||
canTakeSnapshot: true
|
||||
},
|
||||
};
|
||||
}
|
||||
64
src/extension/properties.js
Normal file
64
src/extension/properties.js
Normal file
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* @type {object}
|
||||
* @extends {GenericObjectProperties}
|
||||
* @entry
|
||||
*/
|
||||
const properties = {
|
||||
/**
|
||||
* Current version of this generic object definition
|
||||
* @type {string}
|
||||
*/
|
||||
version: process.env.PACKAGE_VERSION,
|
||||
/**
|
||||
* Extends `HyperCubeDef`, see Engine API: `HyperCubeDef`.
|
||||
* @extends {EngineAPI.HyperCubeDef}
|
||||
*/
|
||||
qHyperCubeDef: {
|
||||
qDimensions: [],
|
||||
qMeasures: [],
|
||||
qInitialDataFetch: [
|
||||
{
|
||||
qWidth: 7,
|
||||
qHeight: 1400,
|
||||
},
|
||||
],
|
||||
},
|
||||
/**
|
||||
* @type {boolean=}
|
||||
*/
|
||||
showTitles: false,
|
||||
/**
|
||||
* @type {string=}
|
||||
*/
|
||||
title: "",
|
||||
/**
|
||||
* @type {string=}
|
||||
*/
|
||||
subtitle: "",
|
||||
/**
|
||||
* @type {string=}
|
||||
*/
|
||||
footnote: "",
|
||||
/**
|
||||
* @type {('dynamic'|'continuous'|'discrete'|'diagonalCross'|'straightCross'|'horizontal'|'vertical'|'curvedCW'|'curvedCCW'|'cubicBezier')=}
|
||||
*/
|
||||
edgeType: "dynamic",
|
||||
/**
|
||||
* @type {boolean=}
|
||||
*/
|
||||
displayEdgeLabel: false,
|
||||
/**
|
||||
* @type {('top'|'middle'|'bottom'|'horizontal')=}
|
||||
*/
|
||||
posEdgeLabel: "top",
|
||||
/**
|
||||
* @type {('dot'|'square'|'star'|'triangle'|'triangleDown'|'diamond')=}
|
||||
*/
|
||||
nodeShape: "dot",
|
||||
/**
|
||||
* @type {boolean=}
|
||||
*/
|
||||
shadowMode: false,
|
||||
};
|
||||
|
||||
export default properties;
|
||||
23
src/extension/strings.js
Normal file
23
src/extension/strings.js
Normal file
@@ -0,0 +1,23 @@
|
||||
export const dimDesc = [
|
||||
"Node Identifier",
|
||||
"Node Label",
|
||||
"Node Parent",
|
||||
"Node Group"
|
||||
];
|
||||
|
||||
export const dimLongDesc = [
|
||||
"Node Identifier - a field in the dataset which should be presented as a node in the network diagram."
|
||||
+ " these control the actual elements presented in the network diagram.",
|
||||
"Node Label - controls what field holds the data that described the nodes in the network"
|
||||
+ " diagram. The field content will be presented as label.",
|
||||
"Node Parent - is used to determine the ancestor node for the individual nodes."
|
||||
+ " This field will be used for describing the relationships between network elements.",
|
||||
"Node Group - is a field which describes groups of a node in the network."
|
||||
+ " This is used to apply the same color to several nodes."
|
||||
];
|
||||
|
||||
export const measureDesc = [
|
||||
"Tooltip",
|
||||
"Node size",
|
||||
"Edge size"
|
||||
];
|
||||
257
src/index.js
257
src/index.js
@@ -1,230 +1,33 @@
|
||||
/*
|
||||
Created by Michael Laenen - michael.laenen@agilos.com - (c) 2016
|
||||
Tested on Qlik Sense 2.2.3
|
||||
import { useElement, usePromise, useEffect, useStaleLayout, useTheme, useRect, useState, useConstraints, useSelections } from '@nebula.js/stardust';
|
||||
import data from './extension/data';
|
||||
import ext from './extension/ext';
|
||||
import properties from './extension/properties';
|
||||
import paint from './sn-paint';
|
||||
|
||||
Agilos.com takes no responsibility for any code.
|
||||
Use at your own risk.
|
||||
*/
|
||||
if (!window._babelPolyfill) { // eslint-disable-line no-underscore-dangle
|
||||
require('@babel/polyfill'); // eslint-disable-line global-require
|
||||
}
|
||||
|
||||
import paint from './paint';
|
||||
import './styles/main.less';
|
||||
|
||||
const dimDesc = [
|
||||
"Node Identifier",
|
||||
"Node Label",
|
||||
"Node Parent",
|
||||
"Node Group"
|
||||
];
|
||||
|
||||
const dimLongDesc = [
|
||||
"Node Identifier - a field in the dataset which should be presented as a node in the network diagram."
|
||||
+ " these control the actual elements presented in the network diagram.",
|
||||
"Node Label - controls what field holds the data that described the nodes in the network"
|
||||
+ " diagram. The field content will be presented as label.",
|
||||
"Node Parent - is used to determine the ancestor node for the individual nodes."
|
||||
+ " This field will be used for describing the relationships between network elements.",
|
||||
"Node Group - is a field which describes groups of a node in the network."
|
||||
+ " This is used to apply the same color to several nodes."
|
||||
];
|
||||
|
||||
const measureDesc = [
|
||||
"Tooltip",
|
||||
"Node size",
|
||||
"Edge size"
|
||||
];
|
||||
|
||||
const component = {
|
||||
initialProperties: {
|
||||
version: 1.0,
|
||||
qHyperCubeDef: {
|
||||
qDimensions: [],
|
||||
qMeasures: [],
|
||||
qInitialDataFetch: [{
|
||||
qWidth: 7,
|
||||
qHeight: 1400
|
||||
}]
|
||||
}
|
||||
},
|
||||
//property panel
|
||||
data: {
|
||||
dimensions: {
|
||||
min: 3,
|
||||
max: 4,
|
||||
description(properties, index) {
|
||||
return dimDesc[index];
|
||||
}
|
||||
/*
|
||||
1. Dimension: Node ID, numeric (Event ID or else) or String
|
||||
2. Dimension: Node Label
|
||||
3. Dimension: Node Parent ID, numeric (Event ID or else) or String
|
||||
4. Dimension: Node Cluster
|
||||
*/
|
||||
export default function supernova() {
|
||||
return {
|
||||
qae: {
|
||||
properties,
|
||||
data: data(),
|
||||
},
|
||||
measures: {
|
||||
min: 0,
|
||||
max: 3,
|
||||
description(properties, index) {
|
||||
return measureDesc[index];
|
||||
}
|
||||
/*
|
||||
1. Measure: title text for tooltip (optional)
|
||||
2. Measure: node value
|
||||
3. Measure: edge value
|
||||
*/
|
||||
}
|
||||
},
|
||||
definition: {
|
||||
type: "items",
|
||||
component: "accordion",
|
||||
items: {
|
||||
data: {
|
||||
uses: "data",
|
||||
items:{
|
||||
dimensions:{
|
||||
disabledRef: "",
|
||||
items: {
|
||||
helpDesc: {
|
||||
component: 'text',
|
||||
style: 'qlik-network-chart-italic-property',
|
||||
label: function(properties, handler) {
|
||||
var index;
|
||||
handler.getDimensions().forEach((element, i) => {
|
||||
if(element.qDef.cId === properties.qDef.cId) {
|
||||
index = i;
|
||||
}
|
||||
});
|
||||
return dimLongDesc[index];
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
measures: {
|
||||
disabledRef: ""
|
||||
}
|
||||
}
|
||||
},
|
||||
sorting: {
|
||||
uses: "sorting"
|
||||
},
|
||||
addons: {
|
||||
uses: "addons",
|
||||
items: {
|
||||
dataHandling: {
|
||||
uses: "dataHandling"
|
||||
}
|
||||
}
|
||||
},
|
||||
settings: {
|
||||
type: "items",
|
||||
label: "Settings",
|
||||
items: {
|
||||
edgeType: {
|
||||
ref: "edgeType",
|
||||
type: "string",
|
||||
component: "dropdown",
|
||||
label: "Edge Type",
|
||||
options: [
|
||||
{ value: 'dynamic' },
|
||||
{ value: 'continuous' },
|
||||
{ value: 'discrete' },
|
||||
{ value: 'diagonalCross' },
|
||||
{ value: 'straightCross' },
|
||||
{ value: 'horizontal' },
|
||||
{ value: 'vertical' },
|
||||
{ value: 'curvedCW' },
|
||||
{ value: 'curvedCCW' },
|
||||
{ value: 'cubicBezier' }
|
||||
],
|
||||
defaultValue: "dynamic"
|
||||
},
|
||||
displayEdgeLabel : {
|
||||
ref: "displayEdgeLabel",
|
||||
type: "boolean",
|
||||
component: "switch",
|
||||
label: "Display Edge Value",
|
||||
options: [{
|
||||
value: true,
|
||||
label: "On"
|
||||
}, {
|
||||
value: false,
|
||||
label: "Off"
|
||||
}],
|
||||
defaultValue: false
|
||||
},
|
||||
posEdgeLabel: {
|
||||
ref: "posEdgeLabel",
|
||||
type: "string",
|
||||
component: "dropdown",
|
||||
label: "Position Edge Label",
|
||||
options: [
|
||||
{ value: 'top' }, { value: 'middle' }, { value: 'bottom' }, { value: 'horizontal' }
|
||||
],
|
||||
defaultValue: "top"
|
||||
},
|
||||
nodeShape: {
|
||||
ref: "nodeShape",
|
||||
type: "string",
|
||||
component: "dropdown",
|
||||
label: "Node Shape",
|
||||
options: [
|
||||
{ value: 'dot' },
|
||||
{ value: 'square' },
|
||||
{ value: 'star' },
|
||||
{ value: 'triangle' },
|
||||
{ value: 'triangleDown' },
|
||||
{ value: 'diamond' }
|
||||
],
|
||||
defaultValue: "dot"
|
||||
},
|
||||
shadowMode: {
|
||||
ref: "shadowMode",
|
||||
type: "boolean",
|
||||
component: "switch",
|
||||
label: "Display Shadow",
|
||||
options: [{
|
||||
value: true,
|
||||
label: "On"
|
||||
}, {
|
||||
value: false,
|
||||
label: "Off"
|
||||
}],
|
||||
defaultValue: false
|
||||
}
|
||||
}
|
||||
},
|
||||
about: {
|
||||
component: 'items',
|
||||
label: 'About',
|
||||
items: {
|
||||
header: {
|
||||
label: 'Network chart',
|
||||
style: 'header',
|
||||
component: 'text'
|
||||
},
|
||||
paragraph1: {
|
||||
label: `Network chart is Qlik Sense chart which allows you to draw a network of connected nodes and edges from a data set to a sheet.`,
|
||||
component: 'text'
|
||||
},
|
||||
paragraph2: {
|
||||
label: 'Network chart is based upon an extension created by Michael Laenen.',
|
||||
component: 'text'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
support: {
|
||||
export: true,
|
||||
snapshot: true,
|
||||
exportData: true
|
||||
},
|
||||
snapshot: {
|
||||
canTakeSnapshot: true
|
||||
},
|
||||
paint: paint
|
||||
};
|
||||
component() {
|
||||
const layout = useStaleLayout();
|
||||
const element = useElement();
|
||||
const theme = useTheme();
|
||||
const rect = useRect();
|
||||
const constraints = useConstraints();
|
||||
const selections = useSelections();
|
||||
const [network, setNetwork] = useState();
|
||||
|
||||
export default component;
|
||||
useEffect(()=> {
|
||||
network && network.fit();
|
||||
}, [rect.width, rect.height]);
|
||||
|
||||
usePromise(()=>
|
||||
paint({ element,layout, theme, constraints, selections }).then((n)=>setNetwork(n)),
|
||||
[layout, element, theme.name(), constraints ]);
|
||||
},
|
||||
|
||||
ext: ext(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Network } from 'vis/index-network';
|
||||
import qlik from 'qlik';
|
||||
import { Network } from 'vis-network';
|
||||
import { createTooltipHTML } from './tooltip';
|
||||
import { escapeHTML } from './utilities';
|
||||
import './styles/main.css';
|
||||
|
||||
function isTextCellNotEmpty(c) {
|
||||
return (c.qText && !(c.qIsNull || c.qText.trim() == ''));
|
||||
@@ -11,11 +11,9 @@ function getColor (index, colors) {
|
||||
return colors[index % colors.length];
|
||||
}
|
||||
|
||||
function paint ( $element, layout, qTheme, component ) {
|
||||
|
||||
return new qlik.Promise(function(resolve) {
|
||||
|
||||
const colorScale = qTheme.properties.palettes.data[0];
|
||||
export default function paint ( { element,layout, theme, selections, constraints } ) {
|
||||
return new Promise((resolve) => {
|
||||
const colorScale = theme.getDataColorPalettes()[0];
|
||||
const numDimensions = layout.qHyperCube.qDimensionInfo.length;
|
||||
const numMeasures = layout.qHyperCube.qMeasureInfo.length;
|
||||
|
||||
@@ -24,14 +22,12 @@ function paint ( $element, layout, qTheme, component ) {
|
||||
containerId = 'network-container_' + id;
|
||||
|
||||
if(qData && qData.qMatrix) {
|
||||
$element.empty().append($('<div />')
|
||||
.attr({ id: containerId })
|
||||
.toggleClass('is-edit-mode', component.inEditState())
|
||||
.css({
|
||||
height: $element.height(),
|
||||
width: $element.width(),
|
||||
overflow: 'auto'
|
||||
}));
|
||||
element.textContent = '';
|
||||
const topDiv = document.createElement("div");
|
||||
topDiv.setAttribute('id', containerId);
|
||||
topDiv.classList.add('sn-network-top');
|
||||
constraints.passive && topDiv.classList.add('is-edit-mode');
|
||||
element.append(topDiv);
|
||||
|
||||
var dataSet = qData.qMatrix.map(function(e){
|
||||
const nodeName = e[1].qText;
|
||||
@@ -70,7 +66,7 @@ function paint ( $element, layout, qTheme, component ) {
|
||||
if (numMeasures > 1) {
|
||||
if (e[numDimensions+1].qNum) {
|
||||
// node value - to scale node shape size
|
||||
dataItem.nodeValue = e[5].qNum;
|
||||
dataItem.nodeValue = e[numDimensions+1].qNum;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +118,7 @@ function paint ( $element, layout, qTheme, component ) {
|
||||
groups[nodeItem.group] = {};
|
||||
}
|
||||
}
|
||||
const colors = colorScale.scale[Math.min(Object.keys(groups).length-1, colorScale.scale.length-1)];
|
||||
const colors = colorScale.colors[Math.min(Object.keys(groups).length-1, colorScale.colors.length-1)];
|
||||
|
||||
Object.keys(groups).forEach(function(g,i) {
|
||||
groups[g].color = getColor(i, colors);
|
||||
@@ -140,7 +136,7 @@ function paint ( $element, layout, qTheme, component ) {
|
||||
var options = {
|
||||
groups: groups,
|
||||
layout: {
|
||||
randomSeed: 1
|
||||
randomSeed: 34545 //"0.6610209392878246:1631081903504"
|
||||
},
|
||||
nodes: {
|
||||
shape:layout.nodeShape,
|
||||
@@ -157,7 +153,10 @@ function paint ( $element, layout, qTheme, component ) {
|
||||
},
|
||||
interaction: {
|
||||
hideEdgesOnDrag: true,
|
||||
tooltipDelay: 100
|
||||
selectable: !constraints.active && !constraints.select,
|
||||
tooltipDelay: 100,
|
||||
multiselect: true,
|
||||
selectConnectedEdges: true
|
||||
},
|
||||
physics: {
|
||||
forceAtlas2Based: {
|
||||
@@ -174,17 +173,15 @@ function paint ( $element, layout, qTheme, component ) {
|
||||
};
|
||||
var network = new Network(container, data, options);
|
||||
network.fit();
|
||||
|
||||
// Handle Selection on 1-node
|
||||
$("#"+containerId).css('cursor','default');
|
||||
|
||||
network.on('select', function (properties) {
|
||||
if (properties.hasOwnProperty("nodes") && component.options.noInteraction !== true) {
|
||||
if (properties.nodes.length > 0) {
|
||||
if (Object.prototype.hasOwnProperty.call(properties, "nodes") && !constraints.active && !constraints.select) {
|
||||
const nodes = network.getSelectedNodes();
|
||||
if (nodes.length > 0) {
|
||||
// find connected nodes to selection
|
||||
var connectedNodes = network.getConnectedNodes(properties.nodes[0]);
|
||||
// append node to the array
|
||||
connectedNodes.push(properties.nodes[0]);
|
||||
var conNodes = nodes.map(n => network.getConnectedNodes(n));
|
||||
// append nodes to the array
|
||||
conNodes.push(nodes);
|
||||
var connectedNodes = conNodes.flat();
|
||||
const toSelect = [];
|
||||
connectedNodes.forEach(function(node) {
|
||||
var id;
|
||||
@@ -199,32 +196,28 @@ function paint ( $element, layout, qTheme, component ) {
|
||||
toSelect.indexOf(id) === -1 && toSelect.push(id);
|
||||
}
|
||||
});
|
||||
|
||||
//network.selectNodes(connectedNodes);
|
||||
|
||||
if (!selections.isActive()) {
|
||||
selections.begin('/qHyperCubeDef');
|
||||
}
|
||||
|
||||
//Make the selections
|
||||
component.backendApi.selectValues(0,toSelect,false);
|
||||
selections.select({
|
||||
method: 'selectHyperCubeValues',
|
||||
params: ['/qHyperCubeDef', 0, toSelect, false],
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
network.on('stabilizationIterationsDone', function() {
|
||||
resolve();
|
||||
network.stopSimulation();
|
||||
resolve(network);
|
||||
});
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function themePaint ($element, layout) {
|
||||
const component = this;
|
||||
try {
|
||||
const app = qlik.currApp(this);
|
||||
|
||||
return app.theme.getApplied().then( function( qTheme ) {
|
||||
return paint($element, layout, qTheme, component);
|
||||
});
|
||||
} catch (exception) {
|
||||
console.error(exception); // eslint-disable-line no-console
|
||||
}
|
||||
}
|
||||
|
||||
export default themePaint;
|
||||
@@ -2,6 +2,13 @@
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.sn-network-top {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
overflow: 'auto';
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.vis-tooltip {
|
||||
position: absolute;
|
||||
background-color: #333;
|
||||
@@ -24,5 +24,5 @@ export function createTooltipHTML({ name, groupNumber, nodeMeasure }) {
|
||||
tooltip.appendChild(groupNumberEntry);
|
||||
tooltip.appendChild(nodeMeasureEntry);
|
||||
|
||||
return tooltip.innerHTML;
|
||||
return tooltip;
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
rules: {
|
||||
"at-rule-no-unknown": true,
|
||||
"block-no-empty": true,
|
||||
"color-no-invalid-hex": true,
|
||||
"comment-no-empty": true,
|
||||
"declaration-block-no-duplicate-properties": [
|
||||
true,
|
||||
{
|
||||
ignore: ["consecutive-duplicates-with-different-values"]
|
||||
}
|
||||
],
|
||||
"declaration-block-no-shorthand-property-overrides": true,
|
||||
"font-family-no-duplicate-names": true,
|
||||
"font-family-no-missing-generic-family-keyword": true,
|
||||
"function-calc-no-unspaced-operator": true,
|
||||
"function-linear-gradient-no-nonstandard-direction": true,
|
||||
"keyframe-declaration-no-important": true,
|
||||
"media-feature-name-no-unknown": true,
|
||||
"no-descending-specificity": true,
|
||||
"no-duplicate-at-import-rules": true,
|
||||
"no-duplicate-selectors": true,
|
||||
"no-empty-source": true,
|
||||
"no-extra-semicolons": true,
|
||||
"no-invalid-double-slash-comments": true,
|
||||
"property-no-unknown": true,
|
||||
"selector-pseudo-class-no-unknown": true,
|
||||
"selector-pseudo-element-no-unknown": true,
|
||||
"selector-type-no-unknown": true,
|
||||
"string-no-newline": true,
|
||||
"unit-no-unknown": true
|
||||
}
|
||||
};
|
||||
@@ -1,84 +0,0 @@
|
||||
const StyleLintPlugin = require('stylelint-webpack-plugin');
|
||||
const packageJSON = require('./package.json');
|
||||
const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
const SOURCE_MAP = 'sourec-map';
|
||||
const DEVTOOL = (process.env.NODE_ENV === 'development') ? SOURCE_MAP : false;
|
||||
|
||||
const DIST = path.resolve("./dist");
|
||||
const MODE = process.env.NODE_ENV || 'development';
|
||||
|
||||
console.log('Webpack mode:', MODE); // eslint-disable-line no-console
|
||||
|
||||
const config = {
|
||||
devtool: DEVTOOL,
|
||||
entry: [
|
||||
'./src/index.js'
|
||||
],
|
||||
mode: MODE,
|
||||
output: {
|
||||
filename: `${packageJSON.name}.js`,
|
||||
libraryTarget: 'amd',
|
||||
path: DIST
|
||||
},
|
||||
externals: {
|
||||
qlik: {
|
||||
amd: 'qlik',
|
||||
commonjs: 'qlik',
|
||||
commonjs2: 'qlik',
|
||||
root: '_'
|
||||
}
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
enforce: "pre",
|
||||
test: /\.js$/,
|
||||
exclude: /(node_modules)/,
|
||||
loader: "eslint-loader",
|
||||
options: {
|
||||
failOnError: true
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /node_modules[\\\/]vis[\\\/].*\.js$/,
|
||||
use: {
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
cacheDirectory: true,
|
||||
presets: ['@babel/preset-env']
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /.js$/,
|
||||
exclude: /node_modules/,
|
||||
use: {
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
presets: ['@babel/preset-env']
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /.(less|css)$/,
|
||||
use: ['style-loader', 'css-loader', 'less-loader']
|
||||
},
|
||||
{
|
||||
test: /\.(png|jpg|gif)$/,
|
||||
use: [
|
||||
{
|
||||
loader: 'file-loader',
|
||||
options: {}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new StyleLintPlugin(),
|
||||
new webpack.ContextReplacementPlugin(/moment[\\\/]locale$/, /^\.\/en$/),
|
||||
]
|
||||
};
|
||||
|
||||
module.exports = config;
|
||||
Reference in New Issue
Block a user