Merge pull request #27 from mgr9525/dev

Dev->Master
This commit is contained in:
Linsk Ruis 2020-12-15 10:26:41 +08:00 committed by GitHub
commit d97eea3b32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 88 additions and 41 deletions

1
.gitignore vendored
View File

@ -2,6 +2,7 @@
*.dat
*.class
/ruis.go
# Mobile Tools for Java (J2ME)
.mtj.tmp/

View File

@ -16,6 +16,7 @@ func bdsqls() {
ioutil.WriteFile("comm/dbfl.go",
[]byte(fmt.Sprintf("package comm\n\nconst sqls = `\n%s\n`", string(bts))),
0644)
println("sql insert go ok!!!")
}
func bdzip() {
bts, _ := ioutil.ReadFile("uis/vue-admin/dist/dist.zip")
@ -23,4 +24,5 @@ func bdzip() {
ioutil.WriteFile("comm/vuefl.go",
[]byte(fmt.Sprintf("package comm\n\nconst StaticPkg = \"%s\"", cont)),
0644)
println("ui insert go ok!!!")
}

File diff suppressed because one or more lines are too long

View File

@ -56,6 +56,36 @@ function main(){
ret.check=true;
return ret
}
`,
}
HookjsMap["gitea"] = &Hookjs{
Uis: map[string]string{"token": "string", "branch": "string"},
Desc: "secret:秘钥,branch:push对象分支",
Defs: `{"secret":"pwd","branch":"master"}`,
js: `
function main(){
console.log('start run main function!!!!');
var ret={check:false};
var conf=getConf();
var body=getBody();
var event=getHeader('X-Gitea-Event');
if(conf.secret!=body.secret){
ret.errs='触发请求秘钥错误';
return ret;
}
if(event!='push'||!body.ref||body.ref==''){
return ret;
}
console.log(conf.branch,body.ref);
if(conf.branch&&conf.branch!=''&&body.ref!='refs/heads/'+conf.branch){
return ret;
}
ret.check=true;
return ret
}
`,
}
HookjsMap["github"] = &Hookjs{

View File

@ -13,9 +13,9 @@ func Init() {
comm.Gin.Use(core.MidAccessAllow)
//comm模块路由
gpComm := comm.Gin.Group("/comm")
// comm模块路由
{
gpComm := comm.Gin.Group("/comm")
gpComm.Any("/info", server.CommInfo)
gpLogin := comm.Gin.Group("/lg")
gpLogin.Any("/info", server.LoginInfo)
@ -24,9 +24,9 @@ func Init() {
gpLogin.Any("/uppass", core.GinHandler(server.Uppass))
}
//流水线路由
gpModel := comm.Gin.Group("/model")
// 流水线路由
{
gpModel := comm.Gin.Group("/model")
gpModel.Use(utilService.MidNeedLogin)
gpModel.Any("/get", core.GinHandler(server.ModelGet))
gpModel.Any("/list", core.GinHandler(server.ModelList))
@ -38,9 +38,9 @@ func Init() {
gpModel.Any("/copy", core.GinHandler(server.ModelCopy))
}
//插件路由
gpPlug := comm.Gin.Group("/plug")
// 插件路由
{
gpPlug := comm.Gin.Group("/plug")
gpPlug.Use(utilService.MidNeedLogin)
gpPlug.Any("/list", core.GinHandler(server.PlugList))
gpPlug.Any("/edit", core.GinHandler(server.PlugEdit))
@ -49,9 +49,9 @@ func Init() {
gpPlug.Any("/log", core.GinHandler(server.PlugLog))
}
//触发器路由
gpTimer := comm.Gin.Group("/trigger")
// 触发器路由
{
gpTimer := comm.Gin.Group("/trigger")
gpTimer.Use(utilService.MidNeedLogin)
gpTimer.Any("/list", core.GinHandler(server.TriggerList))
gpTimer.Any("/edit", core.GinHandler(server.TriggerEdit))
@ -59,9 +59,9 @@ func Init() {
gpTimer.Any("/hooks", server.TriggerHooks)
}
//hook
gpHook := comm.Gin.Group("/hook")
// hook
{
gpHook := comm.Gin.Group("/hook")
gpHook.Any("/trigger/:trid", server.HookTrigger)
}
}

View File

@ -19,7 +19,7 @@ func TriggerList(c *gin.Context, req *ruisUtil.Map) {
ls := make([]*model.TTrigger, 0)
ses := comm.Db.Where("del !='1'")
if q != "" {
ses.And("name like ?", "%"+q+"%")
ses.And("title like ?", "%"+q+"%")
}
page, err := core.XormFindPage(ses, &ls, pg, 20)
if err != nil {

View File

@ -10,7 +10,7 @@
"build": "node build/build.js"
},
"dependencies": {
"axios": "^0.15.3",
"axios": "^0.21.0",
"echarts": "^3.3.2",
"element-ui": "^2.10.1",
"font-awesome": "^4.7.0",

View File

@ -23,23 +23,29 @@
<el-table-column type="index" width="60">
</el-table-column>
<el-table-column label="名称" width="250">
<template slot-scope="{row}">
{{row.Title}}
<template slot-scope="{row}">
{{ row.Title }}
<el-tag size="mini" type="success" v-if="row.Enable==1">已激活</el-tag>
<el-tag size="mini" type="danger" v-else>未激活</el-tag>
</template>
</template>
</el-table-column>
<el-table-column label="描述">
<template slot-scope="{row}">
<span>{{row.Desc}}</span>
<div><el-tag type="danger" v-if="row.Errs!=''">{{row.Errs}}</el-tag></div>
<div><el-tag type="info" v-if="row.Types == 'hook'">hook地址/hook/trigger/{{row.Id}}</el-tag></div>
</template>
<template slot-scope="{row}">
<span>{{ row.Desc }}</span>
<div>
<el-tag type="danger" v-if="row.Errs!=''">{{ row.Errs }}</el-tag>
</div>
<div>
<el-tag type="info" v-if="row.Types == 'hook'">hook地址
{{host}}hook/trigger/{{ row.Id }}
</el-tag>
</div>
</template>
</el-table-column>
<el-table-column prop="Types" label="触发器类型" width="150" :formatter="typesFormatter">
<template slot-scope="{row}">
{{getTypes(row.Types)}}
</template>
<template slot-scope="{row}">
{{ getTypes(row.Types) }}
</template>
</el-table-column>
<el-table-column prop="Times" label="创建时间" width="200" :formatter="dateFormat" sortable>
</el-table-column>
@ -85,6 +91,7 @@ export default {
limit: 0,
listdata: [],
sels: [],//
host: "",
}
},
mounted() {
@ -95,6 +102,11 @@ export default {
getList() {
this.loading = true;
//NProgress.start();
// URL
const routerIndex = window.location.href.indexOf('#');
const url = window.location.href.slice(0, routerIndex > 0 ? routerIndex : window.location.href.length);
console.log("xxx:", url)
this.host = url;
this.$post('/trigger/list', this.filters).then((res) => {
console.log(res);
this.loading = false;
@ -127,11 +139,15 @@ export default {
});
});
}, getTypes(typ) {
switch(typ){
case "timer":return "定时器";
case "hook":return "hook";
case "worked":return "流水线结束";
default:return typ;
switch (typ) {
case "timer":
return "定时器";
case "hook":
return "hook";
case "worked":
return "流水线结束";
default:
return typ;
}
},
dateFormat: function (row, column) {

View File

@ -310,12 +310,12 @@ axios-mock-adapter@^1.7.1:
fast-deep-equal "^3.1.1"
is-buffer "^2.0.3"
axios@^0.15.3:
version "0.15.3"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.15.3.tgz#2c9d638b2e191a08ea1d6cc988eadd6ba5bdc053"
integrity sha1-LJ1jiy4ZGgjqHWzJiOrda6W9wFM=
axios@^0.21.0:
version "0.21.0"
resolved "https://registry.npm.taobao.org/axios/download/axios-0.21.0.tgz#26df088803a2350dff2c27f96fef99fe49442aca"
integrity sha1-Jt8IiAOiNQ3/LCf5b++Z/klEKso=
dependencies:
follow-redirects "1.0.0"
follow-redirects "^1.10.0"
babel-code-frame@^6.11.0, babel-code-frame@^6.26.0:
version "6.26.0"
@ -2543,18 +2543,16 @@ flush-write-stream@^1.0.0:
inherits "^2.0.3"
readable-stream "^2.3.6"
follow-redirects@1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.0.0.tgz#8e34298cbd2e176f254effec75a1c78cc849fd37"
integrity sha1-jjQpjL0uF28lTv/sdaHHjMhJ/Tc=
dependencies:
debug "^2.2.0"
follow-redirects@^1.0.0:
version "1.13.0"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.13.0.tgz#b42e8d93a2a7eea5ed88633676d6597bc8e384db"
integrity sha512-aq6gF1BEKje4a9i9+5jimNFIpq4Q1WiwBToeRK5NvZBd/TRsmW8BsJfOEGkr76TbOyPVD3OVDN910EcUNtRYEA==
follow-redirects@^1.10.0:
version "1.13.1"
resolved "https://registry.npm.taobao.org/follow-redirects/download/follow-redirects-1.13.1.tgz?cache=0&sync_timestamp=1607916886138&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ffollow-redirects%2Fdownload%2Ffollow-redirects-1.13.1.tgz#5f69b813376cee4fd0474a3aba835df04ab763b7"
integrity sha1-X2m4Ezds7k/QR0o6uoNd8Eq3Y7c=
font-awesome@^4.7.0:
version "4.7.0"
resolved "https://registry.yarnpkg.com/font-awesome/-/font-awesome-4.7.0.tgz#8fa8cf0411a1a31afd07b06d2902bb9fc815a133"