ViewConvertSchema.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <template>
  2. <main v-if="schema">
  3. <h1>View schema</h1>
  4. <hr/>
  5. <br/>
  6. <p><b>Version from</b>: {{ schema.versionFrom }}</p>
  7. <p><b>Version to</b>: {{ schema.versionTo }}</p>
  8. <p><b>Changes</b>: </p>
  9. <div class="changes-container">
  10. <div v-for="(key, value) in schema.changes" class="change-item">
  11. <p><b>{{ key }}</b>: {{ value }}</p>
  12. </div>
  13. </div>
  14. <br/>
  15. <br/>
  16. <button class="button" @click="removeSchema()">Remove schema</button>
  17. </main>
  18. </template>
  19. <script>
  20. import io from "../../io.js";
  21. export default {
  22. components: {},
  23. data: () => {
  24. return {
  25. schema: null
  26. }
  27. },
  28. props: {
  29. },
  30. methods: {
  31. removeSchema() {
  32. this.socket.emit("convertSchema.removeById", this.schemaId, (res) => {
  33. alert(res.status);
  34. this.$router.push("/convert");
  35. });
  36. }
  37. },
  38. mounted() {
  39. this.schemaId = this.$route.params.schemaId;
  40. io.getSocket(socket => {
  41. this.socket = socket;
  42. this.socket.emit("convertSchema.getById", this.schemaId, res => {
  43. if (res.status === "success") {
  44. this.schema = res.schema;
  45. this.schema.changes = {
  46. Test123: "test1232321"
  47. }
  48. }
  49. });
  50. });
  51. }
  52. };
  53. </script>
  54. <style lang="scss" scoped>
  55. .change-item {
  56. padding-left: 25px;
  57. border: 1px solid black;
  58. margin-right: -1px;
  59. margin-bottom: -1px;
  60. }
  61. </style>