fluentd-ui 0.3.9 → 0.3.10

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 (69) hide show
  1. data/ChangeLog +5 -0
  2. data/Gemfile +2 -0
  3. data/Gemfile.lock +52 -40
  4. data/README.md +21 -1
  5. data/app/assets/javascripts/enable_bootstrap_tooltip.js +3 -0
  6. data/app/assets/javascripts/vue/fluent_log.js +1 -1
  7. data/app/assets/stylesheets/common.css.scss +9 -0
  8. data/app/controllers/fluentd/settings/in_forward_controller.rb +9 -0
  9. data/app/controllers/fluentd/settings/in_http_controller.rb +9 -0
  10. data/app/controllers/fluentd/settings/in_monitor_agent_controller.rb +9 -0
  11. data/app/controllers/fluentd/settings/out_stdout_controller.rb +9 -0
  12. data/app/controllers/fluentd/settings_controller.rb +2 -0
  13. data/app/helpers/application_helper.rb +10 -0
  14. data/app/models/fluent_gem.rb +1 -1
  15. data/app/models/fluentd/agent/local_common.rb +3 -2
  16. data/app/models/fluentd/setting/in_forward.rb +44 -0
  17. data/app/models/fluentd/setting/in_http.rb +45 -0
  18. data/app/models/fluentd/setting/in_monitor_agent.rb +38 -0
  19. data/app/models/fluentd/setting/out_stdout.rb +37 -0
  20. data/app/views/fluentd/settings/source_and_output.html.haml +10 -28
  21. data/app/views/layouts/application.html.erb +7 -0
  22. data/bower.json +1 -1
  23. data/config/locales/translation_en.yml +31 -1
  24. data/config/locales/translation_ja.yml +35 -1
  25. data/config/routes.rb +16 -0
  26. data/docs/screenshots/02.png +0 -0
  27. data/docs/screenshots/dashboard.gif +0 -0
  28. data/docs/screenshots/fluentd-ui.gif +0 -0
  29. data/docs/screenshots/in_tail.gif +0 -0
  30. data/docs/screenshots/plugin.gif +0 -0
  31. data/docs/screenshots/setting.gif +0 -0
  32. data/lib/file_reverse_reader.rb +2 -1
  33. data/lib/fluentd-ui/version.rb +1 -1
  34. data/public/td-logo.png +0 -0
  35. data/spec/features/dashboard_spec.rb +42 -0
  36. data/spec/features/fluentd/setting/in_forward_spec.rb +7 -0
  37. data/spec/features/fluentd/setting/in_http_spec.rb +7 -0
  38. data/spec/features/fluentd/setting/in_monitor_agent_spec.rb +7 -0
  39. data/spec/features/fluentd/setting/out_stdout_spec.rb +7 -0
  40. data/spec/features/fluentd_status_spec.rb +36 -0
  41. data/spec/features/{fluentd/setting/out_elasticsearch_spec.rb → out_elasticsearch_spec.rb} +3 -13
  42. data/spec/features/{fluentd/setting/out_forward_spec.rb → out_forward_spec.rb} +2 -12
  43. data/spec/features/{fluentd/setting/out_td_spec.rb → out_td_spec.rb} +2 -12
  44. data/spec/features/sessions_spec.rb +6 -18
  45. data/spec/features/setting_spec.rb +33 -0
  46. data/spec/features/shared_examples/configurable_daemon_settings.rb +17 -0
  47. data/spec/features/{fluentd/setting/source_and_output_spec.rb → source_and_output_spec.rb} +2 -13
  48. data/spec/lib/file_reverse_reader_spec.rb +33 -13
  49. data/spec/models/fluent_gem_spec.rb +0 -6
  50. data/spec/models/fluentd/agent/local_common_spec.rb +29 -0
  51. data/spec/spec_helper.rb +3 -0
  52. data/spec/support/login_macro.rb +2 -2
  53. data/spec/support/stub_daemon.rb +12 -0
  54. data/vendor/assets/javascripts/bower/vue/.bower.json +5 -5
  55. data/vendor/assets/javascripts/bower/vue/dist/vue.js +200 -180
  56. data/vendor/assets/javascripts/bower/vue/dist/vue.min.js +3 -3
  57. data/vendor/assets/javascripts/bower/vue/src/api/lifecycle.js +3 -75
  58. data/vendor/assets/javascripts/bower/vue/src/compiler/transclude.js +9 -26
  59. data/vendor/assets/javascripts/bower/vue/src/directive.js +8 -7
  60. data/vendor/assets/javascripts/bower/vue/src/directives/component.js +3 -21
  61. data/vendor/assets/javascripts/bower/vue/src/directives/html.js +2 -1
  62. data/vendor/assets/javascripts/bower/vue/src/directives/repeat.js +16 -10
  63. data/vendor/assets/javascripts/bower/vue/src/instance/compile.js +116 -8
  64. data/vendor/assets/javascripts/bower/vue/src/observer/object.js +5 -14
  65. data/vendor/assets/javascripts/bower/vue/src/parsers/template.js +7 -5
  66. data/vendor/assets/javascripts/bower/vue/src/util/dom.js +21 -0
  67. data/vendor/assets/javascripts/bower/vue/src/util/merge-option.js +9 -12
  68. metadata +131 -52
  69. checksums.yaml +0 -7
