cob-cli 2.16.1 → 2.17.0

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.
Files changed (24) hide show
  1. package/customizations/keywords.js +1 -0
  2. package/customizations/keywords.styleResults.js +17 -0
  3. package/lib/task_lists/rsyncFilter.txt +1 -0
  4. package/package.json +1 -1
  5. package/templates/dashboards/dash/dist/dashboard.html +2 -2
  6. package/templates/dashboards/dash/dist/js/{app.e7f52f45.js → app.197de6fa.js} +3 -3
  7. package/templates/dashboards/dash/dist/js/app.197de6fa.js.map +1 -0
  8. package/templates/dashboards/dash/package-lock.json +2 -0
  9. package/templates/dashboards/dash/src/collector.js +4 -3
  10. package/templates/dashboards/dash/src/components/Board.vue +3 -3
  11. package/templates/dashboards/dash/src/components/Calendar.vue +24 -9
  12. package/templates/dashboards/dash/src/components/Kibana.vue +1 -0
  13. package/templates/dashboards/dash/src/components/Menu.vue +7 -4
  14. package/templates/dashboards/dash/src/components/TotalsValue.vue +2 -2
  15. package/templates/dashboards/dash/src/components/shared/Instance.vue +8 -2
  16. package/templates/dashboards/dash/src/{definition_dashboard.json → definition_dashboard_v0.json} +0 -0
  17. package/templates/dashboards/dash/src/definition_dashboard_v1.json +1 -0
  18. package/templates/keywords/audit/backend/scripts/_audit.groovy +9 -7
  19. package/templates/keywords/calc/backend/scripts/_calc.groovy +1 -1
  20. package/templates/keywords/styleResults/frontend/css/_styleResults.css +86 -0
  21. package/templates/keywords/styleResults/frontend/css/customizations.__MERGE__.css +1 -0
  22. package/templates/keywords/styleResults/frontend/js/cob/_styleResults.js +34 -0
  23. package/templates/keywords/styleResults/frontend/js/customizations2.__MERGE__.js +1 -0
  24. package/templates/dashboards/dash/dist/js/app.e7f52f45.js.map +0 -1
@@ -11355,6 +11355,7 @@
11355
11355
  "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz",
11356
11356
  "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==",
11357
11357
  "dev": true,
11358
+ "hasInstallScript": true,
11358
11359
  "optional": true,
11359
11360
  "os": [
11360
11361
  "darwin"
@@ -11765,6 +11766,7 @@
11765
11766
  "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz",
11766
11767
  "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==",
11767
11768
  "dev": true,
11769
+ "hasInstallScript": true,
11768
11770
  "optional": true,
11769
11771
  "os": [
11770
11772
  "darwin"
@@ -108,7 +108,7 @@ function parseDashboard(raw_dashboard, userInfo) {
108
108
  "ValueClasses": "",
109
109
  "View": "",
110
110
  "ValueAttention": "",
111
- "AttentionClasses": "",
111
+ "ValueAttentionClasses": "",
112
112
  "Unit": "",
113
113
  }],
114
114
  "Style Value": "",
@@ -139,7 +139,8 @@ function parseDashboard(raw_dashboard, userInfo) {
139
139
  "OutputVarCalendar": "",
140
140
  "MaxVisibleDayEvents": "",
141
141
  "AllowCreateInstances":"",
142
- "CreateDefinition":""
142
+ "CreateDefinition":"",
143
+ "EventViews":""
143
144
  }],
