fluentd-ui 0.3.8 → 0.3.9

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.

Potentially problematic release.


This version of fluentd-ui might be problematic. Click here for more details.

Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +9 -0
  3. data/Gemfile +1 -0
  4. data/Gemfile.lock +4 -1
  5. data/app/assets/javascripts/vue/fluent_log.js +4 -4
  6. data/app/assets/javascripts/vue/in_tail_format.js +43 -49
  7. data/app/assets/javascripts/{alert.js → vue/notification.js} +21 -7
  8. data/app/assets/javascripts/vue/settings.js +121 -0
  9. data/app/assets/javascripts/vue/treeview.js +3 -3
  10. data/app/assets/stylesheets/common.css.scss +7 -1
  11. data/app/controllers/api/settings_controller.rb +55 -0
  12. data/app/controllers/api_controller.rb +6 -2
  13. data/app/controllers/concerns/setting_concern.rb +2 -2
  14. data/app/controllers/fluentd/settings_controller.rb +17 -2
  15. data/app/models/fluentd/setting/config.rb +39 -0
  16. data/app/views/api/settings/_element.json.jbuilder +6 -0
  17. data/app/views/api/settings/index.json.jbuilder +3 -0
  18. data/app/views/api/settings/show.json.jbuilder +1 -0
  19. data/app/views/fluentd/settings/edit.html.haml +3 -0
  20. data/app/views/fluentd/settings/source_and_output.html.haml +19 -2
  21. data/app/views/layouts/application.html.erb +1 -30
  22. data/app/views/shared/vue/_in_tail_format.html.erb +11 -36
  23. data/app/views/shared/vue/_notification.html.erb +31 -0
  24. data/app/views/shared/vue/_setting.html.erb +23 -0
  25. data/app/views/shared/vue/_treeview.html.erb +2 -2
  26. data/bower.json +1 -1
  27. data/config/application.rb +1 -0
  28. data/config/locales/translation_en.yml +11 -7
  29. data/config/locales/translation_ja.yml +4 -0
  30. data/config/routes.rb +2 -0
  31. data/lib/fluentd-ui/version.rb +1 -1
  32. data/spec/features/fluentd/setting/source_and_output_spec.rb +157 -0
  33. data/spec/spec_helper.rb +1 -0
  34. data/spec/support/javascript_macro.rb +21 -0
  35. data/vendor/assets/javascripts/bower/vue/.bower.json +7 -7
  36. data/vendor/assets/javascripts/bower/vue/LICENSE +1 -1
  37. data/vendor/assets/javascripts/bower/vue/dist/vue.js +7822 -4768
  38. data/vendor/assets/javascripts/bower/vue/dist/vue.min.js +7 -7
  39. data/vendor/assets/javascripts/bower/vue/src/api/child.js +53 -0
  40. data/vendor/assets/javascripts/bower/vue/src/api/data.js +161 -0
  41. data/vendor/assets/javascripts/bower/vue/src/api/dom.js +211 -0
  42. data/vendor/assets/javascripts/bower/vue/src/api/events.js +176 -0
  43. data/vendor/assets/javascripts/bower/vue/src/api/global.js +146 -0
  44. data/vendor/assets/javascripts/bower/vue/src/api/lifecycle.js +144 -0
  45. data/vendor/assets/javascripts/bower/vue/src/batcher.js +52 -32
  46. data/vendor/assets/javascripts/bower/vue/src/cache.js +112 -0
  47. data/vendor/assets/javascripts/bower/vue/src/compiler/compile.js +549 -0
  48. data/vendor/assets/javascripts/bower/vue/src/compiler/transclude.js +163 -0
  49. data/vendor/assets/javascripts/bower/vue/src/config.js +74 -14
  50. data/vendor/assets/javascripts/bower/vue/src/directive.js +179 -219
  51. data/vendor/assets/javascripts/bower/vue/src/directives/attr.js +32 -0
  52. data/vendor/assets/javascripts/bower/vue/src/directives/class.js +18 -0
  53. data/vendor/assets/javascripts/bower/vue/src/directives/cloak.js +12 -0
  54. data/vendor/assets/javascripts/bower/vue/src/directives/component.js +214 -0
  55. data/vendor/assets/javascripts/bower/vue/src/directives/el.js +13 -0
  56. data/vendor/assets/javascripts/bower/vue/src/directives/html.js +30 -34
  57. data/vendor/assets/javascripts/bower/vue/src/directives/if.js +77 -46
  58. data/vendor/assets/javascripts/bower/vue/src/directives/index.js +22 -129
  59. data/vendor/assets/javascripts/bower/vue/src/directives/model/checkbox.js +25 -0
  60. data/vendor/assets/javascripts/bower/vue/src/directives/model/default.js +123 -0
  61. data/vendor/assets/javascripts/bower/vue/src/directives/model/index.js +56 -0
  62. data/vendor/assets/javascripts/bower/vue/src/directives/model/radio.js +26 -0
  63. data/vendor/assets/javascripts/bower/vue/src/directives/model/select.js +166 -0
  64. data/vendor/assets/javascripts/bower/vue/src/directives/on.js +51 -50
  65. data/vendor/assets/javascripts/bower/vue/src/directives/partial.js +36 -42
  66. data/vendor/assets/javascripts/bower/vue/src/directives/ref.js +24 -0
  67. data/vendor/assets/javascripts/bower/vue/src/directives/repeat.js +477 -226
  68. data/vendor/assets/javascripts/bower/vue/src/directives/show.js +8 -0
  69. data/vendor/assets/javascripts/bower/vue/src/directives/style.js +49 -37
  70. data/vendor/assets/javascripts/bower/vue/src/directives/text.js +15 -0
  71. data/vendor/assets/javascripts/bower/vue/src/directives/transition.js +12 -0
  72. data/vendor/assets/javascripts/bower/vue/src/directives/with.js +38 -41
  73. data/vendor/assets/javascripts/bower/vue/src/filters/array-filters.js +87 -0
  74. data/vendor/assets/javascripts/bower/vue/src/filters/index.js +135 -0
  75. data/vendor/assets/javascripts/bower/vue/src/instance/compile.js +71 -0
  76. data/vendor/assets/javascripts/bower/vue/src/instance/events.js +122 -0
  77. data/vendor/assets/javascripts/bower/vue/src/instance/init.js +76 -0
  78. data/vendor/assets/javascripts/bower/vue/src/instance/scope.js +217 -0
  79. data/vendor/assets/javascripts/bower/vue/src/observer/array.js +90 -0
  80. data/vendor/assets/javascripts/bower/vue/src/observer/dep.js +50 -0
  81. data/vendor/assets/javascripts/bower/vue/src/observer/index.js +235 -0
  82. data/vendor/assets/javascripts/bower/vue/src/observer/object.js +75 -0
  83. data/vendor/assets/javascripts/bower/vue/src/parsers/directive.js +159 -0
  84. data/vendor/assets/javascripts/bower/vue/src/parsers/expression.js +226 -0
  85. data/vendor/assets/javascripts/bower/vue/src/parsers/path.js +300 -0
  86. data/vendor/assets/javascripts/bower/vue/src/parsers/template.js +246 -0
  87. data/vendor/assets/javascripts/bower/vue/src/parsers/text.js +178 -0
  88. data/vendor/assets/javascripts/bower/vue/src/transition/css.js +189 -0
  89. data/vendor/assets/javascripts/bower/vue/src/transition/index.js +151 -0
  90. data/vendor/assets/javascripts/bower/vue/src/transition/js.js +43 -0
  91. data/vendor/assets/javascripts/bower/vue/src/util/debug.js +50 -0
  92. data/vendor/assets/javascripts/bower/vue/src/util/dom.js +176 -0
  93. data/vendor/assets/javascripts/bower/vue/src/util/env.js +74 -0
  94. data/vendor/assets/javascripts/bower/vue/src/util/filter.js +72 -0
  95. data/vendor/assets/javascripts/bower/vue/src/util/index.js +8 -0
  96. data/vendor/assets/javascripts/bower/vue/src/util/lang.js +175 -0
  97. data/vendor/assets/javascripts/bower/vue/src/util/merge-option.js +258 -0
  98. data/vendor/assets/javascripts/bower/vue/src/vue.js +84 -0
  99. data/vendor/assets/javascripts/bower/vue/src/watcher.js +240 -0
  100. metadata +65 -20
  101. data/app/assets/javascripts/setting_format.js +0 -15
  102. data/vendor/assets/javascripts/bower/vue/src/binding.js +0 -103
  103. data/vendor/assets/javascripts/bower/vue/src/compiler.js +0 -1037
  104. data/vendor/assets/javascripts/bower/vue/src/deps-parser.js +0 -65
  105. data/vendor/assets/javascripts/bower/vue/src/directives/model.js +0 -174
  106. data/vendor/assets/javascripts/bower/vue/src/directives/view.js +0 -56
  107. data/vendor/assets/javascripts/bower/vue/src/emitter.js +0 -97
  108. data/vendor/assets/javascripts/bower/vue/src/exp-parser.js +0 -190
  109. data/vendor/assets/javascripts/bower/vue/src/filters.js +0 -191
  110. data/vendor/assets/javascripts/bower/vue/src/fragment.js +0 -67
  111. data/vendor/assets/javascripts/bower/vue/src/main.js +0 -188
  112. data/vendor/assets/javascripts/bower/vue/src/observer.js +0 -446
  113. data/vendor/assets/javascripts/bower/vue/src/template-parser.js +0 -46
  114. data/vendor/assets/javascripts/bower/vue/src/text-parser.js +0 -96
  115. data/vendor/assets/javascripts/bower/vue/src/transition.js +0 -228
  116. data/vendor/assets/javascripts/bower/vue/src/utils.js +0 -326
  117. data/vendor/assets/javascripts/bower/vue/src/viewmodel.js +0 -190
