@datarailsshared/dr_renderer 1.2.2 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,86 +1,66 @@
1
1
  version: 2.1
2
-
3
2
  orbs:
4
3
  datarails-cicd-orb: datarails-ns/datarails-cicd-orb@dev:primary
5
-
6
- defaults: &defaults
4
+ defaults:
7
5
  working_directory: ~/repo
8
- docker:
9
- - image: circleci/node:14.16.1
10
-
6
+ docker: &id001
7
+ - image: circleci/node:14.16.1
11
8
  jobs:
12
9
  deploy:
13
- <<: *defaults
10
+ working_directory: ~/repo
11
+ docker: *id001
14
12
  steps:
15
- - checkout
16
-
17
- - attach_workspace:
18
- at: ~/repo
19
- - run:
20
- name: Prepare publish version
21
- command: |
22
- postfix=""
23
- if [[ "${CIRCLE_BRANCH}" != master ]] ; then
24
- postfix="-$CIRCLE_BRANCH"
25
- fi
26
-
27
- VERSION="1.2.$CIRCLE_BUILD_NUM$postfix"
28
- sed -i s/{{cicd_version}}/$VERSION/g ./package.json
29
- cat ./package.json
30
- - run:
31
- name: Authenticate with registry
32
- command: echo "//registry.npmjs.org/:_authToken=$npm_TOKEN" > ~/repo/.npmrc
33
- - run:
34
- name: Install dependencies
35
- command: npm install
36
- - run:
37
- name: Run npm test
38
- command: npm test
39
- - run:
40
- name: Publish package
41
- command: npm publish . --access=public
42
- - datarails-cicd-orb/add-ssh-id:
43
- private_key_env_var: github_deploy_private_encoded
44
- public_key_env_var: github_deploy_pub_encoded
45
- is_public_key_encoded: true
46
- is_private_key_encoded: true
47
- - run:
48
- name: prepare git tag
49
- command: |
50
- postfix=""
51
- if [[ "${CIRCLE_BRANCH}" != prod ]] ; then
52
- postfix="-$CIRCLE_BRANCH"
53
- fi
54
-
55
- VERSION="1.2.$CIRCLE_BUILD_NUM$postfix"
56
- git config --global user.email noreplay@circleci.com
57
- git config --global user.name circleci
58
- git config --global -l
59
- git tag -a "$CIRCLE_BRANCH/$VERSION" -m "circleci build"
60
- # Test SSH connection to GitHub
61
- output=$(ssh -o "StrictHostKeyChecking no" -T git@github.com 2>&1 || true)
62
- echo "$output"
63
- if ! echo "$output" | grep -q "Hi.*You've successfully authenticated"; then
64
- echo "Failed to authenticate with GitHub"
65
- exit 1
66
- fi
67
- # Push the tag after successful authentication
68
- git push origin "$CIRCLE_BRANCH/$VERSION"
69
-
13
+ - checkout
14
+ - attach_workspace:
15
+ at: ~/repo
16
+ - run:
17
+ name: Prepare publish version
18
+ command: "postfix=\"\"\nif [[ \"${CIRCLE_BRANCH}\" != master ]] ; then\n \
19
+ \ postfix=\"-$CIRCLE_BRANCH\"\nfi\n\nVERSION=\"1.2.$CIRCLE_BUILD_NUM$postfix\"\
20
+ \nsed -i s/{{cicd_version}}/$VERSION/g ./package.json\ncat ./package.json\n"
21
+ - run:
22
+ name: Authenticate with registry
23
+ command: echo "//registry.npmjs.org/:_authToken=$npm_TOKEN" > ~/repo/.npmrc
24
+ - run:
25
+ name: Install dependencies
26
+ command: npm install
27
+ - run:
28
+ name: Run npm test
29
+ command: npm test
30
+ - run:
31
+ name: Publish package
32
+ command: npm publish . --access=public
33
+ - datarails-cicd-orb/add-ssh-id:
34
+ private_key_env_var: github_deploy_private_encoded
35
+ public_key_env_var: github_deploy_pub_encoded
36
+ is_public_key_encoded: true
37
+ is_private_key_encoded: true
38
+ - run:
39
+ name: prepare git tag
40
+ command: "postfix=\"\"\nif [[ \"${CIRCLE_BRANCH}\" != prod ]] ; then\n postfix=\"\
41
+ -$CIRCLE_BRANCH\"\nfi\n\nVERSION=\"1.2.$CIRCLE_BUILD_NUM$postfix\"\ngit\
42
+ \ config --global user.email noreplay@circleci.com\ngit config --global\
43
+ \ user.name circleci\ngit config --global -l\ngit tag -a \"$CIRCLE_BRANCH/$VERSION\"\
44
+ \ -m \"circleci build\"\n# Test SSH connection to GitHub\noutput=$(ssh -o\
45
+ \ \"StrictHostKeyChecking no\" -T git@github.com 2>&1 || true)\necho \"\
46
+ $output\"\nif ! echo \"$output\" | grep -q \"Hi.*You've successfully authenticated\"\
47
+ ; then\n echo \"Failed to authenticate with GitHub\"\n exit 1\nfi\n# Push\
48
+ \ the tag after successful authentication\ngit push origin \"$CIRCLE_BRANCH/$version\"\
49
+ \n"
70
50
  workflows:
