import axios from 'axios';
var data = JSON.stringify({
   "namespace": "argo",
   "template_name": "repo-runtime-workflow",
   "parameters": {
      "git-schema": "http",
      "git-domain": "gitea-service-http.cropflow-dev.svc.cluster.local:3000",
      "git-user": "cavin",
      "git-repo": "smart-crop-ui",
      "git-revision": "main",
      "git-pat": "b6c02bf1aec73d7bbbfbe590ea37564a29c4bd5d",
      "docker-image-domain": "172.16.102.3:30648",
      "docker-dockerfile-path": "./Dockerfile.crop-x",
      "resource-cpu-limit": "500m",
      "resource-memory-limit": "512Mi",
      "resource-gpu-mem-limit": "",
      "resource-mount-path": "/data",
      "resource-mount-capacity": "",
      "app-namespace": "argo",
      "app-env-vars": "",
      "app-ingress-host": ".dev.maimaiag.com",
      "app-container-port": "3000",
      "security-scan-enabled": "false"
   }
});

var config = {
   method: 'post',
   url: 'https://gitea-admin-argo-workflow-api-app.dev.maimaiag.com/api/v1/workflows/from-template',
   headers: { 
      'Content-Type': 'application/json'
   },
   data : data
};

axios(config)
.then(function (response) {
   
   let url = `https://gitea-admin-argo-workflow-api-app.dev.maimaiag.com/api/v1/workflows/${response.data.name}/log`
   console.log(`打开 ${url} 查看日志`);
})
.catch(function (error) {
   console.log(error);
});
