mirror of
https://github.com/cuigh/swirl
synced 2024-12-28 14:51:57 +00:00
Update auxo to latest version
This commit is contained in:
parent
9de2f2e62c
commit
a958d7de24
@ -8,7 +8,7 @@ import (
|
||||
func do(fn func(d dao.Interface)) {
|
||||
d, err := dao.Get()
|
||||
if err != nil {
|
||||
panic(errors.Wrap("failed to load storage engine", err))
|
||||
panic(errors.Wrap(err, "failed to load storage engine"))
|
||||
}
|
||||
|
||||
fn(d)
|
||||
|
@ -165,7 +165,7 @@ func StackRemove(name string) error {
|
||||
}
|
||||
|
||||
if len(errs) > 0 {
|
||||
return errors.Multi(errs...)
|
||||
return errors.List(errs...)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
@ -264,7 +264,7 @@ func createNetworks(ctx context.Context, cli *client.Client, namespace compose.N
|
||||
|
||||
mgr.Logger().Infof("Creating network %s", name)
|
||||
if _, err = cli.NetworkCreate(ctx, name, createOpts); err != nil {
|
||||
return errors.Wrap("failed to create network "+internalName, err)
|
||||
return errors.Wrap(err, "failed to create network "+internalName)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
@ -277,12 +277,12 @@ func createSecrets(ctx context.Context, cli *client.Client, secrets []swarm.Secr
|
||||
case err == nil:
|
||||
// secret already exists, then we update that
|
||||
if err = cli.SecretUpdate(ctx, secret.ID, secret.Meta.Version, secretSpec); err != nil {
|
||||
return errors.Wrap("failed to update secret "+secretSpec.Name, err)
|
||||
return errors.Wrap(err, "failed to update secret "+secretSpec.Name)
|
||||
}
|
||||
case client.IsErrSecretNotFound(err):
|
||||
// secret does not exist, then we create a new one.
|
||||
if _, err = cli.SecretCreate(ctx, secretSpec); err != nil {
|
||||
return errors.Wrap("failed to create secret "+secretSpec.Name, err)
|
||||
return errors.Wrap(err, "failed to create secret "+secretSpec.Name)
|
||||
}
|
||||
default:
|
||||
return err
|
||||
@ -298,12 +298,12 @@ func createConfigs(ctx context.Context, cli *client.Client, configs []swarm.Conf
|
||||
case err == nil:
|
||||
// config already exists, then we update that
|
||||
if err = cli.ConfigUpdate(ctx, config.ID, config.Meta.Version, configSpec); err != nil {
|
||||
errors.Wrap("failed to update config "+configSpec.Name, err)
|
||||
errors.Wrap(err, "failed to update config "+configSpec.Name)
|
||||
}
|
||||
case client.IsErrConfigNotFound(err):
|
||||
// config does not exist, then we create a new one.
|
||||
if _, err = cli.ConfigCreate(ctx, configSpec); err != nil {
|
||||
errors.Wrap("failed to create config "+configSpec.Name, err)
|
||||
errors.Wrap(err, "failed to create config "+configSpec.Name)
|
||||
}
|
||||
default:
|
||||
return err
|
||||
@ -377,7 +377,7 @@ func deployServices(
|
||||
updateOpts,
|
||||
)
|
||||
if err != nil {
|
||||
return errors.Wrap("failed to update service "+name, err)
|
||||
return errors.Wrap(err, "failed to update service "+name)
|
||||
}
|
||||
|
||||
for _, warning := range response.Warnings {
|
||||
@ -394,7 +394,7 @@ func deployServices(
|
||||
//}
|
||||
|
||||
if _, err = cli.ServiceCreate(ctx, serviceSpec, createOpts); err != nil {
|
||||
return errors.Wrap("failed to create service "+name, err)
|
||||
return errors.Wrap(err, "failed to create service "+name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import (
|
||||
"math"
|
||||
"sort"
|
||||
|
||||
"github.com/cuigh/auxo/util/choose"
|
||||
"github.com/cuigh/swirl/misc"
|
||||
"github.com/cuigh/swirl/model"
|
||||
"github.com/docker/docker/api/types"
|
||||
@ -57,7 +56,11 @@ func TaskList(args *model.TaskListArgs) (infos []*model.TaskInfo, totalCount int
|
||||
for _, t := range tasks {
|
||||
if _, ok := nodes[t.NodeID]; !ok {
|
||||
if n, _, e := cli.NodeInspectWithRaw(ctx, t.NodeID); e == nil {
|
||||
nodes[t.NodeID] = choose.String(n.Spec.Name == "", n.Description.Hostname, n.Spec.Name)
|
||||
if n.Spec.Name == "" {
|
||||
nodes[t.NodeID] = n.Description.Hostname
|
||||
} else {
|
||||
nodes[t.NodeID] = n.Spec.Name
|
||||
}
|
||||
} else {
|
||||
nodes[t.NodeID] = ""
|
||||
}
|
||||
|
@ -288,9 +288,9 @@ func (b *userBiz) Identify(token string) (user web.User) {
|
||||
}
|
||||
|
||||
// Authorize check permission of user
|
||||
func (b *userBiz) Authorize(user web.User, handler string) bool {
|
||||
func (b *userBiz) Authorize(user web.User, h web.HandlerInfo) bool {
|
||||
if au, ok := user.(*model.AuthUser); ok {
|
||||
return au.IsAllowed(handler)
|
||||
return au.IsAllowed(h.Name())
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
@ -1,20 +1,20 @@
|
||||
name: swirl
|
||||
banner: false
|
||||
|
||||
web:
|
||||
address: ':8001'
|
||||
authorize_mode: '*'
|
||||
authorize: '?'
|
||||
|
||||
swirl:
|
||||
db_type: mongo
|
||||
db_address: localhost:27017/swirl
|
||||
# docker_endpoint: tcp://docker-proxy:2375
|
||||
|
||||
#log:
|
||||
# loggers:
|
||||
# - level: info
|
||||
# writers: console
|
||||
# writers:
|
||||
# - name: console
|
||||
# type: console
|
||||
# format: json
|
||||
# layout: '[{L}]{T}: {M} - {F:S}{N}'
|
||||
log:
|
||||
loggers:
|
||||
- level: info
|
||||
writers: console
|
||||
writers:
|
||||
- name: console
|
||||
type: console
|
||||
layout: '[{L}]{T}: {M}{N}'
|
@ -1,19 +1,20 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"github.com/cuigh/auxo/data"
|
||||
"github.com/cuigh/auxo/net/web"
|
||||
"github.com/cuigh/swirl/model"
|
||||
)
|
||||
|
||||
func newModel(ctx web.Context) web.Map {
|
||||
return web.Map{
|
||||
func newModel(ctx web.Context) data.Map {
|
||||
return data.Map{
|
||||
"ContextUser": ctx.User(),
|
||||
}
|
||||
}
|
||||
|
||||
func newPagerModel(ctx web.Context, totalCount, size, page int) web.Map {
|
||||
func newPagerModel(ctx web.Context, totalCount, size, page int) data.Map {
|
||||
pager := model.NewPager(ctx.Request().RequestURI, totalCount, size, page)
|
||||
return newModel(ctx).Add("Pager", pager)
|
||||
return newModel(ctx).Set("Pager", pager)
|
||||
}
|
||||
|
||||
func ajaxResult(ctx web.Context, err error) error {
|
||||
@ -21,14 +22,14 @@ func ajaxResult(ctx web.Context, err error) error {
|
||||
return err
|
||||
}
|
||||
|
||||
return ctx.JSON(web.Map{
|
||||
return ctx.JSON(data.Map{
|
||||
"success": err == nil,
|
||||
})
|
||||
}
|
||||
|
||||
func ajaxSuccess(ctx web.Context, data interface{}) error {
|
||||
return ctx.JSON(web.Map{
|
||||
func ajaxSuccess(ctx web.Context, value interface{}) error {
|
||||
return ctx.JSON(data.Map{
|
||||
"success": true,
|
||||
"data": data,
|
||||
"data": value,
|
||||
})
|
||||
}
|
||||
|
@ -41,8 +41,8 @@ func configList(ctx web.Context) error {
|
||||
}
|
||||
|
||||
m := newPagerModel(ctx, totalCount, model.PageSize, page).
|
||||
Add("Name", name).
|
||||
Add("Configs", configs)
|
||||
Set("Name", name).
|
||||
Set("Configs", configs)
|
||||
return ctx.Render("config/list", m)
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ func configEdit(ctx web.Context) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
m := newModel(ctx).Add("Config", cfg)
|
||||
m := newModel(ctx).Set("Config", cfg)
|
||||
return ctx.Render("config/edit", m)
|
||||
}
|
||||
|
||||
|
@ -47,9 +47,9 @@ func containerList(ctx web.Context) error {
|
||||
}
|
||||
|
||||
m := newPagerModel(ctx, totalCount, model.PageSize, args.PageIndex).
|
||||
Add("Name", args.Name).
|
||||
Add("Filter", args.Filter).
|
||||
Add("Containers", containers)
|
||||
Set("Name", args.Name).
|
||||
Set("Filter", args.Filter).
|
||||
Set("Containers", containers)
|
||||
return ctx.Render("container/list", m)
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ func containerDetail(ctx web.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
m := newModel(ctx).Add("Container", container)
|
||||
m := newModel(ctx).Set("Container", container)
|
||||
return ctx.Render("container/detail", m)
|
||||
}
|
||||
|
||||
@ -76,7 +76,7 @@ func containerRaw(ctx web.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
m := newModel(ctx).Add("Container", container).Add("Raw", j)
|
||||
m := newModel(ctx).Set("Container", container).Set("Raw", j)
|
||||
return ctx.Render("container/raw", m)
|
||||
}
|
||||
|
||||
@ -94,8 +94,8 @@ func containerLogs(ctx web.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
m := newModel(ctx).Add("Container", container).Add("Line", line).Add("Timestamps", timestamps).
|
||||
Add("Stdout", stdout.String()).Add("Stderr", stderr.String())
|
||||
m := newModel(ctx).Set("Container", container).Set("Line", line).Set("Timestamps", timestamps).
|
||||
Set("Stdout", stdout.String()).Set("Stderr", stderr.String())
|
||||
return ctx.Render("container/logs", m)
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,6 @@ func eventList(ctx web.Context) error {
|
||||
}
|
||||
|
||||
m := newPagerModel(ctx, totalCount, model.PageSize, args.PageIndex).
|
||||
Add("Events", events).Add("Args", args)
|
||||
Set("Events", events).Set("Args", args)
|
||||
return ctx.Render("system/event/list", m)
|
||||
}
|
||||
|
@ -39,22 +39,22 @@ func homeIndex(ctx web.Context) (err error) {
|
||||
if count, err = docker.NodeCount(); err != nil {
|
||||
return
|
||||
}
|
||||
m.Add("NodeCount", count)
|
||||
m.Set("NodeCount", count)
|
||||
|
||||
if count, err = docker.NetworkCount(); err != nil {
|
||||
return
|
||||
}
|
||||
m.Add("NetworkCount", count)
|
||||
m.Set("NetworkCount", count)
|
||||
|
||||
if count, err = docker.ServiceCount(); err != nil {
|
||||
return
|
||||
}
|
||||
m.Add("ServiceCount", count)
|
||||
m.Set("ServiceCount", count)
|
||||
|
||||
if count, err = docker.StackCount(); err != nil {
|
||||
return
|
||||
}
|
||||
m.Add("StackCount", count)
|
||||
m.Set("StackCount", count)
|
||||
|
||||
return ctx.Render("index", m)
|
||||
}
|
||||
|
@ -37,8 +37,8 @@ func imageList(ctx web.Context) error {
|
||||
}
|
||||
|
||||
m := newPagerModel(ctx, totalCount, model.PageSize, page).
|
||||
Add("Name", name).
|
||||
Add("Images", images)
|
||||
Set("Name", name).
|
||||
Set("Images", images)
|
||||
return ctx.Render("image/list", m)
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ func imageDetail(ctx web.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
m := newModel(ctx).Add("Image", image).Add("Histories", histories)
|
||||
m := newModel(ctx).Set("Image", image).Set("Histories", histories)
|
||||
return ctx.Render("image/detail", m)
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ func imageRaw(ctx web.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
m := newModel(ctx).Add("Image", image).Add("Raw", j)
|
||||
m := newModel(ctx).Set("Image", image).Set("Raw", j)
|
||||
return ctx.Render("image/raw", m)
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ func networkList(ctx web.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
m := newModel(ctx).Add("Networks", networks)
|
||||
m := newModel(ctx).Set("Networks", networks)
|
||||
return ctx.Render("network/list", m)
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ func networkDetail(ctx web.Context) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
m := newModel(ctx).Add("Network", network)
|
||||
m := newModel(ctx).Set("Network", network)
|
||||
return ctx.Render("network/detail", m)
|
||||
}
|
||||
|
||||
@ -101,6 +101,6 @@ func networkRaw(ctx web.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
m := newModel(ctx).Add("Network", name).Add("Raw", j)
|
||||
m := newModel(ctx).Set("Network", name).Set("Raw", j)
|
||||
return ctx.Render("network/raw", m)
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ func nodeList(ctx web.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
m := newModel(ctx).Add("Nodes", nodes)
|
||||
m := newModel(ctx).Set("Nodes", nodes)
|
||||
return ctx.Render("node/list", m)
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ func nodeDetail(ctx web.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
m := newModel(ctx).Add("Node", node).Add("Tasks", tasks)
|
||||
m := newModel(ctx).Set("Node", node).Set("Tasks", tasks)
|
||||
return ctx.Render("node/detail", m)
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ func nodeRaw(ctx web.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
m := newModel(ctx).Add("ID", id).Add("Node", node).Add("Raw", j)
|
||||
m := newModel(ctx).Set("ID", id).Set("Node", node).Set("Raw", j)
|
||||
return ctx.Render("node/raw", m)
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ func nodeEdit(ctx web.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
m := newModel(ctx).Add("Node", node)
|
||||
m := newModel(ctx).Set("Node", node)
|
||||
return ctx.Render("node/edit", m)
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ func profileIndex(ctx web.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
m := newModel(ctx).Add("User", user)
|
||||
m := newModel(ctx).Set("User", user)
|
||||
return ctx.Render("profile/index", m)
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ func registryList(ctx web.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
m := newModel(ctx).Add("Registries", registries)
|
||||
m := newModel(ctx).Set("Registries", registries)
|
||||
return ctx.Render("registry/list", m)
|
||||
}
|
||||
|
||||
|
@ -37,12 +37,12 @@ func roleIndex(ctx web.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
m := newModel(ctx).Add("Roles", roles)
|
||||
m := newModel(ctx).Set("Roles", roles)
|
||||
return ctx.Render("system/role/list", m)
|
||||
}
|
||||
|
||||
func roleNew(ctx web.Context) error {
|
||||
m := newModel(ctx).Add("Perms", misc.Perms)
|
||||
m := newModel(ctx).Set("Perms", misc.Perms)
|
||||
return ctx.Render("system/role/new", m)
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ func roleDetail(ctx web.Context) error {
|
||||
for _, p := range role.Perms {
|
||||
perms[p] = model.Placeholder
|
||||
}
|
||||
m := newModel(ctx).Add("Role", role).Add("Perms", misc.Perms).Add("CheckedPerms", perms)
|
||||
m := newModel(ctx).Set("Role", role).Set("Perms", misc.Perms).Set("CheckedPerms", perms)
|
||||
return ctx.Render("system/role/detail", m)
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ func roleEdit(ctx web.Context) error {
|
||||
for _, p := range role.Perms {
|
||||
perms[p] = model.Placeholder
|
||||
}
|
||||
m := newModel(ctx).Add("Role", role).Add("Perms", misc.Perms).Add("CheckedPerms", perms)
|
||||
m := newModel(ctx).Set("Role", role).Set("Perms", misc.Perms).Set("CheckedPerms", perms)
|
||||
return ctx.Render("system/role/edit", m)
|
||||
}
|
||||
|
||||
|
@ -40,8 +40,8 @@ func secretList(ctx web.Context) error {
|
||||
}
|
||||
|
||||
m := newPagerModel(ctx, totalCount, model.PageSize, page).
|
||||
Add("Name", name).
|
||||
Add("Secrets", secrets)
|
||||
Set("Name", name).
|
||||
Set("Secrets", secrets)
|
||||
return ctx.Render("secret/list", m)
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ func secretEdit(ctx web.Context) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
m := newModel(ctx).Add("Secret", secret)
|
||||
m := newModel(ctx).Set("Secret", secret)
|
||||
return ctx.Render("secret/edit", m)
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,6 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/cuigh/auxo/data/set"
|
||||
"github.com/cuigh/auxo/errors"
|
||||
"github.com/cuigh/auxo/net/web"
|
||||
"github.com/cuigh/auxo/util/cast"
|
||||
@ -13,6 +12,7 @@ import (
|
||||
"github.com/cuigh/swirl/biz/docker"
|
||||
"github.com/cuigh/swirl/misc"
|
||||
"github.com/cuigh/swirl/model"
|
||||
"mtime.com/auxo/data/set"
|
||||
)
|
||||
|
||||
// ServiceController is a controller of docker service
|
||||
@ -56,8 +56,8 @@ func serviceList(ctx web.Context) error {
|
||||
}
|
||||
|
||||
m := newPagerModel(ctx, totalCount, model.PageSize, page).
|
||||
Add("Name", name).
|
||||
Add("Services", services)
|
||||
Set("Name", name).
|
||||
Set("Services", services)
|
||||
return ctx.Render("service/list", m)
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ func serviceDetail(ctx web.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
m := newModel(ctx).Add("Service", info).Add("Tasks", tasks).Add("Command", cmd)
|
||||
m := newModel(ctx).Set("Service", info).Set("Tasks", tasks).Set("Command", cmd)
|
||||
return ctx.Render("service/detail", m)
|
||||
}
|
||||
|
||||
@ -103,7 +103,7 @@ func serviceRaw(ctx web.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
m := newModel(ctx).Add("Service", name).Add("Raw", j)
|
||||
m := newModel(ctx).Set("Service", name).Set("Raw", j)
|
||||
return ctx.Render("service/raw", m)
|
||||
}
|
||||
|
||||
@ -116,8 +116,8 @@ func serviceLogs(ctx web.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
m := newModel(ctx).Add("Service", name).Add("Line", line).Add("Timestamps", timestamps).
|
||||
Add("Stdout", stdout.String()).Add("Stderr", stderr.String())
|
||||
m := newModel(ctx).Set("Service", name).Set("Line", line).Set("Timestamps", timestamps).
|
||||
Set("Stdout", stdout.String()).Set("Stderr", stderr.String())
|
||||
return ctx.Render("service/logs", m)
|
||||
}
|
||||
|
||||
@ -177,9 +177,9 @@ func serviceNew(ctx web.Context) error {
|
||||
}
|
||||
checkedNetworks := set.FromSlice(service.Networks, func(i int) interface{} { return service.Networks[i] })
|
||||
|
||||
m := newModel(ctx).Add("Service", service).Add("Registries", registries).
|
||||
Add("Networks", networks).Add("CheckedNetworks", checkedNetworks).
|
||||
Add("Secrets", secrets).Add("Configs", configs)
|
||||
m := newModel(ctx).Set("Service", service).Set("Registries", registries).
|
||||
Set("Networks", networks).Set("CheckedNetworks", checkedNetworks).
|
||||
Set("Secrets", secrets).Set("Configs", configs)
|
||||
return ctx.Render("service/new", m)
|
||||
}
|
||||
|
||||
@ -194,9 +194,9 @@ func serviceCreate(ctx web.Context) error {
|
||||
var registry *model.Registry
|
||||
registry, err = biz.Registry.Get(info.Registry)
|
||||
if err != nil {
|
||||
return errors.Wrap("Load registry info failed", err)
|
||||
return errors.Wrap(err, "load registry info failed")
|
||||
} else if registry == nil {
|
||||
return errors.New("Can't load registry info")
|
||||
return errors.New("can't load registry info")
|
||||
}
|
||||
|
||||
info.Image = registry.URL + "/" + info.Image
|
||||
@ -232,9 +232,9 @@ func serviceEdit(ctx web.Context) error {
|
||||
stack := service.Spec.Labels["com.docker.stack.namespace"]
|
||||
checkedNetworks := set.FromSlice(service.Endpoint.VirtualIPs, func(i int) interface{} { return service.Endpoint.VirtualIPs[i].NetworkID })
|
||||
|
||||
m := newModel(ctx).Add("Service", model.NewServiceInfo(service)).Add("Stack", stack).
|
||||
Add("Networks", networks).Add("CheckedNetworks", checkedNetworks).
|
||||
Add("Secrets", secrets).Add("Configs", configs)
|
||||
m := newModel(ctx).Set("Service", model.NewServiceInfo(service)).Set("Stack", stack).
|
||||
Set("Networks", networks).Set("CheckedNetworks", checkedNetworks).
|
||||
Set("Secrets", secrets).Set("Configs", configs)
|
||||
return ctx.Render("service/edit", m)
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ func settingIndex(ctx web.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
m := newModel(ctx).Add("Setting", setting)
|
||||
m := newModel(ctx).Set("Setting", setting)
|
||||
return ctx.Render("system/setting/index", m)
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ func stackTaskList(ctx web.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
m := newModel(ctx).Add("Stacks", stacks)
|
||||
m := newModel(ctx).Set("Stacks", stacks)
|
||||
return ctx.Render("stack/task/list", m)
|
||||
}
|
||||
|
||||
@ -74,8 +74,8 @@ func stackArchiveList(ctx web.Context) error {
|
||||
}
|
||||
|
||||
m := newPagerModel(ctx, totalCount, model.PageSize, args.PageIndex).
|
||||
Add("Name", args.Name).
|
||||
Add("Archives", archives)
|
||||
Set("Name", args.Name).
|
||||
Set("Archives", archives)
|
||||
return ctx.Render("stack/archive/list", m)
|
||||
}
|
||||
|
||||
@ -89,7 +89,7 @@ func stackArchiveDetail(ctx web.Context) error {
|
||||
return web.ErrNotFound
|
||||
}
|
||||
|
||||
m := newModel(ctx).Add("Archive", archive)
|
||||
m := newModel(ctx).Set("Archive", archive)
|
||||
return ctx.Render("stack/archive/detail", m)
|
||||
}
|
||||
|
||||
@ -103,7 +103,7 @@ func stackArchiveEdit(ctx web.Context) error {
|
||||
return web.ErrNotFound
|
||||
}
|
||||
|
||||
m := newModel(ctx).Add("Archive", archive)
|
||||
m := newModel(ctx).Set("Archive", archive)
|
||||
return ctx.Render("stack/archive/edit", m)
|
||||
}
|
||||
|
||||
|
@ -40,8 +40,8 @@ func taskList(ctx web.Context) error {
|
||||
}
|
||||
|
||||
m := newPagerModel(ctx, totalCount, args.PageSize, args.PageIndex).
|
||||
Add("Args", args).
|
||||
Add("Tasks", tasks)
|
||||
Set("Args", args).
|
||||
Set("Tasks", tasks)
|
||||
return ctx.Render("task/list", m)
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ func taskDetail(ctx web.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
m := newModel(ctx).Add("Task", task)
|
||||
m := newModel(ctx).Set("Task", task)
|
||||
return ctx.Render("task/detail", m)
|
||||
}
|
||||
|
||||
@ -68,6 +68,6 @@ func taskRaw(ctx web.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
m := newModel(ctx).Add("Task", task).Add("Raw", j)
|
||||
m := newModel(ctx).Set("Task", task).Set("Raw", j)
|
||||
return ctx.Render("task/raw", m)
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package controller
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/cuigh/auxo/data/set"
|
||||
"github.com/cuigh/auxo/data"
|
||||
"github.com/cuigh/auxo/net/web"
|
||||
"github.com/cuigh/swirl/biz"
|
||||
"github.com/cuigh/swirl/biz/docker"
|
||||
@ -49,8 +49,8 @@ func templateList(ctx web.Context) error {
|
||||
}
|
||||
|
||||
m := newPagerModel(ctx, totalCount, model.PageSize, args.PageIndex).
|
||||
Add("Name", args.Name).
|
||||
Add("Templates", tpls)
|
||||
Set("Name", args.Name).
|
||||
Set("Templates", tpls)
|
||||
return ctx.Render("service/template/list", m)
|
||||
}
|
||||
|
||||
@ -72,9 +72,9 @@ func templateNew(ctx web.Context) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
m := newModel(ctx).Add("Action", "New").Add("Service", service).Add("Registries", registries).
|
||||
Add("Networks", networks).Add("CheckedNetworks", set.Set{}).
|
||||
Add("Secrets", secrets).Add("Configs", configs)
|
||||
m := newModel(ctx).Set("Action", "New").Set("Service", service).Set("Registries", registries).
|
||||
Set("Networks", networks).Set("CheckedNetworks", data.Set{}).
|
||||
Set("Secrets", secrets).Set("Configs", configs)
|
||||
return ctx.Render("service/template/edit", m)
|
||||
}
|
||||
|
||||
@ -140,11 +140,13 @@ func templateEdit(ctx web.Context) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
checkedNetworks := set.FromSlice(service.Networks, func(i int) interface{} { return service.Networks[i] })
|
||||
|
||||
m := newModel(ctx).Add("Action", "Edit").Add("Service", service).Add("Registries", registries).
|
||||
Add("Networks", networks).Add("CheckedNetworks", checkedNetworks).
|
||||
Add("Secrets", secrets).Add("Configs", configs)
|
||||
checkedNetworks := data.NewSet()
|
||||
checkedNetworks.AddSlice(service.Networks, func(i int) interface{} { return service.Networks[i] })
|
||||
|
||||
m := newModel(ctx).Set("Action", "Edit").Set("Service", service).Set("Registries", registries).
|
||||
Set("Networks", networks).Set("CheckedNetworks", checkedNetworks).
|
||||
Set("Secrets", secrets).Set("Configs", configs)
|
||||
return ctx.Render("service/template/edit", m)
|
||||
}
|
||||
|
||||
|
@ -52,9 +52,9 @@ func userIndex(ctx web.Context) error {
|
||||
}
|
||||
|
||||
m := newPagerModel(ctx, totalCount, model.PageSize, args.PageIndex).
|
||||
Add("Query", args.Query).
|
||||
Add("Filter", args.Filter).
|
||||
Add("Users", users)
|
||||
Set("Query", args.Query).
|
||||
Set("Filter", args.Filter).
|
||||
Set("Users", users)
|
||||
return ctx.Render("system/user/list", m)
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ func userNew(ctx web.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
m := newModel(ctx).Add("Roles", roles)
|
||||
m := newModel(ctx).Set("Roles", roles)
|
||||
return ctx.Render("system/user/new", m)
|
||||
}
|
||||
|
||||
@ -106,7 +106,7 @@ func userDetail(ctx web.Context) error {
|
||||
}
|
||||
}
|
||||
|
||||
m := newModel(ctx).Add("User", user).Add("Roles", roles)
|
||||
m := newModel(ctx).Set("User", user).Set("Roles", roles)
|
||||
return ctx.Render("system/user/detail", m)
|
||||
}
|
||||
|
||||
@ -129,7 +129,7 @@ func userEdit(ctx web.Context) error {
|
||||
for _, id := range user.Roles {
|
||||
userRoles[id] = model.Placeholder
|
||||
}
|
||||
m := newModel(ctx).Add("User", user).Add("Roles", roles).Add("UserRoles", userRoles)
|
||||
m := newModel(ctx).Set("User", user).Set("Roles", roles).Set("UserRoles", userRoles)
|
||||
return ctx.Render("system/user/edit", m)
|
||||
}
|
||||
|
||||
|
@ -44,8 +44,8 @@ func volumeList(ctx web.Context) error {
|
||||
}
|
||||
|
||||
m := newPagerModel(ctx, totalCount, model.PageSize, page).
|
||||
//Add("Name", name).
|
||||
Add("Volumes", volumes)
|
||||
//Set("Name", name).
|
||||
Set("Volumes", volumes)
|
||||
return ctx.Render("volume/list", m)
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ func volumeDetail(ctx web.Context) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
m := newModel(ctx).Add("Volume", volume)
|
||||
m := newModel(ctx).Set("Volume", volume)
|
||||
return ctx.Render("volume/detail", m)
|
||||
}
|
||||
|
||||
@ -109,6 +109,6 @@ func volumeRaw(ctx web.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
m := newModel(ctx).Add("Volume", name).Add("Raw", j)
|
||||
m := newModel(ctx).Set("Volume", name).Set("Raw", j)
|
||||
return ctx.Render("volume/raw", m)
|
||||
}
|
||||
|
21
main.go
21
main.go
@ -11,8 +11,8 @@ import (
|
||||
"github.com/cuigh/auxo/app/flag"
|
||||
"github.com/cuigh/auxo/config"
|
||||
"github.com/cuigh/auxo/net/web"
|
||||
"github.com/cuigh/auxo/net/web/auth"
|
||||
"github.com/cuigh/auxo/net/web/middleware"
|
||||
"github.com/cuigh/auxo/net/web/filter"
|
||||
"github.com/cuigh/auxo/net/web/filter/auth"
|
||||
"github.com/cuigh/auxo/net/web/renderer/jet"
|
||||
"github.com/cuigh/swirl/biz"
|
||||
"github.com/cuigh/swirl/controller"
|
||||
@ -23,7 +23,7 @@ func main() {
|
||||
misc.BindOptions()
|
||||
|
||||
app.Name = "Swirl"
|
||||
app.Version = "0.6"
|
||||
app.Version = "0.6.1"
|
||||
app.Desc = "A web management UI for Docker, focused on swarm cluster"
|
||||
app.Action = func(ctx *app.Context) {
|
||||
misc.LoadOptions()
|
||||
@ -49,7 +49,7 @@ func server() *web.Server {
|
||||
|
||||
ws := web.Auto()
|
||||
|
||||
// set render/validator..
|
||||
// set render
|
||||
ws.Renderer = jet.New().SetDebug(config.GetBool("debug")).
|
||||
AddFunc("time", misc.FormatTime(setting.TimeZone.Offset)).
|
||||
AddFunc("i18n", misc.Message(setting.Language)).
|
||||
@ -57,17 +57,20 @@ func server() *web.Server {
|
||||
AddVariable("language", setting.Language).
|
||||
AddVariable("version", app.Version).
|
||||
AddVariable("go_version", runtime.Version())
|
||||
//ws.Validator = valid.New()
|
||||
|
||||
// register global filters
|
||||
ws.Filter(middleware.Recover())
|
||||
ws.Use(filter.NewRecover())
|
||||
|
||||
// register static handlers
|
||||
ws.Static("", filepath.Join(filepath.Dir(app.GetPath()), "assets"))
|
||||
ws.Static("/assets", filepath.Join(filepath.Dir(app.GetPath()), "assets"))
|
||||
|
||||
// create biz group
|
||||
form := auth.NewForm(biz.User.Identify, &auth.FormConfig{Timeout: time.Minute * 30, SlidingExpiration: true})
|
||||
g := ws.Group("", form.Middleware, middleware.Authorize(biz.User.Authorize))
|
||||
form := &auth.Form{
|
||||
Identifier: biz.User.Identify,
|
||||
Timeout: time.Minute * 30,
|
||||
SlidingExpiration: true,
|
||||
}
|
||||
g := ws.Group("", form, filter.NewAuthorizer(biz.User.Authorize))
|
||||
|
||||
// register auth handlers
|
||||
g.Post("/login", form.LoginJSON(biz.User.Login)).SetAuthorize(web.AuthAnonymous)
|
||||
|
@ -12,12 +12,6 @@ import (
|
||||
)
|
||||
|
||||
var Funcs = map[string]interface{}{
|
||||
"limit": func(s string, length int) string {
|
||||
if len(s) > length {
|
||||
return s[:length] + "..."
|
||||
}
|
||||
return s
|
||||
},
|
||||
//"time": func(t time.Time) string {
|
||||
// return t.Local().Format("2006-01-02 15:04:05")
|
||||
//},
|
||||
@ -41,9 +35,6 @@ var Funcs = map[string]interface{}{
|
||||
"trimPrefix": func(s, prefix string) string {
|
||||
return strings.TrimPrefix(s, prefix)
|
||||
},
|
||||
"slice": func(values ...interface{}) interface{} {
|
||||
return values
|
||||
},
|
||||
}
|
||||
|
||||
func Message(lang string) func(key string, args ...interface{}) string {
|
||||
|
@ -50,10 +50,10 @@ type User struct {
|
||||
|
||||
type UserListArgs struct {
|
||||
// admins, active, blocked
|
||||
Filter string `query:"filter"`
|
||||
Query string `query:"query"`
|
||||
PageIndex int `query:"page"`
|
||||
PageSize int `query:"size"`
|
||||
Filter string `bind:"filter"`
|
||||
Query string `bind:"query"`
|
||||
PageIndex int `bind:"page"`
|
||||
PageSize int `bind:"size"`
|
||||
}
|
||||
|
||||
type Session struct {
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/cuigh/auxo/data/size"
|
||||
"github.com/cuigh/auxo/byte/size"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/mount"
|
||||
"github.com/docker/docker/api/types/swarm"
|
||||
@ -487,12 +487,12 @@ type ConfigUpdateInfo struct {
|
||||
}
|
||||
|
||||
type TaskListArgs struct {
|
||||
Service string `query:"service"`
|
||||
Node string `query:"node"`
|
||||
Name string `query:"name"`
|
||||
State string `query:"state"`
|
||||
PageIndex int `query:"page"`
|
||||
PageSize int `query:"size"`
|
||||
Service string `bind:"service"`
|
||||
Node string `bind:"node"`
|
||||
Name string `bind:"name"`
|
||||
State string `bind:"state"`
|
||||
PageIndex int `bind:"page"`
|
||||
PageSize int `bind:"size"`
|
||||
}
|
||||
|
||||
type TaskInfo struct {
|
||||
@ -594,10 +594,10 @@ func NewImageListInfo(image types.ImageSummary) *ImageListInfo {
|
||||
|
||||
type ContainerListArgs struct {
|
||||
// created|restarting|running|removing|paused|exited|dead
|
||||
Filter string `query:"filter"`
|
||||
Name string `query:"name"`
|
||||
PageIndex int `query:"page"`
|
||||
PageSize int `query:"size"`
|
||||
Filter string `bind:"filter"`
|
||||
Name string `bind:"name"`
|
||||
PageIndex int `bind:"page"`
|
||||
PageSize int `bind:"size"`
|
||||
}
|
||||
|
||||
type ContainerListInfo struct {
|
||||
|
@ -8,7 +8,6 @@ import (
|
||||
type EventType string
|
||||
|
||||
const (
|
||||
// swarm
|
||||
EventTypeRegistry EventType = "Registry"
|
||||
EventTypeNode EventType = "Node"
|
||||
EventTypeNetwork EventType = "Network"
|
||||
@ -19,10 +18,8 @@ const (
|
||||
EventTypeSecret EventType = "Secret"
|
||||
EventTypeConfig EventType = "Config"
|
||||
|
||||
// local
|
||||
EventTypeVolume EventType = "Volume"
|
||||
|
||||
// system
|
||||
EventTypeAuthentication EventType = "Authentication"
|
||||
EventTypeRole EventType = "Role"
|
||||
EventTypeUser EventType = "User"
|
||||
@ -32,8 +29,8 @@ const (
|
||||
type EventAction string
|
||||
|
||||
const (
|
||||
EventActionLogin EventAction = "Login"
|
||||
EventActionLogout EventAction = "Logout"
|
||||
EventActionLogin EventAction = "Login"
|
||||
//EventActionLogout EventAction = "Logout"
|
||||
EventActionCreate EventAction = "Create"
|
||||
EventActionDelete EventAction = "Delete"
|
||||
EventActionUpdate EventAction = "Update"
|
||||
@ -78,8 +75,8 @@ func (e *Event) URL(et EventType, code string) string {
|
||||
}
|
||||
|
||||
type EventListArgs struct {
|
||||
Type string `query:"type"`
|
||||
Name string `query:"name"`
|
||||
PageIndex int `query:"page"`
|
||||
PageSize int `query:"size"`
|
||||
Type string `bind:"type"`
|
||||
Name string `bind:"name"`
|
||||
PageIndex int `bind:"page"`
|
||||
PageSize int `bind:"size"`
|
||||
}
|
||||
|
@ -13,9 +13,9 @@ type Archive struct {
|
||||
}
|
||||
|
||||
type ArchiveListArgs struct {
|
||||
Name string `query:"name"`
|
||||
PageIndex int `query:"page"`
|
||||
PageSize int `query:"size"`
|
||||
Name string `bind:"name"`
|
||||
PageIndex int `bind:"page"`
|
||||
PageSize int `bind:"size"`
|
||||
}
|
||||
|
||||
type Template struct {
|
||||
@ -29,7 +29,7 @@ type Template struct {
|
||||
}
|
||||
|
||||
type TemplateListArgs struct {
|
||||
Name string `query:"name"`
|
||||
PageIndex int `query:"page"`
|
||||
PageSize int `query:"size"`
|
||||
Name string `bind:"name"`
|
||||
PageIndex int `bind:"page"`
|
||||
PageSize int `bind:"size"`
|
||||
}
|
||||
|
@ -6,9 +6,9 @@
|
||||
<meta name="keywords" content="swirl,docker,moby,swarm,docker-compose,docker-ui,docker-web-management">
|
||||
<meta name="description" content="{{ i18n("description") }}">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<link rel="stylesheet" href="/lyicon/css/lyicon.css">
|
||||
<link rel="stylesheet" href="/bulma/bulma.css?v=0.5.3">
|
||||
<link rel="stylesheet" href="/swirl/css/swirl.css?v={{ version }}">
|
||||
<link rel="stylesheet" href="/assets/lyicon/css/lyicon.css">
|
||||
<link rel="stylesheet" href="/assets/bulma/bulma.css?v=0.5.3">
|
||||
<link rel="stylesheet" href="/assets/swirl/css/swirl.css?v={{ version }}">
|
||||
{{ block style() }}{{end}}
|
||||
</head>
|
||||
<body>
|
||||
@ -16,7 +16,7 @@
|
||||
<nav class="navbar">
|
||||
<div class="navbar-brand">
|
||||
<a class="navbar-item" href="/">
|
||||
<img src="/swirl/img/logo.png" alt="logo" height="28">
|
||||
<img src="/assets/swirl/img/logo.png" alt="logo" height="28">
|
||||
</a>
|
||||
<div class="navbar-burger" data-target="menu-top">
|
||||
<span></span>
|
||||
@ -99,8 +99,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="/jquery/jquery-3.2.1.min.js"></script>
|
||||
<script src="/swirl/js/swirl.js?v={{ version }}"></script>
|
||||
<script src="/assets/jquery/jquery-3.2.1.min.js"></script>
|
||||
<script src="/assets/swirl/js/swirl.js?v={{ version }}"></script>
|
||||
{{ block script() }}{{end}}
|
||||
</body>
|
||||
</html>
|
||||
|
@ -6,13 +6,13 @@
|
||||
<meta name="keywords" content="swirl,docker,moby,swarm,docker-compose,docker-ui,docker-web-management">
|
||||
<meta name="description" content="{{ i18n("description") }}">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<link rel="stylesheet" href="/lyicon/css/lyicon.css">
|
||||
<link rel="stylesheet" href="/bulma/bulma.css?v=0.5.3">
|
||||
<link rel="stylesheet" href="/swirl/css/swirl.css?v={{ version }}">
|
||||
<link rel="stylesheet" href="/assets/lyicon/css/lyicon.css">
|
||||
<link rel="stylesheet" href="/assets/bulma/bulma.css?v=0.5.3">
|
||||
<link rel="stylesheet" href="/assets/swirl/css/swirl.css?v={{ version }}">
|
||||
</head>
|
||||
<body>
|
||||
{{ yield body() }}
|
||||
<script src="/jquery/jquery-3.2.1.min.js"></script>
|
||||
<script src="/swirl/js/swirl.js?v={{ version }}"></script>
|
||||
<script src="/assets/jquery/jquery-3.2.1.min.js"></script>
|
||||
<script src="/assets/swirl/js/swirl.js?v={{ version }}"></script>
|
||||
</body>
|
||||
</html>
|
@ -1,11 +1,11 @@
|
||||
{{ extends "../_layouts/default" }}
|
||||
|
||||
{{ block style() }}
|
||||
<link rel="stylesheet" href="/highlight/highlight.css?v=9.12">
|
||||
<link rel="stylesheet" href="/assets/highlight/highlight.css?v=9.12">
|
||||
{{ end }}
|
||||
|
||||
{{ block script() }}
|
||||
<script src="/highlight/highlight.pack.js?v=9.12"></script>
|
||||
<script src="/assets/highlight/highlight.pack.js?v=9.12"></script>
|
||||
<script>hljs.initHighlightingOnLoad();</script>
|
||||
{{ end }}
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
{{ extends "../_layouts/default" }}
|
||||
|
||||
{{ block style() }}
|
||||
<link rel="stylesheet" href="/highlight/highlight.css?v=9.12">
|
||||
<link rel="stylesheet" href="/assets/highlight/highlight.css?v=9.12">
|
||||
{{ end }}
|
||||
|
||||
{{ block script() }}
|
||||
<script src="/highlight/highlight.pack.js?v=9.12"></script>
|
||||
<script src="/assets/highlight/highlight.pack.js?v=9.12"></script>
|
||||
<script>hljs.initHighlightingOnLoad();</script>
|
||||
{{ end }}
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
{{ extends "../_layouts/default" }}
|
||||
|
||||
{{ block style() }}
|
||||
<link rel="stylesheet" href="/highlight/highlight.css?v=9.12">
|
||||
<link rel="stylesheet" href="/assets/highlight/highlight.css?v=9.12">
|
||||
{{ end }}
|
||||
|
||||
{{ block script() }}
|
||||
<script src="/highlight/highlight.pack.js?v=9.12"></script>
|
||||
<script src="/assets/highlight/highlight.pack.js?v=9.12"></script>
|
||||
<script>hljs.initHighlightingOnLoad();</script>
|
||||
{{ end }}
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
{{ extends "../_layouts/default" }}
|
||||
|
||||
{{ block style() }}
|
||||
<link rel="stylesheet" href="/highlight/highlight.css?v=9.12">
|
||||
<link rel="stylesheet" href="/assets/highlight/highlight.css?v=9.12">
|
||||
{{ end }}
|
||||
|
||||
{{ block script() }}
|
||||
<script src="/highlight/highlight.pack.js?v=9.12"></script>
|
||||
<script src="/assets/highlight/highlight.pack.js?v=9.12"></script>
|
||||
<script>hljs.initHighlightingOnLoad();</script>
|
||||
{{ end }}
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
{{ extends "_base" }}
|
||||
|
||||
{{ block style() }}
|
||||
<link rel="stylesheet" href="/highlight/highlight.css?v=9.12">
|
||||
<link rel="stylesheet" href="/assets/highlight/highlight.css?v=9.12">
|
||||
{{ end }}
|
||||
|
||||
{{ block script() }}
|
||||
<script src="/highlight/highlight.pack.js?v=9.12"></script>
|
||||
<script src="/assets/highlight/highlight.pack.js?v=9.12"></script>
|
||||
<script>hljs.initHighlightingOnLoad();</script>
|
||||
{{ end }}
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
{{ extends "../../_layouts/default" }}
|
||||
|
||||
{{ block style() }}
|
||||
<link rel="stylesheet" href="/highlight/highlight.css?v=9.12">
|
||||
<link rel="stylesheet" href="/assets/highlight/highlight.css?v=9.12">
|
||||
{{ end }}
|
||||
|
||||
{{ block script() }}
|
||||
<script src="/highlight/highlight.pack.js?v=9.12"></script>
|
||||
<script src="/assets/highlight/highlight.pack.js?v=9.12"></script>
|
||||
<script>hljs.initHighlightingOnLoad();</script>
|
||||
{{ end }}
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
{{ extends "../../_layouts/default" }}
|
||||
|
||||
{{ block style() }}
|
||||
<link rel="stylesheet" href="/codemirror/codemirror.css?v=5.30">
|
||||
<link rel="stylesheet" href="/assets/codemirror/codemirror.css?v=5.30">
|
||||
{{ end }}
|
||||
|
||||
{{ block script() }}
|
||||
<script src="/codemirror/codemirror.js?v=5.30"></script>
|
||||
<script src="/codemirror/mode/yaml.js?v=5.30"></script>
|
||||
<script src="/assets/codemirror/codemirror.js?v=5.30"></script>
|
||||
<script src="/assets/codemirror/mode/yaml.js?v=5.30"></script>
|
||||
<script>var editor = CodeMirror.fromTextArea(document.getElementById("txt-content"), {lineNumbers: true});</script>
|
||||
{{ end }}
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
{{ extends "../../_layouts/default" }}
|
||||
|
||||
{{ block style() }}
|
||||
<link rel="stylesheet" href="/codemirror/codemirror.css?v=5.30">
|
||||
<link rel="stylesheet" href="/assets/codemirror/codemirror.css?v=5.30">
|
||||
{{ end }}
|
||||
|
||||
{{ block script() }}
|
||||
<script src="/codemirror/codemirror.js?v=5.30"></script>
|
||||
<script src="/codemirror/mode/yaml.js?v=5.30"></script>
|
||||
<script src="/assets/codemirror/codemirror.js?v=5.30"></script>
|
||||
<script src="/assets/codemirror/mode/yaml.js?v=5.30"></script>
|
||||
<script>var editor = CodeMirror.fromTextArea(document.getElementById("txt-content"), {lineNumbers: true});</script>
|
||||
{{ end }}
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
{{ extends "_base" }}
|
||||
|
||||
{{ block style() }}
|
||||
<link rel="stylesheet" href="/highlight/highlight.css?v=9.12">
|
||||
<link rel="stylesheet" href="/assets/highlight/highlight.css?v=9.12">
|
||||
{{ end }}
|
||||
|
||||
{{ block script() }}
|
||||
<script src="/highlight/highlight.pack.js?v=9.12"></script>
|
||||
<script src="/assets/highlight/highlight.pack.js?v=9.12"></script>
|
||||
<script>hljs.initHighlightingOnLoad();</script>
|
||||
{{ end }}
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
{{ extends "../_layouts/default" }}
|
||||
|
||||
{{ block style() }}
|
||||
<link rel="stylesheet" href="/highlight/highlight.css?v=9.12">
|
||||
<link rel="stylesheet" href="/assets/highlight/highlight.css?v=9.12">
|
||||
{{ end }}
|
||||
|
||||
{{ block script() }}
|
||||
<script src="/highlight/highlight.pack.js?v=9.12"></script>
|
||||
<script src="/assets/highlight/highlight.pack.js?v=9.12"></script>
|
||||
<script>hljs.initHighlightingOnLoad();</script>
|
||||
{{ end }}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user