index.ftl 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <#import "/spring.ftl" as spring />
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  3. <html>
  4. <head>
  5. <base href="${basePath}">
  6. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  7. <title>Hystrix Dashboard</title>
  8. <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
  9. </head>
  10. <body>
  11. <div id="app">
  12. <el-container>
  13. <el-main>
  14. <div style="width:600px;margin:0 auto;">
  15. <center>
  16. <img width="264" height="233" src="<@spring.url '/hystrix'/>/images/hystrix-logo.png">
  17. <br>
  18. <br>
  19. <h2>PigX Hystrix Dashboard</h2>
  20. <el-form ref="form" :model="form" label-width="80px">
  21. <el-form-item label="stream">
  22. <el-input v-model="form.stream"></el-input>
  23. </el-form-item>
  24. <el-form-item label="delay">
  25. <el-input v-model="form.delay"></el-input>
  26. </el-form-item>
  27. <el-form-item label="title">
  28. <el-input v-model="form.title"></el-input>
  29. </el-form-item>
  30. <el-form-item>
  31. <el-button type="primary" @click="sendToMonitor">开始监控</el-button>
  32. </el-form-item>
  33. </el-form>
  34. </center>
  35. </div>
  36. </el-main>
  37. </el-container>
  38. </div>
  39. </body>
  40. </html>
  41. <script src="https://unpkg.com/vue/dist/vue.js"></script>
  42. <script src="https://unpkg.com/element-ui/lib/index.js"></script>
  43. <script>
  44. new Vue({
  45. el: '#app',
  46. data() {
  47. return {
  48. form: {
  49. stream: '',
  50. delay: '',
  51. title: '',
  52. }
  53. }
  54. },
  55. methods: {
  56. sendToMonitor() {
  57. if ($('#stream').val().length > 0) {
  58. var url = "<@spring.url '/hystrix'/>/monitor?stream=" + encodeURIComponent($('#stream').val()) + "";
  59. if ($('#delay').val().length > 0) {
  60. url += "&delay=" + $('#delay').val();
  61. }
  62. if ($('#title').val().length > 0) {
  63. url += "&title=" + encodeURIComponent($('#title').val());
  64. }
  65. location.href = url;
  66. } else {
  67. this.$message({
  68. message: "The 'stream' value is required.",
  69. type: 'warning'
  70. });
  71. }
  72. }
  73. }
  74. })
  75. </script>