pipeline.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /* eslint-disable max-len */
  2. /* eslint-disable import/no-extraneous-dependencies */
  3. /* eslint-disable @typescript-eslint/no-var-requires */
  4. const router = require('express').Router();
  5. const Mock = require('mockjs');
  6. const wrapper = require('../wrapper');
  7. const { Random } = Mock;
  8. router.delete((req, res) => {
  9. res.json(wrapper('success'));
  10. });
  11. router.get((req, res) => {
  12. res.json(wrapper({
  13. configJson: {
  14. code: 0,
  15. data: {
  16. configJson: 'string',
  17. id: 0,
  18. },
  19. msg: 'string',
  20. },
  21. id: req.params.pipelineId,
  22. }));
  23. });
  24. router.post((req, res) => {
  25. res.json(wrapper('success'));
  26. });
  27. router.put('/config', (req, res) => {
  28. res.json(wrapper('success'));
  29. });
  30. router.get('/history/list', (req, res) => {
  31. res.json(wrapper(
  32. Mock.mock(
  33. {
  34. 'data|10': [{
  35. details: `2021-03-16 00:01:58.621 INFO 20584 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
  36. 2021-03-16 00:01:58.622 INFO 20584 --- [ main] d.s.w.p.DocumentationPluginsBootstrapper : Context refreshed
  37. 2021-03-16 00:01:58.634 INFO 20584 --- [ main] d.s.w.p.DocumentationPluginsBootstrapper : Found 1 custom documentation plugin(s)
  38. 2021-03-16 00:01:58.641 INFO 20584 --- [ main] s.d.s.w.s.ApiListingReferenceScanner : Scanning for api listing references
  39. 2021-03-16 00:01:58.974 INFO 20584 --- [ main] DeferredRepositoryInitializationListener : Triggering deferred initialization of Spring Data repositories…
  40. 2021-03-16 00:01:58.975 INFO 20584 --- [ main] DeferredRepositoryInitializationListener : Spring Data repositories initialized!
  41. 2021-03-16 00:01:58.993 INFO 20584 --- [ main] s.devcloud.web.DevcloudWebApplication : Started DevcloudWebApplication in 6.659 seconds (JVM running for 8.913)
  42. 2021-03-16 00:12:39.211 INFO 20584 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
  43. 2021-03-16 00:12:39.211 INFO 20584 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
  44. 2021-03-16 00:12:39.222 INFO 20584 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 11 ms`,
  45. 'id|+5': 101,
  46. pipelineId: 100,
  47. 'result|1': ['成功', '失败', '执行中'],
  48. startTime: {
  49. date: 0,
  50. day: 1,
  51. 'hours|+1': 12,
  52. 'minutes|+1': 30,
  53. month: 3,
  54. nanos: 0,
  55. 'seconds|+1': 15,
  56. time: 0,
  57. timezoneOffset: 0,
  58. year: 2021,
  59. },
  60. username: 'hkshu12',
  61. }],
  62. },
  63. ).data,
  64. ));
  65. });
  66. router.get('/list', (req, res) => {
  67. res.json(wrapper(
  68. Mock.mock(
  69. {
  70. 'data|10': [{
  71. details: `2021-03-16 00:01:58.621 INFO 20584 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
  72. 2021-03-16 00:01:58.622 INFO 20584 --- [ main] d.s.w.p.DocumentationPluginsBootstrapper : Context refreshed
  73. 2021-03-16 00:01:58.634 INFO 20584 --- [ main] d.s.w.p.DocumentationPluginsBootstrapper : Found 1 custom documentation plugin(s)
  74. 2021-03-16 00:01:58.641 INFO 20584 --- [ main] s.d.s.w.s.ApiListingReferenceScanner : Scanning for api listing references
  75. 2021-03-16 00:01:58.974 INFO 20584 --- [ main] DeferredRepositoryInitializationListener : Triggering deferred initialization of Spring Data repositories…
  76. 2021-03-16 00:01:58.975 INFO 20584 --- [ main] DeferredRepositoryInitializationListener : Spring Data repositories initialized!
  77. 2021-03-16 00:01:58.993 INFO 20584 --- [ main] s.devcloud.web.DevcloudWebApplication : Started DevcloudWebApplication in 6.659 seconds (JVM running for 8.913)
  78. 2021-03-16 00:12:39.211 INFO 20584 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
  79. 2021-03-16 00:12:39.211 INFO 20584 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
  80. 2021-03-16 00:12:39.222 INFO 20584 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 11 ms`,
  81. 'id|+1': 100,
  82. name: Random.cname(),
  83. 'result|1': ['成功', '失败', '执行中'],
  84. startTime: {
  85. date: 0,
  86. day: 1,
  87. 'hours|+1': 12,
  88. 'minutes|+1': 30,
  89. month: 3,
  90. nanos: 0,
  91. 'seconds|+1': 15,
  92. time: 0,
  93. timezoneOffset: 0,
  94. year: 2021,
  95. },
  96. username: 'hkshu12',
  97. }],
  98. },
  99. ).data,
  100. ));
  101. });
  102. module.exports = router;