fluentd-ui/app/javascript/packs/transport_section.js
Kenji Okimoto a644442687
Add transport section to in_forward
Signed-off-by: Kenji Okimoto <okimoto@clear-code.com>
2018-06-19 18:05:56 +09:00

72 lines
1.5 KiB
JavaScript

'use strict'
import 'lodash/lodash'
import ConfigField from './config_field'
$(document).ready(() => {
new Vue({
el: '#transport-section',
components: {
"config-field": ConfigField
},
props: [
"transportType",
],
propsData: {
"transportType": "tcp"
},
data: function() {
return {
pluginType: null,
pluginName: null,
options: ["tcp", "tls"],
commonOptions: [],
advancedOptions: []
}
},
computed: {
token: function() {
return Rails.csrfToken()
}
},
filters: {
toUpper: function(value) {
return _.toUpper(value)
}
},
beforeMount: function() {
this.pluginType = this.$el.attributes.pluginType.nodeValue
this.pluginName = this.$el.attributes.pluginName.nodeValue
},
mounted: function() {
},
methods: {
onChange: function() {
console.log(this.pluginType, this.pluginName, this.transportType)
this.updateSection()
},
updateSection: function() {
if (this.transportType === "tcp") {
return
}
$.ajax({
method: "GET",
url: "/api/config_definitions",
headers: {
'X-CSRF-Token': this.token
},
data: {
type: this.pluginType,
name: this.pluginName
}
}).then((data) => {
this.commonOptions = data.transport.commonOptions
this.advancedOptions = data.transport.advancedOptions
})
}
}
})
})