71
51
  version: 2
72
52
  npm-publish:
73
53
  jobs:
74
- - deploy:
75
- context:
76
- - metadata
77
- filters:
78
- branches:
79
- only:
80
- - /master/
81
- - /tigers/
82
- - /bratans/
83
- - /dragons/
84
- - /tigers/
85
- - /wizards/
86
- - /rocket/
54
+ - deploy:
55
+ context:
56
+ - metadata
57
+ filters:
58
+ branches:
59
+ only:
60
+ - /master/
61
+ - /tigers/
62
+ - /bratans/
63
+ - /dragons/
64
+ - /tigers/
65
+ - /wizards/
66
+ - /rocket/
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datarailsshared/dr_renderer",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -2242,7 +2242,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
2242
2242
  return newOptions;
2243
2243
  }
2244
2244
 
2245
- const rangeArr = [range.low, range.medium, Math.max(range.high || 100, 100)];
2245
+ const rangeArr = [1 * range.low, 1 * range.medium, Math.max(1 * range.high || 100, 100)];
2246
2246
 
2247
2247
  newOptions.segments.forEach((segment, i) => {
2248
2248
  segment.from = (rangeArr[i - 1] + 1) || segment.from;
@@ -2253,7 +2253,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
2253
2253
  newOptions.goal = highchartsRenderer.objectCopyJsonMethod(GAUGE_OPTIONS_DEFAULT.goal);
2254
2254
  }
2255
2255
 
2256
- newOptions.goal.value = range.max || newOptions.goal.value;
2256
+ newOptions.goal.value = 1 * range.max || newOptions.goal.value;
2257
2257
 
2258
2258
  delete newOptions.range;
2259
2259
 
@@ -8771,6 +8771,37 @@ describe('highcharts_renderer', () => {
8771
8771
  }]);
8772
8772
  });
8773
8773
 
8774
+ it('should prepopulate segments with the old range data (string)', () => {
8775
+ const res = highchartsRenderer.transformOldGaugeOptions({
8776
+ opt1: 1,
8777
+ opt2: '2',
8778
+ range: {
8779
+ low: '20',
8780
+ medium: '30',
8781
+ high: '70',
8782
+ max: '200'
8783
+ }
8784
+ });
8785
+ expect(res.segments).toEqual([{
8786
+ from: 0,
8787
+ to: 20,
8788
+ color: GAUGE_OPTIONS_DEFAULT.segments[0].color,
8789
+ title: GAUGE_OPTIONS_DEFAULT.segments[0].title,
8790
+ },
8791
+ {
8792
+ from: 21,
8793
+ to: 30,
8794
+ color: GAUGE_OPTIONS_DEFAULT.segments[1].color,
8795
+ title: GAUGE_OPTIONS_DEFAULT.segments[1].title
8796
+ },
8797
+ {
8798
+ from: 31,
8799
+ to: 100,
8800
+ color: GAUGE_OPTIONS_DEFAULT.segments[2].color,
8801
+ title: GAUGE_OPTIONS_DEFAULT.segments[2].title
8802
+ }]);
8803
+ });
8804
+
8774
8805
  it('should remove old range object', () => {
8775
8806
  const res = highchartsRenderer.transformOldGaugeOptions({
8776
8807
  opt1: 1,