pipeline.js 3.0 KB

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