pipeline.js 4.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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: Random.datetime(),
  52. username: 'hkshu12',
  53. }],
  54. },
  55. ).data,
  56. ));
  57. });
  58. router.get('/list', (req, res) => {
  59. res.json(wrapper(
  60. Mock.mock(
  61. {
  62. 'data|10': [{
  63. 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 ''
  64. 2021-03-16 00:01:58.622 INFO 20584 --- [ main] d.s.w.p.DocumentationPluginsBootstrapper : Context refreshed
  65. 2021-03-16 00:01:58.634 INFO 20584 --- [ main] d.s.w.p.DocumentationPluginsBootstrapper : Found 1 custom documentation plugin(s)
  66. 2021-03-16 00:01:58.641 INFO 20584 --- [ main] s.d.s.w.s.ApiListingReferenceScanner : Scanning for api listing references
  67. 2021-03-16 00:01:58.974 INFO 20584 --- [ main] DeferredRepositoryInitializationListener : Triggering deferred initialization of Spring Data repositories…
  68. 2021-03-16 00:01:58.975 INFO 20584 --- [ main] DeferredRepositoryInitializationListener : Spring Data repositories initialized!
  69. 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)
  70. 2021-03-16 00:12:39.211 INFO 20584 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
  71. 2021-03-16 00:12:39.211 INFO 20584 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
  72. 2021-03-16 00:12:39.222 INFO 20584 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 11 ms`,
  73. 'id|+1': 100,
  74. name: Random.cname(),
  75. 'result|1': ['成功', '失败', '执行中'],
  76. startTime: Random.datetime(),
  77. username: 'hkshu12',
  78. }],
  79. },
  80. ).data,
  81. ));
  82. });
  83. module.exports = router;