@@ -18,15 +18,36 @@ var transclude = require('../compiler/transclude')
18
18
 
19
19
  exports._compile = function (el) {
20
20
  var options = this.$options
21
- if (options._linker) {
21
+ if (options._linkFn) {
22
22
  this._initElement(el)
23
- options._linker(this, el)
23
+ options._linkFn(this, el)
24
24
  } else {
25
25
  var raw = el
26
- el = transclude(el, options)
26
+ if (options._asComponent) {
27
+ // separate container element and content
28
+ var content = options._content = _.extractContent(raw)
29
+ // create two separate linekrs for container and content
30
+ var containerLinkFn =
31
+ compile(raw, options, true, true)
32
+ if (content) {
33
+ var contentLinkFn =
34
+ compile(content, options, true, true)
35
+ // call content linker now, before transclusion
36
+ this._contentUnlinkFn =
37
+ contentLinkFn(options._parent, content)
38
+ }
39
+ // tranclude, this possibly replaces original
40
+ el = transclude(el, options)
41
+ // now call the container linker on the resolved el
42
+ this._containerUnlinkFn =
43
+ containerLinkFn(options._parent, el)
44
+ } else {
45
+ // simply transclude
46
+ el = transclude(el, options)
47
+ }
27
48
  this._initElement(el)
28
- var linker = compile(el, options)
29
- linker(this, el)
49
+ var linkFn = compile(el, options)
50
+ linkFn(this, el)
30
51
  if (options.replace) {
31
52
  _.replace(raw, el)
32
53
  }
@@ -61,11 +82,98 @@ exports._initElement = function (el) {
61
82
  * @param {Node} node - target node
62
83
  * @param {Object} desc - parsed directive descriptor
63
84
  * @param {Object} def - directive definition object
64
- * @param {Function} [linker] - pre-compiled linker fn
65
85
  */
66
86
 
67
- exports._bindDir = function (name, node, desc, def, linker) {
87
+ exports._bindDir = function (name, node, desc, def) {
68
88
  this._directives.push(
69
- new Directive(name, node, this, desc, def, linker)
89
+ new Directive(name, node, this, desc, def)
70
90
  )
91
+ }
92
+
93
+ /**
94
+ * Teardown an instance, unobserves the data, unbind all the
95
+ * directives, turn off all the event listeners, etc.
96
+ *
97
+ * @param {Boolean} remove - whether to remove the DOM node.
98
+ * @param {Boolean} deferCleanup - if true, defer cleanup to
99
+ * be called later
100
+ */
101
+
102
+ exports._destroy = function (remove, deferCleanup) {
103
+ if (this._isBeingDestroyed) {
104
+ return
105
+ }
106
+ this._callHook('beforeDestroy')
107
+ this._isBeingDestroyed = true
108
+ var i
109
+ // remove self from parent. only necessary
110
+ // if parent is not being destroyed as well.
111
+ var parent = this.$parent
112
+ if (parent && !parent._isBeingDestroyed) {
113
+ i = parent._children.indexOf(this)
114
+ parent._children.splice(i, 1)
115
+ }
116
+ // destroy all children.
117
+ if (this._children) {
118
+ i = this._children.length
119
+ while (i--) {
120
+ this._children[i].$destroy()
121
+ }
122
+ }
123
+ // teardown parent linkers
124
+ if (this._containerUnlinkFn) {
125
+ this._containerUnlinkFn()
126
+ }
127
+ if (this._contentUnlinkFn) {
128
+ this._contentUnlinkFn()
129
+ }
130
+ // teardown all directives. this also tearsdown all
131
+ // directive-owned watchers. intentionally check for
132
+ // directives array length on every loop since directives
133
+ // that manages partial compilation can splice ones out
134
+ for (i = 0; i < this._directives.length; i++) {
135
+ this._directives[i]._teardown()
136
+ }
137
+ // teardown all user watchers.
138
+ for (i in this._userWatchers) {
139
+ this._userWatchers[i].teardown()
140
+ }
141
+ // remove reference to self on $el
142
+ if (this.$el) {
143
+ this.$el.__vue__ = null
144
+ }
145
+ // remove DOM element
146
+ var self = this
147
+ if (remove && this.$el) {
148
+ this.$remove(function () {
149
+ self._cleanup()
150
+ })
151
+ } else if (!deferCleanup) {
152
+ this._cleanup()
153
+ }
154
+ }
155
+
156
+ /**
157
+ * Clean up to ensure garbage collection.
158
+ * This is called after the leave transition if there
159
+ * is any.
160
+ */
161
+
162
+ exports._cleanup = function () {
163
+ // remove reference from data ob
164
+ this._data.__ob__.removeVm(this)
165
+ this._data =
166
+ this._watchers =
167
+ this._userWatchers =
168
+ this._watcherList =
169
+ this.$el =
170
+ this.$parent =
171
+ this.$root =
172
+ this._children =
173
+ this._directives = null
174
+ // call the last hook...
175
+ this._isDestroyed = true
176
+ this._callHook('destroyed')
177
+ // turn off all instance listeners.
178
+ this.$off()
71
179
  }
@@ -14,16 +14,12 @@ _.define(
14
14
  objProto,
15
15
  '$add',
16
16
  function $add (key, val) {
17
+ if (this.hasOwnProperty(key)) return
17
18
  var ob = this.__ob__
18
- if (!ob) {
19
+ if (!ob || _.isReserved(key)) {
19
20
  this[key] = val
20
21
  return
21
22
  }
22
- if (_.isReserved(key)) {
23
- _.warn('Refused to $add reserved key: ' + key)
24
- return
25
- }
26
- if (this.hasOwnProperty(key)) return
27
23
  ob.convert(key, val)
28
24
  if (ob.vms) {
29
25
  var i = ob.vms.length
@@ -50,17 +46,12 @@ _.define(
50
46
  objProto,
51
47
  '$delete',
52
48
  function $delete (key) {
49
+ if (!this.hasOwnProperty(key)) return
50
+ delete this[key]
53
51
  var ob = this.__ob__
54
- if (!ob) {
55
- delete this[key]
56
- return
57
- }
58
- if (_.isReserved(key)) {
59
- _.warn('Refused to $add reserved key: ' + key)
52
+ if (!ob || _.isReserved(key)) {
60
53
  return
61
54
  }
62
- if (!this.hasOwnProperty(key)) return
63
- delete this[key]
64
55
  if (ob.vms) {
65
56
  var i = ob.vms.length
66
57
  while (i--) {
@@ -1,6 +1,7 @@
1
1
  var _ = require('../util')
2
2
  var Cache = require('../cache')
3
- var templateCache = new Cache(100)
3
+ var templateCache = new Cache(1000)
4
+ var idSelectorCache = new Cache(1000)
4
5
 
5
6
  var map = {
6
7
  _default : [0, '', ''],
@@ -204,10 +205,11 @@ exports.clone = function (node) {
204
205
  * - id selector: '#some-template-id'
205
206
  * - template string: '<div><span>{{msg}}</span></div>'
206
207
  * @param {Boolean} clone
208
+ * @param {Boolean} noSelector
207
209
  * @return {DocumentFragment|undefined}
208
210
  */
209
211
 
210
- exports.parse = function (template, clone) {
212
+ exports.parse = function (template, clone, noSelector) {
211
213
  var node, frag
212
214
 
213
215
  // if the template is already a document fragment,
@@ -220,15 +222,15 @@ exports.parse = function (template, clone) {
220
222
 
221
223
  if (typeof template === 'string') {
222
224
  // id selector
223
- if (template.charAt(0) === '#') {
225
+ if (!noSelector && template.charAt(0) === '#') {
224
226
  // id selector can be cached too
225
- frag = templateCache.get(template)
227
+ frag = idSelectorCache.get(template)
226
228
  if (!frag) {
227
229
  node = document.getElementById(template.slice(1))
228
230
  if (node) {
229
231
  frag = nodeToFragment(node)
230
232
  // save selector to cache
231
- templateCache.put(template, frag)
233
+ idSelectorCache.put(template, frag)
232
234
  }
233
235
  }
234
236
  } else {
@@ -173,4 +173,25 @@ exports.removeClass = function (el, cls) {
173
173
  }
174
174
  el.setAttribute('class', cur.trim())
175
175
  }
176
+ }
177
+
178
+ /**
179
+ * Extract raw content inside an element into a temporary
180
+ * container div
181
+ *
182
+ * @param {Element} el
183
+ * @return {Element}
184
+ */
185
+
186
+ exports.extractContent = function (el) {
187
+ var child
188
+ var rawContent
189
+ if (el.hasChildNodes()) {
190
+ rawContent = document.createElement('div')
191
+ /* jshint boss:true */
192
+ while (child = el.firstChild) {
193
+ rawContent.appendChild(child)
194
+ }
195
+ }
196
+ return rawContent
176
197
  }
@@ -234,25 +234,22 @@ module.exports = function mergeOptions (parent, child, vm) {
234
234
  guardComponents(child.components)
235
235
  var options = {}
236
236
  var key
237
+ if (child.mixins) {
238
+ for (var i = 0, l = child.mixins.length; i < l; i++) {
239
+ parent = mergeOptions(parent, child.mixins[i], vm)
240
+ }
241
+ }
237
242
  for (key in parent) {
238
- merge(parent[key], child[key], key)
243
+ merge(key)
239
244
  }
240
245
  for (key in child) {
241
246
  if (!(parent.hasOwnProperty(key))) {
242
- merge(parent[key], child[key], key)
243
- }
244
- }
245
- var mixins = child.mixins
246
- if (mixins) {
247
- for (var i = 0, l = mixins.length; i < l; i++) {
248
- for (key in mixins[i]) {
249
- merge(options[key], mixins[i][key], key)
250
- }
247
+ merge(key)
251
248
  }
252
249
  }
253
- function merge (parentVal, childVal, key) {
250
+ function merge (key) {
254
251
  var strat = strats[key] || defaultStrat
255
- options[key] = strat(parentVal, childVal, vm, key)
252
+ options[key] = strat(parent[key], child[key], vm, key)
256
253
  }
257
254
  return options
258
255
  }