@@ -30,36 +30,87 @@ spec:
30
30
defaultValue :
31
31
$$jsExpression : |
32
32
page.parameters.package
33
- - component : codeComponent.PieChart
34
- name : codeComponent_PieChart
33
+ - component : PageRow
34
+ name : pageRow
35
35
props :
36
- data :
37
- $$jsExpression : |
38
- Object.entries(
39
- Object.entries(downloadsVersions.data)
40
- .filter(([version]) => version.indexOf("0.0") !== 0)
41
- .map((entry) => {
42
- const groups = entry[0].split(".")
43
- let group = `v${groups[0]}`
36
+ justifyContent : start
37
+ children :
38
+ - component : codeComponent.PieChart
39
+ name : codeComponent_PieChart
40
+ layout :
41
+ columnSize : 1
42
+ props :
43
+ data :
44
+ $$jsExpression : |
45
+ Object.entries(
46
+ Object.entries(downloadsVersions.data)
47
+ .filter(([version]) => version.indexOf("0.0") !== 0)
48
+ .map((entry) => {
49
+ const groups = entry[0].split(".")
50
+ let group = `v${groups[0]}`
44
51
45
- if (group === "v16" && parseInt(groups[1]) >= 8) {
46
- group = "v16.8"
47
- }
52
+ if (group === "v16" && parseInt(groups[1]) >= 8) {
53
+ group = "v16.8"
54
+ }
48
55
49
- return {
50
- version: entry[0],
51
- downloads: entry[1],
52
- group,
53
- }
54
- })
55
- .reduce((acc, item) => {
56
- acc[item.group] |= 0
57
- acc[item.group] += item.downloads
58
- return acc
59
- }, {})
60
- ).map((group) => ({ name: group[0], value: group[1] }))
61
- layout :
62
- columnSize : 1
56
+ return {
57
+ version: entry[0],
58
+ downloads: entry[1],
59
+ group,
60
+ }
61
+ })
62
+ .reduce((acc, item) => {
63
+ acc[item.group] |= 0
64
+ acc[item.group] += item.downloads
65
+ return acc
66
+ }, {})
67
+ ).map((group) => ({ name: group[0], value: group[1] }))
68
+ - component : Text
69
+ name : markdown
70
+ props :
71
+ mode : markdown
72
+ value :
73
+ $$jsExpression : >-
74
+ `${(() => {
75
+
76
+ const list = Object.entries(
77
+ Object.entries(downloadsVersions.data)
78
+ .filter(([version]) => version.indexOf("0.0") !== 0)
79
+ .map((entry) => {
80
+ const groups = entry[0].split(".")
81
+ let group = `v${groups[0]}`
82
+
83
+ if (group === "v16" && parseInt(groups[1]) >= 8) {
84
+ group = "v16.8"
85
+ }
86
+
87
+ return {
88
+ version: entry[0],
89
+ downloads: entry[1],
90
+ group,
91
+ }
92
+ })
93
+ .reduce((acc, item) => {
94
+ acc[item.group] |= 0
95
+ acc[item.group] += item.downloads
96
+ return acc
97
+ }, {})
98
+ )
99
+
100
+ .sort((groupA, groupB) => parseInt(groupA[0].replace('v', '')) -
101
+ parseInt(groupB[0].replace('v', '')))
102
+
103
+
104
+ const total = list.reduce((acc, item) => {
105
+ acc += item[1];
106
+ return acc;
107
+ }, 0);
108
+
109
+
110
+ return list.map((group) => ` - ${group[0]}:
111
+ ${Math.round(group[1]/total * 100)}%`).join('\n');
112
+
113
+ })()}`
63
114
queries :
64
115
- name : downloadsVersions
65
116
query :
0 commit comments