You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by il...@apache.org on 2018/09/10 02:40:44 UTC
[incubator-dubbo-ops] branch develop updated: add codemirror (#101)
This is an automated email from the ASF dual-hosted git repository.
iluo 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 2803639 add codemirror (#101)
2803639 is described below
commit 28036397737cd472a95dbd1e905efe77c3a6664d
Author: min <z8...@gmail.com>
AuthorDate: Mon Sep 10 10:40:41 2018 +0800
add codemirror (#101)
* add codemirror
* remove unused import
---
.../dubbo/admin/controller/RoutesController.java | 17 +++
dubbo-admin/dubbo-admin-frontend/package.json | 2 +-
.../src/components/RoutingRule.vue | 135 +++++++++------------
3 files changed, 77 insertions(+), 77 deletions(-)
diff --git a/dubbo-admin/dubbo-admin-backend/src/main/java/org/apache/dubbo/admin/controller/RoutesController.java b/dubbo-admin/dubbo-admin-backend/src/main/java/org/apache/dubbo/admin/controller/RoutesController.java
new file mode 100644
index 0000000..3928d5f
--- /dev/null
+++ b/dubbo-admin/dubbo-admin-backend/src/main/java/org/apache/dubbo/admin/controller/RoutesController.java
@@ -0,0 +1,17 @@
+package org.apache.dubbo.admin.controller;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/api/routes")
+public class RoutesController {
+
+
+ @RequestMapping("/create")
+ public void createRule(@RequestParam String serviceName, @RequestParam String rule) {
+
+ }
+
+}
\ No newline at end of file
diff --git a/dubbo-admin/dubbo-admin-frontend/package.json b/dubbo-admin/dubbo-admin-frontend/package.json
index 70c0488..9843430 100644
--- a/dubbo-admin/dubbo-admin-frontend/package.json
+++ b/dubbo-admin/dubbo-admin-frontend/package.json
@@ -12,8 +12,8 @@
},
"dependencies": {
"axios": "^0.18.0",
- "codemirror": "^5.39.2",
"vue": "^2.5.2",
+ "vue-codemirror": "^4.0.5",
"vue-router": "^3.0.1",
"vuetify": "^1.0.0",
"vuex": "^3.0.1"
diff --git a/dubbo-admin/dubbo-admin-frontend/src/components/RoutingRule.vue b/dubbo-admin/dubbo-admin-frontend/src/components/RoutingRule.vue
index a91a5e7..01b46ac 100644
--- a/dubbo-admin/dubbo-admin-frontend/src/components/RoutingRule.vue
+++ b/dubbo-admin/dubbo-admin-frontend/src/components/RoutingRule.vue
@@ -20,30 +20,13 @@
<div>
<v-layout row wrap>
<v-flex xs12 >
- <!--<v-form>-->
- <!--<v-layout row wrap>-->
- <!--<v-flex xs11>-->
- <!--<v-text-field label="Search dubbo service"-->
- <!--v-model="filter"></v-text-field>-->
- <!--</v-flex>-->
-
- <!--<v-flex xs1>-->
- <!--<v-btn @click="submit" color="primary" >Search</v-btn>-->
- <!--</v-flex>-->
- <!--</v-layout>-->
- <!--</v-form>-->
<v-card flat>
<v-card-text>
- <v-layout row wrap >
- <!--<v-flex xs10>-->
- <v-text-field label="Search dubbo service"
- v-model="filter"></v-text-field>
- <!--</v-flex>-->
-
- <!--<v-flex xs1>-->
- <v-btn @click="submit" color="primary" >Search</v-btn>
- <!--</v-flex>-->
- </v-layout>
+ <v-layout row wrap >
+ <v-text-field label="Search dubbo service"
+ v-model="filter"></v-text-field>
+ <v-btn @click="submit" color="primary" >Search</v-btn>
+ </v-layout>
</v-card-text>
@@ -53,7 +36,7 @@
<v-toolbar class="elevation-1" flat color="white">
<v-toolbar-title>Search Result</v-toolbar-title>
<v-spacer></v-spacer>
- <v-btn outline color="primary" @click.stop="dialog = true" class="mb-2">CREATE</v-btn>
+ <v-btn outline color="primary" @click.stop="openDialog" class="mb-2">CREATE</v-btn>
</v-toolbar>
<v-data-table
:headers="headers"
@@ -104,13 +87,25 @@
<span class="headline">Create new Routing rule</span>
</v-card-title>
<v-card-text >
- <v-textarea
- name="input-7-1"
- box
- :height="height"
- label="Label"
- :placeholder="placeholder"
- ></v-textarea>
+ <v-text-field
+ placeholder="service:version or application, version is optional"
+ required
+ ref="scope"
+ :rules="[() => !!scope || 'This field is required']"
+ v-model="scope"
+ ></v-text-field>
+ <v-text-field
+ placeholder="group, only effective on service"
+ v-model="group"
+ ></v-text-field>
+ <!--<v-textarea-->
+ <!--id="rule-content"-->
+ <!--name="input-7-1"-->
+ <!--box-->
+ <!--:height="height"-->
+ <!--:placeholder="placeholder"-->
+ <!--></v-textarea>-->
+ <codemirror :placeholder='placeholder' :options="cmOption"></codemirror>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
@@ -123,13 +118,22 @@
</template>
<script>
+ import { codemirror } from 'vue-codemirror'
+ import 'codemirror/lib/codemirror.css'
+ import 'codemirror/mode/yaml/yaml.js'
+ import 'codemirror/addon/display/placeholder'
export default {
+ components: {
+ codemirror
+ },
data: () => ({
dropdown_font: [ 'Service', 'App', 'IP' ],
pattern: 'Service',
filter: '',
dialog: false,
- selected: [],
+ group: '',
+ scope: '',
+ height: 0,
routingRules: [
{
id: 0,
@@ -139,45 +143,25 @@
status: 'enabled'
}
],
- placeholder: 'dataId: serviceKey + CONFIGURATORS\n' +
- '\n' +
- '%yaml 1.2\n' +
- '---\n' +
- 'scope: service/application\n' +
- 'key: serviceKey/appName\n' +
- 'configs:\n' +
- ' - addresses:[ip1, ip2]\n' +
- ' apps: [app1, app2]\n' +
- ' services: [s1, s2]\n' +
- ' side: provider\n' +
- ' rules:\n' +
- ' threadpool:\n' +
- ' size:\n' +
- ' core:\n' +
- ' queue:\n' +
- ' cluster:\n' +
- ' loadbalance:\n' +
- ' cluster:\n' +
- ' config:\n' +
- ' timeout:\n' +
- ' weight:\n' +
- ' mock: return null\n' +
- ' - addresses: [ip1, ip2]\n' +
- ' rules:\n' +
- ' threadpool:\n' +
- ' size:\n' +
- ' core:\n' +
- ' queue:\n' +
- ' cluster:\n' +
- ' loadbalance:\n' +
- ' cluster:\n' +
- ' config:\n' +
- ' timeout:\n' +
- ' weight:\n' +
- ' apps: [app1, app2]\n' +
- ' services: [s1, s2]\n' +
- ' side: provider\n' +
- '...\n',
+ placeholder: '%yaml 1.2\n' +
+ '---\n' +
+ 'enable: true/false\n' +
+ 'priority:\n' +
+ 'runtime: false/true\n' +
+ 'category: routers\n' +
+ 'force: true/false\n' +
+ 'dynamic: true/false\n' +
+ 'conditions:\n' +
+ ' - => host != 172.22.3.91\n' +
+ ' - host != 10.20.153.10,10.20.153.11 =>\n' +
+ ' - host = 10.20.153.10,10.20.153.11 =>\n' +
+ ' - 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\n' +
+ '...\n',
+ cmOption: {
+ lineNumbers: true,
+ mode: 'text/x-yaml'
+ },
headers: [
{
text: 'Rule Name',
@@ -207,12 +191,11 @@
]
}),
methods: {
- submit () {
+ submit: function () {
console.log('submit')
},
- toggleAll () {
- if (this.selected.length) this.selected = []
- else this.selected = this.routingRules.slice()
+ openDialog: function () {
+ this.dialog = true
},
enable: function (status) {
if (status === 'enabled') {
@@ -221,10 +204,10 @@
return 'enable'
},
setHeight: function () {
- this.height = window.innerHeight * 0.65
- console.log(this.height)
+ this.height = window.innerHeight * 0.5
}
},
+
created () {
this.setHeight()
}