You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by mi...@apache.org on 2018/09/29 09:18:51 UTC
[incubator-dubbo-ops] branch develop updated: use ace instead of
codemirror
This is an automated email from the ASF dual-hosted git repository.
min pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo-ops.git
The following commit(s) were added to refs/heads/develop by this push:
new 3e0c003 use ace instead of codemirror
3e0c003 is described below
commit 3e0c003112313581517076e7baf3e9f9111a4758
Author: nzomkxia <z8...@gmail.com>
AuthorDate: Sat Sep 29 17:18:41 2018 +0800
use ace instead of codemirror
---
dubbo-admin-frontend/package.json | 1 -
.../src/components/LoadBalance.vue | 38 ++++++--------------
dubbo-admin-frontend/src/components/Overrides.vue | 33 ++++--------------
.../src/components/RoutingRule.vue | 33 ++++--------------
.../src/components/WeightAdjust.vue | 40 ++++++----------------
5 files changed, 35 insertions(+), 110 deletions(-)
diff --git a/dubbo-admin-frontend/package.json b/dubbo-admin-frontend/package.json
index a9cf14e..543087e 100644
--- a/dubbo-admin-frontend/package.json
+++ b/dubbo-admin-frontend/package.json
@@ -15,7 +15,6 @@
"brace": "^0.11.1",
"js-yaml": "^3.12.0",
"vue": "^2.5.2",
- "vue-codemirror": "^4.0.5",
"vue-router": "^3.0.1",
"vuetify": "^1.2.2",
"vuex": "^3.0.1"
diff --git a/dubbo-admin-frontend/src/components/LoadBalance.vue b/dubbo-admin-frontend/src/components/LoadBalance.vue
index b85b9ef..83f8bb6 100644
--- a/dubbo-admin-frontend/src/components/LoadBalance.vue
+++ b/dubbo-admin-frontend/src/components/LoadBalance.vue
@@ -81,10 +81,7 @@
v-model="service"
></v-text-field>
<v-subheader class="pa-0 mt-3">RULE CONTENT</v-subheader>
- <codemirror ref="myCm"
- v-model="ruleText"
- :options="cmOption">
- </codemirror>
+ <ace-editor v-model="ruleText" :readonly="readonly"/>
</v-card-text>
<v-card-actions>
@@ -111,17 +108,12 @@
</template>
<script>
- import { codemirror } from 'vue-codemirror'
- import 'codemirror/lib/codemirror.css'
- import 'codemirror/theme/paraiso-light.css'
- import 'codemirror/mode/yaml/yaml.js'
- import 'codemirror/addon/display/autorefresh.js'
- import 'codemirror/addon/display/placeholder'
import yaml from 'js-yaml'
import {AXIOS} from './http-common'
+ import AceEditor from '@/components/AceEditor'
export default {
components: {
- codemirror
+ AceEditor
},
data: () => ({
dropdown_font: [ 'Service', 'App', 'IP' ],
@@ -141,19 +133,13 @@
{id: 1, icon: 'edit', tooltip: 'Edit'},
{id: 3, icon: 'delete', tooltip: 'Delete'}
],
- configs: [
+ loadBalances: [
],
template:
'methodName: sayHello # 0 for all methods\n' +
'strategy: # leastactive, random, roundrobin',
ruleText: '',
- cmOption: {
- theme: 'paraiso-light',
- autoRefresh: true,
- readOnly: false,
- mode: 'text/x-yaml',
- line: true
- },
+ readonly: false,
headers: [
{
text: 'Service Name',
@@ -178,7 +164,7 @@
this.search(this.filter, true)
},
search: function (filter, rewrite) {
- AXIOS.get('/balancing/search?service=' + filter)
+ AXIOS.get('/balancing/search?serviceName=' + filter)
.then(response => {
this.loadBalances = response.data
if (rewrite) {
@@ -190,7 +176,7 @@
this.ruleText = this.template
this.service = ''
this.dialog = false
- this.cmOption.readOnly = false
+ this.readonly = false
},
openDialog: function () {
this.dialog = true
@@ -225,8 +211,9 @@
let balancing = response.data
this.service = balancing.service
delete balancing.service
+ delete balancing.id
this.ruleText = yaml.safeDump(balancing)
- this.cmOption.readOnly = true
+ this.readonly = true
this.dialog = true
})
break
@@ -237,7 +224,7 @@
this.service = balancing.service
delete balancing.service
this.ruleText = yaml.safeDump(balancing)
- this.cmOption.readOnly = false
+ this.readonly = false
this.dialog = true
})
break
@@ -260,11 +247,6 @@
})
}
},
- computed: {
- codemirror () {
- return this.$refs.myCm.codemirror
- }
- },
created () {
this.setHeight()
},
diff --git a/dubbo-admin-frontend/src/components/Overrides.vue b/dubbo-admin-frontend/src/components/Overrides.vue
index 7d808ae..33f3c10 100644
--- a/dubbo-admin-frontend/src/components/Overrides.vue
+++ b/dubbo-admin-frontend/src/components/Overrides.vue
@@ -80,10 +80,7 @@
v-model="service"
></v-text-field>
<v-subheader class="pa-0 mt-3">RULE CONTENT</v-subheader>
- <codemirror ref="myCm"
- v-model="ruleText"
- :options="cmOption">
- </codemirror>
+ <ace-editor v-model="ruleText" :readonly="readonly"/>
</v-card-text>
<v-card-actions>
@@ -110,17 +107,12 @@
</template>
<script>
- import { codemirror } from 'vue-codemirror'
- import 'codemirror/lib/codemirror.css'
- import 'codemirror/theme/paraiso-light.css'
- import 'codemirror/mode/yaml/yaml.js'
- import 'codemirror/addon/display/autorefresh.js'
- import 'codemirror/addon/display/placeholder'
+ import AceEditor from '@/components/AceEditor'
import yaml from 'js-yaml'
import {AXIOS} from './http-common'
export default {
components: {
- codemirror
+ AceEditor
},
data: () => ({
dropdown_font: [ 'Service', 'App', 'IP' ],
@@ -154,13 +146,7 @@
' - sayHello: \'force: return null\'\n' +
' - test: \'fail: return empty\'',
ruleText: '',
- cmOption: {
- theme: 'paraiso-light',
- autoRefresh: true,
- readOnly: false,
- mode: 'text/x-yaml',
- line: true
- },
+ readonly: false,
headers: [
{
text: 'Service Name',
@@ -191,7 +177,7 @@
this.ruleText = this.template
this.service = ''
this.dialog = false
- this.cmOption.readOnly = false
+ this.readonly = false
},
openDialog: function () {
this.dialog = true
@@ -227,7 +213,7 @@
this.service = config.service
delete config.service
this.ruleText = yaml.safeDump(config)
- this.cmOption.readOnly = true
+ this.readonly = true
this.dialog = true
})
break
@@ -238,7 +224,7 @@
this.service = config.service
delete config.service
this.ruleText = yaml.safeDump(config)
- this.cmOption.readOnly = false
+ this.readonly = false
this.dialog = true
})
break
@@ -261,11 +247,6 @@
})
}
},
- computed: {
- codemirror () {
- return this.$refs.myCm.codemirror
- }
- },
created () {
this.setHeight()
},
diff --git a/dubbo-admin-frontend/src/components/RoutingRule.vue b/dubbo-admin-frontend/src/components/RoutingRule.vue
index 6bcba1c..fc58de4 100644
--- a/dubbo-admin-frontend/src/components/RoutingRule.vue
+++ b/dubbo-admin-frontend/src/components/RoutingRule.vue
@@ -90,10 +90,7 @@
></v-text-field>
<v-subheader class="pa-0 mt-3">RULE CONTENT</v-subheader>
- <codemirror ref="myCm"
- v-model="ruleText"
- :options="cmOption">
- </codemirror>
+ <ace-editor v-model="ruleText" :readonly="readonly"></ace-editor>
</v-card-text>
<v-card-actions>
@@ -120,17 +117,12 @@
</template>
<script>
- import { codemirror } from 'vue-codemirror'
- import 'codemirror/lib/codemirror.css'
- import 'codemirror/theme/paraiso-light.css'
- import 'codemirror/mode/yaml/yaml.js'
- import 'codemirror/addon/display/autorefresh.js'
- import 'codemirror/addon/display/placeholder'
import yaml from 'js-yaml'
+ import AceEditor from '@/components/AceEditor'
import {AXIOS} from './http-common'
export default {
components: {
- codemirror
+ AceEditor
},
data: () => ({
dropdown_font: [ 'Service', 'App', 'IP' ],
@@ -197,13 +189,7 @@
' - \'application != kylin => host != 172.22.3.95,172.22.3.96\'\n' +
' - \'method = find*,list*,get*,is* => host = 172.22.3.94,172.22.3.95,172.22.3.96\'',
ruleText: '',
- cmOption: {
- theme: 'paraiso-light',
- autoRefresh: true,
- readOnly: false,
- mode: 'text/x-yaml',
- line: true
- },
+ readonly: false,
headers: [
{
text: 'Service Name',
@@ -251,7 +237,7 @@
this.updateId = -1
this.service = ''
this.dialog = false
- this.cmOption.readOnly = false
+ this.readonly = false
},
openDialog: function () {
this.dialog = true
@@ -298,7 +284,7 @@
this.service = route.service
delete route.service
this.ruleText = yaml.safeDump(route)
- this.cmOption.readOnly = true
+ this.readonly = true
this.dialog = true
})
break
@@ -311,7 +297,7 @@
this.service = route.service
delete route.service
this.ruleText = yaml.safeDump(route)
- this.cmOption.readOnly = false
+ this.readonly = false
this.dialog = true
this.updateId = item.id
})
@@ -363,11 +349,6 @@
}
}
},
- computed: {
- codemirror () {
- return this.$refs.myCm.codemirror
- }
- },
created () {
this.setHeight()
},
diff --git a/dubbo-admin-frontend/src/components/WeightAdjust.vue b/dubbo-admin-frontend/src/components/WeightAdjust.vue
index bc702a3..7a6e054 100644
--- a/dubbo-admin-frontend/src/components/WeightAdjust.vue
+++ b/dubbo-admin-frontend/src/components/WeightAdjust.vue
@@ -47,7 +47,7 @@
<v-card-text class="pa-0">
<v-data-table
:headers="headers"
- :items="loadBalances"
+ :items="weights"
hide-actions
class="elevation-0"
>
@@ -81,10 +81,8 @@
v-model="service"
></v-text-field>
<v-subheader class="pa-0 mt-3">RULE CONTENT</v-subheader>
- <codemirror ref="myCm"
- v-model="ruleText"
- :options="cmOption">
- </codemirror>
+
+ <ace-editor v-model="ruleText" :readonly="readonly"></ace-editor>
</v-card-text>
<v-card-actions>
@@ -111,17 +109,12 @@
</template>
<script>
- import { codemirror } from 'vue-codemirror'
- import 'codemirror/lib/codemirror.css'
- import 'codemirror/theme/paraiso-light.css'
- import 'codemirror/mode/yaml/yaml.js'
- import 'codemirror/addon/display/autorefresh.js'
- import 'codemirror/addon/display/placeholder'
+ import AceEditor from '@/components/AceEditor'
import yaml from 'js-yaml'
import {AXIOS} from './http-common'
export default {
components: {
- codemirror
+ AceEditor
},
data: () => ({
dropdown_font: [ 'Service', 'App', 'IP' ],
@@ -141,7 +134,7 @@
{id: 1, icon: 'edit', tooltip: 'Edit'},
{id: 3, icon: 'delete', tooltip: 'Delete'}
],
- configs: [
+ weights: [
],
template:
'weight: 100 # 100 for default\n' +
@@ -149,13 +142,7 @@
' - 192.168.0.1\n' +
' - 192.168.0.2',
ruleText: '',
- cmOption: {
- theme: 'paraiso-light',
- autoRefresh: true,
- readOnly: false,
- mode: 'text/x-yaml',
- line: true
- },
+ readonly: false,
headers: [
{
text: 'Service Name',
@@ -182,7 +169,7 @@
search: function (filter, rewrite) {
AXIOS.get('/weight/search?serviceName=' + filter)
.then(response => {
- this.loadBalances = response.data
+ this.weights = response.data
if (rewrite) {
this.$router.push({path: 'weight', query: {service: filter}})
}
@@ -192,7 +179,7 @@
this.ruleText = this.template
this.service = ''
this.dialog = false
- this.cmOption.readOnly = false
+ this.readonly = false
},
openDialog: function () {
this.dialog = true
@@ -226,7 +213,7 @@
this.service = weight.service
delete weight.service
this.ruleText = yaml.safeDump(weight)
- this.cmOption.readOnly = true
+ this.readonly = true
this.dialog = true
})
break
@@ -237,7 +224,7 @@
this.service = weight.service
delete weight.service
this.ruleText = yaml.safeDump(weight)
- this.cmOption.readOnly = false
+ this.readonly = false
this.dialog = true
})
break
@@ -260,11 +247,6 @@
})
}
},
- computed: {
- codemirror () {
- return this.$refs.myCm.codemirror
- }
- },
created () {
this.setHeight()
},