| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- /* eslint-disable max-len */
- /* eslint-disable import/no-extraneous-dependencies */
- /* eslint-disable @typescript-eslint/no-var-requires */
- const router = require('express').Router();
- const Mock = require('mockjs');
- const wrapper = require('../wrapper');
- const { Random } = Mock;
- router.delete('', (req, res) => {
- res.json(wrapper('success'));
- });
- router.get('', (req, res) => {
- res.json(wrapper({
- configJson: JSON.stringify([
- {
- name: 'java-image-build',
- active: true,
- configs: {
- repoUrl: '#todo',
- branchName: '#todo',
- jarName: '#todo',
- },
- },
- {
- name: 'k8s-namespace',
- active: true,
- configs: {
- },
- },
- {
- name: 'k8s-deployment',
- active: true,
- configs: {
- port: '#todo',
- },
- },
- {
- name: 'k8s-service',
- active: true,
- configs: {
- },
- },
- {
- name: 'k8s-ingress',
- active: true,
- configs: {
- },
- },
- ]),
- id: req.params.pipelineId,
- }));
- });
- router.post('', (req, res) => {
- res.json(wrapper('success'));
- });
- router.get('/templates', (req, res) => {
- res.json(wrapper(['Java', 'MySQL', 'Node', 'Go', 'Android']));
- });
- router.put('/config', (req, res) => {
- res.json(wrapper('success'));
- });
- router.get('/record/list', (req, res) => {
- res.json(wrapper(
- Mock.mock(
- {
- 'data|10': [{
- 'id|+5': 101,
- pipelineId: 100,
- 'result|1': ['成功', '失败', '执行中'],
- startTime: {
- date: 0,
- day: 1,
- 'hours|+1': 12,
- 'minutes|+1': 30,
- month: 3,
- nanos: 0,
- 'seconds|+1': 15,
- time: 0,
- timezoneOffset: 0,
- year: 2021,
- },
- username: 'hkshu12',
- }],
- },
- ).data,
- ));
- });
- router.get('/record', (req, res) => {
- res.json(wrapper(
- Mock.mock({
- 'id|+5': 101,
- pipelineId: 100,
- 'result|1': ['成功', '失败', '执行中'],
- startTime: Random.datetime(),
- username: 'hkshu12',
- }).data,
- ));
- });
- router.get('/record/details', (req, res) => {
- 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 ''
- 2021-03-16 00:01:58.622 INFO 20584 --- [ main] d.s.w.p.DocumentationPluginsBootstrapper : Context refreshed
- 2021-03-16 00:01:58.634 INFO 20584 --- [ main] d.s.w.p.DocumentationPluginsBootstrapper : Found 1 custom documentation plugin(s)
- 2021-03-16 00:01:58.641 INFO 20584 --- [ main] s.d.s.w.s.ApiListingReferenceScanner : Scanning for api listing references
- 2021-03-16 00:01:58.974 INFO 20584 --- [ main] DeferredRepositoryInitializationListener : Triggering deferred initialization of Spring Data repositories…
- 2021-03-16 00:01:58.975 INFO 20584 --- [ main] DeferredRepositoryInitializationListener : Spring Data repositories initialized!
- 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)
- 2021-03-16 00:12:39.211 INFO 20584 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
- 2021-03-16 00:12:39.211 INFO 20584 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
- 2021-03-16 00:12:39.222 INFO 20584 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 11 ms`));
- });
- router.get('/list', (req, res) => {
- res.json(wrapper(
- Mock.mock(
- {
- 'data|10': [{
- 'id|+1': 100,
- name: Random.cname(),
- 'result|1': ['成功', '失败', '执行中'],
- startTime: {
- date: 0,
- day: 1,
- 'hours|+1': 12,
- 'minutes|+1': 30,
- month: 3,
- nanos: 0,
- 'seconds|+1': 15,
- time: 0,
- timezoneOffset: 0,
- year: 2021,
- },
- username: 'hkshu12',
- }],
- },
- ).data,
- ));
- });
- module.exports = router;
|