/* global _ */ "use strict"; import "lodash/lodash"; import "popper.js/dist/popper"; import "bootstrap/dist/js/bootstrap"; import ParserPluginForm from "./parser_plugin_form"; import store from "./store"; $(document).ready(() => { new Vue({ el: "#in-tail-parse", store, components: { "parser-plugin-form": ParserPluginForm }, props: [ "initialPluginName", "pluginType", "pluginLabel", ], data: function() { return { "path": "", "parseType": "", "highlightedLines": null }; }, computed: { token: function() { return Rails.csrfToken(); } }, watch: { "parse.expression": function() { console.log(`parse.expression: ${this.parse.expression}`); this.preview(); }, "parse.time_format": function() { console.log(`parse.time_format: ${this.parse.time_format}`); this.preview(); }, "parseType": function() { this.preview(); }, }, beforeMount: function() { this.path = this.$el.attributes.path.nodeValue; }, mounted: function() { this.parse = {}; }, updated: function() { this.$nextTick(() => { if ($("[data-toggle=tooltip]").tooltip) { $("[data-toggle=tooltip]").tooltip("dispose"); $("[data-toggle=tooltip]").tooltip("enable"); } }); }, methods: { onChangePluginName: function(name) { console.log("#in-tail-parse onChangePluginName", name); console.log("#in-tail-parse onChangePluginName store", this.$store); this.parseType = name; this.parse = {}; // clear parser plugin configuration }, onChangeParseConfig: function(data) { console.log("#in-tail-parse onChangeParseConfig", store.getters["parserParams/toParams"]); _.merge(this.parse, store.getters["parserParams/toParams"]); this.preview(); }, onChangeFormats: function(data) { console.log("#in_tail_parse onChangeFormats", data); _.merge(this.parse, data); this.preview(); }, updateHighlightedLines: function(matches) { if (!matches) { this.highlightedLines = null; return; } let $container = $("