cob-cli 2.25.0 → 2.26.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.
- package/bin/cob-cli.js +3 -1
- package/bin/handleAutoComplete.js +1 -4
- package/lib/commands/customize.js +213 -66
- package/package.json +3 -2
- package/.vscode/launch.json +0 -106
- package/customizations/backend.email.js +0 -10
- package/customizations/backend.js +0 -14
- package/customizations/backend.updateField.js +0 -11
- package/customizations/backend.vuepress.js +0 -35
- package/customizations/dashboard.dash.js +0 -14
- package/customizations/dashboard.js +0 -14
- package/customizations/dashboard.simple.js +0 -12
- package/customizations/dashboard.vue.empty.js +0 -12
- package/customizations/dashboard.vue.grid.js +0 -10
- package/customizations/dashboard.vue.js +0 -14
- package/customizations/dashboard.vue.menuAndGrid.js +0 -10
- package/customizations/frontend.common.js +0 -16
- package/customizations/frontend.easy.js +0 -16
- package/customizations/frontend.formatList.currency.js +0 -17
- package/customizations/frontend.formatList.js +0 -13
- package/customizations/frontend.js +0 -14
- package/customizations/importer.js +0 -10
- package/customizations/keywords.audit.js +0 -18
- package/customizations/keywords.calc.js +0 -18
- package/customizations/keywords.image.js +0 -16
- package/customizations/keywords.js +0 -17
- package/customizations/keywords.kibana.js +0 -16
- package/customizations/keywords.log.js +0 -18
- package/customizations/keywords.styleResults.js +0 -18
- package/templates/backend/vuepress/integrationm/actions/getVuePressDoc.groovy +0 -74
- package/templates/backend/vuepress/integrationm/actions/getVuePressSidebarConfig.groovy +0 -42
- package/templates/backend/vuepress/integrationm/actions/getVuePressSidebarRootElements.groovy +0 -17
- package/templates/backend/vuepress/others/vuepress/definition_contents_v234.json +0 -619
- package/templates/backend/vuepress/others/vuepress/nginx/README.md +0 -28
- package/templates/backend/vuepress/others/vuepress/package-lock.json +0 -29656
- package/templates/backend/vuepress/others/vuepress/package.json +0 -24
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/components/DescriptVideo.vue +0 -22
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/components/Graph.vue +0 -124
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/components/ReadingTime.vue +0 -26
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/components/References.vue +0 -228
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/components/RestrictedContent.vue +0 -77
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/config.js +0 -101
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/config.json +0 -31
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/enhanceApp.js +0 -14
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/nav/getNavTranslated.js +0 -52
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/plugins/References.js +0 -96
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/public/Logo-Cult-of-Bits-400x400-1.png +0 -0
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/public/favicon-cob.png +0 -0
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/public/logo.png +0 -0
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/styles/index.styl +0 -39
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/styles/palette.styl +0 -17
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/theme/LICENSE +0 -21
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/theme/README.md +0 -11
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/theme/components/AlgoliaSearchBox.vue +0 -172
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/theme/components/DropdownLink.vue +0 -252
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/theme/components/DropdownTransition.vue +0 -33
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/theme/components/Home.vue +0 -134
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/theme/components/NavLink.vue +0 -98
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/theme/components/NavLinks.vue +0 -165
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/theme/components/Navbar.vue +0 -140
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/theme/components/Page.vue +0 -31
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/theme/components/PageEdit.vue +0 -119
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/theme/components/PageNav.vue +0 -163
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/theme/components/Sidebar.vue +0 -64
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/theme/components/SidebarButton.vue +0 -40
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/theme/components/SidebarGroup.vue +0 -144
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/theme/components/SidebarLink.vue +0 -140
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/theme/components/SidebarLinks.vue +0 -114
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/theme/global-components/Badge.vue +0 -44
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/theme/global-components/CodeBlock.vue +0 -41
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/theme/global-components/CodeGroup.vue +0 -120
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/theme/index.js +0 -59
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/theme/layouts/404.vue +0 -30
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/theme/layouts/Layout.vue +0 -151
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/theme/noopModule.js +0 -1
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/theme/package.json +0 -44
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/theme/styles/arrow.styl +0 -22
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/theme/styles/code.styl +0 -137
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/theme/styles/config.styl +0 -1
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/theme/styles/custom-blocks.styl +0 -44
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/theme/styles/index.styl +0 -202
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/theme/styles/mobile.styl +0 -37
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/theme/styles/toc.styl +0 -3
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/theme/styles/wrapper.styl +0 -10
- package/templates/backend/vuepress/others/vuepress/src/.vuepress/theme/util/index.js +0 -244
- package/templates/dashboards/cob-dashboard-html/demoDashboard.html +0 -18
- package/templates/dashboards/cob-dashboard-vue/package-lock.json +0 -25020
- package/templates/dashboards/cob-dashboard-vue/package.json +0 -21
- package/templates/dashboards/cob-dashboard-vue/src/App.vue +0 -26
- package/templates/dashboards/cob-dashboard-vue/src/dashboard.html +0 -31
- package/templates/dashboards/cob-dashboard-vue/src/main.js +0 -12
- package/templates/dashboards/cob-dashboard-vue/src/plugins/cobUiVueComponents.js +0 -6
- package/templates/dashboards/cob-dashboard-vue/src/plugins/vuetify.js +0 -9
- package/templates/dashboards/cob-dashboard-vue/vue.config.js +0 -104
- package/templates/dashboards/dash/dist/css/app.7b16c01a.css +0 -11
- package/templates/dashboards/dash/dist/dashboard.html +0 -25
- package/templates/dashboards/dash/dist/fonts/fa-brands-400.a78ffbbe.ttf +0 -0
- package/templates/dashboards/dash/dist/fonts/fa-brands-400.cd2b4095.woff2 +0 -0
- package/templates/dashboards/dash/dist/fonts/fa-regular-400.b1a1bebb.ttf +0 -0
- package/templates/dashboards/dash/dist/fonts/fa-regular-400.e8a1ba41.woff2 +0 -0
- package/templates/dashboards/dash/dist/fonts/fa-solid-900.55b416a8.woff2 +0 -0
- package/templates/dashboards/dash/dist/fonts/fa-solid-900.73820155.ttf +0 -0
- package/templates/dashboards/dash/dist/fonts/fa-v4compatibility.0d6f5f18.ttf +0 -0
- package/templates/dashboards/dash/dist/fonts/fa-v4compatibility.786e6b33.woff2 +0 -0
- package/templates/dashboards/dash/dist/js/app.13b950c8.js +0 -199
- package/templates/dashboards/dash/dist/js/app.13b950c8.js.map +0 -1
- package/templates/dashboards/dash/package-lock.json +0 -22646
- package/templates/dashboards/dash/package.json +0 -27
- package/templates/dashboards/dash/src/App.vue +0 -124
- package/templates/dashboards/dash/src/assets/css/all.min.css +0 -6
- package/templates/dashboards/dash/src/assets/webfonts/fa-brands-400.ttf +0 -0
- package/templates/dashboards/dash/src/assets/webfonts/fa-brands-400.woff2 +0 -0
- package/templates/dashboards/dash/src/assets/webfonts/fa-regular-400.ttf +0 -0
- package/templates/dashboards/dash/src/assets/webfonts/fa-regular-400.woff2 +0 -0
- package/templates/dashboards/dash/src/assets/webfonts/fa-solid-900.ttf +0 -0
- package/templates/dashboards/dash/src/assets/webfonts/fa-solid-900.woff2 +0 -0
- package/templates/dashboards/dash/src/assets/webfonts/fa-v4compatibility.ttf +0 -0
- package/templates/dashboards/dash/src/assets/webfonts/fa-v4compatibility.woff2 +0 -0
- package/templates/dashboards/dash/src/collector.js +0 -222
- package/templates/dashboards/dash/src/components/Attention.vue +0 -30
- package/templates/dashboards/dash/src/components/Board.vue +0 -35
- package/templates/dashboards/dash/src/components/Calendar.vue +0 -422
- package/templates/dashboards/dash/src/components/Dashboard.vue +0 -27
- package/templates/dashboards/dash/src/components/Filter.vue +0 -68
- package/templates/dashboards/dash/src/components/Kibana.vue +0 -138
- package/templates/dashboards/dash/src/components/Label.vue +0 -15
- package/templates/dashboards/dash/src/components/Menu.vue +0 -44
- package/templates/dashboards/dash/src/components/Totals.vue +0 -49
- package/templates/dashboards/dash/src/components/TotalsValue.vue +0 -59
- package/templates/dashboards/dash/src/components/shared/Instance.vue +0 -64
- package/templates/dashboards/dash/src/components/shared/Waiting.vue +0 -25
- package/templates/dashboards/dash/src/dashboard.html +0 -39
- package/templates/dashboards/dash/src/definition_dashboard_v0.json +0 -924
- package/templates/dashboards/dash/src/definition_dashboard_v1.json +0 -1
- package/templates/dashboards/dash/src/input.css +0 -9
- package/templates/dashboards/dash/src/main.js +0 -11
- package/templates/dashboards/dash/src/model/ComponentStatePersistence.js +0 -66
- package/templates/dashboards/dash/src/output.css +0 -314245
- package/templates/dashboards/dash/src/test_collector.js +0 -3719
- package/templates/dashboards/dash/src/utils/EsInstanceUtils.js +0 -8
- package/templates/dashboards/dash/tailwind.config.js +0 -12
- package/templates/dashboards/dash/vue.config.js +0 -104
- package/templates/frontend/common/templates/frontend/common/css/_dualColumn.css +0 -46
- package/templates/frontend/common/templates/frontend/common/css/_global.css +0 -19
- package/templates/frontend/common/templates/frontend/common/css/_hidden.css +0 -13
- package/templates/frontend/common/templates/frontend/common/css/_history.css +0 -13
- package/templates/frontend/common/templates/frontend/common/css/_mobile.css +0 -125
- package/templates/frontend/common/templates/frontend/common/css/customizations.__MERGE__.css +0 -5
- package/templates/frontend/common/templates/frontend/common/js/cob/_disable_save_onSubdetail.js +0 -11
- package/templates/frontend/common/templates/frontend/common/js/cob/_group_references.js +0 -22
- package/templates/frontend/common/templates/frontend/common/js/cob/_show_hidden.js +0 -35
- package/templates/frontend/common/templates/frontend/common/js/customizations2.__MERGE__.js +0 -3
- package/templates/frontend/common/templates/frontend/common/package.json +0 -3
- package/templates/frontend/easy/css/_easy/googlefonts.css +0 -360
- package/templates/frontend/easy/css/_easy/vuetify.cob-scoped.css +0 -10488
- package/templates/frontend/easy/js/_easy/lib/axios.min.js +0 -9
- package/templates/frontend/easy/js/_easy/lib/marked.min.js +0 -6
- package/templates/frontend/easy/js/_easy/lib/vue.js +0 -11912
- package/templates/frontend/easy/js/_easy/lib/vue.min.js +0 -6
- package/templates/frontend/easy/js/_easy/lib/vuetify.min.js +0 -6
- package/templates/frontend/easy/js/customizations2.__MERGE__.js +0 -22
- package/templates/frontend/easy/webapp/.browserslistrc +0 -2
- package/templates/frontend/easy/webapp/.eslintrc.js +0 -17
- package/templates/frontend/easy/webapp/README.md +0 -60
- package/templates/frontend/easy/webapp/babel.config.js +0 -5
- package/templates/frontend/easy/webapp/dist/css/app.a4fb91f8.css +0 -1
- package/templates/frontend/easy/webapp/dist/dashboard.html +0 -13
- package/templates/frontend/easy/webapp/dist/js/app.63a57dcd.js +0 -2
- package/templates/frontend/easy/webapp/dist/js/app.63a57dcd.js.map +0 -1
- package/templates/frontend/easy/webapp/package-lock.json +0 -32986
- package/templates/frontend/easy/webapp/package.json +0 -32
- package/templates/frontend/easy/webapp/postcss.config.js +0 -5
- package/templates/frontend/easy/webapp/public/dashboard.html +0 -13
- package/templates/frontend/easy/webapp/src/App.vue +0 -181
- package/templates/frontend/easy/webapp/src/assets/logo.png +0 -0
- package/templates/frontend/easy/webapp/src/components/HelloWorld.vue +0 -59
- package/templates/frontend/easy/webapp/src/components/PermBuilder.vue +0 -163
- package/templates/frontend/easy/webapp/src/components/PlanExecutor.vue +0 -225
- package/templates/frontend/easy/webapp/src/components/ProductPermBuilder.vue +0 -95
- package/templates/frontend/easy/webapp/src/components/RmDefinitionChooser.vue +0 -59
- package/templates/frontend/easy/webapp/src/components/RmDomainChooser.vue +0 -60
- package/templates/frontend/easy/webapp/src/components/RoleBuilder.vue +0 -73
- package/templates/frontend/easy/webapp/src/main.js +0 -19
- package/templates/frontend/easy/webapp/src/perm-templates.js +0 -189
- package/templates/frontend/easy/webapp/src/perms.js +0 -197
- package/templates/frontend/easy/webapp/vue.config.js +0 -66
- package/templates/frontend/formatList/currency/css/_format_currency.css +0 -11
- package/templates/frontend/formatList/currency/css/customizations.__MERGE__.css +0 -1
- package/templates/frontend/formatList/currency/js/cob/_format_currency.js +0 -11
- package/templates/frontend/formatList/currency/js/customizations2.__MERGE__.js +0 -1
- package/templates/frontend/formatList/currency/package.json +0 -3
- package/templates/gitignore +0 -14
- package/templates/keywords/audit/backend/scripts/_audit.groovy +0 -78
- package/templates/keywords/audit/frontend/js/cob/_audit.js +0 -24
- package/templates/keywords/audit/frontend/js/customizations2.__MERGE__.js +0 -1
- package/templates/keywords/audit/package.json +0 -3
- package/templates/keywords/calc/backend/scripts/_calc.groovy +0 -151
- package/templates/keywords/calc/frontend/js/cob/_calc.js +0 -193
- package/templates/keywords/calc/frontend/js/customizations2.__MERGE__.js +0 -1
- package/templates/keywords/calc/package.json +0 -3
- package/templates/keywords/image/frontend/js/cob/_image.js +0 -30
- package/templates/keywords/image/frontend/js/customizations2.__MERGE__.js +0 -1
- package/templates/keywords/image/package.json +0 -3
- package/templates/keywords/kibana/frontend/js/cob/_kibana.js +0 -58
- package/templates/keywords/kibana/frontend/js/customizations2.__MERGE__.js +0 -1
- package/templates/keywords/kibana/package.json +0 -3
- package/templates/keywords/log/backend/scripts/_log.groovy +0 -95
- package/templates/keywords/log/frontend/css/_log.css +0 -5
- package/templates/keywords/log/frontend/css/customizations.__MERGE__.css +0 -1
- package/templates/keywords/log/package.json +0 -3
- package/templates/keywords/styleResults/frontend/css/_styleResults.css +0 -86
- package/templates/keywords/styleResults/frontend/css/customizations.__MERGE__.css +0 -1
- package/templates/keywords/styleResults/frontend/js/cob/_styleResults.js +0 -38
- package/templates/keywords/styleResults/frontend/js/customizations2.__MERGE__.js +0 -1
- package/templates/keywords/styleResults/package.json +0 -3
|
@@ -1,422 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :class='["relative", classes]'>
|
|
3
|
-
|
|
4
|
-
<Waiting :active='updatingFlag || debouncing' :interactable='debouncing'/>
|
|
5
|
-
|
|
6
|
-
<div>
|
|
7
|
-
<div class='mb-4 text-center text-4xl'>{{ monthTitle }} {{ yearTitle }}</div>
|
|
8
|
-
<FullCalendar ref='fullCalendar' :options='calendarOptions'/>
|
|
9
|
-
</div>
|
|
10
|
-
|
|
11
|
-
</div>
|
|
12
|
-
</template>
|
|
13
|
-
|
|
14
|
-
<script>
|
|
15
|
-
import '@fullcalendar/core/vdom'
|
|
16
|
-
import FullCalendar from '@fullcalendar/vue'
|
|
17
|
-
import dayGridPlugin from '@fullcalendar/daygrid'
|
|
18
|
-
import interactionPlugin from '@fullcalendar/interaction'
|
|
19
|
-
import listPlugin from '@fullcalendar/list'
|
|
20
|
-
import allLocales from '@fullcalendar/core/locales-all';
|
|
21
|
-
import {instancesList} from '@cob/dashboard-info';
|
|
22
|
-
import Waiting from './shared/Waiting.vue'
|
|
23
|
-
import debounce from 'lodash.debounce';
|
|
24
|
-
import {toEsFieldName} from '@cob/rest-api-wrapper/src/utils/ESHelper';
|
|
25
|
-
import rmListDefinitions from '@cob/rest-api-wrapper/src/rmListDefinitions';
|
|
26
|
-
import tippy from 'tippy.js';
|
|
27
|
-
import Instance from "@/components/shared/Instance";
|
|
28
|
-
import Vue from "vue";
|
|
29
|
-
import ComponentStatePersistence from "@/model/ComponentStatePersistence";
|
|
30
|
-
|
|
31
|
-
const DEFAULT_EVENT_COLOR = '#0e7bbe'
|
|
32
|
-
const MAX_VISIBLE_DAY_EVENTS = 3
|
|
33
|
-
|
|
34
|
-
export default {
|
|
35
|
-
components: {
|
|
36
|
-
FullCalendar,
|
|
37
|
-
Waiting,
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
props: {
|
|
41
|
-
component: Object,
|
|
42
|
-
userInfo: Object
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
data: () => ({
|
|
46
|
-
rmEventSources: [], // Array with a DashInfo(...) for each event source spec
|
|
47
|
-
createDefinitionId: null,
|
|
48
|
-
|
|
49
|
-
monthTitle: null,
|
|
50
|
-
yearTitle: null,
|
|
51
|
-
dateRange: null, // array: [initDate, endDate]
|
|
52
|
-
|
|
53
|
-
calendarApi: null,
|
|
54
|
-
debouncing: false,
|
|
55
|
-
calendarOptions: {
|
|
56
|
-
plugins: [dayGridPlugin, interactionPlugin, listPlugin],
|
|
57
|
-
timeZone: 'local',
|
|
58
|
-
locales: allLocales,
|
|
59
|
-
// Take in consideration updating the initial state value of `activeView` if you change this value
|
|
60
|
-
initialView: 'dayGridWeek',
|
|
61
|
-
headerToolbar: {
|
|
62
|
-
left: 'today prev next',
|
|
63
|
-
center: '',
|
|
64
|
-
right: 'dayGridWeek,dayGridMonth,listMonth'
|
|
65
|
-
},
|
|
66
|
-
buttonText: {
|
|
67
|
-
today: 'Today',
|
|
68
|
-
week: 'Week',
|
|
69
|
-
month: 'Month',
|
|
70
|
-
list: 'List',
|
|
71
|
-
},
|
|
72
|
-
height: 'auto',
|
|
73
|
-
contentHeight: 'auto',
|
|
74
|
-
aspectRatio: 2,
|
|
75
|
-
validRange: {
|
|
76
|
-
start: '1970-01-01'
|
|
77
|
-
},
|
|
78
|
-
noEventsContent: {html: '<div> </div>'}
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
// Need the debouncer to delay the change of the calendar option to make a day selectable because it's impossible
|
|
82
|
-
// to know if there is a tooltip open.
|
|
83
|
-
lazyCalendarConfigurer: debounce((calendarApi, enable) => calendarApi.setOption('selectable', enable), 500),
|
|
84
|
-
|
|
85
|
-
statePersistence: Object,
|
|
86
|
-
}),
|
|
87
|
-
|
|
88
|
-
created() {
|
|
89
|
-
this.calendarOptions.initialView = this.eventView[0]
|
|
90
|
-
this.calendarOptions.headerToolbar.right = this.eventView.join(",")
|
|
91
|
-
|
|
92
|
-
this.statePersistence = new ComponentStatePersistence(this.component.id, this.updateCalendarBasedOnPersistedStateChange)
|
|
93
|
-
|
|
94
|
-
// Setup a dashInfo placeholder for each event source, initially with a zero result query ( "-*") so it has a fast response
|
|
95
|
-
for(let i in this.eventSources) {
|
|
96
|
-
this.rmEventSources.push( instancesList( this.eventSources[i]['Definition'], "-*", 800, 0, "", {validity: 60}) )
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// If configured get the definition id to allow instance creation
|
|
100
|
-
if(this.createDefinition) {
|
|
101
|
-
rmListDefinitions({name: this.createDefinition, includeDisabled: true})
|
|
102
|
-
.then( definitions => {
|
|
103
|
-
if (definitions.length) {
|
|
104
|
-
this.createDefinitionId = definitions[0].id
|
|
105
|
-
} else {
|
|
106
|
-
cob.ui.notification.showError(`Unable to find definition ${this.definition}`)
|
|
107
|
-
}
|
|
108
|
-
})
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
|
|
112
|
-
mounted() {
|
|
113
|
-
// Now that we have DOM finish calendar configuration
|
|
114
|
-
const calendarApi = this.$refs.fullCalendar.getApi()
|
|
115
|
-
this.calendarApi = calendarApi
|
|
116
|
-
this.initialDate = calendarApi.getDate()
|
|
117
|
-
|
|
118
|
-
calendarApi.setOption('dayMaxEvents', this.dayMaxEvents === -1 ? false : this.dayMaxEvents)
|
|
119
|
-
calendarApi.setOption('locale', navigator.language ? navigator.languages[0] : undefined )
|
|
120
|
-
calendarApi.setOption('selectMinDistance', !this.endDateField ? 1 : 0) //only allow to select on day if no end date field is available
|
|
121
|
-
calendarApi.setOption('selectable', this.allowCreateInstances)
|
|
122
|
-
calendarApi.setOption('select', this.redirectToNewInstance)
|
|
123
|
-
calendarApi.setOption('viewDidMount', this.updatePersistedStateBasedOnCalendarChange)
|
|
124
|
-
|
|
125
|
-
const lazyEventsLoader = debounce((dateInfo) => {
|
|
126
|
-
this.debouncing = false
|
|
127
|
-
this.updatePersistedStateBasedOnCalendarChange()
|
|
128
|
-
this.dateRange = [dateInfo.start, dateInfo.end]
|
|
129
|
-
}, 800)
|
|
130
|
-
|
|
131
|
-
calendarApi.setOption('datesSet', (dateInfo) => {
|
|
132
|
-
// Reflect immediately the change in the title and set 'debouncing' to 'true' to signal change in progress
|
|
133
|
-
const currentDate = calendarApi.getDate()
|
|
134
|
-
this.monthTitle = currentDate.toLocaleString('default', {month: 'long'});
|
|
135
|
-
this.yearTitle = currentDate.getFullYear()
|
|
136
|
-
this.debouncing = true
|
|
137
|
-
|
|
138
|
-
// 'debounce' loading the events (ie, wait for some user inactivity)
|
|
139
|
-
lazyEventsLoader(dateInfo)
|
|
140
|
-
})
|
|
141
|
-
|
|
142
|
-
calendarApi.setOption('eventClick', (eventClickInfo) => {
|
|
143
|
-
// Check if there is already a tooltip instance associated to the element
|
|
144
|
-
// if not let's create one,
|
|
145
|
-
if (!eventClickInfo.el._tippy) {
|
|
146
|
-
// When list view is active I have to look for a different tooltip anchor
|
|
147
|
-
let listViewActive = eventClickInfo.view.type.match(/list.*/)
|
|
148
|
-
const element = listViewActive
|
|
149
|
-
? eventClickInfo.el.getElementsByClassName('fc-list-event-title')[0].children[0]
|
|
150
|
-
: eventClickInfo.el
|
|
151
|
-
// tippy will handle hide and show of existing tooltips. We just need to trigger the show
|
|
152
|
-
this.buildTooltipInstance(element, eventClickInfo.event.extendedProps.esInstance, listViewActive).show()
|
|
153
|
-
}
|
|
154
|
-
})
|
|
155
|
-
},
|
|
156
|
-
|
|
157
|
-
beforeDestroy() {
|
|
158
|
-
this.statePersistence.stop()
|
|
159
|
-
for (var i=0; i < this.rmEventSources.length; i++) {
|
|
160
|
-
this.rmEventSources[i].stopUpdates()
|
|
161
|
-
}
|
|
162
|
-
},
|
|
163
|
-
|
|
164
|
-
computed: {
|
|
165
|
-
// Customizations component model
|
|
166
|
-
options() { return this.component['CalendarCustomize'][0] },
|
|
167
|
-
classes() { return this.options['CalendarClasses'] || 'p-4' },
|
|
168
|
-
inputVarCalendar() { return this.options['InputVarCalendar'] || [] },
|
|
169
|
-
allowCreateInstances() { return this.options['AllowCreateInstances'] === 'TRUE' || false},
|
|
170
|
-
createDefinition() { return this.options['CreateDefinition'] },
|
|
171
|
-
eventView() { return this.options['EventViews'] && this.options['EventViews'].split(',') || ['dayGridWeek','dayGridMonth','listMonth'] },
|
|
172
|
-
outputVar() { return this.options['OutputVarCalendar'] || '' },
|
|
173
|
-
dayMaxEvents() { return parseInt(this.options['MaxVisibleDayEvents'], 10) || MAX_VISIBLE_DAY_EVENTS },
|
|
174
|
-
|
|
175
|
-
// Calendar component model
|
|
176
|
-
eventSources() { return this.component['Events'] },
|
|
177
|
-
|
|
178
|
-
// Behavior component model
|
|
179
|
-
updatingFlag() { return this.eventSources.map(source => source.state == "loading" || source.state == "updating" ).reduce( (acc,v) => acc || v, false) }, //True if any source is loading|updating
|
|
180
|
-
|
|
181
|
-
queries() {
|
|
182
|
-
let queries = []
|
|
183
|
-
if (this.dateRange) { // Only calculate queries after having a dateRange set by the calendar
|
|
184
|
-
for(let i in this.eventSources) {
|
|
185
|
-
// Calculate date range query part
|
|
186
|
-
let startField = toEsFieldName(this.eventSources[i]['DateStartEventField'])
|
|
187
|
-
let endField = toEsFieldName(this.eventSources[i]['DateEndEventField'])
|
|
188
|
-
let dateRangeQuery = `(${startField}:[${this.dateRange[0].getTime()} TO ${this.dateRange[1].getTime()}])`
|
|
189
|
-
if (endField) {
|
|
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()})`
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
// Calculate final query
|
|
195
|
-
const eventQuery = this.eventSources[i]['EventsQuery'] && this.eventSources[i]['EventsQuery'].replace(/__USERNAME__/g, this.userInfo.username) || '*'
|
|
196
|
-
const baseQuery = `${eventQuery} AND (${dateRangeQuery})`
|
|
197
|
-
const inputVars = new Set(this.inputVarCalendar.map(inputVar => inputVar['InputVarCalendar']));
|
|
198
|
-
const finalQuery = `${baseQuery} ${[...inputVars].map(inputVar => this.component.vars[inputVar]).join(' ')}`.trim()
|
|
199
|
-
|
|
200
|
-
queries.push(finalQuery)
|
|
201
|
-
|
|
202
|
-
// If set, the 'outputVar' should be a query reflecting the current date range displayed on the calendar. Since we can use only one date_field for the query we opt to use the first(0) "Event Source" specs
|
|
203
|
-
if (i==0 && this.outputVar) this.$set(this.component.vars, this.outputVar, dateRangeQuery)
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
return queries
|
|
207
|
-
},
|
|
208
|
-
|
|
209
|
-
allResults() {
|
|
210
|
-
let results = []
|
|
211
|
-
for (var i=0; i<this.rmEventSources.length;i++) {
|
|
212
|
-
const rmEventSource = this.rmEventSources[i]
|
|
213
|
-
if (rmEventSource.results && rmEventSource.results.value) {
|
|
214
|
-
for(let result of rmEventSource.results.value) {
|
|
215
|
-
result["DESCRIPTION FIELD"] = toEsFieldName(this.eventSources[i]['DescriptionEventField'])
|
|
216
|
-
result["STATE FIELD"] = toEsFieldName(this.eventSources[i]['StateEventField'])
|
|
217
|
-
result["START DATE FIELD"] = toEsFieldName(this.eventSources[i]['DateStartEventField'])
|
|
218
|
-
result["END DATE FIELD"] = toEsFieldName(this.eventSources[i]['DateEndEventField'])
|
|
219
|
-
results.push(result)
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
return results
|
|
224
|
-
}
|
|
225
|
-
},
|
|
226
|
-
|
|
227
|
-
watch: {
|
|
228
|
-
queries: function(newQueries) {
|
|
229
|
-
this.calendarApi.setOption('noEventsContent', {html: '<div> </div>'})
|
|
230
|
-
for (var i=0; i<newQueries.length; i++) {
|
|
231
|
-
this.rmEventSources[i].changeArgs({query: newQueries[i]})
|
|
232
|
-
}
|
|
233
|
-
},
|
|
234
|
-
|
|
235
|
-
allResults: function(esInstances) {
|
|
236
|
-
const newCalendarEvents = this.buildCalendarEvents(esInstances)
|
|
237
|
-
const calendarApi = this.calendarApi
|
|
238
|
-
|
|
239
|
-
calendarApi.batchRendering(() => {
|
|
240
|
-
calendarApi.getEvents().forEach(event => event.remove())
|
|
241
|
-
newCalendarEvents.forEach(event => calendarApi.addEvent(event))
|
|
242
|
-
})
|
|
243
|
-
|
|
244
|
-
if (esInstances.length === 0) {
|
|
245
|
-
this.calendarApi.setOption('noEventsContent', {html: '<div>No events to display</div>'})
|
|
246
|
-
}
|
|
247
|
-
},
|
|
248
|
-
},
|
|
249
|
-
|
|
250
|
-
methods: {
|
|
251
|
-
updateCalendarBasedOnPersistedStateChange(newContent = {}) {
|
|
252
|
-
if(!this.calendarApi) {
|
|
253
|
-
setTimeout(() => this.updateCalendarBasedOnPersistedStateChange(newContent),100)
|
|
254
|
-
} else {
|
|
255
|
-
this.calendarApi.gotoDate(newContent.initialDate ? newContent.initialDate : this.initialDate )
|
|
256
|
-
this.calendarApi.changeView(newContent.activeView ? newContent.activeView : this.calendarOptions.initialView )
|
|
257
|
-
}
|
|
258
|
-
},
|
|
259
|
-
|
|
260
|
-
updatePersistedStateBasedOnCalendarChange() {
|
|
261
|
-
const activeView = this.calendarApi.view.type
|
|
262
|
-
const currentDate = this.calendarApi.getDate()
|
|
263
|
-
const newState = { }
|
|
264
|
-
if(JSON.stringify(currentDate) != JSON.stringify(this.initialDate)) newState.initialDate = `${currentDate.getFullYear()}-${("0" + (currentDate.getMonth() + 1)).slice(-2)}-01`
|
|
265
|
-
if(activeView != this.calendarOptions.initialView) newState.activeView = activeView
|
|
266
|
-
if(newState.initialDate || newState.activeView ) this.statePersistence.content = newState
|
|
267
|
-
},
|
|
268
|
-
|
|
269
|
-
buildCalendarEvents(instances) {
|
|
270
|
-
return instances
|
|
271
|
-
.map(esInstance => {
|
|
272
|
-
const startDateField = esInstance["START DATE FIELD"]
|
|
273
|
-
const endDateField = esInstance["END DATE FIELD"]
|
|
274
|
-
const descriptionEventField = esInstance["DESCRIPTION FIELD"]
|
|
275
|
-
const stateField = esInstance["STATE FIELD"]
|
|
276
|
-
|
|
277
|
-
const title = esInstance[descriptionEventField] || [esInstance.id]
|
|
278
|
-
const startDate = new Date(parseInt(esInstance[startDateField][0], 10))
|
|
279
|
-
const endDate = endDateField ? new Date(parseInt(esInstance[endDateField][0], 10)) : null
|
|
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
|
-
|
|
290
|
-
return {
|
|
291
|
-
id: `calendar-event-${esInstance.id}`,
|
|
292
|
-
title: title[0] + (title.length > 1 ? `(${title.length})` : ''),
|
|
293
|
-
start: startDate,
|
|
294
|
-
end: endDate,
|
|
295
|
-
allDay: false,
|
|
296
|
-
backgroundColor: color,
|
|
297
|
-
|
|
298
|
-
// from: https://fullcalendar.io/docs/event-object
|
|
299
|
-
// In addition to the fields above, you may also include your own non-standard fields in each Event object.
|
|
300
|
-
// FullCalendar will not modify or delete these fields. For example, developers often include a description
|
|
301
|
-
// field for use in callbacks like event render hooks. Any non-standard properites are moved into the
|
|
302
|
-
// extendedProps hash during event parsing.
|
|
303
|
-
esInstance,
|
|
304
|
-
}
|
|
305
|
-
})
|
|
306
|
-
},
|
|
307
|
-
|
|
308
|
-
buildTooltipInstance(el, esInstance, listViewActive) {
|
|
309
|
-
const calendarApi = this.$refs.fullCalendar.getApi()
|
|
310
|
-
|
|
311
|
-
return tippy(el, {
|
|
312
|
-
content: new Vue(Object.assign({propsData: {esInstance}}, Instance)).$mount().$el,
|
|
313
|
-
allowHTML: true,
|
|
314
|
-
delay: 100,
|
|
315
|
-
duration: 0,
|
|
316
|
-
placement: listViewActive ? 'right' : 'top',
|
|
317
|
-
interactive: true,
|
|
318
|
-
trigger: 'click',
|
|
319
|
-
offset: [0, 10],
|
|
320
|
-
onShown: () => {
|
|
321
|
-
this.lazyCalendarConfigurer(calendarApi, false)
|
|
322
|
-
},
|
|
323
|
-
onHidden: () => {
|
|
324
|
-
this.lazyCalendarConfigurer(calendarApi, this.allowCreateInstances)
|
|
325
|
-
},
|
|
326
|
-
onDestroy: () => {
|
|
327
|
-
this.lazyCalendarConfigurer(calendarApi, this.allowCreateInstances)
|
|
328
|
-
},
|
|
329
|
-
})
|
|
330
|
-
},
|
|
331
|
-
|
|
332
|
-
redirectToNewInstance(dateInfo) {
|
|
333
|
-
if (dateInfo.jsEvent.target.classList.contains("js-instance-label")) {
|
|
334
|
-
// It's not a create operation, the user clicked in the instance label in the tooltip
|
|
335
|
-
return
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
const fields = []
|
|
339
|
-
// Since we need to choose only 1 set of fields use the first source spec (eventSources[0])
|
|
340
|
-
fields.push({fieldDefinition: {name: this.eventSources[0]['DateStartEventField']}, value: dateInfo.start.getTime()})
|
|
341
|
-
|
|
342
|
-
if (this.eventSources[0]['DateEndEventField']) {
|
|
343
|
-
fields.push({fieldDefinition: {name: this.eventSources[0]['DateEndEventField']}, value: dateInfo.end.getTime()})
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
cob.app.navigateTo('#/instance/create/' + this.createDefinitionId + '/data=' + JSON.stringify({
|
|
347
|
-
opts: {'auto-paste-if-empty': true},
|
|
348
|
-
fields,
|
|
349
|
-
}));
|
|
350
|
-
},
|
|
351
|
-
|
|
352
|
-
textToRGB: function(text) {
|
|
353
|
-
let hash = 0;
|
|
354
|
-
for (let i = 0; i < text.length; i++) {
|
|
355
|
-
hash = text.charCodeAt(i) + ((hash << 2) - hash)
|
|
356
|
-
}
|
|
357
|
-
hash = hash & 0x00FFFFFF
|
|
358
|
-
|
|
359
|
-
// Escurece em caso de côr demasiado clara
|
|
360
|
-
let red = (hash & 0x00FF0000) >> 16
|
|
361
|
-
let green = (hash & 0x0000FF00) >> 8
|
|
362
|
-
let blue = (hash & 0x000000FF)
|
|
363
|
-
|
|
364
|
-
while (red + green + blue > 382) {
|
|
365
|
-
red = red >= 10 ? red - 10 : red
|
|
366
|
-
green = green >= 10 ? green - 10 : green
|
|
367
|
-
blue = blue >= 10 ? blue - 10 : blue
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
let color = ((red << 16) + (green << 8) + blue).toString(16).toUpperCase();
|
|
371
|
-
return `#${'00000'.substring(0, 6 - color.length) + color}`
|
|
372
|
-
},
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
</script>
|
|
376
|
-
|
|
377
|
-
<style lang='css'>
|
|
378
|
-
.fc .fc-toolbar.fc-header-toolbar {
|
|
379
|
-
align-items: flex-end;
|
|
380
|
-
font-size: 0.8rem;
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
.fc .fc-toolbar.fc-header-toolbar .fc-toolbar-chunk:first-child button:not(:first-child) {
|
|
384
|
-
background-color: #fff;
|
|
385
|
-
border-color: #fff;
|
|
386
|
-
border-radius: 50%;
|
|
387
|
-
color: #000;
|
|
388
|
-
font-weight: 700;
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
.fc .fc-daygrid .fc-event,
|
|
392
|
-
.fc .fc-list-table a,
|
|
393
|
-
.fc .fc-popover .fc-event-title {
|
|
394
|
-
cursor: pointer;
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
.fc .fc-daygrid-day-top {
|
|
398
|
-
margin-bottom: 5px;
|
|
399
|
-
justify-content: center;
|
|
400
|
-
font-size: 0.8rem;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
.fc .fc-daygrid-more-link {
|
|
404
|
-
top: 10px;
|
|
405
|
-
font-weight: 600;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
.calendar-tooltip a {
|
|
409
|
-
/* calendar component when in list mode is overriding the color */
|
|
410
|
-
color: #3399CC !important;
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
.calendar-tooltip .main-info:hover {
|
|
414
|
-
text-decoration: underline;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
/* FIX para quando fazemos back de uma instância e temos o width errado */
|
|
418
|
-
.fc-col-header, .fc-scrollgrid-sync-table, .fc-daygrid-body {
|
|
419
|
-
width: 100% !important
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
</style>
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :class="classes" :style="image" >
|
|
3
|
-
<div :class="width + ' ' + grid">
|
|
4
|
-
<Board v-for="(board,i) in boards" :board="board" :key="i" :userInfo="userInfo"/>
|
|
5
|
-
</div>
|
|
6
|
-
</div>
|
|
7
|
-
</template>
|
|
8
|
-
|
|
9
|
-
<script>
|
|
10
|
-
import Board from './Board.vue'
|
|
11
|
-
|
|
12
|
-
export default {
|
|
13
|
-
components: { Board },
|
|
14
|
-
props: {
|
|
15
|
-
dashboard: Object,
|
|
16
|
-
userInfo: Object
|
|
17
|
-
},
|
|
18
|
-
computed: {
|
|
19
|
-
options() { return this.dashboard['DashboardCustomize'][0] },
|
|
20
|
-
boards() { return this.dashboard['Board'] },
|
|
21
|
-
classes() { return this.options['DashboardClasses'] || "h-full bg-cover bg-center overflow-auto p-3" },
|
|
22
|
-
width() { return this.options['Width'] || "max-w-6xl mx-auto" },
|
|
23
|
-
grid() { return this.options['Grid'] || "grid grid-flow-row-dense md:grid-cols-12" },
|
|
24
|
-
image() { return this.options['Image'] ? "background-image: url(" + this.options['Image'] + ");" : "" }
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
</script>
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="flex h-fit pb-0 justify-center items-center">
|
|
3
|
-
<textarea :class="classes"
|
|
4
|
-
v-model="inputContent"
|
|
5
|
-
ref="textarea"
|
|
6
|
-
@keydown.enter.exact.prevent
|
|
7
|
-
@keyup.enter.exact="activateFromInputChange"
|
|
8
|
-
@focus="resize"
|
|
9
|
-
@keyup="resize"
|
|
10
|
-
:placeholder="placeholder"
|
|
11
|
-
></textarea>
|
|
12
|
-
<button @click="activateFromInputChange" type="submit" class="max-h-11 p-2.5 ml-2 text-sm font-medium text-white bg-blue-700 rounded-lg border border-blue-700 hover:bg-blue-800">
|
|
13
|
-
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg>
|
|
14
|
-
</button>
|
|
15
|
-
</div>
|
|
16
|
-
</template>
|
|
17
|
-
|
|
18
|
-
<script>
|
|
19
|
-
import ComponentStatePersistence from "@/model/ComponentStatePersistence";
|
|
20
|
-
|
|
21
|
-
export default {
|
|
22
|
-
props: {
|
|
23
|
-
component: Object
|
|
24
|
-
},
|
|
25
|
-
data: () => ({
|
|
26
|
-
inputContent: "",
|
|
27
|
-
activeContent: "",
|
|
28
|
-
statePersistence: Object
|
|
29
|
-
}),
|
|
30
|
-
created() {
|
|
31
|
-
this.statePersistence = new ComponentStatePersistence(this.component.id, this.activateFromPersistenceChange)
|
|
32
|
-
},
|
|
33
|
-
beforeDestroy() {
|
|
34
|
-
this.statePersistence.stop()
|
|
35
|
-
},
|
|
36
|
-
computed: {
|
|
37
|
-
options() { return this.component['FilterCustomize'][0] },
|
|
38
|
-
outputVar() { return this.component['OutputVarFilter'] || "" },
|
|
39
|
-
placeholder() { return this.options['Placeholder'] || "Pesquisar ..." },
|
|
40
|
-
classes() { return this.options['FilterClasses'] || "w-full max-w-xs resize-none min-h-min h-min border border-slate-300 rounded-md py-2 px-2 outline-slate-300 leading-5" },
|
|
41
|
-
},
|
|
42
|
-
watch: {
|
|
43
|
-
activeContent(newActiveContent) {
|
|
44
|
-
let cleanContent = newActiveContent.replace(/\n/g,' ').trim()
|
|
45
|
-
let esFilter = cleanContent ? "(" + cleanContent +")" : "*"
|
|
46
|
-
this.$set(this.component.vars, this.outputVar, esFilter)
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
methods: {
|
|
50
|
-
activateFromInputChange() {
|
|
51
|
-
this.activeContent = this.statePersistence.content = this.inputContent || ""
|
|
52
|
-
},
|
|
53
|
-
activateFromPersistenceChange(newContent) {
|
|
54
|
-
this.activeContent = this.inputContent = newContent || ""
|
|
55
|
-
setTimeout(() => this.resize(),10) // dá tempo ao input box ter o conte
|
|
56
|
-
},
|
|
57
|
-
resize() {
|
|
58
|
-
const { textarea } = this.$refs;
|
|
59
|
-
if(this.inputContent && ( textarea.textLength >= textarea.cols || this.inputContent.split("\n").length > 1) ) {
|
|
60
|
-
textarea.style.height = "auto";
|
|
61
|
-
textarea.style.height = (textarea.scrollHeight + 2) + 'px'; // Os 14px são do padding acrescentado
|
|
62
|
-
} else {
|
|
63
|
-
textarea.style.height = "40px";
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
</script>
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<iframe id="kibana" :src="shareLink" width="100%" :onload="updateIFrameStyle()" :class="classes"></iframe>
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
|
-
<script>
|
|
6
|
-
export default {
|
|
7
|
-
props: {
|
|
8
|
-
component: Object,
|
|
9
|
-
userInfo: Object
|
|
10
|
-
},
|
|
11
|
-
data: () => ({
|
|
12
|
-
iFrame: null,
|
|
13
|
-
outputFilter: ""
|
|
14
|
-
}),
|
|
15
|
-
mounted() {
|
|
16
|
-
this.iFrame = this.$el
|
|
17
|
-
|
|
18
|
-
this.inputs.forEach(inputVar => {
|
|
19
|
-
this.$watch("component.vars."+inputVar, this.updateKibanaQuery)
|
|
20
|
-
});
|
|
21
|
-
this.updateKibanaQuery()
|
|
22
|
-
|
|
23
|
-
window.addEventListener("resize", this.updateIFrameStyle);
|
|
24
|
-
this.updateIFrameStyle();
|
|
25
|
-
|
|
26
|
-
window.addEventListener("message", this.processKibanaEvent);
|
|
27
|
-
this.processKibanaEvent();
|
|
28
|
-
},
|
|
29
|
-
computed: {
|
|
30
|
-
options() { return this.component['KibanaCustomize'][0] },
|
|
31
|
-
shareLink() { return this.component['ShareLink'] || "" },
|
|
32
|
-
classes() { return this.options['KibanaClasses'] || "" },
|
|
33
|
-
fixedQuery() { return this.options['InputQueryKibana']|| "" },
|
|
34
|
-
inputs() { return this.options['InputVarKibana'].map(v => v['InputVarKibana']) },
|
|
35
|
-
inputFilter() {
|
|
36
|
-
let filters = this.inputs.filter(v => this.component.vars[v]).map(v => this.component.vars[v]);
|
|
37
|
-
if (filters.length == 0) filters.push("*")
|
|
38
|
-
if (this.fixedQuery !== "") filters.push(" AND (" + this.fixedQuery + ")");
|
|
39
|
-
return filters.join(" ")
|
|
40
|
-
},
|
|
41
|
-
outputVar() { return this.options['OutputVarKibana'] || "" },
|
|
42
|
-
},
|
|
43
|
-
methods: {
|
|
44
|
-
updateIFrameStyle() {
|
|
45
|
-
if(!this.iFrame || !this.iFrame.contentWindow || !this.iFrame.contentWindow.document.head) {
|
|
46
|
-
//iFrame do Kibana ainda não está pronta. Voltar a tentar em 100ms
|
|
47
|
-
setTimeout( () => this.updateIFrameStyle(), 100)
|
|
48
|
-
} else {
|
|
49
|
-
// Ajusta tamanho do iFrame, de acordo com a dimensão do conteúdo, quando a aplicação estiver pronta
|
|
50
|
-
if (!this.iFrame.contentWindow.document.getElementsByClassName("application").length && !this.iFrame.contentWindow.document.getElementsByClassName("dashboardViewport").length) {
|
|
51
|
-
//Ainda está a carregar, espera mais um pouco
|
|
52
|
-
setTimeout( () => this.updateIFrameStyle(), 100)
|
|
53
|
-
} else {
|
|
54
|
-
// Visualizações ainda vai estar a carregar e o tamanho vai variando
|
|
55
|
-
// Ir actualizando de 100ms em 100ms até 3s (SlowestLoading estimado),
|
|
56
|
-
// para ter um comportamento optimizado tão instantânio qt possível
|
|
57
|
-
const SlowestLoading = 3000
|
|
58
|
-
for(let t = 100; t < SlowestLoading; t += 100) setTimeout(() => {
|
|
59
|
-
this.iFrame.style.minHeight = this.iFrame.contentWindow.document.body.scrollHeight + "px"
|
|
60
|
-
}, t)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// Ajuste ao estilo interno do Kibana, alguns condicionais às classes passadas na iFrame (se ainda não tiver sido feito)
|
|
64
|
-
if(!this.iFrame.contentWindow.document.getElementById("cobKibanaStyle")) {
|
|
65
|
-
var s = document.createElement("style");
|
|
66
|
-
s.id = "cobKibanaStyle";
|
|
67
|
-
s.appendChild(document.createTextNode([
|
|
68
|
-
"html, .kbnWelcomeView { background-color: #ffffff00 !important }"
|
|
69
|
-
, (this.classes.indexOf("kibanaEmbPanelTransparent") !== -1 ? ".euiPanel { background-color: #ffffff00 !important; border:none; box-shadow: none }" : "")
|
|
70
|
-
, (this.classes.indexOf("kibanaNoNavMenu") !== -1 ? ".kbnTopNavMenu__wrapper { display: none }" : "")
|
|
71
|
-
,".visLegend__toggle { display: none!important; }"
|
|
72
|
-
|
|
73
|
-
].join("\n")));
|
|
74
|
-
// Aplica dentro de um try catch, porque a iframe Kibana no arranque tem e deixa de ter document.head e dá um erro. Não é um problema pois voltaremos a passar aqui fruto do resize ainda por fazer.
|
|
75
|
-
try { this.iFrame.contentWindow.document.head.appendChild(s); } catch {}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
processKibanaEvent(event) {
|
|
80
|
-
// Só vale a pena reagir aos eventos de mudança de filtro no Kibana
|
|
81
|
-
if(event && event.data && event.data.filters) {
|
|
82
|
-
var filters = []
|
|
83
|
-
for (let filter of event.data.filters) {
|
|
84
|
-
let queryStr = "";
|
|
85
|
-
let negateStr = filter.meta.negate ? "-" : "";
|
|
86
|
-
let enabled = !filter.meta.disabled;
|
|
87
|
-
let key;
|
|
88
|
-
|
|
89
|
-
let query = filter.query;
|
|
90
|
-
|
|
91
|
-
if (query.query_string) {
|
|
92
|
-
// condições incluídas no próprio dashboard via query DSL
|
|
93
|
-
queryStr = query.query_string.query;
|
|
94
|
-
|
|
95
|
-
} else if (query.query) {
|
|
96
|
-
queryStr = query.query;
|
|
97
|
-
|
|
98
|
-
} else if (query.match) {
|
|
99
|
-
key = Object.keys(query.match)[0];
|
|
100
|
-
queryStr = key + ':"' + query.match[key] + '"';
|
|
101
|
-
|
|
102
|
-
} else if (query.match_phrase) {
|
|
103
|
-
key = Object.keys(query.match_phrase)[0];
|
|
104
|
-
let _phrase = query.match_phrase[key];
|
|
105
|
-
queryStr = key + ':"' + (_phrase instanceof Object ? _phrase.query : _phrase) + '"';
|
|
106
|
-
|
|
107
|
-
} else if (query.bool && query.bool.must.length === 1 && query.bool.must[0].query_string) {
|
|
108
|
-
// filtros adicionados a partir de visualizações com splits por filtros
|
|
109
|
-
queryStr = query.bool.must[0].query_string.query;
|
|
110
|
-
|
|
111
|
-
} else {
|
|
112
|
-
window.console.error('COB', "unknown filter, can't send to RM", filter);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (enabled) filters.push(negateStr + "(" + queryStr + ")");
|
|
116
|
-
}
|
|
117
|
-
this.outputFilter = filters.length > 0 ? filters.join(" AND ") : ""
|
|
118
|
-
this.$set(this.component.vars, this.outputVar, this.outputFilter)
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
updateKibanaQuery() {
|
|
122
|
-
if(!this.iFrame || !this.iFrame.contentWindow || !this.iFrame.contentWindow.document.head || !this.iFrame.contentWindow.document.getElementsByClassName("kbnTopNavMenu__wrapper").length) {
|
|
123
|
-
//O Kibana ainda não está pronto. Voltar a tentar em 100ms
|
|
124
|
-
setTimeout(this.updateKibanaQuery, 100)
|
|
125
|
-
} else if(this.inputFilter) {
|
|
126
|
-
|
|
127
|
-
if(this.iFrame.contentWindow.document.getElementsByClassName("euiLoadingChart").length > 0) {
|
|
128
|
-
//O Kibana já está pronto mas ainda está a carregar dados. Voltar a tentar em 100ms
|
|
129
|
-
setTimeout(this.updateKibanaQuery, 100)
|
|
130
|
-
} else {
|
|
131
|
-
console.debug("KIBANA QUERY: ", this.inputFilter.replaceAll("__USERNAME__",this.userInfo.username) );
|
|
132
|
-
this.iFrame.contentWindow.postMessage({"query":{ "query_string":{ "query": this.inputFilter.replaceAll("__USERNAME__",this.userInfo.username) || "*" } }}, '*');
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
</script>
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :class="classes" :style="image" v-html="label"></div>
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
|
-
<script>
|
|
6
|
-
export default {
|
|
7
|
-
props: { component: Object },
|
|
8
|
-
computed: {
|
|
9
|
-
options() { return this.component['LabelCustomize'][0] },
|
|
10
|
-
label() { return this.component['Label'] || "" },
|
|
11
|
-
classes() { return this.options['LabelClasses'] || "text-center font-bold pb-2 " },
|
|
12
|
-
image() { return this.options['Image'] ? "background-image: url(" + this.options['Image'] + ");" : "" }
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
</script>
|