Skip to content
Permalink
Browse files

modify CODE_OF_CONDUCT

  • Loading branch information
chenhg5 committed Oct 18, 2019
1 parent 96bc02b commit 9076bb683e66a88fe49571673a803d60aa146e77
Showing with 13 additions and 28 deletions.
  1. +1 −1 CODE_OF_CONDUCT.md
  2. +12 −27 plugins/admin/modules/table/table.go
@@ -34,7 +34,7 @@ This Code of Conduct applies both within project spaces and in public spaces whe

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at afc163@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at chg80333@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

@@ -305,6 +305,7 @@ func (tb DefaultTable) GetDataFromDatabase(path string, params parameter.Paramet

var (
sortable string
hide string
joins string
headField string
joinTables = make([]string, 0)
@@ -331,14 +332,8 @@ func (tb DefaultTable) GetDataFromDatabase(path string, params parameter.Paramet
if tb.info.FieldList[i].Hide {
continue
}
sortable = "0"
if tb.info.FieldList[i].Sortable {
sortable = "1"
}
hide := "0"
if !modules.InArrayWithoutEmpty(params.Columns, headField) {
hide = "1"
}
sortable = modules.AorB(tb.info.FieldList[i].Sortable, "1", "0")
hide = modules.AorB(modules.InArrayWithoutEmpty(params.Columns, headField), "0", "1")
thead = append(thead, map[string]string{
"head": tb.info.FieldList[i].Head,
"sortable": sortable,
@@ -369,8 +364,6 @@ func (tb DefaultTable) GetDataFromDatabase(path string, params parameter.Paramet
}
args := append(whereArgs, params.PageSize, (modules.GetPage(params.Page)-1)*10)

// TODO: add left join table relations, Display is inefficient.

queryCmd := fmt.Sprintf(queryStatement, fields, tb.info.Table, joins, wheres, params.SortField, params.SortType)

logger.LogSql(queryCmd, args)
@@ -437,9 +430,7 @@ func (tb DefaultTable) GetDataFromDatabase(path string, params parameter.Paramet
logger.LogSql(countCmd, whereArgs)

var size int
if tb.connectionDriver == "sqlite" {
size = int(total[0]["count(*)"].(int64))
} else if tb.connectionDriver == "postgresql" {
if tb.connectionDriver == "postgresql" {
size = int(total[0]["count"].(int64))
} else {
size = int(total[0]["count(*)"].(int64))
@@ -475,6 +466,7 @@ func (tb DefaultTable) GetDataFromDatabaseWithIds(path string, params parameter.

var (
sortable string
hide string
joins string
headField string
joinTables = make([]string, 0)
@@ -501,14 +493,8 @@ func (tb DefaultTable) GetDataFromDatabaseWithIds(path string, params parameter.
if tb.info.FieldList[i].Hide {
continue
}
sortable = "0"
if tb.info.FieldList[i].Sortable {
sortable = "1"
}
hide := "0"
if !modules.InArrayWithoutEmpty(params.Columns, headField) {
hide = "1"
}
sortable = modules.AorB(tb.info.FieldList[i].Sortable, "1", "0")
hide = modules.AorB(modules.InArrayWithoutEmpty(params.Columns, headField), "0", "1")
thead = append(thead, map[string]string{
"head": tb.info.FieldList[i].Head,
"sortable": sortable,
@@ -533,8 +519,6 @@ func (tb DefaultTable) GetDataFromDatabaseWithIds(path string, params parameter.
}
whereIds = whereIds[:len(whereIds)-1]

// TODO: add left join table relations

queryCmd := fmt.Sprintf(queryStatement, fields, tb.info.Table, joins, whereIds, params.SortField, params.SortType)

res, _ := connection.QueryWithConnection(tb.connection, queryCmd)
@@ -602,9 +586,7 @@ func (tb DefaultTable) GetDataFromDatabaseWithIds(path string, params parameter.
logger.LogSql(countCmd, nil)

var size int
if tb.connectionDriver == "sqlite" {
size = int(total[0]["count(*)"].(int64))
} else if tb.connectionDriver == "postgresql" {
if tb.connectionDriver == "postgresql" {
size = int(total[0]["count"].(int64))
} else {
size = int(total[0]["count(*)"].(int64))
@@ -910,7 +892,10 @@ func (tb DefaultTable) sql() *db.Sql {
return db.WithDriverAndConnection(tb.connection, tb.connectionDriver)
}

func GetNewFormList(groupHeaders []string, group [][]string, old []types.FormField, primaryKey string) ([]types.FormField, [][]types.FormField, []string) {
func GetNewFormList(groupHeaders []string,
group [][]string,
old []types.FormField,
primaryKey string) ([]types.FormField, [][]types.FormField, []string) {

if len(group) == 0 {
var newForm []types.FormField

0 comments on commit 9076bb6

Please sign in to comment.
You can’t perform that action at this time.