ViewConvertSchema.vue 1.1 KB

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