fluentd-ui/app/javascript/packs/transport_config.js
Kenji Okimoto d6516ea172
Convert to vue component
Signed-off-by: Kenji Okimoto <okimoto@clear-code.com>
2018-06-20 15:18:32 +09:00

61 lines
1.1 KiB
JavaScript

'use strict'
import ConfigField from './config_field'
const TransportConfig = {
template: "#vue-transport-config",
components: {
"config-field": ConfigField
},
props: [
"pluginType",
"pluginName"
],
data: function() {
return {
transportType: "tcp",
options: ["tcp", "tls"],
tlsOptions: []
}
},
computed: {
token: function() {
return Rails.csrfToken()
}
},
filters: {
toUpper: function(value) {
return _.toUpper(value)
}
},
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.tlsOptions = data.tlsOptions
})
}
}
}
export { TransportConfig as default }