@@ -0,0 +1,146 @@
1
+ var _ = require('../util')
2
+ var mergeOptions = require('../util/merge-option')
3
+
4
+ /**
5
+ * Expose useful internals
6
+ */
7
+
8
+ exports.util = _
9
+ exports.nextTick = _.nextTick
10
+ exports.config = require('../config')
11
+
12
+ exports.compiler = {
13
+ compile: require('../compiler/compile'),
14
+ transclude: require('../compiler/transclude')
15
+ }
16
+
17
+ exports.parsers = {
18
+ path: require('../parsers/path'),
19
+ text: require('../parsers/text'),
20
+ template: require('../parsers/template'),
21
+ directive: require('../parsers/directive'),
22
+ expression: require('../parsers/expression')
23
+ }
24
+
25
+ /**
26
+ * Each instance constructor, including Vue, has a unique
27
+ * cid. This enables us to create wrapped "child
28
+ * constructors" for prototypal inheritance and cache them.
29
+ */
30
+
31
+ exports.cid = 0
32
+ var cid = 1
33
+
34
+ /**
35
+ * Class inehritance
36
+ *
37
+ * @param {Object} extendOptions
38
+ */
39
+
40
+ exports.extend = function (extendOptions) {
41
+ extendOptions = extendOptions || {}
42
+ var Super = this
43
+ var Sub = createClass(extendOptions.name || 'VueComponent')
44
+ Sub.prototype = Object.create(Super.prototype)
45
+ Sub.prototype.constructor = Sub
46
+ Sub.cid = cid++
47
+ Sub.options = mergeOptions(
48
+ Super.options,
49
+ extendOptions
50
+ )
51
+ Sub['super'] = Super
52
+ // allow further extension
53
+ Sub.extend = Super.extend
54
+ // create asset registers, so extended classes
55
+ // can have their private assets too.
56
+ createAssetRegisters(Sub)
57
+ return Sub
58
+ }
59
+
60
+ /**
61
+ * A function that returns a sub-class constructor with the
62
+ * given name. This gives us much nicer output when
63
+ * logging instances in the console.
64
+ *
65
+ * @param {String} name
66
+ * @return {Function}
67
+ */
68
+
69
+ function createClass (name) {
70
+ return new Function(
71
+ 'return function ' + _.camelize(name, true) +
72
+ ' (options) { this._init(options) }'
73
+ )()
74
+ }
75
+
76
+ /**
77
+ * Plugin system
78
+ *
79
+ * @param {Object} plugin
80
+ */
81
+
82
+ exports.use = function (plugin) {
83
+ // additional parameters
84
+ var args = _.toArray(arguments, 1)
85
+ args.unshift(this)
86
+ if (typeof plugin.install === 'function') {
87
+ plugin.install.apply(plugin, args)
88
+ } else {
89
+ plugin.apply(null, args)
90
+ }
91
+ return this
92
+ }
93
+
94
+ /**
95
+ * Define asset registration methods on a constructor.
96
+ *
97
+ * @param {Function} Constructor
98
+ */
99
+
100
+ var assetTypes = [
101
+ 'directive',
102
+ 'filter',
103
+ 'partial',
104
+ 'transition'
105
+ ]
106
+
107
+ function createAssetRegisters (Constructor) {
108
+
109
+ /* Asset registration methods share the same signature:
110
+ *
111
+ * @param {String} id
112
+ * @param {*} definition
113
+ */
114
+
115
+ assetTypes.forEach(function (type) {
116
+ Constructor[type] = function (id, definition) {
117
+ if (!definition) {
118
+ return this.options[type + 's'][id]
119
+ } else {
120
+ this.options[type + 's'][id] = definition
121
+ }
122
+ }
123
+ })
124
+
125
+ /**
126
+ * Component registration needs to automatically invoke
127
+ * Vue.extend on object values.
128
+ *
129
+ * @param {String} id
130
+ * @param {Object|Function} definition
131
+ */
132
+
133
+ Constructor.component = function (id, definition) {
134
+ if (!definition) {
135
+ return this.options.components[id]
136
+ } else {
137
+ if (_.isPlainObject(definition)) {
138
+ definition.name = id
139
+ definition = _.Vue.extend(definition)
140
+ }
141
+ this.options.components[id] = definition
142
+ }
143
+ }
144
+ }
145
+
146
+ createAssetRegisters(exports)
@@ -0,0 +1,144 @@
1
+ var _ = require('../util')
2
+ var compile = require('../compiler/compile')
3
+
4
+ /**
5
+ * Set instance target element and kick off the compilation
6
+ * process. The passed in `el` can be a selector string, an
7
+ * existing Element, or a DocumentFragment (for block
8
+ * instances).
9
+ *
10
+ * @param {Element|DocumentFragment|string} el
11
+ * @public
12
+ */
13
+
14
+ exports.$mount = function (el) {
15
+ if (this._isCompiled) {
16
+ _.warn('$mount() should be called only once.')
17
+ return
18
+ }
19
+ if (!el) {
20
+ el = document.createElement('div')
21
+ } else if (typeof el === 'string') {
22
+ var selector = el
23
+ el = document.querySelector(el)
24
+ if (!el) {
25
+ _.warn('Cannot find element: ' + selector)
26
+ return
27
+ }
28
+ }
29
+ this._compile(el)
30
+ this._isCompiled = true
31
+ this._callHook('compiled')
32
+ if (_.inDoc(this.$el)) {
33
+ this._callHook('attached')
34
+ this._initDOMHooks()
35
+ ready.call(this)
36
+ } else {
37
+ this._initDOMHooks()
38
+ this.$once('hook:attached', ready)
39
+ }
40
+ return this
41
+ }
42
+
43
+ /**
44
+ * Mark an instance as ready.
45
+ */
46
+
47
+ function ready () {
48
+ this._isAttached = true
49
+ this._isReady = true
50
+ this._callHook('ready')
51
+ }
52
+
53
+ /**
54
+ * Teardown an instance, unobserves the data, unbind all the
55
+ * directives, turn off all the event listeners, etc.
56
+ *
57
+ * @param {Boolean} remove - whether to remove the DOM node.
58
+ * @param {Boolean} deferCleanup - if true, defer cleanup to
59
+ * be called later
60
+ * @public
61
+ */
62
+
63
+ exports.$destroy = function (remove, deferCleanup) {
64
+ if (this._isBeingDestroyed) {
65
+ return
66
+ }
67
+ this._callHook('beforeDestroy')
68
+ this._isBeingDestroyed = true
69
+ var i
70
+ // remove self from parent. only necessary
71
+ // if parent is not being destroyed as well.
72
+ var parent = this.$parent
73
+ if (parent && !parent._isBeingDestroyed) {
74
+ i = parent._children.indexOf(this)
75
+ parent._children.splice(i, 1)
76
+ }
77
+ // destroy all children.
78
+ if (this._children) {
79
+ i = this._children.length
80
+ while (i--) {
81
+ this._children[i].$destroy()
82
+ }
83
+ }
84
+ // teardown all directives. this also tearsdown all
85
+ // directive-owned watchers.
86
+ i = this._directives.length
87
+ while (i--) {
88
+ this._directives[i]._teardown()
89
+ }
90
+ // teardown all user watchers.
91
+ for (i in this._userWatchers) {
92
+ this._userWatchers[i].teardown()
93
+ }
94
+ // remove reference to self on $el
95
+ if (this.$el) {
96
+ this.$el.__vue__ = null
97
+ }
98
+ // remove DOM element
99
+ var self = this
100
+ if (remove && this.$el) {
101
+ this.$remove(function () {
102
+ self._cleanup()
103
+ })
104
+ } else if (!deferCleanup) {
105
+ this._cleanup()
106
+ }
107
+ }
108
+
109
+ /**
110
+ * Clean up to ensure garbage collection.
111
+ * This is called after the leave transition if there
112
+ * is any.
113
+ */
114
+
115
+ exports._cleanup = function () {
116
+ // remove reference from data ob
117
+ this._data.__ob__.removeVm(this)
118
+ this._data =
119
+ this._watchers =
120
+ this._userWatchers =
121
+ this._watcherList =
122
+ this.$el =
123
+ this.$parent =
124
+ this.$root =
125
+ this._children =
126
+ this._directives = null
127
+ // call the last hook...
128
+ this._isDestroyed = true
129
+ this._callHook('destroyed')
130
+ // turn off all instance listeners.
131
+ this.$off()
132
+ }
133
+
134
+ /**
135
+ * Partially compile a piece of DOM and return a
136
+ * decompile function.
137
+ *
138
+ * @param {Element|DocumentFragment} el
139
+ * @return {Function}
140
+ */
141
+
142
+ exports.$compile = function (el) {
143
+ return compile(el, this.$options, true)(this, el)
144
+ }
@@ -1,45 +1,65 @@
1
- var utils = require('./utils')
1
+ var _ = require('./util')
2
+
3
+ /**
4
+ * The Batcher maintains a job queue to be run
5
+ * async on the next event loop.
6
+ */
2
7
 
