@concretecms/bedrock 1.3.1 → 1.3.2
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.
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
</template>
|
|
32
32
|
|
|
33
33
|
<script>
|
|
34
|
+
/* global CCM_DISPATCHER_FILENAME, CCM_SERVER_EVENTS_URL, CCM_SECURITY_TOKEN */
|
|
34
35
|
/* eslint-disable no-new */
|
|
35
36
|
/* eslint eqeqeq: 0 */
|
|
36
37
|
import Icon from './Icon'
|
|
@@ -117,36 +118,45 @@ export default {
|
|
|
117
118
|
}
|
|
118
119
|
})
|
|
119
120
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
})
|
|
127
|
-
}
|
|
128
|
-
})
|
|
129
|
-
ConcreteEvent.subscribe('ConcreteServerEventBatchUpdated', function(e, data) {
|
|
130
|
-
var total = data.batch.totalJobs
|
|
131
|
-
var progress = total - data.batch.pendingJobs
|
|
132
|
-
var percent = Math.round(progress / total * 100)
|
|
133
|
-
|
|
134
|
-
my.processes.forEach(function (thisProcess) {
|
|
135
|
-
if (thisProcess.batch && thisProcess.batch.id == data.batch.id) {
|
|
136
|
-
thisProcess.progress = percent
|
|
137
|
-
thisProcess.batch = data.batch
|
|
138
|
-
}
|
|
121
|
+
if (typeof (CCM_SERVER_EVENTS_URL) !== 'undefined') {
|
|
122
|
+
const eventSourceUrl = new URL(CCM_SERVER_EVENTS_URL)
|
|
123
|
+
eventSourceUrl.searchParams.append('topic', '{+siteUrl}/concrete/events/processes/{+eventName}')
|
|
124
|
+
const eventSource = new EventSource(eventSourceUrl, {
|
|
125
|
+
withCredentials: true
|
|
139
126
|
})
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
if (
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
127
|
+
|
|
128
|
+
eventSource.onmessage = event => {
|
|
129
|
+
var data = JSON.parse(event.data)
|
|
130
|
+
if (Object.prototype.hasOwnProperty.call(data, 'batch')) {
|
|
131
|
+
// Batch Updated
|
|
132
|
+
var total = data.batch.totalJobs
|
|
133
|
+
var progress = total - data.batch.pendingJobs
|
|
134
|
+
var percent = Math.round(progress / total * 100)
|
|
135
|
+
|
|
136
|
+
my.processes.forEach(function (thisProcess) {
|
|
137
|
+
if (thisProcess.batch && thisProcess.batch.id == data.batch.id) {
|
|
138
|
+
thisProcess.progress = percent
|
|
139
|
+
thisProcess.batch = data.batch
|
|
140
|
+
}
|
|
141
|
+
})
|
|
142
|
+
} else if (Object.prototype.hasOwnProperty.call(data, 'exitCode')) {
|
|
143
|
+
// Close process
|
|
144
|
+
my.processes.forEach(function (thisProcess) {
|
|
145
|
+
if (thisProcess.id == data.process.id) {
|
|
146
|
+
thisProcess.dateCompleted = data.process.dateCompleted
|
|
147
|
+
thisProcess.dateCompletedString = data.process.dateCompletedString
|
|
148
|
+
my.completeProcess(thisProcess)
|
|
149
|
+
}
|
|
150
|
+
})
|
|
151
|
+
} else if (Object.prototype.hasOwnProperty.call(data, 'processId')) {
|
|
152
|
+
my.processes.forEach(function (thisProcess) {
|
|
153
|
+
if (thisProcess.id === data.processId) {
|
|
154
|
+
thisProcess.details.push(data.message)
|
|
155
|
+
}
|
|
156
|
+
})
|
|
147
157
|
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
150
160
|
},
|
|
151
161
|
watch: {
|
|
152
162
|
processes: {
|
package/assets/cms/js/base.js
CHANGED
|
@@ -13,9 +13,6 @@ import 'ajax-bootstrap-select'
|
|
|
13
13
|
import './modifiable-ajax-bootstrap-select'
|
|
14
14
|
import 'dropzone/dist/dropzone'
|
|
15
15
|
|
|
16
|
-
// Server events
|
|
17
|
-
import './server-events'
|
|
18
|
-
|
|
19
16
|
// jQuery UI components
|
|
20
17
|
import 'jquery-ui/ui/widgets/button'
|
|
21
18
|
import 'jquery-ui/ui/widgets/dialog'
|
package/package.json
CHANGED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-new, no-unused-vars, camelcase, eqeqeq */
|
|
2
|
-
|
|
3
|
-
class ConcreteServerEvents {
|
|
4
|
-
static listen(url, topicUrl) {
|
|
5
|
-
const eventSourceUrl = new URL(url)
|
|
6
|
-
eventSourceUrl.searchParams.append('topic', topicUrl + '/{+anything}')
|
|
7
|
-
const eventSource = new EventSource(eventSourceUrl)
|
|
8
|
-
eventSource.onmessage = event => {
|
|
9
|
-
// Will be called every time an update is published by the server
|
|
10
|
-
var data = JSON.parse(event.data)
|
|
11
|
-
var eventName = 'ConcreteServerEvent' + data.event
|
|
12
|
-
ConcreteEvent.publish(eventName, data.data)
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
global.ConcreteServerEvents = ConcreteServerEvents
|