pipeline.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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.get('/templates', (req, res) => {
  28. res.json(wrapper(['Java', 'MySQL', 'Node', 'Go', 'Android']));
  29. });
  30. router.put('/config', (req, res) => {
  31. res.json(wrapper('success'));
  32. });
  33. router.get('/history/list', (req, res) => {
  34. res.json(wrapper(
  35. Mock.mock(
  36. {
  37. 'data|10': [{
  38. 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 ''
  39. 2021-03-16 00:01:58.622 INFO 20584 --- [ main] d.s.w.p.DocumentationPluginsBootstrapper : Context refreshed
  40. 2021-03-16 00:01:58.634 INFO 20584 --- [ main] d.s.w.p.DocumentationPluginsBootstrapper : Found 1 custom documentation plugin(s)
  41. 2021-03-16 00:01:58.641 INFO 20584 --- [ main] s.d.s.w.s.ApiListingReferenceScanner : Scanning for api listing references
  42. 2021-03-16 00:01:58.974 INFO 20584 --- [ main] DeferredRepositoryInitializationListener : Triggering deferred initialization of Spring Data repositories…
  43. 2021-03-16 00:01:58.975 INFO 20584 --- [ main] DeferredRepositoryInitializationListener : Spring Data repositories initialized!
  44. 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)
  45. 2021-03-16 00:12:39.211 INFO 20584 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
  46. 2021-03-16 00:12:39.211 INFO 20584 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
  47. 2021-03-16 00:12:39.222 INFO 20584 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 11 ms`,
  48. 'id|+5': 101,
  49. pipelineId: 100,
  50. 'result|1': ['成功', '失败', '执行中'],
  51. startTime: {
  52. date: 0,
  53. day: 1,
  54. 'hours|+1': 12,
  55. 'minutes|+1': 30,
  56. month: 3,
  57. nanos: 0,
  58. 'seconds|+1': 15,
  59. time: 0,
  60. timezoneOffset: 0,
  61. year: 2021,
  62. },
  63. username: 'hkshu12',
  64. }],
  65. },
  66. ).data,
  67. ));
  68. });
  69. router.get('/list', (req, res) => {
  70. res.json(wrapper(
  71. Mock.mock(
  72. {
  73. 'data|10': [{
  74. 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 ''
  75. 2021-03-16 00:01:58.622 INFO 20584 --- [ main] d.s.w.p.DocumentationPluginsBootstrapper : Context refreshed
  76. 2021-03-16 00:01:58.634 INFO 20584 --- [ main] d.s.w.p.DocumentationPluginsBootstrapper : Found 1 custom documentation plugin(s)
  77. 2021-03-16 00:01:58.641 INFO 20584 --- [ main] s.d.s.w.s.ApiListingReferenceScanner : Scanning for api listing references
  78. 2021-03-16 00:01:58.974 INFO 20584 --- [ main] DeferredRepositoryInitializationListener : Triggering deferred initialization of Spring Data repositories…
  79. 2021-03-16 00:01:58.975 INFO 20584 --- [ main] DeferredRepositoryInitializationListener : Spring Data repositories initialized!
  80. 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)
  81. 2021-03-16 00:12:39.211 INFO 20584 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
  82. 2021-03-16 00:12:39.211 INFO 20584 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
  83. 2021-03-16 00:12:39.222 INFO 20584 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 11 ms`,
  84. 'id|+1': 100,
  85. name: Random.cname(),
  86. 'result|1': ['成功', '失败', '执行中'],
  87. startTime: {
  88. date: 0,
  89. day: 1,
  90. 'hours|+1': 12,
  91. 'minutes|+1': 30,
  92. month: 3,
  93. nanos: 0,
  94. 'seconds|+1': 15,
  95. time: 0,
  96. timezoneOffset: 0,
  97. year: 2021,
  98. },
  99. username: 'hkshu12',
  100. }],
  101. },
  102. ).data,
  103. ));
  104. });
  105. module.exports = router;