3
8
  function Batcher () {
4
- this.reset()
9
+ this.reset()
5
10
  }
6
11
 
7
- var BatcherProto = Batcher.prototype
8
-
9
- BatcherProto.push = function (job) {
10
- if (!job.id || !this.has[job.id]) {
11
- this.queue.push(job)
12
- this.has[job.id] = job
13
- if (!this.waiting) {
14
- this.waiting = true
15
- utils.nextTick(utils.bind(this.flush, this))
16
- }
17
- } else if (job.override) {
18
- var oldJob = this.has[job.id]
19
- oldJob.cancelled = true
20
- this.queue.push(job)
21
- this.has[job.id] = job
12
+ var p = Batcher.prototype
13
+
14
+ /**
15
+ * Push a job into the job queue.
16
+ * Jobs with duplicate IDs will be skipped unless it's
17
+ * pushed when the queue is being flushed.
18
+ *
19
+ * @param {Object} job
20
+ * properties:
21
+ * - {String|Number} id
22
+ * - {Function} run
23
+ */
24
+
25
+ p.push = function (job) {
26
+ if (!job.id || !this.has[job.id] || this.flushing) {
27
+ this.queue.push(job)
28
+ this.has[job.id] = job
29
+ if (!this.waiting) {
30
+ this.waiting = true
31
+ _.nextTick(this.flush, this)
22
32
  }
33
+ }
23
34
  }
24
35
 
25
- BatcherProto.flush = function () {
26
- // before flush hook
27
- if (this._preFlush) this._preFlush()
28
- // do not cache length because more jobs might be pushed
29
- // as we execute existing jobs
30
- for (var i = 0; i < this.queue.length; i++) {
31
- var job = this.queue[i]
32
- if (!job.cancelled) {
33
- job.execute()
34
- }
36
+ /**
37
+ * Flush the queue and run the jobs.
38
+ * Will call a preFlush hook if has one.
39
+ */
40
+
41
+ p.flush = function () {
42
+ this.flushing = true
43
+ // do not cache length because more jobs might be pushed
44
+ // as we run existing jobs
45
+ for (var i = 0; i < this.queue.length; i++) {
46
+ var job = this.queue[i]
47
+ if (!job.cancelled) {
48
+ job.run()
35
49
  }
36
- this.reset()
50
+ }
51
+ this.reset()
37
52
  }
38
53
 
39
- BatcherProto.reset = function () {
40
- this.has = utils.hash()
41
- this.queue = []
42
- this.waiting = false
54
+ /**
55
+ * Reset the batcher's state.
56
+ */
57
+
58
+ p.reset = function () {
59
+ this.has = {}
60
+ this.queue = []
61
+ this.waiting = false
62
+ this.flushing = false
43
63
  }
44
64
 
45
65
  module.exports = Batcher
@@ -0,0 +1,112 @@
1
+ /**
2
+ * A doubly linked list-based Least Recently Used (LRU)
3
+ * cache. Will keep most recently used items while
4
+ * discarding least recently used items when its limit is
5
+ * reached. This is a bare-bone version of
6
+ * Rasmus Andersson's js-lru:
7
+ *
8
+ * https://github.com/rsms/js-lru
9
+ *
10
+ * @param {Number} limit
11
+ * @constructor
12
+ */
13
+
14
+ function Cache (limit) {
15
+ this.size = 0
16
+ this.limit = limit
17
+ this.head = this.tail = undefined
18
+ this._keymap = {}
19
+ }
20
+
21
+ var p = Cache.prototype
22
+
23
+ /**
24
+ * Put <value> into the cache associated with <key>.
25
+ * Returns the entry which was removed to make room for
26
+ * the new entry. Otherwise undefined is returned.
27
+ * (i.e. if there was enough room already).
28
+ *
29
+ * @param {String} key
30
+ * @param {*} value
31
+ * @return {Entry|undefined}
32
+ */
33
+
34
+ p.put = function (key, value) {
35
+ var entry = {
36
+ key:key,
37
+ value:value
38
+ }
39
+ this._keymap[key] = entry
40
+ if (this.tail) {
41
+ this.tail.newer = entry
42
+ entry.older = this.tail
43
+ } else {
44
+ this.head = entry
45
+ }
46
+ this.tail = entry
47
+ if (this.size === this.limit) {
48
+ return this.shift()
49
+ } else {
50
+ this.size++
51
+ }
52
+ }
53
+
54
+ /**
55
+ * Purge the least recently used (oldest) entry from the
56
+ * cache. Returns the removed entry or undefined if the
57
+ * cache was empty.
58
+ */
59
+
60
+ p.shift = function () {
61
+ var entry = this.head
62
+ if (entry) {
63
+ this.head = this.head.newer
64
+ this.head.older = undefined
65
+ entry.newer = entry.older = undefined
66
+ this._keymap[entry.key] = undefined
67
+ }
68
+ return entry
69
+ }
70
+
71
+ /**
72
+ * Get and register recent use of <key>. Returns the value
73
+ * associated with <key> or undefined if not in cache.
74
+ *
75
+ * @param {String} key
76
+ * @param {Boolean} returnEntry
77
+ * @return {Entry|*}
78
+ */
79
+
80
+ p.get = function (key, returnEntry) {
81
+ var entry = this._keymap[key]
82
+ if (entry === undefined) return
83
+ if (entry === this.tail) {
84
+ return returnEntry
85
+ ? entry
86
+ : entry.value
87
+ }
88
+ // HEAD--------------TAIL
89
+ // <.older .newer>
90
+ // <--- add direction --
91
+ // A B C <D> E
92
+ if (entry.newer) {
93
+ if (entry === this.head) {
94
+ this.head = entry.newer
95
+ }
96
+ entry.newer.older = entry.older // C <-- E.
97
+ }
98
+ if (entry.older) {
99
+ entry.older.newer = entry.newer // C. --> E
100
+ }
101
+ entry.newer = undefined // D --x
102
+ entry.older = this.tail // D. --> E
103
+ if (this.tail) {
104
+ this.tail.newer = entry // E. <-- D
105
+ }
106
+ this.tail = entry
107
+ return returnEntry
108
+ ? entry
109
+ : entry.value
110
+ }
111
+
112
+ module.exports = Cache