144
145
  "Events": [{
145
146
  "Definition": "",
@@ -199,7 +200,7 @@ function parseDashboard(raw_dashboard, userInfo) {
199
200
  if (v.Value === 'Label') {
200
201
  v.dash_info = {value: v.Arg[0].Arg, state: "ready"}
201
202
  } else if (v.Value === 'link') {
202
- v.dash_info = {value: icon, href: url, state: undefined, isLink: true}
203
+ v.dash_info = {value: v.Arg[1].Arg, href: v.Arg[0].Arg, state: "ready", isLink: true}
203
204
  } else {
204
205
  // add dash-info values in Totals
205
206
  v.dash_info = dashFunctions[v.Value].apply(this, v['Arg'].map( a =>
@@ -2,11 +2,11 @@
2
2
  <div :class="classes" :style="image" >
3
3
  <template v-for="(item, i) in components">
4
4
  <Label v-if="item['Component'] === 'Label'" :component="item" :key="i" />
5
- <Menu v-if="item['Component'] === 'Menu'" :component="item" :key="i" />
5
+ <Menu v-if="item['Component'] === 'Menu'" :component="item" :key="i" :userInfo="userInfo"/>
6
6
  <Totals v-if="item['Component'] === 'Totals'" :component="item" :key="i" :userInfo="userInfo"/>
7
7
  <Kibana v-if="item['Component'] === 'Kibana'" :component="item" :key="i" :userInfo="userInfo"/>
8
- <Filtro v-if="item['Component'] === 'Filter'" :component="item" :key="i" />
9
- <Calendar v-if="item['Component'] === 'Calendar'" :component="item" :key="i" />
8
+ <Filtro v-if="item['Component'] === 'Filter'" :component="item" :key="i" :userInfo="userInfo"/>
9
+ <Calendar v-if="item['Component'] === 'Calendar'" :component="item" :key="i" :userInfo="userInfo"/>
10
10
  </template>
11
11
  </div>
12
12
  </template>
@@ -26,7 +26,6 @@
26
26
  import tippy from 'tippy.js';
27
27
  import Instance from "@/components/shared/Instance";
28
28
  import Vue from "vue";
29
- import {getValue} from "@/utils/EsInstanceUtils";
30
29
  import ComponentStatePersistence from "@/model/ComponentStatePersistence";
31
30
 
32
31
  const DEFAULT_EVENT_COLOR = '#0e7bbe'
@@ -39,7 +38,8 @@
39
38
  },
40
39
 
41
40
  props: {
42
- component: Object
41
+ component: Object,
42
+ userInfo: Object
43
43
  },
44
44
 
45
45
  data: () => ({
@@ -57,14 +57,15 @@
57
57
  timeZone: 'UTC',
58
58
  locales: allLocales,
59
59
  // Take in consideration updating the initial state value of `activeView` if you change this value
60
- initialView: 'dayGridMonth',
60
+ initialView: 'dayGridWeek',
61
61
  headerToolbar: {
62
62
  left: 'today prev next',
63
63
  center: '',
64
- right: 'dayGridMonth,listMonth'
64
+ right: 'dayGridWeek,dayGridMonth,listMonth'
65
65
  },
66
66
  buttonText: {
67
67
  today: 'Today',
68
+ week: 'Week',
68
69
  month: 'Month',
69
70
  list: 'List',
70
71
  },
@@ -85,11 +86,14 @@
85
86
  }),
86
87
 
87
88
  created() {
89
+ this.calendarOptions.initialView = this.eventView[0]
90
+ this.calendarOptions.headerToolbar.right = this.eventView.join(",")
91
+
88
92
  this.statePersistence = new ComponentStatePersistence(this.component.id, this.updateCalendarBasedOnPersistedStateChange)
89
93
 
90
94
  // Setup a dashInfo placeholder for each event source, initially with a zero result query ( "-*") so it has a fast response
91
95
  for(let i in this.eventSources) {
92
- this.rmEventSources.push( instancesList( this.eventSources[i]['Definition'], "-*", 2000, 0, {validity: 30}) )
96
+ this.rmEventSources.push( instancesList( this.eventSources[i]['Definition'], "-*", 800, 0, "", {validity: 60}) )
93
97
  }
94
98
 
95
99
  // If configured get the definition id to allow instance creation
@@ -164,6 +168,7 @@
164
168
  inputVarCalendar() { return this.options['InputVarCalendar'] || [] },
165
169
  allowCreateInstances() { return this.options['AllowCreateInstances'] === 'TRUE' || false},
166
170
  createDefinition() { return this.options['CreateDefinition'] },
171
+ eventView() { return this.options['EventViews'] && this.options['EventViews'].split(',') || ['dayGridWeek','dayGridMonth','listMonth'] },
167
172
  outputVar() { return this.options['OutputVarCalendar'] || '' },
168
173
  dayMaxEvents() { return parseInt(this.options['MaxVisibleDayEvents'], 10) || MAX_VISIBLE_DAY_EVENTS },
169
174
 
@@ -180,13 +185,14 @@
180
185
  // Calculate date range query part
181
186
  let startField = toEsFieldName(this.eventSources[i]['DateStartEventField'])
182
187
  let endField = toEsFieldName(this.eventSources[i]['DateEndEventField'])
183
- let dateRangeQuery = `${startField}:[${this.dateRange[0].getTime()} TO ${this.dateRange[1].getTime()}]`
188
+ let dateRangeQuery = `(${startField}:[${this.dateRange[0].getTime()} TO ${this.dateRange[1].getTime()}])`
184
189
  if (endField) {
185
- dateRangeQuery += ` OR ${endField}:[${this.dateRange[0].getTime()} TO ${this.dateRange[1].getTime()}]`
190
+ dateRangeQuery += ` OR (${endField}:[${this.dateRange[0].getTime()} TO ${this.dateRange[1].getTime()}])`
191
+ dateRangeQuery += ` OR (${startField}:<${this.dateRange[0].getTime()} AND ${endField}:>=${this.dateRange[1].getTime()})`
186
192
  }
187
193
 
188
194
  // Calculate final query
189
- const eventQuery = this.eventSources[i]['EventsQuery'] || '*'
195
+ const eventQuery = this.eventSources[i]['EventsQuery'] && this.eventSources[i]['EventsQuery'].replace(/__USERNAME__/g, this.userInfo.username) || '*'
190
196
  const baseQuery = `${eventQuery} AND (${dateRangeQuery})`
191
197
  const inputVars = new Set(this.inputVarCalendar.map(inputVar => inputVar['InputVarCalendar']));
192
198
  const finalQuery = `${baseQuery} ${[...inputVars].map(inputVar => this.component.vars[inputVar]).join(' ')}`.trim()
@@ -272,13 +278,22 @@
272
278
  const startDate = new Date(parseInt(esInstance[startDateField][0], 10))
273
279
  const endDate = endDateField ? new Date(parseInt(esInstance[endDateField][0], 10)) : null
274
280
 
281
+ let color
282
+ if(stateField && stateField.startsWith("#")) {
283
+ color = stateField
284
+ } else if(!stateField || !esInstance[stateField]) {
285
+ color = DEFAULT_EVENT_COLOR
286
+ } else {
287
+ color = this.textToRGB(esInstance[stateField][0])
288
+ }
289
+
275
290
  return {
276
291
  id: `calendar-event-${esInstance.id}`,
277
292
  title: title[0] + (title.length > 1 ? `(${title.length})` : ''),
278
293
  start: startDate,
279
294
  end: endDate,
280
295
  allDay: true,
281
- backgroundColor: stateField && esInstance[stateField] ? this.textToRGB(esInstance[stateField][0]) : DEFAULT_EVENT_COLOR,
296
+ backgroundColor: color,
282
297
 
283
298
  // from: https://fullcalendar.io/docs/event-object
284
299
  // In addition to the fields above, you may also include your own non-standard fields in each Event object.
@@ -34,6 +34,7 @@
34
34
  inputs() { return this.options['InputVarKibana'].map(v => v['InputVarKibana']) },
35
35
  inputFilter() {
36
36
  let filters = this.inputs.filter(v => this.component.vars[v]).map(v => this.component.vars[v]);
37
+ if (filters.length == 0) filters.push("*")
37
38
  if (this.fixedQuery !== "") filters.push(" AND (" + this.fixedQuery + ")");
38
39
  return filters.join(" ")
39
40
  },
@@ -19,16 +19,19 @@
19
19
 
20
20
  export default {
21
21
  components: { Attention },
22
- props: { component: Object },
22
+ props: {
23
+ component: Object,
24
+ userInfo: Object
25
+ },
23
26
  computed: {
24
27
  options() { return this.component['MenuCustomize'][0] },
25
28
  classes() { return this.options['MenuClasses'] || "flex flex-col gap-y-2" },
26
29
  lines() {
27
30
  let lines = this.component['Text'].map( line => ({
28
31
  classes: line["TextCustomize"][0]['TextClasses'] || "transition ease-in-out duration-300 rounded-md border border-gray-300 border-l-2 border-l-sky-600 shadow-sm transform hover:translate-x-0.5 p-2 bg-white",
29
- icon: line["TextCustomize"][0]['Icon'] || "",
30
- text: line['Text'] || "",
31
- link: line['Link'] || "",
32
+ icon: line["TextCustomize"][0]['Icon'] || "",
33
+ text: line['Text'] || "",
34
+ link: line['Link'] && line['Link'].replace(/__USERNAME__/g, this.userInfo.username) || "",
32
35
  groups: line["TextCustomize"][0]['GroupVisibility'].map(g => g["GroupVisibility"] && g["GroupVisibility"] ).filter(g => g) || [],
33
36
  attention: line["TextCustomize"][0]['AttentionInfo'],
34
37
  }))
@@ -38,12 +38,12 @@
38
38
  options() { return this.valueData['ValueCustomize'][0] },
39
39
  view() { return this.options['View'] },
40
40
  attention() { return this.options['AttentionInfo'] },
41
- attentionClasses() { return this.options['AttentionClasses'] },
41
+ attentionClasses() { return this.options['ValueAttentionClasses'] },
42
42
  unit() { return this.options['Unit'] },
43
43
  state() { return this.valueData.dash_info && this.valueData.dash_info.state || "" },
44
44
  updating() { return this.state === "updating" || this.state === "loading" },
45
45
  classes() { return (this.options['ValueClasses'] || "Default Info") + " S_"+this.valueData.dash_info.state },
46
- link() { return this.valueData.dash_info.href + (this.view ? "?&av=" + this.view : "") },
46
+ link() { return this.valueData.dash_info.href + (this.view ? "?av=" + this.view : "") },
47
47
  expandedClasses() { return this.classes.split(/\s/).map(c => specialClasses[c] || c ).join(" ") },
48
48
  value() {
49
49
  if(this.valueData.dash_info.state === "loading") return "L"
@@ -9,7 +9,7 @@
9
9
  :key="i"
10
10
  >
11
11
  <div class='whitespace-nowrap mr-1 text-gray-400 field'>{{ description.name }}:</div>
12
- <div class='whitespace-nowrap text-ellipsis overflow-hidden value'>{{ description.value }}</div>
12
+ <div class='whitespace-nowrap text-ellipsis overflow-hidden value' v-html="description.value"></div>
13
13
  </div>
14
14
  </div>
15
15
  </div>
@@ -46,9 +46,15 @@ export default {
46
46
  return this.esInstance._definitionInfo.instanceDescription
47
47
  .filter(fieldDefinition => this.esInstance[toEsFieldName(fieldDefinition.name)])
48
48
  .map(fieldDefinition => {
49
+ let value = getValue(this.esInstance, fieldDefinition).join(', ')
50
+ if(fieldDefinition.description.indexOf("$date")>=0) {
51
+ value = (new Date(value*1)).toISOString().split('T')[0]
52
+ } else if(fieldDefinition.description.indexOf("$link")>=0) {
53
+ value = "<a href='"+getValue(this.esInstance, fieldDefinition)+"'>link</a>"
54
+ }
49
55
  return {
50
56
  name: fieldDefinition.name,
51
- value: getValue(this.esInstance, fieldDefinition).join(', ')
57
+ value: value
52
58
  }
53
59
  });
54
60
  }
@@ -0,0 +1 @@
1
+ {"id":null,"name":"Dashboard_v1","description":null,"duplicable":null,"state":"enabled","fieldDefinitions":[{"id":null,"name":"Dashboard Info","required":null,"description":"$group","condition":null,"duplicable":false,"fields":[],"order":0,"restricted":false,"rootField":true,"defaultValue":null},{"id":null,"name":"Name","required":null,"description":"$expanded $instanceLabel","condition":null,"duplicable":false,"fields":[],"order":1,"restricted":false,"rootField":true,"defaultValue":null},{"id":null,"name":"DashboardCustomize","required":null,"description":"$[Classes,Image,Width,Grid,Access] $multiple $help[Select the defaults to change] $style[hide] ","condition":null,"duplicable":false,"fields":[{"id":null,"name":"DashboardClasses","required":null,"description":"$default(h-full bg-cover bg-center overflow-auto p-3) Default: h-full bg-cover bg-center overflow-auto p-3","condition":"=Classes","duplicable":false,"fields":[],"order":3,"restricted":false,"rootField":false,"defaultValue":"h-full bg-cover bg-center overflow-auto p-3"},{"id":null,"name":"Image","required":null,"description":"$file Default:none","condition":"=Image","duplicable":false,"fields":[],"order":4,"restricted":false,"rootField":false,"defaultValue":null},{"id":null,"name":"Width","required":null,"description":"Default: max-w-6xl mx-auto ","condition":"=Width","duplicable":false,"fields":[],"order":5,"restricted":false,"rootField":false,"defaultValue":null},{"id":null,"name":"Grid","required":null,"description":"$default(grid grid-flow-row-dense md:grid-cols-12) Default: grid grid-flow-row-dense md:grid-cols-12","condition":"=Grid","duplicable":false,"fields":[],"order":6,"restricted":false,"rootField":false,"defaultValue":"grid grid-flow-row-dense md:grid-cols-12"},{"id":null,"name":"GroupAccess","required":null,"description":"$instanceDescription Group allowed to access this dashboard","condition":"=Access","duplicable":true,"fields":[],"order":7,"restricted":false,"rootField":false,"defaultValue":null}],"order":2,"restricted":false,"rootField":true,"defaultValue":null},{"id":null,"name":"URL","required":null,"description":"$link $auto.text(id).join('/recordm/index.html#/cob.custom-resource/',id,'/dash') $instanceDescription","condition":null,"duplicable":false,"fields":[],"order":8,"restricted":false,"rootField":true,"defaultValue":null},{"id":null,"name":"Boards","required":null,"description":"$group","condition":null,"duplicable":false,"fields":[],"order":9,"restricted":false,"rootField":true,"defaultValue":null},{"id":null,"name":"Board","required":null,"description":null,"condition":null,"duplicable":true,"fields":[{"id":null,"name":"BoardCustomize","required":null,"description":"$[Classes,Image] $multiple $help[Select the defaults to change] $style[hide] ","condition":null,"duplicable":false,"fields":[{"id":null,"name":"BoardClasses","required":null,"description":"$default(col-span-12 md:col-span-4 rounded-md border border-gray-300 bg-white bg-opacity-70 p-4 m-1) Default:col-span-12 md:col-span-4 rounded-md border border-gray-300 bg-white bg-opacity-70 p-4 m-1","condition":"=Classes","duplicable":false,"fields":[],"order":12,"restricted":false,"rootField":false,"defaultValue":"col-span-12 md:col-span-4 rounded-md border border-gray-300 bg-white bg-opacity-70 p-4 m-1"},{"id":null,"name":"Image","required":null,"description":"$file Default: none","condition":"=Image","duplicable":false,"fields":[],"order":13,"restricted":false,"rootField":false,"defaultValue":null}],"order":11,"restricted":false,"rootField":false,"defaultValue":null},{"id":null,"name":"Component","required":null,"description":"$[Label,Menu,Totals,Kibana,Filter,Calendar] $instanceDescription $style[singleColumn] ","condition":null,"duplicable":true,"fields":[{"id":null,"name":"LabelCustomize","required":null,"description":"$[Classes,Image] $multiple $help[Select the defaults to change] $style[hide] ","condition":"=Label","duplicable":false,"fields":[{"id":null,"name":"LabelClasses","required":null,"description":"$default(text-center font-bold pb-2) Default: text-center font-bold pb-2","condition":"=Classes","duplicable":false,"fields":[],"order":16,"restricted":false,"rootField":false,"defaultValue":"text-center font-bold pb-2"},{"id":null,"name":"Image","required":null,"description":"$file Default: none","condition":"=Image","duplicable":false,"fields":[],"order":17,"restricted":false,"rootField":false,"defaultValue":null}],"order":15,"restricted":false,"rootField":false,"defaultValue":null},{"id":null,"name":"Label","required":null,"description":null,"condition":"=Label","duplicable":false,"fields":[],"order":18,"restricted":false,"rootField":false,"defaultValue":null},{"id":null,"name":"MenuCustomize","required":null,"description":"$[Classes] $multiple $help[Select the defaults to change] $style[hide] ","condition":"=Menu","duplicable":false,"fields":[{"id":null,"name":"MenuClasses","required":null,"description":"$default(flex flex-col gap-y-2) Default: flex flex-col gap-y-2","condition":"=Classes","duplicable":false,"fields":[],"order":20,"restricted":false,"rootField":false,"defaultValue":"flex flex-col gap-y-2"}],"order":19,"restricted":false,"rootField":false,"defaultValue":null},{"id":null,"name":"Text","required":null,"description":null,"condition":"=Menu","duplicable":true,"fields":[{"id":null,"name":"TextCustomize","required":null,"description":"$[Classes,Icon,Attention,Visibility] $multiple $help[Select the defaults to change] $style[hide] ","condition":null,"duplicable":false,"fields":[{"id":null,"name":"TextClasses","required":null,"description":"$default(transition ease-in-out duration-300 rounded-md border border-gray-300 border-l-2 border-l-sky-600 shadow-sm transform hover:translate-x-0.5 p-2) Default: transition ease-in-out duration-300 rounded-md border border-gray-300 border-l-2 border-l-sky-600 shadow-sm transform hover:translate-x-0.5 p-2","condition":"=Classes","duplicable":false,"fields":[],"order":23,"restricted":false,"rootField":false,"defaultValue":"transition ease-in-out duration-300 rounded-md border border-gray-300 border-l-2 border-l-sky-600 shadow-sm transform hover:translate-x-0.5 p-2"},{"id":null,"name":"Icon","required":null,"description":"Default: none Example: fa-solid fa-circle-chevron-left","condition":"=Icon","duplicable":false,"fields":[],"order":24,"restricted":false,"rootField":false,"defaultValue":null},{"id":null,"name":"TextAttention","required":null,"description":"Crisis:<=-5, ActionableBad:-4 .. -1, No action Required:0, ActionableGood:1..4,Extraordinary:>=5","condition":"=Attention","duplicable":false,"fields":[],"order":25,"restricted":false,"rootField":false,"defaultValue":null},{"id":null,"name":"GroupVisibility","required":null,"description":"Group allowed to view this menu line","condition":"=Visibility","duplicable":true,"fields":[],"order":26,"restricted":false,"rootField":false,"defaultValue":null}],"order":22,"restricted":false,"rootField":false,"defaultValue":null},{"id":null,"name":"Link","required":null,"description":null,"condition":null,"duplicable":false,"fields":[],"order":27,"restricted":false,"rootField":false,"defaultValue":null}],"order":21,"restricted":false,"rootField":false,"defaultValue":null},{"id":null,"name":"TotalsCustomize","required":null,"description":"$[Classes,InputVar] $multiple $help[Select the defaults to change] $style[hide] ","condition":"=Totals","duplicable":false,"fields":[{"id":null,"name":"TotalsClasses","required":null,"description":"$default(w-full table-auto) Default: w-full table-auto","condition":"=Classes","duplicable":false,"fields":[],"order":29,"restricted":false,"rootField":false,"defaultValue":"w-full table-auto"},{"id":null,"name":"InputVarTotals","required":null,"description":null,"condition":"=InputVar","duplicable":true,"fields":[],"order":30,"restricted":false,"rootField":false,"defaultValue":null}],"order":28,"restricted":false,"rootField":false,"defaultValue":null},{"id":null,"name":"Line","required":null,"description":null,"condition":"=Totals","duplicable":true,"fields":[{"id":null,"name":"LineCustomize","required":null,"description":"$[LineClasses,TitleClasses] $multiple $help[Select the defaults to change] $style[hide] ","condition":null,"duplicable":false,"fields":[{"id":null,"name":"LineClasses","required":null,"description":"$default(text-right) Default: text-right","condition":"=LineClasses","duplicable":false,"fields":[],"order":33,"restricted":false,"rootField":false,"defaultValue":"text-right"},{"id":null,"name":"TitleClasses","required":null,"description":"$default(text-left p-2) Default: text-left p-2","condition":"=TitleClasses","duplicable":false,"fields":[],"order":34,"restricted":false,"rootField":false,"defaultValue":"text-left p-2"}],"order":32,"restricted":false,"rootField":false,"defaultValue":null},{"id":null,"name":"Value","required":null,"description":"$[*Label,definitionCount,domainCount,fieldSum,fieldAverage,fieldWeightedAverage,dmEquipmentCount,link] ","condition":null,"duplicable":true,"fields":[{"id":null,"name":"ValueCustomize","required":null,"description":"$[Classes,View,Attention,AttentionClasses,Unit] $multiple $help[Select the defaults to change] $style[hide]","condition":null,"duplicable":false,"fields":[{"id":null,"name":"ValueClasses","required":null,"description":"$default(w-0 p-2) Default: w-0 p-2","condition":"=Classes","duplicable":false,"fields":[],"order":37,"restricted":false,"rootField":false,"defaultValue":"w-0 p-2"},{"id":null,"name":"View","required":null,"description":"Default: none","condition":"=View","duplicable":false,"fields":[],"order":38,"restricted":false,"rootField":false,"defaultValue":null},{"id":null,"name":"ValueAttention","required":null,"description":"Crisis:<=-5, ActionableBad:-4 .. -1, No action Required:0, ActionableGood:1..4,Extraordinary:>=5","condition":"=Attention","duplicable":false,"fields":[],"order":39,"restricted":false,"rootField":false,"defaultValue":null},{"id":null,"name":"ValueAttentionClasses","required":null,"description":"$default(fa-solid fa-circle pr-1 animate-pulse text-lg align-middle) Default: fa-solid fa-circle pr-1 animate-pulse text-lg align-middle","condition":"=AttentionClasses","duplicable":false,"fields":[],"order":40,"restricted":false,"rootField":false,"defaultValue":"fa-solid fa-circle pr-1 animate-pulse text-lg align-middle"},{"id":null,"name":"Unit","required":null,"description":null,"condition":"=Unit","duplicable":false,"fields":[],"order":41,"restricted":false,"rootField":false,"defaultValue":null}],"order":36,"restricted":false,"rootField":false,"defaultValue":null},{"id":null,"name":"Arg","required":null,"description":null,"condition":null,"duplicable":true,"fields":[],"order":42,"restricted":false,"rootField":false,"defaultValue":null}],"order":35,"restricted":false,"rootField":false,"defaultValue":"Label"}],"order":31,"restricted":false,"rootField":false,"defaultValue":null},{"id":null,"name":"KibanaCustomize","required":null,"description":"$[Classes,InputVar,OutputVar,Query] $multiple $help[Select the defaults to change] $style[hide] ","condition":"=Kibana","duplicable":false,"fields":[{"id":null,"name":"KibanaClasses","required":null,"description":null,"condition":"=Classes","duplicable":false,"fields":[],"order":44,"restricted":false,"rootField":false,"defaultValue":null},{"id":null,"name":"InputVarKibana","required":null,"description":null,"condition":"=InputVar","duplicable":true,"fields":[],"order":45,"restricted":false,"rootField":false,"defaultValue":null},{"id":null,"name":"OutputVarKibana","required":null,"description":null,"condition":"=OutputVar","duplicable":false,"fields":[],"order":46,"restricted":false,"rootField":false,"defaultValue":null},{"id":null,"name":"InputQueryKibana","required":null,"description":"Atenção: espaços no Kibana são OR e não AND","condition":"=Query","duplicable":false,"fields":[],"order":47,"restricted":false,"rootField":false,"defaultValue":null}],"order":43,"restricted":false,"rootField":false,"defaultValue":null},{"id":null,"name":"ShareLink","required":null,"description":null,"condition":"=Kibana","duplicable":false,"fields":[],"order":48,"restricted":false,"rootField":false,"defaultValue":null},{"id":null,"name":"FilterCustomize","required":null,"description":"$[Classes,Type,Placeholder] $multiple $help[Select the defaults to change] $style[hide] ","condition":"=Filter","duplicable":false,"fields":[{"id":null,"name":"FilterClasses","required":null,"description":null,"condition":"=Classes","duplicable":false,"fields":[],"order":50,"restricted":false,"rootField":false,"defaultValue":null},{"id":null,"name":"Type","required":null,"description":"$[Text,List,Date]","condition":"=Type","duplicable":false,"fields":[{"id":null,"name":"Alternatives","required":null,"description":null,"condition":"=List","duplicable":false,"fields":[],"order":52,"restricted":false,"rootField":false,"defaultValue":null},{"id":null,"name":"DateFilterType","required":null,"description":null,"condition":"=Date","duplicable":false,"fields":[],"order":53,"restricted":false,"rootField":false,"defaultValue":null}],"order":51,"restricted":false,"rootField":false,"defaultValue":null},{"id":null,"name":"Placeholder","required":null,"description":"$default(Pesquisar...) default: Pesquisar...","condition":"=Placeholder","duplicable":false,"fields":[],"order":54,"restricted":false,"rootField":false,"defaultValue":"Pesquisar..."}],"order":49,"restricted":false,"rootField":false,"defaultValue":null},{"id":null,"name":"OutputVarFilter","required":null,"description":null,"condition":"=Filter","duplicable":false,"fields":[],"order":55,"restricted":false,"rootField":false,"defaultValue":null},{"id":null,"name":"Query","required":null,"description":null,"condition":"=MD List","duplicable":false,"fields":[],"order":56,"restricted":false,"rootField":false,"defaultValue":null},{"id":null,"name":"CalendarCustomize","required":null,"description":"$[Classes,InputVar,OutputVar,Settings] $multiple $help[Select the defaults to change] $style[hide] ","condition":"=Calendar","duplicable":false,"fields":[{"id":null,"name":"CalendarClasses","required":null,"description":null,"condition":"=Classes","duplicable":false,"fields":[],"order":58,"restricted":false,"rootField":false,"defaultValue":null},{"id":null,"name":"InputVarCalendar","required":null,"description":null,"condition":"=InputVar","duplicable":true,"fields":[],"order":59,"restricted":false,"rootField":false,"defaultValue":null},{"id":null,"name":"MaxVisibleDayEvents","required":null,"description":"$number(0) Specify the maximum number of events that will be visible before enabling the +more link. Set to -1 to list all events. Defaults to 3.","condition":"=Settings","duplicable":false,"fields":[],"order":60,"restricted":false,"rootField":false,"defaultValue":null},{"id":null,"name":"AllowCreateInstances","required":null,"description":"$[TRUE,FALSE] $default(FALSE)","condition":"=Settings","duplicable":false,"fields":[],"order":61,"restricted":false,"rootField":false,"defaultValue":"FALSE"},{"id":null,"name":"CreateDefinition","required":null,"description":"Name of the Definition of Instances to Create","condition":"=Settings","duplicable":false,"fields":[],"order":62,"restricted":false,"rootField":false,"defaultValue":null},{"id":null,"name":"OutputVarCalendar","required":null,"description":null,"condition":"=OutputVar","duplicable":false,"fields":[],"order":63,"restricted":false,"rootField":false,"defaultValue":null}],"order":57,"restricted":false,"rootField":false,"defaultValue":null},{"id":null,"name":"Events","required":null,"description":"$group","condition":"=Calendar","duplicable":true,"fields":[{"id":null,"name":"Definition","required":"mandatory","description":"$definition","condition":null,"duplicable":false,"fields":[],"order":65,"restricted":false,"rootField":false,"defaultValue":null},{"id":null,"name":"DateStartEventField","required":"mandatory","description":"Name of the definition date field that represents the beginning of the event","condition":null,"duplicable":false,"fields":[],"order":66,"restricted":false,"rootField":false,"defaultValue":null},{"id":null,"name":"DateEndEventField","required":null,"description":"Name of the definition date field that represents the end of the event","condition":null,"duplicable":false,"fields":[],"order":67,"restricted":false,"rootField":false,"defaultValue":null},{"id":null,"name":"DescriptionEventField","required":"mandatory","description":"Name of the definition field to use as the event description","condition":null,"duplicable":false,"fields":[],"order":68,"restricted":false,"rootField":false,"defaultValue":null},{"id":null,"name":"StateEventField","required":null,"description":"Name of the field to calculate the color for the event. If not defined it will use always the same color for all events","condition":null,"duplicable":false,"fields":[],"order":69,"restricted":false,"rootField":false,"defaultValue":null},{"id":null,"name":"EventsQuery","required":null,"description":"Define a query to restrict the results that will appear in the calendar. Defaults to all records in the definition","condition":null,"duplicable":false,"fields":[],"order":70,"restricted":false,"rootField":false,"defaultValue":null}],"order":64,"restricted":false,"rootField":false,"defaultValue":null}],"order":14,"restricted":false,"rootField":false,"defaultValue":null}],"order":10,"restricted":false,"rootField":true,"defaultValue":null}],"version":null}
@@ -21,7 +21,7 @@ if (auditFields.size() > 0
21
21
  && msg.action =~ "add|update" ) {
22
22
 
23
23
  def updates = getAuditFieldsUpdates(auditFields,msg.instance.fields)
24
- def result = actionPacks.recordm.update(msg.type, "recordmInstanceId:" + msg.instance.id, updates);
24
+ def result = actionPacks.recordm.update(msg.type, "recordmInstanceId:" + msg.instance.id, updates);
25
25
  if(updates) log.info("[\$audit] UPDATE '${msg.type}' id:${msg.instance.id}, updates: ${updates}, result:${result.getStatus()} | ${result.getStatusInfo()} ");
26
26
  }
27
27
 
@@ -51,7 +51,7 @@ def getAuditFields(definitionName) {
51
51
 
52
52
  // Obtém detalhes da definição
53
53
  def definitionEncoded = URLEncoder.encode(definitionName, "utf-8").replace("+", "%20")
54
- def resp = actionPacks.rmRest.get( "recordm/definitions/name/${definitionEncoded}".toString(), [:], "");
54
+ def resp = actionPacks.rmRest.get( "recordm/definitions/name/${definitionEncoded}".toString(), [:], "integrationm");
55
55
  JSONObject definition = new JSONObject(resp);
56
56
 
57
57
  def fieldsSize = definition.fieldDefinitions.length();
@@ -59,16 +59,18 @@ def getAuditFields(definitionName) {
59
59
  def fields = [:]
60
60
  (0..fieldsSize-1).each { index ->
61
61
  def fieldDefinition = definition.fieldDefinitions.getJSONObject(index)
62
- def fieldDescription = fieldDefinition.get("description")
63
- def fieldDefId = fieldDefinition.get("id")
64
- def fieldName = fieldDefinition.get("name");
65
- fields[fieldDefId] = [name:fieldName, description: fieldDescription]
62
+ def fieldDescription = fieldDefinition.getString("description")
63
+ if(fieldDescription){
64
+ def fieldDefId = fieldDefinition.get("id");
65
+ def fieldName = fieldDefinition.get("name");
66
+ fields[fieldDefId] = [name:fieldName, description: fieldDescription]
67
+ }
66
68
  }
67
69
 
68
70
  // Finalmente obtém a lista de campos que é necessário calcular
69
71
  def auditFields = [];
70
72
  fields.each { fieldId,field ->
71
- def matcher = field.description.toString() =~ /[$]audit\.(creator|updater)\.(username|uri|time)/
73
+ def matcher = field.description =~ /[$]audit\.(creator|updater)\.(username|uri|time)/
72
74
  if(matcher) {
73
75
  def op = matcher[0][1]
74
76
  def arg = matcher[0][2]
@@ -122,7 +122,7 @@ def getAllCalculationFields(definitionName) {
122
122
 
123
123
  // Obtém detalhes da definição
124
124
  def definitionEncoded = URLEncoder.encode(definitionName, "utf-8").replace("+", "%20")
125
- def resp = actionPacks.rmRest.get( "recordm/definitions/name/${definitionEncoded}".toString(), [:], "");
125
+ def resp = actionPacks.rmRest.get( "recordm/definitions/name/${definitionEncoded}".toString(), [:], "integrationm");
126
126
  JSONObject definition = new JSONObject(resp);
127
127
 
128
128
  def fieldsSize = definition.fieldDefinitions.length();
@@ -0,0 +1,86 @@
1
+ /* Font color Classes */
2
+ .DimRed a,
3
+ .DimGreen a,
4
+ .DimBlue a {
5
+ color:#a7c7d7;
6
+ }
7
+ .DimRed {
8
+ color:#fbb;
9
+ }
10
+ .DimGreen {
11
+ color:#9c9;
12
+ }
13
+ .DimBlue {
14
+ color:rgb(191, 200, 243);
15
+ }
16
+ .DimOrange {
17
+ color:rgb(255, 222, 187);
18
+ }
19
+ .DimGray {
20
+ color:#bebebe;
21
+ }
22
+ .Red {
23
+ color: red
24
+ }
25
+ .Green {
26
+ color:green;
27
+ }
28
+ .Blue {
29
+ color:blue
30
+ }
31
+ .Orange {
32
+ color:orange;
33
+ }
34
+ .Gray {
35
+ color:gray;
36
+ }
37
+
38
+
39
+ /* Background Color Classes */
40
+ .BgRed {
41
+ background-color: red;
42
+ }
43
+ .BgGreen {
44
+ background-color: green;
45
+ }
46
+ .BgBlue{
47
+ background-color: blue;
48
+ }
49
+ .BgOrange{
50
+ background-color: orange;
51
+ }
52
+ .BgGray {
53
+ background-color:gray;
54
+ }
55
+ .BgDimRed {
56
+ background-color:lightpink;
57
+ }
58
+ .BgDimGreen {
59
+ background-color:#C1FA77;
60
+ }
61
+ .BgDimBlue {
62
+ background-color:#def4f9;
63
+ }
64
+ .BgDimOrange {
65
+ background-color:#FFE0D2;
66
+ }
67
+ .BgDimGray {
68
+ background-color:#bebebe;
69
+ }
70
+
71
+
72
+ .BgRed,
73
+ .BgGreen,
74
+ .BgBlue,
75
+ .BgOrange,
76
+ .BgGray {
77
+ color: white;
78
+ text-align: center;
79
+ }
80
+ .BgDimRed,
81
+ .BgDimGreen,
82
+ .BgDimBlue,
83
+ .BgDimOrange,
84
+ .BgDimGray {
85
+ text-align: center;
86
+ }
@@ -0,0 +1 @@
1
+ @import "_styleResults.css";
@@ -0,0 +1,34 @@
1
+ cob.custom.customize.push(function (core, utils, ui) {
2
+ const toES = (name) => name.toLowerCase().replace(/ /g, '_')
3
+
4
+ core.customizeColumn("*","*",function(node, esDoc, fieldInfo){
5
+ // Check $styleResultColumn
6
+ const matchColumnRegex = /\$styleResultColumn\((.*)\)/
7
+ let styleColField = matchColumnRegex.exec(fieldInfo.fieldDefDescription)
8
+ if(styleColField) {
9
+ const fieldValue = esDoc[toES(fieldInfo.name)] && esDoc[toES(fieldInfo.name)][0];
10
+ const relevantMapping = styleColField[1].split(",")
11
+
12
+ for(let mapping of relevantMapping) {
13
+ let [styleValue, styleClass] = mapping.split(":")
14
+ if(styleValue.trim() == fieldValue) node.classList.add(styleClass.trim())
15
+ }
16
+ }
17
+ }),
18
+
19
+ core.customizeAllColumns("*",function(node, esDoc, fieldInfo){
20
+ // Finds $styleResultRows -> ATTENTION: only first occurrence, subsequent $styleResultRows will be ignore
21
+ // TODO: remove dependency of $styleResultsRow HAVING TO HAVE ALSO $instanceDescription
22
+ const matchRowsRegex = /\$styleResultRows\((.*)\)/
23
+ let firstStyleResultsField = esDoc._definitionInfo.instanceDescription.find( field => matchRowsRegex.exec(field.description))
24
+ if(firstStyleResultsField) {
25
+ const fieldValue = esDoc[toES(firstStyleResultsField.name)] && esDoc[toES(firstStyleResultsField.name)][0];
26
+ const relevantMapping = matchRowsRegex.exec(firstStyleResultsField.description)[1].split(",")
27
+
28
+ for(let mapping of relevantMapping) {
29
+ let [styleValue, styleClass] = mapping.split(":")
30
+ if(styleValue.trim() == fieldValue) node.classList.add(styleClass.trim())
31
+ }
32
+ }
33
+ })
34
+ })
@@ -0,0 +1 @@
1
+ import("./cob/_styleResults.js");