From 499dd3ab85346ec976491e04779efe2af60392a2 Mon Sep 17 00:00:00 2001 From: dushixiang <798148596@qq.com> Date: Wed, 13 Jan 2021 20:09:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=A4=9A=E7=A7=9F=E6=88=B7?= =?UTF-8?q?=E9=9A=94=E7=A6=BB=E5=88=9D=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.go | 13 ++++- pkg/api/routes.go | 1 + pkg/model/asset.go | 1 + pkg/model/command.go | 1 + pkg/model/credential.go | 1 + pkg/model/user.go | 1 + web/src/components/user/User.js | 88 +++++++++++++++++++++++++++++---- 7 files changed, 96 insertions(+), 10 deletions(-) diff --git a/main.go b/main.go index 7965711..d534cbb 100644 --- a/main.go +++ b/main.go @@ -28,6 +28,16 @@ func main() { func Run() error { + fmt.Printf(` + _______ __ ___________ .__ .__ + \ \ ____ ___ ____/ |_ \__ ___/__________ _____ |__| ____ _____ | | + / | \_/ __ \\ \/ /\ __\ | |_/ __ \_ __ \/ \| |/ \\__ \ | | +/ | \ ___/ > < | | | |\ ___/| | \/ Y Y \ | | \/ __ \| |__ +\____|__ /\___ >__/\_ \ |__| |____| \___ >__| |__|_| /__|___| (____ /____/ + \/ \/ \/ \/ \/ \/ \/ + +`) + var err error //logrus.SetReportCaller(true) logrus.SetFormatter(&nested.Formatter{ @@ -49,7 +59,7 @@ func Run() error { return err } - logrus.Infof("当前数据库模式为:%v", global.Config.DB) + fmt.Printf("当前数据库模式为:%v\n", global.Config.DB) if global.Config.DB == "mysql" { dsn := fmt.Sprintf("%s:%s@tcp(%s:%d)/%s?charset=utf8mb4&parseTime=True&loc=Local", global.Config.Mysql.Username, @@ -123,6 +133,7 @@ func Run() error { global.Cache = cache.New(5*time.Minute, 10*time.Minute) global.Store = global.NewStore() + e := api.SetupRoutes() if err := handle.InitProperties(); err != nil { return err diff --git a/pkg/api/routes.go b/pkg/api/routes.go index fd10274..0ebec7a 100644 --- a/pkg/api/routes.go +++ b/pkg/api/routes.go @@ -14,6 +14,7 @@ const Token = "X-Auth-Token" func SetupRoutes() *echo.Echo { e := echo.New() + e.HideBanner = true e.File("/", "web/build/index.html") e.File("/logo.svg", "web/build/logo.svg") diff --git a/pkg/model/asset.go b/pkg/model/asset.go index aa884f1..e211496 100644 --- a/pkg/model/asset.go +++ b/pkg/model/asset.go @@ -22,6 +22,7 @@ type Asset struct { Active bool `json:"active"` Created utils.JsonTime `json:"created"` Tags string `json:"tags"` + Creator string `json:"creator"` } func (r *Asset) TableName() string { diff --git a/pkg/model/command.go b/pkg/model/command.go index e1bc5d2..ca477fb 100644 --- a/pkg/model/command.go +++ b/pkg/model/command.go @@ -10,6 +10,7 @@ type Command struct { Name string `json:"name"` Content string `json:"content"` Created utils.JsonTime `json:"created"` + Creator string `json:"creator"` } func (r *Command) TableName() string { diff --git a/pkg/model/credential.go b/pkg/model/credential.go index c8d1f6b..8f4580e 100644 --- a/pkg/model/credential.go +++ b/pkg/model/credential.go @@ -20,6 +20,7 @@ type Credential struct { PrivateKey string `json:"privateKey"` Passphrase string `json:"passphrase"` Created utils.JsonTime `json:"created"` + Creator string `json:"creator"` } func (r *Credential) TableName() string { diff --git a/pkg/model/user.go b/pkg/model/user.go index f437042..3be3acc 100644 --- a/pkg/model/user.go +++ b/pkg/model/user.go @@ -15,6 +15,7 @@ type User struct { Online bool `json:"online"` Enabled bool `json:"enabled"` Created utils.JsonTime `json:"created"` + Role string `json:"role"` } func (r *User) TableName() string { diff --git a/web/src/components/user/User.js b/web/src/components/user/User.js index a3812a8..b2c839f 100644 --- a/web/src/components/user/User.js +++ b/web/src/components/user/User.js @@ -5,9 +5,10 @@ import { Badge, Button, Col, - Divider, + Divider, Dropdown, Input, Layout, + Menu, Modal, PageHeader, Row, @@ -21,10 +22,10 @@ import UserModal from "./UserModal"; import request from "../../common/request"; import {message} from "antd/es"; import { - DeleteOutlined, DeleteTwoTone, - EditTwoTone, - ExclamationCircleOutlined, - PlusOutlined, + DeleteOutlined, DownOutlined, + ExclamationCircleOutlined, IssuesCloseOutlined, + PlusOutlined, SmileOutlined, + StopOutlined, SyncOutlined, UndoOutlined } from '@ant-design/icons'; @@ -127,7 +128,8 @@ class User extends Component { queryParams: queryParams }); - this.loadTableData(queryParams).then(r => {}) + this.loadTableData(queryParams).then(r => { + }) }; showDeleteConfirm(id, content) { @@ -279,12 +281,34 @@ class User extends Component { title: '操作', key: 'action', render: (text, record) => { + + const menu = ( + + + + + + + + + + + + + ); + return (
- - + + +
) }, @@ -367,6 +391,52 @@ class User extends Component { + + + + + + + +