forked from dreamans/syncd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
450 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Copyright 2019 syncd Author. All Rights Reserved. | ||
// Use of this source code is governed by a MIT-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package model | ||
|
||
import( | ||
"time" | ||
) | ||
|
||
type DeployApply struct { | ||
ID int `gorm:"primary_key"` | ||
SpaceId int `gorm:"type:int(11);not null;default:0"` | ||
Project int `gorm:"type:int(11);not null;default:0"` | ||
Name string `gorm:"type:varchar(100);not null;default:''"` | ||
Description string `gorm:"type:varchar(500);not null;default:''"` | ||
BranchName string `gorm:"type:varchar(100);not null;default:''"` | ||
TagName string `gorm:"type:varchar(100);not null;default:''"` | ||
Status int `gorm:"type:int(11);not null;default:0"` | ||
} | ||
|
||
func (m *Project) TableName() string { | ||
return "syd_project" | ||
} | ||
|
||
func (m *Project) Create() bool { | ||
m.Ctime = int(time.Now().Unix()) | ||
return Create(m) | ||
} | ||
|
||
func (m *Project) Update() bool { | ||
return UpdateByPk(m) | ||
} | ||
|
||
func (m *Project) UpdateByFields(data map[string]interface{}, query QueryParam) bool { | ||
return Update(m, data, query) | ||
} | ||
|
||
func (m *Project) List(query QueryParam) ([]Project, bool) { | ||
var data []Project | ||
ok := GetMulti(&data, query) | ||
return data, ok | ||
} | ||
|
||
func (m *Project) Count(query QueryParam) (int, bool) { | ||
var count int | ||
ok := Count(m, &count, query) | ||
return count, ok | ||
} | ||
|
||
func (m *Project) Delete() bool { | ||
return DeleteByPk(m) | ||
} | ||
|
||
func (m *Project) Get(id int) bool { | ||
return GetByPk(m, id) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright 2019 syncd Author. All Rights Reserved. | ||
// Use of this source code is governed by a MIT-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package deploy | ||
|
||
import ( | ||
"errors" | ||
"fmt" | ||
|
||
"github.com/dreamans/syncd/model" | ||
"github.com/dreamans/syncd/util/gostring" | ||
) | ||
|
||
type Apply struct { | ||
ID int `json:"id"` | ||
SpaceId int `json:"space_id"` | ||
ProjectId int `json:"project_id"` | ||
Name string `json:"name"` | ||
Description string `json:"description"` | ||
BranchName string `json:"branch_name"` | ||
Status int `json:"status"` | ||
} | ||
|
||
func (a *Apply) Create() { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Copyright 2019 syncd Author. All Rights Reserved. | ||
// Use of this source code is governed by a MIT-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package deploy | ||
|
||
import ( | ||
"github.com/gin-gonic/gin" | ||
"github.com/dreamans/syncd/render" | ||
"github.com/dreamans/syncd/util/gostring" | ||
"github.com/dreamans/syncd/module/project" | ||
) | ||
|
||
type ApplyFormBind struct { | ||
ProjectId int `form:"project_id" binding:"required"` | ||
SpaceId string `form:"space_id" binding:"required"` | ||
Name string `form:"name" binding:"required"` | ||
BranchName string `form:"branch_name"` | ||
Description string `form:"description"` | ||
} | ||
|
||
func ApplySubmit(c *gin.Context) { | ||
var form ApplyFormBind | ||
if err := c.ShouldBind(&form); err != nil { | ||
render.ParamError(c, err.Error()) | ||
return | ||
} | ||
apply := &deploy.Apply{ | ||
SpaceId: form.SpaceId, | ||
ProjectId: form.ProjectId, | ||
Name: form.Name, | ||
Description: form.Description, | ||
BranchName: form.BranchName, | ||
} | ||
apply.Create() | ||
} | ||
|
||
func ApplyProjectDetail(c *gin.Context) { | ||
id := gostring.Str2Int(c.Query("id")) | ||
if id == 0 { | ||
render.ParamError(c, "id cannot be empty") | ||
return | ||
} | ||
proj := &project.Project{ | ||
ID: id, | ||
} | ||
if err := proj.Detail(); err != nil { | ||
render.AppError(c, err.Error()) | ||
return | ||
} | ||
|
||
restProj := map[string]interface{}{ | ||
"id": proj.ID, | ||
"name": proj.Name, | ||
"deploy_mode": proj.DeployMode, | ||
"repo_branch": proj.RepoBranch, | ||
} | ||
|
||
render.JSON(c, restProj) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import {get, post} from '@/lib/fetch.js' | ||
|
||
export function applyProjectDetailApi(params) { | ||
return get('/deploy/apply/project/detail', params) | ||
} | ||
|
||
export function applySubmitApi(data) { | ||
return post('/deploy/apply/submit', data) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ html, body { | |
} | ||
|
||
// reset element css | ||
.el-checkbox { | ||
.el-checkbox, .el-radio { | ||
font-weight: 400; | ||
} | ||
|
||
|
Oops, something went wrong.