Compare commits
60 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3ff49542f3 | |||
| 27dcfd043b | |||
| 1de0619fd5 | |||
| 1c67db0c70 | |||
| 7365e69c59 | |||
| 23a565243a | |||
| 27dceadba1 | |||
| 6f471cef34 | |||
| e6422a6d75 | |||
| 56cab429de | |||
| 5f742c2163 | |||
| f31f29fa2f | |||
| 672819f3af | |||
| 0ff0c3ed0d | |||
| 54750f002a | |||
| 4c2dfb3346 | |||
| 8ae3abf29e | |||
| 362f036a68 | |||
| 0d0072a50e | |||
| 173ea372c2 | |||
| 8c75f705e2 | |||
| b1863430df | |||
| c51db23c32 | |||
| c40f120da2 | |||
| a7cb0ca823 | |||
| 7817d4bd0b | |||
| edadce359c | |||
| e1bf9599ef | |||
| c3ba9e6a53 | |||
| 10174b98b9 | |||
| 6acfb580dc | |||
| 340ec841fe | |||
| a515b96a46 | |||
| 46da85c8cf | |||
| f52ac8fb12 | |||
| 0e28aebd65 | |||
| 35892525ff | |||
| d2f3309842 | |||
| 03f6cc0acf | |||
| f8c7ee7ae6 | |||
| 00daedca30 | |||
| e2b8633aac | |||
| 50dbb572b1 | |||
| 95b595d2a9 | |||
| f57ce8b327 | |||
| 5787df5599 | |||
| 52ac9504c1 | |||
| 1da64f2e75 | |||
| 8bf3f669d0 | |||
| eec10541b3 | |||
| e0b09f20b0 | |||
| 8e40eb1844 | |||
| c9e060d574 | |||
| 9c9e16b2b2 | |||
| 35f7ce5f3d | |||
| 45e7938c5c | |||
| fbd9139928 | |||
| d0da9860af | |||
| 46d8dba137 | |||
| 3660f6eeb5 |
+6
-22
@@ -1,7 +1,6 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/portainer/portainer"
|
||||
@@ -31,12 +30,11 @@ func (*Service) ParseFlags(version string) (*portainer.CLIFlags, error) {
|
||||
kingpin.Version(version)
|
||||
|
||||
flags := &portainer.CLIFlags{
|
||||
Endpoint: kingpin.Flag("host", "Dockerd endpoint").Short('H').String(),
|
||||
ExternalEndpoints: kingpin.Flag("external-endpoints", "Path to a file defining available endpoints").String(),
|
||||
SyncInterval: kingpin.Flag("sync-interval", "Duration between each synchronization via the external endpoints source").Default(defaultSyncInterval).String(),
|
||||
Addr: kingpin.Flag("bind", "Address and port to serve Portainer").Default(defaultBindAddress).Short('p').String(),
|
||||
Assets: kingpin.Flag("assets", "Path to the assets").Default(defaultAssetsDirectory).Short('a').String(),
|
||||
Data: kingpin.Flag("data", "Path to the folder where the data is stored").Default(defaultDataDirectory).Short('d').String(),
|
||||
Endpoint: kingpin.Flag("host", "Dockerd endpoint").Short('H').String(),
|
||||
ExternalEndpoints: kingpin.Flag("external-endpoints", "Path to a file defining available endpoints").String(),
|
||||
NoAuth: kingpin.Flag("no-auth", "Disable authentication").Default(defaultNoAuth).Bool(),
|
||||
NoAnalytics: kingpin.Flag("no-analytics", "Disable Analytics in app").Default(defaultNoAnalytics).Bool(),
|
||||
TLSVerify: kingpin.Flag("tlsverify", "TLS support").Default(defaultTLSVerify).Bool(),
|
||||
@@ -46,12 +44,12 @@ func (*Service) ParseFlags(version string) (*portainer.CLIFlags, error) {
|
||||
SSL: kingpin.Flag("ssl", "Secure Portainer instance using SSL").Default(defaultSSL).Bool(),
|
||||
SSLCert: kingpin.Flag("sslcert", "Path to the SSL certificate used to secure the Portainer instance").Default(defaultSSLCertPath).String(),
|
||||
SSLKey: kingpin.Flag("sslkey", "Path to the SSL key used to secure the Portainer instance").Default(defaultSSLKeyPath).String(),
|
||||
SyncInterval: kingpin.Flag("sync-interval", "Duration between each synchronization via the external endpoints source").Default(defaultSyncInterval).String(),
|
||||
AdminPassword: kingpin.Flag("admin-password", "Hashed admin password").String(),
|
||||
AdminPasswordFile: kingpin.Flag("admin-password-file", "Path to the file containing the password for the admin user").String(),
|
||||
// Deprecated flags
|
||||
Labels: pairs(kingpin.Flag("hide-label", "Hide containers with a specific label in the UI").Short('l')),
|
||||
Logo: kingpin.Flag("logo", "URL for the logo displayed in the UI").String(),
|
||||
Templates: kingpin.Flag("templates", "URL to the templates (apps) definitions").Short('t').String(),
|
||||
Labels: pairs(kingpin.Flag("hide-label", "Hide containers with a specific label in the UI").Short('l')),
|
||||
Logo: kingpin.Flag("logo", "URL for the logo displayed in the UI").String(),
|
||||
Templates: kingpin.Flag("templates", "URL to the templates (apps) definitions").Short('t').String(),
|
||||
}
|
||||
|
||||
kingpin.Parse()
|
||||
@@ -97,8 +95,6 @@ func (*Service) ValidateFlags(flags *portainer.CLIFlags) error {
|
||||
return errAdminPassExcludeAdminPassFile
|
||||
}
|
||||
|
||||
displayDeprecationWarnings(*flags.Templates, *flags.Logo, *flags.Labels)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -142,15 +138,3 @@ func validateSyncInterval(syncInterval string) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func displayDeprecationWarnings(templates, logo string, labels []portainer.Pair) {
|
||||
if templates != "" {
|
||||
log.Println("Warning: the --templates / -t flag is deprecated and will be removed in future versions.")
|
||||
}
|
||||
if logo != "" {
|
||||
log.Println("Warning: the --logo flag is deprecated and will be removed in future versions.")
|
||||
}
|
||||
if labels != nil {
|
||||
log.Println("Warning: the --hide-label / -l flag is deprecated and will be removed in future versions.")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"github.com/portainer/portainer/cron"
|
||||
"github.com/portainer/portainer/crypto"
|
||||
"github.com/portainer/portainer/exec"
|
||||
"github.com/portainer/portainer/file"
|
||||
"github.com/portainer/portainer/filesystem"
|
||||
"github.com/portainer/portainer/git"
|
||||
"github.com/portainer/portainer/http"
|
||||
"github.com/portainer/portainer/jwt"
|
||||
@@ -31,7 +31,7 @@ func initCLI() *portainer.CLIFlags {
|
||||
}
|
||||
|
||||
func initFileService(dataStorePath string) portainer.FileService {
|
||||
fileService, err := file.NewService(dataStorePath, "")
|
||||
fileService, err := filesystem.NewService(dataStorePath, "")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
+10
-13
@@ -23,27 +23,19 @@ func NewStackManager(binaryPath string) *StackManager {
|
||||
}
|
||||
|
||||
// Login executes the docker login command against a list of registries (including DockerHub).
|
||||
func (manager *StackManager) Login(dockerhub *portainer.DockerHub, registries []portainer.Registry, endpoint *portainer.Endpoint) error {
|
||||
func (manager *StackManager) Login(dockerhub *portainer.DockerHub, registries []portainer.Registry, endpoint *portainer.Endpoint) {
|
||||
command, args := prepareDockerCommandAndArgs(manager.binaryPath, endpoint)
|
||||
for _, registry := range registries {
|
||||
if registry.Authentication {
|
||||
registryArgs := append(args, "login", "--username", registry.Username, "--password", registry.Password, registry.URL)
|
||||
err := runCommandAndCaptureStdErr(command, registryArgs, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
runCommandAndCaptureStdErr(command, registryArgs, nil)
|
||||
}
|
||||
}
|
||||
|
||||
if dockerhub.Authentication {
|
||||
dockerhubArgs := append(args, "login", "--username", dockerhub.Username, "--password", dockerhub.Password)
|
||||
err := runCommandAndCaptureStdErr(command, dockerhubArgs, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
runCommandAndCaptureStdErr(command, dockerhubArgs, nil)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Logout executes the docker logout command.
|
||||
@@ -54,10 +46,15 @@ func (manager *StackManager) Logout(endpoint *portainer.Endpoint) error {
|
||||
}
|
||||
|
||||
// Deploy executes the docker stack deploy command.
|
||||
func (manager *StackManager) Deploy(stack *portainer.Stack, endpoint *portainer.Endpoint) error {
|
||||
func (manager *StackManager) Deploy(stack *portainer.Stack, prune bool, endpoint *portainer.Endpoint) error {
|
||||
stackFilePath := path.Join(stack.ProjectPath, stack.EntryPoint)
|
||||
command, args := prepareDockerCommandAndArgs(manager.binaryPath, endpoint)
|
||||
args = append(args, "stack", "deploy", "--with-registry-auth", "--compose-file", stackFilePath, stack.Name)
|
||||
|
||||
if prune {
|
||||
args = append(args, "stack", "deploy", "--prune", "--with-registry-auth", "--compose-file", stackFilePath, stack.Name)
|
||||
} else {
|
||||
args = append(args, "stack", "deploy", "--with-registry-auth", "--compose-file", stackFilePath, stack.Name)
|
||||
}
|
||||
|
||||
env := make([]string, 0)
|
||||
for _, envvar := range stack.Env {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package file
|
||||
package filesystem
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
|
||||
"github.com/asaskevich/govalidator"
|
||||
"github.com/portainer/portainer"
|
||||
"github.com/portainer/portainer/file"
|
||||
"github.com/portainer/portainer/filesystem"
|
||||
httperror "github.com/portainer/portainer/http/error"
|
||||
"github.com/portainer/portainer/http/security"
|
||||
|
||||
@@ -138,11 +138,11 @@ func (handler *SettingsHandler) handlePutSettings(w http.ResponseWriter, r *http
|
||||
}
|
||||
|
||||
if (settings.LDAPSettings.TLSConfig.TLS || settings.LDAPSettings.StartTLS) && !settings.LDAPSettings.TLSConfig.TLSSkipVerify {
|
||||
caCertPath, _ := handler.FileService.GetPathForTLSFile(file.LDAPStorePath, portainer.TLSFileCA)
|
||||
caCertPath, _ := handler.FileService.GetPathForTLSFile(filesystem.LDAPStorePath, portainer.TLSFileCA)
|
||||
settings.LDAPSettings.TLSConfig.TLSCACertPath = caCertPath
|
||||
} else {
|
||||
settings.LDAPSettings.TLSConfig.TLSCACertPath = ""
|
||||
err := handler.FileService.DeleteTLSFiles(file.LDAPStorePath)
|
||||
err := handler.FileService.DeleteTLSFiles(filesystem.LDAPStorePath)
|
||||
if err != nil {
|
||||
httperror.WriteErrorResponse(w, err, http.StatusInternalServerError, handler.Logger)
|
||||
}
|
||||
@@ -169,7 +169,7 @@ func (handler *SettingsHandler) handlePutSettingsLDAPCheck(w http.ResponseWriter
|
||||
}
|
||||
|
||||
if (req.LDAPSettings.TLSConfig.TLS || req.LDAPSettings.StartTLS) && !req.LDAPSettings.TLSConfig.TLSSkipVerify {
|
||||
caCertPath, _ := handler.FileService.GetPathForTLSFile(file.LDAPStorePath, portainer.TLSFileCA)
|
||||
caCertPath, _ := handler.FileService.GetPathForTLSFile(filesystem.LDAPStorePath, portainer.TLSFileCA)
|
||||
req.LDAPSettings.TLSConfig.TLSCACertPath = caCertPath
|
||||
}
|
||||
|
||||
|
||||
+50
-17
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
"github.com/asaskevich/govalidator"
|
||||
"github.com/portainer/portainer"
|
||||
"github.com/portainer/portainer/file"
|
||||
"github.com/portainer/portainer/filesystem"
|
||||
httperror "github.com/portainer/portainer/http/error"
|
||||
"github.com/portainer/portainer/http/proxy"
|
||||
"github.com/portainer/portainer/http/security"
|
||||
@@ -37,6 +37,14 @@ type StackHandler struct {
|
||||
StackManager portainer.StackManager
|
||||
}
|
||||
|
||||
type stackDeploymentConfig struct {
|
||||
endpoint *portainer.Endpoint
|
||||
stack *portainer.Stack
|
||||
prune bool
|
||||
dockerhub *portainer.DockerHub
|
||||
registries []portainer.Registry
|
||||
}
|
||||
|
||||
// NewStackHandler returns a new instance of StackHandler.
|
||||
func NewStackHandler(bouncer *security.RequestBouncer) *StackHandler {
|
||||
h := &StackHandler{
|
||||
@@ -78,6 +86,7 @@ type (
|
||||
putStackRequest struct {
|
||||
StackFileContent string `valid:"required"`
|
||||
Env []portainer.Pair `valid:""`
|
||||
Prune bool `valid:"-"`
|
||||
}
|
||||
)
|
||||
|
||||
@@ -166,7 +175,7 @@ func (handler *StackHandler) handlePostStacksStringMethod(w http.ResponseWriter,
|
||||
ID: portainer.StackID(stackName + "_" + swarmID),
|
||||
Name: stackName,
|
||||
SwarmID: swarmID,
|
||||
EntryPoint: file.ComposeFileDefaultName,
|
||||
EntryPoint: filesystem.ComposeFileDefaultName,
|
||||
Env: req.Env,
|
||||
}
|
||||
|
||||
@@ -207,7 +216,14 @@ func (handler *StackHandler) handlePostStacksStringMethod(w http.ResponseWriter,
|
||||
return
|
||||
}
|
||||
|
||||
err = handler.deployStack(endpoint, stack, dockerhub, filteredRegistries)
|
||||
config := stackDeploymentConfig{
|
||||
stack: stack,
|
||||
endpoint: endpoint,
|
||||
dockerhub: dockerhub,
|
||||
registries: filteredRegistries,
|
||||
prune: false,
|
||||
}
|
||||
err = handler.deployStack(&config)
|
||||
if err != nil {
|
||||
httperror.WriteErrorResponse(w, err, http.StatusInternalServerError, handler.Logger)
|
||||
return
|
||||
@@ -264,7 +280,7 @@ func (handler *StackHandler) handlePostStacksRepositoryMethod(w http.ResponseWri
|
||||
}
|
||||
|
||||
if req.PathInRepository == "" {
|
||||
req.PathInRepository = file.ComposeFileDefaultName
|
||||
req.PathInRepository = filesystem.ComposeFileDefaultName
|
||||
}
|
||||
|
||||
stacks, err := handler.StackService.Stacks()
|
||||
@@ -334,7 +350,14 @@ func (handler *StackHandler) handlePostStacksRepositoryMethod(w http.ResponseWri
|
||||
return
|
||||
}
|
||||
|
||||
err = handler.deployStack(endpoint, stack, dockerhub, filteredRegistries)
|
||||
config := stackDeploymentConfig{
|
||||
stack: stack,
|
||||
endpoint: endpoint,
|
||||
dockerhub: dockerhub,
|
||||
registries: filteredRegistries,
|
||||
prune: false,
|
||||
}
|
||||
err = handler.deployStack(&config)
|
||||
if err != nil {
|
||||
httperror.WriteErrorResponse(w, err, http.StatusInternalServerError, handler.Logger)
|
||||
return
|
||||
@@ -404,7 +427,7 @@ func (handler *StackHandler) handlePostStacksFileMethod(w http.ResponseWriter, r
|
||||
ID: portainer.StackID(stackName + "_" + swarmID),
|
||||
Name: stackName,
|
||||
SwarmID: swarmID,
|
||||
EntryPoint: file.ComposeFileDefaultName,
|
||||
EntryPoint: filesystem.ComposeFileDefaultName,
|
||||
Env: env,
|
||||
}
|
||||
|
||||
@@ -445,7 +468,14 @@ func (handler *StackHandler) handlePostStacksFileMethod(w http.ResponseWriter, r
|
||||
return
|
||||
}
|
||||
|
||||
err = handler.deployStack(endpoint, stack, dockerhub, filteredRegistries)
|
||||
config := stackDeploymentConfig{
|
||||
stack: stack,
|
||||
endpoint: endpoint,
|
||||
dockerhub: dockerhub,
|
||||
registries: filteredRegistries,
|
||||
prune: false,
|
||||
}
|
||||
err = handler.deployStack(&config)
|
||||
if err != nil {
|
||||
httperror.WriteErrorResponse(w, err, http.StatusInternalServerError, handler.Logger)
|
||||
return
|
||||
@@ -637,7 +667,14 @@ func (handler *StackHandler) handlePutStack(w http.ResponseWriter, r *http.Reque
|
||||
return
|
||||
}
|
||||
|
||||
err = handler.deployStack(endpoint, stack, dockerhub, filteredRegistries)
|
||||
config := stackDeploymentConfig{
|
||||
stack: stack,
|
||||
endpoint: endpoint,
|
||||
dockerhub: dockerhub,
|
||||
registries: filteredRegistries,
|
||||
prune: req.Prune,
|
||||
}
|
||||
err = handler.deployStack(&config)
|
||||
if err != nil {
|
||||
httperror.WriteErrorResponse(w, err, http.StatusInternalServerError, handler.Logger)
|
||||
return
|
||||
@@ -732,22 +769,18 @@ func (handler *StackHandler) handleDeleteStack(w http.ResponseWriter, r *http.Re
|
||||
}
|
||||
}
|
||||
|
||||
func (handler *StackHandler) deployStack(endpoint *portainer.Endpoint, stack *portainer.Stack, dockerhub *portainer.DockerHub, registries []portainer.Registry) error {
|
||||
func (handler *StackHandler) deployStack(config *stackDeploymentConfig) error {
|
||||
handler.stackCreationMutex.Lock()
|
||||
|
||||
err := handler.StackManager.Login(dockerhub, registries, endpoint)
|
||||
handler.StackManager.Login(config.dockerhub, config.registries, config.endpoint)
|
||||
|
||||
err := handler.StackManager.Deploy(config.stack, config.prune, config.endpoint)
|
||||
if err != nil {
|
||||
handler.stackCreationMutex.Unlock()
|
||||
return err
|
||||
}
|
||||
|
||||
err = handler.StackManager.Deploy(stack, endpoint)
|
||||
if err != nil {
|
||||
handler.stackCreationMutex.Unlock()
|
||||
return err
|
||||
}
|
||||
|
||||
err = handler.StackManager.Logout(endpoint)
|
||||
err = handler.StackManager.Logout(config.endpoint)
|
||||
if err != nil {
|
||||
handler.stackCreationMutex.Unlock()
|
||||
return err
|
||||
|
||||
+10
-11
@@ -12,13 +12,17 @@ type (
|
||||
// CLIFlags represents the available flags on the CLI.
|
||||
CLIFlags struct {
|
||||
Addr *string
|
||||
AdminPassword *string
|
||||
AdminPasswordFile *string
|
||||
Assets *string
|
||||
Data *string
|
||||
ExternalEndpoints *string
|
||||
SyncInterval *string
|
||||
Endpoint *string
|
||||
ExternalEndpoints *string
|
||||
Labels *[]Pair
|
||||
Logo *string
|
||||
NoAuth *bool
|
||||
NoAnalytics *bool
|
||||
Templates *string
|
||||
TLSVerify *bool
|
||||
TLSCacert *string
|
||||
TLSCert *string
|
||||
@@ -26,12 +30,7 @@ type (
|
||||
SSL *bool
|
||||
SSLCert *string
|
||||
SSLKey *string
|
||||
AdminPassword *string
|
||||
AdminPasswordFile *string
|
||||
// Deprecated fields
|
||||
Logo *string
|
||||
Templates *string
|
||||
Labels *[]Pair
|
||||
SyncInterval *string
|
||||
}
|
||||
|
||||
// Status represents the application status.
|
||||
@@ -381,16 +380,16 @@ type (
|
||||
|
||||
// StackManager represents a service to manage stacks.
|
||||
StackManager interface {
|
||||
Login(dockerhub *DockerHub, registries []Registry, endpoint *Endpoint) error
|
||||
Login(dockerhub *DockerHub, registries []Registry, endpoint *Endpoint)
|
||||
Logout(endpoint *Endpoint) error
|
||||
Deploy(stack *Stack, endpoint *Endpoint) error
|
||||
Deploy(stack *Stack, prune bool, endpoint *Endpoint) error
|
||||
Remove(stack *Stack, endpoint *Endpoint) error
|
||||
}
|
||||
)
|
||||
|
||||
const (
|
||||
// APIVersion is the version number of the Portainer API.
|
||||
APIVersion = "1.15.4"
|
||||
APIVersion = "1.16.2"
|
||||
// DBVersion is the version number of the Portainer database.
|
||||
DBVersion = 7
|
||||
// DefaultTemplatesURL represents the default URL for the templates definitions.
|
||||
|
||||
+386
-11
@@ -56,7 +56,7 @@ info:
|
||||
|
||||
**NOTE**: You can find more information on how to query the Docker API in the [Docker official documentation](https://docs.docker.com/engine/api/v1.30/) as well as in [this Portainer example](https://gist.github.com/deviantony/77026d402366b4b43fa5918d41bc42f8).
|
||||
|
||||
version: "1.15.4"
|
||||
version: "1.16.2"
|
||||
title: "Portainer API"
|
||||
contact:
|
||||
email: "info@portainer.io"
|
||||
@@ -77,6 +77,8 @@ tags:
|
||||
description: "Manage Portainer settings"
|
||||
- name: "status"
|
||||
description: "Information about the Portainer instance"
|
||||
- name: "stacks"
|
||||
description: "Manage Docker stacks"
|
||||
- name: "users"
|
||||
description: "Manage users"
|
||||
- name: "teams"
|
||||
@@ -436,6 +438,285 @@ paths:
|
||||
schema:
|
||||
$ref: "#/definitions/GenericError"
|
||||
|
||||
/endpoints/{endpointId}/stacks:
|
||||
get:
|
||||
tags:
|
||||
- "stacks"
|
||||
summary: "List stacks"
|
||||
description: |
|
||||
List all stacks based on the current user authorizations.
|
||||
Will return all stacks if using an administrator account otherwise it
|
||||
will only return the list of stacks the user have access to.
|
||||
**Access policy**: restricted
|
||||
operationId: "StackList"
|
||||
produces:
|
||||
- "application/json"
|
||||
parameters:
|
||||
- name: "endpointId"
|
||||
in: "path"
|
||||
description: "Endpoint identifier"
|
||||
required: true
|
||||
type: "integer"
|
||||
responses:
|
||||
200:
|
||||
description: "Success"
|
||||
schema:
|
||||
$ref: "#/definitions/StackListResponse"
|
||||
403:
|
||||
description: "Unauthorized"
|
||||
schema:
|
||||
$ref: "#/definitions/GenericError"
|
||||
examples:
|
||||
application/json:
|
||||
err: "Access denied to resource"
|
||||
500:
|
||||
description: "Server error"
|
||||
schema:
|
||||
$ref: "#/definitions/GenericError"
|
||||
post:
|
||||
tags:
|
||||
- "stacks"
|
||||
summary: "Deploy a new stack"
|
||||
description: |
|
||||
Deploy a new stack into a Docker environment specified via the endpoint identifier.
|
||||
**Access policy**: restricted
|
||||
operationId: "StackCreate"
|
||||
consumes:
|
||||
- "application/json"
|
||||
produces:
|
||||
- "application/json"
|
||||
parameters:
|
||||
- name: "endpointId"
|
||||
in: "path"
|
||||
description: "Endpoint identifier"
|
||||
required: true
|
||||
type: "integer"
|
||||
- name: "method"
|
||||
in: "query"
|
||||
description: "Stack deployment method. Possible values: string or repository."
|
||||
required: true
|
||||
type: "string"
|
||||
- in: "body"
|
||||
name: "body"
|
||||
description: "Stack details. Used when"
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/StackCreateRequest"
|
||||
responses:
|
||||
200:
|
||||
description: "Success"
|
||||
schema:
|
||||
$ref: "#/definitions/StackCreateResponse"
|
||||
400:
|
||||
description: "Invalid request"
|
||||
schema:
|
||||
$ref: "#/definitions/GenericError"
|
||||
examples:
|
||||
application/json:
|
||||
err: "Invalid request data format"
|
||||
404:
|
||||
description: "Endpoint not found"
|
||||
schema:
|
||||
$ref: "#/definitions/GenericError"
|
||||
examples:
|
||||
application/json:
|
||||
err: "Endpoint not found"
|
||||
500:
|
||||
description: "Server error"
|
||||
schema:
|
||||
$ref: "#/definitions/GenericError"
|
||||
/endpoints/{endpointId}/stacks/{id}:
|
||||
get:
|
||||
tags:
|
||||
- "stacks"
|
||||
summary: "Inspect a stack"
|
||||
description: |
|
||||
Retrieve details about a stack.
|
||||
**Access policy**: restricted
|
||||
operationId: "StackInspect"
|
||||
produces:
|
||||
- "application/json"
|
||||
parameters:
|
||||
- name: "endpointId"
|
||||
in: "path"
|
||||
description: "Endpoint identifier"
|
||||
required: true
|
||||
type: "integer"
|
||||
- name: "id"
|
||||
in: "path"
|
||||
description: "Stack identifier"
|
||||
required: true
|
||||
type: "string"
|
||||
responses:
|
||||
200:
|
||||
description: "Success"
|
||||
schema:
|
||||
$ref: "#/definitions/Stack"
|
||||
400:
|
||||
description: "Invalid request"
|
||||
schema:
|
||||
$ref: "#/definitions/GenericError"
|
||||
examples:
|
||||
application/json:
|
||||
err: "Invalid request"
|
||||
403:
|
||||
description: "Unauthorized"
|
||||
schema:
|
||||
$ref: "#/definitions/GenericError"
|
||||
404:
|
||||
description: "Stack not found"
|
||||
schema:
|
||||
$ref: "#/definitions/GenericError"
|
||||
examples:
|
||||
application/json:
|
||||
err: "Stack not found"
|
||||
500:
|
||||
description: "Server error"
|
||||
schema:
|
||||
$ref: "#/definitions/GenericError"
|
||||
put:
|
||||
tags:
|
||||
- "stacks"
|
||||
summary: "Update a stack"
|
||||
description: |
|
||||
Update a stack.
|
||||
**Access policy**: restricted
|
||||
operationId: "StackUpdate"
|
||||
consumes:
|
||||
- "application/json"
|
||||
produces:
|
||||
- "application/json"
|
||||
parameters:
|
||||
- name: "endpointId"
|
||||
in: "path"
|
||||
description: "Endpoint identifier"
|
||||
required: true
|
||||
type: "integer"
|
||||
- name: "id"
|
||||
in: "path"
|
||||
description: "Stack identifier"
|
||||
required: true
|
||||
type: "string"
|
||||
- in: "body"
|
||||
name: "body"
|
||||
description: "Stack details"
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/StackUpdateRequest"
|
||||
responses:
|
||||
200:
|
||||
description: "Success"
|
||||
400:
|
||||
description: "Invalid request"
|
||||
schema:
|
||||
$ref: "#/definitions/GenericError"
|
||||
examples:
|
||||
application/json:
|
||||
err: "Invalid request data format"
|
||||
404:
|
||||
description: "Stack not found"
|
||||
schema:
|
||||
$ref: "#/definitions/GenericError"
|
||||
examples:
|
||||
application/json:
|
||||
err: "Stack not found"
|
||||
500:
|
||||
description: "Server error"
|
||||
schema:
|
||||
$ref: "#/definitions/GenericError"
|
||||
delete:
|
||||
tags:
|
||||
- "stacks"
|
||||
summary: "Remove a stack"
|
||||
description: |
|
||||
Remove a stack.
|
||||
**Access policy**: restricted
|
||||
operationId: "StackDelete"
|
||||
parameters:
|
||||
- name: "endpointId"
|
||||
in: "path"
|
||||
description: "Endpoint identifier"
|
||||
required: true
|
||||
type: "integer"
|
||||
- name: "id"
|
||||
in: "path"
|
||||
description: "Stack identifier"
|
||||
required: true
|
||||
type: "string"
|
||||
responses:
|
||||
200:
|
||||
description: "Success"
|
||||
400:
|
||||
description: "Invalid request"
|
||||
schema:
|
||||
$ref: "#/definitions/GenericError"
|
||||
examples:
|
||||
application/json:
|
||||
err: "Invalid request"
|
||||
403:
|
||||
description: "Unauthorized"
|
||||
schema:
|
||||
$ref: "#/definitions/GenericError"
|
||||
404:
|
||||
description: "Stack not found"
|
||||
schema:
|
||||
$ref: "#/definitions/GenericError"
|
||||
examples:
|
||||
application/json:
|
||||
err: "Stack not found"
|
||||
500:
|
||||
description: "Server error"
|
||||
schema:
|
||||
$ref: "#/definitions/GenericError"
|
||||
/endpoints/{endpointId}/stacks/{id}/stackfile:
|
||||
get:
|
||||
tags:
|
||||
- "stacks"
|
||||
summary: "Retrieve the content of the Stack file for the specified stack"
|
||||
description: |
|
||||
Get Stack file content.
|
||||
**Access policy**: restricted
|
||||
operationId: "StackFileInspect"
|
||||
produces:
|
||||
- "application/json"
|
||||
parameters:
|
||||
- name: "endpointId"
|
||||
in: "path"
|
||||
description: "Endpoint identifier"
|
||||
required: true
|
||||
type: "integer"
|
||||
- name: "id"
|
||||
in: "path"
|
||||
description: "Stack identifier"
|
||||
required: true
|
||||
type: "string"
|
||||
responses:
|
||||
200:
|
||||
description: "Success"
|
||||
schema:
|
||||
$ref: "#/definitions/StackFileInspectResponse"
|
||||
400:
|
||||
description: "Invalid request"
|
||||
schema:
|
||||
$ref: "#/definitions/GenericError"
|
||||
examples:
|
||||
application/json:
|
||||
err: "Invalid request"
|
||||
403:
|
||||
description: "Unauthorized"
|
||||
schema:
|
||||
$ref: "#/definitions/GenericError"
|
||||
404:
|
||||
description: "Stack not found"
|
||||
schema:
|
||||
$ref: "#/definitions/GenericError"
|
||||
examples:
|
||||
application/json:
|
||||
err: "Stack not found"
|
||||
500:
|
||||
description: "Server error"
|
||||
schema:
|
||||
$ref: "#/definitions/GenericError"
|
||||
/registries:
|
||||
get:
|
||||
tags:
|
||||
@@ -536,7 +817,7 @@ paths:
|
||||
$ref: "#/definitions/GenericError"
|
||||
examples:
|
||||
application/json:
|
||||
err: "Endpoint not found"
|
||||
err: "Registry not found"
|
||||
500:
|
||||
description: "Server error"
|
||||
schema:
|
||||
@@ -593,13 +874,6 @@ paths:
|
||||
description: "Server error"
|
||||
schema:
|
||||
$ref: "#/definitions/GenericError"
|
||||
503:
|
||||
description: "Endpoint management disabled"
|
||||
schema:
|
||||
$ref: "#/definitions/GenericError"
|
||||
examples:
|
||||
application/json:
|
||||
err: "Endpoint management is disabled"
|
||||
delete:
|
||||
tags:
|
||||
- "registries"
|
||||
@@ -1869,7 +2143,7 @@ definitions:
|
||||
description: "Is analytics enabled"
|
||||
Version:
|
||||
type: "string"
|
||||
example: "1.15.4"
|
||||
example: "1.16.2"
|
||||
description: "Portainer API version"
|
||||
PublicSettingsInspectResponse:
|
||||
type: "object"
|
||||
@@ -1883,7 +2157,7 @@ definitions:
|
||||
DisplayDonationHeader:
|
||||
type: "boolean"
|
||||
example: true
|
||||
description: "Whether to display or not the donation message in the header."\
|
||||
description: "Whether to display or not the donation message in the header."
|
||||
DisplayExternalContributors:
|
||||
type: "boolean"
|
||||
example: false
|
||||
@@ -2612,3 +2886,104 @@ definitions:
|
||||
type: "string"
|
||||
example: "nginx:latest"
|
||||
description: "The Docker image associated to the template"
|
||||
StackCreateRequest:
|
||||
type: "object"
|
||||
required:
|
||||
- "Name"
|
||||
- "SwarmID"
|
||||
properties:
|
||||
Name:
|
||||
type: "string"
|
||||
example: "myStack"
|
||||
description: "Name of the stack"
|
||||
SwarmID:
|
||||
type: "string"
|
||||
example: "jpofkc0i9uo9wtx1zesuk649w"
|
||||
description: "Cluster identifier of the Swarm cluster"
|
||||
StackFileContent:
|
||||
type: "string"
|
||||
example: "version: 3\n services:\n web:\n image:nginx"
|
||||
description: "Content of the Stack file. Required when using the 'string' deployment method."
|
||||
GitRepository:
|
||||
type: "string"
|
||||
example: "https://github.com/openfaas/faas"
|
||||
description: "URL of a public Git repository hosting the Stack file. Required when using the 'repository' deployment method."
|
||||
PathInRepository:
|
||||
type: "string"
|
||||
example: "docker-compose.yml"
|
||||
description: "Path to the Stack file inside the Git repository. Required when using the 'repository' deployment method."
|
||||
Env:
|
||||
type: "array"
|
||||
description: "A list of environment variables used during stack deployment"
|
||||
items:
|
||||
$ref: "#/definitions/Stack_Env"
|
||||
Stack_Env:
|
||||
properties:
|
||||
name:
|
||||
type: "string"
|
||||
example: "MYSQL_ROOT_PASSWORD"
|
||||
value:
|
||||
type: "string"
|
||||
example: "password"
|
||||
StackCreateResponse:
|
||||
type: "object"
|
||||
properties:
|
||||
Id:
|
||||
type: "string"
|
||||
example: "myStack_jpofkc0i9uo9wtx1zesuk649w"
|
||||
description: "Id of the stack"
|
||||
StackListResponse:
|
||||
type: "array"
|
||||
items:
|
||||
$ref: "#/definitions/Stack"
|
||||
Stack:
|
||||
type: "object"
|
||||
properties:
|
||||
Id:
|
||||
type: "string"
|
||||
example: "myStack_jpofkc0i9uo9wtx1zesuk649w"
|
||||
description: "Stack identifier"
|
||||
Name:
|
||||
type: "string"
|
||||
example: "myStack"
|
||||
description: "Stack name"
|
||||
EntryPoint:
|
||||
type: "string"
|
||||
example: "docker-compose.yml"
|
||||
description: "Path to the Stack file"
|
||||
SwarmID:
|
||||
type: "string"
|
||||
example: "jpofkc0i9uo9wtx1zesuk649w"
|
||||
description: "Cluster identifier of the Swarm cluster where the stack is deployed"
|
||||
ProjectPath:
|
||||
type: "string"
|
||||
example: "/data/compose/myStack_jpofkc0i9uo9wtx1zesuk649w"
|
||||
description: "Path on disk to the repository hosting the Stack file"
|
||||
Env:
|
||||
type: "array"
|
||||
description: "A list of environment variables used during stack deployment"
|
||||
items:
|
||||
$ref: "#/definitions/Stack_Env"
|
||||
StackUpdateRequest:
|
||||
type: "object"
|
||||
properties:
|
||||
StackFileContent:
|
||||
type: "string"
|
||||
example: "version: 3\n services:\n web:\n image:nginx"
|
||||
description: "New content of the Stack file."
|
||||
Env:
|
||||
type: "array"
|
||||
description: "A list of environment variables used during stack deployment"
|
||||
items:
|
||||
$ref: "#/definitions/Stack_Env"
|
||||
Prune:
|
||||
type: "boolean"
|
||||
example: false
|
||||
description: "Prune services that are no longer referenced"
|
||||
StackFileInspectResponse:
|
||||
type: "object"
|
||||
properties:
|
||||
StackFileContent:
|
||||
type: "string"
|
||||
example: "version: 3\n services:\n web:\n image:nginx"
|
||||
description: "Content of the Stack file."
|
||||
|
||||
+6
-60
@@ -5,70 +5,16 @@ angular.module('portainer', [
|
||||
'ngCookies',
|
||||
'ngSanitize',
|
||||
'ngFileUpload',
|
||||
'ngMessages',
|
||||
'ngResource',
|
||||
'angularUtils.directives.dirPagination',
|
||||
'LocalStorageModule',
|
||||
'angular-jwt',
|
||||
'angular-google-analytics',
|
||||
'ui',
|
||||
'angular-json-tree',
|
||||
'angular-loading-bar',
|
||||
'portainer.templates',
|
||||
'portainer.filters',
|
||||
'portainer.rest',
|
||||
'portainer.helpers',
|
||||
'portainer.services',
|
||||
'auth',
|
||||
'dashboard',
|
||||
'config',
|
||||
'configs',
|
||||
'container',
|
||||
'containerConsole',
|
||||
'containerLogs',
|
||||
'containerStats',
|
||||
'containerInspect',
|
||||
'serviceLogs',
|
||||
'containers',
|
||||
'createConfig',
|
||||
'createContainer',
|
||||
'createNetwork',
|
||||
'createRegistry',
|
||||
'createSecret',
|
||||
'createService',
|
||||
'createVolume',
|
||||
'createStack',
|
||||
'engine',
|
||||
'endpoint',
|
||||
'endpointAccess',
|
||||
'endpoints',
|
||||
'events',
|
||||
'image',
|
||||
'images',
|
||||
'initAdmin',
|
||||
'initEndpoint',
|
||||
'main',
|
||||
'network',
|
||||
'networks',
|
||||
'node',
|
||||
'registries',
|
||||
'registry',
|
||||
'registryAccess',
|
||||
'secrets',
|
||||
'secret',
|
||||
'service',
|
||||
'services',
|
||||
'settings',
|
||||
'settingsAuthentication',
|
||||
'sidebar',
|
||||
'stack',
|
||||
'stacks',
|
||||
'swarm',
|
||||
'swarmVisualizer',
|
||||
'task',
|
||||
'team',
|
||||
'teams',
|
||||
'templates',
|
||||
'user',
|
||||
'users',
|
||||
'userSettings',
|
||||
'volume',
|
||||
'volumes',
|
||||
'portainer.app',
|
||||
'portainer.docker',
|
||||
'extension.storidge',
|
||||
'rzModule']);
|
||||
|
||||
+3
-3
@@ -7,7 +7,7 @@ angular.module('portainer')
|
||||
StateManager.initialize()
|
||||
.then(function success(state) {
|
||||
if (state.application.authentication) {
|
||||
initAuthentication(authManager, Authentication, $rootScope);
|
||||
initAuthentication(authManager, Authentication, $rootScope, $state);
|
||||
}
|
||||
if (state.application.analytics) {
|
||||
initAnalytics(Analytics, $rootScope);
|
||||
@@ -30,12 +30,12 @@ angular.module('portainer')
|
||||
}]);
|
||||
|
||||
|
||||
function initAuthentication(authManager, Authentication, $rootScope) {
|
||||
function initAuthentication(authManager, Authentication, $rootScope, $state) {
|
||||
authManager.checkAuthOnRefresh();
|
||||
authManager.redirectWhenUnauthenticated();
|
||||
Authentication.init();
|
||||
$rootScope.$on('tokenHasExpired', function() {
|
||||
$state.go('auth', {error: 'Your session has expired'});
|
||||
$state.go('portainer.auth', {error: 'Your session has expired'});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,144 +0,0 @@
|
||||
<rd-header>
|
||||
<rd-header-title title="Network list">
|
||||
<a data-toggle="tooltip" title="Refresh" ui-sref="networks" ui-sref-opts="{reload: true}">
|
||||
<i class="fa fa-refresh" aria-hidden="true"></i>
|
||||
</a>
|
||||
</rd-header-title>
|
||||
<rd-header-content>Networks</rd-header-content>
|
||||
</rd-header>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<networks-datatable
|
||||
title="Networks" title-icon="fa-sitemap"
|
||||
dataset="networks" table-key="networks"
|
||||
order-by="Name" show-text-filter="true"
|
||||
remove-action="removeAction"
|
||||
show-ownership-column="applicationState.application.authentication"
|
||||
></networks-datatable>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div class="row">
|
||||
<div class="col-lg-12 col-md-12 col-xs-12">
|
||||
<rd-widget>
|
||||
<rd-widget-header icon="fa-sitemap" title="Networks">
|
||||
<div class="pull-right">
|
||||
Items per page:
|
||||
<select ng-model="state.pagination_count" ng-change="changePaginationCount()">
|
||||
<option value="0">All</option>
|
||||
<option value="10">10</option>
|
||||
<option value="25">25</option>
|
||||
<option value="50">50</option>
|
||||
<option value="100">100</option>
|
||||
</select>
|
||||
</div>
|
||||
</rd-widget-header>
|
||||
<rd-widget-taskbar classes="col-lg-12">
|
||||
<div class="pull-left">
|
||||
<button type="button" class="btn btn-danger" ng-click="removeAction()" ng-disabled="!state.selectedItemCount"><i class="fa fa-trash space-right" aria-hidden="true"></i>Remove</button>
|
||||
<a class="btn btn-primary" type="button" ui-sref="actions.create.network"><i class="fa fa-plus space-right" aria-hidden="true"></i>Add network</a>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<input type="text" id="filter" ng-model="state.filter" placeholder="Filter..." class="form-control input-sm" />
|
||||
</div>
|
||||
</rd-widget-taskbar>
|
||||
<rd-widget-body classes="no-padding">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<input type="checkbox" ng-model="allSelected" ng-change="selectItems(allSelected)" />
|
||||
</th>
|
||||
<th>
|
||||
<a ng-click="order('Name')">
|
||||
Name
|
||||
<span ng-show="sortType == 'Name' && !sortReverse" class="glyphicon glyphicon-chevron-down"></span>
|
||||
<span ng-show="sortType == 'Name' && sortReverse" class="glyphicon glyphicon-chevron-up"></span>
|
||||
</a>
|
||||
</th>
|
||||
<th>
|
||||
<a ng-click="order('StackName')">
|
||||
Stack
|
||||
<span ng-show="sortType == 'StackName' && !sortReverse" class="glyphicon glyphicon-chevron-down"></span>
|
||||
<span ng-show="sortType == 'StackName' && sortReverse" class="glyphicon glyphicon-chevron-up"></span>
|
||||
</a>
|
||||
</th>
|
||||
<th>
|
||||
<a ng-click="order('Scope')">
|
||||
Scope
|
||||
<span ng-show="sortType == 'Scope' && !sortReverse" class="glyphicon glyphicon-chevron-down"></span>
|
||||
<span ng-show="sortType == 'Scope' && sortReverse" class="glyphicon glyphicon-chevron-up"></span>
|
||||
</a>
|
||||
</th>
|
||||
<th>
|
||||
<a ng-click="order('Driver')">
|
||||
Driver
|
||||
<span ng-show="sortType == 'Driver' && !sortReverse" class="glyphicon glyphicon-chevron-down"></span>
|
||||
<span ng-show="sortType == 'Driver' && sortReverse" class="glyphicon glyphicon-chevron-up"></span>
|
||||
</a>
|
||||
</th>
|
||||
<th>
|
||||
<a ng-click="order('IPAM.Driver')">
|
||||
IPAM Driver
|
||||
<span ng-show="sortType == 'IPAM.Driver' && !sortReverse" class="glyphicon glyphicon-chevron-down"></span>
|
||||
<span ng-show="sortType == 'IPAM.Driver' && sortReverse" class="glyphicon glyphicon-chevron-up"></span>
|
||||
</a>
|
||||
</th>
|
||||
<th>
|
||||
<a ng-click="order('IPAM.Config[0].Subnet')">
|
||||
IPAM Subnet
|
||||
<span ng-show="sortType == 'IPAM.Config[0].Subnet' && !sortReverse" class="glyphicon glyphicon-chevron-down"></span>
|
||||
<span ng-show="sortType == 'IPAM.Config[0].Subnet' && sortReverse" class="glyphicon glyphicon-chevron-up"></span>
|
||||
</a>
|
||||
</th>
|
||||
<th>
|
||||
<a ng-click="order('IPAM.Config[0].Gateway')">
|
||||
IPAM Gateway
|
||||
<span ng-show="sortType == 'IPAM.Config[0].Gateway' && !sortReverse" class="glyphicon glyphicon-chevron-down"></span>
|
||||
<span ng-show="sortType == 'IPAM.Config[0].Gateway' && sortReverse" class="glyphicon glyphicon-chevron-up"></span>
|
||||
</a>
|
||||
</th>
|
||||
<th ng-if="applicationState.application.authentication">
|
||||
<a ng-click="order('ResourceControl.Ownership')">
|
||||
Ownership
|
||||
<span ng-show="sortType == 'ResourceControl.Ownership' && !sortReverse" class="glyphicon glyphicon-chevron-down"></span>
|
||||
<span ng-show="sortType == 'ResourceControl.Ownership' && sortReverse" class="glyphicon glyphicon-chevron-up"></span>
|
||||
</a>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr dir-paginate="network in ( state.filteredNetworks = (networks | filter:state.filter | orderBy:sortType:sortReverse | itemsPerPage: state.pagination_count))" ng-class="{active: network.Checked}">
|
||||
<td><input type="checkbox" ng-model="network.Checked" ng-change="selectItem(network)"/></td>
|
||||
<td><a ui-sref="network({id: network.Id})">{{ network.Name | truncate:40 }}</a></td>
|
||||
<td>{{ network.StackName ? network.StackName : '-' }}</td>
|
||||
<td>{{ network.Scope }}</td>
|
||||
<td>{{ network.Driver }}</td>
|
||||
<td>{{ network.IPAM.Driver }}</td>
|
||||
<td>{{ network.IPAM.Config[0].Subnet ? network.IPAM.Config[0].Subnet : '-' }}</td>
|
||||
<td>{{ network.IPAM.Config[0].Gateway ? network.IPAM.Config[0].Gateway : '-' }}</td>
|
||||
<td ng-if="applicationState.application.authentication">
|
||||
<span>
|
||||
<i ng-class="network.ResourceControl.Ownership | ownershipicon" aria-hidden="true"></i>
|
||||
{{ network.ResourceControl.Ownership ? network.ResourceControl.Ownership : network.ResourceControl.Ownership = 'public' }}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr ng-if="!networks">
|
||||
<td colspan="9" class="text-center text-muted">Loading...</td>
|
||||
</tr>
|
||||
<tr ng-if="networks.length == 0">
|
||||
<td colspan="9" class="text-center text-muted">No networks available.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div ng-if="networks" class="pull-left pagination-controls">
|
||||
<dir-pagination-controls></dir-pagination-controls>
|
||||
</div>
|
||||
</div>
|
||||
</rd-widget-body>
|
||||
</rd-widget>
|
||||
</div>
|
||||
</div> -->
|
||||
@@ -1,90 +0,0 @@
|
||||
<!-- Sidebar -->
|
||||
<div id="sidebar-wrapper">
|
||||
<div class="sidebar-header">
|
||||
<a ng-click="toggleSidebar()" class="interactive">
|
||||
<img ng-if="logo" ng-src="{{ logo }}" class="img-responsive logo">
|
||||
<img ng-if="!logo" src="images/logo.png" class="img-responsive logo" alt="Portainer">
|
||||
<span class="menu-icon glyphicon glyphicon-transfer"></span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="sidebar-content">
|
||||
<ul class="sidebar">
|
||||
<li class="sidebar-title"><span>Active endpoint</span></li>
|
||||
<li class="sidebar-title">
|
||||
<select class="select-endpoint form-control" ng-options="endpoint.Name for endpoint in endpoints" ng-model="activeEndpoint" ng-change="switchEndpoint(activeEndpoint)">
|
||||
</select>
|
||||
</li>
|
||||
<li class="sidebar-title"><span>Endpoint actions</span></li>
|
||||
<li class="sidebar-list">
|
||||
<a ui-sref="dashboard" ui-sref-active="active">Dashboard <span class="menu-icon fa fa-tachometer fa-fw"></span></a>
|
||||
</li>
|
||||
<li class="sidebar-list">
|
||||
<a ui-sref="templates" ui-sref-active="active">App Templates <span class="menu-icon fa fa-rocket fa-fw"></span></a>
|
||||
<div class="sidebar-sublist" ng-if="toggle && displayExternalContributors && ($state.current.name === 'templates' || $state.current.name === 'templates_linuxserver')">
|
||||
<a ui-sref="templates_linuxserver" ui-sref-active="active">LinuxServer.io</a>
|
||||
</div>
|
||||
</li>
|
||||
<li class="sidebar-list" ng-if="applicationState.endpoint.apiVersion >= 1.25 && applicationState.endpoint.mode.provider === 'DOCKER_SWARM_MODE' && applicationState.endpoint.mode.role === 'MANAGER'">
|
||||
<a ui-sref="stacks" ui-sref-active="active">Stacks <span class="menu-icon fa fa-th-list fa-fw"></span></a>
|
||||
</li>
|
||||
<li class="sidebar-list" ng-if="applicationState.endpoint.mode.provider === 'DOCKER_SWARM_MODE' && applicationState.endpoint.mode.role === 'MANAGER'">
|
||||
<a ui-sref="services" ui-sref-active="active">Services <span class="menu-icon fa fa-list-alt fa-fw"></span></a>
|
||||
</li>
|
||||
<li class="sidebar-list">
|
||||
<a ui-sref="containers" ui-sref-active="active">Containers <span class="menu-icon fa fa-server fa-fw"></span></a>
|
||||
</li>
|
||||
<li class="sidebar-list">
|
||||
<a ui-sref="images" ui-sref-active="active">Images <span class="menu-icon fa fa-clone fa-fw"></span></a>
|
||||
</li>
|
||||
<li class="sidebar-list">
|
||||
<a ui-sref="networks" ui-sref-active="active">Networks <span class="menu-icon fa fa-sitemap fa-fw"></span></a>
|
||||
</li>
|
||||
<li class="sidebar-list">
|
||||
<a ui-sref="volumes" ui-sref-active="active">Volumes <span class="menu-icon fa fa-cubes fa-fw"></span></a>
|
||||
</li>
|
||||
<li class="sidebar-list" ng-if="applicationState.endpoint.apiVersion >= 1.30 && applicationState.endpoint.mode.provider === 'DOCKER_SWARM_MODE' && applicationState.endpoint.mode.role === 'MANAGER'">
|
||||
<a ui-sref="configs" ui-sref-active="active">Configs <span class="menu-icon fa fa-file-code-o fa-fw"></span></a>
|
||||
</li>
|
||||
<li class="sidebar-list" ng-if="applicationState.endpoint.apiVersion >= 1.25 && applicationState.endpoint.mode.provider === 'DOCKER_SWARM_MODE' && applicationState.endpoint.mode.role === 'MANAGER'">
|
||||
<a ui-sref="secrets" ui-sref-active="active">Secrets <span class="menu-icon fa fa-user-secret fa-fw"></span></a>
|
||||
</li>
|
||||
<li class="sidebar-list" ng-if="(applicationState.endpoint.mode.provider === 'DOCKER_STANDALONE' || applicationState.endpoint.mode.provider === 'VMWARE_VIC') && (!applicationState.application.authentication || isAdmin)">
|
||||
<a ui-sref="events" ui-sref-active="active">Events <span class="menu-icon fa fa-history fa-fw"></span></a>
|
||||
</li>
|
||||
<li class="sidebar-list" ng-if="applicationState.endpoint.mode.provider === 'DOCKER_SWARM' || (applicationState.endpoint.mode.provider === 'DOCKER_SWARM_MODE' && applicationState.endpoint.mode.role === 'MANAGER')">
|
||||
<a ui-sref="swarm" ui-sref-active="active">Swarm <span class="menu-icon fa fa-object-group fa-fw"></span></a>
|
||||
</li>
|
||||
<li class="sidebar-list" ng-if="applicationState.endpoint.mode.provider === 'DOCKER_STANDALONE' || applicationState.endpoint.mode.provider === 'VMWARE_VIC'">
|
||||
<a ui-sref="engine" ui-sref-active="active">Engine <span class="menu-icon fa fa-th fa-fw"></span></a>
|
||||
</li>
|
||||
<li class="sidebar-title" ng-if="!applicationState.application.authentication || isAdmin || isTeamLeader">
|
||||
<span>Portainer settings</span>
|
||||
</li>
|
||||
<li class="sidebar-list" ng-if="applicationState.application.authentication && (isAdmin || isTeamLeader)">
|
||||
<a ui-sref="users" ui-sref-active="active">User management <span class="menu-icon fa fa-users fa-fw"></span></a>
|
||||
<div class="sidebar-sublist" ng-if="toggle && ($state.current.name === 'users' || $state.current.name === 'user' || $state.current.name === 'teams' || $state.current.name === 'team')">
|
||||
<a ui-sref="teams" ui-sref-active="active">Teams</a>
|
||||
</div>
|
||||
</li>
|
||||
<li class="sidebar-list" ng-if="!applicationState.application.authentication || isAdmin">
|
||||
<a ui-sref="endpoints" ui-sref-active="active">Endpoints <span class="menu-icon fa fa-plug fa-fw"></span></a>
|
||||
</li>
|
||||
<li class="sidebar-list" ng-if="!applicationState.application.authentication || isAdmin">
|
||||
<a ui-sref="registries" ui-sref-active="active">Registries <span class="menu-icon fa fa-database fa-fw"></span></a>
|
||||
</li>
|
||||
<li class="sidebar-list" ng-if="!applicationState.application.authentication || isAdmin">
|
||||
<a ui-sref="settings" ui-sref-active="active">Settings <span class="menu-icon fa fa-cogs fa-fw"></span></a>
|
||||
<div class="sidebar-sublist" ng-if="toggle && ($state.current.name === 'settings' || $state.current.name === 'settings_authentication' || $state.current.name === 'settings_about') && applicationState.application.authentication && isAdmin">
|
||||
<a ui-sref="settings_authentication" ui-sref-active="active">Authentication</a></div>
|
||||
<div class="sidebar-sublist" ng-if="toggle && ($state.current.name === 'settings' || $state.current.name === 'settings_authentication' || $state.current.name === 'settings_about')">
|
||||
<a ui-sref="settings_about" ui-sref-active="active">About</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="sidebar-footer-content">
|
||||
<img src="images/logo_small.png" class="img-responsive logo" alt="Portainer">
|
||||
<span class="version">{{ uiVersion }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End Sidebar -->
|
||||
+3
-4
@@ -1,6 +1,6 @@
|
||||
angular.module('portainer')
|
||||
.config(['$stateProvider', '$urlRouterProvider', '$httpProvider', 'localStorageServiceProvider', 'jwtOptionsProvider', 'AnalyticsProvider', '$uibTooltipProvider', '$compileProvider', 'cfpLoadingBarProvider',
|
||||
function ($stateProvider, $urlRouterProvider, $httpProvider, localStorageServiceProvider, jwtOptionsProvider, AnalyticsProvider, $uibTooltipProvider, $compileProvider, cfpLoadingBarProvider) {
|
||||
.config(['$urlRouterProvider', '$httpProvider', 'localStorageServiceProvider', 'jwtOptionsProvider', 'AnalyticsProvider', '$uibTooltipProvider', '$compileProvider', 'cfpLoadingBarProvider',
|
||||
function ($urlRouterProvider, $httpProvider, localStorageServiceProvider, jwtOptionsProvider, AnalyticsProvider, $uibTooltipProvider, $compileProvider, cfpLoadingBarProvider) {
|
||||
'use strict';
|
||||
|
||||
var environment = '@@ENVIRONMENT';
|
||||
@@ -16,7 +16,7 @@ angular.module('portainer')
|
||||
return LocalStorage.getJWT();
|
||||
}],
|
||||
unauthenticatedRedirector: ['$state', function($state) {
|
||||
$state.go('auth', {error: 'Your session has expired'});
|
||||
$state.go('portainer.auth', {error: 'Your session has expired'});
|
||||
}]
|
||||
});
|
||||
$httpProvider.interceptors.push('jwtInterceptor');
|
||||
@@ -37,5 +37,4 @@ angular.module('portainer')
|
||||
cfpLoadingBarProvider.parentSelector = '#loadingbar-placeholder';
|
||||
|
||||
$urlRouterProvider.otherwise('/auth');
|
||||
configureRoutes($stateProvider);
|
||||
}]);
|
||||
|
||||
+2
-1
@@ -11,4 +11,5 @@ angular.module('portainer')
|
||||
.constant('API_ENDPOINT_TEAM_MEMBERSHIPS', 'api/team_memberships')
|
||||
.constant('API_ENDPOINT_TEMPLATES', 'api/templates')
|
||||
.constant('DEFAULT_TEMPLATES_URL', 'https://raw.githubusercontent.com/portainer/templates/master/templates.json')
|
||||
.constant('PAGINATION_MAX_ITEMS', 10);
|
||||
.constant('PAGINATION_MAX_ITEMS', 10)
|
||||
.constant('APPLICATION_CACHE_VALIDITY', 3600);
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
angular.module('portainer').component('porAccessManagement', {
|
||||
templateUrl: 'app/directives/accessManagement/porAccessManagement.html',
|
||||
controller: 'porAccessManagementController',
|
||||
bindings: {
|
||||
accessControlledEntity: '<',
|
||||
updateAccess: '&'
|
||||
}
|
||||
});
|
||||
@@ -1,9 +0,0 @@
|
||||
angular.module('portainer').component('porImageRegistry', {
|
||||
templateUrl: 'app/directives/imageRegistry/porImageRegistry.html',
|
||||
controller: 'porImageRegistryController',
|
||||
bindings: {
|
||||
'image': '=',
|
||||
'registry': '=',
|
||||
'autoComplete': '<'
|
||||
}
|
||||
});
|
||||
@@ -1 +0,0 @@
|
||||
angular.module('ui', []);
|
||||
@@ -0,0 +1,484 @@
|
||||
angular.module('portainer.docker', ['portainer.app'])
|
||||
.config(['$stateRegistryProvider', function ($stateRegistryProvider) {
|
||||
'use strict';
|
||||
|
||||
var docker = {
|
||||
name: 'docker',
|
||||
parent: 'root',
|
||||
abstract: true
|
||||
};
|
||||
|
||||
var configs = {
|
||||
name: 'docker.configs',
|
||||
url: '/configs',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'app/docker/views/configs/configs.html',
|
||||
controller: 'ConfigsController'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var config = {
|
||||
name: 'docker.configs.config',
|
||||
url: '/:id',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'app/docker/views/configs/edit/config.html',
|
||||
controller: 'ConfigController'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var configCreation = {
|
||||
name: 'docker.configs.new',
|
||||
url: '/new',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'app/docker/views/configs/create/createconfig.html',
|
||||
controller: 'CreateConfigController'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var containers = {
|
||||
name: 'docker.containers',
|
||||
url: '/containers',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'app/docker/views/containers/containers.html',
|
||||
controller: 'ContainersController'
|
||||
}
|
||||
},
|
||||
params: {
|
||||
selectedContainers: []
|
||||
}
|
||||
};
|
||||
|
||||
var container = {
|
||||
name: 'docker.containers.container',
|
||||
url: '/:id',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'app/docker/views/containers/edit/container.html',
|
||||
controller: 'ContainerController'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var containerConsole = {
|
||||
name: 'docker.containers.container.console',
|
||||
url: '/console',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'app/docker/views/containers/console/containerconsole.html',
|
||||
controller: 'ContainerConsoleController'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var containerCreation = {
|
||||
name: 'docker.containers.new',
|
||||
url: '/new',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'app/docker/views/containers/create/createcontainer.html',
|
||||
controller: 'CreateContainerController'
|
||||
}
|
||||
},
|
||||
params: {
|
||||
from: ''
|
||||
}
|
||||
};
|
||||
|
||||
var containerInspect = {
|
||||
name: 'docker.containers.container.inspect',
|
||||
url: '/inspect',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'app/docker/views/containers/inspect/containerinspect.html',
|
||||
controller: 'ContainerInspectController'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var containerLogs = {
|
||||
name: 'docker.containers.container.logs',
|
||||
url: '/logs',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'app/docker/views/containers/logs/containerlogs.html',
|
||||
controller: 'ContainerLogsController'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var containerStats = {
|
||||
name: 'docker.containers.container.stats',
|
||||
url: '/stats',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'app/docker/views/containers/stats/containerstats.html',
|
||||
controller: 'ContainerStatsController'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var dashboard = {
|
||||
name: 'docker.dashboard',
|
||||
url: '/dashboard',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'app/docker/views/dashboard/dashboard.html',
|
||||
controller: 'DashboardController'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var engine = {
|
||||
name: 'docker.engine',
|
||||
url: '/engine',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'app/docker/views/engine/engine.html',
|
||||
controller: 'EngineController'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var events = {
|
||||
name: 'docker.events',
|
||||
url: '/events',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'app/docker/views/events/events.html',
|
||||
controller: 'EventsController'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var images = {
|
||||
name: 'docker.images',
|
||||
url: '/images',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'app/docker/views/images/images.html',
|
||||
controller: 'ImagesController'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var image = {
|
||||
name: 'docker.images.image',
|
||||
url: '/:id',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'app/docker/views/images/edit/image.html',
|
||||
controller: 'ImageController'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var networks = {
|
||||
name: 'docker.networks',
|
||||
url: '/networks',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'app/docker/views/networks/networks.html',
|
||||
controller: 'NetworksController'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var network = {
|
||||
name: 'docker.networks.network',
|
||||
url: '/:id',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'app/docker/views/networks/edit/network.html',
|
||||
controller: 'NetworkController'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var networkCreation = {
|
||||
name: 'docker.networks.new',
|
||||
url: '/new',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'app/docker/views/networks/create/createnetwork.html',
|
||||
controller: 'CreateNetworkController'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var nodes = {
|
||||
name: 'docker.nodes',
|
||||
url: '/nodes',
|
||||
abstract: true
|
||||
};
|
||||
|
||||
var node = {
|
||||
name: 'docker.nodes.node',
|
||||
url: '/:id',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'app/docker/views/nodes/edit/node.html',
|
||||
controller: 'NodeController'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var secrets = {
|
||||
name: 'docker.secrets',
|
||||
url: '/secrets',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'app/docker/views/secrets/secrets.html',
|
||||
controller: 'SecretsController'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var secret = {
|
||||
name: 'docker.secrets.secret',
|
||||
url: '/:id',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'app/docker/views/secrets/edit/secret.html',
|
||||
controller: 'SecretController'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var secretCreation = {
|
||||
name: 'docker.secrets.new',
|
||||
url: '/new',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'app/docker/views/secrets/create/createsecret.html',
|
||||
controller: 'CreateSecretController'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var services = {
|
||||
name: 'docker.services',
|
||||
url: '/services',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'app/docker/views/services/services.html',
|
||||
controller: 'ServicesController'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var service = {
|
||||
name: 'docker.services.service',
|
||||
url: '/:id',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'app/docker/views/services/edit/service.html',
|
||||
controller: 'ServiceController'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var serviceCreation = {
|
||||
name: 'docker.services.new',
|
||||
url: '/new',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'app/docker/views/services/create/createservice.html',
|
||||
controller: 'CreateServiceController'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var serviceLogs = {
|
||||
name: 'docker.services.service.logs',
|
||||
url: '/logs',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'app/docker/views/services/logs/servicelogs.html',
|
||||
controller: 'ServiceLogsController'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var stacks = {
|
||||
name: 'docker.stacks',
|
||||
url: '/stacks',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'app/docker/views/stacks/stacks.html',
|
||||
controller: 'StacksController'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var stack = {
|
||||
name: 'docker.stacks.stack',
|
||||
url: '/:id',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'app/docker/views/stacks/edit/stack.html',
|
||||
controller: 'StackController'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var stackCreation = {
|
||||
name: 'docker.stacks.new',
|
||||
url: '/new',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'app/docker/views/stacks/create/createstack.html',
|
||||
controller: 'CreateStackController'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var swarm = {
|
||||
name: 'docker.swarm',
|
||||
url: '/swarm',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'app/docker/views/swarm/swarm.html',
|
||||
controller: 'SwarmController'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var swarmVisualizer = {
|
||||
name: 'docker.swarm.visualizer',
|
||||
url: '/visualizer',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'app/docker/views/swarm/visualizer/swarmvisualizer.html',
|
||||
controller: 'SwarmVisualizerController'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var tasks = {
|
||||
name: 'docker.tasks',
|
||||
url: '/tasks',
|
||||
abstract: true
|
||||
};
|
||||
|
||||
var task = {
|
||||
name: 'docker.tasks.task',
|
||||
url: '/:id',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'app/docker/views/tasks/edit/task.html',
|
||||
controller: 'TaskController'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var templates = {
|
||||
name: 'docker.templates',
|
||||
url: '/templates',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'app/docker/views/templates/templates.html',
|
||||
controller: 'TemplatesController'
|
||||
}
|
||||
},
|
||||
params: {
|
||||
key: 'containers',
|
||||
hide_descriptions: false
|
||||
}
|
||||
};
|
||||
|
||||
var templatesLinuxServer = {
|
||||
name: 'docker.templates.linuxserver',
|
||||
url: '/linuxserver',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'app/docker/views/templates/templates.html',
|
||||
controller: 'TemplatesController'
|
||||
}
|
||||
},
|
||||
params: {
|
||||
key: 'linuxserver.io',
|
||||
hide_descriptions: true
|
||||
}
|
||||
};
|
||||
|
||||
var volumes = {
|
||||
name: 'docker.volumes',
|
||||
url: '/volumes',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'app/docker/views/volumes/volumes.html',
|
||||
controller: 'VolumesController'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var volume = {
|
||||
name: 'docker.volumes.volume',
|
||||
url: '/:id',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'app/docker/views/volumes/edit/volume.html',
|
||||
controller: 'VolumeController'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var volumeCreation = {
|
||||
name: 'docker.volumes.new',
|
||||
url: '/new',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'app/docker/views/volumes/create/createvolume.html',
|
||||
controller: 'CreateVolumeController'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$stateRegistryProvider.register(configs);
|
||||
$stateRegistryProvider.register(config);
|
||||
$stateRegistryProvider.register(configCreation);
|
||||
$stateRegistryProvider.register(containers);
|
||||
$stateRegistryProvider.register(container);
|
||||
$stateRegistryProvider.register(containerConsole);
|
||||
$stateRegistryProvider.register(containerCreation);
|
||||
$stateRegistryProvider.register(containerInspect);
|
||||
$stateRegistryProvider.register(containerLogs);
|
||||
$stateRegistryProvider.register(containerStats);
|
||||
$stateRegistryProvider.register(docker);
|
||||
$stateRegistryProvider.register(dashboard);
|
||||
$stateRegistryProvider.register(engine);
|
||||
$stateRegistryProvider.register(events);
|
||||
$stateRegistryProvider.register(images);
|
||||
$stateRegistryProvider.register(image);
|
||||
$stateRegistryProvider.register(networks);
|
||||
$stateRegistryProvider.register(network);
|
||||
$stateRegistryProvider.register(networkCreation);
|
||||
$stateRegistryProvider.register(nodes);
|
||||
$stateRegistryProvider.register(node);
|
||||
$stateRegistryProvider.register(secrets);
|
||||
$stateRegistryProvider.register(secret);
|
||||
$stateRegistryProvider.register(secretCreation);
|
||||
$stateRegistryProvider.register(services);
|
||||
$stateRegistryProvider.register(service);
|
||||
$stateRegistryProvider.register(serviceCreation);
|
||||
$stateRegistryProvider.register(serviceLogs);
|
||||
$stateRegistryProvider.register(stacks);
|
||||
$stateRegistryProvider.register(stack);
|
||||
$stateRegistryProvider.register(stackCreation);
|
||||
$stateRegistryProvider.register(swarm);
|
||||
$stateRegistryProvider.register(swarmVisualizer);
|
||||
$stateRegistryProvider.register(tasks);
|
||||
$stateRegistryProvider.register(task);
|
||||
$stateRegistryProvider.register(templates);
|
||||
$stateRegistryProvider.register(templatesLinuxServer);
|
||||
$stateRegistryProvider.register(volumes);
|
||||
$stateRegistryProvider.register(volume);
|
||||
$stateRegistryProvider.register(volumeCreation);
|
||||
}]);
|
||||
+3
-3
@@ -16,13 +16,13 @@
|
||||
ng-disabled="$ctrl.state.selectedItemCount === 0" ng-click="$ctrl.removeAction($ctrl.state.selectedItems)">
|
||||
<i class="fa fa-trash space-right" aria-hidden="true"></i>Remove
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-primary" ui-sref="actions.create.config">
|
||||
<button type="button" class="btn btn-sm btn-primary" ui-sref="docker.configs.new">
|
||||
<i class="fa fa-plus space-right" aria-hidden="true"></i>Add config
|
||||
</button>
|
||||
</div>
|
||||
<div class="searchBar" ng-if="$ctrl.state.displayTextFilter">
|
||||
<i class="fa fa-search searchIcon" aria-hidden="true"></i>
|
||||
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" placeholder="Search...">
|
||||
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" placeholder="Search..." auto-focus>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover">
|
||||
@@ -62,7 +62,7 @@
|
||||
<input id="select_{{ $index }}" type="checkbox" ng-model="item.Checked" ng-change="$ctrl.selectItem(item)"/>
|
||||
<label for="select_{{ $index }}"></label>
|
||||
</span>
|
||||
<a ui-sref="config({id: item.Id})">{{ item.Name }}</a>
|
||||
<a ui-sref="docker.configs.config({id: item.Id})">{{ item.Name }}</a>
|
||||
</td>
|
||||
<td>{{ item.CreatedAt | getisodate }}</td>
|
||||
<td ng-if="$ctrl.showOwnershipColumn">
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
angular.module('ui').component('configsDatatable', {
|
||||
templateUrl: 'app/directives/ui/datatables/configs-datatable/configsDatatable.html',
|
||||
angular.module('portainer.docker').component('configsDatatable', {
|
||||
templateUrl: 'app/docker/components/datatables/configs-datatable/configsDatatable.html',
|
||||
controller: 'GenericDatatableController',
|
||||
bindings: {
|
||||
title: '@',
|
||||
+1
-1
@@ -38,7 +38,7 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr dir-paginate="(key, value) in $ctrl.dataset | itemsPerPage: $ctrl.state.paginatedItemLimit" ng-class="{active: item.Checked}">
|
||||
<td><a ui-sref="network({id: value.NetworkID})">{{ key }}</a></td>
|
||||
<td><a ui-sref="docker.networks.network({id: value.NetworkID})">{{ key }}</a></td>
|
||||
<td>{{ value.IPAddress || '-' }}</td>
|
||||
<td>{{ value.Gateway || '-' }}</td>
|
||||
<td>{{ value.MacAddress || '-' }}</td>
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
angular.module('ui').component('containerNetworksDatatable', {
|
||||
templateUrl: 'app/directives/ui/datatables/container-networks-datatable/containerNetworksDatatable.html',
|
||||
angular.module('portainer.docker').component('containerNetworksDatatable', {
|
||||
templateUrl: 'app/docker/components/datatables/container-networks-datatable/containerNetworksDatatable.html',
|
||||
controller: 'GenericDatatableController',
|
||||
bindings: {
|
||||
title: '@',
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
</div>
|
||||
<div class="searchBar" ng-if="$ctrl.state.displayTextFilter">
|
||||
<i class="fa fa-search searchIcon" aria-hidden="true"></i>
|
||||
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" placeholder="Search...">
|
||||
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" placeholder="Search..." auto-focus>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover">
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
angular.module('ui').component('containerProcessesDatatable', {
|
||||
templateUrl: 'app/directives/ui/datatables/container-processes-datatable/containerProcessesDatatable.html',
|
||||
angular.module('portainer.docker').component('containerProcessesDatatable', {
|
||||
templateUrl: 'app/docker/components/datatables/container-processes-datatable/containerProcessesDatatable.html',
|
||||
controller: 'GenericDatatableController',
|
||||
bindings: {
|
||||
title: '@',
|
||||
+9
-9
@@ -82,13 +82,13 @@
|
||||
<i class="fa fa-trash space-right" aria-hidden="true"></i>Remove
|
||||
</button>
|
||||
</div>
|
||||
<button type="button" class="btn btn-sm btn-primary" ui-sref="actions.create.container">
|
||||
<button type="button" class="btn btn-sm btn-primary" ui-sref="docker.containers.new">
|
||||
<i class="fa fa-plus space-right" aria-hidden="true"></i>Add container
|
||||
</button>
|
||||
</div>
|
||||
<div class="searchBar" ng-if="$ctrl.state.displayTextFilter">
|
||||
<i class="fa fa-search searchIcon" aria-hidden="true"></i>
|
||||
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" placeholder="Search...">
|
||||
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" placeholder="Search..." auto-focus>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover table-filters">
|
||||
@@ -186,8 +186,8 @@
|
||||
<input id="select_{{ $index }}" type="checkbox" ng-model="item.Checked" ng-change="$ctrl.selectItem(item)"/>
|
||||
<label for="select_{{ $index }}"></label>
|
||||
</span>
|
||||
<a ui-sref="container({ id: item.Id })" ng-if="!$ctrl.swarmContainers">{{ item | containername | truncate: $ctrl.settings.containerNameTruncateSize }}</a>
|
||||
<a ui-sref="container({ id: item.Id })" ng-if="$ctrl.swarmContainers">{{ item | swarmcontainername | truncate: $ctrl.settings.containerNameTruncateSize }}</a>
|
||||
<a ui-sref="docker.containers.container({ id: item.Id })" ng-if="!$ctrl.swarmContainers">{{ item | containername | truncate: $ctrl.settings.containerNameTruncateSize }}</a>
|
||||
<a ui-sref="docker.containers.container({ id: item.Id })" ng-if="$ctrl.swarmContainers">{{ item | swarmcontainername | truncate: $ctrl.settings.containerNameTruncateSize }}</a>
|
||||
</td>
|
||||
<td>
|
||||
<span ng-if="['starting','healthy','unhealthy'].indexOf(item.Status) !== -1" class="label label-{{ item.Status|containerstatusbadge }} interactive" uib-tooltip="This container has a health check">{{ item.Status }}</span>
|
||||
@@ -195,14 +195,14 @@
|
||||
</td>
|
||||
<td ng-if="$ctrl.settings.showQuickActionStats || $ctrl.settings.showQuickActionLogs || $ctrl.settings.showQuickActionConsole || $ctrl.settings.showQuickActionInspect">
|
||||
<div class="btn-group btn-group-xs" role="group" aria-label="..." style="display:inline-flex;">
|
||||
<a ng-if="$ctrl.settings.showQuickActionStats" style="margin: 0 2.5px;" ui-sref="stats({id: item.Id})"><i class="fa fa-area-chart space-right" aria-hidden="true"></i></a>
|
||||
<a ng-if="$ctrl.settings.showQuickActionLogs" style="margin: 0 2.5px;" ui-sref="containerlogs({id: item.Id})"><i class="fa fa-exclamation-circle space-right" aria-hidden="true"></i></a>
|
||||
<a ng-if="$ctrl.settings.showQuickActionConsole" style="margin: 0 2.5px;" ui-sref="console({id: item.Id})"><i class="fa fa-terminal space-right" aria-hidden="true"></i></a>
|
||||
<a ng-if="$ctrl.settings.showQuickActionInspect" style="margin: 0 2.5px;" ui-sref="inspect({id: item.Id})"><i class="fa fa-info-circle space-right" aria-hidden="true"></i></a>
|
||||
<a ng-if="$ctrl.settings.showQuickActionStats" style="margin: 0 2.5px;" ui-sref="docker.containers.container.stats({id: item.Id})"><i class="fa fa-area-chart space-right" aria-hidden="true"></i></a>
|
||||
<a ng-if="$ctrl.settings.showQuickActionLogs" style="margin: 0 2.5px;" ui-sref="docker.containers.container.logs({id: item.Id})"><i class="fa fa-exclamation-circle space-right" aria-hidden="true"></i></a>
|
||||
<a ng-if="$ctrl.settings.showQuickActionConsole" style="margin: 0 2.5px;" ui-sref="docker.containers.container.console({id: item.Id})"><i class="fa fa-terminal space-right" aria-hidden="true"></i></a>
|
||||
<a ng-if="$ctrl.settings.showQuickActionInspect" style="margin: 0 2.5px;" ui-sref="docker.containers.container.inspect({id: item.Id})"><i class="fa fa-info-circle space-right" aria-hidden="true"></i></a>
|
||||
</div>
|
||||
</td>
|
||||
<td>{{ item.StackName ? item.StackName : '-' }}</td>
|
||||
<td><a ui-sref="image({ id: item.Image })">{{ item.Image | hideshasum }}</a></td>
|
||||
<td><a ui-sref="docker.images.image({ id: item.Image })">{{ item.Image | trimshasum }}</a></td>
|
||||
<td>{{ item.IP ? item.IP : '-' }}</td>
|
||||
<td ng-if="$ctrl.swarmContainers">{{ item.hostIP }}</td>
|
||||
<td>
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
angular.module('ui').component('containersDatatable', {
|
||||
templateUrl: 'app/directives/ui/datatables/containers-datatable/containersDatatable.html',
|
||||
angular.module('portainer.docker').component('containersDatatable', {
|
||||
templateUrl: 'app/docker/components/datatables/containers-datatable/containersDatatable.html',
|
||||
controller: 'ContainersDatatableController',
|
||||
bindings: {
|
||||
title: '@',
|
||||
+28
-9
@@ -1,4 +1,4 @@
|
||||
angular.module('ui')
|
||||
angular.module('portainer.docker')
|
||||
.controller('ContainersDatatableController', ['PaginationService', 'DatatableService',
|
||||
function (PaginationService, DatatableService) {
|
||||
|
||||
@@ -70,16 +70,22 @@ function (PaginationService, DatatableService) {
|
||||
|
||||
for (var i = 0; i < this.dataset.length; i++) {
|
||||
var item = this.dataset[i];
|
||||
if (item.Checked && item.Status === 'paused') {
|
||||
this.state.noPausedItemsSelected = false;
|
||||
} else if (item.Checked && (item.Status === 'stopped' || item.Status === 'created')) {
|
||||
this.state.noStoppedItemsSelected = false;
|
||||
} else if (item.Checked && item.Status === 'running') {
|
||||
this.state.noRunningItemsSelected = false;
|
||||
if (item.Checked) {
|
||||
this.updateSelectionStateBasedOnItemStatus(item);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.updateSelectionStateBasedOnItemStatus = function(item) {
|
||||
if (item.Status === 'paused') {
|
||||
this.state.noPausedItemsSelected = false;
|
||||
} else if (['stopped', 'created'].indexOf(item.Status) !== -1) {
|
||||
this.state.noStoppedItemsSelected = false;
|
||||
} else if (['running', 'healthy', 'unhealthy', 'starting'].indexOf(item.Status) !== -1) {
|
||||
this.state.noRunningItemsSelected = false;
|
||||
}
|
||||
};
|
||||
|
||||
this.changePaginationLimit = function() {
|
||||
PaginationService.setPaginationLimit(this.tableKey, this.state.paginatedItemLimit);
|
||||
};
|
||||
@@ -138,7 +144,20 @@ function (PaginationService, DatatableService) {
|
||||
}
|
||||
availableStateFilters.push({ label: item.Status, display: true });
|
||||
}
|
||||
this.filters.state.values = _.uniqBy(availableStateFilters, 'label');
|
||||
this.filters.state.values = _.uniqBy(availableStateFilters, 'label');
|
||||
};
|
||||
|
||||
this.updateStoredFilters = function(storedFilters) {
|
||||
var datasetFilters = this.filters.state.values;
|
||||
|
||||
for (var i = 0; i < datasetFilters.length; i++) {
|
||||
var filter = datasetFilters[i];
|
||||
existingFilter = _.find(storedFilters, ['label', filter.label]);
|
||||
if (existingFilter && !existingFilter.display) {
|
||||
filter.display = existingFilter.display;
|
||||
this.filters.state.enabled = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.$onInit = function() {
|
||||
@@ -153,7 +172,7 @@ function (PaginationService, DatatableService) {
|
||||
|
||||
var storedFilters = DatatableService.getDataTableFilters(this.tableKey);
|
||||
if (storedFilters !== null) {
|
||||
this.filters = storedFilters;
|
||||
this.updateStoredFilters(storedFilters.state.values);
|
||||
}
|
||||
this.filters.state.open = false;
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
</div>
|
||||
<div class="searchBar" ng-if="$ctrl.state.displayTextFilter">
|
||||
<i class="fa fa-search searchIcon" aria-hidden="true"></i>
|
||||
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" placeholder="Search...">
|
||||
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" placeholder="Search..." auto-focus>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover">
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
angular.module('ui').component('eventsDatatable', {
|
||||
templateUrl: 'app/directives/ui/datatables/events-datatable/eventsDatatable.html',
|
||||
angular.module('portainer.docker').component('eventsDatatable', {
|
||||
templateUrl: 'app/docker/components/datatables/events-datatable/eventsDatatable.html',
|
||||
controller: 'GenericDatatableController',
|
||||
bindings: {
|
||||
title: '@',
|
||||
+2
-2
@@ -28,7 +28,7 @@
|
||||
</div>
|
||||
<div class="searchBar" ng-if="$ctrl.state.displayTextFilter">
|
||||
<i class="fa fa-search searchIcon" aria-hidden="true"></i>
|
||||
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" placeholder="Search...">
|
||||
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" placeholder="Search..." auto-focus>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover table-filters">
|
||||
@@ -99,7 +99,7 @@
|
||||
<input id="select_{{ $index }}" type="checkbox" ng-model="item.Checked" ng-change="$ctrl.selectItem(item)"/>
|
||||
<label for="select_{{ $index }}"></label>
|
||||
</span>
|
||||
<a ui-sref="image({id: item.Id})" class="monospaced">{{ item.Id | truncate:20 }}</a>
|
||||
<a ui-sref="docker.images.image({id: item.Id})" class="monospaced">{{ item.Id | truncate:20 }}</a>
|
||||
<span style="margin-left: 10px;" class="label label-warning image-tag" ng-if="::item.ContainerCount === 0">Unused</span>
|
||||
</td>
|
||||
<td>
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
angular.module('ui').component('imagesDatatable', {
|
||||
templateUrl: 'app/directives/ui/datatables/images-datatable/imagesDatatable.html',
|
||||
angular.module('portainer.docker').component('imagesDatatable', {
|
||||
templateUrl: 'app/docker/components/datatables/images-datatable/imagesDatatable.html',
|
||||
controller: 'ImagesDatatableController',
|
||||
bindings: {
|
||||
title: '@',
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
angular.module('ui')
|
||||
angular.module('portainer.docker')
|
||||
.controller('ImagesDatatableController', ['PaginationService', 'DatatableService',
|
||||
function (PaginationService, DatatableService) {
|
||||
|
||||
+4
-4
@@ -16,13 +16,13 @@
|
||||
ng-disabled="$ctrl.state.selectedItemCount === 0" ng-click="$ctrl.removeAction($ctrl.state.selectedItems)">
|
||||
<i class="fa fa-trash space-right" aria-hidden="true"></i>Remove
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-primary" ui-sref="actions.create.network">
|
||||
<i class="fa fa-plus space-right" aria-hidden="true"></i>Add volume
|
||||
<button type="button" class="btn btn-sm btn-primary" ui-sref="docker.networks.new">
|
||||
<i class="fa fa-plus space-right" aria-hidden="true"></i>Add network
|
||||
</button>
|
||||
</div>
|
||||
<div class="searchBar" ng-if="$ctrl.state.displayTextFilter">
|
||||
<i class="fa fa-search searchIcon" aria-hidden="true"></i>
|
||||
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" placeholder="Search...">
|
||||
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" placeholder="Search..." auto-focus>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover">
|
||||
@@ -97,7 +97,7 @@
|
||||
<input id="select_{{ $index }}" type="checkbox" ng-model="item.Checked" ng-change="$ctrl.selectItem(item)"/>
|
||||
<label for="select_{{ $index }}"></label>
|
||||
</span>
|
||||
<a ui-sref="network({id: item.Id})">{{ item.Name | truncate:40 }}</a>
|
||||
<a ui-sref="docker.networks.network({id: item.Id})" title="{{ item.Name }}">{{ item.Name | truncate:40 }}</a>
|
||||
</td>
|
||||
<td>{{ item.StackName ? item.StackName : '-' }}</td>
|
||||
<td>{{ item.Scope }}</td>
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
angular.module('ui').component('networksDatatable', {
|
||||
templateUrl: 'app/directives/ui/datatables/networks-datatable/networksDatatable.html',
|
||||
angular.module('portainer.docker').component('networksDatatable', {
|
||||
templateUrl: 'app/docker/components/datatables/networks-datatable/networksDatatable.html',
|
||||
controller: 'GenericDatatableController',
|
||||
bindings: {
|
||||
title: '@',
|
||||
+2
-2
@@ -13,7 +13,7 @@
|
||||
</div>
|
||||
<div class="searchBar" ng-if="$ctrl.state.displayTextFilter">
|
||||
<i class="fa fa-search searchIcon" aria-hidden="true"></i>
|
||||
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" placeholder="Search...">
|
||||
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" placeholder="Search..." auto-focus>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover">
|
||||
@@ -58,7 +58,7 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr dir-paginate="item in ($ctrl.state.filteredDataSet = ($ctrl.dataset | filter:$ctrl.state.textFilter | orderBy:$ctrl.state.orderBy:$ctrl.state.reverseOrder | itemsPerPage: $ctrl.state.paginatedItemLimit))" ng-class="{active: item.Checked}">
|
||||
<td><a ui-sref="task({id: item.Id})" class="monospaced">{{ item.Id }}</a></td>
|
||||
<td><a ui-sref="docker.tasks.task({id: item.Id})" class="monospaced">{{ item.Id }}</a></td>
|
||||
<td><span class="label label-{{ item.Status.State | taskstatusbadge }}">{{ item.Status.State }}</span></td>
|
||||
<td>{{ item.Slot ? item.Slot : '-' }}</td>
|
||||
<td>{{ item.Spec.ContainerSpec.Image | hideshasum }}</td>
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
angular.module('ui').component('nodeTasksDatatable', {
|
||||
templateUrl: 'app/directives/ui/datatables/node-tasks-datatable/nodeTasksDatatable.html',
|
||||
angular.module('portainer.docker').component('nodeTasksDatatable', {
|
||||
templateUrl: 'app/docker/components/datatables/node-tasks-datatable/nodeTasksDatatable.html',
|
||||
controller: 'GenericDatatableController',
|
||||
bindings: {
|
||||
title: '@',
|
||||
+2
-2
@@ -13,7 +13,7 @@
|
||||
</div>
|
||||
<div class="searchBar" ng-if="$ctrl.state.displayTextFilter">
|
||||
<i class="fa fa-search searchIcon" aria-hidden="true"></i>
|
||||
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" placeholder="Search...">
|
||||
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" placeholder="Search..." auto-focus>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover">
|
||||
@@ -73,7 +73,7 @@
|
||||
<tbody>
|
||||
<tr dir-paginate="item in ($ctrl.state.filteredDataSet = ($ctrl.dataset | filter:$ctrl.state.textFilter | orderBy:$ctrl.state.orderBy:$ctrl.state.reverseOrder | itemsPerPage: $ctrl.state.paginatedItemLimit))" ng-class="{active: item.Checked}">
|
||||
<td>
|
||||
<a ui-sref="node({id: item.Id})" ng-if="$ctrl.accessToNodeDetails">{{ item.Hostname }}</a>
|
||||
<a ui-sref="docker.nodes.node({id: item.Id})" ng-if="$ctrl.accessToNodeDetails">{{ item.Hostname }}</a>
|
||||
<span ng-if="!$ctrl.accessToNodeDetails">{{ item.Hostname }}</span>
|
||||
</td>
|
||||
<td>{{ item.Role }}</td>
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
angular.module('ui').component('nodesDatatable', {
|
||||
templateUrl: 'app/directives/ui/datatables/nodes-datatable/nodesDatatable.html',
|
||||
angular.module('portainer.docker').component('nodesDatatable', {
|
||||
templateUrl: 'app/docker/components/datatables/nodes-datatable/nodesDatatable.html',
|
||||
controller: 'GenericDatatableController',
|
||||
bindings: {
|
||||
title: '@',
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
</div>
|
||||
<div class="searchBar" ng-if="$ctrl.state.displayTextFilter">
|
||||
<i class="fa fa-search searchIcon" aria-hidden="true"></i>
|
||||
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" placeholder="Search...">
|
||||
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" placeholder="Search..." auto-focus>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover">
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
angular.module('ui').component('nodesSsDatatable', {
|
||||
templateUrl: 'app/directives/ui/datatables/nodes-ss-datatable/nodesSSDatatable.html',
|
||||
angular.module('portainer.docker').component('nodesSsDatatable', {
|
||||
templateUrl: 'app/docker/components/datatables/nodes-ss-datatable/nodesSSDatatable.html',
|
||||
controller: 'GenericDatatableController',
|
||||
bindings: {
|
||||
title: '@',
|
||||
+3
-3
@@ -16,13 +16,13 @@
|
||||
ng-disabled="$ctrl.state.selectedItemCount === 0" ng-click="$ctrl.removeAction($ctrl.state.selectedItems)">
|
||||
<i class="fa fa-trash space-right" aria-hidden="true"></i>Remove
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-primary" ui-sref="actions.create.secret">
|
||||
<button type="button" class="btn btn-sm btn-primary" ui-sref="docker.secrets.new">
|
||||
<i class="fa fa-plus space-right" aria-hidden="true"></i>Add secret
|
||||
</button>
|
||||
</div>
|
||||
<div class="searchBar" ng-if="$ctrl.state.displayTextFilter">
|
||||
<i class="fa fa-search searchIcon" aria-hidden="true"></i>
|
||||
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" placeholder="Search...">
|
||||
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" placeholder="Search..." auto-focus>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover">
|
||||
@@ -62,7 +62,7 @@
|
||||
<input id="select_{{ $index }}" type="checkbox" ng-model="item.Checked" ng-change="$ctrl.selectItem(item)"/>
|
||||
<label for="select_{{ $index }}"></label>
|
||||
</span>
|
||||
<a ui-sref="secret({id: item.Id})">{{ item.Name }}</a>
|
||||
<a ui-sref="docker.secrets.secret({id: item.Id})">{{ item.Name }}</a>
|
||||
</td>
|
||||
<td>{{ item.CreatedAt | getisodate }}</td>
|
||||
<td ng-if="$ctrl.showOwnershipColumn">
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
angular.module('ui').component('secretsDatatable', {
|
||||
templateUrl: 'app/directives/ui/datatables/secrets-datatable/secretsDatatable.html',
|
||||
angular.module('portainer.docker').component('secretsDatatable', {
|
||||
templateUrl: 'app/docker/components/datatables/secrets-datatable/secretsDatatable.html',
|
||||
controller: 'GenericDatatableController',
|
||||
bindings: {
|
||||
title: '@',
|
||||
+14
-8
@@ -12,17 +12,23 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="actionBar">
|
||||
<button type="button" class="btn btn-sm btn-danger"
|
||||
ng-disabled="$ctrl.state.selectedItemCount === 0" ng-click="$ctrl.removeAction($ctrl.state.selectedItems)">
|
||||
<i class="fa fa-trash space-right" aria-hidden="true"></i>Remove
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-primary" ui-sref="actions.create.service">
|
||||
<div class="btn-group" role="group" aria-label="...">
|
||||
<button ng-if="$ctrl.showForceUpdateButton" type="button" class="btn btn-sm btn-primary"
|
||||
ng-disabled="$ctrl.state.selectedItemCount === 0" ng-click="$ctrl.forceUpdateAction($ctrl.state.selectedItems)">
|
||||
<i class="fa fa-refresh space-right" aria-hidden="true"></i>Update
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-danger"
|
||||
ng-disabled="$ctrl.state.selectedItemCount === 0" ng-click="$ctrl.removeAction($ctrl.state.selectedItems)">
|
||||
<i class="fa fa-trash space-right" aria-hidden="true"></i>Remove
|
||||
</button>
|
||||
</div>
|
||||
<button type="button" class="btn btn-sm btn-primary" ui-sref="docker.services.new">
|
||||
<i class="fa fa-plus space-right" aria-hidden="true"></i>Add service
|
||||
</button>
|
||||
</div>
|
||||
<div class="searchBar" ng-if="$ctrl.state.displayTextFilter">
|
||||
<i class="fa fa-search searchIcon" aria-hidden="true"></i>
|
||||
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" placeholder="Search...">
|
||||
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" placeholder="Search..." auto-focus>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover">
|
||||
@@ -90,7 +96,7 @@
|
||||
<input id="select_{{ $index }}" type="checkbox" ng-model="item.Checked" ng-change="$ctrl.selectItem(item)"/>
|
||||
<label for="select_{{ $index }}"></label>
|
||||
</span>
|
||||
<a ui-sref="service({id: item.Id})">{{ item.Name }}</a>
|
||||
<a ui-sref="docker.services.service({id: item.Id})">{{ item.Name }}</a>
|
||||
</td>
|
||||
<td>{{ item.StackName ? item.StackName : '-' }}</td>
|
||||
<td>{{ item.Image | hideshasum }}</td>
|
||||
@@ -102,7 +108,7 @@
|
||||
</a>
|
||||
</span>
|
||||
<span ng-if="item.Mode === 'replicated' && item.Scale">
|
||||
<input class="input-sm" type="number" ng-model="item.Replicas" />
|
||||
<input class="input-sm" type="number" ng-model="item.Replicas" on-enter-key="$ctrl.scaleAction(item)" />
|
||||
<a class="interactive" ng-click="item.Scale = false;"><i class="fa fa-times"></i></a>
|
||||
<a class="interactive" ng-click="$ctrl.scaleAction(item)"><i class="fa fa-check-square-o"></i></a>
|
||||
</span>
|
||||
+5
-3
@@ -1,5 +1,5 @@
|
||||
angular.module('ui').component('servicesDatatable', {
|
||||
templateUrl: 'app/directives/ui/datatables/services-datatable/servicesDatatable.html',
|
||||
angular.module('portainer.docker').component('servicesDatatable', {
|
||||
templateUrl: 'app/docker/components/datatables/services-datatable/servicesDatatable.html',
|
||||
controller: 'GenericDatatableController',
|
||||
bindings: {
|
||||
title: '@',
|
||||
@@ -12,6 +12,8 @@ angular.module('ui').component('servicesDatatable', {
|
||||
showOwnershipColumn: '<',
|
||||
removeAction: '<',
|
||||
scaleAction: '<',
|
||||
swarmManagerIp: '<'
|
||||
swarmManagerIp: '<',
|
||||
forceUpdateAction: '<',
|
||||
showForceUpdateButton: '<'
|
||||
}
|
||||
});
|
||||
+2
-2
@@ -13,7 +13,7 @@
|
||||
</div>
|
||||
<div class="searchBar" ng-if="$ctrl.state.displayTextFilter">
|
||||
<i class="fa fa-search searchIcon" aria-hidden="true"></i>
|
||||
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" placeholder="Search...">
|
||||
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" placeholder="Search..." auto-focus>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover">
|
||||
@@ -58,7 +58,7 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr dir-paginate="item in ($ctrl.state.filteredDataSet = ($ctrl.dataset | filter:$ctrl.state.textFilter | orderBy:$ctrl.state.orderBy:$ctrl.state.reverseOrder | itemsPerPage: $ctrl.state.paginatedItemLimit))" ng-class="{active: item.Checked}">
|
||||
<td><a ui-sref="task({id: item.Id})" class="monospaced">{{ item.Id }}</a></td>
|
||||
<td><a ui-sref="docker.tasks.task({id: item.Id})" class="monospaced">{{ item.Id }}</a></td>
|
||||
<td><span class="label label-{{ item.Status.State | taskstatusbadge }}">{{ item.Status.State }}</span></td>
|
||||
<td ng-if="$ctrl.showSlotColumn">{{ item.Slot ? item.Slot : '-' }}</td>
|
||||
<td>{{ item.NodeId | tasknodename: $ctrl.nodes }}</td>
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
angular.module('ui').component('tasksDatatable', {
|
||||
templateUrl: 'app/directives/ui/datatables/tasks-datatable/tasksDatatable.html',
|
||||
angular.module('portainer.docker').component('tasksDatatable', {
|
||||
templateUrl: 'app/docker/components/datatables/tasks-datatable/tasksDatatable.html',
|
||||
controller: 'GenericDatatableController',
|
||||
bindings: {
|
||||
title: '@',
|
||||
+3
-3
@@ -16,13 +16,13 @@
|
||||
ng-disabled="$ctrl.state.selectedItemCount === 0" ng-click="$ctrl.removeAction($ctrl.state.selectedItems)">
|
||||
<i class="fa fa-trash space-right" aria-hidden="true"></i>Remove
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-primary" ui-sref="actions.create.volume">
|
||||
<button type="button" class="btn btn-sm btn-primary" ui-sref="docker.volumes.new">
|
||||
<i class="fa fa-plus space-right" aria-hidden="true"></i>Add volume
|
||||
</button>
|
||||
</div>
|
||||
<div class="searchBar" ng-if="$ctrl.state.displayTextFilter">
|
||||
<i class="fa fa-search searchIcon" aria-hidden="true"></i>
|
||||
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" placeholder="Search...">
|
||||
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" placeholder="Search..." auto-focus>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover table-filters">
|
||||
@@ -100,7 +100,7 @@
|
||||
<input id="select_{{ $index }}" type="checkbox" ng-model="item.Checked" ng-change="$ctrl.selectItem(item)"/>
|
||||
<label for="select_{{ $index }}"></label>
|
||||
</span>
|
||||
<a ui-sref="volume({id: item.Id})" class="monospaced">{{ item.Id | truncate:25 }}</a>
|
||||
<a ui-sref="docker.volumes.volume({id: item.Id})" class="monospaced">{{ item.Id | truncate:25 }}</a>
|
||||
<span style="margin-left: 10px;" class="label label-warning image-tag" ng-if="item.dangling">Unused</span>
|
||||
</td>
|
||||
<td>{{ item.StackName ? item.StackName : '-' }}</td>
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
angular.module('ui').component('volumesDatatable', {
|
||||
templateUrl: 'app/directives/ui/datatables/volumes-datatable/volumesDatatable.html',
|
||||
angular.module('portainer.docker').component('volumesDatatable', {
|
||||
templateUrl: 'app/docker/components/datatables/volumes-datatable/volumesDatatable.html',
|
||||
controller: 'VolumesDatatableController',
|
||||
bindings: {
|
||||
title: '@',
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
angular.module('ui')
|
||||
angular.module('portainer.docker')
|
||||
.controller('VolumesDatatableController', ['PaginationService', 'DatatableService',
|
||||
function (PaginationService, DatatableService) {
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
angular.module('portainer.docker').component('dockerSidebarContent', {
|
||||
templateUrl: 'app/docker/components/dockerSidebarContent/dockerSidebarContent.html',
|
||||
bindings: {
|
||||
'endpointApiVersion': '<',
|
||||
'swarmManagement': '<',
|
||||
'standaloneManagement': '<',
|
||||
'adminAccess': '<',
|
||||
'externalContributions': '<',
|
||||
'sidebarToggledOn': '<',
|
||||
'currentState': '<'
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,42 @@
|
||||
<li class="sidebar-list">
|
||||
<a ui-sref="docker.dashboard" ui-sref-active="active">Dashboard <span class="menu-icon fa fa-tachometer fa-fw"></span></a>
|
||||
</li>
|
||||
<li class="sidebar-list">
|
||||
<a ui-sref="docker.templates" ui-sref-active="active">App Templates <span class="menu-icon fa fa-rocket fa-fw"></span></a>
|
||||
<div class="sidebar-sublist" ng-if="$ctrl.sidebarToggledOn && $ctrl.externalContributions && ($ctrl.currentState === 'docker.templates' || $ctrl.currentState === 'docker.templates.linuxserver')">
|
||||
<a ui-sref="docker.templates.linuxserver" ui-sref-active="active">LinuxServer.io</a>
|
||||
</div>
|
||||
</li>
|
||||
<li class="sidebar-list" ng-if="$ctrl.endpointApiVersion >= 1.25 && $ctrl.swarmManagement">
|
||||
<a ui-sref="docker.stacks" ui-sref-active="active">Stacks <span class="menu-icon fa fa-th-list fa-fw"></span></a>
|
||||
</li>
|
||||
<li class="sidebar-list" ng-if="$ctrl.swarmManagement">
|
||||
<a ui-sref="docker.services" ui-sref-active="active">Services <span class="menu-icon fa fa-list-alt fa-fw"></span></a>
|
||||
</li>
|
||||
<li class="sidebar-list">
|
||||
<a ui-sref="docker.containers" ui-sref-active="active">Containers <span class="menu-icon fa fa-server fa-fw"></span></a>
|
||||
</li>
|
||||
<li class="sidebar-list">
|
||||
<a ui-sref="docker.images" ui-sref-active="active">Images <span class="menu-icon fa fa-clone fa-fw"></span></a>
|
||||
</li>
|
||||
<li class="sidebar-list">
|
||||
<a ui-sref="docker.networks" ui-sref-active="active">Networks <span class="menu-icon fa fa-sitemap fa-fw"></span></a>
|
||||
</li>
|
||||
<li class="sidebar-list">
|
||||
<a ui-sref="docker.volumes" ui-sref-active="active">Volumes <span class="menu-icon fa fa-cubes fa-fw"></span></a>
|
||||
</li>
|
||||
<li class="sidebar-list" ng-if="$ctrl.endpointApiVersion >= 1.30 && $ctrl.swarmManagement">
|
||||
<a ui-sref="docker.configs" ui-sref-active="active">Configs <span class="menu-icon fa fa-file-code-o fa-fw"></span></a>
|
||||
</li>
|
||||
<li class="sidebar-list" ng-if="$ctrl.endpointApiVersion >= 1.25 && $ctrl.swarmManagement">
|
||||
<a ui-sref="docker.secrets" ui-sref-active="active">Secrets <span class="menu-icon fa fa-user-secret fa-fw"></span></a>
|
||||
</li>
|
||||
<li class="sidebar-list" ng-if="$ctrl.standaloneManagement && $ctrl.adminAccess">
|
||||
<a ui-sref="docker.events" ui-sref-active="active">Events <span class="menu-icon fa fa-history fa-fw"></span></a>
|
||||
</li>
|
||||
<li class="sidebar-list" ng-if="$ctrl.swarmManagement">
|
||||
<a ui-sref="docker.swarm" ui-sref-active="active">Swarm <span class="menu-icon fa fa-object-group fa-fw"></span></a>
|
||||
</li>
|
||||
<li class="sidebar-list" ng-if="$ctrl.standaloneManagement">
|
||||
<a ui-sref="docker.engine" ui-sref-active="active">Engine <span class="menu-icon fa fa-th fa-fw"></span></a>
|
||||
</li>
|
||||
@@ -0,0 +1,9 @@
|
||||
angular.module('portainer.docker').component('porImageRegistry', {
|
||||
templateUrl: 'app/docker/components/imageRegistry/porImageRegistry.html',
|
||||
controller: 'porImageRegistryController',
|
||||
bindings: {
|
||||
'image': '=',
|
||||
'registry': '=',
|
||||
'autoComplete': '<'
|
||||
}
|
||||
});
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
angular.module('portainer')
|
||||
angular.module('portainer.docker')
|
||||
.controller('porImageRegistryController', ['$q', 'RegistryService', 'DockerHubService', 'ImageService', 'Notifications',
|
||||
function ($q, RegistryService, DockerHubService, ImageService, Notifications) {
|
||||
var ctrl = this;
|
||||
@@ -4,39 +4,7 @@ function includeString(text, values) {
|
||||
});
|
||||
}
|
||||
|
||||
angular.module('portainer.filters')
|
||||
.filter('truncate', function () {
|
||||
'use strict';
|
||||
return function (text, length, end) {
|
||||
if (isNaN(length)) {
|
||||
length = 10;
|
||||
}
|
||||
|
||||
if (end === undefined) {
|
||||
end = '...';
|
||||
}
|
||||
|
||||
if (text.length <= length || text.length - end.length <= length) {
|
||||
return text;
|
||||
} else {
|
||||
return String(text).substring(0, length - end.length) + end;
|
||||
}
|
||||
};
|
||||
})
|
||||
.filter('truncatelr', function () {
|
||||
'use strict';
|
||||
return function (text, max, left, right) {
|
||||
max = isNaN(max) ? 50 : max;
|
||||
left = isNaN(left) ? 25 : left;
|
||||
right = isNaN(right) ? 25 : right;
|
||||
|
||||
if (text.length <= max) {
|
||||
return text;
|
||||
} else {
|
||||
return text.substring(0, left) + '[...]' + text.substring(text.length - right, text.length);
|
||||
}
|
||||
};
|
||||
})
|
||||
angular.module('portainer.docker')
|
||||
.filter('visualizerTask', function () {
|
||||
'use strict';
|
||||
return function (text) {
|
||||
@@ -66,7 +34,7 @@ angular.module('portainer.filters')
|
||||
labelStyle = 'primary';
|
||||
} else if (includeString(status, ['running'])) {
|
||||
labelStyle = 'success';
|
||||
}
|
||||
}
|
||||
return labelStyle;
|
||||
};
|
||||
})
|
||||
@@ -124,12 +92,6 @@ angular.module('portainer.filters')
|
||||
return '';
|
||||
};
|
||||
})
|
||||
.filter('capitalize', function () {
|
||||
'use strict';
|
||||
return function (text) {
|
||||
return _.capitalize(text);
|
||||
};
|
||||
})
|
||||
.filter('getstatetext', function () {
|
||||
'use strict';
|
||||
return function (state) {
|
||||
@@ -154,12 +116,6 @@ angular.module('portainer.filters')
|
||||
return 'Stopped';
|
||||
};
|
||||
})
|
||||
.filter('stripprotocol', function() {
|
||||
'use strict';
|
||||
return function (url) {
|
||||
return url.replace(/.*?:\/\//g, '');
|
||||
};
|
||||
})
|
||||
.filter('getstatelabel', function () {
|
||||
'use strict';
|
||||
return function (state) {
|
||||
@@ -175,20 +131,6 @@ angular.module('portainer.filters')
|
||||
return 'label-default';
|
||||
};
|
||||
})
|
||||
.filter('humansize', function () {
|
||||
'use strict';
|
||||
return function (bytes, round, base) {
|
||||
if (!round) {
|
||||
round = 1;
|
||||
}
|
||||
if (!base) {
|
||||
base = 10;
|
||||
}
|
||||
if (bytes || bytes === 0) {
|
||||
return filesize(bytes, {base: base, round: round});
|
||||
}
|
||||
};
|
||||
})
|
||||
.filter('containername', function () {
|
||||
'use strict';
|
||||
return function (container) {
|
||||
@@ -227,18 +169,6 @@ angular.module('portainer.filters')
|
||||
return [];
|
||||
};
|
||||
})
|
||||
.filter('getisodatefromtimestamp', function () {
|
||||
'use strict';
|
||||
return function (timestamp) {
|
||||
return moment.unix(timestamp).format('YYYY-MM-DD HH:mm:ss');
|
||||
};
|
||||
})
|
||||
.filter('getisodate', function () {
|
||||
'use strict';
|
||||
return function (date) {
|
||||
return moment(date).format('YYYY-MM-DD HH:mm:ss');
|
||||
};
|
||||
})
|
||||
.filter('command', function () {
|
||||
'use strict';
|
||||
return function (command) {
|
||||
@@ -247,39 +177,6 @@ angular.module('portainer.filters')
|
||||
}
|
||||
};
|
||||
})
|
||||
.filter('key', function () {
|
||||
'use strict';
|
||||
return function (pair, separator) {
|
||||
return pair.slice(0, pair.indexOf(separator));
|
||||
};
|
||||
})
|
||||
.filter('value', function () {
|
||||
'use strict';
|
||||
return function (pair, separator) {
|
||||
return pair.slice(pair.indexOf(separator) + 1);
|
||||
};
|
||||
})
|
||||
.filter('emptyobject', function () {
|
||||
'use strict';
|
||||
return function (obj) {
|
||||
return _.isEmpty(obj);
|
||||
};
|
||||
})
|
||||
.filter('ipaddress', function () {
|
||||
'use strict';
|
||||
return function (ip) {
|
||||
return ip.slice(0, ip.indexOf('/'));
|
||||
};
|
||||
})
|
||||
.filter('arraytostr', function () {
|
||||
'use strict';
|
||||
return function (arr, separator) {
|
||||
if (arr) {
|
||||
return _.join(arr, separator);
|
||||
}
|
||||
return '';
|
||||
};
|
||||
})
|
||||
.filter('hideshasum', function () {
|
||||
'use strict';
|
||||
return function (imageName) {
|
||||
@@ -289,21 +186,6 @@ angular.module('portainer.filters')
|
||||
return '';
|
||||
};
|
||||
})
|
||||
.filter('ownershipicon', function () {
|
||||
'use strict';
|
||||
return function (ownership) {
|
||||
switch (ownership) {
|
||||
case 'private':
|
||||
return 'fa fa-eye-slash';
|
||||
case 'administrators':
|
||||
return 'fa fa-eye-slash';
|
||||
case 'restricted':
|
||||
return 'fa fa-users';
|
||||
default:
|
||||
return 'fa fa-eye';
|
||||
}
|
||||
};
|
||||
})
|
||||
.filter('availablenodecount', function () {
|
||||
'use strict';
|
||||
return function (nodes) {
|
||||
@@ -345,4 +227,13 @@ angular.module('portainer.filters')
|
||||
return function (createdBy) {
|
||||
return createdBy.replace('/bin/sh -c #(nop) ', '').replace('/bin/sh -c ', 'RUN ');
|
||||
};
|
||||
})
|
||||
.filter('trimshasum', function () {
|
||||
'use strict';
|
||||
return function (imageName) {
|
||||
if (imageName.indexOf('sha256:') === 0) {
|
||||
return imageName.substring(7, 19);
|
||||
}
|
||||
return _.split(imageName, '@sha256')[0];
|
||||
};
|
||||
});
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module('portainer.helpers')
|
||||
angular.module('portainer.docker')
|
||||
.factory('ConfigHelper', [function ConfigHelperFactory() {
|
||||
'use strict';
|
||||
return {
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module('portainer.helpers')
|
||||
angular.module('portainer.docker')
|
||||
.factory('ContainerHelper', [function ContainerHelperFactory() {
|
||||
'use strict';
|
||||
var helper = {};
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module('portainer.helpers')
|
||||
angular.module('portainer.docker')
|
||||
.factory('ImageHelper', [function ImageHelperFactory() {
|
||||
'use strict';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module('portainer.helpers')
|
||||
angular.module('portainer.docker')
|
||||
.factory('InfoHelper', [function InfoHelperFactory() {
|
||||
'use strict';
|
||||
return {
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module('portainer.helpers')
|
||||
angular.module('portainer.docker')
|
||||
.factory('LabelHelper', [function LabelHelperFactory() {
|
||||
'use strict';
|
||||
return {
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module('portainer.helpers')
|
||||
angular.module('portainer.docker')
|
||||
.factory('NodeHelper', [function NodeHelperFactory() {
|
||||
'use strict';
|
||||
return {
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module('portainer.helpers')
|
||||
angular.module('portainer.docker')
|
||||
.factory('SecretHelper', [function SecretHelperFactory() {
|
||||
'use strict';
|
||||
return {
|
||||
@@ -1,4 +1,5 @@
|
||||
angular.module('portainer.helpers').factory('ServiceHelper', [function ServiceHelperFactory() {
|
||||
angular.module('portainer.docker')
|
||||
.factory('ServiceHelper', [function ServiceHelperFactory() {
|
||||
'use strict';
|
||||
|
||||
var helper = {};
|
||||
@@ -141,17 +142,17 @@ angular.module('portainer.helpers').factory('ServiceHelper', [function ServiceHe
|
||||
}
|
||||
};
|
||||
|
||||
helper.translateHumanDurationToNanos = function(humanDuration) {
|
||||
helper.translateHumanDurationToNanos = function(humanDuration) {
|
||||
var nanos;
|
||||
var regex = /^([0-9]+)(h|m|s|ms|us|ns)$/i;
|
||||
var matches = humanDuration.match(regex);
|
||||
|
||||
if (matches !== null && matches.length === 3) {
|
||||
var duration = parseInt(matches[1], 10);
|
||||
var unit = matches[2];
|
||||
var unit = matches[2];
|
||||
// Moment.js cannot use micro or nanoseconds
|
||||
switch (unit) {
|
||||
case 'ns':
|
||||
case 'ns':
|
||||
nanos = duration;
|
||||
break;
|
||||
case 'us':
|
||||
@@ -159,7 +160,7 @@ angular.module('portainer.helpers').factory('ServiceHelper', [function ServiceHe
|
||||
break;
|
||||
default:
|
||||
nanos = moment.duration(duration, unit).asMilliseconds() * 1000000;
|
||||
}
|
||||
}
|
||||
}
|
||||
return nanos;
|
||||
};
|
||||
@@ -171,9 +172,8 @@ angular.module('portainer.helpers').factory('ServiceHelper', [function ServiceHe
|
||||
// e.g 3540000000000 nanoseconds = 59m
|
||||
// e.g 3600000000000 nanoseconds = 1h
|
||||
|
||||
helper.translateNanosToHumanDuration = function(nanos) {
|
||||
helper.translateNanosToHumanDuration = function(nanos) {
|
||||
var humanDuration = '0s';
|
||||
|
||||
var conversionFromNano = {};
|
||||
conversionFromNano['ns'] = 1;
|
||||
conversionFromNano['us'] = conversionFromNano['ns'] * 1000;
|
||||
@@ -181,15 +181,67 @@ angular.module('portainer.helpers').factory('ServiceHelper', [function ServiceHe
|
||||
conversionFromNano['s'] = conversionFromNano['ms'] * 1000;
|
||||
conversionFromNano['m'] = conversionFromNano['s'] * 60;
|
||||
conversionFromNano['h'] = conversionFromNano['m'] * 60;
|
||||
|
||||
Object.keys(conversionFromNano).forEach(function(unit) {
|
||||
|
||||
Object.keys(conversionFromNano).forEach(function(unit) {
|
||||
if ( nanos % conversionFromNano[unit] === 0 && (nanos / conversionFromNano[unit]) > 0) {
|
||||
humanDuration = (nanos / conversionFromNano[unit]) + unit;
|
||||
}
|
||||
});
|
||||
|
||||
return humanDuration;
|
||||
};
|
||||
|
||||
helper.translateLogDriverOptsToKeyValue = function(logOptions) {
|
||||
var options = [];
|
||||
if (logOptions) {
|
||||
Object.keys(logOptions).forEach(function(key) {
|
||||
options.push({
|
||||
key: key,
|
||||
value: logOptions[key],
|
||||
originalKey: key,
|
||||
originalValue: logOptions[key],
|
||||
added: true
|
||||
});
|
||||
});
|
||||
}
|
||||
return options;
|
||||
};
|
||||
|
||||
helper.translateKeyValueToLogDriverOpts = function(keyValueLogDriverOpts) {
|
||||
var options = {};
|
||||
if (keyValueLogDriverOpts) {
|
||||
keyValueLogDriverOpts.forEach(function(option) {
|
||||
if (option.key && option.key !== '' && option.value && option.value !== '') {
|
||||
options[option.key] = option.value;
|
||||
}
|
||||
});
|
||||
}
|
||||
return options;
|
||||
};
|
||||
|
||||
helper.translateHostsEntriesToHostnameIP = function(entries) {
|
||||
var ipHostEntries = [];
|
||||
if (entries) {
|
||||
entries.forEach(function(entry) {
|
||||
if (entry.indexOf(' ') && entry.split(' ').length === 2) {
|
||||
var keyValue = entry.split(' ');
|
||||
ipHostEntries.push({ hostname: keyValue[1], ip: keyValue[0]});
|
||||
}
|
||||
});
|
||||
}
|
||||
return ipHostEntries;
|
||||
};
|
||||
|
||||
helper.translateHostnameIPToHostsEntries = function(entries) {
|
||||
var ipHostEntries = [];
|
||||
if (entries) {
|
||||
entries.forEach(function(entry) {
|
||||
if (entry.ip && entry.hostname) {
|
||||
ipHostEntries.push(entry.ip + ' ' + entry.hostname);
|
||||
}
|
||||
});
|
||||
}
|
||||
return ipHostEntries;
|
||||
};
|
||||
|
||||
return helper;
|
||||
}]);
|
||||
@@ -0,0 +1,30 @@
|
||||
angular.module('portainer.docker')
|
||||
.factory('VolumeHelper', [function VolumeHelperFactory() {
|
||||
'use strict';
|
||||
var helper = {};
|
||||
|
||||
helper.createDriverOptions = function(optionArray) {
|
||||
var options = {};
|
||||
optionArray.forEach(function (option) {
|
||||
options[option.name] = option.value;
|
||||
});
|
||||
return options;
|
||||
};
|
||||
|
||||
helper.isVolumeUsedByAService = function(volume, services) {
|
||||
for (var i = 0; i < services.length; i++) {
|
||||
var service = services[i];
|
||||
var mounts = service.Mounts;
|
||||
for (var j = 0; j < mounts.length; j++) {
|
||||
var mount = mounts[j];
|
||||
if (mount.Source === volume.Id) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
return helper;
|
||||
}]);
|
||||
@@ -34,7 +34,5 @@ function ContainerViewModel(data) {
|
||||
if (data.Portainer.ResourceControl) {
|
||||
this.ResourceControl = new ResourceControlViewModel(data.Portainer.ResourceControl);
|
||||
}
|
||||
} else {
|
||||
this.ResourceControl = { Ownership: 'public' };
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,5 @@ function NetworkViewModel(data) {
|
||||
if (data.Portainer.ResourceControl) {
|
||||
this.ResourceControl = new ResourceControlViewModel(data.Portainer.ResourceControl);
|
||||
}
|
||||
} else {
|
||||
this.ResourceControl = { Ownership: 'public' };
|
||||
}
|
||||
}
|
||||
@@ -41,6 +41,15 @@ function ServiceViewModel(data, runningTasks, allTasks, nodes) {
|
||||
this.RestartMaxAttempts = 0;
|
||||
this.RestartWindow = 0;
|
||||
}
|
||||
|
||||
if (data.Spec.TaskTemplate.LogDriver) {
|
||||
this.LogDriverName = data.Spec.TaskTemplate.LogDriver.Name || '';
|
||||
this.LogDriverOpts = data.Spec.TaskTemplate.LogDriver.Options || [];
|
||||
} else {
|
||||
this.LogDriverName = '';
|
||||
this.LogDriverOpts = [];
|
||||
}
|
||||
|
||||
this.Constraints = data.Spec.TaskTemplate.Placement ? data.Spec.TaskTemplate.Placement.Constraints || [] : [];
|
||||
this.Preferences = data.Spec.TaskTemplate.Placement ? data.Spec.TaskTemplate.Placement.Preferences || [] : [];
|
||||
this.Platforms = data.Spec.TaskTemplate.Placement ? data.Spec.TaskTemplate.Placement.Platforms || [] : [];
|
||||
@@ -2,7 +2,7 @@ function StackViewModel(data) {
|
||||
this.Id = data.Id;
|
||||
this.Name = data.Name;
|
||||
this.Checked = false;
|
||||
this.Env = data.Env;
|
||||
this.Env = data.Env ? data.Env : [];
|
||||
if (data.ResourceControl && data.ResourceControl.Id !== 0) {
|
||||
this.ResourceControl = new ResourceControlViewModel(data.ResourceControl);
|
||||
}
|
||||
@@ -14,7 +14,9 @@ function TemplateViewModel(data) {
|
||||
this.Privileged = data.privileged ? data.privileged : false;
|
||||
this.Interactive = data.interactive ? data.interactive : false;
|
||||
this.RestartPolicy = data.restart_policy ? data.restart_policy : 'always';
|
||||
this.Labels = data.labels ? data.labels : [];
|
||||
this.Volumes = [];
|
||||
|
||||
if (data.volumes) {
|
||||
this.Volumes = data.volumes.map(function (v) {
|
||||
// @DEPRECATED: New volume definition introduced
|
||||
@@ -43,5 +45,5 @@ function TemplateViewModel(data) {
|
||||
};
|
||||
});
|
||||
}
|
||||
this.Hosts = data.hosts ? data.hosts : [];
|
||||
this.Hosts = data.hosts ? data.hosts : [];
|
||||
}
|
||||
@@ -14,7 +14,5 @@ function VolumeViewModel(data) {
|
||||
if (data.Portainer.ResourceControl) {
|
||||
this.ResourceControl = new ResourceControlViewModel(data.Portainer.ResourceControl);
|
||||
}
|
||||
} else {
|
||||
this.ResourceControl = { Ownership: 'public' };
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module('portainer.rest')
|
||||
angular.module('portainer.docker')
|
||||
.factory('Config', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', function ConfigFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||
'use strict';
|
||||
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/configs/:id/:action', {
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module('portainer.rest')
|
||||
angular.module('portainer.docker')
|
||||
.factory('Container', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', function ContainerFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||
'use strict';
|
||||
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/containers/:id/:action', {
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module('portainer.rest')
|
||||
angular.module('portainer.docker')
|
||||
.factory('ContainerCommit', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', function ContainerCommitFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||
'use strict';
|
||||
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/commit', {
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module('portainer.rest')
|
||||
angular.module('portainer.docker')
|
||||
.factory('ContainerLogs', ['$http', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', function ContainerLogsFactory($http, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||
'use strict';
|
||||
return {
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module('portainer.rest')
|
||||
angular.module('portainer.docker')
|
||||
.factory('Exec', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', function ExecFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||
'use strict';
|
||||
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/exec/:id/:action', {
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module('portainer.rest')
|
||||
angular.module('portainer.docker')
|
||||
.factory('Image', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', 'HttpRequestHelper', function ImageFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider, HttpRequestHelper) {
|
||||
'use strict';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module('portainer.rest')
|
||||
angular.module('portainer.docker')
|
||||
.factory('Network', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', function NetworkFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||
'use strict';
|
||||
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/networks/:id/:action', {
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module('portainer.rest')
|
||||
angular.module('portainer.docker')
|
||||
.factory('Node', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', function NodeFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||
'use strict';
|
||||
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/nodes/:id/:action', {
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module('portainer.rest')
|
||||
angular.module('portainer.docker')
|
||||
.factory('Plugin', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', function PluginFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||
'use strict';
|
||||
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/plugins/:id/:action', {
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module('portainer.rest')
|
||||
angular.module('portainer.docker')
|
||||
.factory('Secret', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', function SecretFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||
'use strict';
|
||||
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/secrets/:id/:action', {
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module('portainer.rest')
|
||||
angular.module('portainer.docker')
|
||||
.factory('Service', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', 'HttpRequestHelper' ,function ServiceFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider, HttpRequestHelper) {
|
||||
'use strict';
|
||||
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/services/:id/:action', {
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module('portainer.rest')
|
||||
angular.module('portainer.docker')
|
||||
.factory('ServiceLogs', ['$http', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', function ServiceLogsFactory($http, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||
'use strict';
|
||||
return {
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module('portainer.rest')
|
||||
angular.module('portainer.docker')
|
||||
.factory('Swarm', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', function SwarmFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||
'use strict';
|
||||
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/swarm', {
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module('portainer.rest')
|
||||
angular.module('portainer.docker')
|
||||
.factory('System', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', function SystemFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||
'use strict';
|
||||
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/:action/:subAction', {
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module('portainer.rest')
|
||||
angular.module('portainer.docker')
|
||||
.factory('Task', ['$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider', function TaskFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||
'use strict';
|
||||
return $resource(API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/tasks/:id', {
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user