mirror of
https://github.com/fluent/fluentd-ui.git
synced 2025-08-11 08:47:06 +02:00
Use reactive property properly
In previous version, we have modified read-only property directly. Signed-off-by: Kenji Okimoto <okimoto@clear-code.com>
This commit is contained in:
parent
5b882568f7
commit
937fc907b5
@ -6,15 +6,25 @@ import "lodash/lodash";
|
|||||||
$(document).ready(() => {
|
$(document).ready(() => {
|
||||||
const SettingSection = {
|
const SettingSection = {
|
||||||
template: "#vue-setting-section",
|
template: "#vue-setting-section",
|
||||||
props: ["id", "content", "type", "name", "arg"],
|
props: ["initialId", "initialContent", "initialType", "initialName", "initialArg"],
|
||||||
data: function() {
|
data: function() {
|
||||||
return {
|
return {
|
||||||
mode: "default",
|
mode: "default",
|
||||||
processing: false
|
processing: false,
|
||||||
|
id: null,
|
||||||
|
content: null,
|
||||||
|
type: null,
|
||||||
|
name: null,
|
||||||
|
arg: null
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created: function() {
|
created: function() {
|
||||||
this.initialState();
|
this.initialState();
|
||||||
|
this.id = this.initialId;
|
||||||
|
this.content = this.initialContent;
|
||||||
|
this.type = this.initialType;
|
||||||
|
this.name = this.initialName;
|
||||||
|
this.arg = this.initialArg;
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
endpoint: function() {
|
endpoint: function() {
|
||||||
@ -50,7 +60,7 @@ $(document).ready(() => {
|
|||||||
"X-CSRF-Token": token
|
"X-CSRF-Token": token
|
||||||
}
|
}
|
||||||
}).then((data)=> {
|
}).then((data)=> {
|
||||||
_.each(data, function(v,k){
|
_.each(data, (v, k) => {
|
||||||
this[k] = v;
|
this[k] = v;
|
||||||
});
|
});
|
||||||
this.initialState();
|
this.initialState();
|
||||||
|
@ -44,19 +44,21 @@
|
|||||||
%p.empty= t('.setting_empty')
|
%p.empty= t('.setting_empty')
|
||||||
%setting-section{"v-if" => "loaded && sections.sources.length > 0",
|
%setting-section{"v-if" => "loaded && sections.sources.length > 0",
|
||||||
"v-for" => "source in sections.sources",
|
"v-for" => "source in sections.sources",
|
||||||
"v-bind:id" => "source.id",
|
"v-bind:key" => "source.id",
|
||||||
"v-bind:content" => "source.content",
|
"v-bind:initial-id" => "source.id",
|
||||||
"v-bind:type" => "source.type",
|
"v-bind:initial-content" => "source.content",
|
||||||
"v-bind:name" => "source.name",
|
"v-bind:initial-type" => "source.type",
|
||||||
"v-bind:arg" => "source.arg"}
|
"v-bind:initial-name" => "source.name",
|
||||||
|
"v-bind:initial-arg" => "source.arg"}
|
||||||
.col-xl-6.output
|
.col-xl-6.output
|
||||||
%h3= t('.out')
|
%h3= t('.out')
|
||||||
%div{"v-if" => "loaded && sections.matches.length == 0"}
|
%div{"v-if" => "loaded && sections.matches.length == 0"}
|
||||||
%p.empty= t('.setting_empty')
|
%p.empty= t('.setting_empty')
|
||||||
%setting-section{"v-if" => "loaded && sections.matches.length > 0",
|
%setting-section{"v-if" => "loaded && sections.matches.length > 0",
|
||||||
"v-for" => "match in sections.matches",
|
"v-for" => "match in sections.matches",
|
||||||
"v-bind:id" => "match.id",
|
"v-bind:key" => "match.id",
|
||||||
"v-bind:content" => "match.content",
|
"v-bind:initial-id" => "match.id",
|
||||||
"v-bind:type" => "match.type",
|
"v-bind:initial-content" => "match.content",
|
||||||
"v-bind:name" => "match.name",
|
"v-bind:initial-type" => "match.type",
|
||||||
"v-bind:arg" => "match.arg"}
|
"v-bind:initial-name" => "match.name",
|
||||||
|
"v-bind:initial-arg" => "match.arg"}
|
||||||
|
Loading…
Reference in New Issue
Block a user