diff --git a/.travis.yml b/.travis.yml index e6c9d4ba4..5fd1ac82c 100755 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ go_import_path: github.com/opensds/opensds go: - 1.9.x + - 1.11.x - tip env: diff --git a/client/receiver.go b/client/receiver.go index 62d7d2e1a..2829a9358 100755 --- a/client/receiver.go +++ b/client/receiver.go @@ -18,8 +18,10 @@ import ( "encoding/json" "fmt" "io/ioutil" + "log" "net/http" "strings" + "time" "github.com/astaxie/beego/httplib" "github.com/gophercloud/gophercloud" @@ -67,10 +69,19 @@ func NewReceiver() Receiver { func request(url string, method string, headers HeaderOption, input interface{}, output interface{}) error { req := httplib.NewBeegoRequest(url, strings.ToUpper(method)) + // Set the request timeout a little bit longer upload snapshot to cloud temporarily. + req.SetTimeout(time.Minute*6, time.Minute*6) // init body + log.Printf("%s %s\n", strings.ToUpper(method), url) if input != nil { - req.JSONBody(input) + body, err := json.MarshalIndent(input, "", " ") + if err != nil { + return err + } + log.Printf("Request body:\n%s\n", string(body)) + req.Body(body) } + //init header if headers != nil { for k, v := range headers { @@ -87,6 +98,7 @@ func request(url string, method string, headers HeaderOption, input interface{}, return err } + log.Printf("\nStatusCode: %s\nResponse Body:\n%s\n", resp.Status, string(rbody)) if 400 <= resp.StatusCode && resp.StatusCode <= 599 { return NewHttpError(resp.StatusCode, string(rbody)) } diff --git a/cmd/osdsdock/osdsdock.go b/cmd/osdsdock/osdsdock.go index 2d15113fe..acdd642e4 100755 --- a/cmd/osdsdock/osdsdock.go +++ b/cmd/osdsdock/osdsdock.go @@ -30,12 +30,13 @@ import ( func init() { def := GetDefaultConfig() - flag := CONF.Flag + flag := &CONF.Flag flag.StringVar(&CONF.OsdsDock.ApiEndpoint, "api-endpoint", def.OsdsDock.ApiEndpoint, "Listen endpoint of dock service") flag.StringVar(&CONF.OsdsDock.DockType, "dock-type", def.OsdsDock.DockType, "Type of dock service") flag.StringVar(&CONF.Database.Endpoint, "db-endpoint", def.Database.Endpoint, "Connection endpoint of database service") flag.StringVar(&CONF.Database.Driver, "db-driver", def.Database.Driver, "Driver name of database service") // flag.StringVar(&CONF.Database.Credential, "db-credential", def.Database.Credential, "Connection credential of database service") + flag.DurationVar(&CONF.OsdsDock.LogFlushFrequency, "log-flush-frequency", def.OsdsLet.LogFlushFrequency, "Maximum number of seconds between log flushes") daemon.SetDaemonFlag(&CONF.OsdsDock.Daemon, def.OsdsDock.Daemon) CONF.Load("/etc/opensds/opensds.conf") daemon.CheckAndRunDaemon(CONF.OsdsDock.Daemon) @@ -43,7 +44,7 @@ func init() { func main() { // Open OpenSDS dock service log file. - logs.InitLogs() + logs.InitLogs(CONF.OsdsDock.LogFlushFrequency) defer logs.FlushLogs() // Set up database session. diff --git a/cmd/osdslet/osdslet.go b/cmd/osdslet/osdslet.go index 429a21e8b..f5cc15a9c 100755 --- a/cmd/osdslet/osdslet.go +++ b/cmd/osdslet/osdslet.go @@ -30,11 +30,12 @@ import ( func init() { def := GetDefaultConfig() - flag := CONF.Flag + flag := &CONF.Flag flag.StringVar(&CONF.OsdsLet.ApiEndpoint, "api-endpoint", def.OsdsLet.ApiEndpoint, "Listen endpoint of controller service") flag.StringVar(&CONF.Database.Endpoint, "db-endpoint", def.Database.Endpoint, "Connection endpoint of database service") flag.StringVar(&CONF.Database.Driver, "db-driver", def.Database.Driver, "Driver name of database service") flag.StringVar(&CONF.Database.Credential, "db-credential", def.Database.Credential, "Connection credential of database service") + flag.DurationVar(&CONF.OsdsLet.LogFlushFrequency, "log-flush-frequency", def.OsdsLet.LogFlushFrequency, "Maximum number of seconds between log flushes") daemon.SetDaemonFlag(&CONF.OsdsLet.Daemon, def.OsdsLet.Daemon) CONF.Load("/etc/opensds/opensds.conf") daemon.CheckAndRunDaemon(CONF.OsdsLet.Daemon) @@ -42,7 +43,7 @@ func init() { func main() { // Open OpenSDS orchestrator service log file. - logs.InitLogs() + logs.InitLogs(CONF.OsdsLet.LogFlushFrequency) defer logs.FlushLogs() // Set up database session. diff --git a/contrib/backup/driver.go b/contrib/backup/driver.go index c5007f463..546b7e0df 100644 --- a/contrib/backup/driver.go +++ b/contrib/backup/driver.go @@ -28,7 +28,7 @@ type BackupSpec struct { type BackupDriver interface { SetUp() error Backup(backup *BackupSpec, volumeFile *os.File) error - Restore(backup *BackupSpec, volId string, volFile *os.File) error + Restore(backup *BackupSpec, backupId string, volFile *os.File) error Delete(backup *BackupSpec) error CleanUp() error } diff --git a/contrib/backup/multicloud/client.go b/contrib/backup/multicloud/client.go index 8119d29ec..fb2c5520d 100644 --- a/contrib/backup/multicloud/client.go +++ b/contrib/backup/multicloud/client.go @@ -25,6 +25,7 @@ import ( "github.com/astaxie/beego/httplib" log "github.com/golang/glog" + "io/ioutil" ) const ( @@ -101,12 +102,13 @@ func (c *Client) doRequest(method, u string, in interface{}, cb ReqSettingCB) ([ return nil, nil, err } - log.Errorf("%s: %s OK\n", method, u) - b, err := req.Bytes() + log.V(5).Infof("%s: %s OK\n", method, u) + rbody, err := ioutil.ReadAll(resp.Body) if err != nil { log.Errorf("Get byte[] from response failed, method: %s\n url: %s\n error: %v", method, u, err) + return nil, nil, err } - return b, resp.Header, nil + return rbody, resp.Header, nil } func (c *Client) request(method, p string, in, out interface{}, cb ReqSettingCB) error { @@ -251,3 +253,30 @@ func (c *Client) AbortMultipartUpload(bucketName, objectKey string) error { //} return nil } + +func (c *Client) DownloadPart(bucketName, objectKey string, offset, size int64) ([]byte, error) { + p := path.Join("s3", bucketName, objectKey) + + reqSettingCB := func(req *httplib.BeegoHTTPRequest) error { + rangeStr := fmt.Sprintf("bytes:%d-%d", offset, offset+size-1) + req.Header("Range", rangeStr) + req.SetTimeout(c.uploadTimeout, c.uploadTimeout) + return nil + } + + u, err := url.Parse(p) + if err != nil { + return nil, err + } + base, err := url.Parse(c.baseURL) + if err != nil { + return nil, err + } + + fullUrl := base.ResolveReference(u) + body, _, err := c.doRequest("GET", fullUrl.String(), nil, reqSettingCB) + if err != nil { + return nil, err + } + return body, nil +} diff --git a/contrib/backup/multicloud/driver.go b/contrib/backup/multicloud/driver.go index 409e1cb52..b6394142f 100644 --- a/contrib/backup/multicloud/driver.go +++ b/contrib/backup/multicloud/driver.go @@ -15,6 +15,7 @@ package multicloud import ( + "errors" "io" "io/ioutil" "os" @@ -25,8 +26,8 @@ import ( ) const ( - ConfFile = "/etc/opensds/driver/multi-cloud.yaml" - UploadChunkSize = 1024 * 1024 * 50 + ConfFile = "/etc/opensds/driver/multi-cloud.yaml" + ChunkSize = 1024 * 1024 * 50 ) func init() { @@ -89,10 +90,13 @@ func (m *MultiCloud) CleanUp() error { } func (m *MultiCloud) Backup(backup *backup.BackupSpec, volFile *os.File) error { - buf := make([]byte, UploadChunkSize) + buf := make([]byte, ChunkSize) input := &CompleteMultipartUpload{} - bucket := backup.Metadata["bucket"] + bucket, ok := backup.Metadata["bucket"] + if !ok { + return errors.New("can't find bucket in metadata") + } key := backup.Id initResp, err := m.client.InitMultiPartUpload(bucket, key) if err != nil { @@ -132,10 +136,39 @@ func (m *MultiCloud) Backup(backup *backup.BackupSpec, volFile *os.File) error { return nil } -func (m *MultiCloud) Restore(backup *backup.BackupSpec, volId string, volFile *os.File) error { +func (m *MultiCloud) Restore(backup *backup.BackupSpec, backupId string, volFile *os.File) error { + bucket, ok := backup.Metadata["bucket"] + if !ok { + return errors.New("can't find bucket in metadata") + } + var downloadSize = ChunkSize + // if the size of data of smaller than require download size + // downloading is completed. + for offset := int64(0); downloadSize == ChunkSize; offset += ChunkSize { + data, err := m.client.DownloadPart(bucket, backupId, offset, ChunkSize) + if err != nil { + glog.Errorf("download part failed: %v", err) + return err + } + downloadSize = len(data) + glog.V(5).Infof("download size: %d\n", downloadSize) + volFile.Seek(offset, 0) + size, err := volFile.Write(data) + if err != nil { + glog.Errorf("write part failed: %v", err) + return err + } + if size != downloadSize { + return errors.New("size not equal to download size") + } + glog.V(5).Infof("write buf size len:%d", size) + } + glog.Infof("restore success ...") return nil } func (m *MultiCloud) Delete(backup *backup.BackupSpec) error { - return nil + bucket := backup.Metadata["bucket"] + key := backup.Id + return m.client.RemoveObject(bucket, key) } diff --git a/contrib/cindercompatibleapi/main.go b/contrib/cindercompatibleapi/main.go index 52d76933e..e12a8488b 100644 --- a/contrib/cindercompatibleapi/main.go +++ b/contrib/cindercompatibleapi/main.go @@ -23,6 +23,7 @@ import ( "flag" "fmt" "os" + "time" "github.com/opensds/opensds/contrib/cindercompatibleapi/api" "github.com/opensds/opensds/pkg/utils/logs" @@ -30,7 +31,7 @@ import ( func main() { flag.Parse() - logs.InitLogs() + logs.InitLogs(5 * time.Second) defer logs.FlushLogs() cinderEndpoint, ok := os.LookupEnv("CINDER_ENDPOINT") diff --git a/contrib/connector/common.go b/contrib/connector/common.go new file mode 100644 index 000000000..bdefb0a25 --- /dev/null +++ b/contrib/connector/common.go @@ -0,0 +1,156 @@ +// Copyright (c) 2018 Huawei Technologies Co., Ltd. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package connector + +import ( + "log" + "net" + "os/exec" + "strings" +) + +// InitiatorInfo implementation +type InitiatorInfo struct { + HostName string `json:"hostName"` + InitiatorData map[string]interface{} `json:"initiatorData"` +} + +// ExecCmd Log and convert the result of exec.Command +func ExecCmd(name string, arg ...string) (string, error) { + log.Printf("Command: %s %s:\n", name, strings.Join(arg, " ")) + info, err := exec.Command(name, arg...).CombinedOutput() + return string(info), err +} + +// GetFSType returns the File System Type of device +func GetFSType(device string) string { + fsType := "" + res, err := ExecCmd("blkid", device) + if err != nil { + log.Printf("failed to GetFSType: %v", err) + return fsType + } + + if strings.Contains(string(res), "TYPE=") { + for _, v := range strings.Split(string(res), " ") { + if strings.Contains(v, "TYPE=") { + fsType = strings.Split(v, "=")[1] + fsType = strings.Replace(fsType, "\"", "", -1) + fsType = strings.Replace(fsType, "\n", "", -1) + fsType = strings.Replace(fsType, "\r", "", -1) + } + } + } + return fsType +} + +// Format device by File System Type +func Format(device string, fstype string) error { + log.Printf("Format device: %s fstype: %s", device, fstype) + + // Get current File System Type + curFSType := GetFSType(device) + if curFSType == "" { + // Default File Sysem Type is ext4 + if fstype == "" { + fstype = "ext4" + } + _, err := ExecCmd("mkfs", "-t", fstype, "-F", device) + if err != nil { + log.Printf("failed to Format: %v", err) + return err + } + } else { + log.Printf("Device: %s has been formatted yet. fsType: %s", device, curFSType) + } + return nil +} + +// Mount device into mount point +func Mount(device string, mountpoint string) error { + log.Printf("Mount device: %s mountpoint: %s", device, mountpoint) + + _, err := ExecCmd("mkdir", "-p", mountpoint) + if err != nil { + log.Printf("failed to mkdir: %v", err) + } + _, err = ExecCmd("mount", device, mountpoint) + if err != nil { + log.Printf("failed to mount: %v", err) + return err + } + return nil +} + +// FormatAndMount device +func FormatAndMount(device string, fstype string, mountpoint string) error { + log.Printf("FormatandMount device: %s fstype: %s mountpoint: %s", device, fstype, mountpoint) + + // Format + err := Format(device, fstype) + if err != nil { + return err + } + + // Mount + err = Mount(device, mountpoint) + if err != nil { + return err + } + + return nil +} + +// Umount from mountpoint +func Umount(mountpoint string) error { + log.Printf("Umount mountpoint: %s", mountpoint) + + _, err := ExecCmd("umount", mountpoint) + if err != nil { + log.Printf("failed to Umount: %v", err) + return err + } + return nil +} + +// GetHostIp return Host IP +func GetHostIp() string { + addrs, err := net.InterfaceAddrs() + if err != nil { + return "127.0.0.1" + } + + for _, address := range addrs { + if ipnet, ok := address.(*net.IPNet); ok && !ipnet.IP.IsLoopback() { + return ipnet.IP.String() + } + } + + return "127.0.0.1" +} + +// GetHostName return Host Name +func GetHostName() (string, error) { + hostName, err := ExecCmd("hostname") + if err != nil { + log.Printf("failed to get hostname: %v", err) + return "", err + } + + hostName = strings.Replace(hostName, "\n", "", -1) + log.Printf("GetHostName result: %v", hostName) + + return hostName, nil +} diff --git a/contrib/connector/connector.go b/contrib/connector/connector.go index 363d741b4..d7c4aed4f 100644 --- a/contrib/connector/connector.go +++ b/contrib/connector/connector.go @@ -16,32 +16,52 @@ package connector import ( "fmt" + "log" ) +const ( + FcDriver = "fibre_channel" + PortName = "port_name" + NodeName = "node_name" + Wwpn = "wwpn" + Wwnn = "wwnn" + + IscsiDriver = "iscsi" + Iqn = "iqn" + + RbdDriver = "rbd" +) + +// Connector implementation type Connector interface { Attach(map[string]interface{}) (string, error) Detach(map[string]interface{}) error + GetInitiatorInfo() (InitiatorInfo, error) } +// NewConnector implementation func NewConnector(cType string) Connector { if cnt, exist := cnts[cType]; exist { return cnt } + log.Printf("%s is not registered to connector", cType) return nil } var cnts = map[string]Connector{} +// RegisterConnector implementation func RegisterConnector(cType string, cnt Connector) error { if _, exist := cnts[cType]; exist { - return fmt.Errorf("Connector %s already exist.", cType) + return fmt.Errorf("Connector %s already exist", cType) } cnts[cType] = cnt return nil } +// UnregisterConnector implementation func UnregisterConnector(cType string) { if _, exist := cnts[cType]; !exist { return diff --git a/contrib/connector/fc/fc.go b/contrib/connector/fc/fc.go index ca5c46d49..c8ee66a31 100644 --- a/contrib/connector/fc/fc.go +++ b/contrib/connector/fc/fc.go @@ -18,16 +18,12 @@ import ( "github.com/opensds/opensds/contrib/connector" ) -const ( - fcDriver = "fibre_channel" -) - type FC struct { self *fibreChannel } func init() { - connector.RegisterConnector(fcDriver, + connector.RegisterConnector(connector.FcDriver, &FC{ self: &fibreChannel{ helper: &linuxfc{}, @@ -46,3 +42,8 @@ func (f *FC) Attach(conn map[string]interface{}) (string, error) { func (f *FC) Detach(conn map[string]interface{}) error { return f.self.disconnectVolume(conn) } + +// GetInitiatorInfo implementation +func (f *FC) GetInitiatorInfo() (connector.InitiatorInfo, error) { + return f.self.getInitiatorInfo() +} diff --git a/contrib/connector/fc/fibreChannel.go b/contrib/connector/fc/fibreChannel.go index fb87c714b..ecc0c272b 100644 --- a/contrib/connector/fc/fibreChannel.go +++ b/contrib/connector/fc/fibreChannel.go @@ -23,6 +23,7 @@ import ( "time" "github.com/mitchellh/mapstructure" + "github.com/opensds/opensds/contrib/connector" ) type FCConnectorInfo struct { @@ -215,3 +216,41 @@ func (f *fibreChannel) getFChbasInfo() ([]map[string]string, error) { return hbasInfos, nil } + +func (f *fibreChannel) getInitiatorInfo() (connector.InitiatorInfo, error) { + var initiatorInfo connector.InitiatorInfo + + hbas, err := f.getFChbasInfo() + if err != nil { + log.Printf("getFChbasInfo failed: %v", err.Error()) + return initiatorInfo, err + } + + var wwpns []string + var wwnns []string + + for _, hba := range hbas { + if v, ok := hba[connector.PortName]; ok { + wwpns = append(wwpns, v) + } + + if v, ok := hba[connector.NodeName]; ok { + wwnns = append(wwnns, v) + } + } + + initiatorInfo.InitiatorData = make(map[string]interface{}) + initiatorInfo.InitiatorData[connector.Wwpn] = wwpns + initiatorInfo.InitiatorData[connector.Wwnn] = wwnns + + hostName, err := connector.GetHostName() + if err != nil { + return initiatorInfo, err + } + + initiatorInfo.HostName = hostName + log.Printf("getFChbasInfo success: protocol=%v, initiatorInfo=%v", + connector.FcDriver, initiatorInfo) + + return initiatorInfo, nil +} diff --git a/contrib/connector/iscsi/helper.go b/contrib/connector/iscsi/helper.go index 0262d61a5..d5734f1d4 100644 --- a/contrib/connector/iscsi/helper.go +++ b/contrib/connector/iscsi/helper.go @@ -17,15 +17,14 @@ package iscsi import ( "errors" "log" - "net" "os" - "os/exec" "path/filepath" "strconv" "strings" "time" "github.com/mitchellh/mapstructure" + "github.com/opensds/opensds/contrib/connector" ) // IscsiConnectorInfo define @@ -101,7 +100,7 @@ func waitForPathToExistInternal(devicePath *string, maxRetries int, deviceTransp // GetInitiator returns all the ISCSI Initiator Name func GetInitiator() ([]string, error) { - res, err := execCmd("cat", "/etc/iscsi/initiatorname.iscsi") + res, err := connector.ExecCmd("cat", "/etc/iscsi/initiatorname.iscsi") iqns := []string{} if err != nil { log.Printf("Error encountered gathering initiator names: %v", err) @@ -122,14 +121,14 @@ func GetInitiator() ([]string, error) { // Login ISCSI Target func SetAuth(portal string, targetiqn string, name string, passwd string) error { // Set UserName - info, err := execCmd("iscsiadm", "-m", "node", "-p", portal, "-T", targetiqn, + info, err := connector.ExecCmd("iscsiadm", "-m", "node", "-p", portal, "-T", targetiqn, "--op=update", "--name", "node.session.auth.username", "--value", name) if err != nil { log.Fatalf("Received error on set income username: %v, %v", err, info) return err } // Set Password - info, err = execCmd("iscsiadm", "-m", "node", "-p", portal, "-T", targetiqn, + info, err = connector.ExecCmd("iscsiadm", "-m", "node", "-p", portal, "-T", targetiqn, "--op=update", "--name", "node.session.auth.password", "--value", passwd) if err != nil { log.Fatalf("Received error on set income password: %v, %v", err, info) @@ -140,7 +139,7 @@ func SetAuth(portal string, targetiqn string, name string, passwd string) error // Discovery ISCSI Target func Discovery(portal string) error { - info, err := execCmd("iscsiadm", "-m", "discovery", "-t", "sendtargets", "-p", portal) + info, err := connector.ExecCmd("iscsiadm", "-m", "discovery", "-t", "sendtargets", "-p", portal) if err != nil { log.Println("Error encountered in sendtargets:", string(info), err) return err @@ -150,7 +149,7 @@ func Discovery(portal string) error { // Login ISCSI Target func Login(portal string, targetiqn string) error { - info, err := execCmd("iscsiadm", "-m", "node", "-p", portal, "-T", targetiqn, "--login") + info, err := connector.ExecCmd("iscsiadm", "-m", "node", "-p", portal, "-T", targetiqn, "--login") if err != nil { log.Println("Received error on login attempt:", string(info), err) return err @@ -160,7 +159,7 @@ func Login(portal string, targetiqn string) error { // Logout ISCSI Target func Logout(portal string, targetiqn string) error { - info, err := execCmd("iscsiadm", "-m", "node", "-p", portal, "-T", targetiqn, "--logout") + info, err := connector.ExecCmd("iscsiadm", "-m", "node", "-p", portal, "-T", targetiqn, "--logout") if err != nil { log.Println("Received error on logout attempt:", string(info), err) return err @@ -170,7 +169,7 @@ func Logout(portal string, targetiqn string) error { // Delete ISCSI Node func Delete(targetiqn string) error { - info, err := execCmd("iscsiadm", "-m", "node", "-o", "delete", "-T", targetiqn) + info, err := connector.ExecCmd("iscsiadm", "-m", "node", "-o", "delete", "-T", targetiqn) if err != nil { log.Println("Received error on Delete attempt:", string(info), err) return err @@ -221,7 +220,7 @@ func Connect(connMap map[string]interface{}) (string, error) { } func sessionExists(portal string, tgtIqn string) bool { - info, err := execCmd("iscsiadm", "-m", "session", "-s") + info, err := connector.ExecCmd("iscsiadm", "-m", "session", "-s") if err != nil { log.Println("Warning: get session failed,", string(info)) return false @@ -236,7 +235,7 @@ func sessionExists(portal string, tgtIqn string) bool { } func recordExists(portal string, tgtIqn string) bool { - _, err := execCmd("iscsiadm", "-m", "node", "-o", "show", + _, err := connector.ExecCmd("iscsiadm", "-m", "node", "-o", "show", "-T", tgtIqn, "-p", portal) return err == nil } @@ -256,95 +255,6 @@ func Disconnect(portal string, targetiqn string) error { return nil } -// GetFSType returns the File System Type of device -func GetFSType(device string) string { - fsType := "" - res, err := execCmd("blkid", device) - if err != nil { - log.Printf("failed to GetFSType: %v", err) - return fsType - } - - if strings.Contains(string(res), "TYPE=") { - for _, v := range strings.Split(string(res), " ") { - if strings.Contains(v, "TYPE=") { - fsType = strings.Split(v, "=")[1] - fsType = strings.Replace(fsType, "\"", "", -1) - } - } - } - return fsType -} - -// Format device by File System Type -func Format(device string, fstype string) error { - log.Printf("Format device: %s fstype: %s", device, fstype) - - // Get current File System Type - curFSType := GetFSType(device) - if curFSType == "" { - // Default File Sysem Type is ext4 - if fstype == "" { - fstype = "ext4" - } - _, err := execCmd("mkfs", "-t", fstype, "-F", device) - if err != nil { - log.Printf("failed to Format: %v", err) - return err - } - } else { - log.Printf("Device: %s has been formatted yet. fsType: %s", device, curFSType) - } - return nil -} - -// Mount device into mount point -func Mount(device string, mountpoint string) error { - log.Printf("Mount device: %s mountpoint: %s", device, mountpoint) - - _, err := execCmd("mkdir", "-p", mountpoint) - if err != nil { - log.Printf("failed to mkdir: %v", err) - } - _, err = execCmd("mount", device, mountpoint) - if err != nil { - log.Printf("failed to mount: %v", err) - return err - } - return nil -} - -// FormatAndMount device -func FormatAndMount(device string, fstype string, mountpoint string) error { - log.Printf("FormatandMount device: %s fstype: %s mountpoint: %s", device, fstype, mountpoint) - - // Format - err := Format(device, fstype) - if err != nil { - return err - } - - // Mount - err = Mount(device, mountpoint) - if err != nil { - return err - } - - return nil -} - -// Umount from mountpoint -func Umount(mountpoint string) error { - log.Printf("Umount mountpoint: %s", mountpoint) - - _, err := execCmd("umount", mountpoint) - if err != nil { - log.Printf("failed to Umount: %v", err) - return err - } - return nil -} - // ParseIscsiConnectInfo decode func ParseIscsiConnectInfo(connectInfo map[string]interface{}) *IscsiConnectorInfo { var con IscsiConnectorInfo @@ -352,24 +262,30 @@ func ParseIscsiConnectInfo(connectInfo map[string]interface{}) *IscsiConnectorIn return &con } -// GetHostIp return Host IP -func GetHostIp() string { - addrs, err := net.InterfaceAddrs() +// getInitiatorInfo implementation +func getInitiatorInfo() (connector.InitiatorInfo, error) { + var initiatorInfo connector.InitiatorInfo + + initiators, err := GetInitiator() if err != nil { - return "127.0.0.1" + return initiatorInfo, err } - for _, address := range addrs { - if ipnet, ok := address.(*net.IPNet); ok && !ipnet.IP.IsLoopback() { - return ipnet.IP.String() - } + if len(initiators) == 0 { + return initiatorInfo, errors.New("The number of iqn is wrong") } - return "127.0.0.1" -} + initiatorInfo.InitiatorData = make(map[string]interface{}) + initiatorInfo.InitiatorData[connector.Iqn] = initiators[0] + + hostName, err := connector.GetHostName() + if err != nil { + return initiatorInfo, err + } + + initiatorInfo.HostName = hostName + log.Printf("getInitiatorInfo success: protocol=%v, initiatorInfo=%v", + connector.IscsiDriver, initiatorInfo) -func execCmd(name string, arg ...string) (string, error) { - log.Printf("Command: %s %s:\n", name, strings.Join(arg, " ")) - info, err := exec.Command(name, arg...).CombinedOutput() - return string(info), err + return initiatorInfo, nil } diff --git a/contrib/connector/iscsi/iscsi.go b/contrib/connector/iscsi/iscsi.go index bae2faf73..0e899c3ea 100644 --- a/contrib/connector/iscsi/iscsi.go +++ b/contrib/connector/iscsi/iscsi.go @@ -18,14 +18,10 @@ import ( "github.com/opensds/opensds/contrib/connector" ) -const ( - iscsiDriver = "iscsi" -) - type Iscsi struct{} func init() { - connector.RegisterConnector(iscsiDriver, &Iscsi{}) + connector.RegisterConnector(connector.IscsiDriver, &Iscsi{}) } func (isc *Iscsi) Attach(conn map[string]interface{}) (string, error) { @@ -37,3 +33,8 @@ func (isc *Iscsi) Detach(conn map[string]interface{}) error { return Disconnect(iscsiCon.TgtPortal, iscsiCon.TgtIQN) } + +// GetInitiatorInfo implementation +func (isc *Iscsi) GetInitiatorInfo() (connector.InitiatorInfo, error) { + return getInitiatorInfo() +} diff --git a/contrib/connector/rbd/rbd.go b/contrib/connector/rbd/rbd.go index d37089698..a7b939e5e 100644 --- a/contrib/connector/rbd/rbd.go +++ b/contrib/connector/rbd/rbd.go @@ -27,10 +27,6 @@ import ( "github.com/opensds/opensds/contrib/connector" ) -const ( - rbdDriver = "rbd" -) - var ( rbdBusPath = "/sys/bus/rbd" rbdDevicePath = path.Join(rbdBusPath, "devices") @@ -42,7 +38,7 @@ type RBD struct{} var _ connector.Connector = &RBD{} func init() { - connector.RegisterConnector(rbdDriver, &RBD{}) + connector.RegisterConnector(connector.RbdDriver, &RBD{}) } func (*RBD) Attach(conn map[string]interface{}) (string, error) { @@ -96,6 +92,20 @@ func (*RBD) Detach(conn map[string]interface{}) error { return err } +// GetInitiatorInfo implementation +func (*RBD) GetInitiatorInfo() (connector.InitiatorInfo, error) { + var initiatorInfo connector.InitiatorInfo + hostName, err := connector.GetHostName() + + if err != nil { + return initiatorInfo, err + } + + initiatorInfo.HostName = hostName + + return initiatorInfo, nil +} + func mapDevice(poolName, imageName string, hosts, ports []interface{}) (string, error) { devName, err := findDevice(poolName, imageName, 1) if err == nil { diff --git a/contrib/drivers/huawei/dorado/dorado.go b/contrib/drivers/huawei/dorado/dorado.go index 717fb1b6e..45da19746 100644 --- a/contrib/drivers/huawei/dorado/dorado.go +++ b/contrib/drivers/huawei/dorado/dorado.go @@ -74,23 +74,29 @@ func (d *Driver) createVolumeFromSnapshot(opt *pb.CreateVolumeOpts) (*model.Volu return nil, err1 } - lun, err := d.client.CreateVolume(opt.GetName(), opt.GetSize(), volumeDesc, poolId) + lun, err := d.client.CreateVolume(EncodeName(opt.GetId()), opt.GetSize(), + volumeDesc, poolId) if err != nil { log.Error("Create Volume Failed:", err) return nil, err } log.Infof("Create Volume from snapshot, source_lun_id : %s , target_lun_id : %s", snapshot.Id, lun.Id) - err = WaitForCondition(func() (bool, error) { - if lun.HealthStatus == StatusHealth && lun.RunningStatus == StatusVolumeReady { - return true, nil + getVolumeResult, getVolumeErr := d.client.GetVolume(lun.Id) + if nil == getVolumeErr { + if getVolumeResult.HealthStatus == StatusHealth && getVolumeResult.RunningStatus == StatusVolumeReady { + return true, nil + } else { + log.V(5).Infof("Current lun HealthStatus : %s , RunningStatus : %s", + getVolumeResult.HealthStatus, getVolumeResult.RunningStatus) + return false, nil + } } else { - msg := fmt.Sprintf("Volume state is not mathch, lun ID : %s , HealthStatus : %s,RunningStatus : %s", - lun.Id, lun.HealthStatus, lun.RunningStatus) - return false, errors.New(msg) + return false, getVolumeErr } }, LunReadyWaitInterval, LunReadyWaitTimeout) + if err != nil { log.Error(err) d.client.DeleteVolume(lun.Id) @@ -118,37 +124,35 @@ func (d *Driver) createVolumeFromSnapshot(opt *pb.CreateVolumeOpts) (*model.Volu func (d *Driver) copyVolume(opt *pb.CreateVolumeOpts, srcid, tgtid string) error { metadata := opt.GetMetadata() copyspeed := metadata["copyspeed"] - luncopyid, err := d.client.CreateLunCopy(opt.GetName(), srcid, tgtid, copyspeed) + luncopyid, err := d.client.CreateLunCopy(EncodeName(opt.GetId()), srcid, + tgtid, copyspeed) if err != nil { log.Error("Create Lun Copy failed,", err) return err } - defer d.client.DeleteLunCopy(luncopyid) + err = d.client.StartLunCopy(luncopyid) if err != nil { log.Errorf("Start lun: %s copy failed :%v,", luncopyid, err) + d.client.DeleteLunCopy(luncopyid) return err } - lunCopyInfo, err1 := d.client.GetLunInfo(luncopyid) - if err1 != nil { - log.Errorf("Get lun info failed :%v", err1) - return err1 - } + err = WaitForCondition(func() (bool, error) { - if lunCopyInfo.RunningStatus == StatusLuncopyReady || lunCopyInfo.RunningStatus == StatusLunCoping { + deleteLunCopyErr := d.client.DeleteLunCopy(luncopyid) + if nil == deleteLunCopyErr { return true, nil - } else if lunCopyInfo.HealthStatus != StatusHealth { - msg := fmt.Sprintf("An error occurred during the luncopy operation. Lun name : %s ,Lun copy health status : %s ,Lun copy running status : %s ", - lunCopyInfo.Name, lunCopyInfo.HealthStatus, lunCopyInfo.RunningStatus) - return false, errors.New(msg) } - return true, nil + + return false, nil }, LunCopyWaitInterval, LunCopyWaitTimeout) + if err != nil { log.Error(err) return err } + log.Infof("Copy Volume %s success", tgtid) return nil } diff --git a/contrib/drivers/huawei/dorado/replication.go b/contrib/drivers/huawei/dorado/replication.go index 50b70a88d..710d2fb6c 100644 --- a/contrib/drivers/huawei/dorado/replication.go +++ b/contrib/drivers/huawei/dorado/replication.go @@ -204,10 +204,6 @@ func (r *ReplicaPairMgr) CheckRemoteAvailable() bool { return false } -func (r *ReplicaPairMgr) UpdateReplicationCapability(stats []string) { - //rmtOk := r.CheckRemoteAvailable() -} - func (r *ReplicaPairMgr) GetRemoteDevInfo() (id, name string) { wwn := r.TryGetRemoteWwn() if wwn == "" { @@ -220,24 +216,6 @@ func (r *ReplicaPairMgr) GetRemoteDevInfo() (id, name string) { return dev.Id, dev.Name } -func (r *ReplicaPairMgr) BuildRemoteLunParams(localLun *Lun) map[string]interface{} { - return map[string]interface{}{ - "Type": "11", - "Name": localLun.Name, - "Parenttype": "216", - "ParentId": "", - "Description": localLun.Description, - "Alloctype": localLun.AllocType, - "Capacity": localLun.Capability, - //"Writepolicy": Self.Conf.Lun_Write_Type, - //"Prefetchpolicy": Self.Conf.Lun_Prefetch_Type, - //"Prefetchvalue": Self.Conf.Lun_Prefetch_Value, - //"Datatransferpolicy": Self.Conf.Lun_Policy, - //"Readcachepolicy": Self.Conf.Lun_Read_Cache_Policy, - //"Writecachepolicy": Self.Conf.Lun_Write_Cache_Policy, - } -} - func (r *ReplicaPairMgr) WaitVolumeOnline(client *DoradoClient, lun *Lun, interval, timeout time.Duration) error { if lun.RunningStatus == StatusVolumeReady { return nil @@ -263,32 +241,6 @@ func (r *ReplicaPairMgr) WaitVolumeOnline(client *DoradoClient, lun *Lun, interv }, interval, timeout) } -func (r *ReplicaPairMgr) CreateRemoteLun(localLun *Lun) (*Lun, error) { - //params := r.BuildRemoteLunParams(localLun) - sector, err := strconv.ParseInt(localLun.SectorSize, 10, 64) - if err != nil { - return nil, err - } - rmtLun, err := r.remoteClient.CreateVolume(localLun.Name, sector, localLun.Description, "0") - if err != nil { - return nil, err - } - interval := DefaultReplicaWaitInterval - timeout := DefaultReplicaWaitTimeout - if err := r.WaitVolumeOnline(r.remoteClient, rmtLun, interval, timeout); err != nil { - r.remoteClient.DeleteVolume(rmtLun.Id) - return nil, err - } - return rmtLun, err -} - -func (r *ReplicaPairMgr) DeleteRemoteLun(id string) error { - if r.remoteClient.CheckLunExist(id, "") { - return r.remoteClient.DeleteVolume(id) - } - return nil -} - func (r *ReplicaPairMgr) DeletePair(id string) error { if !r.localClient.CheckPairExist(id) { return nil @@ -303,12 +255,12 @@ func (r *ReplicaPairMgr) DeletePair(id string) error { return nil } -func (r *ReplicaPairMgr) CreateReplication(pLunId, sLunId, replicationMode string, replicaPeriod string) (map[string]string, error) { +func (r *ReplicaPairMgr) CreateReplication(localLunId, rmtLunId, replicationMode string, replicaPeriod string) (map[string]string, error) { interval := DefaultReplicaWaitInterval timeout := DefaultReplicaWaitTimeout var respMap = make(map[string]string) - localLun, err := r.localClient.GetVolume(pLunId) + localLun, err := r.localClient.GetVolume(localLunId) if err != nil { return nil, err } @@ -317,39 +269,20 @@ func (r *ReplicaPairMgr) CreateReplication(pLunId, sLunId, replicationMode strin if err != nil { return nil, err } - var rmtLunId = sLunId - if sLunId == "" { - rmtLun, err := r.CreateRemoteLun(localLun) - if err != nil { - return nil, err - } - rmtLunId = rmtLun.Id - respMap[KSecondaryLunId] = rmtLunId - } - - var cleanlun = false - defer func() { - if cleanlun && sLunId == "" { - r.DeleteRemoteLun(rmtLunId) - } - }() rmtDevId, rmtDevName := r.GetRemoteDevInfo() log.Errorf("rmtDevId:%s, rmtDevName:%s", rmtDevId, rmtDevName) if rmtDevId == "" || rmtDevName == "" { - cleanlun = true return nil, fmt.Errorf("get remote deivce info failed") } pair, err := r.localOp.Create(localLun.Id, rmtLunId, rmtDevId, rmtDevName, replicationMode, ReplicaSpeed, replicaPeriod) if err != nil { - cleanlun = true return nil, err } log.Error("start sync ....", pair) if err := r.localDriver.Sync(pair.Id, replicationMode == ReplicaSyncMode); err != nil { r.DeletePair(pair.Id) - cleanlun = true return nil, err } respMap[KPairId] = pair.Id @@ -361,9 +294,6 @@ func (r *ReplicaPairMgr) DeleteReplication(pairId, rmtLunId string) error { log.Error("Delete pair failed,", err) return err } - if rmtLunId != "" { - return r.DeleteRemoteLun(rmtLunId) - } return nil } @@ -376,10 +306,9 @@ func (r *ReplicaPairMgr) DeleteReplication(pairId, rmtLunId string) error { // 5. Enable replications. func (r *ReplicaPairMgr) Failback(pairId string) error { + r.remoteDriver.Enable(pairId, true) + r.remoteDriver.WaitReplicaReady(pairId) r.localDriver.Enable(pairId, false) - r.localDriver.WaitReplicaReady(pairId) - r.remoteDriver.Failover(pairId) - r.remoteDriver.Enable(pairId, false) return nil } diff --git a/contrib/drivers/huawei/fusionstorage/fusionstorage.go b/contrib/drivers/huawei/fusionstorage/fusionstorage.go index 6faed39b1..8ab10ea24 100644 --- a/contrib/drivers/huawei/fusionstorage/fusionstorage.go +++ b/contrib/drivers/huawei/fusionstorage/fusionstorage.go @@ -204,7 +204,7 @@ func (d *Driver) DeleteSnapshot(opt *pb.DeleteVolumeSnapshotOpts) error { log.Errorf("Delete volume snapshot (%s) failed: %v", opt.GetId(), err) return err } - log.Info("Remove volume snapshot (%s) success", opt.GetId()) + log.Infof("Remove volume snapshot (%s) success", opt.GetId()) return nil } diff --git a/contrib/drivers/huawei/fusionstorage/parser.go b/contrib/drivers/huawei/fusionstorage/parser.go index d04c1bed7..1b5561170 100644 --- a/contrib/drivers/huawei/fusionstorage/parser.go +++ b/contrib/drivers/huawei/fusionstorage/parser.go @@ -76,7 +76,7 @@ func Value(data map[string]string, v reflect.Value) error { case reflect.String: iv.SetString(s) default: - return fmt.Errorf("fsc: Unexpected key type", iv.Kind()) // should never occur + return fmt.Errorf("fsc: Unexpected key type %v", iv.Kind()) // should never occur } } return nil @@ -112,7 +112,7 @@ func unmarshalSlice(data string, v reflect.Value) error { func Unmarshal(data []byte, v interface{}) error { rv := reflect.ValueOf(v) if rv.Kind() != reflect.Ptr || rv.IsNil() { - return fmt.Errorf("invalid type of %s ,reflect.TypeOf(v) ") + return fmt.Errorf("invalid value kind %v", rv.Kind()) } rv = rv.Elem() switch rv.Kind() { diff --git a/contrib/drivers/lvm/lvm.go b/contrib/drivers/lvm/lvm.go index f4ffca98d..cea6152b0 100755 --- a/contrib/drivers/lvm/lvm.go +++ b/contrib/drivers/lvm/lvm.go @@ -87,7 +87,57 @@ func (d *Driver) Setup() error { func (*Driver) Unset() error { return nil } -func (d *Driver) CreateVolume(opt *pb.CreateVolumeOpts) (*model.VolumeSpec, error) { +func (d *Driver) copySnapshotToVolume(opt *pb.CreateVolumeOpts, lvPath string) error { + var snapSize = uint64(opt.GetSnapshotSize()) + var count = (snapSize << sizeShiftBit) / blocksize + var snapName = snapshotPrefix + opt.GetSnapshotId() + var snapPath = path.Join("/dev", opt.GetPoolName(), snapName) + if _, err := d.handler("dd", []string{ + "if=" + snapPath, + "of=" + lvPath, + "count=" + fmt.Sprint(count), + "bs=" + fmt.Sprint(blocksize), + }); err != nil { + log.Error("Failed to create logic volume:", err) + return err + } + return nil +} + +func (d *Driver) downloadSnapshot(bucket, backupId, dest string) error { + mc, err := backup.NewBackup("multi-cloud") + if err != nil { + log.Errorf("get backup driver, err: %v", err) + return err + } + + if err := mc.SetUp(); err != nil { + return err + } + defer mc.CleanUp() + + file, err := os.OpenFile(dest, os.O_RDWR, 0666) + if err != nil { + log.Errorf("open lvm snapshot file, err: %v", err) + return err + } + defer file.Close() + + metadata := map[string]string{ + "bucket": bucket, + } + b := &backup.BackupSpec{ + Metadata: metadata, + } + + if err := mc.Restore(b, backupId, file); err != nil { + log.Errorf("upload snapshot to multi-cloud failed, err: %v", err) + return err + } + return nil +} + +func (d *Driver) CreateVolume(opt *pb.CreateVolumeOpts) (vol *model.VolumeSpec, err error) { var size = fmt.Sprint(opt.GetSize()) + "G" var polName = opt.GetPoolName() var id = opt.GetId() @@ -121,21 +171,41 @@ func (d *Driver) CreateVolume(opt *pb.CreateVolumeOpts) (*model.VolumeSpec, erro } } - // Copy snapshot to volume - var snap = opt.GetSnapshotId() - if snap != "" { - var snapSize = uint64(opt.GetSnapshotSize()) - var count = (snapSize << sizeShiftBit) / blocksize - var snapName = snapshotPrefix + snap - var snapPath = path.Join("/dev", polName, snapName) - if _, err := d.handler("dd", []string{ - "if=" + snapPath, - "of=" + lvPath, - "count=" + fmt.Sprint(count), - "bs=" + fmt.Sprint(blocksize), - }); err != nil { - log.Error("Failed to create logic volume:", err) - return nil, err + // remove created volume if got error + defer func() { + // using return value as the error flag + if vol == nil { + _, err := d.handler("lvremove", []string{"-f", lvPath}) + if err != nil { + log.Error("Failed to remove logic volume:", err) + } + } + }() + + // Create volume from snapshot + if opt.GetSnapshotId() != "" { + if opt.SnapshotFromCloud { + // download cloud snapshot to volume + data := opt.GetMetadata() + backupId, ok := data["backupId"] + if !ok { + return nil, errors.New("can't find backupId in metadata") + } + bucket, ok := data["bucket"] + if !ok { + return nil, errors.New("can't find bucket name in metadata") + } + err := d.downloadSnapshot(bucket, backupId, lvPath) + if err != nil { + log.Errorf("Download snapshot failed, %v", err) + return nil, err + } + } else { + // copy local snapshot to volume + if err := d.copySnapshotToVolume(opt, lvPath); err != nil { + log.Errorf("Copy snapshot to volume failed, %v", err) + return nil, err + } } } @@ -502,11 +572,10 @@ func (d *Driver) deleteUploadedSnapshot(backupId string, bucket string) error { return nil } -func (d *Driver) CreateSnapshot(opt *pb.CreateVolumeSnapshotOpts) (*model.VolumeSnapshotSpec, error) { +func (d *Driver) CreateSnapshot(opt *pb.CreateVolumeSnapshotOpts) (snap *model.VolumeSnapshotSpec, err error) { var size = fmt.Sprint(opt.GetSize()) + "G" var id = opt.GetId() var snapName = snapshotPrefix + id - var err error lvPath, ok := opt.GetMetadata()["lvPath"] if !ok { @@ -542,7 +611,7 @@ func (d *Driver) CreateSnapshot(opt *pb.CreateVolumeSnapshotOpts) (*model.Volume } defer func() { - if err != nil { + if snap == nil { log.Errorf("create snapshot failed, rollback it") d.handler("lvremove", []string{"-f", lvsPath}) } diff --git a/dashboard/.angular-cli.json b/dashboard/.angular-cli.json deleted file mode 100644 index df63f8d03..000000000 --- a/dashboard/.angular-cli.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "$schema": "./node_modules/@angular/cli/lib/config/schema.json", - "project": { - "name": "primeng" - }, - "apps": [ - { - "root": "src", - "outDir": "dist", - "assets": [ - "assets", - "upload.php", - "favicon.png", - { "glob": "**/**", "input": "./assets", "output": "./assets/"}, - { "glob": "**/**", "input": "./app/i18n", "output": "./src/app/i18n/"} - ], - "index": "index.html", - "main": "main.ts", - "polyfills": "polyfills.ts", - "test": "test.ts", - "tsconfig": "tsconfig.app.json", - "testTsconfig": "tsconfig.spec.json", - "prefix": "app", - "styles": [ - "../node_modules/fullcalendar/dist/fullcalendar.min.css", - "../node_modules/quill/dist/quill.snow.css", - "../node_modules/font-awesome/css/font-awesome.min.css", - "styles.scss" - ], - "scripts": [ - "../node_modules/jquery/dist/jquery.js", - "../node_modules/moment/moment.js", - "../node_modules/chart.js/dist/Chart.js", - "../node_modules/fullcalendar/dist/fullcalendar.js", - "../node_modules/quill/dist/quill.js", - "../node_modules/prismjs/prism.js", - "../node_modules/prismjs/components/prism-typescript.js" - ], - "environmentSource": "environments/environment.ts", - "environments": { - "dev": "environments/environment.ts", - "prod": "environments/environment.prod.ts" - } - } - ], - "e2e": { - "protractor": { - "config": "./protractor.conf.js" - } - }, - "lint": [ - { - "project": "src/tsconfig.app.json" - }, - { - "project": "src/tsconfig.spec.json" - }, - { - "project": "e2e/tsconfig.e2e.json" - } - ], - "test": { - "karma": { - "config": "./karma.conf.js" - } - }, - "defaults": { - "styleExt": "css", - "component": {} - } -} diff --git a/dashboard/.editorconfig b/dashboard/.editorconfig deleted file mode 100644 index 9b7352176..000000000 --- a/dashboard/.editorconfig +++ /dev/null @@ -1,13 +0,0 @@ -# Editor configuration, see http://editorconfig.org -root = true - -[*] -charset = utf-8 -indent_style = space -indent_size = 4 -insert_final_newline = true -trim_trailing_whitespace = true - -[*.md] -max_line_length = off -trim_trailing_whitespace = false diff --git a/dashboard/.gitignore b/dashboard/.gitignore deleted file mode 100644 index 825c75d0a..000000000 --- a/dashboard/.gitignore +++ /dev/null @@ -1,50 +0,0 @@ -# See http://help.github.com/ignore-files/ for more about ignoring files. - -# compiled output -/dist -/tmp -/out-tsc -/components -/resources -/aot - -# dependencies -/node_modules - -# IDEs and editors -/.idea -.project -.classpath -.c9/ -*.launch -.settings/ -*.sublime-workspace - -# IDE - VSCode -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json - -# misc -/.sass-cache -/connect.lock -/coverage -/libpeerconnection.log -npm-debug.log -testem.log -/typings - -# themes -/src/assets/components/themes/**/*.css -/src/assets/components/themes/**/*.map -!/src/assets/components/themes/bootstrap/theme.css - -# e2e -/e2e/*.js -/e2e/*.map - -# System Files -.DS_Store -Thumbs.db diff --git a/dashboard/.npmignore b/dashboard/.npmignore deleted file mode 100644 index 98f95cfdc..000000000 --- a/dashboard/.npmignore +++ /dev/null @@ -1,67 +0,0 @@ -# compiled output -/dist -/tmp -/out-tsc -/aot - -# source -src - -# test -e2e -karma.conf.js -protractor.conf.js -*.spec.d.ts -*.spec.js -*.spec.js.map -*.spec.metadata.json -*.spec.ngsummary.json - -# dependencies -node_modules - -# IDEs and editors -/.idea -.project -.classpath -.c9/ -*.launch -.settings/ -*.sublime-workspace -.editor-config - -# IDE - VSCode -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json - -# misc -/.sass-cache -/connect.lock -/coverage -/libpeerconnection.log -npm-debug.log -testem.log -/typings -.gitignore -exports - -# config -.angular-cli.json -tsconfig.json -tsconfig-release.json -tsconfig-aot.json -tslint.json -gulpfile.js -.github - -# System Files -.DS_Store -Thumbs.db - -# aot -*.ngfactory.js -*.ngfactory.js.map -*.ngsummary.json \ No newline at end of file diff --git a/dashboard/.travis.yml b/dashboard/.travis.yml deleted file mode 100644 index 7cbe366e4..000000000 --- a/dashboard/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -language: node_js -sudo: required -node_js: - - node - -before_script: - - "sudo chown root /opt/google/chrome/chrome-sandbox" - - "sudo chmod 4755 /opt/google/chrome/chrome-sandbox" - -before_install: - - export CHROME_BIN=chromium-browser - - export DISPLAY=:99.0 - - sh -e /etc/init.d/xvfb start - -script: # the build step - - node_modules/.bin/ng test --colors=false --progress=false --single-run - - -cache: - yarn: true - directories: - - ./node_modules - - ./.chrome/chromium \ No newline at end of file diff --git a/dashboard/Dockerfile b/dashboard/Dockerfile deleted file mode 100644 index cb51b0043..000000000 --- a/dashboard/Dockerfile +++ /dev/null @@ -1,35 +0,0 @@ -# Docker build usage: -# docker build . -t opensdsio/dashboard:latest -# Docker run usage: -# docker run -d -p 8088:8088 opensdsio/dashboard:latest - -FROM ubuntu:16.04 -MAINTAINER Leon Wang - -ARG DEBIAN_FRONTEND=noninteractive - -# Download and install some packages. -RUN apt-get update && apt-get install -y --no-install-recommends \ - sudo \ - wget \ - make \ - g++ \ - nginx \ - && rm -rf /var/lib/apt/lists/* \ - && apt-get clean -RUN wget --no-check-certificate https://deb.nodesource.com/setup_8.x \ - && chmod +x setup_8.x && ./setup_8.x \ - && apt-get install -y nodejs - -# Current directory is always /opt/dashboard. -WORKDIR /opt/dashboard - -# Copy dashboard source code into container before running command. -COPY ./ ./ - -RUN chmod 755 ./image_builder.sh \ - && sudo ./image_builder.sh -RUN sudo ./image_builder.sh --rebuild - -# Define default command. -CMD /usr/sbin/nginx -g "daemon off;" diff --git a/dashboard/LICENSE.md b/dashboard/LICENSE.md deleted file mode 100644 index 02647baee..000000000 --- a/dashboard/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016-2017 PrimeTek - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/dashboard/Makefile b/dashboard/Makefile deleted file mode 100644 index 9601d10fb..000000000 --- a/dashboard/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright (c) 2018 Huawei Technologies Co., Ltd. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -IMAGE = opensdsio/dashboard -VERSION := latest - -all:build -.PHONY: all - -build:dashboard -.PHONY: build - -dashboard:package - chmod +x ./image_builder.sh \ - && ./image_builder.sh -.PHONY: dashboard - -package: - apt-get update && apt-get install -y --no-install-recommends \ - wget \ - make \ - g++ \ - nginx \ - && rm -rf /var/lib/apt/lists/* \ - && apt-get clean - wget --no-check-certificate https://deb.nodesource.com/setup_8.x \ - && chmod +x setup_8.x && ./setup_8.x \ - && apt-get install -y nodejs -.PHONY: package - -docker: - docker build . -t $(IMAGE):$(VERSION) -.PHONY: docker - -clean: - service nginx stop - rm -rf /etc/nginx/sites-available/default /var/www/html/* ./dist warn=False - npm uninstall --unsafe-perm - npm uninstall --unsafe-perm -g @angular/cli@1.7.4 - apt-get --purge remove -y nodejs nginx \ - && rm -rf ./setup_8.x warn=False -.PHONY: clean diff --git a/dashboard/README.md b/dashboard/README.md deleted file mode 100644 index 2e26c0f97..000000000 --- a/dashboard/README.md +++ /dev/null @@ -1,77 +0,0 @@ -# Summary -OpenSDS dashboard uses the front-end development framework Angular5 (https://angular.io/) -and relies on PrimeNG UI Components (https://www.primefaces.org/primeng/). Regardless of -deployment or two development, prepare the corresponding environment. - -# Prerequisite - -### 1. Ubuntu -* Version information -```shell -root@proxy:~# cat /etc/issue -Ubuntu 16.04.2 LTS \n \l -``` - -### 2. Nginx installation -```shell -sudo apt-get install nginx -``` - -### 3. NodeJS installation, NPM will be installed with nodejs. -```shell -curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - -sudo apt-get install -y nodejs -``` - -### 4. Angular CLI installation -Specify the version[1.7.4] of angular5 suitable for installation. -```shell -sudo npm install -g @angular/cli@1.7.4 -``` - - -# Build & Start -### 1. Git clone dashboard code. -```shell -git clone https://github.com/opensds/opensds.git -``` - -### 2. Build opensds dashboard. -After the build work finished, the files in the `dist` folder should be copied to the folder ` /var/www/html/`. -```shell -cd opensds/dashboard -sudo npm install -sudo ng build --prod -``` - -```shell -cp -R opensds/dashboard/dist/* /var/www/html/ -``` - -### 3. Set nginx default config. -```shell -vi /etc/nginx/sites-available/default -``` -Configure proxy, points to the resource server and the authentication server respectively. -Such as: -* Keystone server `http://1.1.1.0:5000` -* Resource server `http://1.1.1.0:50040` -```shell -location /v3/ { - proxy_pass http://1.1.1.0:5000/v3/; -} - -location /v1beta/ { - proxy_pass http://1.1.1.0:50040/v1beta/; -} -``` - -### 4. Restart nginx -```shell -service nginx restart -``` - -### 5. Access dashboard in browser. -```shell -http://localhost/ -``` diff --git a/dashboard/e2e/accordion.e2e-spec.ts b/dashboard/e2e/accordion.e2e-spec.ts deleted file mode 100644 index 5476c373d..000000000 --- a/dashboard/e2e/accordion.e2e-spec.ts +++ /dev/null @@ -1,20 +0,0 @@ -import {browser, by, element, ElementArrayFinder} from 'protractor'; - -describe('Accordion', () => { - let accordionHeaders: ElementArrayFinder; - let accordionContents: ElementArrayFinder; - - describe('Header Click', () => { - beforeEach(() => { - browser.get('#/accordion'); - accordionContents = element.all(by.css('.ui-accordion-content-wrapper')); - accordionHeaders = element.all(by.css('.ui-accordion-header')); - }); - - it('should close active content', () => { - accordionHeaders.get(0).click(); - expect(accordionContents.get(0).getCssValue('overflow')).toBe('hidden'); - }); - - }); -}); \ No newline at end of file diff --git a/dashboard/e2e/app.e2e-spec.ts b/dashboard/e2e/app.e2e-spec.ts deleted file mode 100644 index 83f61bb6a..000000000 --- a/dashboard/e2e/app.e2e-spec.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { PrimengPage } from './app.po'; - -describe('primeng App', () => { - let page: PrimengPage; - - beforeEach(() => { - page = new PrimengPage(); - }); - - it('should display welcome message', done => { - page.navigateTo(); - page.getPROText() - .then(msg => expect(msg).toEqual('PrimeNG PRO Support')) - .then(done, done.fail); - }); -}); diff --git a/dashboard/e2e/app.po.ts b/dashboard/e2e/app.po.ts deleted file mode 100644 index 7b1a2d7ee..000000000 --- a/dashboard/e2e/app.po.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { browser, by, element } from 'protractor'; - -export class PrimengPage { - navigateTo() { - return browser.get('/'); - } - - getPROText() { - return element(by.css('.pro-title')).getText(); - } -} diff --git a/dashboard/e2e/fieldset.e2e-spec.ts b/dashboard/e2e/fieldset.e2e-spec.ts deleted file mode 100644 index 4b417a44d..000000000 --- a/dashboard/e2e/fieldset.e2e-spec.ts +++ /dev/null @@ -1,27 +0,0 @@ -import {browser, by, element, ElementFinder, ElementArrayFinder} from 'protractor'; - -describe('Fieldset', () => { - let legend: ElementFinder; - let contentWrapper: ElementArrayFinder; - - describe('Toggle Icon Click', () => { - beforeEach(() => { - browser.get('#/fieldset'); - legend = element(by.css('.ui-fieldset-toggleable .ui-fieldset-legend')); - contentWrapper = element.all(by.css('.ui-fieldset-content-wrapper')); - }); - - it('should close active content', () => { - legend.click(); - expect(contentWrapper.get(1).getCssValue('overflow')).toBe('hidden'); - }); - - it('should toggle content', () => { - legend.click(); - browser.sleep(1000); - legend.click(); - expect(contentWrapper.get(1).getCssValue('height')).not.toBe('0'); - }); - - }); -}); \ No newline at end of file diff --git a/dashboard/e2e/inputtext.e2e-spec.ts b/dashboard/e2e/inputtext.e2e-spec.ts deleted file mode 100644 index 6022bcbb3..000000000 --- a/dashboard/e2e/inputtext.e2e-spec.ts +++ /dev/null @@ -1,34 +0,0 @@ -import {browser, by, element} from 'protractor'; - -describe('InputText', () => { - describe('Attribute Value', () => { - let inputEl = element(by.id('input')); - let spanEl = element(by.id('text')); - - beforeEach(() => { - browser.get('#/inputtext'); - }); - - it('should be displayed in the span element', () => { - inputEl.sendKeys('PrimeNG Rocks'); - expect(spanEl.getText()).toBe('PrimeNG Rocks'); - }); - }); - - describe('Disabled property', () => { - let disabledInput = element(by.id('disabled-input')); - let disableBtn = element(by.id('disabled-btn')); - - beforeEach(() => { - browser.get('#/inputtext'); - }); - - it('should prevent click handlers from executing when disabled', () => { - expect(disabledInput.isEnabled()).toBe(false); - }); - it('should become enabled with button click', () => { - disableBtn.click(); - expect(disabledInput.isEnabled()).toBe(true); - }); - }); -}); \ No newline at end of file diff --git a/dashboard/e2e/panel.e2e-spec.ts b/dashboard/e2e/panel.e2e-spec.ts deleted file mode 100644 index 299b0af9d..000000000 --- a/dashboard/e2e/panel.e2e-spec.ts +++ /dev/null @@ -1,27 +0,0 @@ -import {browser, by, element, ElementFinder, ElementArrayFinder} from 'protractor'; - -describe('Panel', () => { - let toggleIcon: ElementFinder; - let contentWrapper: ElementArrayFinder; - - describe('Toggle Icon Click', () => { - beforeEach(() => { - browser.get('#/panel'); - toggleIcon = element(by.css('.ui-panel-titlebar-icon')); - contentWrapper = element.all(by.css('.ui-panel-content-wrapper')); - }); - - it('should close active content', () => { - toggleIcon.click(); - expect(contentWrapper.get(0).getCssValue('overflow')).toBe('hidden'); - }); - - it('should toggle content', () => { - toggleIcon.click(); - browser.sleep(1000); - toggleIcon.click(); - expect(contentWrapper.get(0).getCssValue('height')).not.toBe('0'); - }); - - }); -}); \ No newline at end of file diff --git a/dashboard/e2e/tabview.e2e-spec.ts b/dashboard/e2e/tabview.e2e-spec.ts deleted file mode 100644 index ba717e9be..000000000 --- a/dashboard/e2e/tabview.e2e-spec.ts +++ /dev/null @@ -1,49 +0,0 @@ -import {browser, by, element, ElementArrayFinder} from 'protractor'; - -describe('TabView', () => { - let tabPanels: ElementArrayFinder; - let tabElements: ElementArrayFinder; - let closeIcons: ElementArrayFinder; - let closableTabPanels: ElementArrayFinder; - let closableTabElements: ElementArrayFinder; - - describe('Tab Click', () => { - beforeEach(() => { - browser.get('#/tabview'); - tabPanels = element.all(by.css('.ui-tabview-panel')); - tabElements = element.all(by.css('.ui-tabview-nav li')); - }); - - it('should switch panels', () => { - tabElements.get(1).click(); - expect(tabPanels.get(1).getCssValue('display')).toBe('block'); - }); - - }); - describe('Close Icon Click', () => { - beforeEach(() => { - browser.get('#/tabview'); - closableTabElements = element.all(by.css('#closableTabView .ui-tabview-nav li')); - closeIcons = element.all(by.css('#closableTabView .ui-tabview-nav li .ui-tabview-close')); - }); - - it('should delete closed panel', () => { - closeIcons.get(0).click(); - expect(closableTabElements.count()).toBe(2); - }); - }); - describe('Close Icon Click on an active tab', () => { - beforeEach(() => { - browser.get('#/tabview'); - closableTabPanels = element.all(by.css('#closableTabView .ui-tabview-panel')); - closableTabElements = element.all(by.css('#closableTabView .ui-tabview-nav li')); - closeIcons = element.all(by.css('#closableTabView .ui-tabview-nav li .ui-tabview-close')); - }); - - it('should close that panel and first tab should be active', () => { - closableTabElements.get(2).click(); - closeIcons.get(1).click(); - expect(closableTabPanels.get(0).getCssValue('display')).toBe('block'); - }); - }); -}); \ No newline at end of file diff --git a/dashboard/e2e/tsconfig.e2e.json b/dashboard/e2e/tsconfig.e2e.json deleted file mode 100644 index e2a9a2fc7..000000000 --- a/dashboard/e2e/tsconfig.e2e.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "outDir": "../out-tsc/e2e", - "module": "commonjs", - "target": "es5", - "types": [ - "jasmine", - "node" - ] - } -} diff --git a/dashboard/exports/accordion.d.ts b/dashboard/exports/accordion.d.ts deleted file mode 100644 index 452bb1c17..000000000 --- a/dashboard/exports/accordion.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/accordion/accordion'; \ No newline at end of file diff --git a/dashboard/exports/accordion.js b/dashboard/exports/accordion.js deleted file mode 100644 index 01ce630d8..000000000 --- a/dashboard/exports/accordion.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/accordion/accordion")); \ No newline at end of file diff --git a/dashboard/exports/api.d.ts b/dashboard/exports/api.d.ts deleted file mode 100644 index 719f575ac..000000000 --- a/dashboard/exports/api.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/common/api'; \ No newline at end of file diff --git a/dashboard/exports/api.js b/dashboard/exports/api.js deleted file mode 100644 index 0a03470e5..000000000 --- a/dashboard/exports/api.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/common/api")); \ No newline at end of file diff --git a/dashboard/exports/autocomplete.d.ts b/dashboard/exports/autocomplete.d.ts deleted file mode 100644 index 1ac0ce8cd..000000000 --- a/dashboard/exports/autocomplete.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/autocomplete/autocomplete'; \ No newline at end of file diff --git a/dashboard/exports/autocomplete.js b/dashboard/exports/autocomplete.js deleted file mode 100644 index 8d1ad87ff..000000000 --- a/dashboard/exports/autocomplete.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/autocomplete/autocomplete")); \ No newline at end of file diff --git a/dashboard/exports/blockui.d.ts b/dashboard/exports/blockui.d.ts deleted file mode 100644 index 64124130b..000000000 --- a/dashboard/exports/blockui.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/blockui/blockui'; \ No newline at end of file diff --git a/dashboard/exports/blockui.js b/dashboard/exports/blockui.js deleted file mode 100644 index 06926523c..000000000 --- a/dashboard/exports/blockui.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/blockui/blockui")); \ No newline at end of file diff --git a/dashboard/exports/breadcrumb.d.ts b/dashboard/exports/breadcrumb.d.ts deleted file mode 100644 index b81a3729d..000000000 --- a/dashboard/exports/breadcrumb.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/breadcrumb/breadcrumb'; \ No newline at end of file diff --git a/dashboard/exports/breadcrumb.js b/dashboard/exports/breadcrumb.js deleted file mode 100644 index f4ed86279..000000000 --- a/dashboard/exports/breadcrumb.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/breadcrumb/breadcrumb")); \ No newline at end of file diff --git a/dashboard/exports/button.d.ts b/dashboard/exports/button.d.ts deleted file mode 100644 index 945534232..000000000 --- a/dashboard/exports/button.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/button/button'; \ No newline at end of file diff --git a/dashboard/exports/button.js b/dashboard/exports/button.js deleted file mode 100644 index 9b5036483..000000000 --- a/dashboard/exports/button.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/button/button")); \ No newline at end of file diff --git a/dashboard/exports/calendar.d.ts b/dashboard/exports/calendar.d.ts deleted file mode 100644 index eadf99239..000000000 --- a/dashboard/exports/calendar.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/calendar/calendar'; \ No newline at end of file diff --git a/dashboard/exports/calendar.js b/dashboard/exports/calendar.js deleted file mode 100644 index f048d89eb..000000000 --- a/dashboard/exports/calendar.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/calendar/calendar")); \ No newline at end of file diff --git a/dashboard/exports/captcha.d.ts b/dashboard/exports/captcha.d.ts deleted file mode 100644 index 8116f2ba7..000000000 --- a/dashboard/exports/captcha.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/captcha/captcha'; \ No newline at end of file diff --git a/dashboard/exports/captcha.js b/dashboard/exports/captcha.js deleted file mode 100644 index 5ad37eb5f..000000000 --- a/dashboard/exports/captcha.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/captcha/captcha")); \ No newline at end of file diff --git a/dashboard/exports/card.d.ts b/dashboard/exports/card.d.ts deleted file mode 100644 index c4e0d1f51..000000000 --- a/dashboard/exports/card.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/card/card'; \ No newline at end of file diff --git a/dashboard/exports/card.js b/dashboard/exports/card.js deleted file mode 100644 index fe72ed2f9..000000000 --- a/dashboard/exports/card.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/card/card")); \ No newline at end of file diff --git a/dashboard/exports/carousel.d.ts b/dashboard/exports/carousel.d.ts deleted file mode 100644 index 2fdb7c0f7..000000000 --- a/dashboard/exports/carousel.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/carousel/carousel'; \ No newline at end of file diff --git a/dashboard/exports/carousel.js b/dashboard/exports/carousel.js deleted file mode 100644 index 7a093b101..000000000 --- a/dashboard/exports/carousel.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/carousel/carousel")); \ No newline at end of file diff --git a/dashboard/exports/chart.d.ts b/dashboard/exports/chart.d.ts deleted file mode 100644 index 32e069313..000000000 --- a/dashboard/exports/chart.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/chart/chart'; \ No newline at end of file diff --git a/dashboard/exports/chart.js b/dashboard/exports/chart.js deleted file mode 100644 index 5a822b266..000000000 --- a/dashboard/exports/chart.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/chart/chart")); \ No newline at end of file diff --git a/dashboard/exports/checkbox.d.ts b/dashboard/exports/checkbox.d.ts deleted file mode 100644 index 6e455b294..000000000 --- a/dashboard/exports/checkbox.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/checkbox/checkbox'; \ No newline at end of file diff --git a/dashboard/exports/checkbox.js b/dashboard/exports/checkbox.js deleted file mode 100644 index 81c5fd123..000000000 --- a/dashboard/exports/checkbox.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/checkbox/checkbox")); \ No newline at end of file diff --git a/dashboard/exports/chips.d.ts b/dashboard/exports/chips.d.ts deleted file mode 100644 index 8f55793e4..000000000 --- a/dashboard/exports/chips.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/chips/chips'; \ No newline at end of file diff --git a/dashboard/exports/chips.js b/dashboard/exports/chips.js deleted file mode 100644 index 436f3913c..000000000 --- a/dashboard/exports/chips.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/chips/chips")); \ No newline at end of file diff --git a/dashboard/exports/codehighlighter.d.ts b/dashboard/exports/codehighlighter.d.ts deleted file mode 100644 index c8d5f58d9..000000000 --- a/dashboard/exports/codehighlighter.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/codehighlighter/codehighlighter'; \ No newline at end of file diff --git a/dashboard/exports/codehighlighter.js b/dashboard/exports/codehighlighter.js deleted file mode 100644 index d137e15ec..000000000 --- a/dashboard/exports/codehighlighter.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/codehighlighter/codehighlighter")); \ No newline at end of file diff --git a/dashboard/exports/colorpicker.d.ts b/dashboard/exports/colorpicker.d.ts deleted file mode 100644 index 552c7d866..000000000 --- a/dashboard/exports/colorpicker.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/colorpicker/colorpicker'; \ No newline at end of file diff --git a/dashboard/exports/colorpicker.js b/dashboard/exports/colorpicker.js deleted file mode 100644 index 2dde45ecf..000000000 --- a/dashboard/exports/colorpicker.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/colorpicker/colorpicker")); \ No newline at end of file diff --git a/dashboard/exports/confirmdialog.d.ts b/dashboard/exports/confirmdialog.d.ts deleted file mode 100644 index 23e6bfcc6..000000000 --- a/dashboard/exports/confirmdialog.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/confirmdialog/confirmdialog'; \ No newline at end of file diff --git a/dashboard/exports/confirmdialog.js b/dashboard/exports/confirmdialog.js deleted file mode 100644 index 02cf7970d..000000000 --- a/dashboard/exports/confirmdialog.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/confirmdialog/confirmdialog")); \ No newline at end of file diff --git a/dashboard/exports/contextmenu.d.ts b/dashboard/exports/contextmenu.d.ts deleted file mode 100644 index 6f6f7add3..000000000 --- a/dashboard/exports/contextmenu.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/contextmenu/contextmenu'; \ No newline at end of file diff --git a/dashboard/exports/contextmenu.js b/dashboard/exports/contextmenu.js deleted file mode 100644 index e2eaf2350..000000000 --- a/dashboard/exports/contextmenu.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/contextmenu/contextmenu")); \ No newline at end of file diff --git a/dashboard/exports/datagrid.d.ts b/dashboard/exports/datagrid.d.ts deleted file mode 100644 index ccbe60863..000000000 --- a/dashboard/exports/datagrid.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/datagrid/datagrid'; \ No newline at end of file diff --git a/dashboard/exports/datagrid.js b/dashboard/exports/datagrid.js deleted file mode 100644 index 012a164ee..000000000 --- a/dashboard/exports/datagrid.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/datagrid/datagrid")); \ No newline at end of file diff --git a/dashboard/exports/datalist.d.ts b/dashboard/exports/datalist.d.ts deleted file mode 100644 index 1a2433b09..000000000 --- a/dashboard/exports/datalist.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/datalist/datalist'; \ No newline at end of file diff --git a/dashboard/exports/datalist.js b/dashboard/exports/datalist.js deleted file mode 100644 index 2e41aaa52..000000000 --- a/dashboard/exports/datalist.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/datalist/datalist")); \ No newline at end of file diff --git a/dashboard/exports/datascroller.d.ts b/dashboard/exports/datascroller.d.ts deleted file mode 100644 index a2ac4baad..000000000 --- a/dashboard/exports/datascroller.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/datascroller/datascroller'; \ No newline at end of file diff --git a/dashboard/exports/datascroller.js b/dashboard/exports/datascroller.js deleted file mode 100644 index 4b5f82c5f..000000000 --- a/dashboard/exports/datascroller.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/datascroller/datascroller")); \ No newline at end of file diff --git a/dashboard/exports/datatable.d.ts b/dashboard/exports/datatable.d.ts deleted file mode 100644 index cc9a4d1e2..000000000 --- a/dashboard/exports/datatable.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/datatable/datatable'; \ No newline at end of file diff --git a/dashboard/exports/datatable.js b/dashboard/exports/datatable.js deleted file mode 100644 index bab7d0f3e..000000000 --- a/dashboard/exports/datatable.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/datatable/datatable")); \ No newline at end of file diff --git a/dashboard/exports/dataview.d.ts b/dashboard/exports/dataview.d.ts deleted file mode 100644 index 595fa964e..000000000 --- a/dashboard/exports/dataview.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/dataview/dataview'; \ No newline at end of file diff --git a/dashboard/exports/dataview.js b/dashboard/exports/dataview.js deleted file mode 100644 index ed0c29d23..000000000 --- a/dashboard/exports/dataview.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/dataview/dataview")); \ No newline at end of file diff --git a/dashboard/exports/defer.d.ts b/dashboard/exports/defer.d.ts deleted file mode 100644 index 295dc29e1..000000000 --- a/dashboard/exports/defer.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/defer/defer'; \ No newline at end of file diff --git a/dashboard/exports/defer.js b/dashboard/exports/defer.js deleted file mode 100644 index 587cd4a05..000000000 --- a/dashboard/exports/defer.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/defer/defer")); \ No newline at end of file diff --git a/dashboard/exports/dialog.d.ts b/dashboard/exports/dialog.d.ts deleted file mode 100644 index 319213f8a..000000000 --- a/dashboard/exports/dialog.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/dialog/dialog'; \ No newline at end of file diff --git a/dashboard/exports/dialog.js b/dashboard/exports/dialog.js deleted file mode 100644 index c618248a6..000000000 --- a/dashboard/exports/dialog.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/dialog/dialog")); \ No newline at end of file diff --git a/dashboard/exports/dragdrop.d.ts b/dashboard/exports/dragdrop.d.ts deleted file mode 100644 index 42002ad67..000000000 --- a/dashboard/exports/dragdrop.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/dragdrop/dragdrop'; \ No newline at end of file diff --git a/dashboard/exports/dragdrop.js b/dashboard/exports/dragdrop.js deleted file mode 100644 index 6cf00b128..000000000 --- a/dashboard/exports/dragdrop.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/dragdrop/dragdrop")); \ No newline at end of file diff --git a/dashboard/exports/dropdown.d.ts b/dashboard/exports/dropdown.d.ts deleted file mode 100644 index 59a9b3a7f..000000000 --- a/dashboard/exports/dropdown.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/dropdown/dropdown'; \ No newline at end of file diff --git a/dashboard/exports/dropdown.js b/dashboard/exports/dropdown.js deleted file mode 100644 index c9df1e3fe..000000000 --- a/dashboard/exports/dropdown.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/dropdown/dropdown")); \ No newline at end of file diff --git a/dashboard/exports/editor.d.ts b/dashboard/exports/editor.d.ts deleted file mode 100644 index 8a147719b..000000000 --- a/dashboard/exports/editor.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/editor/editor'; \ No newline at end of file diff --git a/dashboard/exports/editor.js b/dashboard/exports/editor.js deleted file mode 100644 index ee153ec23..000000000 --- a/dashboard/exports/editor.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/editor/editor")); \ No newline at end of file diff --git a/dashboard/exports/fieldset.d.ts b/dashboard/exports/fieldset.d.ts deleted file mode 100644 index c7e44238a..000000000 --- a/dashboard/exports/fieldset.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/fieldset/fieldset'; \ No newline at end of file diff --git a/dashboard/exports/fieldset.js b/dashboard/exports/fieldset.js deleted file mode 100644 index be4397a07..000000000 --- a/dashboard/exports/fieldset.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/fieldset/fieldset")); \ No newline at end of file diff --git a/dashboard/exports/fileupload.d.ts b/dashboard/exports/fileupload.d.ts deleted file mode 100644 index 2c5b61d27..000000000 --- a/dashboard/exports/fileupload.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/fileupload/fileupload'; \ No newline at end of file diff --git a/dashboard/exports/fileupload.js b/dashboard/exports/fileupload.js deleted file mode 100644 index f6d989a36..000000000 --- a/dashboard/exports/fileupload.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/fileupload/fileupload")); \ No newline at end of file diff --git a/dashboard/exports/galleria.d.ts b/dashboard/exports/galleria.d.ts deleted file mode 100644 index 5355b48d8..000000000 --- a/dashboard/exports/galleria.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/galleria/galleria'; \ No newline at end of file diff --git a/dashboard/exports/galleria.js b/dashboard/exports/galleria.js deleted file mode 100644 index 0dbf04949..000000000 --- a/dashboard/exports/galleria.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/galleria/galleria")); \ No newline at end of file diff --git a/dashboard/exports/gmap.d.ts b/dashboard/exports/gmap.d.ts deleted file mode 100644 index 11cba6531..000000000 --- a/dashboard/exports/gmap.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/gmap/gmap'; \ No newline at end of file diff --git a/dashboard/exports/gmap.js b/dashboard/exports/gmap.js deleted file mode 100644 index b89a2c90e..000000000 --- a/dashboard/exports/gmap.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/gmap/gmap")); \ No newline at end of file diff --git a/dashboard/exports/growl.d.ts b/dashboard/exports/growl.d.ts deleted file mode 100644 index 0892d8792..000000000 --- a/dashboard/exports/growl.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/growl/growl'; \ No newline at end of file diff --git a/dashboard/exports/growl.js b/dashboard/exports/growl.js deleted file mode 100644 index dca7b5e94..000000000 --- a/dashboard/exports/growl.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/growl/growl")); \ No newline at end of file diff --git a/dashboard/exports/inplace.d.ts b/dashboard/exports/inplace.d.ts deleted file mode 100644 index 1b1b4c02a..000000000 --- a/dashboard/exports/inplace.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/inplace/inplace'; \ No newline at end of file diff --git a/dashboard/exports/inplace.js b/dashboard/exports/inplace.js deleted file mode 100644 index c5c6847e5..000000000 --- a/dashboard/exports/inplace.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/inplace/inplace")); \ No newline at end of file diff --git a/dashboard/exports/inputmask.d.ts b/dashboard/exports/inputmask.d.ts deleted file mode 100644 index 05a587e78..000000000 --- a/dashboard/exports/inputmask.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/inputmask/inputmask'; \ No newline at end of file diff --git a/dashboard/exports/inputmask.js b/dashboard/exports/inputmask.js deleted file mode 100644 index 14864e4c1..000000000 --- a/dashboard/exports/inputmask.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/inputmask/inputmask")); \ No newline at end of file diff --git a/dashboard/exports/inputswitch.d.ts b/dashboard/exports/inputswitch.d.ts deleted file mode 100644 index 4ff45dfbb..000000000 --- a/dashboard/exports/inputswitch.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/inputswitch/inputswitch'; \ No newline at end of file diff --git a/dashboard/exports/inputswitch.js b/dashboard/exports/inputswitch.js deleted file mode 100644 index 61301252c..000000000 --- a/dashboard/exports/inputswitch.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/inputswitch/inputswitch")); \ No newline at end of file diff --git a/dashboard/exports/inputtext.d.ts b/dashboard/exports/inputtext.d.ts deleted file mode 100644 index 3359c9c70..000000000 --- a/dashboard/exports/inputtext.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/inputtext/inputtext'; \ No newline at end of file diff --git a/dashboard/exports/inputtext.js b/dashboard/exports/inputtext.js deleted file mode 100644 index 84752274d..000000000 --- a/dashboard/exports/inputtext.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/inputtext/inputtext")); \ No newline at end of file diff --git a/dashboard/exports/inputtextarea.d.ts b/dashboard/exports/inputtextarea.d.ts deleted file mode 100644 index 76331c7e0..000000000 --- a/dashboard/exports/inputtextarea.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/inputtextarea/inputtextarea'; \ No newline at end of file diff --git a/dashboard/exports/inputtextarea.js b/dashboard/exports/inputtextarea.js deleted file mode 100644 index 99ade804c..000000000 --- a/dashboard/exports/inputtextarea.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/inputtextarea/inputtextarea")); \ No newline at end of file diff --git a/dashboard/exports/keyfilter.d.ts b/dashboard/exports/keyfilter.d.ts deleted file mode 100644 index c45db1f27..000000000 --- a/dashboard/exports/keyfilter.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/keyfilter/keyfilter'; \ No newline at end of file diff --git a/dashboard/exports/keyfilter.js b/dashboard/exports/keyfilter.js deleted file mode 100644 index f974d6867..000000000 --- a/dashboard/exports/keyfilter.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/keyfilter/keyfilter")); \ No newline at end of file diff --git a/dashboard/exports/lightbox.d.ts b/dashboard/exports/lightbox.d.ts deleted file mode 100644 index 4fecd3bba..000000000 --- a/dashboard/exports/lightbox.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/lightbox/lightbox'; \ No newline at end of file diff --git a/dashboard/exports/lightbox.js b/dashboard/exports/lightbox.js deleted file mode 100644 index c81b75360..000000000 --- a/dashboard/exports/lightbox.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/lightbox/lightbox")); \ No newline at end of file diff --git a/dashboard/exports/listbox.d.ts b/dashboard/exports/listbox.d.ts deleted file mode 100644 index b7519c1d2..000000000 --- a/dashboard/exports/listbox.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/listbox/listbox'; \ No newline at end of file diff --git a/dashboard/exports/listbox.js b/dashboard/exports/listbox.js deleted file mode 100644 index de5ff0317..000000000 --- a/dashboard/exports/listbox.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/listbox/listbox")); \ No newline at end of file diff --git a/dashboard/exports/megamenu.d.ts b/dashboard/exports/megamenu.d.ts deleted file mode 100644 index 56b7dc67c..000000000 --- a/dashboard/exports/megamenu.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/megamenu/megamenu'; \ No newline at end of file diff --git a/dashboard/exports/megamenu.js b/dashboard/exports/megamenu.js deleted file mode 100644 index 9c93b4cee..000000000 --- a/dashboard/exports/megamenu.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/megamenu/megamenu")); \ No newline at end of file diff --git a/dashboard/exports/menu.d.ts b/dashboard/exports/menu.d.ts deleted file mode 100644 index 2098c7a80..000000000 --- a/dashboard/exports/menu.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/menu/menu'; \ No newline at end of file diff --git a/dashboard/exports/menu.js b/dashboard/exports/menu.js deleted file mode 100644 index ccb487dca..000000000 --- a/dashboard/exports/menu.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/menu/menu")); \ No newline at end of file diff --git a/dashboard/exports/menubar.d.ts b/dashboard/exports/menubar.d.ts deleted file mode 100644 index c841483f2..000000000 --- a/dashboard/exports/menubar.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/menubar/menubar'; \ No newline at end of file diff --git a/dashboard/exports/menubar.js b/dashboard/exports/menubar.js deleted file mode 100644 index 6fb64bb2c..000000000 --- a/dashboard/exports/menubar.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/menubar/menubar")); \ No newline at end of file diff --git a/dashboard/exports/message.d.ts b/dashboard/exports/message.d.ts deleted file mode 100644 index 530a8bc60..000000000 --- a/dashboard/exports/message.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/message/message'; \ No newline at end of file diff --git a/dashboard/exports/message.js b/dashboard/exports/message.js deleted file mode 100644 index cfdc590ea..000000000 --- a/dashboard/exports/message.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/message/message")); \ No newline at end of file diff --git a/dashboard/exports/messages.d.ts b/dashboard/exports/messages.d.ts deleted file mode 100644 index 4c034ca49..000000000 --- a/dashboard/exports/messages.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/messages/messages'; \ No newline at end of file diff --git a/dashboard/exports/messages.js b/dashboard/exports/messages.js deleted file mode 100644 index e7cdbf25f..000000000 --- a/dashboard/exports/messages.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/messages/messages")); \ No newline at end of file diff --git a/dashboard/exports/multiselect.d.ts b/dashboard/exports/multiselect.d.ts deleted file mode 100644 index 7bda86c6b..000000000 --- a/dashboard/exports/multiselect.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/multiselect/multiselect'; \ No newline at end of file diff --git a/dashboard/exports/multiselect.js b/dashboard/exports/multiselect.js deleted file mode 100644 index c0ad550f3..000000000 --- a/dashboard/exports/multiselect.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/multiselect/multiselect")); \ No newline at end of file diff --git a/dashboard/exports/orderlist.d.ts b/dashboard/exports/orderlist.d.ts deleted file mode 100644 index 90edacb80..000000000 --- a/dashboard/exports/orderlist.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/orderlist/orderlist'; \ No newline at end of file diff --git a/dashboard/exports/orderlist.js b/dashboard/exports/orderlist.js deleted file mode 100644 index dc34b4daf..000000000 --- a/dashboard/exports/orderlist.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/orderlist/orderlist")); \ No newline at end of file diff --git a/dashboard/exports/organizationchart.d.ts b/dashboard/exports/organizationchart.d.ts deleted file mode 100644 index 6ea484fbd..000000000 --- a/dashboard/exports/organizationchart.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/organizationchart/organizationchart'; \ No newline at end of file diff --git a/dashboard/exports/organizationchart.js b/dashboard/exports/organizationchart.js deleted file mode 100644 index 707856b17..000000000 --- a/dashboard/exports/organizationchart.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/organizationchart/organizationchart")); \ No newline at end of file diff --git a/dashboard/exports/overlaypanel.d.ts b/dashboard/exports/overlaypanel.d.ts deleted file mode 100644 index b024ecb06..000000000 --- a/dashboard/exports/overlaypanel.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/overlaypanel/overlaypanel'; \ No newline at end of file diff --git a/dashboard/exports/overlaypanel.js b/dashboard/exports/overlaypanel.js deleted file mode 100644 index 9270ed15b..000000000 --- a/dashboard/exports/overlaypanel.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/overlaypanel/overlaypanel")); \ No newline at end of file diff --git a/dashboard/exports/paginator.d.ts b/dashboard/exports/paginator.d.ts deleted file mode 100644 index 786177c39..000000000 --- a/dashboard/exports/paginator.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/paginator/paginator'; \ No newline at end of file diff --git a/dashboard/exports/paginator.js b/dashboard/exports/paginator.js deleted file mode 100644 index f81ca12ae..000000000 --- a/dashboard/exports/paginator.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/paginator/paginator")); \ No newline at end of file diff --git a/dashboard/exports/panel.d.ts b/dashboard/exports/panel.d.ts deleted file mode 100644 index 2d97c4f7a..000000000 --- a/dashboard/exports/panel.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/panel/panel'; \ No newline at end of file diff --git a/dashboard/exports/panel.js b/dashboard/exports/panel.js deleted file mode 100644 index a0ea4b6cb..000000000 --- a/dashboard/exports/panel.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/panel/panel")); \ No newline at end of file diff --git a/dashboard/exports/panelmenu.d.ts b/dashboard/exports/panelmenu.d.ts deleted file mode 100644 index 2fda895ee..000000000 --- a/dashboard/exports/panelmenu.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/panelmenu/panelmenu'; \ No newline at end of file diff --git a/dashboard/exports/panelmenu.js b/dashboard/exports/panelmenu.js deleted file mode 100644 index 4f11922e8..000000000 --- a/dashboard/exports/panelmenu.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/panelmenu/panelmenu")); \ No newline at end of file diff --git a/dashboard/exports/password.d.ts b/dashboard/exports/password.d.ts deleted file mode 100644 index 14befa5e3..000000000 --- a/dashboard/exports/password.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/password/password'; \ No newline at end of file diff --git a/dashboard/exports/password.js b/dashboard/exports/password.js deleted file mode 100644 index f6f08f053..000000000 --- a/dashboard/exports/password.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/password/password")); \ No newline at end of file diff --git a/dashboard/exports/picklist.d.ts b/dashboard/exports/picklist.d.ts deleted file mode 100644 index 00d26f555..000000000 --- a/dashboard/exports/picklist.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/picklist/picklist'; \ No newline at end of file diff --git a/dashboard/exports/picklist.js b/dashboard/exports/picklist.js deleted file mode 100644 index ccb03f180..000000000 --- a/dashboard/exports/picklist.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/picklist/picklist")); \ No newline at end of file diff --git a/dashboard/exports/progressbar.d.ts b/dashboard/exports/progressbar.d.ts deleted file mode 100644 index ec5a777e3..000000000 --- a/dashboard/exports/progressbar.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/progressbar/progressbar'; \ No newline at end of file diff --git a/dashboard/exports/progressbar.js b/dashboard/exports/progressbar.js deleted file mode 100644 index e21a9299f..000000000 --- a/dashboard/exports/progressbar.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/progressbar/progressbar")); \ No newline at end of file diff --git a/dashboard/exports/progressspinner.d.ts b/dashboard/exports/progressspinner.d.ts deleted file mode 100644 index 857379f33..000000000 --- a/dashboard/exports/progressspinner.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/progressspinner/progressspinner'; \ No newline at end of file diff --git a/dashboard/exports/progressspinner.js b/dashboard/exports/progressspinner.js deleted file mode 100644 index 523742c94..000000000 --- a/dashboard/exports/progressspinner.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/progressspinner/progressspinner")); \ No newline at end of file diff --git a/dashboard/exports/radiobutton.d.ts b/dashboard/exports/radiobutton.d.ts deleted file mode 100644 index 8969af7db..000000000 --- a/dashboard/exports/radiobutton.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/radiobutton/radiobutton'; \ No newline at end of file diff --git a/dashboard/exports/radiobutton.js b/dashboard/exports/radiobutton.js deleted file mode 100644 index f99063786..000000000 --- a/dashboard/exports/radiobutton.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/radiobutton/radiobutton")); \ No newline at end of file diff --git a/dashboard/exports/rating.d.ts b/dashboard/exports/rating.d.ts deleted file mode 100644 index 8f352d26b..000000000 --- a/dashboard/exports/rating.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/rating/rating'; \ No newline at end of file diff --git a/dashboard/exports/rating.js b/dashboard/exports/rating.js deleted file mode 100644 index 89a99275f..000000000 --- a/dashboard/exports/rating.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/rating/rating")); \ No newline at end of file diff --git a/dashboard/exports/schedule.d.ts b/dashboard/exports/schedule.d.ts deleted file mode 100644 index 6af565faf..000000000 --- a/dashboard/exports/schedule.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/schedule/schedule'; \ No newline at end of file diff --git a/dashboard/exports/schedule.js b/dashboard/exports/schedule.js deleted file mode 100644 index eaadb03e9..000000000 --- a/dashboard/exports/schedule.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/schedule/schedule")); \ No newline at end of file diff --git a/dashboard/exports/scrollpanel.d.ts b/dashboard/exports/scrollpanel.d.ts deleted file mode 100644 index edb73e68a..000000000 --- a/dashboard/exports/scrollpanel.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/scrollpanel/scrollpanel'; \ No newline at end of file diff --git a/dashboard/exports/scrollpanel.js b/dashboard/exports/scrollpanel.js deleted file mode 100644 index 41986a4b4..000000000 --- a/dashboard/exports/scrollpanel.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/scrollpanel/scrollpanel")); \ No newline at end of file diff --git a/dashboard/exports/selectbutton.d.ts b/dashboard/exports/selectbutton.d.ts deleted file mode 100644 index 2f3e809af..000000000 --- a/dashboard/exports/selectbutton.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/selectbutton/selectbutton'; \ No newline at end of file diff --git a/dashboard/exports/selectbutton.js b/dashboard/exports/selectbutton.js deleted file mode 100644 index 30524f893..000000000 --- a/dashboard/exports/selectbutton.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/selectbutton/selectbutton")); \ No newline at end of file diff --git a/dashboard/exports/shared.d.ts b/dashboard/exports/shared.d.ts deleted file mode 100644 index 80786466f..000000000 --- a/dashboard/exports/shared.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/common/shared'; \ No newline at end of file diff --git a/dashboard/exports/shared.js b/dashboard/exports/shared.js deleted file mode 100644 index 4ae5ca2e6..000000000 --- a/dashboard/exports/shared.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/common/shared")); \ No newline at end of file diff --git a/dashboard/exports/sidebar.d.ts b/dashboard/exports/sidebar.d.ts deleted file mode 100644 index 28aa57888..000000000 --- a/dashboard/exports/sidebar.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/sidebar/sidebar'; \ No newline at end of file diff --git a/dashboard/exports/sidebar.js b/dashboard/exports/sidebar.js deleted file mode 100644 index 65e1457d8..000000000 --- a/dashboard/exports/sidebar.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/sidebar/sidebar")); \ No newline at end of file diff --git a/dashboard/exports/slidemenu.d.ts b/dashboard/exports/slidemenu.d.ts deleted file mode 100644 index 8337e345a..000000000 --- a/dashboard/exports/slidemenu.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/slidemenu/slidemenu'; \ No newline at end of file diff --git a/dashboard/exports/slidemenu.js b/dashboard/exports/slidemenu.js deleted file mode 100644 index 1640a183a..000000000 --- a/dashboard/exports/slidemenu.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/slidemenu/slidemenu")); \ No newline at end of file diff --git a/dashboard/exports/slider.d.ts b/dashboard/exports/slider.d.ts deleted file mode 100644 index daa647ed1..000000000 --- a/dashboard/exports/slider.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/slider/slider'; \ No newline at end of file diff --git a/dashboard/exports/slider.js b/dashboard/exports/slider.js deleted file mode 100644 index 76d0b2629..000000000 --- a/dashboard/exports/slider.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/slider/slider")); \ No newline at end of file diff --git a/dashboard/exports/spinner.d.ts b/dashboard/exports/spinner.d.ts deleted file mode 100644 index ef0c15147..000000000 --- a/dashboard/exports/spinner.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/spinner/spinner'; \ No newline at end of file diff --git a/dashboard/exports/spinner.js b/dashboard/exports/spinner.js deleted file mode 100644 index 5feafe33b..000000000 --- a/dashboard/exports/spinner.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/spinner/spinner")); \ No newline at end of file diff --git a/dashboard/exports/splitbutton.d.ts b/dashboard/exports/splitbutton.d.ts deleted file mode 100644 index 1c84d1712..000000000 --- a/dashboard/exports/splitbutton.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/splitbutton/splitbutton'; \ No newline at end of file diff --git a/dashboard/exports/splitbutton.js b/dashboard/exports/splitbutton.js deleted file mode 100644 index 343d9cc50..000000000 --- a/dashboard/exports/splitbutton.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/splitbutton/splitbutton")); \ No newline at end of file diff --git a/dashboard/exports/steps.d.ts b/dashboard/exports/steps.d.ts deleted file mode 100644 index 2f4735fa7..000000000 --- a/dashboard/exports/steps.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/steps/steps'; \ No newline at end of file diff --git a/dashboard/exports/steps.js b/dashboard/exports/steps.js deleted file mode 100644 index 7119f35d2..000000000 --- a/dashboard/exports/steps.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/steps/steps")); \ No newline at end of file diff --git a/dashboard/exports/table.d.ts b/dashboard/exports/table.d.ts deleted file mode 100644 index c171708f7..000000000 --- a/dashboard/exports/table.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/table/table'; \ No newline at end of file diff --git a/dashboard/exports/table.js b/dashboard/exports/table.js deleted file mode 100644 index cbd8e99ca..000000000 --- a/dashboard/exports/table.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/table/table")); \ No newline at end of file diff --git a/dashboard/exports/tabmenu.d.ts b/dashboard/exports/tabmenu.d.ts deleted file mode 100644 index 3c519f064..000000000 --- a/dashboard/exports/tabmenu.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/tabmenu/tabmenu'; \ No newline at end of file diff --git a/dashboard/exports/tabmenu.js b/dashboard/exports/tabmenu.js deleted file mode 100644 index a76ba2be9..000000000 --- a/dashboard/exports/tabmenu.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/tabmenu/tabmenu")); \ No newline at end of file diff --git a/dashboard/exports/tabview.d.ts b/dashboard/exports/tabview.d.ts deleted file mode 100644 index 7e74bf4f8..000000000 --- a/dashboard/exports/tabview.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/tabview/tabview'; \ No newline at end of file diff --git a/dashboard/exports/tabview.js b/dashboard/exports/tabview.js deleted file mode 100644 index ce6daf5df..000000000 --- a/dashboard/exports/tabview.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/tabview/tabview")); \ No newline at end of file diff --git a/dashboard/exports/terminal.d.ts b/dashboard/exports/terminal.d.ts deleted file mode 100644 index b597ebde8..000000000 --- a/dashboard/exports/terminal.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/terminal/terminal'; \ No newline at end of file diff --git a/dashboard/exports/terminal.js b/dashboard/exports/terminal.js deleted file mode 100644 index 1f5049d3d..000000000 --- a/dashboard/exports/terminal.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/terminal/terminal")); \ No newline at end of file diff --git a/dashboard/exports/tieredmenu.d.ts b/dashboard/exports/tieredmenu.d.ts deleted file mode 100644 index 8781fdda4..000000000 --- a/dashboard/exports/tieredmenu.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/tieredmenu/tieredmenu'; \ No newline at end of file diff --git a/dashboard/exports/tieredmenu.js b/dashboard/exports/tieredmenu.js deleted file mode 100644 index c2920695b..000000000 --- a/dashboard/exports/tieredmenu.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/tieredmenu/tieredmenu")); \ No newline at end of file diff --git a/dashboard/exports/togglebutton.d.ts b/dashboard/exports/togglebutton.d.ts deleted file mode 100644 index eec3875eb..000000000 --- a/dashboard/exports/togglebutton.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/togglebutton/togglebutton'; \ No newline at end of file diff --git a/dashboard/exports/togglebutton.js b/dashboard/exports/togglebutton.js deleted file mode 100644 index 78f25a189..000000000 --- a/dashboard/exports/togglebutton.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/togglebutton/togglebutton")); \ No newline at end of file diff --git a/dashboard/exports/toolbar.d.ts b/dashboard/exports/toolbar.d.ts deleted file mode 100644 index 35b9790fd..000000000 --- a/dashboard/exports/toolbar.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/toolbar/toolbar'; \ No newline at end of file diff --git a/dashboard/exports/toolbar.js b/dashboard/exports/toolbar.js deleted file mode 100644 index 88b5112fa..000000000 --- a/dashboard/exports/toolbar.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/toolbar/toolbar")); \ No newline at end of file diff --git a/dashboard/exports/tooltip.d.ts b/dashboard/exports/tooltip.d.ts deleted file mode 100644 index b188f0d2d..000000000 --- a/dashboard/exports/tooltip.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/tooltip/tooltip'; \ No newline at end of file diff --git a/dashboard/exports/tooltip.js b/dashboard/exports/tooltip.js deleted file mode 100644 index 270701079..000000000 --- a/dashboard/exports/tooltip.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/tooltip/tooltip")); \ No newline at end of file diff --git a/dashboard/exports/tree.d.ts b/dashboard/exports/tree.d.ts deleted file mode 100644 index c6c79854d..000000000 --- a/dashboard/exports/tree.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/tree/tree'; \ No newline at end of file diff --git a/dashboard/exports/tree.js b/dashboard/exports/tree.js deleted file mode 100644 index 2f111e9ab..000000000 --- a/dashboard/exports/tree.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/tree/tree")); \ No newline at end of file diff --git a/dashboard/exports/treetable.d.ts b/dashboard/exports/treetable.d.ts deleted file mode 100644 index 3e3ce3e46..000000000 --- a/dashboard/exports/treetable.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/treetable/treetable'; \ No newline at end of file diff --git a/dashboard/exports/treetable.js b/dashboard/exports/treetable.js deleted file mode 100644 index c1eb56bba..000000000 --- a/dashboard/exports/treetable.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/treetable/treetable")); \ No newline at end of file diff --git a/dashboard/exports/tristatecheckbox.d.ts b/dashboard/exports/tristatecheckbox.d.ts deleted file mode 100644 index 70e6e5065..000000000 --- a/dashboard/exports/tristatecheckbox.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './components/tristatecheckbox/tristatecheckbox'; \ No newline at end of file diff --git a/dashboard/exports/tristatecheckbox.js b/dashboard/exports/tristatecheckbox.js deleted file mode 100644 index 68ec104a4..000000000 --- a/dashboard/exports/tristatecheckbox.js +++ /dev/null @@ -1,7 +0,0 @@ -/* Shorthand */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./components/tristatecheckbox/tristatecheckbox")); \ No newline at end of file diff --git a/dashboard/gulpfile.js b/dashboard/gulpfile.js deleted file mode 100644 index a2eb160dd..000000000 --- a/dashboard/gulpfile.js +++ /dev/null @@ -1,62 +0,0 @@ -'use strict'; - -var gulp = require('gulp'), - concat = require('gulp-concat'), - uglifycss = require('gulp-uglifycss'), - rename = require('gulp-rename'), - del = require('del'), - flatten = require('gulp-flatten'); - -gulp.task('build-css', function() { - gulp.src([ - 'src/app/components/common/common.scss', - 'src/app/components/**/*.css' - ]) - .pipe(concat('primeng.css')) - .pipe(gulp.dest('resources')); -}); - -gulp.task('build-css-prod', function() { - gulp.src([ - 'src/app/components/common/common.scss', - 'src/app/components/**/*.css' - ]) - .pipe(concat('primeng.css')) - .pipe(gulp.dest('resources')) - .pipe(uglifycss({"uglyComments": true})) - .pipe(rename('primeng.min.css')) - .pipe(gulp.dest('resources')); -}); - -gulp.task('copy-component-css', function () { - gulp.src([ - 'src/app/components/**/*.css' - ]) - .pipe(gulp.dest('resources/components')); -}); - -gulp.task('images', function() { - return gulp.src(['src/app/components/**/images/*.png', 'src/app/components/**/images/*.gif']) - .pipe(flatten()) - .pipe(gulp.dest('resources/images')); -}); - -gulp.task('themes', function() { - return gulp.src(['src/assets/components/themes/**/*']) - .pipe(gulp.dest('resources/themes')); -}); - -gulp.task('build-exports', function() { - return gulp.src(['exports/*.js','exports/*.d.ts']) - .pipe(gulp.dest('./')); -}); - -//Cleaning previous gulp tasks from project -gulp.task('clean', function() { - del(['resources']); -}); - -//Building project with run sequence -gulp.task('build-assets', ['clean','copy-component-css', 'build-css-prod', 'images', 'themes']); - - \ No newline at end of file diff --git a/dashboard/image_builder.sh b/dashboard/image_builder.sh deleted file mode 100644 index d7b2b9acb..000000000 --- a/dashboard/image_builder.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2018 Huawei Technologies Co., Ltd. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -if [[ "X$1" == "X--rebuild" ]]; then - npm rebuild node-sass --force -fi - -npm install --unsafe-perm -g @angular/cli@1.7.4 -npm install --unsafe-perm -ng build --prod - -cp -R ./dist/* /var/www/html/ - -cat > /etc/nginx/sites-available/default < - - - - - -
-
- - - - - -
- -
-
- -
-
-
\ No newline at end of file diff --git a/dashboard/src/app/app.component.ts b/dashboard/src/app/app.component.ts deleted file mode 100644 index 42a8b561b..000000000 --- a/dashboard/src/app/app.component.ts +++ /dev/null @@ -1,445 +0,0 @@ -import { Component, OnInit, ViewContainerRef, ViewChild, Directive, ElementRef, HostBinding, HostListener, AfterViewInit } from '@angular/core'; -import { Http } from '@angular/http'; -import { Router } from '@angular/router'; -import { I18NService, Consts, ParamStorService } from 'app/shared/api'; -// import { AppService } from 'app/app.service'; -import { I18nPluralPipe } from '@angular/common'; -import { MenuItem, SelectItem } from './components/common/api'; - -@Component({ - selector: 'app-root', - templateUrl: './app.component.html', - styleUrls: [] -}) -export class AppComponent implements OnInit, AfterViewInit{ - chromeBrowser: boolean = false; - - isLogin: boolean; - - hideLoginForm: boolean = false; - - linkUrl = ""; - - username: string; - - password: string; - - dropMenuItems: MenuItem[]; - - currentTenant: string=""; - - showLoginAnimation: boolean=false; - - showLogoutAnimation: boolean=false; - currentTime=new Date().getTime(); - lastTime=new Date().getTime(); - minExpireTime = 2 * 60 * 1000; - advanceRefreshTime = 1*60*1000; - defaultExpireTime = 10*60*1000; - interval:any; - intervalRefreshToken:any; - showErrorMsg:boolean=false; - errorMsg:string=""; - - tenantItems = []; - - menuItems = []; - - menuItems_tenant = [ - { - "title": "Home", - "description": "Resources statistics", - "routerLink": "/home" - }, - { - "title": "Volume", - "description": "Block storage resources", - "routerLink": "/block" - } - ] - - menuItems_admin = [ - { - "title": "Home", - "description": "Resources statistics", - "routerLink": "/home" - }, - { - "title": "Volume", - "description": "Block storage resources", - "routerLink": "/block" - }, - // { - // "title": "Multi-Cloud Service", - // "description": "5 replications, 1 migrations", - // "routerLink": "/cloud" - // }, - { - "title": "Profile", - "description": "Block profiles", - "routerLink": "/profile" - }, - { - "title": "Resource", - "description": "Regions, availability zones and storages", - "routerLink": "/resource" - }, - { - "title": "Identity", - "description": "Managing tenants and users", - "routerLink": "/identity" - } - ]; - - activeItem: any; - - private msgs: any = [{ severity: 'warn', summary: 'Warn Message', detail: 'There are unsaved changes'}]; - - constructor( - private el: ElementRef, - private viewContainerRef: ViewContainerRef, - private http: Http, - private router: Router, - private paramStor: ParamStorService, - public I18N: I18NService - ){} - - ngOnInit() { - let currentUserInfo = this.paramStor.CURRENT_USER(); - if(currentUserInfo != undefined && currentUserInfo != ""){ - this.hideLoginForm = true; - - let [username, userid, tenantname, tenantid] = [ - this.paramStor.CURRENT_USER().split("|")[0], - this.paramStor.CURRENT_USER().split("|")[1], - this.paramStor.CURRENT_TENANT().split("|")[0], - this.paramStor.CURRENT_TENANT().split("|")[1] ]; - this.AuthWithTokenScoped({'name': username, 'id': userid}); - }else{ - this.isLogin = false; - this.hideLoginForm = false; - } - } - checkTimeOut(){ - this.currentTime = new Date().getTime(); //update current time - let timeout = this.paramStor.TOKEN_PERIOD() ? this.paramStor.TOKEN_PERIOD() : this.defaultExpireTime; - if(this.currentTime - this.lastTime > timeout){ //check time out - this.logout(); - } - } - refreshLastTime(){ - this.lastTime = new Date().getTime(); - } - /** - * this function must be called after AuthWithTokenScoped succeed ,because it need username and password - */ - refreshToken(){ - let request: any = { auth: {} }; - request.auth = { - "identity": { - "methods": [ - "password" - ], - "password":{ - "user": { - "name": this.paramStor.CURRENT_USER().split("|")[0], - "domain": { - "name": "Default" - }, - "password": this.paramStor.PASSWORD() - } - } - } - } - - this.http.post("/v3/auth/tokens", request).subscribe((res)=>{ - let token_id = res.headers.get('x-subject-token'); - let projectName = this.paramStor.CURRENT_TENANT().split("|")[0]; - let req: any = { auth: {} }; - req.auth = { - "identity": { - "methods": [ - "token" - ], - "token": { - "id": token_id - } - }, - "scope": { - "project": { - "name": projectName, - "domain": { "id": "default" } - } - } - } - - this.http.post("/v3/auth/tokens", req).subscribe((r)=>{ - this.paramStor.AUTH_TOKEN( r.headers.get('x-subject-token') ); - }); - }, - error=>{ - console.log("Username or password incorrect.") - }); - } - ngAfterViewInit(){ - this.loginBgAnimation(); - } - - loginBgAnimation(){ - let obj =this.el.nativeElement.querySelector(".login-bg"); - if(obj){ - let obj_w = obj.clientWidth; - let obj_h = obj.clientHeight; - let dis = 50; - obj.addEventListener("mousemove", (e)=>{ - let MX = e.clientX; - let MY = e.clientY; - let offsetX = (obj_w - 2258)*0.5 + (obj_w-MX)*dis / obj_w; - let offsetY = (obj_h - 1363)*0.5 + (obj_h-MY)*dis / obj_h; - obj.style.backgroundPositionX = offsetX +"px"; - obj.style.backgroundPositionY = offsetY +"px"; - }) - } - } - - login() { - let request: any = { auth: {} }; - request.auth = { - "identity": { - "methods": [ - "password" - ], - "password":{ - "user": { - "name": this.username, - "domain": { - "name": "Default" - }, - "password": this.password - } - } - } - } - - this.http.post("/v3/auth/tokens", request).subscribe((res)=>{ - //set token period start - let token = res.json().token; - let expires_at = token.expires_at; - let issued_at = token.issued_at; - let tokenPeriod = Date.parse(expires_at) - Date.parse(issued_at); - if(tokenPeriod >= this.minExpireTime){ - this.paramStor.TOKEN_PERIOD(tokenPeriod); - } - //set token period end - this.paramStor.AUTH_TOKEN(res.headers.get('x-subject-token')); - this.paramStor.PASSWORD(this.password); - let user = res.json().token.user; - this.AuthWithTokenScoped(user); - this.showErrorMsg = false; - }, - error=>{ - switch(error.status){ - case 401: - this.errorMsg = this.I18N.keyID['sds_login_error_msg_401']; - break; - case 503: - this.errorMsg = this.I18N.keyID['sds_login_error_msg_503']; - break; - default: - this.errorMsg = this.I18N.keyID['sds_login_error_msg_default']; - } - this.showErrorMsg = true; - }); - } - - AuthWithTokenScoped(user, tenant?){ - if(this.interval){ - clearInterval(this.interval); - } - this.lastTime=new Date().getTime(); - this.interval = window.setInterval(()=>{ - this.checkTimeOut() - }, 10000); - // Get user owned tenants - let reqUser: any = { params:{} }; - this.http.get("/v3/users/"+ user.id +"/projects", reqUser).subscribe((objRES) => { - let projects = objRES.json().projects; - let defaultProject = user.name != 'admin' ? projects[0] : projects.filter((project) => { return project.name == 'admin'})[0]; - let project = tenant===undefined ? defaultProject : tenant; - - this.tenantItems = []; - projects.map(item => { - let tenantItemObj = {}; - tenantItemObj["label"] = item.name; - tenantItemObj["command"] = ()=>{ - let username = this.paramStor.CURRENT_USER().split("|")[0]; - let userid = this.paramStor.CURRENT_USER().split("|")[1]; - this.AuthWithTokenScoped({'name': username, 'id': userid}, item); - }; - this.tenantItems.push(tenantItemObj); - }) - - // Get token authentication with scoped - let token_id = this.paramStor.AUTH_TOKEN(); - let req: any = { auth: {} }; - req.auth = { - "identity": { - "methods": [ - "token" - ], - "token": { - "id": token_id - } - }, - "scope": { - "project": { - "name": project.name, - "domain": { "id": "default" } - } - } - } - - this.http.post("/v3/auth/tokens", req).subscribe((r)=>{ - this.paramStor.AUTH_TOKEN( r.headers.get('x-subject-token') ); - this.paramStor.CURRENT_TENANT(project.name + "|" + project.id); - this.paramStor.CURRENT_USER(user.name + "|"+ user.id); - - this.username = this.paramStor.CURRENT_USER().split("|")[0]; - this.currentTenant = this.paramStor.CURRENT_TENANT().split("|")[0]; - - if(this.username == "admin"){ - this.menuItems = this.menuItems_admin; - this.dropMenuItems = [ - { - label: "Switch Region", - items: [{ label: "default_region", command:()=>{} }] - }, - { - label: "Logout", - command:()=>{ this.logout() } - } - ]; - }else{ - this.menuItems = this.menuItems_tenant; - this.dropMenuItems = [ - { - label: "Switch Region", - items: [{ label: "default_region", command:()=>{} }] - }, - { - label: "Switch Tenant", - items: this.tenantItems - }, - { - label: "Logout", - command:()=>{ this.logout() } - } - ]; - } - - this.isLogin = true; - this.router.navigateByUrl("home"); - this.activeItem = this.menuItems[0]; - - // annimation for after login - this.showLoginAnimation = true; - setTimeout(() => { - this.showLoginAnimation = false; - this.hideLoginForm = true; - }, 500); - if(this.intervalRefreshToken){ - clearInterval(this.intervalRefreshToken); - } - let tokenPeriod = this.paramStor.TOKEN_PERIOD(); - let refreshTime = tokenPeriod ? (Number(tokenPeriod) - this.advanceRefreshTime) : this.defaultExpireTime; - this.intervalRefreshToken = window.setInterval(()=>{ - this.refreshToken() - },refreshTime); - }) - }, - error => { - this.logout(); - }) - } - - logout() { - this.paramStor.AUTH_TOKEN(""); - this.paramStor.CURRENT_USER(""); - this.paramStor.CURRENT_TENANT(""); - this.paramStor.PASSWORD(""); - this.paramStor.TOKEN_PERIOD(""); - if(this.interval){ - clearInterval(this.interval); - } - if(this.intervalRefreshToken){ - clearInterval(this.intervalRefreshToken); - } - // annimation for after logout - this.hideLoginForm = false; - this.showLogoutAnimation = true; - setTimeout(() => { - this.showLogoutAnimation = false; - this.username = ""; - this.password = ""; - this.isLogin = false; - }, 500); - - } - - onKeyDown(e) { - let keycode = window.event ? e.keyCode : e.which; - if(keycode == 13){ - this.login(); - } - } - - menuItemClick(event, item) { - this.activeItem = item; - } - - supportCurrentBrowser(){ - let ie, - firefox, - safari, - chrome, - cIE = 11, - cFirefox = 40, - cChrome = 40; - let ua = navigator.userAgent.toLowerCase(); - let isLinux = (ua.indexOf('linux') >= 0); - - if(this.isIE()) { - if(ua.indexOf('msie') >= 0) { - ie = this.getSys(ua.match(/msie ([\d]+)/)); - } else { - ie = this.getSys(ua.match(/trident.*rv:([\d]+)/)); - } - }else if(navigator.userAgent.indexOf("Firefox") > 0){ - firefox = this.getSys(ua.match(/firefox\/([\d]+)/)); - }else if(ua.indexOf("safari") != -1 && !(ua.indexOf("chrome") != -1)) { - safari = this.getSys(ua.match(/version\/([\d]+)/)); - }else if(ua.indexOf("chrome") != -1) { - chrome = this.getSys(ua.match(/chrome\/([\d]+)/)); - } - - if ((firefox) / 1 < cFirefox || (chrome) / 1 < cChrome || (ie) / 1 < cIE) { - return true; - } - - return false; - } - - isIE() { - return navigator.userAgent.toLowerCase().indexOf('trident') >= 0; - } - - getSys (browserVersionArr) { - if( !browserVersionArr) { - return 0; - } else if( browserVersionArr.length < 2) { - return 0; - } else { - return browserVersionArr[1]; - } - } -} diff --git a/dashboard/src/app/app.module.ts b/dashboard/src/app/app.module.ts deleted file mode 100644 index 058c62394..000000000 --- a/dashboard/src/app/app.module.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { BrowserModule } from '@angular/platform-browser'; -import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; -import { CommonModule } from '@angular/common'; -import { NgModule, APP_INITIALIZER } from '@angular/core'; -import { HttpModule } from "@angular/http"; -import { AppRoutingModule } from './app-routing.module'; -import { AppComponent } from './app.component'; -import { SharedModule } from './shared/shared.module'; -import { DropMenuModule, SelectButtonModule, ButtonModule, InputTextModule } from './components/common/api'; -// import { AppService } from './app.service'; -import { LocationStrategy, HashLocationStrategy } from '@angular/common'; - -import { MessagesModule } from './components/messages/messages'; - -@NgModule({ - declarations: [ - AppComponent - ], - imports: [ - BrowserModule, - CommonModule, - AppRoutingModule, - MessagesModule, - HttpModule, - BrowserAnimationsModule, - SharedModule.forRoot(), - DropMenuModule, - SelectButtonModule, - ButtonModule, - InputTextModule - ], - providers: [ - // AppService, - { provide: LocationStrategy, useClass: HashLocationStrategy } - ], - bootstrap: [AppComponent] -}) -export class AppModule { } \ No newline at end of file diff --git a/dashboard/src/app/app.service.ts b/dashboard/src/app/app.service.ts deleted file mode 100644 index 886b4f82e..000000000 --- a/dashboard/src/app/app.service.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Injectable, Output, EventEmitter } from '@angular/core'; -import { Http } from '@angular/http'; - -@Injectable() -export class AppService { - constructor(private http: Http){} - - @Output() onHeaderTitleChange = new EventEmitter(); - - changeHeaderTitle(){ - this.onHeaderTitleChange.emit(); - } - - logOut(){ - // return this.http.get("v1/portal/logout"); - } - -} \ No newline at end of file diff --git a/dashboard/src/app/business/block/block.component.ts b/dashboard/src/app/business/block/block.component.ts deleted file mode 100644 index ad96bc7c9..000000000 --- a/dashboard/src/app/business/block/block.component.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { Router,ActivatedRoute } from '@angular/router'; -import { Component, OnInit, ViewContainerRef, ViewChild, Directive, ElementRef, HostBinding, HostListener } from '@angular/core'; -import { I18NService } from 'app/shared/api'; -import { AppService } from 'app/app.service'; -import { trigger, state, style, transition, animate} from '@angular/animations'; -import { I18nPluralPipe } from '@angular/common'; - -@Component({ - templateUrl: './block.html', - styleUrls: [], - animations: [ - trigger('overlayState', [ - state('hidden', style({ - opacity: 0 - })), - state('visible', style({ - opacity: 1 - })), - transition('visible => hidden', animate('400ms ease-in')), - transition('hidden => visible', animate('400ms ease-out')) - ]), - - trigger('notificationTopbar', [ - state('hidden', style({ - height: '0', - opacity: 0 - })), - state('visible', style({ - height: '*', - opacity: 1 - })), - transition('visible => hidden', animate('400ms ease-in')), - transition('hidden => visible', animate('400ms ease-out')) - ]) - ] -}) -export class BlockComponent implements OnInit{ - fromGroup:boolean=false; - constructor( - public I18N: I18NService, - private router: Router, - private ActivatedRoute:ActivatedRoute - ){} - - ngOnInit() { - this.ActivatedRoute.params.subscribe( - (params) => this.fromGroup = !!params.fromRoute - ); - } - -} diff --git a/dashboard/src/app/business/block/block.html b/dashboard/src/app/business/block/block.html deleted file mode 100644 index 95616263b..000000000 --- a/dashboard/src/app/business/block/block.html +++ /dev/null @@ -1,14 +0,0 @@ - - -
-

{{I18N.keyID['sds_block_volumes_descrip']}}

-
- -
- -
-

{{I18N.keyID['sds_block_volumesGroup_descrip']}}

-
- -
-
diff --git a/dashboard/src/app/business/block/block.module.ts b/dashboard/src/app/business/block/block.module.ts deleted file mode 100644 index 9a52e7f0f..000000000 --- a/dashboard/src/app/business/block/block.module.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { NgModule, APP_INITIALIZER } from '@angular/core'; -import { BlockComponent } from './block.component'; -import { RouterModule } from '@angular/router'; -import { TabViewModule, ButtonModule } from '../../components/common/api'; -import { VolumeListModule } from './volumeList.module'; -import { VolumeGroupModule } from './volumeGroup.module'; -import { CreateVolumeGroupComponent } from './create-volume-group/create-volume-group.component'; - -let routers = [{ - path: '', - component: BlockComponent -}] - -@NgModule({ - declarations: [ - BlockComponent, - CreateVolumeGroupComponent - ], - imports: [ - RouterModule.forChild(routers), - VolumeListModule, - VolumeGroupModule, - TabViewModule, - ButtonModule - ], - providers: [] -}) -export class BlockModule { } \ No newline at end of file diff --git a/dashboard/src/app/business/block/create-volume-group/create-volume-group.component.html b/dashboard/src/app/business/block/create-volume-group/create-volume-group.component.html deleted file mode 100644 index 86859275d..000000000 --- a/dashboard/src/app/business/block/create-volume-group/create-volume-group.component.html +++ /dev/null @@ -1,3 +0,0 @@ -

- create-volume-group works! -

diff --git a/dashboard/src/app/business/block/create-volume-group/create-volume-group.component.ts b/dashboard/src/app/business/block/create-volume-group/create-volume-group.component.ts deleted file mode 100644 index 0c714bf6f..000000000 --- a/dashboard/src/app/business/block/create-volume-group/create-volume-group.component.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Component, OnInit } from '@angular/core'; - -@Component({ - selector: 'app-create-volume-group', - templateUrl: './create-volume-group.component.html', - styleUrls: [ - - ] -}) -export class CreateVolumeGroupComponent implements OnInit { - - constructor() { } - - ngOnInit() { - } - -} diff --git a/dashboard/src/app/business/block/create-volume/create-volume.component.html b/dashboard/src/app/business/block/create-volume/create-volume.component.html deleted file mode 100644 index 784ac2f46..000000000 --- a/dashboard/src/app/business/block/create-volume/create-volume.component.html +++ /dev/null @@ -1,92 +0,0 @@ -
-

{{i18n.keyID['sds_block_volume_createVol']}}

-

{{i18n.keyID['sds_block_volume_createVol_desc']}}

-
- -
- - - - -
-
-
- *{{label.name}}: -
-
- *{{label.profile}}: -
-
- *{{label.capacity}}: -
-
- {{label.quantity}}: -
-
- -
-
- -
-
- - - {{getErrorMessage(volumeform.controls['name'+i],"name")}} - -
-
-
-
- -
-
- - - {{getErrorMessage(volumeform.controls['profileId'+i],"profile")}} - -
-
-
-
-
- - -
-
-
- - - {{getErrorMessage(volumeform.controls['size'+i],"Capacity")}} - -
-
-
-
- -
-
- -
-
- - - -
- -
- -
- -
-
-
- - - -
-
diff --git a/dashboard/src/app/business/block/create-volume/create-volume.component.ts b/dashboard/src/app/business/block/create-volume/create-volume.component.ts deleted file mode 100644 index 39e5363e0..000000000 --- a/dashboard/src/app/business/block/create-volume/create-volume.component.ts +++ /dev/null @@ -1,274 +0,0 @@ -import { Component, OnInit } from '@angular/core'; -import { Router } from '@angular/router'; -import { trigger, state, style, transition, animate } from '@angular/animations'; -import { Validators, FormControl, FormGroup, FormBuilder } from '@angular/forms'; - -import { Message, SelectItem } from './../../../components/common/api'; - -import { VolumeService ,ReplicationService} from './../volume.service'; -import { ProfileService } from './../../profile/profile.service'; -import { AvailabilityZonesService } from './../../resource/resource.service'; -import { I18NService,Utils } from 'app/shared/api'; - -@Component({ - selector: 'app-create-volume', - templateUrl: './create-volume.component.html', - styleUrls: [ - - ], - animations: [ - trigger('overlayState', [ - state('hidden', style({ - opacity: 0 - })), - state('visible', style({ - opacity: 1 - })), - transition('visible => hidden', animate('400ms ease-in')), - transition('hidden => visible', animate('400ms ease-out')) - ]), - - trigger('notificationTopbar', [ - state('hidden', style({ - height: '0', - opacity: 0 - })), - state('visible', style({ - height: '*', - opacity: 1 - })), - transition('visible => hidden', animate('400ms ease-in')), - transition('hidden => visible', animate('400ms ease-out')) - ]) - ] -}) -export class CreateVolumeComponent implements OnInit { - - label = { - zone: this.i18n.keyID["sds_block_volume_az"], - name: this.i18n.keyID["sds_block_volume_name"], - profile: this.i18n.keyID["sds_block_volume_profile"], - capacity: this.i18n.keyID["sds_home_capacity"], - quantity: this.i18n.keyID["sds_block_volume_quantity"] - }; - availabilityZones = []; - volumeform; - volumeItems = [0]; - capacityUnit = []; - profileOptions = []; - capacity = 'GB'; - createVolumes = []; - value: boolean; - showReplicationConf = false; - errorMessage = { - "zone": { required: "Zone is required."} - }; - validRule= { - 'name':'^[a-zA-Z]{1}([a-zA-Z0-9]|[_]){0,127}$' - }; - defaultProfile = { - label: null, - value: {id:null,profileName:null} - }; - constructor( - private router: Router, - private fb: FormBuilder, - private ProfileService: ProfileService, - private VolumeService: VolumeService, - private replicationService:ReplicationService, - private availabilityZonesService:AvailabilityZonesService, - public i18n:I18NService - ) {} - - ngOnInit() { - this.getAZ(); - this.getProfiles(); - - this.capacityUnit = [ - { - label: 'GB', value: 'GB' - }, - { - label: 'TB', value: 'TB' - } - ]; - this.volumeform = this.fb.group({ - 'zone': new FormControl('', Validators.required), - 'name0': new FormControl('', {validators:[Validators.required,Validators.pattern(this.validRule.name)]}), - 'profileId0': new FormControl(this.defaultProfile, {validators:[Validators.required,this.checkProfile]}), - 'size0': new FormControl(1, Validators.required), - 'capacity0': new FormControl(''), - 'quantity0': new FormControl(1) - }); - this.volumeform.valueChanges.subscribe( - (value:string)=>{ - this.createVolumes = this.getVolumesDataArray(this.volumeform.value); - this.setRepForm(); - } - ); - this.createVolumes = this.getVolumesDataArray(this.volumeform.value); - this.setRepForm(); - } - - addVolumeItem() { - this.volumeItems.push( - this.volumeItems[this.volumeItems.length-1] + 1 - ); - this.volumeItems.forEach(index => { - if(index !== 0){ - this.volumeform.addControl('name'+index, this.fb.control('', Validators.required)); - this.volumeform.addControl('profileId'+index, this.fb.control(this.defaultProfile,Validators.required)); - this.volumeform.addControl('size'+index, this.fb.control(1, Validators.required)); - this.volumeform.addControl('capacity'+index, this.fb.control('GB', Validators.required)); - this.volumeform.addControl('quantity'+index, this.fb.control(1)); - } - }); - } - getAZ(){ - this.availabilityZonesService.getAZ().subscribe((azRes) => { - let AZs=azRes.json(); - let azArr = []; - if(AZs && AZs.length !== 0){ - AZs.forEach(item =>{ - let obj = {label: item, value: item}; - azArr.push(obj); - }) - } - this.availabilityZones = azArr; - }) - } - getProfiles() { - this.ProfileService.getProfiles().subscribe((res) => { - let profiles = res.json(); - profiles.forEach(profile => { - this.profileOptions.push({ - label: profile.name, - value: {id:profile.id,profileName:profile.name} - }); - }); - }); - } - - deleteVolumeItem(index) { - this.volumeItems.splice(index, 1); - this.volumeform.removeControl('name'+index); - this.volumeform.removeControl('profileId'+index); - this.volumeform.removeControl('size'+index); - this.volumeform.removeControl('capacity'+index); - this.volumeform.removeControl('quantity'+index); - } - - createVolume(param){ - this.VolumeService.createVolume(param).subscribe((res) => { - this.router.navigate(['/block']); - }); - } - createVolumeAndReplication(volParam,repParam){ - this.VolumeService.createVolume(volParam).subscribe((res2) => { - this.VolumeService.createVolume(repParam).subscribe((res) => { - let param = { - "name":res.json().name , - "primaryVolumeId": res2.json().id, - "availabilityZone": res.json().availabilityZone, - "profileId": res.json().profileId, - "replicationMode":"async", - "replicationPeriod":this.createVolumes["formGroup"].value.period, - "secondaryVolumeId":res.json().id - } - this.replicationService.createReplication(param).subscribe((res) => {}); - this.router.navigate(['/block']); - }); - }); - } - onSubmit(value) { - if(!this.volumeform.valid){ - for(let i in this.volumeform.controls){ - this.volumeform.controls[i].markAsTouched(); - } - return; - } - if(this.showReplicationConf && !this.createVolumes["formGroup"].valid){ - for(let i in this.createVolumes["formGroup"].controls){ - this.createVolumes["formGroup"].controls[i].markAsTouched(); - } - return; - } - let dataArr = this.getVolumesDataArray(value); - let volumeData = []; - dataArr.forEach(item => { - volumeData.push({ - name: item.name, - size: item.size, - availabilityZone: item.availabilityZone, - profileId: item.profile.id - }); - }); - for(let i in volumeData){ - if(this.showReplicationConf){ - let repVolume = { - name:null, - profileId:null, - availabilityZone: null - }; - Object.assign(repVolume,volumeData[i]); - repVolume.name = this.createVolumes["formGroup"].value["name"+i]; - repVolume.profileId = this.createVolumes["formGroup"].value["profileId"+i]; - repVolume.availabilityZone = "secondary"; - this.createVolumeAndReplication(volumeData[i],repVolume); - }else{ - this.createVolume(volumeData[i]); - } - } - } - getVolumesDataArray(value){ - let dataArr = []; - this.volumeItems.forEach(index => { - if(!value['capacity'+index]){ - value['capacity'+index]='GB'; - } - let unit = value['capacity'+index]==='GB' ? 1 : 1024; - let qunantity = value['quantity'+index]; - if(qunantity && qunantity !== 1){ - for(let i=0;i - -
- {{I18N.keyID['sds_block_volume_rep_pair']}} -
-
-
-
-
-
-
-
-
-
- -
- - {{volumes.length!=0 ? volumes[0].availabilityZone:''}} -
-
-
-
-
-
- -
-
- -
-
- -
-
-
-
-
-
-
-
- {{I18N.keyID['sds_profile_rep_period']}} - = - - {{I18N.keyID['sds_profile_unit_minutes']}} -
- -
-
-
-
- -
-
-
-
-
-
-
-
- -
- - - -
-
-
-
-
-
- -
-
- -
-
- - ProfileId is required -
-
-
-
-
-
-
-
-
-
- diff --git a/dashboard/src/app/business/block/create-volume/replication-group/replication-group.component.ts b/dashboard/src/app/business/block/create-volume/replication-group/replication-group.component.ts deleted file mode 100644 index 3cc275e04..000000000 --- a/dashboard/src/app/business/block/create-volume/replication-group/replication-group.component.ts +++ /dev/null @@ -1,111 +0,0 @@ -import { Component, OnInit,Input,Output,EventEmitter} from '@angular/core'; -import { trigger, state, style, transition, animate } from '@angular/animations'; - -import { ProfileService } from './../../../profile/profile.service'; -import {FormBuilder, FormControl, Validators} from "@angular/forms"; -import { I18NService,Utils } from 'app/shared/api'; - -@Component({ - selector: 'app-replication-group', - templateUrl: './replication-group.component.html', - styleUrls: [ - - ], - animations: [ - trigger('overlayState', [ - state('hidden', style({ - opacity: 0 - })), - state('visible', style({ - opacity: 1 - })), - transition('visible => hidden', animate('400ms ease-in')), - transition('hidden => visible', animate('400ms ease-out')) - ]), - - trigger('notificationTopbar', [ - state('hidden', style({ - height: '0', - opacity: 0 - })), - state('visible', style({ - height: '*', - opacity: 1 - })), - transition('visible => hidden', animate('400ms ease-in')), - transition('hidden => visible', animate('400ms ease-out')) - ]) - ] -}) -export class ReplicationGroupComponent implements OnInit { - groupOptions = []; - createOrExist = 'createGroup'; - existingGroupLists = []; - replicationEnable:boolean; - @Input() volumes:any; - @Output() checkParam = new EventEmitter(); - period = 60; - selectedProfile; - availabilityZone=[]; - profileOptions = [ - { - label: 'Select Profile', - value: null - } - ]; - - constructor( - private ProfileService: ProfileService, - private fb: FormBuilder, - public I18N:I18NService - ) { } - - ngOnInit() { - this.groupOptions = [ - { - label: 'Create Group', - value: 'createGroup' - }, - { - label: 'Add to Existing Group', - value: 'existingGroup' - } - ]; - this.availabilityZone = [ - { - label: 'Secondary', value: 'secondary' - } - ]; - this.getProfiles(); - } - - getReplicationGroup(){ - if(this.createOrExist==='existingGroup'){ - this.existingGroupLists = [ - { - label: 'group_for_REP', - value: 'group_for_REP_id1' - }, - { - label: 'group_for_REP', - value: 'group_for_REP_id2' - } - ] - } - } - - getProfiles() { - this.ProfileService.getProfiles().subscribe((res) => { - let profiles = res.json(); - profiles.forEach(profile => { - this.profileOptions.push({ - label: profile.name, - value: profile.id - }); - }); - }); - } - checkParamSubmit(){ - this.checkParam.emit(false); - } -} diff --git a/dashboard/src/app/business/block/volume-detail/replication-list/replication-list.component.html b/dashboard/src/app/business/block/volume-detail/replication-list/replication-list.component.html deleted file mode 100644 index e19f19af8..000000000 --- a/dashboard/src/app/business/block/volume-detail/replication-list/replication-list.component.html +++ /dev/null @@ -1,71 +0,0 @@ -
-
-
- - - - -
-
-
-
-
-
-
-
-
- -
-
-
{{volume.name}}
-
-
- - default -
-
-
-
-
-
-
-
-
- {{I18N.keyID['sds_profile_rep_period']}} - = - - {{periodControl.value}} - {{I18N.keyID['sds_profile_unit_minutes']}} - -
-
-
{{replication['replicationStatus']}}
-
-
-
-
-
-
-
-
-
- -
-
-
{{replication.name}}
-
-
- - secondary -
-
-
-
-
-
-
-
-
- no data available -
- diff --git a/dashboard/src/app/business/block/volume-detail/replication-list/replication-list.component.ts b/dashboard/src/app/business/block/volume-detail/replication-list/replication-list.component.ts deleted file mode 100644 index 6cb0c20b5..000000000 --- a/dashboard/src/app/business/block/volume-detail/replication-list/replication-list.component.ts +++ /dev/null @@ -1,241 +0,0 @@ -import {Component, Input, OnInit} from '@angular/core'; -import { I18NService } from 'app/shared/api'; -import { VolumeService ,ReplicationService} from './../../volume.service'; -import { ConfirmationService,ConfirmDialogModule} from '../../../../components/common/api'; -import { FormControl, FormGroup, FormBuilder, Validators, ValidatorFn, AbstractControl } from '@angular/forms'; - -@Component({ - selector: 'app-replication-list', - templateUrl: './replication-list.component.html', - providers: [ConfirmationService], - styleUrls: [ - - ] -}) -export class ReplicationListComponent implements OnInit { - - @Input() volumeId; - volume={ - name:"" - }; - replication ={ - name:"replication", - replicationPeriod:30, - id:"" - }; - arrowEnable = true; - showReplication:boolean=false; - editReplicationDisable :boolean=true; - periodControl:FormControl; - //[0]:status:enble;[1]:status:disabled;[2]:status:failover;[3]:status:other - swichMode = [ - { - disableBtnDisplay:true, - disableBtnDisabled:false, - enableBtnDisplay:false, - enableBtnDisabled:true, - failoverBtnDisabled:false, - }, - { - disableBtnDisplay:false, - disableBtnDisabled:true, - enableBtnDisplay:true, - enableBtnDisabled:false, - failoverBtnDisabled:false, - }, - { - disableBtnDisplay:false, - disableBtnDisabled:true, - enableBtnDisplay:true, - enableBtnDisabled:false, - failoverBtnDisabled:true, - }, - { - disableBtnDisplay:true, - disableBtnDisabled:true, - enableBtnDisplay:false, - enableBtnDisabled:true, - failoverBtnDisabled:true, - } - ]; - operationStatus:any; - constructor( - public I18N:I18NService, - private VolumeService:VolumeService, - private replicationService:ReplicationService, - private confirmationService:ConfirmationService - ) { } - - ngOnInit() { - this.operationStatus = this.swichMode[3]; - this.periodControl = new FormControl("1"); - this.getAllReplicationsDetail(); - this.periodControl.valueChanges.subscribe( - (value)=>{ - if(Number(value) < 1){ - this.periodControl.setValue("1"); - } - } - ); - } - getAllReplicationsDetail(){ - this.replicationService.getAllReplicationsDetail().subscribe((resRep)=>{ - let replications = resRep.json(); - replications.forEach(element => { - if(element.primaryVolumeId == this.volumeId){ - this.getVolumeById(this.volumeId); - this.replication = element; - this.periodControl.setValue(this.replication.replicationPeriod); - //ReplicationStatus - switch(this.replication['replicationStatus']){ - case "enabled": - this.operationStatus = this.swichMode[0]; - this.arrowEnable = true; - break; - case "disabled": - this.operationStatus = this.swichMode[1]; - this.arrowEnable = false; - break; - case "failed_over": - this.operationStatus = this.swichMode[2]; - this.arrowEnable = false; - break; - default: - this.operationStatus = this.swichMode[3]; - this.arrowEnable = false; - } - this.showReplication = true; - } - if(element.secondaryVolumeId == this.volumeId){ - this.replication = element; - this.periodControl.setValue(this.replication.replicationPeriod); - //ReplicationStatus - switch(this.replication['replicationStatus']){ - case "enabled": - this.operationStatus = this.swichMode[0]; - this.arrowEnable = true; - break; - case "disabled": - this.operationStatus = this.swichMode[1]; - this.arrowEnable = false; - break; - case "failed_over": - this.operationStatus = this.swichMode[2]; - this.arrowEnable = false; - break; - default: - this.operationStatus = this.swichMode[3]; - this.arrowEnable = false; - } - this.getVolumeById(element.primaryVolumeId); - this.showReplication = true; - } - }); - }); - } - getVolumeById(volumeId){ - this.VolumeService.getVolumeById(volumeId).subscribe((res) => { - this.volume = res.json(); - }); - } - getReplicationByVolumeId = function(volumeId){ - let param = { - "key": "PrimaryVolumeId", - "value":volumeId - } - this.replicationService.getReplicationDetailByVolumeId(param).subscribe((res) => { - var data = res.json(); - if(data.length !== 0){ - this.replication = data[0]; - this.showReplication = true; - }else{ - this.showReplication = false; - } - }); - } - disableReplication(){ - let msg = "
Are you sure you want to disable the Replication?

[ "+ this.replication.name +" ]

"; - let header ="Disable Replication"; - let acceptLabel = "Disable"; - let warming = false; - this.confirmDialog([msg,header,acceptLabel,warming,"disable"]) - } - enableReplication(){ - let msg = "
Are you sure you want to enable the Replication?

[ "+ this.replication.name +" ]

"; - let header ="Enable Replication"; - let acceptLabel = "Enable"; - let warming = false; - this.confirmDialog([msg,header,acceptLabel,warming,"enable"]) - } - failoverReplication(){ - let msg = "
Are you sure you want to failover the Replication?

[ "+ this.replication.name +" ]

"; - let header ="Failover Replication"; - let acceptLabel = "Failover"; - let warming = true; - this.confirmDialog([msg,header,acceptLabel,warming,"failover"]) - } - deleteReplication(){ - let msg = "
Are you sure you want to delete the Replication?

[ "+ this.replication.name +" ]

"; - let header ="Delete Replication"; - let acceptLabel = "Delete"; - let warming = true; - this.confirmDialog([msg,header,acceptLabel,warming,"delete"]) - } - editReplicationPriod(){ - if(!this.editReplicationDisable){ - //wait interface modify period ,icon color:#40bcec - if(this.replication.replicationPeriod != this.periodControl.value){ - let param = { - name:this.replication.name, - replicationPeriod:this.periodControl.value - }; - this.replicationService.modifyReplication(this.replication.id,param).subscribe((res)=>{ - this.getAllReplicationsDetail(); - }); - } - } - this.editReplicationDisable = !this.editReplicationDisable; - - } - confirmDialog([msg,header,acceptLabel,warming=true,func]){ - this.confirmationService.confirm({ - message: msg, - header: header, - acceptLabel: acceptLabel, - isWarning: warming, - accept: ()=>{ - try { - switch(func){ - case "disable": - this.replicationService.disableReplication(this.replication.id).subscribe((res)=>{ - this.getAllReplicationsDetail(); - }); - break; - case "delete": - this.replicationService.deleteReplication(this.replication.id).subscribe((res)=>{ - this.getAllReplicationsDetail(); - }); - break; - case "failover": - this.replicationService.failoverReplication(this.replication.id).subscribe((res)=>{ - this.getAllReplicationsDetail(); - }); - break; - case "enable": - this.replicationService.enableReplication(this.replication.id).subscribe((res)=>{ - this.getAllReplicationsDetail(); - }); - break; - } - } - catch (e) { - console.log(e); - } - finally { - this.getAllReplicationsDetail(); - } - }, - reject:()=>{} - }) - } -} diff --git a/dashboard/src/app/business/block/volume-detail/snapshot-list/snapshot-list.component.html b/dashboard/src/app/business/block/volume-detail/snapshot-list/snapshot-list.component.html deleted file mode 100644 index d5205626a..000000000 --- a/dashboard/src/app/business/block/volume-detail/snapshot-list/snapshot-list.component.html +++ /dev/null @@ -1,71 +0,0 @@ -
-
-
- - -
-
-
- - -
- -
-
- - - - - - - - - - - {{I18N.keyID['sds_block_volume_createVol']}} - {{I18N.keyID['sds_block_volume_modify']}} - {{I18N.keyID['sds_block_volume_delete']}} - - - - - - -
- - {{volume.name}} - - - - - - - - - -
- - - - - -
- - -
- - - - - - - -
- - - - - -
-
- diff --git a/dashboard/src/app/business/block/volume-detail/snapshot-list/snapshot-list.component.ts b/dashboard/src/app/business/block/volume-detail/snapshot-list/snapshot-list.component.ts deleted file mode 100644 index 40f9604e4..000000000 --- a/dashboard/src/app/business/block/volume-detail/snapshot-list/snapshot-list.component.ts +++ /dev/null @@ -1,221 +0,0 @@ -import { Component, OnInit, Input } from '@angular/core'; -import { FormControl, FormGroup, FormBuilder, Validators, ValidatorFn, AbstractControl } from '@angular/forms'; -import { VolumeService,SnapshotService } from './../../volume.service'; -import { ConfirmationService,ConfirmDialogModule} from '../../../../components/common/api'; -import { I18NService, MsgBoxService, Utils } from 'app/shared/api'; - -@Component({ - selector: 'app-snapshot-list', - templateUrl: './snapshot-list.component.html', - providers: [ConfirmationService], - styleUrls: [ - - ] -}) -export class SnapshotListComponent implements OnInit { - - @Input() volumeId; - volume; - label; - selectedSnapshotId; - selectedSnapshots = []; - snapshots; - snapshotfilter; - snapshotPropertyDisplay = false; - snapshotFormGroup; - createVolumeFormGroup; - createVolumeDisplay: boolean = false; - - isCreate = false; - isModify = false; - snapshotProperty = { - name: '', - description: '' - } - okBtnDisabled = false; - - errorMessage = { - "name": { required: "Name is required." }, - "description": { maxlength: "Max. length is 200." } - }; - param = { - key: 'VolumeId', - value: null - } - constructor( - private VolumeService: VolumeService, - private SnapshotService: SnapshotService, - private fb: FormBuilder, - private confirmationService:ConfirmationService, - public I18N:I18NService, - private msg: MsgBoxService - ) { - this.snapshotFormGroup = this.fb.group({ - "name": ["", Validators.required], - "description": ["", Validators.maxLength(200)] - }); - - this.createVolumeFormGroup = this.fb.group({ - "name": ["", Validators.required], - "description": ["", Validators.maxLength(200)] - }); - } - - ngOnInit() { - this.getVolumeById(this.volumeId); - this.label = { - name: this.I18N.keyID['sds_block_volume_name'], - volume: this.I18N.keyID['sds_block_volume_title'], - description: this.I18N.keyID['sds_block_volume_descri'] - } - this.param={ - key: 'VolumeId', - value: this.volumeId - }; - this.getSnapshots(this.param); - } - - getVolumeById(volumeId){ - this.VolumeService.getVolumeById(volumeId).subscribe((res) => { - this.volume = res.json(); - }); - } - - createSnapshot() { - let param = { - name: this.snapshotFormGroup.value.name, - volumeId: this.volumeId, - description: this.snapshotFormGroup.value.description - } - this.SnapshotService.createSnapshot(param).subscribe((res) => { - this.getSnapshots( - { - key: 'VolumeId', - value: this.volumeId - } - ); - }); - } - - batchDeleteSnapshot(param) { - if (param) { - let msg; - if(param.length>1){ - - msg = "
Are you sure you want to delete the selected Snapshots?

[ "+ param.length +" Snapshots ]

"; - }else{ - msg = "
Are you sure you want to delete the Snapshot?

[ "+ param[0].name +" ]

"; - } - - this.confirmationService.confirm({ - message: msg, - header: this.I18N.keyID['sds_block_volume_del_sna'], - acceptLabel: this.I18N.keyID['sds_block_volume_delete'], - isWarning: true, - accept: ()=>{ - param.forEach(snapshot => { - this.deleteSnapshot(snapshot.id); - - }); - }, - reject:()=>{} - }) - } - } - - deleteSnapshot(id) { - this.SnapshotService.deleteSnapshot(id).subscribe((res) => { - Utils.arrayRemoveOneElement(this.selectedSnapshots,id,function(value,index,arr){ - return value.id === id; - }); - this.getSnapshots( - { - key: 'VolumeId', - value: this.volumeId - } - ); - }); - } - - getSnapshots(filter?) { - this.SnapshotService.getSnapshots(filter).subscribe((res) => { - this.snapshots = res.json(); - this.snapshotPropertyDisplay = false; - - this.snapshots.map((item, index, arr)=>{ - item.size = Utils.getDisplayGBCapacity(item.size); - }) - }); - } - - modifySnapshot(){ - let param = { - name: this.snapshotFormGroup.value.name, - description: this.snapshotFormGroup.value.description - } - this.SnapshotService.modifySnapshot(this.selectedSnapshotId,param).subscribe((res) => { - this.getSnapshots( - { - key: 'VolumeId', - value: this.volumeId - } - ); - }); - } - - showSnapshotPropertyDialog(method,selectedSnapshot?){ - this.snapshotPropertyDisplay = true; - if(method === 'create'){ - this.isCreate = true; - this.isModify = false; - this.snapshotProperty.name = ''; - this.snapshotProperty.description = ''; - }else if(method === 'modify'){ - this.isCreate = false; - this.isModify = true; - this.snapshotProperty.name = selectedSnapshot.name; - this.snapshotProperty.description = selectedSnapshot.description; - } - if(selectedSnapshot && selectedSnapshot.id){ - this.selectedSnapshotId = selectedSnapshot.id; - } - } - - snapshotModifyOrCreate(){ - if(this.isModify){ - this.modifySnapshot(); - }else{ - this.createSnapshot(); - } - - } - - showCreateVolumeBasedonSnapshot(snapshot){ - this.createVolumeDisplay = true; - this.selectedSnapshotId = snapshot.id; - } - - createVolumeBasedonSnapshot(snapshot) { - let param = { - name: this.createVolumeFormGroup.value.name, - description: this.createVolumeFormGroup.value.description, - size: this.volume.size, - availabilityZone: this.volume.availabilityZone, - profileId: this.volume.profileId, - snapshotId: this.selectedSnapshotId - } - - if(this.createVolumeFormGroup.status == "VALID"){ - this.VolumeService.createVolume(param).subscribe((res) => { - this.createVolumeDisplay = false; - this.msg.info("The volume is being created, please go to the volume list and check it."); - }); - }else{ - // validate - for(let i in this.createVolumeFormGroup.controls){ - this.createVolumeFormGroup.controls[i].markAsTouched(); - } - } - } - -} diff --git a/dashboard/src/app/business/block/volume-detail/volume-detail.component.html b/dashboard/src/app/business/block/volume-detail/volume-detail.component.html deleted file mode 100644 index a07de63e0..000000000 --- a/dashboard/src/app/business/block/volume-detail/volume-detail.component.html +++ /dev/null @@ -1,64 +0,0 @@ -
-
- - {{item.label}} - > - -
-
-

{{i18n.keyID['sds_block_volume_base_info']}}

-

{{ volumeSource }}

-
-
-
- {{label.Name}}: -
-
- {{volume.name}} -
-
- {{label.Profile}}: -
-
- {{volume.profileName}} -
-
- {{label.Status}}: -
-
- {{volume.status}} -
-
-
-
- {{label.Capacity}}: -
-
- {{volume.size}} -
-
- {{label.VolumeID}}: -
-
- {{volume.id}} -
-
- {{label.CreatedAt}}: -
-
- {{volume.createdAt}} -
-
-
-
-
- - - - - - - - -
-
diff --git a/dashboard/src/app/business/block/volume-detail/volume-detail.component.ts b/dashboard/src/app/business/block/volume-detail/volume-detail.component.ts deleted file mode 100644 index f9a36cd9b..000000000 --- a/dashboard/src/app/business/block/volume-detail/volume-detail.component.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { Component, OnInit } from '@angular/core'; -import { Router,ActivatedRoute} from '@angular/router'; - -import { VolumeService } from './../volume.service'; -import { ProfileService } from './../../profile/profile.service'; -import { I18NService, Utils } from 'app/shared/api'; - -@Component({ - selector: 'app-volume-detail', - templateUrl: './volume-detail.component.html', - styleUrls: [ - - ] -}) -export class VolumeDetailComponent implements OnInit { - items; - label; - volume; - volumeId; - showVolumeSource: boolean = false; - volumeSource: string = ""; - - constructor( - private VolumeService: VolumeService, - private ActivatedRoute: ActivatedRoute, - private ProfileService: ProfileService, - public i18n:I18NService - ) { } - - ngOnInit() { - this.ActivatedRoute.params.subscribe((params) => this.volumeId = params.volumeId); - - this.items = [ - { label: this.i18n.keyID["sds_block_volume_title"], url: '/block' }, - { label: this.i18n.keyID["sds_block_volume_detail"], url: '/volumeDetail' } - ]; - - this.label = { - Name: this.i18n.keyID["sds_block_volume_name"], - Profile: this.i18n.keyID["sds_block_volume_profile"], - Status: this.i18n.keyID["sds_block_volume_status"], - VolumeID: this.i18n.keyID["sds_block_volume_id"], - Capacity: this.i18n.keyID["sds_home_capacity"], - CreatedAt: this.i18n.keyID["sds_block_volume_createat"] - }; - - this.getVolume(this.volumeId); - } - - getVolume(id){ - this.VolumeService.getVolumeById(id).subscribe((res) => { - this.volume = res.json(); - this.volume.size = Utils.getDisplayGBCapacity(res.json().size); - this.ProfileService.getProfileById(this.volume.profileId).subscribe((res)=>{ - this.volume.profileName = res.json().name; - }) - - if(this.volume.snapshotId != ""){ - this.showVolumeSource = true; - this.volumeSource = this.i18n.keyID['sds_block_volume_source'].replace("{{}}", this.volume.snapshotId); - } - }); - } - -} diff --git a/dashboard/src/app/business/block/volume-detail/volume-detail.module.ts b/dashboard/src/app/business/block/volume-detail/volume-detail.module.ts deleted file mode 100644 index 38f551aec..000000000 --- a/dashboard/src/app/business/block/volume-detail/volume-detail.module.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { ReactiveFormsModule, FormsModule } from '@angular/forms'; -import { RouterModule } from '@angular/router'; -import { VolumeDetailComponent } from './volume-detail.component'; - -import { TabViewModule,ButtonModule, DataTableModule, DropMenuModule, DialogModule, FormModule, InputTextModule, InputTextareaModule, ConfirmDialogModule ,ConfirmationService} from './../../../components/common/api'; -import { HttpService } from './../../../shared/service/Http.service'; -import { VolumeService,SnapshotService ,ReplicationService} from './../volume.service'; -import { SnapshotListComponent } from './snapshot-list/snapshot-list.component'; -import { ReplicationListComponent } from './replication-list/replication-list.component'; -import { ProfileService } from './../../profile/profile.service'; - -let routers = [{ - path: '', - component: VolumeDetailComponent -}] - -@NgModule({ - imports: [ - CommonModule, - ReactiveFormsModule, - FormsModule, - InputTextModule, - InputTextareaModule, - RouterModule.forChild(routers), - TabViewModule, - ButtonModule, - DataTableModule, - DialogModule, - FormModule, - ConfirmDialogModule - ], - declarations: [ - VolumeDetailComponent, - SnapshotListComponent, - ReplicationListComponent - ], - providers: [ - HttpService, - VolumeService, - SnapshotService, - ConfirmationService, - ProfileService, - ReplicationService - ] -}) -export class VolumeDetailModule { } diff --git a/dashboard/src/app/business/block/volume-group-detail/volume-group-detail.component.html b/dashboard/src/app/business/block/volume-group-detail/volume-group-detail.component.html deleted file mode 100644 index 15877e379..000000000 --- a/dashboard/src/app/business/block/volume-group-detail/volume-group-detail.component.html +++ /dev/null @@ -1,84 +0,0 @@ -
-
- - {{item.label}} - > - -
-
-

{{I18N.keyID['sds_block_volume_base_info']}}

-
-
-
- {{label.Name}}: -
-
- {{volumeGroup.name}} -
-
- {{label.description}}: -
-
- {{volumeGroup.description}} -
-
- {{label.Status}}: -
-
- {{volumeGroup.status}} -
-
-
-
- {{label.Profile}}: -
-
- {{volumeGroup.profileName}} -
-
- {{label.groupId}}: -
-
- {{volumeGroup.id}} -
-
- {{label.CreatedAt}}: -
-
- {{volumeGroup.createdAt}} -
-
-
-
-
- -
-
- - - - - - - - - {{I18N.keyID['sds_block_volume_group_remove']}} - - - -
-
- - - - - - - - - - - - - - \ No newline at end of file diff --git a/dashboard/src/app/business/block/volume-group-detail/volume-group-detail.component.ts b/dashboard/src/app/business/block/volume-group-detail/volume-group-detail.component.ts deleted file mode 100644 index 5d18a700c..000000000 --- a/dashboard/src/app/business/block/volume-group-detail/volume-group-detail.component.ts +++ /dev/null @@ -1,156 +0,0 @@ -import { Component, OnInit } from '@angular/core'; -import { Router,ActivatedRoute} from '@angular/router'; -import { VolumeService ,VolumeGroupService} from './../volume.service'; -import { ProfileService } from './../../profile/profile.service'; -import { I18NService, Utils } from 'app/shared/api'; -import { TabViewModule,ButtonModule, DataTableModule, DropMenuModule, DialogModule, FormModule, InputTextModule, InputTextareaModule, ConfirmDialogModule ,ConfirmationService} from './../../../components/common/api'; - -@Component({ - selector: 'app-volume-group-detail', - templateUrl: './volume-group-detail.component.html', - providers: [ConfirmationService], - styleUrls: [] -}) -export class VolumeGroupDetailComponent implements OnInit { - items = []; - volumeGroupId:string; - volumeGroup:any; - label:any; - profileJson = {}; - volumes=[]; - allOptionalVolumes = []; - selectedVolumes = []; - showAddVolumes:boolean=false; - constructor( - private VolumeService: VolumeService, - private ActivatedRoute: ActivatedRoute, - private profileService: ProfileService, - private VolumeGroupService:VolumeGroupService, - private confirmationService:ConfirmationService, - public I18N:I18NService - ) { } - - ngOnInit() { - this.ActivatedRoute.params.subscribe( - (params) => this.volumeGroupId = params.groupId - ); - this.getProfiles(); - this.items = [ - { label: this.I18N.keyID["sds_block_volume_group_router"], url: '/block' }, - { label: this.I18N.keyID["sds_block_volume_group_detail"], url: '/volumeGroupDetails' } - ]; - this.label = { - Name: this.I18N.keyID["sds_block_volume_name"], - Profile: this.I18N.keyID["sds_block_volume_profile"], - Status: this.I18N.keyID["sds_block_volume_status"], - groupId: this.I18N.keyID["sds_block_volume_group_id"], - description:this.I18N.keyID["sds_block_volume_descri"], - CreatedAt: this.I18N.keyID["sds_block_volume_createat"] - }; - } - getVolumeGroupById(groupId){ - this.VolumeGroupService.getVolumeGroupById(groupId).subscribe((res)=>{ - let volumeGroup = res.json(); - if(volumeGroup && volumeGroup.length != 0){ - if(!volumeGroup.description){ - volumeGroup.description = "--"; - } - let profileName = []; - volumeGroup.profiles.forEach((profileId)=>{ - profileName.push(this.profileJson[profileId]); - }); - volumeGroup.profileName = profileName; - } - this.volumeGroup = volumeGroup; - this.getAllOptionalVolumes(); - }); - } - getProfiles() { - this.profileService.getProfiles().subscribe((res) => { - let profiles = res.json(); - profiles.forEach(profile => { - this.profileJson[profile.id] = profile.name; - }); - this.getVolumeGroupById(this.volumeGroupId); - this.getVolumesByGroupId(this.volumeGroupId); - }); - } - getAllOptionalVolumes(){ - this.VolumeService.getVolumes().subscribe((res)=>{ - let allVolumes = res.json(); - this.allOptionalVolumes = []; - if(allVolumes){ - allVolumes.forEach((item)=>{ - if(item.pooId == this.volumeGroup.pooId && !item.groupId && this.volumeGroup.profiles.includes(item.profileId)){ - item.size = Utils.getDisplayGBCapacity(item.size); - item.profileName = this.profileJson[item.profileId]; - this.allOptionalVolumes.push(item); - } - }); - } - }); - } - getVolumesByGroupId(volumeGroupId){ - this.VolumeService.getVolumeByGroupId(volumeGroupId).subscribe((res)=>{ - let volumes = res.json(); - if(volumes && volumes.length != 0){ - volumes.forEach((item)=>{ - item.size = Utils.getDisplayGBCapacity(item.size); - item.profileName = this.profileJson[item.profileId]; - }); - } - this.volumes = volumes; - }); - }; - addVolumesToGroup(){ - let volumes = []; - this.selectedVolumes.forEach((item)=>{ - volumes.push(item.id); - }); - let param = { - "addVolumes": volumes, - } - this.selectedVolumes = []; - this.VolumeGroupService.addOrRemovevolumes(this.volumeGroupId,param).subscribe((res)=>{ - this.showAddVolumes = false; - this.getProfiles(); - }); - } - removeVolumeFromGroup(volume){ - let msg = "
Are you sure you want to remove the selected Volume ?

[ "+ volume.name +"]

"; - let header ="Remove Volume"; - let acceptLabel = "Remove"; - let warming = true; - this.confirmDialog([msg,header,acceptLabel,warming,"remove",volume]) - } - confirmDialog([msg,header,acceptLabel,warming=true,func,data]){ - this.confirmationService.confirm({ - message: msg, - header: header, - acceptLabel: acceptLabel, - isWarning: warming, - accept: ()=>{ - try { - if(func === "remove"){ - let param = { - "removeVolumes": [ - data.id - ], - } - this.VolumeGroupService.addOrRemovevolumes(this.volumeGroupId,param).subscribe((res)=>{ - this.getProfiles(); - }); - } - } - catch (e) { - console.log(e); - } - finally { - - } - }, - reject:()=>{} - }) - } - -} diff --git a/dashboard/src/app/business/block/volume-group-detail/volume-group-detail.module.ts b/dashboard/src/app/business/block/volume-group-detail/volume-group-detail.module.ts deleted file mode 100644 index a1e665b29..000000000 --- a/dashboard/src/app/business/block/volume-group-detail/volume-group-detail.module.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { VolumeGroupDetailComponent } from './volume-group-detail.component'; -import { RouterModule } from '@angular/router'; -import { ReactiveFormsModule, FormsModule } from '@angular/forms'; -import { TabViewModule,ButtonModule, DataTableModule, DropMenuModule, DialogModule, FormModule, InputTextModule, InputTextareaModule, ConfirmDialogModule ,ConfirmationService} from './../../../components/common/api'; -import { HttpService } from './../../../shared/service/Http.service'; -import { VolumeService,VolumeGroupService} from './../volume.service'; -import { ProfileService } from './../../profile/profile.service'; - -let routers = [{ - path: '', - component: VolumeGroupDetailComponent -}] -@NgModule({ - imports: [ - CommonModule, - RouterModule.forChild(routers), - ReactiveFormsModule, - FormsModule, - InputTextModule, - InputTextareaModule, - TabViewModule, - ButtonModule, - DataTableModule, - DialogModule, - FormModule, - ConfirmDialogModule - ], - declarations: [VolumeGroupDetailComponent], - providers: [ - HttpService, - VolumeService, - ConfirmationService, - ProfileService, - VolumeGroupService - ] -}) -export class VolumeGroupDetailModule { } diff --git a/dashboard/src/app/business/block/volume.service.ts b/dashboard/src/app/business/block/volume.service.ts deleted file mode 100644 index 0dccc1e6a..000000000 --- a/dashboard/src/app/business/block/volume.service.ts +++ /dev/null @@ -1,192 +0,0 @@ -import { Injectable } from '@angular/core'; -import { I18NService, HttpService, ParamStorService } from '../../shared/api'; -import { Observable } from 'rxjs'; - -@Injectable() -export class VolumeService { - constructor( - private http: HttpService, - private paramStor: ParamStorService - ) { } - - url = 'v1beta/{project_id}/block/volumes'; - - //Create volume - createVolume(param) { - return this.http.post(this.url, param); - } - - //Update volume - modifyVolume(id,param) { - let modifyUrl = this.url + '/' + id - return this.http.put(modifyUrl, param); - } - - //Delete volume - deleteVolume(id): Observable { - let deleteUrl = this.url + '/' + id - return this.http.delete(deleteUrl); - } - - //Search all volumes - getVolumes(): Observable { - return this.http.get(this.url); - } - - //Search volume - getVolumeById(id): Observable { - let url = this.url + '/' + id; - return this.http.get(url); - } - //Search volume by groupId - getVolumeByGroupId(id): Observable { - let url = this.url + '?GroupId=' + id; - return this.http.get(url); - } - - //Create volumesGroup - createVolumesGroup(param) { - return this.http.post(this.url, param); - } - - //Delete volumesGroup - deleteVolumesGroup(id): Observable { - let deleteUrl = this.url + '/' + id - return this.http.delete(deleteUrl); - } - - //Search volumesGroups - getVolumesGroups(): Observable { - return this.http.get(this.url); - } - expandVolume(id,param):Observable { - let expandVolumeUrl = 'v1beta/{project_id}/block/volumes' + '/' + id + "/resize" - return this.http.post(expandVolumeUrl,param); - } -} - -@Injectable() -export class SnapshotService { - constructor( - private http: HttpService, - private paramStor: ParamStorService - ) { } - - url = 'v1beta/{project_id}/block/snapshots'; - - //Create snapshot - createSnapshot(param) { - return this.http.post(this.url, param); - } - - //Delete snapshot - deleteSnapshot(id){ - let url = this.url + "/" + id; - return this.http.delete(url); - } - - //Search snapshot - getSnapshots(filter?){ - let url = this.url; - if(filter){ - url = this.url + "?" + filter.key + "=" + filter.value; - } - return this.http.get(url); - } - - //Update snapshot - modifySnapshot(id,param){ - let url = this.url + "/" + id; - return this.http.put(url,param); - } -} -@Injectable() -export class ReplicationService { - constructor( - private http: HttpService, - private paramStor: ParamStorService - ) { } - - project_id = this.paramStor.CURRENT_TENANT().split("|")[1]; - replicationUrl = 'v1beta/{project_id}/block/replications'; - //create replication - createReplication(param){ - let url = this.replicationUrl; - return this.http.post(url,param); - } - getReplicationDetailByVolumeId(filter?){ - let url = this.replicationUrl+"/detail"; - if(filter){ - url = url + "?" + filter.key + "=" + filter.value; - } - return this.http.get(url); - } - disableReplication(param){ - let url = this.replicationUrl+"/"+param+"/disable"; - return this.http.post(url,param); - } - enableReplication(param){ - let url = this.replicationUrl+"/"+param+"/enable"; - return this.http.post(url,param); - } - failoverReplication(id){ - let url = this.replicationUrl+"/"+id+"/failover"; - let param = { - "allowAttachedVolume": true, - "secondaryBackendId": "default" - } - return this.http.post(url,param); - } - deleteReplication(param){ - let url = this.replicationUrl+"/"+param; - return this.http.delete(url); - } - modifyReplication(replicationId,param){ - let url = this.replicationUrl+"/"+replicationId; - return this.http.put(url,param); - } - //get all replications - getAllReplicationsDetail(){ - let url = this.replicationUrl+"/detail"; - return this.http.get(url); - } -} -@Injectable() -export class VolumeGroupService { - constructor( - private http: HttpService, - private paramStor: ParamStorService - ) { } - - project_id = this.paramStor.CURRENT_TENANT().split("|")[1]; - volumeGroupUrl = 'v1beta/{project_id}/block/volumeGroup'; - //create volume group - createVolumeGroup(param){ - let url = this.volumeGroupUrl; - return this.http.post(url,param); - } - //get volume group - getVolumeGroups(): Observable { - return this.http.get(this.volumeGroupUrl); - } - //delete volume group - deleteVolumeGroup(groupId): Observable { - let url = this.volumeGroupUrl+"/" + groupId - return this.http.delete(url); - } - //modify volume group - modifyVolumeGroup(groupId,param): Observable { - let url = this.volumeGroupUrl+"/" + groupId - return this.http.put(url,param); - } - //get volume group by id - getVolumeGroupById(groupId): Observable { - let url = this.volumeGroupUrl+"/"+groupId; - return this.http.get(url); - } - //add or remove volumes - addOrRemovevolumes(groupId,param): Observable { - let url = this.volumeGroupUrl+"/"+groupId; - return this.http.put(url,param); - } -} diff --git a/dashboard/src/app/business/block/volumeGroup.component.ts b/dashboard/src/app/business/block/volumeGroup.component.ts deleted file mode 100644 index abde0e952..000000000 --- a/dashboard/src/app/business/block/volumeGroup.component.ts +++ /dev/null @@ -1,213 +0,0 @@ -import { Component, OnInit, ViewContainerRef, ViewChild, Directive, ElementRef, HostBinding, HostListener } from '@angular/core'; -import { I18NService } from 'app/shared/api'; -import { AppService } from 'app/app.service'; -import { I18nPluralPipe } from '@angular/common'; -import { trigger, state, style, transition, animate} from '@angular/animations'; -import { DialogModule } from '../../components/common/api'; -import { FormControl, FormGroup, FormBuilder, Validators, ValidatorFn, AbstractControl} from '@angular/forms'; -import { VolumeService ,VolumeGroupService} from './volume.service'; -import { ProfileService } from './../profile/profile.service'; -import { AvailabilityZonesService } from './../resource/resource.service'; -import { ConfirmationService,ConfirmDialogModule} from '../../components/common/api'; -import { Router } from '@angular/router'; - -@Component({ - selector: 'volume-group-list', - templateUrl: 'volumeGroup.html', - providers: [ConfirmationService], - styleUrls: [], - animations: [] -}) -export class VolumeGroupComponent implements OnInit{ - volumeGroups=[]; - volemeOptions = []; - profileOptions = []; - currentGroup:any; - availabilityZones = []; - selectedOption :string; - selectedVolumeGroups=[]; - profileJson = {}; - showVolumeGroupDialog :boolean = false; - showModifyGroup :boolean = false; - volumeGroupForm:any; - modifyGroupForm:any; - validRule= { - 'name':'^[a-zA-Z]{1}([a-zA-Z0-9]|[_]){0,127}$' - }; - constructor( - public I18N: I18NService, - private router: Router, - private volumeGroupService : VolumeGroupService, - private fb : FormBuilder, - private profileService :ProfileService, - private confirmationService:ConfirmationService, - private availabilityZonesService:AvailabilityZonesService - ){ - this.volumeGroupForm = this.fb.group({ - "group_name":["",{validators:[Validators.required, Validators.pattern(this.validRule.name)], updateOn:'change'} ], - "description":[""], - "profile":["",Validators.required], - "zone":[""] - }); - this.modifyGroupForm = this.fb.group({ - "group_name":["",{validators:[Validators.required, Validators.pattern(this.validRule.name)], updateOn:'change'} ], - "description":[""] - }); - } - errorMessage = { - "group_name": { required: "group name is required.", pattern:"Beginning with a letter with a length of 1-128, it can contain letters / numbers / underlines."}, - "profile": { required: "profile is required."} - }; - - label = { - group_name_lable:'Group Name', - profile_label:'Profile', - description:this.I18N.keyID['sds_block_volume_descri'], - zone:this.I18N.keyID['sds_block_volume_az'] - } - - ngOnInit() { - this.volemeOptions = []; - this.getProfiles(); - this.getAZ(); - } - getAZ(){ - this.availabilityZonesService.getAZ().subscribe((azRes) => { - let AZs=azRes.json(); - let azArr = []; - if(AZs && AZs.length !== 0){ - AZs.forEach(item =>{ - let obj = {label: item, value: item}; - azArr.push(obj); - }) - } - this.availabilityZones = azArr; - }) - } - //show create volumes group - createVolumeGroup(){ - this.volumeGroupForm.reset(); - this.showVolumeGroupDialog = true; - } - ModifyVolumeGroupDisplay(volumeGroup){ - this.modifyGroupForm.reset(); - this.currentGroup = volumeGroup; - this.modifyGroupForm.controls['group_name'].setValue(this.currentGroup.name); - this.modifyGroupForm.controls['description'].setValue(""); - this.showModifyGroup = true; - } - submit(group){ - if(!this.volumeGroupForm.valid){ - for(let i in this.volumeGroupForm.controls){ - this.volumeGroupForm.controls[i].markAsTouched(); - } - return; - }else{ - let param = { - name : group.group_name, - profiles : group.profile, - description:group.description, - availabilityZone:group.zone - } - this.volumeGroupService.createVolumeGroup(param).subscribe((res) => { - this.getVolumeGroups(); - }); - } - this.showVolumeGroupDialog = false; - } - getVolumeGroups(){ - this.volumeGroupService.getVolumeGroups().subscribe((res) => { - let volumeGroups = res.json(); - if(volumeGroups && volumeGroups.length != 0){ - volumeGroups.forEach((item)=>{ - if(!item.description){ - item.description = "--"; - } - let profileName = []; - item.profiles.forEach((profileId)=>{ - profileName.push(this.profileJson[profileId]); - }); - item.profileName = profileName; - }); - } - this.volumeGroups = volumeGroups; - }); - } - getProfiles() { - this.profileService.getProfiles().subscribe((res) => { - let profiles = res.json(); - profiles.forEach(profile => { - this.profileOptions.push({ - label: profile.name, - value: profile.id - }); - this.profileJson[profile.id] = profile.name; - }); - this.getVolumeGroups(); - }); - } - deleteVolumeGroup(volumeGroup){ - this.currentGroup = volumeGroup; - let msg = "
Are you sure you want to delete the Volume Group?

[ "+ volumeGroup.name +" ]

"; - let header ="Delete Volume Group"; - let acceptLabel = "Delete"; - let warming = true; - this.confirmDialog([msg,header,acceptLabel,warming,"delete"]) - } - deleteMultiVolumeGroups(){ - let msg = "
Are you sure you want to delete the selected Volume Groups?

[ "+ this.selectedVolumeGroups.length +" Volume Group ]

"; - let header ="Delete Volume Group"; - let acceptLabel = "Delete"; - let warming = true; - this.confirmDialog([msg,header,acceptLabel,warming,"multiDelete"]) - } - modifyGroup(value){ - if(!this.modifyGroupForm.valid){ - for(let i in this.modifyGroupForm.controls){ - this.modifyGroupForm.controls[i].markAsTouched(); - } - return; - }else{ - let param = { - name:value.group_name, - description:value.description, - } - this.volumeGroupService.modifyVolumeGroup(this.currentGroup.id,param).subscribe((res) => { - this.getVolumeGroups(); - }); - } - this.showModifyGroup = false; - } - confirmDialog([msg,header,acceptLabel,warming=true,func]){ - this.confirmationService.confirm({ - message: msg, - header: header, - acceptLabel: acceptLabel, - isWarning: warming, - accept: ()=>{ - try { - if(func === "delete"){ - this.volumeGroupService.deleteVolumeGroup(this.currentGroup.id).subscribe((res) => { - this.getVolumeGroups(); - }) - }else if(func === "multiDelete"){ - this.selectedVolumeGroups.forEach(item=>{ - this.volumeGroupService.deleteVolumeGroup(item.id).subscribe((res) => { - this.getVolumeGroups(); - }) - }); - this.selectedVolumeGroups = []; - } - } - catch (e) { - console.log(e); - } - finally { - - } - }, - reject:()=>{} - }) - } - -} diff --git a/dashboard/src/app/business/block/volumeGroup.html b/dashboard/src/app/business/block/volumeGroup.html deleted file mode 100644 index 962c28dcb..000000000 --- a/dashboard/src/app/business/block/volumeGroup.html +++ /dev/null @@ -1,66 +0,0 @@ -
-
- -
-
-
- - -
- -
-
- - - - - - {{group.name}} - - - - - - - - - {{I18N.keyID['sds_block_volume_modify']}}{{I18N.keyID['sds_block_volume_delete']}} - - - - - -
- - - - - - - - - - - - -
- - - - -
- -
- - - - - - -
- - - - -
- diff --git a/dashboard/src/app/business/block/volumeGroup.module.ts b/dashboard/src/app/business/block/volumeGroup.module.ts deleted file mode 100644 index 091a352c2..000000000 --- a/dashboard/src/app/business/block/volumeGroup.module.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { NgModule, APP_INITIALIZER } from '@angular/core'; -import { VolumeGroupComponent } from './volumeGroup.component'; -import { ButtonModule, DataTableModule, InputTextModule, DialogModule,FormModule,MultiSelectModule ,DropdownModule,InputTextareaModule} from '../../components/common/api'; -import { ReactiveFormsModule, FormsModule } from '@angular/forms'; -import { HttpService } from './../../shared/service/Http.service'; -import { VolumeService ,VolumeGroupService} from './volume.service'; -import { AvailabilityZonesService } from './../resource/resource.service'; -import { ConfirmationService,ConfirmDialogModule} from '../../components/common/api'; -import { RouterModule } from '@angular/router'; - -@NgModule({ - declarations: [ VolumeGroupComponent ], - imports: [ ButtonModule, DataTableModule, InputTextModule, DialogModule,FormModule,MultiSelectModule,DropdownModule,ReactiveFormsModule,FormsModule,ConfirmDialogModule,InputTextareaModule,RouterModule], - exports: [ VolumeGroupComponent ], - providers: [ - HttpService, - VolumeService, - VolumeGroupService, - ConfirmationService, - AvailabilityZonesService - ] -}) -export class VolumeGroupModule { } diff --git a/dashboard/src/app/business/block/volumeList.component.ts b/dashboard/src/app/business/block/volumeList.component.ts deleted file mode 100644 index 30c8c0e30..000000000 --- a/dashboard/src/app/business/block/volumeList.component.ts +++ /dev/null @@ -1,367 +0,0 @@ -import { Component, OnInit, ViewContainerRef, ViewChild, Directive, ElementRef, HostBinding, HostListener } from '@angular/core'; -import { Router } from '@angular/router'; -import { I18NService, Utils } from 'app/shared/api'; -import { FormControl, FormGroup, FormBuilder, Validators, ValidatorFn, AbstractControl } from '@angular/forms'; -import { AppService } from 'app/app.service'; -import { I18nPluralPipe } from '@angular/common'; -import { trigger, state, style, transition, animate } from '@angular/animations'; -import { MenuItem ,ConfirmationService} from '../../components/common/api'; - -import { VolumeService, SnapshotService,ReplicationService} from './volume.service'; -import { ProfileService } from './../profile/profile.service'; -import { identifierModuleUrl } from '@angular/compiler'; - -let _ = require("underscore"); -@Component({ - selector: 'volume-list', - templateUrl: 'volumeList.html', - providers: [ConfirmationService], - styleUrls: [], - animations: [] -}) -export class VolumeListComponent implements OnInit { - createSnapshotDisplay = false; - createReplicationDisplay = false; - expandDisplay = false; - modifyDisplay = false; - selectVolumeSize; - newVolumeSize; - newVolumeSizeFormat; - unit:number = 1; - repPeriod : number=60; - capacityOptions = [ - { - label: 'GB', - value: 'gb' - }, - { - label: 'TB', - value: 'tb' - } - - ]; - profileOptions = [ - { - label: 'Select Profile', - value: null - } - ]; - azOption=[{label:"Secondary",value:"secondary"}]; - selectedVolumes = []; - volumes = []; - menuItems: MenuItem[]; - menuDeleDisableItems: MenuItem[]; - label = { - name: this.I18N.keyID['sds_block_volume_name'], - volume: this.I18N.keyID['sds_block_volume_title'], - description: this.I18N.keyID['sds_block_volume_descri'] - }; - snapshotFormGroup; - modifyFormGroup; - expandFormGroup; - replicationGroup; - errorMessage = { - "name": { required: "Name is required." }, - "description": { maxlength: "Max. length is 200." }, - "repName":{ required: "Name is required." }, - "profileOption":{ required: "Name is required." }, - "expandSize":{required: "Expand Capacity is required."} - }; - profiles; - selectedVolume; - - constructor( - public I18N: I18NService, - private router: Router, - private VolumeService: VolumeService, - private SnapshotService: SnapshotService, - private ProfileService: ProfileService, - private ReplicationService: ReplicationService, - private confirmationService: ConfirmationService, - private fb: FormBuilder - ) { - this.snapshotFormGroup = this.fb.group({ - "name": ["", Validators.required], - "description": ["", Validators.maxLength(200)] - }); - this.modifyFormGroup = this.fb.group({ - "name": ['', Validators.required] - }); - this.expandFormGroup = this.fb.group({ - "expandSize":[1,{validators:[Validators.required], updateOn:'change'} ], - "capacityOption":[this.capacityOptions[0] ] - }); - this.expandFormGroup.get("expandSize").valueChanges.subscribe( - (value:string)=>{ - this.newVolumeSize = parseInt(this.selectedVolume.size) + parseInt(value)*this.unit; - this.newVolumeSizeFormat = Utils.getDisplayGBCapacity(this.newVolumeSize); - } - ); - this.expandFormGroup.get("capacityOption").valueChanges.subscribe( - (value:string)=>{ - this.unit =(value === "tb" ? 1024: 1); - this.newVolumeSize = parseInt(this.selectedVolume.size) + parseInt(this.expandFormGroup.value.expandSize)*this.unit; - this.newVolumeSizeFormat = Utils.getDisplayGBCapacity(this.newVolumeSize); - } - ) - this.replicationGroup = this.fb.group({ - "repName": ['',{validators:[Validators.required], updateOn:'change'}], - "az": [this.azOption[0]], - "profileOption":['',{validators:[Validators.required], updateOn:'change'}] - }); - - } - - ngOnInit() { - this.menuItems = [ - { - "label": this.I18N.keyID['sds_block_volume_modify'], - command: () => { - this.modifyDisplay = true; - }, - disabled:false - }, - { - "label": this.I18N.keyID['sds_block_volume_expand'], - command: () => { - this.expandDisplay = true; - this.expandFormGroup.reset(); - this.expandFormGroup.controls["expandSize"].setValue(1); - this.unit = 1; - }, - disabled:false - }, - { - "label": this.I18N.keyID['sds_block_volume_delete'], - command: () => { - if (this.selectedVolume && this.selectedVolume.id) { - this.deleteVolumes(this.selectedVolume); - } - }, - disabled:false - } - ]; - this.menuDeleDisableItems = [ - { - "label": this.I18N.keyID['sds_block_volume_modify'], - command: () => { - this.modifyDisplay = true; - }, - disabled:false - }, - { - "label": this.I18N.keyID['sds_block_volume_expand'], - command: () => { - this.expandDisplay = true; - this.expandFormGroup.reset(); - this.expandFormGroup.controls["expandSize"].setValue(1); - this.unit = 1; - }, - disabled:false - }, - { - "label": this.I18N.keyID['sds_block_volume_delete'], - command: () => { - if (this.selectedVolume && this.selectedVolume.id) { - this.deleteVolumes(this.selectedVolume); - } - }, - disabled:true - } - ]; - - this.getProfiles() - } - - getVolumes() { - this.selectedVolumes = []; - this.VolumeService.getVolumes().subscribe((res) => { - let volumes = res.json(); - this.ReplicationService.getAllReplicationsDetail().subscribe((resRep)=>{ - let replications = resRep.json(); - volumes.map((item)=> - { - let _profile = this.profiles.filter((profile,index,arr)=>{ - return profile.id == item.profileId; - })[0]; - item['profileName'] = _profile != undefined ? _profile.name : "--"; - item['isDisableRep'] = false; - replications.map((rep)=>{ - if(rep.primaryVolumeId == item.id || rep.secondaryVolumeId == item.id){ - item['isDisableRep'] = true; - } - }); - item.size = Utils.getDisplayGBCapacity(item.size); - } - ); - this.SnapshotService.getSnapshots().subscribe((resSnap)=>{ - let snaps = resSnap.json(); - volumes.map((item)=> - { - item['disabled'] = false; - snaps.map((snap)=>{ - if(snap.volumeId == item.id){ - item['disabled'] = true; - } - }); - } - ); - this.volumes = volumes; - }); - }); - }); - } - - getProfiles() { - this.ProfileService.getProfiles().subscribe((res) => { - this.profiles = res.json(); - this.profiles.forEach(profile => { - this.profileOptions.push({ - label: profile.name, - value: profile.id - }); - }); - - this.getVolumes(); - }); - } - - batchDeleteVolume() { - this.selectedVolumes.forEach(volume => { - this.deleteVolume(volume.id); - }); - } - - deleteVolumeById(id) { - this.deleteVolume(id); - } - - deleteVolume(id) { - this.VolumeService.deleteVolume(id).subscribe((res) => { - this.getVolumes(); - }); - } - - createSnapshot() { - if(!this.snapshotFormGroup.valid){ - for(let i in this.snapshotFormGroup.controls){ - this.snapshotFormGroup.controls[i].markAsTouched(); - } - return; - } - let param = { - name: this.snapshotFormGroup.value.name, - volumeId: this.selectedVolume.id, - description: this.snapshotFormGroup.value.description - } - this.SnapshotService.createSnapshot(param).subscribe((res) => { - this.createSnapshotDisplay = false; - this.getProfiles(); - }); - } - - returnSelectedVolume(selectedVolume, dialog) { - if (dialog === 'snapshot') { - this.snapshotFormGroup.reset(); - this.createSnapshotDisplay = true; - } else if (dialog === 'replication') { - this.createReplicationDisplay = true; - } - let unit = selectedVolume.size.includes("GB") ? 1 : 10; - - this.selectedVolume = selectedVolume; - this.replicationGroup.reset(); - this.replicationGroup.controls["repName"].setValue(selectedVolume.name+"-replication"); - this.replicationGroup.controls["az"].setValue(this.azOption[0]); - this.selectVolumeSize = parseInt(selectedVolume.size)*unit; - } - - modifyVolume() { - let param = { - name: this.modifyFormGroup.value.name - }; - this.VolumeService.modifyVolume(this.selectedVolume.id, param).subscribe((res) => { - this.getVolumes(); - this.modifyDisplay = false; - }); - } - expandVolume(){ - if(!this.expandFormGroup.valid){ - for(let i in this.expandFormGroup.controls){ - this.expandFormGroup.controls[i].markAsTouched(); - } - return; - } - - let param = { - "newSize": this.newVolumeSize - } - this.VolumeService.expandVolume(this.selectedVolume.id, param).subscribe((res) => { - this.getVolumes(); - this.expandDisplay = false; - }); - } - createReplication(){ - if(!this.replicationGroup.valid){ - for(let i in this.replicationGroup.controls){ - this.replicationGroup.controls[i].markAsTouched(); - } - return; - } - let param = { - "name":this.replicationGroup.value.repName , - "size": Number(this.selectedVolume.size.replace(" GB","")), - "availabilityZone": this.replicationGroup.value.az.value, - "profileId": this.replicationGroup.value.profileOption, - } - this.VolumeService.createVolume(param).subscribe((res) => { - let param = { - "name":this.replicationGroup.value.repName , - "primaryVolumeId": this.selectedVolume.id, - "availabilityZone": this.replicationGroup.value.az.value, - "profileId": this.replicationGroup.value.profileOption, - "replicationMode":"async", - "replicationPeriod":Number(this.repPeriod), - "secondaryVolumeId":res.json().id - } - this.createReplicationDisplay = false; - this.ReplicationService.createReplication(param).subscribe((res) => { - this.getVolumes(); - }, - error=>{ - this.getVolumes(); - }); - }); - } - deleteVolumes(volumes){ - let arr=[], msg; - if(_.isArray(volumes)){ - volumes.forEach((item,index)=> { - arr.push(item.id); - }) - msg = "
Are you sure you want to delete the selected volumes?

[ "+ volumes.length +" Volumes ]

"; - }else{ - arr.push(volumes.id); - msg = "
Are you sure you want to delete the volume?

[ "+ volumes.name +" ]

"; - } - - this.confirmationService.confirm({ - message: msg, - header: this.I18N.keyID['sds_block_volume_deleVolu'], - acceptLabel: this.I18N.keyID['sds_block_volume_delete'], - isWarning: true, - accept: ()=>{ - arr.forEach((item,index)=> { - this.deleteVolume(item) - }) - - }, - reject:()=>{} - }) - - } - - tablePaginate() { - this.selectedVolumes = []; - } -} diff --git a/dashboard/src/app/business/block/volumeList.html b/dashboard/src/app/business/block/volumeList.html deleted file mode 100644 index 66584d949..000000000 --- a/dashboard/src/app/business/block/volumeList.html +++ /dev/null @@ -1,159 +0,0 @@ -
-
- - -
-
-
- - -
- -
-
- - - - - {{volume.name}} - - - - - - - - - {{I18N.keyID['sds_block_volume_createsna']}} - {{I18N.keyID['sds_block_volume_createrep']}} - - - - - - -
- - {{selectedVolume.name}} - - - - - - - - - -
- - - - - -
- - -
- - - -
- - - - -
- - -
- - {{selectedVolume.name}} - - - {{selectedVolume.size}} - - -
- - -
-
- - {{newVolumeSizeFormat}} - -
- - - - -
- - -
-
-
-
-
-
- -
- {{selectedVolume && selectedVolume.name}} -
-
- - default -
-
-
-
-
-
-
-
-
-
- Period - = - - Minutes -
- -
-
-
-
-
-
-
-
- -
-
-
-
-
-
- - - - -
- -
-
- -
- -
-
-
-
-
-
-
- - - - -
- diff --git a/dashboard/src/app/business/block/volumeList.module.ts b/dashboard/src/app/business/block/volumeList.module.ts deleted file mode 100644 index da627be72..000000000 --- a/dashboard/src/app/business/block/volumeList.module.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { NgModule, APP_INITIALIZER } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { ReactiveFormsModule, FormsModule } from '@angular/forms'; -import { VolumeListComponent } from './volumeList.component'; -import { ButtonModule, DataTableModule, DropMenuModule, DialogModule, FormModule, InputTextModule, InputTextareaModule, DropdownModule ,ConfirmationService,ConfirmDialogModule} from '../../components/common/api'; - -import { HttpService } from './../../shared/service/Http.service'; -import {VolumeService, SnapshotService, ReplicationService} from './volume.service'; -import { ProfileService } from './../profile/profile.service'; -import { RouterModule } from '@angular/router'; - -@NgModule({ - declarations: [ VolumeListComponent ], - imports: [ - CommonModule, - ReactiveFormsModule, - FormsModule, - ButtonModule, - InputTextModule, - InputTextareaModule, - DataTableModule, - DropdownModule, - DropMenuModule, - DialogModule, - FormModule, - ConfirmDialogModule, - RouterModule - ], - exports: [ VolumeListComponent ], - providers: [ - HttpService, - VolumeService, - SnapshotService, - ProfileService, - ReplicationService, - ConfirmationService - ] -}) -export class VolumeListModule { } diff --git a/dashboard/src/app/business/cloud/cloud-service-item/cloud-service-item.component.html b/dashboard/src/app/business/cloud/cloud-service-item/cloud-service-item.component.html deleted file mode 100644 index 6d63c84d9..000000000 --- a/dashboard/src/app/business/cloud/cloud-service-item/cloud-service-item.component.html +++ /dev/null @@ -1,13 +0,0 @@ -
-
- -
-

{{cloudService.name}}

-
-
region:{{cloudService.region}}
-
type:{{cloudService.type}}
-
- -
-
-
\ No newline at end of file diff --git a/dashboard/src/app/business/cloud/cloud-service-item/cloud-service-item.component.scss b/dashboard/src/app/business/cloud/cloud-service-item/cloud-service-item.component.scss deleted file mode 100644 index 8fa4efde1..000000000 --- a/dashboard/src/app/business/cloud/cloud-service-item/cloud-service-item.component.scss +++ /dev/null @@ -1,15 +0,0 @@ -.img-div { - width: 217px; - height: 153px; - position: relative; - background-image: url(../../../../assets/business/images/cloud_service/u2309.png); - text-align: center; -} - -.img-center { - height: 60px; - position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%, -40%); -} \ No newline at end of file diff --git a/dashboard/src/app/business/cloud/cloud-service-item/cloud-service-item.component.spec.ts b/dashboard/src/app/business/cloud/cloud-service-item/cloud-service-item.component.spec.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/dashboard/src/app/business/cloud/cloud-service-item/cloud-service-item.component.ts b/dashboard/src/app/business/cloud/cloud-service-item/cloud-service-item.component.ts deleted file mode 100644 index 70ae7a471..000000000 --- a/dashboard/src/app/business/cloud/cloud-service-item/cloud-service-item.component.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { Component, OnInit, Input } from '@angular/core'; - -@Component({ - selector: 'app-cloud-service-item', - templateUrl: './cloud-service-item.component.html', - styleUrls: ['./cloud-service-item.component.scss'] -}) -export class CloudServiceItemComponent implements OnInit { - - @Input() cloudService; - - constructor() { } - - ngOnInit() { - } - - deleteCloud(name){ - alert("delete "+name); - //删除某个云 - } - -} diff --git a/dashboard/src/app/business/cloud/cloud.component.html b/dashboard/src/app/business/cloud/cloud.component.html deleted file mode 100644 index 40a9ccf9f..000000000 --- a/dashboard/src/app/business/cloud/cloud.component.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/dashboard/src/app/business/cloud/cloud.component.scss b/dashboard/src/app/business/cloud/cloud.component.scss deleted file mode 100644 index e69de29bb..000000000 diff --git a/dashboard/src/app/business/cloud/cloud.component.ts b/dashboard/src/app/business/cloud/cloud.component.ts deleted file mode 100644 index 616b22281..000000000 --- a/dashboard/src/app/business/cloud/cloud.component.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Component, OnInit } from '@angular/core'; - -@Component({ - selector: 'app-cloud', - templateUrl: './cloud.component.html', - styleUrls: ['./cloud.component.scss'] -}) -export class CloudComponent implements OnInit { - - constructor() { } - - ngOnInit() { - } - -} diff --git a/dashboard/src/app/business/cloud/cloud.module.ts b/dashboard/src/app/business/cloud/cloud.module.ts deleted file mode 100644 index eec027959..000000000 --- a/dashboard/src/app/business/cloud/cloud.module.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { RouterModule } from '@angular/router'; -import { FormsModule } from '@angular/forms'; - -import { ButtonModule,MessageModule,TabViewModule,DialogModule,DropdownModule } from '../../components/common/api'; - -import { CloudComponent } from './cloud.component'; -import { RegistryComponent } from './registry/registry.component'; -import { ReplicationComponent } from './replication/replication.component'; -import { MigrationComponent } from './migration/migration.component'; -import { CloudServiceItemComponent } from './cloud-service-item/cloud-service-item.component'; - -let routers = [{ - path: '', - component: CloudComponent -}] - -@NgModule({ - imports: [ - CommonModule, - RouterModule.forChild(routers), - FormsModule, - ButtonModule, - MessageModule, - TabViewModule, - DialogModule, - DropdownModule - ], - declarations: [ - CloudComponent, - RegistryComponent, - ReplicationComponent, - MigrationComponent, - CloudServiceItemComponent - ] -}) -export class CloudModule { } diff --git a/dashboard/src/app/business/cloud/migration/migration.component.html b/dashboard/src/app/business/cloud/migration/migration.component.html deleted file mode 100644 index 6b120b252..000000000 --- a/dashboard/src/app/business/cloud/migration/migration.component.html +++ /dev/null @@ -1,3 +0,0 @@ -

- migration works! -

diff --git a/dashboard/src/app/business/cloud/migration/migration.component.scss b/dashboard/src/app/business/cloud/migration/migration.component.scss deleted file mode 100644 index e69de29bb..000000000 diff --git a/dashboard/src/app/business/cloud/migration/migration.component.ts b/dashboard/src/app/business/cloud/migration/migration.component.ts deleted file mode 100644 index 26ce78ea3..000000000 --- a/dashboard/src/app/business/cloud/migration/migration.component.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Component, OnInit } from '@angular/core'; - -@Component({ - selector: 'app-migration', - templateUrl: './migration.component.html', - styleUrls: ['./migration.component.scss'] -}) -export class MigrationComponent implements OnInit { - - constructor() { } - - ngOnInit() { - } - -} diff --git a/dashboard/src/app/business/cloud/registry/registry.component.html b/dashboard/src/app/business/cloud/registry/registry.component.html deleted file mode 100644 index 03de8009d..000000000 --- a/dashboard/src/app/business/cloud/registry/registry.component.html +++ /dev/null @@ -1,41 +0,0 @@ -
-
- -
-
-
- -
-
-
-
- - - -
-
- {{label.name}} - -
-
- {{label.type}} - -
-
- {{label.region}} - -
-
- {{label.accessKey}} - -
-
- {{label.secretKey}} - -
-
- - - - -
\ No newline at end of file diff --git a/dashboard/src/app/business/cloud/registry/registry.component.scss b/dashboard/src/app/business/cloud/registry/registry.component.scss deleted file mode 100644 index e69de29bb..000000000 diff --git a/dashboard/src/app/business/cloud/registry/registry.component.ts b/dashboard/src/app/business/cloud/registry/registry.component.ts deleted file mode 100644 index ca8367cd8..000000000 --- a/dashboard/src/app/business/cloud/registry/registry.component.ts +++ /dev/null @@ -1,90 +0,0 @@ -import { Component, OnInit } from '@angular/core'; - -@Component({ - selector: 'app-registry', - templateUrl: './registry.component.html', - styleUrls: ['./registry.component.scss'] -}) -export class RegistryComponent implements OnInit { - - registryServiceDisplay = false; - label; - cloudServices = []; - serviceTypeOptions = []; - regionOptions = []; - selectedType = ''; - selectedRegion = ''; - - - constructor() { } - - ngOnInit() { - //界面文本 - this.label = { - name: 'Service Name', - type: 'Service Type', - region: 'Region', - accessKey: 'AWS Access Key', - secretKey: 'Secret Key' - }; - - //type下拉框的项 - this.serviceTypeOptions = [ - { label: 'AWS S3', value: { id: 0, name: 'New York', code: 'NY' } }, - { label: 'Microsoft Azure Blob Storage', value: { id: 1, name: 'New York', code: 'NY' } }, - { label: 'Huawei OBS', value: { id: 2, name: 'Rome', code: 'RM' } } - ]; - - //region下拉框的项 - this.regionOptions = [ - { label: 'CN North', value: { id: 0, name: 'New York', code: 'NY' } }, - { label: 'CN South', value: { id: 1, name: 'New York', code: 'NY' } }, - { label: 'Huawei OBS', value: { id: 2, name: 'Rome', code: 'RM' } } - ]; - - //查询回来已有的云服务 - this.cloudServices = [ - { - name:'service_for_analytics', - region:'EU(Paris)', - type:'AWS S3' - }, - { - name:'service_for_finance', - region:'CN North', - type:'Huawei OBS' - }, - { - name:'service_for_media', - region:'North Europe', - type:'Microsoft Azure Blob Storage' - } - ]; - - - - - - } - - showRegistryService() { - this.registryServiceDisplay = true; - } - - registryCloud() { - //http注册新的云 - alert("registry"); - } - - getServiceType() { - //http获取service type - } - - getRegions() { - //http获取regions - } - - getCloudServices() { - //http获取cloudServices - } -} diff --git a/dashboard/src/app/business/cloud/replication/replication.component.html b/dashboard/src/app/business/cloud/replication/replication.component.html deleted file mode 100644 index ac4e19a5b..000000000 --- a/dashboard/src/app/business/cloud/replication/replication.component.html +++ /dev/null @@ -1,29 +0,0 @@ - \ No newline at end of file diff --git a/dashboard/src/app/business/cloud/replication/replication.component.scss b/dashboard/src/app/business/cloud/replication/replication.component.scss deleted file mode 100644 index e69de29bb..000000000 diff --git a/dashboard/src/app/business/cloud/replication/replication.component.ts b/dashboard/src/app/business/cloud/replication/replication.component.ts deleted file mode 100644 index b6b2efd92..000000000 --- a/dashboard/src/app/business/cloud/replication/replication.component.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Component, OnInit } from '@angular/core'; - -@Component({ - selector: 'app-replication', - templateUrl: './replication.component.html', - styleUrls: ['./replication.component.scss'] -}) -export class ReplicationComponent implements OnInit { - - constructor() { } - - ngOnInit() { - } - -} diff --git a/dashboard/src/app/business/home/home.component.html b/dashboard/src/app/business/home/home.component.html deleted file mode 100644 index 3b4104d07..000000000 --- a/dashboard/src/app/business/home/home.component.html +++ /dev/null @@ -1,125 +0,0 @@ -
-
-
-

{{I18N.keyID["sds_home_overvew"]}}

-

{{I18N.keyID["sds_home_update"]}}

-
-
-
-
-
-
- -
-
- -
-
-
-
-
- -
-
- -
-
-
-
-
-
- -
-
-
- -
-
- -
-
- -
-
-
- - -
-
-
-
-
-

{{I18N.keyID["Capacity"]}}

-
-
-
{{I18N.keyID["sds_home_block_capacity"]}}
-

{{I18N.keyID["sds_home_update"]}}

-
- -
-
-
-
-
{{I18N.keyID["sds_home_top5"]}}
-

{{I18N.keyID["sds_home_update"]}}

- -
-
-
-
- -
-
-
-

Overview

-

Updated 5 minutes ago

-
-
- - -
-
-
- -
-
- -
-
- -
-
-
-
-
- -
-

Trend

-
-
-
Trend of block storage capacity growth
-

Updated 5 minutes ago

-
- -
-
-
-
-
Trend of quantity of volumes growth
-

Updated 5 minutes ago

-
- -
-
-
-
-
diff --git a/dashboard/src/app/business/home/home.component.scss b/dashboard/src/app/business/home/home.component.scss deleted file mode 100644 index 07ab7ba06..000000000 --- a/dashboard/src/app/business/home/home.component.scss +++ /dev/null @@ -1,43 +0,0 @@ -@import "./../scss-variable"; -.img-item-div-height { - height: 258px; - margin: 2em; -} - -.statisBg{ - background: #f3f6f7; - border-radius: 12px; -} - -.img-item-div { - padding: 2em; - border-radius: 10px; - // background-color: rgb(208, 232, 240); -} - -.home-img-item-margin { - margin: 2em 0; -} - -.user-img-item-margin { - margin-top: 3em; -} - -.header-h2-title-font { - font-size: 2em; - padding: 0.5em 0.25em; -} - -.home-font-color-class { - color: map-get($color-title, primary); - padding-bottom: .30rem; -} - -.header-p-text { - padding: 0 0.5em; - // color: map-get($color-title, secondary); -} - -.capacity-secondary { - margin: 1em 0; -} \ No newline at end of file diff --git a/dashboard/src/app/business/home/home.component.ts b/dashboard/src/app/business/home/home.component.ts deleted file mode 100644 index 5d3e7551e..000000000 --- a/dashboard/src/app/business/home/home.component.ts +++ /dev/null @@ -1,271 +0,0 @@ -import { Component, OnInit, ViewContainerRef, ViewChild, Directive, ElementRef, HostBinding, HostListener } from '@angular/core'; -import { Http } from '@angular/http'; -import { ParamStorService } from 'app/shared/api'; -import { ProfileService } from 'app/business/profile/profile.service'; -import { Observable } from "rxjs/Rx"; -import { I18NService } from 'app/shared/api'; - -@Component({ - templateUrl: './home.component.html', - styleUrls: [ - './home.component.scss' - ] -}) -export class HomeComponent implements OnInit { - items = []; - chartDatas; - chartDatasbar; - option; - chartBarOpion; - profileOptions = []; - lineData_nums; - lineData_capacity; - showAdminStatis = true; - tenants =[]; - constructor( - private http: Http, - private paramStor: ParamStorService, - private profileService: ProfileService, - private I18N: I18NService, - ) { } - - ngOnInit() { - if(this.paramStor.CURRENT_USER().split("|")[0] == "admin"){ - this.showAdminStatis = true; - this.getCountData(); - }else{ - this.showAdminStatis = false; - this.getTenantCountData(); - } - - this.items = [ - { - countNum: 0, - label: this.I18N.keyID["sds_home_tenants"] - }, - { - countNum:0, - label: this.I18N.keyID["sds_home_users"] - }, - { - countNum: 0, - label: this.I18N.keyID["sds_home_storages"] - }, - { - countNum: 0, - label: this.I18N.keyID["sds_home_pools"] - }, - { - countNum: 0, - label: this.I18N.keyID["sds_home_volumes"] - }, - { - countNum: 0, - label:this.I18N.keyID["sds_home_snapshots"] - }, - { - countNum: 0, - label: this.I18N.keyID["sds_home_replications"] - }, - { - countNum: 0, - label: "Cross-Region Replications" - }, - { - countNum: 0, - label: "Cross-Region Migrations" - } - ]; - - - this.option = { - cutoutPercentage: 80, - title: { - display: false, - text: 'My Title', - fontSize: 12 - }, - legend: { - labels: { - boxWidth: 12 - }, - display: true, - position: 'right', - fontSize: 12 - } - }; - this.chartBarOpion= { - scales: { - yAxes: [{ - ticks: { - min: 0, - } - }] - }, - legend: { - display: false - } - } - - this.lineData_capacity = { - labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'], - datasets: [ - { - label: 'Capacity(GB)', - data: [10, 11, 20, 160, 156, 195, 200], - fill: false, - borderColor: '#4bc0c0' - } - ] - } - - this.lineData_nums = { - labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'], - datasets: [ - { - label: 'Volumes', - data: [10, 23, 40, 38, 86, 107, 190], - fill: false, - borderColor: '#565656' - } - ] - } - - } - - getProfiles() { - this.profileService.getProfiles().subscribe((res) => { - let profiles = res.json(); - profiles.forEach(profile => { - this.profileOptions.push({ - name: profile.name, - id: profile.id, - capacity: 0 - }) - }); - }); - } - - listTenants() { - let request: any = { params:{} }; - request.params = { - "domain_id": "default" - } - - this.http.get("/v3/projects", request).subscribe((res) => { - - this.items[0].countNum = res.json().projects.length; - this.tenants = res.json().projects; - this.tenants.forEach((item, i)=>{ - if(item.name == "admin"){ - this.getAllvolumes(item.id, this.tenants.length - 1); - this.getAllSnapshots(item.id); - this.getAllReplications(item.id); - this.getAllPools(item.id); - this.getAllDocks(item.id); - } - }); - - - }); - } - listUsers(){ - let request: any = { params:{} }; - request.params = { - "domain_id": "default" - } - this.http.get("/v3/users", request).subscribe((res) => { - this.items[1].countNum = res.json().users.length; - }); - } - getAllvolumes(projectId, index?){ - let url = 'v1beta/'+projectId+'/block/volumes'; - this.http.get(url).subscribe((res)=>{ - this.items[4].countNum = this.items[4].countNum + res.json().length; - - if(this.showAdminStatis){ - res.json().forEach(volume => { - this.profileOptions.forEach(profile => { - if(volume.profileId == profile.id){ - profile.capacity = profile.capacity + volume.size; - } - }); - }); - - if(index == (this.tenants.length-1)){ - let [chartData, chartLabel] = [[],[]]; - this.profileOptions.forEach(ele=>{ - chartData.push(ele.capacity); - chartLabel.push(ele.name); - }); - - this.chartDatasbar = { - labels: chartLabel, - datasets: [{ - label:"Used Capacity (GB)", - backgroundColor: '#42A5F5', - data: chartData - }] - } - } - } - }); - } - getAllSnapshots(projectId){ - let url = 'v1beta/'+projectId+'/block/snapshots'; - this.http.get(url).subscribe((res)=>{ - this.items[5].countNum = this.items[5].countNum + res.json().length; - }); - } - getAllReplications(projectId){ - let url = 'v1beta/'+projectId+'/block/replications'; - this.http.get(url).subscribe((res)=>{ - if(res.json()){ - this.items[6].countNum = this.items[6].countNum + res.json().length; - } - }); - } - getAllPools(projectId){ - let url = 'v1beta/'+projectId+'/pools'; - this.http.get(url).subscribe((res)=>{ - this.items[3].countNum = this.items[3].countNum + res.json().length; - - let [storCapacityTotal, storCapacityFree]=[0,0]; - res.json().forEach(element => { - storCapacityTotal = storCapacityTotal + element.totalCapacity; - storCapacityFree = storCapacityFree + element.freeCapacity; - }); - - this.chartDatas = { - labels: [this.I18N.keyID["sds_home_used_capacity"] + " (GB)",this.I18N.keyID["sds_home_free_capacity"] + " (GB)"], - datasets: [ - { - label: 'high_capacity', - data: [(storCapacityTotal-storCapacityFree), storCapacityFree], - backgroundColor: [ - "#438bd3", - "rgba(224, 224, 224, .5)" - ] - }] - }; - }); - } - getAllDocks(projectId){ - let url = 'v1beta/'+projectId+'/docks'; - this.http.get(url).subscribe((res)=>{ - this.items[2].countNum = this.items[2].countNum + res.json().length; - }); - } - getCountData(){ - this.getProfiles(); - this.listTenants(); - this.listUsers(); - } - - getTenantCountData(){ - let tenantId = this.paramStor.CURRENT_TENANT().split("|")[1]; - this.getAllvolumes(tenantId); - this.getAllSnapshots(tenantId); - this.getAllReplications(tenantId); - } -} diff --git a/dashboard/src/app/business/home/home.module.ts b/dashboard/src/app/business/home/home.module.ts deleted file mode 100644 index 62667a672..000000000 --- a/dashboard/src/app/business/home/home.module.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { NgModule, APP_INITIALIZER } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { HomeComponent } from './home.component'; -import { ImgItemComponent } from './imgItem.component/imgItem.component'; -import { ProfileService } from 'app/business/profile/profile.service'; -import { HttpService } from 'app/shared/service/Http.service'; - -import { RouterModule } from '@angular/router'; -import { ButtonModule, ChartModule } from '../../components/common/api'; - -let routers = [{ - path: '', - component: HomeComponent -}] - -@NgModule({ - declarations: [ - HomeComponent, - ImgItemComponent, - ], - imports: [ - RouterModule.forChild(routers), ButtonModule, - CommonModule, - ChartModule - ], - providers: [HttpService, ProfileService] -}) -export class HomeModule { } \ No newline at end of file diff --git a/dashboard/src/app/business/home/imgItem.component/imgItem.component.html b/dashboard/src/app/business/home/imgItem.component/imgItem.component.html deleted file mode 100644 index 44dfee26c..000000000 --- a/dashboard/src/app/business/home/imgItem.component/imgItem.component.html +++ /dev/null @@ -1,10 +0,0 @@ -
-
- -
-
-
{{item.countNum}}
-
{{item.label}}
-
-
-
\ No newline at end of file diff --git a/dashboard/src/app/business/home/imgItem.component/imgItem.component.scss b/dashboard/src/app/business/home/imgItem.component/imgItem.component.scss deleted file mode 100644 index 53ab0a516..000000000 --- a/dashboard/src/app/business/home/imgItem.component/imgItem.component.scss +++ /dev/null @@ -1,13 +0,0 @@ -@import "./../../scss-variable"; -.img-item-float-class { - float: left; -} - -.img-width { - width: 80px; -} - -.title-font-class { - color: map-get($color-primary, normal); - font-size: 2em; -} diff --git a/dashboard/src/app/business/home/imgItem.component/imgItem.component.ts b/dashboard/src/app/business/home/imgItem.component/imgItem.component.ts deleted file mode 100644 index 1542cf100..000000000 --- a/dashboard/src/app/business/home/imgItem.component/imgItem.component.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { Component, OnInit, ViewContainerRef, ViewChild, Directive, ElementRef, HostBinding, HostListener,Input } from '@angular/core'; -import { Http } from '@angular/http'; - -@Component({ - selector: 'img-item', - templateUrl: './imgItem.component.html', - styleUrls: [ - './imgItem.component.scss' - ] -}) -export class ImgItemComponent implements OnInit{ - @Input() item; - - - constructor( - private http: Http - ){} - - ngOnInit() { - } -} diff --git a/dashboard/src/app/business/identity/identity.component.ts b/dashboard/src/app/business/identity/identity.component.ts deleted file mode 100644 index b3855ea97..000000000 --- a/dashboard/src/app/business/identity/identity.component.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { Router } from '@angular/router'; -import { Component, OnInit, ViewContainerRef, ViewChild, Directive, ElementRef, HostBinding, HostListener } from '@angular/core'; -import { I18NService } from 'app/shared/api'; -import { AppService } from 'app/app.service'; -import { trigger, state, style, transition, animate} from '@angular/animations'; -import { I18nPluralPipe } from '@angular/common'; - -@Component({ - templateUrl: './identity.html', - styleUrls: [ - - ], - animations: [ - trigger('overlayState', [ - state('hidden', style({ - opacity: 0 - })), - state('visible', style({ - opacity: 1 - })), - transition('visible => hidden', animate('400ms ease-in')), - transition('hidden => visible', animate('400ms ease-out')) - ]), - - trigger('notificationTopbar', [ - state('hidden', style({ - height: '0', - opacity: 0 - })), - state('visible', style({ - height: '*', - opacity: 1 - })), - transition('visible => hidden', animate('400ms ease-in')), - transition('hidden => visible', animate('400ms ease-out')) - ]) - ] -}) -export class IdentityComponent implements OnInit{ - constructor( - public I18N: I18NService, - // private router: Router - ){} - - ngOnInit() { - - } -} diff --git a/dashboard/src/app/business/identity/identity.html b/dashboard/src/app/business/identity/identity.html deleted file mode 100644 index 54a80ec44..000000000 --- a/dashboard/src/app/business/identity/identity.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/dashboard/src/app/business/identity/identity.module.ts b/dashboard/src/app/business/identity/identity.module.ts deleted file mode 100644 index dd40892b6..000000000 --- a/dashboard/src/app/business/identity/identity.module.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { NgModule, APP_INITIALIZER } from '@angular/core'; -import { IdentityComponent } from './identity.component'; -import { RouterModule } from '@angular/router'; -import { TabViewModule } from '../../components/common/api'; -import { TenantListModule } from './tenantList.module'; -import { UserListModule } from './userList.module'; - -let routers = [{ - path: '', - component: IdentityComponent -}] - -@NgModule({ - declarations: [ - IdentityComponent - ], - imports: [ - RouterModule.forChild(routers), - TenantListModule, - UserListModule, - TabViewModule - ], - providers: [] -}) -export class IdentityModule { } \ No newline at end of file diff --git a/dashboard/src/app/business/identity/tenantDetail/tenantDetail.component.ts b/dashboard/src/app/business/identity/tenantDetail/tenantDetail.component.ts deleted file mode 100644 index f26c08c2c..000000000 --- a/dashboard/src/app/business/identity/tenantDetail/tenantDetail.component.ts +++ /dev/null @@ -1,205 +0,0 @@ -import { Component, Input, OnInit, ViewContainerRef, ViewChild, Directive, ElementRef, HostBinding, HostListener } from '@angular/core'; -import { Http } from '@angular/http'; -import { I18NService, Utils } from 'app/shared/api'; -import { AppService } from 'app/app.service'; -import { ParamStorService } from 'app/shared/api'; -import { I18nPluralPipe } from '@angular/common'; -import { trigger, state, style, transition, animate } from '@angular/animations'; -import { MenuItem, ConfirmationService} from '../../../components/common/api'; - -@Component({ - selector: 'tenant-detail', - templateUrl: 'tenantDetail.html', - styleUrls: ['tenantDetail.scss'], - providers: [ConfirmationService], - animations: [] -}) -export class TenantDetailComponent implements OnInit { - @Input() projectID; - @Input() projectName; - @Input() isDetailFinished: Boolean; - addUserDisplay: boolean=false; - userfilter: string=""; - projectGroups = []; - users = []; - popSelectedUsers; - allUsers; - - statistics_volumeSnapshots: string; - statistics_volumes: string; - statistics_capacity: string; - - constructor( - private http: Http, - private confirmationService: ConfirmationService, - private paramStor: ParamStorService, - public I18N: I18NService, - // private router: Router - ) { } - - ngOnInit() { - this.listProjectGroup(); - this.projectResources(); - } - - projectResources(){ - this.http.get("/v1beta/"+ this.projectID +"/block/volumes").subscribe((res)=>{ - let originCapacity = 0; - res.json().map(ele => { - originCapacity += ele.size; - }) - this.statistics_volumes = res.json().length; - this.statistics_capacity = Utils.getDisplayGBCapacity(originCapacity); - }) - - this.http.get("/v1beta/"+ this.projectID +"/block/snapshots").subscribe((res)=>{ - this.statistics_volumeSnapshots = res.json().length; - }) - } - - listProjectGroup(){ - this.http.get("/v3/role_assignments?scope.project.id="+ this.projectID).subscribe((res)=>{ - let arr = res.json().role_assignments; - let newarr = []; - let roles=[]; - - // get roles - let reqRole: any = { params:{} }; - this.http.get("/v3/roles", reqRole).subscribe((roleRES) => { - let currentRoleName = this.projectName == "admin" ? "admin" : (this.projectName == "service" ? "service" : "Member"); - - roleRES.json().roles.forEach((item, index) => { - if(item.name == currentRoleName){ // more role can be expand - let roleJson = {}; - roleJson["id"] = item.id; - roleJson["name"] = item.name; - roles.push(roleJson); - } - }) - - roles.forEach((item, index)=>{ - arr.forEach(ele => { - if(ele.role.id == item.id){ - ele.role["name"] = item.name; - newarr.push(ele); - } - }); - }) - - newarr.forEach((item, index) => { - if(item.group){ - let groupJson = {}; - groupJson["groupid"] = item.group.id; - groupJson["grouprole"] = item.role - this.projectGroups.push(groupJson); - } - }); - - this.listUsers(); - }) - }) - } - - showAddUsers(){ - this.addUserDisplay = true; - this.listAllUsers(); - } - - addUsers(){ - - let group_id; - this.projectGroups.forEach((item)=>{ - if(item.grouprole.name == "Member"){ - group_id = item.groupid; - } - }) - - this.popSelectedUsers.forEach((user, i) => { - let request: any = {}; - this.http.put("/v3/groups/"+ group_id +"/users/"+ user.id, request).subscribe((r) => { - if(i == (this.popSelectedUsers.length-1)){ - this.listUsers(); - this.addUserDisplay = false; - } - }) - }); - - } - - listAllUsers(){ - this.popSelectedUsers = []; - this.allUsers = []; - let request: any = { params:{} }; - request.params = { - "domain_id": "default" - } - - if(this.userfilter != ""){ - request.params["name"] = this.userfilter; - } - - this.http.get("/v3/users", request).subscribe((res) => { - let newarr = []; - res.json().users.map((item, index) => { - item["description"] = item.description == '' ? '--' : item.description; - newarr.push(item); - }); - - //Filter added users - if(this.users.length > 0){ - this.users.forEach((addedUser) => { - this.allUsers = newarr.filter((user, idx, arr)=>{ - return (user.name != 'admin' && user.name != 'opensds' && user.name != addedUser.name); - }) - }) - }else{ - this.allUsers = newarr.filter((user, idx, arr)=>{ - return (user.name != 'admin' && user.name != 'opensds'); - }) - } - - }); - } - - listUsers(){ - this.users = []; - this.isDetailFinished = false; - this.projectGroups.forEach((item, index)=>{ - let request: any = { params:{} }; - this.http.get("/v3/groups/"+ item.groupid +"/users", request).subscribe((userRES)=>{ - userRES.json().users.forEach((ele) => { - ele["role"] = item.grouprole.name; - ele["description"] = ele.description == '' ? '--' : ele.description; - this.users.push(ele); - }); - - this.isDetailFinished = true; - }) - }) - - } - - removeUser(user){ - let group_id; - this.projectGroups.forEach((item)=>{ - if(item.grouprole.name == user.role){ - group_id = item.groupid; - } - }) - - let msg = "
Are you sure you want to remove the user?

[ "+ user.name +" ]

" - this.confirmationService.confirm({ - message: msg, - header: "Remove user", - acceptLabel: "Remove", - accept: ()=>{ - let request: any = {}; - this.http.delete("/v3/groups/"+ group_id +"/users/"+ user.id, request).subscribe((r) => { - this.listUsers(); - }) - }, - reject:()=>{} - }) - } - -} diff --git a/dashboard/src/app/business/identity/tenantDetail/tenantDetail.html b/dashboard/src/app/business/identity/tenantDetail/tenantDetail.html deleted file mode 100644 index 8b8bf9987..000000000 --- a/dashboard/src/app/business/identity/tenantDetail/tenantDetail.html +++ /dev/null @@ -1,61 +0,0 @@ -
Loading...
-
- -

{{I18N.keyID['sds_identity_res_usage']}}

-
    -
  • {{I18N.keyID['sds_identity_tenant_cap']}}: {{ statistics_capacity }}
  • -
  • {{I18N.keyID['sds_home_volumes']}}: {{ statistics_volumes }}
  • -
  • {{I18N.keyID['sds_home_snapshots']}}: {{ statistics_volumeSnapshots }}
  • -
- -

{{I18N.keyID['sds_identity_tenant_manage']}}

-
-
-
- - - - - -
-
-
- - - - - Remove - - -
-
- - -
-
-
-
- - -
- -
-
- - - - - -
-
-
- -
- - - - - -
- - \ No newline at end of file diff --git a/dashboard/src/app/business/identity/tenantDetail/tenantDetail.module.ts b/dashboard/src/app/business/identity/tenantDetail/tenantDetail.module.ts deleted file mode 100644 index 445f9a9a4..000000000 --- a/dashboard/src/app/business/identity/tenantDetail/tenantDetail.module.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { NgModule, APP_INITIALIZER } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { TenantDetailComponent } from './tenantDetail.component'; -import { ButtonModule, DataTableModule, DropMenuModule, DialogModule, ConfirmDialogModule, BadgeModule, InputTextModule } from '../../../components/common/api'; - -@NgModule({ - declarations: [ TenantDetailComponent ], - imports: [ CommonModule, ButtonModule, DataTableModule, DropMenuModule, DialogModule, ConfirmDialogModule, BadgeModule, InputTextModule ], - exports: [ TenantDetailComponent ], - providers: [] -}) -export class TenantDetailModule { } \ No newline at end of file diff --git a/dashboard/src/app/business/identity/tenantDetail/tenantDetail.scss b/dashboard/src/app/business/identity/tenantDetail/tenantDetail.scss deleted file mode 100644 index 1fadb369d..000000000 --- a/dashboard/src/app/business/identity/tenantDetail/tenantDetail.scss +++ /dev/null @@ -1,15 +0,0 @@ -.table-detail-con > ul{ - display: flex; - display: -webkit-flex; - justify-content: space-between; - padding-bottom: 0.25rem; -} -.table-detail-con > ul li{ - color: #666; - width: 30%; -} -.table-detail-con > ul li span{ - padding-left: 0.1rem; - font-size: 20px; - color: #40BCEC; -} \ No newline at end of file diff --git a/dashboard/src/app/business/identity/tenantList.component.ts b/dashboard/src/app/business/identity/tenantList.component.ts deleted file mode 100644 index 12a9bb0c2..000000000 --- a/dashboard/src/app/business/identity/tenantList.component.ts +++ /dev/null @@ -1,248 +0,0 @@ -import { Component, OnInit, ViewContainerRef, ViewChild, Directive, ElementRef, HostBinding, HostListener, ViewChildren } from '@angular/core'; -import { Http } from '@angular/http'; -import { I18NService } from 'app/shared/api'; -import { AppService } from 'app/app.service'; -import { I18nPluralPipe } from '@angular/common'; -import { trigger, state, style, transition, animate } from '@angular/animations'; -import { MenuItem, ConfirmationService } from '../../components/common/api'; -import { FormControl, FormGroup, FormBuilder, Validators, ValidatorFn, AbstractControl} from '@angular/forms'; - -let _ = require("underscore"); - -@Component({ - selector: 'tenant-list', - templateUrl: 'tenantList.html', - styleUrls: [], - providers: [ConfirmationService], - animations: [] -}) -export class TenantListComponent implements OnInit { - tenants = []; - isDetailFinished = false; - createTenantDisplay = false; - isEditTenant = false; - - selectedTenants = []; - - sortField: string; - currentTenant: string; - popTitle: string; - - tenantFormGroup; - projectID: string; - projectName: string; - - validRule= { - 'name':'^[a-zA-Z]{1}([a-zA-Z0-9]|[_]){0,127}$' - }; - - constructor( - private http: Http, - private confirmationService: ConfirmationService, - public I18N: I18NService, - // private router: Router, - private fb: FormBuilder - ) { - this.tenantFormGroup = this.fb.group({ - "form_name": ["", [Validators.required, Validators.pattern(this.validRule.name), this.ifTenantExisting(this.tenants)] ], - "form_description":["", Validators.maxLength(200) ], - }) - } - - errorMessage = { - "form_name": { required: "Username is required.", pattern:"Beginning with a letter with a length of 1-128, it can contain letters / numbers / underlines.", ifTenantExisting:"Tenant is existing."}, - "form_description": { maxlength: "Max. length is 200."} - }; - - ngOnInit() { - this.listTenants(); - - } - - ifTenantExisting (param: any): ValidatorFn{ - return (c: AbstractControl): {[key:string]: boolean} | null => { - let isExisting= false; - this.tenants.forEach(element => { - if(element.name == c.value){ - isExisting = true; - } - }) - if(isExisting && this.isEditTenant == false){ - return {'ifTenantExisting': true}; - }else{ - return null; - } - } - } - - listTenants() { - this.tenants=[]; - this.selectedTenants = []; - - this.sortField = "name"; - - let request: any = { params:{} }; - request.params = { - "domain_id": "default" - } - - this.http.get("/v3/projects", request).subscribe((res) => { - this.tenants = res.json().projects; - this.tenants.forEach((item)=>{ - item["description"] = item.description == '' ? '--' : item.description; - if(item.name == "admin" || item.name == "service"){ - item["disabled"] = true; - } - }) - }); - } - - showCreateTenant(tenant?) { - this.createTenantDisplay = true; - - //Reset form - this.tenantFormGroup.reset(); - - if(tenant){ - this.isEditTenant = true; - this.popTitle = "Modify"; - - this.currentTenant = tenant.id; - - this.tenantFormGroup.controls['form_name'].value = tenant.name; - this.tenantFormGroup.controls['form_description'].value = tenant.description; - - }else{ - this.isEditTenant = false; - this.popTitle = "Create"; - - } - } - - createTenant(){ - let request: any = { project:{} }; - request.project = { - "domain_id": "default", - "name": this.tenantFormGroup.value.form_name, - "description": this.tenantFormGroup.value.form_description - } - - if(this.tenantFormGroup.status == "VALID"){ - // create tenant - this.http.post("/v3/projects", request).subscribe((res) => { - let tenantid = res.json().project.id; - - - // get roles - let request: any = { params:{} }; - this.http.get("/v3/roles", request).subscribe((roleRES) => { - roleRES.json().roles.forEach((item, index) => { - if(item.name == "Member"){ - // create group for role named [Member] - let request: any = { group:{} }; - request.group = { - "domain_id": "default", - "name": "group_"+ tenantid + "_Member" - } - this.http.post("/v3/groups/", request).subscribe((groupRES) => { - let groupid = groupRES.json().group.id; - - // Assign role to group on project - let reqRole: any = { }; - this.http.put("/v3/projects/"+ tenantid +"/groups/"+ groupid +"/roles/"+ item.id, reqRole).subscribe(() => { - this.createTenantDisplay = false; - this.listTenants(); - }) - }); - } - }) - - }) - - - }); - }else{ - // validate - for(let i in this.tenantFormGroup.controls){ - this.tenantFormGroup.controls[i].markAsTouched(); - } - } - } - - updateTenant(){ - let request: any = { project:{} }; - request.project = { - "domain_id": "default", - "name": this.tenantFormGroup.value.form_name, - "description": this.tenantFormGroup.value.form_description - } - - if(this.tenantFormGroup.status == "VALID"){ - this.http.patch("/v3/projects/"+ this.currentTenant, request).subscribe((res) => { - this.createTenantDisplay = false; - this.listTenants(); - }); - } - } - - deleteTenant(tenants){ - let arr=[],msg; - if(_.isArray(tenants)){ - tenants.forEach((item,index)=> { - arr.push(item.id); - }) - msg = "
Are you sure you want to delete the selected tenants?

[ "+ tenants.length +" Tenants ]

"; - }else{ - arr.push(tenants.id); - msg = "
Are you sure you want to delete the tenant?

[ "+ tenants.name +" ]

" - } - - this.confirmationService.confirm({ - message: msg, - header: "Delete Tenant", - acceptLabel: "Delete", - isWarning: true, - accept: ()=>{ - arr.forEach((ele)=> { - this.http.get("/v3/role_assignments?scope.project.id="+ ele).subscribe((res)=>{ - res.json().role_assignments.forEach((item, index) => { - if(item.group){ - let request: any = {}; - this.http.delete("/v3/groups/"+ item.group.id, request).subscribe(); - } - }); - - let request: any = {}; - this.http.delete("/v3/projects/"+ ele, request).subscribe((r) => { - this.listTenants(); - }) - }) - }) - }, - reject:()=>{} - }) - - } - - onRowExpand(evt) { - this.isDetailFinished = false; - this.projectID = evt.data.id; - this.projectName = evt.data.name; - } - - tablePaginate() { - this.selectedTenants = []; - } - - label: object = { - tenantNameLabel: 'Name', - descriptionLabel: 'Description', - } - -} - - - - - - diff --git a/dashboard/src/app/business/identity/tenantList.html b/dashboard/src/app/business/identity/tenantList.html deleted file mode 100644 index 9b0cfd316..000000000 --- a/dashboard/src/app/business/identity/tenantList.html +++ /dev/null @@ -1,53 +0,0 @@ -
-

A tenant is used to group and manage resources and users.

-
- -
-
- - -
-
-
- - -
- -
-
- - - - - - - - - {{I18N.keyID['sds_block_volume_modify']}} - {{I18N.keyID['sds_block_volume_delete']}} - - - - - - - - -
- - - - - - - -
- - - - - - -
- - \ No newline at end of file diff --git a/dashboard/src/app/business/identity/tenantList.module.ts b/dashboard/src/app/business/identity/tenantList.module.ts deleted file mode 100644 index 3111b2c79..000000000 --- a/dashboard/src/app/business/identity/tenantList.module.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { NgModule, APP_INITIALIZER } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { TenantListComponent } from './tenantList.component'; -import { ReactiveFormsModule, FormsModule } from '@angular/forms'; -import { FormModule, CheckboxModule, ConfirmDialogModule, ButtonModule, MultiSelectModule, DataTableModule, DropMenuModule, DialogModule, InputTextModule, InputTextareaModule, DropdownModule } from '../../components/common/api'; -import { TenantDetailModule } from './tenantDetail/tenantDetail.module'; - -@NgModule({ - declarations: [ TenantListComponent ], - imports: [ - CommonModule, - ButtonModule, - DataTableModule, - DropMenuModule, - DialogModule, - InputTextModule, - InputTextareaModule, - ReactiveFormsModule, - FormsModule, - FormModule, - ConfirmDialogModule, - MultiSelectModule, - CheckboxModule, - TenantDetailModule - ], - exports: [ TenantListComponent ], - providers: [] -}) -export class TenantListModule { } \ No newline at end of file diff --git a/dashboard/src/app/business/identity/userDetail/userDetail.component.ts b/dashboard/src/app/business/identity/userDetail/userDetail.component.ts deleted file mode 100644 index 70ed1bd86..000000000 --- a/dashboard/src/app/business/identity/userDetail/userDetail.component.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { Component, Input, OnInit, ViewContainerRef, ViewChild, Directive, ElementRef, HostBinding, HostListener } from '@angular/core'; -import { Http } from '@angular/http'; -import { I18NService } from 'app/shared/api'; -import { AppService } from 'app/app.service'; -import { I18nPluralPipe } from '@angular/common'; -import { trigger, state, style, transition, animate } from '@angular/animations'; -import { MenuItem } from '../../../components/common/api'; - -@Component({ - selector: 'user-detail', - templateUrl: 'userDetail.html', - styleUrls: ['userDetail.scss'], - animations: [] -}) -export class userDetailComponent implements OnInit { - @Input() isUserDetailFinished: Boolean; - - @Input() detailUserInfo: string; - - userID: string; - - unspecified: boolean = false; - - ownedTenant: string = ""; - - constructor( - private http: Http, - // private I18N: I18NService, - // private router: Router - ) { } - - ngOnInit() { - this.userID = this.detailUserInfo; - - let request: any = { params: {} }; - this.http.get("/v3/users/" + this.userID + "/projects", request).subscribe((res) => { - if(res.json().projects.length == 0){ - this.ownedTenant = "Unspecified"; - this.unspecified = true; - } - res.json().projects.forEach((ele, i) => { - if(i==0){ - this.ownedTenant = ele.name; - }else{ - this.ownedTenant += ", "+ ele.name; - } - }); - - this.isUserDetailFinished = true; - }); - - } - -} diff --git a/dashboard/src/app/business/identity/userDetail/userDetail.html b/dashboard/src/app/business/identity/userDetail/userDetail.html deleted file mode 100644 index a2b900600..000000000 --- a/dashboard/src/app/business/identity/userDetail/userDetail.html +++ /dev/null @@ -1,7 +0,0 @@ -
Loading...
-
-
    -
  • {{ ownedTenant }}
  • -
  • {{ userID }}
  • -
-
\ No newline at end of file diff --git a/dashboard/src/app/business/identity/userDetail/userDetail.module.ts b/dashboard/src/app/business/identity/userDetail/userDetail.module.ts deleted file mode 100644 index 3df1c2b89..000000000 --- a/dashboard/src/app/business/identity/userDetail/userDetail.module.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { NgModule, APP_INITIALIZER } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { userDetailComponent } from './userDetail.component'; -import { ButtonModule, DataTableModule, DropMenuModule } from '../../../components/common/api'; - -@NgModule({ - declarations: [ userDetailComponent ], - imports: [ CommonModule, ButtonModule, DataTableModule, DropMenuModule ], - exports: [ userDetailComponent ], - providers: [] -}) -export class UserDetailModule { } \ No newline at end of file diff --git a/dashboard/src/app/business/identity/userDetail/userDetail.scss b/dashboard/src/app/business/identity/userDetail/userDetail.scss deleted file mode 100644 index 8cbddaa0d..000000000 --- a/dashboard/src/app/business/identity/userDetail/userDetail.scss +++ /dev/null @@ -1,18 +0,0 @@ -.table-detail-con > ul{ - padding: 0; -} -.table-detail-con > ul li{ - display: flex; - display: -webkit-flex; - justify-content: flex-start; - line-height: .28rem; -} -.table-detail-con > ul li label{ - display: inline-block; - width: 135px; - color: #8893a6; -} -.table-detail-con > ul li span{ - padding-left: 0.1rem; - color: #657D95; -} \ No newline at end of file diff --git a/dashboard/src/app/business/identity/userList.component.ts b/dashboard/src/app/business/identity/userList.component.ts deleted file mode 100644 index 09a16edd5..000000000 --- a/dashboard/src/app/business/identity/userList.component.ts +++ /dev/null @@ -1,395 +0,0 @@ -import { Component, OnInit, AfterViewChecked, AfterContentChecked, ViewContainerRef, ViewChild, Directive, ElementRef, HostBinding, HostListener, ViewChildren } from '@angular/core'; -import { Http } from '@angular/http'; -import { I18NService } from 'app/shared/api'; -import { AppService } from 'app/app.service'; -import { I18nPluralPipe } from '@angular/common'; -import { trigger, state, style, transition, animate, group } from '@angular/animations'; -import { MenuItem, ConfirmationService } from '../../components/common/api'; -import { FormControl, FormGroup, FormBuilder, Validators, ValidatorFn, AbstractControl} from '@angular/forms'; -import { retry } from 'rxjs/operators'; -import { forEach } from '@angular/router/src/utils/collection'; - -let _ = require("underscore"); - -@Component({ - selector: 'user-list', - templateUrl: 'userList.html', - styleUrls: [], - providers: [ConfirmationService], - animations: [] -}) -export class UserListComponent implements OnInit, AfterViewChecked { - tenantUsers = []; - createUserDisplay = false; - isUserDetailFinished = false; - isEditUser = false; - myFormGroup; - - selectedUsers = []; - - userRole: string; - tenantLists = []; - - username: string; - currentUser; - - detailUserInfo: string; - popTitle: string; - - sortField: string; - - validRule= { - 'name':'^[a-zA-Z]{1}([a-zA-Z0-9]|[_]){0,127}$' - }; - - newPassword = ""; - - constructor( - private http: Http, - private confirmationService: ConfirmationService, - public I18N: I18NService, - // private router: Router, - private fb: FormBuilder - ) { - - this.myFormGroup = this.fb.group({ - "form_username": ["", {validators:[Validators.required, Validators.pattern(this.validRule.name), this.ifUserExisting(this.tenantUsers)], updateOn:'change'} ], - "form_description":["", Validators.maxLength(200) ], - "form_tenant": [""], - "form_isModifyPsw": [true], - "form_psw": ["", {validators: [Validators.required, Validators.minLength(8), this.regPassword], updateOn:'blur'} ], - "form_pswConfirm": ["", [Validators.required, this.regConfirmPassword(this.newPassword)] ] - }) - } - - errorMessage = { - "form_username": { required: "Username is required.", pattern:"Beginning with a letter with a length of 1-128, it can contain letters / numbers / underlines.", ifUserExisting:"User is existing."}, - "form_description": { maxlength: "Max. length is 200."}, - "form_tenant": { required: "Tenant is required."}, - "form_psw": { required: "Password is required.", minlength: "At least two kinds of letters / numbers / special characters, min. length is 8.", regPassword:"At least two kinds of letters / numbers / special characters, min. length is 8." }, - "form_pswConfirm": { required: "Password is required.", regConfirmPassword: "Two inputted password inconsistencies." } - }; - - label:object = { - userNameLabel:'Username', - passwordLabel:'Password', - descriptionLabel:'Description', - confirmPasswordLabel:'Confirm Password', - roleLabel:'Role', - tenantLabel:'Tenant' - } - - ifUserExisting (param: any): ValidatorFn{ - return (c: AbstractControl): {[key:string]: boolean} | null => { - let isExisting= false; - this.tenantUsers.forEach(element => { - if(element.username == c.value){ - isExisting = true; - } - }) - if(isExisting){ - return {'ifUserExisting': true}; - }else{ - return null; - } - } - } - - regPassword(c:AbstractControl):{[key:string]:boolean} | null { - let reg1 = /.*[a-zA-Z]+.*/; - let reg2 = /.*[0-9]+.*/; - let reg3 = /.*[\ \`\~\!\@\#\$\%\^\&\*\(\)\-\_\=\+\\\|\[\{\}\]\;\:\'\"\,\<\.\>\/\?]+.*/; - if( !reg1.test(c.value) && !reg2.test(c.value) ){ - return {'regPassword': true}; - } - if( !reg1.test(c.value) && !reg3.test(c.value) ){ - return {'regPassword': true}; - } - if( !reg2.test(c.value) && !reg3.test(c.value) ){ - return {'regPassword': true}; - } - return null; - } - - regConfirmPassword (param: any): ValidatorFn{ - return (c: AbstractControl): {[key:string]: boolean} | null => { - if(c.value != this.newPassword){ - return {'regConfirmPassword': true}; - } - return null; - } - } - - showUserForm(user?): void{ - this.getRoles(); - this.getTenants(); - this.createUserDisplay = true; - - //Reset form - this.myFormGroup.reset(); - - if(user){ - this.isEditUser = true; - this.popTitle = "Modify"; - - this.username = user.username; - this.currentUser = user; - - this.myFormGroup.controls['form_description'].value = user.description; - this.myFormGroup.controls['form_isModifyPsw'].value = false; - - this.myFormGroup.controls['form_username'].clearValidators(); - this.myFormGroup.controls['form_psw'].clearValidators(); - this.myFormGroup.controls['form_pswConfirm'].clearValidators(); - - - }else{ - this.isEditUser = false; - this.popTitle = "Create"; - - this.myFormGroup.controls['form_isModifyPsw'].value = true; - this.myFormGroup.controls['form_username'].setValidators({validators:[Validators.required, Validators.pattern(this.validRule.name), this.ifUserExisting(this.tenantUsers)], updateOn:'change'}); - this.myFormGroup.controls['form_psw'].setValidators([Validators.required, Validators.minLength(8), this.regPassword]); - this.myFormGroup.controls['form_pswConfirm'].setValidators([Validators.required, this.regConfirmPassword(this.newPassword)] ); - } - - // Update form validate status - for(let i in this.myFormGroup.controls){ - this.myFormGroup.controls[i].updateValueAndValidity(); - } - } - - createUser(){ - let request: any = { user:{} }; - request.user = { - "domain_id": "default", - "name": this.myFormGroup.value.form_username, - "description": this.myFormGroup.value.form_description, - "password": this.myFormGroup.value.form_psw - } - - if(this.myFormGroup.status == "VALID"){ - this.http.post("/v3/users", request).subscribe( (res) => { - let tenants = this.myFormGroup.value.form_tenant; - - if(!tenants){ - this.createUserDisplay = false; - this.listUsers(); - return; - } - - tenants.forEach( (element, i) => { - this.http.get("/v3/role_assignments?scope.project.id="+ element).subscribe((ass_res)=>{ - let groupid; - - ass_res.json().role_assignments.map((element)=>{ - if(element.group){ - return groupid = element.group.id; - } - }) - - let request: any = {}; - this.http.put("/v3/groups/"+ groupid + "/users/"+ res.json().user.id, request).subscribe(); - }) - if(i == (tenants.length-1)){ - this.createUserDisplay = false; - this.listUsers(); - } - }) - }); - }else{ - // validate - for(let i in this.myFormGroup.controls){ - this.myFormGroup.controls[i].markAsTouched(); - } - } - } - - updateUser(){ - let request: any = { user:{} }; - request.user = { - "description": this.myFormGroup.value.form_description - } - if(this.myFormGroup.value.form_isModifyPsw==true){ - request.user["password"] = this.myFormGroup.value.form_psw; - - if(this.myFormGroup.status == "VALID"){ - this.http.patch("/v3/users/"+ this.currentUser.userid, request).subscribe((res) => { - this.createUserDisplay = false; - this.listUsers(); - }); - }else{ - // validate - for(let i in this.myFormGroup.controls){ - this.myFormGroup.controls[i].markAsTouched(); - } - } - }else{ - - if(this.myFormGroup.status == "VALID"){ - this.http.patch("/v3/users/"+ this.currentUser.userid, request).subscribe((res) => { - this.createUserDisplay = false; - this.listUsers(); - }); - }else{ - // validate - for(let i in this.myFormGroup.controls){ - this.myFormGroup.controls[i].markAsTouched(); - } - } - } - - - } - - getRoles(){ - let request: any = { params:{} }; - this.http.get("/v3/roles", request).subscribe((res) => { - res.json().roles.forEach((item, index) => { - if(item.name == "Member"){ - this.userRole = item.id; - } - }) - }); - } - - getTenants(){ - this.tenantLists = []; - - let request: any = { params:{} }; - request.params = { - "domain_id": "default" - } - - this.http.get("/v3/projects", request).subscribe((res) => { - res.json().projects.map((item, index) => { - let tenant = {}; - if(item.name != "admin" && item.name != "service"){ - tenant["label"] = item.name; - tenant["value"] = item.id; - this.tenantLists.push(tenant); - } - }); - }); - } - - - ngOnInit() { - this.listUsers(); - - } - - ngAfterViewChecked(){ - this.newPassword = this.myFormGroup.value.form_psw; - - } - - ModifyPswChecked(checked){ - if(checked){ - this.myFormGroup.controls['form_psw'].setValidators([Validators.required, Validators.minLength(8), this.regPassword]); - this.myFormGroup.controls['form_pswConfirm'].setValidators([Validators.required, this.regConfirmPassword(this.newPassword)] ); - - }else{ - this.myFormGroup.controls['form_psw'].clearValidators(); - this.myFormGroup.controls['form_pswConfirm'].clearValidators(); - - } - - // Update form validate status - for(let i in this.myFormGroup.controls){ - this.myFormGroup.controls[i].updateValueAndValidity(); - } - } - - listUsers(){ - this.tenantUsers = []; - this.selectedUsers = []; - - this.sortField = "username"; - - let request: any = { params:{} }; - request.params = { - "domain_id": "default" - } - - this.http.get("/v3/users", request).subscribe((res) => { - res.json().users.map((item, index) => { - let user = {}; - user["enabled"] = item.enabled; - user["username"] = item.name; - user["userid"] = item.id; - user["defaultTenant"] = item.default_project_id; - user["description"] = !item.description ? '--' : item.description=='' ? '--' : item.description; - - if(item.name == "admin" || item.name == "opensds"){ - user["disabled"] = true; - } - this.tenantUsers.push(user); - }); - }); - } - - userStatus(user){ - let msg = user.enabled == true ? "
Are you sure you want to disable the user?

[ "+ user.username +" ]

" : "
Are you sure you want to enable the user?

[ "+ user.username +" ]

"; - let status = user.enabled ? false : true; - - this.confirmationService.confirm({ - message: msg, - header: user.enabled ? 'Disable User' : 'Enable User', - acceptLabel: user.enabled ? 'Disable' : 'Enable', - accept: ()=>{ - let request: any = { user:{} }; - request.user = { - "enabled": status - } - this.http.patch("/v3/users/"+ user.userid, request).subscribe((res) => { - this.listUsers(); - }); - - }, - reject:()=>{} - }) - } - - deleteUsers(users){ - let arr=[], msg; - if(_.isArray(users)){ - users.forEach((item,index)=> { - arr.push(item.userid); - }) - msg = "
Are you sure you want to delete the selected users?

[ "+ users.length +" Users ]

"; - }else{ - arr.push(users.userid); - msg = "
Are you sure you want to delete the user?

[ "+ users.username +" ]

"; - } - - this.confirmationService.confirm({ - message: msg, - header: "Delete User", - acceptLabel: "Delete", - isWarning: true, - accept: ()=>{ - arr.forEach((item,index)=> { - let request: any = {}; - this.http.delete("/v3/users/"+ item, request).subscribe((res) => { - if(index == arr.length-1){ - this.listUsers(); - } - }); - }) - - }, - reject:()=>{} - }) - - } - - onRowExpand(evt) { - this.isUserDetailFinished = false; - this.detailUserInfo = evt.data.userid; - } - - tablePaginate() { - this.selectedUsers = []; - } -} diff --git a/dashboard/src/app/business/identity/userList.html b/dashboard/src/app/business/identity/userList.html deleted file mode 100644 index 9a1ebe512..000000000 --- a/dashboard/src/app/business/identity/userList.html +++ /dev/null @@ -1,81 +0,0 @@ -
-

A tenant is used to group and manage resources and users.

-
- -
-
- - -
-
-
- - -
- -
-
- - - - - - - -
-
-
- - - - {{I18N.keyID['sds_block_volume_modify']}} - {{ (user.enabled == true) ? "Disable" : "Enable" }} - {{I18N.keyID['sds_block_volume_delete']}} - - - - - - -
- - - -
- - - {{ username }} - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - -
- \ No newline at end of file diff --git a/dashboard/src/app/business/identity/userList.module.ts b/dashboard/src/app/business/identity/userList.module.ts deleted file mode 100644 index afbedddbc..000000000 --- a/dashboard/src/app/business/identity/userList.module.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { NgModule, APP_INITIALIZER } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { ReactiveFormsModule, FormsModule } from '@angular/forms'; -import { UserListComponent } from './userList.component'; -import { BadgeModule, FormModule, ButtonModule, CheckboxModule, DataTableModule, DropMenuModule, MultiSelectModule, DialogModule, InputTextModule, InputTextareaModule, DropdownModule, PasswordModule, ConfirmDialogModule } from '../../components/common/api'; - -import { UserDetailModule } from './userDetail/userDetail.module'; - -@NgModule({ - declarations: [UserListComponent], - imports: [ - CommonModule, - ButtonModule, - BadgeModule, - DataTableModule, - DropMenuModule, - DialogModule, - ConfirmDialogModule, - InputTextModule, - InputTextareaModule, - DropdownModule, - CheckboxModule, - PasswordModule, - FormsModule, - ReactiveFormsModule, - MultiSelectModule, - FormModule, - UserDetailModule - ], - exports: [UserListComponent], - providers: [] -}) -export class UserListModule { } \ No newline at end of file diff --git a/dashboard/src/app/business/profile/createProfile/createProfile.component.html b/dashboard/src/app/business/profile/createProfile/createProfile.component.html deleted file mode 100644 index c70165314..000000000 --- a/dashboard/src/app/business/profile/createProfile/createProfile.component.html +++ /dev/null @@ -1,185 +0,0 @@ -
-

{{I18N.keyID['sds_profile_create_title']}}

-

{{I18N.keyID['sds_profile_create_descrip']}}

-
- -
-
-
- - - - - - - - - - - - - - - - - -
-
-
-
-
- - -
- - {{I18N.keyID['sds_profile_IOPS_unit']}} -
-
- -
- - {{I18N.keyID['sds_profile_BWS_unit']}} -
-
- -
-
-
- - - -
-
-
-
-
-
-
- - - - - - - -
- {{I18N.keyID['sds_profile_unit_minutes']}} -
-
- -
- {{I18N.keyID['sds_profile_BWS_unit']}} -
-
-
-
- - - - - - - - - - - - -
-
-
-
-
- - - -
-
-
-
-
-
- - - - -
- -
-
- -
- -
- - -
- {{I18N.keyID['sds_profile_nuit_days']}} -
-
-
-
-
-
- - - -
-
-
-
-
- {{customizationItem.key}}: -
-
- {{customizationItem.value}} -
-
- -
-
-
- - - -
-
-
-
- -
-
-
-
- - -
- -
- - -
-
- {{label.key}} - -
-
- {{label.value}} - -
-
- - - - -
diff --git a/dashboard/src/app/business/profile/createProfile/createProfile.component.ts b/dashboard/src/app/business/profile/createProfile/createProfile.component.ts deleted file mode 100644 index a19836eef..000000000 --- a/dashboard/src/app/business/profile/createProfile/createProfile.component.ts +++ /dev/null @@ -1,482 +0,0 @@ -import { Router } from '@angular/router'; -import { Component, OnInit, ViewContainerRef, ViewChild, Directive, ElementRef, HostBinding, HostListener } from '@angular/core'; -import { Validators, FormControl, FormGroup, FormBuilder } from '@angular/forms'; -import { I18NService } from 'app/shared/api'; -import { AppService } from 'app/app.service'; -import { trigger, state, style, transition, animate } from '@angular/animations'; -import { I18nPluralPipe } from '@angular/common'; - -import { Message, SelectItem } from './../../../components/common/api'; -import { ProfileService } from './../profile.service'; - -@Component({ - templateUrl: './createProfile.component.html', - styleUrls: [ - - ], - animations: [ - trigger('overlayState', [ - state('hidden', style({ - opacity: 0 - })), - state('visible', style({ - opacity: 1 - })), - transition('visible => hidden', animate('400ms ease-in')), - transition('hidden => visible', animate('400ms ease-out')) - ]), - - trigger('notificationTopbar', [ - state('hidden', style({ - height: '0', - opacity: 0 - })), - state('visible', style({ - height: '*', - opacity: 1 - })), - transition('visible => hidden', animate('400ms ease-in')), - transition('hidden => visible', animate('400ms ease-out')) - ]) - ] -}) -export class CreateProfileComponent implements OnInit { - showCustomization = false; - showStoragePool = false; - msgs: Message[] = []; - userform: FormGroup; - submitted: boolean; - genders: SelectItem[]; - description: string; - - profileform: FormGroup; - qosPolicy:FormGroup; - repPolicy:FormGroup; - snapPolicy:FormGroup; - paramData= { - extras:{protocol:""}, - storageType:"" - }; - label; - param = { - name: '', - description: '', - extras: { - - } - }; - qosIsChecked = false; - replicationIsChecked = false; - snapshotIsChecked = false; - protocolOptions = [ - { - label: 'iSCSI', - value: 'iSCSI' - }, - { - label: 'FC', - value: 'FC' - }, - { - label: 'RBD', - value: 'RBD' - } - ]; - - //用户自定义key、value,用于双向数据绑定 - customizationKey = ''; - customizationValue = ''; - - //用户自定义项,用于 - customizationItems = []; - - replicationTypeOptions = [ - { - label: 'Mirror', - value: 'mirror' - }/*, - { - label: 'Snapshot', - value: 'snapshot' - }, - { - label: 'Clone', - value: 'clone' - }, - { - label: 'Tokenized Clone', - value: 'tokenized' - }*/ - ]; - - replicationRGOOptions = [ - { - label: 'Availability Zone', - value: 'availabilityZone' - }, - { - label: 'Rack', - value: 'rack' - }, - { - label: 'Row', - value: 'row' - }, - { - label: 'Server', - value: 'server' - }, - { - label: 'Facility', - value: 'facility' - }, - { - label: 'Region', - value: 'region' - } - ]; - - replicationModeOptions = [ - { - label: 'Synchronous', - value: 'Synchronous' - }, - { - label: 'Asynchronous', - value: 'Asynchronous' - }, - { - label: 'Active', - value: 'Active' - }, - { - label: 'Adaptive', - value: 'Adaptive' - } - ]; - - replicationRTOOptions = [ - { - label: 'Immediate', - value: 'Immediate' - }, - { - label: 'Online', - value: 'Online' - }, - { - label: 'Nearline', - value: 'Nearline' - }, - { - label: 'Offline', - value: 'Offline' - } - ]; - - replicationRPOOptions = [ - { - label: '0', - value: 0 - }, - { - label: '4', - value: 4 - }, - { - label: '60', - value: 60 - }, - { - label: '3600', - value: 3600 - } - ]; - errorMessage={ - "name": { required: this.I18N.keyID['sds_profile_create_name_require']}, - "maxIOPS": { required: this.I18N.keyID['sds_required'].replace("{0}","MaxIOPS")}, - "maxBWS" :{ required: this.I18N.keyID['sds_required'].replace("{0}","MaxBWS")}, - "repPeriod" :{ required: this.I18N.keyID['sds_required'].replace("{0}","Period")}, - "repBandwidth" :{ required: this.I18N.keyID['sds_required'].replace("{0}","Bandwidth")}, - "repRPO" :{ required: this.I18N.keyID['sds_required'].replace("{0}","RPO")}, - "datetime" :{ required: this.I18N.keyID['sds_required'].replace("{0}","Execution Time")}, - "snapNum" :{ required: this.I18N.keyID['sds_required'].replace("{0}","Retention")}, - "duration" :{ required: this.I18N.keyID['sds_required'].replace("{0}","Retention")}, - "description":{maxlength:this.I18N.keyID['sds_validate_max_length']} - }; - snapshotRetentionOptions = [ - { - label: 'Time', - value: 'Time' - }, - { - label: 'Quantity', - value: 'Quantity' - } - ]; - snapSchedule = [ - { - label: 'Daily', - value: 'Daily' - }, - { - label: 'Weekly', - value: 'Weekly' - }, - { - label: 'Monthly', - value: 'Monthly' - } - ]; - - weekDays; - - constructor( - public I18N: I18NService, - private router: Router, - private ProfileService: ProfileService, - private fb: FormBuilder - ) { - this.weekDays = [ - { - label: 'Sun', - value: 0, - styleClass: 'week-select-list' - }, - { - label: 'Mon', - value: 1, - styleClass: 'week-select-list' - }, - { - label: 'Tue', - value: 2, - styleClass: 'week-select-list' - }, - { - label: 'Wed', - value: 3, - styleClass: 'week-select-list' - }, - { - label: 'Thu', - value: 4, - styleClass: 'week-select-list' - }, - { - label: 'Fri', value: 5, - styleClass: 'week-select-list' - }, - { - label: 'Sat', - value: 6, - styleClass: 'week-select-list' - } - ]; - } - - ngOnInit() { - this.label = { - name: this.I18N.keyID['sds_block_volume_name'], - description: this.I18N.keyID['sds_block_volume_descri'], - protocol: this.I18N.keyID['sds_profile_access_pro'], - type: this.I18N.keyID['sds_profile_pro_type'], - qosPolicy: this.I18N.keyID['sds_profile_qos_policy'], - replicationPolicy: this.I18N.keyID['sds_profile_replication_policy'], - snapshotPolicy: this.I18N.keyID['sds_profile_snap_policy'], - customization: this.I18N.keyID['sds_profile_create_customization'], - storagePool: this.I18N.keyID['sds_profile_avai_pool'], - key: this.I18N.keyID['sds_profile_extra_key'], - value: this.I18N.keyID['sds_profile_extra_value'], - maxIOPS: this.I18N.keyID['sds_profile_create_maxIOPS'], - MBPS: this.I18N.keyID['sds_profile_create_maxBWS'], - replicationLabel: { - type:this.I18N.keyID['sds_profile_rep_type'] , - RGO: this.I18N.keyID['sds_profile_rep_rgo'], - Mode:this.I18N.keyID['sds_profile_rep_mode'], - RTO: this.I18N.keyID['sds_profile_rep_rto'], - Period: this.I18N.keyID['sds_profile_rep_period'], - RPO: this.I18N.keyID['sds_profile_rep_rpo'], - Bandwidth: this.I18N.keyID['sds_profile_rep_bandwidth'], - Consistency: this.I18N.keyID['sds_profile_rep_consis'] - }, - snapshotLabel: { - Schedule: this.I18N.keyID['sds_profile_snap_sche'], - executionTime:this.I18N.keyID['sds_profile_snap_exetime'], - Retention: this.I18N.keyID['sds_profile_snap_reten'] - } - }; - - this.profileform = this.fb.group({ - 'name': new FormControl('', Validators.required), - 'description':new FormControl('',Validators.maxLength(200)), - 'protocol': new FormControl('iSCSI'), - 'storageType': new FormControl('Thin', Validators.required), - 'policys': new FormControl(''), - 'snapshotRetention': new FormControl('Time') - }); - this.qosPolicy = this.fb.group({ - "maxIOPS": new FormControl(6000, Validators.required), - "maxBWS" : new FormControl(100, Validators.required), - }); - this.repPolicy = this.fb.group({ - "repType": new FormControl("mirror", Validators.required), - "repMode": new FormControl(this.replicationModeOptions[0].value, Validators.required), - "repPeriod": new FormControl(60, Validators.required), - "repBandwidth": new FormControl(10, Validators.required), - "repRGO": new FormControl(this.replicationRGOOptions[0].value, Validators.required), - "repRTO": new FormControl(this.replicationRTOOptions[0].value, Validators.required), - "repRPO": new FormControl(0, Validators.required), - "repCons": new FormControl([]) - }); - this.snapPolicy = this.fb.group({ - "Schedule": new FormControl(this.snapSchedule[0].value, Validators.required), - "datetime": new FormControl("00:00", Validators.required), - "snapNum": new FormControl(1, Validators.required), - "duration": new FormControl(0, Validators.required), - "retentionOptions": new FormControl(this.snapshotRetentionOptions[0].value) - }); - this.paramData= { - extras:{protocol:this.profileform.value.protocol}, - storageType:this.profileform.value.storageType - }; - this.profileform.get("protocol").valueChanges.subscribe( - (value:string)=>{ - this.paramData = { - extras:{protocol:value}, - storageType:this.profileform.value.storageType - } - } - ); - this.profileform.get("storageType").valueChanges.subscribe( - (value:string)=>{ - this.paramData = { - extras:{protocol:this.profileform.value.protocol}, - storageType:value - } - } - ); - - - - } - - onSubmit(value) { - this.submitted = true; - this.msgs = []; - this.msgs.push({ severity: 'info', summary: 'Success', detail: 'Form Submitted' }); - this.param.name = value.name; - this.param.description = value.description; - if(this.qosIsChecked){ - if(!this.qosPolicy.valid){ - for(let i in this.qosPolicy.controls){ - this.qosPolicy.controls[i].markAsTouched(); - } - return; - } - this.param.extras[":provisionPolicy"]= { - "ioConnectivityLoS": { - "maxIOPS": this.qosPolicy.value.maxIOPS, - "maxBWS": this.qosPolicy.value.maxBWS, - "accessProtocol": value.protocol - }, - "dataStorageLoS": { - "provisioningPolicy": value.storageType - } - } - }else{ - this.param.extras[":provisionPolicy"]= { - "ioConnectivityLoS": { - "accessProtocol": value.protocol - }, - "dataStorageLoS": { - "provisioningPolicy": value.storageType - } - } - } - if(this.replicationIsChecked){ - if(!this.repPolicy.valid){ - for(let i in this.repPolicy.controls){ - this.repPolicy.controls[i].markAsTouched(); - } - return; - } - this.param.extras["replicationType"]= "ArrayBased"; - this.param.extras[":replicationPolicy"]={ - "dataProtectionLoS": { - "replicaTypes": this.repPolicy.value.repType, - "recoveryGeographicObject": this.repPolicy.value.repRGO, - "recoveryPointObjective": this.repPolicy.value.repRPO, - "recoveryTimeObjective": this.repPolicy.value.repRTO, - }, - "replicaInfos": { - "replicaUpdateMode": this.repPolicy.value.repMode, - "consistencyEnabled": this.repPolicy.value.repCons.length==0 ? false:true, - "replicationPeriod": this.repPolicy.value.repPeriod, - "replicationBandwidth": this.repPolicy.value.repBandwidth - } - } - } - if(this.snapshotIsChecked){ - if(!this.snapPolicy.valid){ - for(let i in this.snapPolicy.controls){ - this.snapPolicy.controls[i].markAsTouched(); - } - return; - } - let reten = this.snapPolicy.value.retentionOptions === "Quantity" ? { - "number": this.snapPolicy.value.snapNum, - }:{"duration": this.snapPolicy.value.duration} - this.param.extras[":snapshotPolicy"]= { - "schedule": { - "datetime": "1970-01-01T"+this.snapPolicy.value.datetime+":00", - "occurrence": this.snapPolicy.value.Schedule //Monthly, Weekly, Daily, Hourly - }, - "retention": reten - } - } - if (this.customizationItems.length > 0) { - let arrLength = this.customizationItems.length; - for (let i = 0; i < arrLength; i++) { - this.param.extras[this.customizationItems[i].key] = this.customizationItems[i].value; - } - } - this.createProfile(this.param); - } - - retentionChange(){ - console.log(this.profileform.controls['snapshotRetention'].value); - } - - createProfile(param) { - this.ProfileService.createProfile(param).subscribe((res) => { - - this.router.navigate(['/profile']); - }); - } - - - - getI18n() { - // return {}; - } - - showDetails(policyType) { - this[policyType + 'IsChecked'] = !this[policyType + 'IsChecked']; - } - - addCustomization() { - this.customizationItems.push({ - key: this.customizationKey, - value: this.customizationValue - }); - this.showCustomization = false - this.customizationKey = ''; - this.customizationValue = ''; - } - - deleteCustomization(index) { - this.customizationItems.splice(index, 1); - } - -} diff --git a/dashboard/src/app/business/profile/createProfile/createProfile.module.ts b/dashboard/src/app/business/profile/createProfile/createProfile.module.ts deleted file mode 100644 index 781c3e25a..000000000 --- a/dashboard/src/app/business/profile/createProfile/createProfile.module.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { Component, NgModule, APP_INITIALIZER } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { ReactiveFormsModule, FormsModule } from '@angular/forms'; -import { CreateProfileComponent } from './createProfile.component'; -import { RouterModule } from '@angular/router'; -import { InputTextModule,InputTextareaModule, CheckboxModule, FormModule, ButtonModule, DropdownModule, RadioButtonModule, DialogModule, Message, GrowlModule, SelectButtonModule } from '../../../components/common/api'; -import { HttpService } from './../../../shared/api'; -import { ProfileService,PoolService } from './../profile.service'; -import { PoolModule } from './../storage-pools-table/storage-pools-table.module'; - -let routers = [{ - path: '', - component: CreateProfileComponent -}] - -@NgModule({ - declarations: [ - CreateProfileComponent - ], - imports: [ - CommonModule, - ReactiveFormsModule, - FormsModule, - RouterModule.forChild(routers), - InputTextModule, - CheckboxModule, - ButtonModule, - DropdownModule, - RadioButtonModule, - DialogModule, - GrowlModule, - PoolModule, - SelectButtonModule, - FormModule, - InputTextareaModule - ], - providers: [ - HttpService, - ProfileService, - PoolService - ] -}) -export class CreateProfileModule { } diff --git a/dashboard/src/app/business/profile/modifyProfile/modifyProfile.component.html b/dashboard/src/app/business/profile/modifyProfile/modifyProfile.component.html deleted file mode 100644 index cbfeedce4..000000000 --- a/dashboard/src/app/business/profile/modifyProfile/modifyProfile.component.html +++ /dev/null @@ -1,50 +0,0 @@ -
- - {{item.label}} - > - -
-
-
-
-

{{data.name}}

-
-
- Access Protocol: - {{data.extras.protocol}} -
-
- Provisioning Type: - {{data.storageType}} -
-
- QoS Policy: -
-
{{policy}}
-
- Replication Policy: -
-
{{policy}}
-
- Snapshot Policy: -
-
{{policy}}
-
-
-
-
- -
-
- Storage Pools: -
- -
-
- -
-
- - -
-
diff --git a/dashboard/src/app/business/profile/modifyProfile/modifyProfile.component.ts b/dashboard/src/app/business/profile/modifyProfile/modifyProfile.component.ts deleted file mode 100644 index bbed0a5fc..000000000 --- a/dashboard/src/app/business/profile/modifyProfile/modifyProfile.component.ts +++ /dev/null @@ -1,152 +0,0 @@ -import { Router,ActivatedRoute} from '@angular/router'; -import { Component, OnInit, ViewContainerRef, ViewChild, Directive, ElementRef, HostBinding, HostListener } from '@angular/core'; -import { I18NService } from 'app/shared/api'; -import { AppService } from 'app/app.service'; -import { trigger, state, style, transition, animate } from '@angular/animations'; -import { I18nPluralPipe } from '@angular/common'; - -import { ProfileService, PoolService} from './../profile.service'; - -@Component({ - templateUrl: './modifyProfile.component.html', - styleUrls: [ - - ], - animations: [ - trigger('overlayState', [ - state('hidden', style({ - opacity: 0 - })), - state('visible', style({ - opacity: 1 - })), - transition('visible => hidden', animate('400ms ease-in')), - transition('hidden => visible', animate('400ms ease-out')) - ]), - - trigger('notificationTopbar', [ - state('hidden', style({ - height: '0', - opacity: 0 - })), - state('visible', style({ - height: '*', - opacity: 1 - })), - transition('visible => hidden', animate('400ms ease-in')), - transition('hidden => visible', animate('400ms ease-out')) - ]) - ] -}) -export class modifyProfileComponent implements OnInit { - items; - chartDatas; - totalFreeCapacity = 0; - option; - data; - cars; - cols: any[]; - formGroup; - errorMessage; - pools; - totalCapacity = 0; - // profileId; - constructor( - // private I18N: I18NService, - // private router: Router - private ActivatedRoute: ActivatedRoute, - private ProfileService: ProfileService, - private poolService:PoolService - ) { } - ngOnInit() { - let profileId; - this.ActivatedRoute.params.subscribe((params) => profileId = params.profileId); - - this.ProfileService.getProfileById(profileId).subscribe((res) => { - // return res.json(); - // this.profiles = res.json(); - this.data = res.json(); - this.getPools(); - }); - this.items = [ - { label: 'Profile', url: '/profile' }, - { label: 'Profile detail', url: '/modifyProfile' } - ]; - this.option = { - cutoutPercentage: 80, - // rotation: (-0.2 * Math.PI), - title: { - display: false, - text: 'My Title', - fontSize: 12 - }, - legend: { - display: true, - labels:{ - boxWidth:12 - }, - position: 'bottom', - fontSize: 12 - } - }; - // this.data = { - // "id": "5d8c3732-a248-50ed-bebc-539a6ffd25c1", - // "name": "Gold", - // "protocol": "FC", - // "type": "Thin", - // "policys": [ - // "Qos", - // "Snapshot", - // "Replication" - // ], - // "description": "provide gold storage service", - // "extras": { - // "key1": "value1", - // "key2": { - // "subKey1": "subValue1", - // "subKey2": "subValue2" - // }, - // "key3": "value3" - // } - // }; - - } - getPools() { - this.poolService.getPools().subscribe((res) => { - this.pools = res.json(); - this.totalFreeCapacity = this.getSumCapacity(this.pools, 'free'); - this.totalCapacity = this.getSumCapacity(this.pools, 'total'); - this.chartDatas = { - labels: ['Total Capacity', 'Used Capacity'], - datasets: [ - { - data: [this.totalCapacity, this.totalCapacity-this.totalFreeCapacity], - backgroundColor: [ - "rgba(224, 224, 224, 1)", - "#438bd3" - ] - // hoverBackgroundColor: [ - // "#FF6384", - // "#36A2EB", - // "#FFCE56" - // ] - }] - }; - }); - } - - getSumCapacity(pools, FreeOrTotal) { - let SumCapacity: number = 0; - let arrLength = pools.length; - for (let i = 0; i < arrLength; i++) { - if(this.data.extras.protocol.toLowerCase() == pools[i].extras.ioConnectivity.accessProtocol && this.data.storageType == pools[i].extras.dataStorage.provisioningPolicy){ - if (FreeOrTotal === 'free') { - SumCapacity += pools[i].freeCapacity; - } else { - SumCapacity += pools[i].totalCapacity; - } - } - } - return SumCapacity; - } -} diff --git a/dashboard/src/app/business/profile/modifyProfile/modifyProfile.module.ts b/dashboard/src/app/business/profile/modifyProfile/modifyProfile.module.ts deleted file mode 100644 index c4ce0b3ee..000000000 --- a/dashboard/src/app/business/profile/modifyProfile/modifyProfile.module.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { Component, NgModule, APP_INITIALIZER } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { modifyProfileComponent } from './modifyProfile.component'; -import { RouterModule } from '@angular/router'; -import { BreadcrumbModule,ChartModule,ButtonModule } from './../../../components/common/api'; - -import { HttpService } from './../../../shared/api'; -import { ProfileService,PoolService } from './../profile.service'; -import { PoolModule } from './../storage-pools-table/storage-pools-table.module'; - -let routers = [{ - path: '', - component: modifyProfileComponent -}] - -@NgModule({ - declarations: [ - modifyProfileComponent - ], - imports: [ - CommonModule, - RouterModule.forChild(routers), - BreadcrumbModule, - ChartModule, - ButtonModule, - PoolModule - // FormModule - ], - providers: [ - HttpService, - ProfileService, - PoolService - ] -}) -export class ModifyProfileModule { } \ No newline at end of file diff --git a/dashboard/src/app/business/profile/profile.component.html b/dashboard/src/app/business/profile/profile.component.html deleted file mode 100644 index c6b3aa1e5..000000000 --- a/dashboard/src/app/business/profile/profile.component.html +++ /dev/null @@ -1,26 +0,0 @@ -
-

{{I18N.keyID['sds_block_volume_profile']}}

-

{{I18N.keyID['sds_profile_list_descrip']}}

-
- -
- -
- -
-
- - -
- - - -
- - - - - - - - diff --git a/dashboard/src/app/business/profile/profile.component.ts b/dashboard/src/app/business/profile/profile.component.ts deleted file mode 100644 index e62fbccbd..000000000 --- a/dashboard/src/app/business/profile/profile.component.ts +++ /dev/null @@ -1,96 +0,0 @@ -import { Router } from '@angular/router'; -import { Component, OnInit, ViewContainerRef, ViewChild, Directive, ElementRef, HostBinding, HostListener } from '@angular/core'; -import { I18NService } from 'app/shared/api'; -import { AppService } from 'app/app.service'; -import { trigger, state, style, transition, animate } from '@angular/animations'; -import { I18nPluralPipe } from '@angular/common'; - -import { ProfileService } from './profile.service'; -import { ConfirmationService,ConfirmDialogModule} from '../../components/common/api'; - -@Component({ - templateUrl: './profile.component.html', - styleUrls: [ - - ], - animations: [ - trigger('overlayState', [ - state('hidden', style({ - opacity: 0 - })), - state('visible', style({ - opacity: 1 - })), - transition('visible => hidden', animate('400ms ease-in')), - transition('hidden => visible', animate('400ms ease-out')) - ]), - - trigger('notificationTopbar', [ - state('hidden', style({ - height: '0', - opacity: 0 - })), - state('visible', style({ - height: '*', - opacity: 1 - })), - transition('visible => hidden', animate('400ms ease-in')), - transition('hidden => visible', animate('400ms ease-out')) - ]) - ] -}) -export class ProfileComponent implements OnInit { - profileId; - profiles; - showWarningDialog = false; - constructor( - public I18N: I18NService, - // private router: Router - private ProfileService: ProfileService, - private confirmationService:ConfirmationService - ) { } - showCard = true; - ngOnInit() { - this.getProfiles(); - this.profiles = []; - } - - getProfiles() { - this.ProfileService.getProfiles().subscribe((res) => { - this.profiles = res.json(); - }); - } - - showWarningDialogFun(profile) { - let msg = "
Are you sure you want to delete the Profile?

[ "+ profile.name +" ]

"; - let header ="Delete Profile"; - let acceptLabel = "Delete"; - let warming = true; - this.confirmDialog([msg,header,acceptLabel,warming,profile.id]) - } - deleteProfile(id) { - this.ProfileService.deleteProfile(id).subscribe((res) => { - this.getProfiles(); - }); - } - confirmDialog([msg,header,acceptLabel,warming=true,func]){ - this.confirmationService.confirm({ - message: msg, - header: header, - acceptLabel: acceptLabel, - isWarning: warming, - accept: ()=>{ - try { - this.deleteProfile(func); - } - catch (e) { - console.log(e); - } - finally { - - } - }, - reject:()=>{} - }) - } -} diff --git a/dashboard/src/app/business/profile/profile.module.ts b/dashboard/src/app/business/profile/profile.module.ts deleted file mode 100644 index 515d0032d..000000000 --- a/dashboard/src/app/business/profile/profile.module.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule, APP_INITIALIZER } from '@angular/core'; -import { ProfileComponent } from './profile.component'; -import { RouterModule } from '@angular/router'; - -import { ProfileCardComponent } from './profileCard/profile-card.component'; -import { ButtonModule,CardModule,ChartModule,MessageModule,OverlayPanelModule,DialogModule ,ConfirmationService,ConfirmDialogModule} from '../../components/common/api'; -import { ProfileService } from './profile.service'; -import { HttpService } from '../../shared/api'; -import { SuspensionFrameComponent } from './profileCard/suspension-frame/suspension-frame.component'; - -let routers = [{ - path: '', - component: ProfileComponent -}] - -@NgModule({ - declarations: [ - ProfileComponent, - ProfileCardComponent, - SuspensionFrameComponent - ], - imports: [ - RouterModule.forChild(routers), - ButtonModule, - CommonModule, - CardModule, - ChartModule, - MessageModule, - OverlayPanelModule, - DialogModule, - ConfirmDialogModule - ], - providers: [ - HttpService, - ProfileService, - ConfirmationService - ] -}) -export class ProfileModule { } \ No newline at end of file diff --git a/dashboard/src/app/business/profile/profile.service.ts b/dashboard/src/app/business/profile/profile.service.ts deleted file mode 100644 index a47f18f37..000000000 --- a/dashboard/src/app/business/profile/profile.service.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { Injectable } from '@angular/core'; -import { HttpService } from './../../shared/service/Http.service'; -import { Observable } from 'rxjs'; - -@Injectable() -export class ProfileService { - url = 'v1beta/{project_id}/profiles' - constructor(private http: HttpService) { } - //创建profile - createProfile(param) { - return this.http.post(this.url, param); - } - - //删除profile - deleteProfile(id): Observable { - let deleteUrl = this.url + '/' + id - return this.http.delete(deleteUrl); - } - - //查询profiles - getProfiles(): Observable { - return this.http.get(this.url); - } - - //查询profiles - getProfileById(id) { - let getUrl = this.url + '/' + id - return this.http.get(getUrl); - } - - //修改profile - modifyProfile(id, param) { - let modifyUrl = this.url + '/' + id - this.http.put(modifyUrl, param).subscribe((res) => { - console.log(res.json().data); - }); - } -} - -@Injectable() -export class PoolService{ - url = 'v1beta/{project_id}/pools'; - constructor(private http: HttpService) { } - //查询profiles - getPools(): Observable { - return this.http.get(this.url); - } -} diff --git a/dashboard/src/app/business/profile/profileCard/profile-card.component.html b/dashboard/src/app/business/profile/profileCard/profile-card.component.html deleted file mode 100644 index c82a17275..000000000 --- a/dashboard/src/app/business/profile/profileCard/profile-card.component.html +++ /dev/null @@ -1,33 +0,0 @@ -
-
-
-

{{data.name}}

-
-
-
{{I18N.keyID['sds_block_volume_descri']}}:
-
{{data && data.description ?data.description :"--"}}
-
-
- Access Protocol: - {{data.extras && data.extras[':provisionPolicy'].ioConnectivityLoS.accessProtocol}} -
-
- Provisioning Type: - {{data.extras && data.extras[':provisionPolicy'].dataStorageLoS.provisioningPolicy}} -
- -
-
-
- {{policy}} -
- -
- -
-
-
- -
-
-
diff --git a/dashboard/src/app/business/profile/profileCard/profile-card.component.ts b/dashboard/src/app/business/profile/profileCard/profile-card.component.ts deleted file mode 100644 index b42378e82..000000000 --- a/dashboard/src/app/business/profile/profileCard/profile-card.component.ts +++ /dev/null @@ -1,156 +0,0 @@ -import { Router } from '@angular/router'; -import { Component, OnInit, Input } from '@angular/core'; -import { I18NService } from 'app/shared/api'; -import { AppService } from 'app/app.service'; -import { trigger, state, style, transition, animate } from '@angular/animations'; -import { I18nPluralPipe } from '@angular/common'; -import { HttpService } from './../../../shared/api'; - -import { ButtonModule } from './../../../components/common/api'; - -// import {CardModule} from 'primeng/card'; - -@Component({ - selector: 'profile-card', - templateUrl: './profile-card.component.html', - styleUrls: [ - - ], - animations: [ - trigger('overlayState', [ - state('hidden', style({ - opacity: 0 - })), - state('visible', style({ - opacity: 1 - })), - transition('visible => hidden', animate('400ms ease-in')), - transition('hidden => visible', animate('400ms ease-out')) - ]), - - trigger('notificationTopbar', [ - state('hidden', style({ - height: '0', - opacity: 0 - })), - state('visible', style({ - height: '*', - opacity: 1 - })), - transition('visible => hidden', animate('400ms ease-in')), - transition('hidden => visible', animate('400ms ease-out')) - ]) - ] -}) -export class ProfileCardComponent implements OnInit { - policys = []; - data:any; - @Input() - set cardData(data: any) { - this.data = data; - this.policys = []; - if(data.extras){ - if(data.extras[':provisionPolicy'].ioConnectivityLoS.maxIOPS){ - this.policys.push("QoS"); - } - if(data.extras[':snapshotPolicy']){ - this.policys.push("Snapshot"); - } - if(data.extras[':replicationPolicy']){ - this.policys.push("Replication"); - } - } - - }; - - chartDatas: any; - constructor( - public I18N: I18NService, - // private router: Router - private http: HttpService - ) { } - option = {}; - pools = []; - totalFreeCapacity = 0; - totalCapacity = 0; - ngOnInit() { - this.getPools(); - this.option = { - cutoutPercentage: 80, - // rotation: (0.5 * Math.PI), - // circumference: (Math.PI), - title: { - display: false, - text: 'My Title', - fontSize: 12 - }, - legend: { - labels: { - boxWidth: 12 - }, - display: false, - width: '5px', - position: 'right', - fontSize: 12 - } - }; - } - - index; - isHover; - - showSuspensionFrame(event){ - if(event.type === 'mouseenter'){ - this.isHover = true; - }else if(event.type === 'mouseleave'){ - this.isHover = false; - } - let arrLength = event.target.parentNode.children.length; - for(let i=0; i { - this.pools = res.json(); - this.totalFreeCapacity = this.getSumCapacity(this.pools, 'free'); - this.totalCapacity = this.getSumCapacity(this.pools, 'total'); - this.chartDatas = { - labels: ['Unused Capacity', 'Used Capacity'], - datasets: [ - { - data: [this.totalFreeCapacity,this.totalCapacity-this.totalFreeCapacity], - backgroundColor: [ - "rgba(224, 224, 224, .5)", - "#438bd3" - ] - // hoverBackgroundColor: [ - // "#FF6384", - // "#36A2EB", - // "#FFCE56" - // ] - }] - }; - }); - } - - getSumCapacity(pools, FreeOrTotal) { - let SumCapacity: number = 0; - let arrLength = pools.length; - for (let i = 0; i < arrLength; i++) { - if(this.data.extras && this.data.extras[":provisionPolicy"].ioConnectivityLoS.accessProtocol.toLowerCase() == pools[i].extras.ioConnectivity.accessProtocol && this.data.extras[":provisionPolicy"].dataStorageLoS.provisioningPolicy == pools[i].extras.dataStorage.provisioningPolicy){ - if (FreeOrTotal === 'free') { - SumCapacity += pools[i].freeCapacity; - } else { - SumCapacity += pools[i].totalCapacity; - } - }else{ - SumCapacity = 0; - } - } - return SumCapacity; - } -} diff --git a/dashboard/src/app/business/profile/profileCard/suspension-frame/suspension-frame.component.html b/dashboard/src/app/business/profile/profileCard/suspension-frame/suspension-frame.component.html deleted file mode 100644 index 114f8ca8e..000000000 --- a/dashboard/src/app/business/profile/profileCard/suspension-frame/suspension-frame.component.html +++ /dev/null @@ -1,9 +0,0 @@ -
-
-
-

{{policyName}} policy

-

{{item}}

- -
-
-
diff --git a/dashboard/src/app/business/profile/profileCard/suspension-frame/suspension-frame.component.ts b/dashboard/src/app/business/profile/profileCard/suspension-frame/suspension-frame.component.ts deleted file mode 100644 index 66bb6da59..000000000 --- a/dashboard/src/app/business/profile/profileCard/suspension-frame/suspension-frame.component.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { Component, OnInit, Input } from '@angular/core'; - -@Component({ - selector: 'app-suspension-frame', - templateUrl: './suspension-frame.component.html', - styleUrls: [ - - ] -}) -export class SuspensionFrameComponent implements OnInit { - data=[]; - policyName:string; - @Input() - set policy(policy: any) { - let extra = policy[1]; - this.policyName = policy[0]; - if(this.policyName === "QoS"){ - let maxIpos ="MaxIOPS = " + extra[":provisionPolicy"].ioConnectivityLoS.maxIOPS + " IOPS/TB"; - this.data.push(maxIpos); - let maxBWS = "MaxBWS = " + extra[":provisionPolicy"].ioConnectivityLoS.maxBWS + " MBPS/TB"; - this.data.push(maxBWS); - }else if(this.policyName === "Replication"){ - let type ="Type = " + extra[":replicationPolicy"].dataProtectionLoS.replicaTypes; - this.data.push(type); - let mode = "Mode = " + extra[":replicationPolicy"].replicaInfos.replicaUpdateMode; - this.data.push(mode); - let Period = "Period = " + extra[":replicationPolicy"].replicaInfos.replicationPeriod +" Minutes"; - this.data.push(Period); - let Bandwidth = "Bandwidth = " + extra[":replicationPolicy"].replicaInfos.replicationBandwidth +" MBPS/TB"; - this.data.push(Bandwidth); - let RGO = "RGO = " + extra[":replicationPolicy"].dataProtectionLoS.recoveryGeographicObject; - this.data.push(RGO); - let RTO = "RTO = " + extra[":replicationPolicy"].dataProtectionLoS.recoveryTimeObjective; - this.data.push(RTO); - let RPO = "RPO = " + extra[":replicationPolicy"].dataProtectionLoS.recoveryPointObjective; - this.data.push(RPO); - let Consistency = "Consistency = " + extra[":replicationPolicy"].replicaInfos.consistencyEnabled; - this.data.push(Consistency); - }else{ - let schedule ="Schedule = " + extra[":snapshotPolicy"].schedule.occurrence; - this.data.push(schedule); - let execution = "Execution Time = " + extra[":snapshotPolicy"].schedule.datetime.split("T")[1] ; - this.data.push(execution); - let Retention = "Retention = " + (extra[":snapshotPolicy"].retention["number"] ? extra[":snapshotPolicy"].retention["number"]: (extra[":snapshotPolicy"].retention.duration+" Days")); - this.data.push(Retention ); - } - }; - constructor() { } - - ngOnInit() { - // console.log(this.policy); - } -} diff --git a/dashboard/src/app/business/profile/storage-pools-table/storage-pools-table.component.html b/dashboard/src/app/business/profile/storage-pools-table/storage-pools-table.component.html deleted file mode 100644 index 701440241..000000000 --- a/dashboard/src/app/business/profile/storage-pools-table/storage-pools-table.component.html +++ /dev/null @@ -1,41 +0,0 @@ - diff --git a/dashboard/src/app/business/profile/storage-pools-table/storage-pools-table.component.ts b/dashboard/src/app/business/profile/storage-pools-table/storage-pools-table.component.ts deleted file mode 100644 index f1fb8ef71..000000000 --- a/dashboard/src/app/business/profile/storage-pools-table/storage-pools-table.component.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { Component, OnInit,Input } from '@angular/core'; -import { PoolService } from './../profile.service'; -import { Utils } from '../../../shared/api'; - -@Component({ - selector: 'app-storage-pools-table', - templateUrl: './storage-pools-table.component.html', - styleUrls: [ - - ] -}) -export class StoragePoolsTableComponent implements OnInit { - cols; - totalFreeCapacity = 0; - pools = []; - selectData; - @Input() - set selectProfile(selectProfile: any) { - this.selectData = selectProfile; - this.getPools(); - }; - constructor( - private PoolService: PoolService - ) { } - - getPools() { - this.PoolService.getPools().subscribe((res) => { - this.pools = []; - let pools = res.json(); - if(this.selectData){ - let arrLength = pools.length - for (let i = 0; i < arrLength; i++) { - if (this.selectData.extras.protocol.toLowerCase() == pools[i].extras.ioConnectivity.accessProtocol && this.selectData.storageType == pools[i].extras.dataStorage.provisioningPolicy){ - this.pools.push(pools[i]); - } - } - }else{ - this.pools = pools; - } - - this.pools.map((pool)=>{ - pool.freeCapacityFormat = Utils.getDisplayGBCapacity(pool.freeCapacity); - pool.totalCapacityFormat = Utils.getDisplayGBCapacity(pool.totalCapacity); - }) - - this.totalFreeCapacity = this.getSumCapacity(this.pools, 'free'); - }); - } - - getSumCapacity(pools, FreeOrTotal) { - let SumCapacity: number = 0; - let arrLength = pools.length; - for (let i = 0; i < arrLength; i++) { - if (FreeOrTotal === 'free') { - SumCapacity += pools[i].freeCapacity; - } else { - SumCapacity += pools[i].totalCapacity; - } - } - return SumCapacity; - } - - ngOnInit() { - - this.cols = [ - { field: 'name', header: 'Name' }, - { field: 'freeCapacity', header: 'FreeCapacity' }, - { field: 'totalCapacity', header: 'TotalCapacity' }, - { field: 'extras.advanced.diskType', header: 'Disk' }, - { field: 'extras.dataStorage.provisioningPolicy', header: 'Backend' } - ]; - this.getPools(); - } - -} diff --git a/dashboard/src/app/business/profile/storage-pools-table/storage-pools-table.module.ts b/dashboard/src/app/business/profile/storage-pools-table/storage-pools-table.module.ts deleted file mode 100644 index ec6b1bce2..000000000 --- a/dashboard/src/app/business/profile/storage-pools-table/storage-pools-table.module.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule, APP_INITIALIZER } from '@angular/core'; - -import { TableModule } from './../../../components/common/api'; -import { HttpService } from './../../../shared/api'; -import { PoolService } from './../profile.service'; - -import { StoragePoolsTableComponent } from './storage-pools-table.component'; - -@NgModule({ - declarations: [ - StoragePoolsTableComponent - ], - imports: [ - CommonModule, - TableModule - ], - providers: [ - HttpService, - PoolService - ], - exports: [ - StoragePoolsTableComponent - ], -}) -export class PoolModule { } \ No newline at end of file diff --git a/dashboard/src/app/business/resource/region/region.component.ts b/dashboard/src/app/business/resource/region/region.component.ts deleted file mode 100644 index d6b34c426..000000000 --- a/dashboard/src/app/business/resource/region/region.component.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { Router } from '@angular/router'; -import { Component, OnInit, ViewContainerRef, ViewChild, Directive, ElementRef, HostBinding, HostListener } from '@angular/core'; -import { I18NService } from './../../../../app/shared/api'; -import { AppService } from './../../../../app/app.service'; -import { trigger, state, style, transition, animate} from '@angular/animations'; -import { I18nPluralPipe } from '@angular/common'; - -@Component({ - selector: 'region-table', - templateUrl: './region.html', - styleUrls: [], - animations: [ - trigger('overlayState', [ - state('hidden', style({ - opacity: 0 - })), - state('visible', style({ - opacity: 1 - })), - transition('visible => hidden', animate('400ms ease-in')), - transition('hidden => visible', animate('400ms ease-out')) - ]), - - trigger('notificationTopbar', [ - state('hidden', style({ - height: '0', - opacity: 0 - })), - state('visible', style({ - height: '*', - opacity: 1 - })), - transition('visible => hidden', animate('400ms ease-in')), - transition('hidden => visible', animate('400ms ease-out')) - ]) - ] -}) -export class RegionComponent implements OnInit{ - regions = []; - - constructor( - public I18N: I18NService, - // private router: Router - ){} - - ngOnInit() { - this.regions = [ - { "name": this.I18N.keyID['sds_resource_region_default'], "role": "Primary Region", } - ]; - } - - rowSelect(rowdata){ - console.log(rowdata); - } - -} - diff --git a/dashboard/src/app/business/resource/region/region.html b/dashboard/src/app/business/resource/region/region.html deleted file mode 100644 index 9d57a5d9f..000000000 --- a/dashboard/src/app/business/resource/region/region.html +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/dashboard/src/app/business/resource/region/region.module.ts b/dashboard/src/app/business/resource/region/region.module.ts deleted file mode 100644 index c70c8a9bb..000000000 --- a/dashboard/src/app/business/resource/region/region.module.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { NgModule, APP_INITIALIZER } from '@angular/core'; -import { RegionComponent } from './region.component'; -import { ButtonModule, DataTableModule, InputTextModule } from './../../../components/common/api'; - - -@NgModule({ - declarations: [ - RegionComponent - ], - imports: [ - ButtonModule, - DataTableModule, - InputTextModule - ], - exports: [ RegionComponent ], - providers: [] -}) -export class RegionModule { } \ No newline at end of file diff --git a/dashboard/src/app/business/resource/resource.component.ts b/dashboard/src/app/business/resource/resource.component.ts deleted file mode 100644 index 9c2df5f62..000000000 --- a/dashboard/src/app/business/resource/resource.component.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { Router } from '@angular/router'; -import { Component, OnInit, ViewContainerRef, ViewChild, Directive, ElementRef, HostBinding, HostListener } from '@angular/core'; -import { I18NService } from '../../../app/shared/api'; -import { AppService } from '../../../app/app.service'; -import { trigger, state, style, transition, animate} from '@angular/animations'; -import { I18nPluralPipe } from '@angular/common'; - -@Component({ - templateUrl: './resource.html', - styleUrls: [], - animations: [ - trigger('overlayState', [ - state('hidden', style({ - opacity: 0 - })), - state('visible', style({ - opacity: 1 - })), - transition('visible => hidden', animate('400ms ease-in')), - transition('hidden => visible', animate('400ms ease-out')) - ]), - - trigger('notificationTopbar', [ - state('hidden', style({ - height: '0', - opacity: 0 - })), - state('visible', style({ - height: '*', - opacity: 1 - })), - transition('visible => hidden', animate('400ms ease-in')), - transition('hidden => visible', animate('400ms ease-out')) - ]) - ] -}) -export class ResourceComponent implements OnInit{ - - constructor( - public I18N: I18NService, - // private router: Router - ){} - - ngOnInit() { - - } - -} - diff --git a/dashboard/src/app/business/resource/resource.html b/dashboard/src/app/business/resource/resource.html deleted file mode 100644 index e7727168c..000000000 --- a/dashboard/src/app/business/resource/resource.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/dashboard/src/app/business/resource/resource.module.ts b/dashboard/src/app/business/resource/resource.module.ts deleted file mode 100644 index 2379ecef9..000000000 --- a/dashboard/src/app/business/resource/resource.module.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { NgModule, APP_INITIALIZER } from '@angular/core'; -import { ResourceComponent } from './resource.component'; -import { RouterModule } from '@angular/router'; -import { TabViewModule, ButtonModule } from '../../components/common/api'; - -// 引入region模块 -import { RegionModule } from './region/region.module'; -// 引入zone模块 -import { ZoneModule } from './zone/zone.module'; -// 引入storage模块 -import { StorageModule } from './storage/storage.module'; - -let routers = [{ - path: '', - component: ResourceComponent -}] - -@NgModule({ - declarations: [ - ResourceComponent - ], - imports: [ - RouterModule.forChild(routers), - TabViewModule, - ButtonModule, - RegionModule,//region模块 - ZoneModule,//zone模块 - StorageModule//storage模块 - ], - providers: [] -}) -export class ResourceModule { } \ No newline at end of file diff --git a/dashboard/src/app/business/resource/resource.service.ts b/dashboard/src/app/business/resource/resource.service.ts deleted file mode 100644 index f748d4047..000000000 --- a/dashboard/src/app/business/resource/resource.service.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { Injectable } from '@angular/core'; -import { I18NService, HttpService, ParamStorService } from '../../shared/api'; -import { Observable } from 'rxjs'; - -@Injectable() -export class AvailabilityZonesService{ - constructor( - private http: HttpService, - private paramStor: ParamStorService - ) { } - - url = 'v1beta/{project_id}/availabilityZones'; - - //get az - getAZ(param?): Observable{ - return this.http.get(this.url, param); - } - - -} diff --git a/dashboard/src/app/business/resource/storage/storage.component.ts b/dashboard/src/app/business/resource/storage/storage.component.ts deleted file mode 100644 index 3aad4f352..000000000 --- a/dashboard/src/app/business/resource/storage/storage.component.ts +++ /dev/null @@ -1,83 +0,0 @@ -import { Router } from '@angular/router'; -import { Component, OnInit, ViewContainerRef, ViewChild, Directive, ElementRef, HostBinding, HostListener } from '@angular/core'; -import { I18NService, ParamStorService} from 'app/shared/api'; -import { Http } from '@angular/http'; -import { trigger, state, style, transition, animate} from '@angular/animations'; - -@Component({ - selector: 'storage-table', - templateUrl: './storage.html', - styleUrls: [], - animations: [ - trigger('overlayState', [ - state('hidden', style({ - opacity: 0 - })), - state('visible', style({ - opacity: 1 - })), - transition('visible => hidden', animate('400ms ease-in')), - transition('hidden => visible', animate('400ms ease-out')) - ]), - - trigger('notificationTopbar', [ - state('hidden', style({ - height: '0', - opacity: 0 - })), - state('visible', style({ - height: '*', - opacity: 1 - })), - transition('visible => hidden', animate('400ms ease-in')), - transition('hidden => visible', animate('400ms ease-out')) - ]) - ] -}) -export class StorageComponent implements OnInit{ - - storages = []; - - constructor( - public I18N: I18NService, - private http: Http, - private paramStor: ParamStorService - ){} - - ngOnInit() { - this.storages = []; - - this.listStorage(); - } - - listStorage(){ - this.storages = []; - let reqUser: any = { params:{} }; - let user_id = this.paramStor.CURRENT_USER().split("|")[1]; - this.http.get("/v3/users/"+ user_id +"/projects", reqUser).subscribe((objRES) => { - let project_id; - objRES.json().projects.forEach(element => { - if(element.name == "admin"){ - project_id = element.id; - } - }) - - let reqPool: any = { params:{} }; - this.http.get("/v1beta/"+ project_id +"/pools", reqPool).subscribe((poolRES) => { - let reqDock: any = { params:{} }; - this.http.get("/v1beta/"+ project_id +"/docks", reqDock).subscribe((dockRES) => { - dockRES.json().forEach(ele => { - let zone = poolRES.json().filter((pool)=>{ - return pool.dockId == ele.id; - })[0].availabilityZone; - let [name,ip,status,description,region,az] = [ele.name, ele.endpoint.split(":")[0], "Enabled", ele.description, "default_region", zone]; - this.storages.push({name,ip,status,description,region,az}); - }) - console.log(this.storages); - }) - }) - }) - } - -} - diff --git a/dashboard/src/app/business/resource/storage/storage.html b/dashboard/src/app/business/resource/storage/storage.html deleted file mode 100644 index e03b3d88b..000000000 --- a/dashboard/src/app/business/resource/storage/storage.html +++ /dev/null @@ -1,19 +0,0 @@ -
-
-
-
- - -
- -
-
- - - - - - - - - \ No newline at end of file diff --git a/dashboard/src/app/business/resource/storage/storage.module.ts b/dashboard/src/app/business/resource/storage/storage.module.ts deleted file mode 100644 index bdf84cfc7..000000000 --- a/dashboard/src/app/business/resource/storage/storage.module.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { NgModule, APP_INITIALIZER } from '@angular/core'; -import { StorageComponent } from './storage.component'; -import { ButtonModule, DataTableModule, InputTextModule } from './../../../components/common/api'; - - -@NgModule({ - declarations: [ - StorageComponent - ], - imports: [ - ButtonModule, - DataTableModule, - InputTextModule - ], - exports: [ - StorageComponent - ], - providers: [] -}) -export class StorageModule { } \ No newline at end of file diff --git a/dashboard/src/app/business/resource/zone/zone.component.ts b/dashboard/src/app/business/resource/zone/zone.component.ts deleted file mode 100644 index e7c6ee3b7..000000000 --- a/dashboard/src/app/business/resource/zone/zone.component.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { Router } from '@angular/router'; -import { Component, OnInit, ViewContainerRef, ViewChild, Directive, ElementRef, HostBinding, HostListener } from '@angular/core'; -import { I18NService, ParamStorService} from 'app/shared/api'; -import { Http } from '@angular/http'; -import { trigger, state, style, transition, animate } from '@angular/animations'; -import {AvailabilityZonesService} from '../resource.service'; - -@Component({ - selector: 'zone-table', - templateUrl: './zone.html', - styleUrls: [], - animations: [ - trigger('overlayState', [ - state('hidden', style({ - opacity: 0 - })), - state('visible', style({ - opacity: 1 - })), - transition('visible => hidden', animate('400ms ease-in')), - transition('hidden => visible', animate('400ms ease-out')) - ]), - - trigger('notificationTopbar', [ - state('hidden', style({ - height: '0', - opacity: 0 - })), - state('visible', style({ - height: '*', - opacity: 1 - })), - transition('visible => hidden', animate('400ms ease-in')), - transition('hidden => visible', animate('400ms ease-out')) - ]) - ] -}) -export class ZoneComponent implements OnInit { - - zones = []; - - constructor( - public I18N: I18NService, - private http: Http, - private paramStor: ParamStorService, - private availabilityZonesService: AvailabilityZonesService - ) { } - - ngOnInit() { - - this.listAZ(); - } - - listAZ(){ - this.zones = []; - this.availabilityZonesService.getAZ().subscribe((azRes) => { - let AZs=azRes.json(); - if(AZs && AZs.length !== 0){ - AZs.forEach(item =>{ - let [name,region,description] = [item, "default_region", "--"]; - this.zones.push({name,region,description}); - }) - } - }) - } -} - diff --git a/dashboard/src/app/business/resource/zone/zone.html b/dashboard/src/app/business/resource/zone/zone.html deleted file mode 100644 index 994629a7c..000000000 --- a/dashboard/src/app/business/resource/zone/zone.html +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/dashboard/src/app/business/resource/zone/zone.module.ts b/dashboard/src/app/business/resource/zone/zone.module.ts deleted file mode 100644 index 971390c21..000000000 --- a/dashboard/src/app/business/resource/zone/zone.module.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { NgModule, APP_INITIALIZER } from '@angular/core'; -import { ZoneComponent } from './zone.component'; -import { ButtonModule, DataTableModule, InputTextModule } from './../../../components/common/api'; -import {AvailabilityZonesService} from '../resource.service'; -import { HttpService } from '../../../shared/service/Http.service'; - -@NgModule({ - declarations: [ - ZoneComponent - ], - imports: [ - ButtonModule, - DataTableModule, - InputTextModule - ], - exports: [ - ZoneComponent - ], - providers: [HttpService,AvailabilityZonesService] -}) -export class ZoneModule { } \ No newline at end of file diff --git a/dashboard/src/app/business/scss-variable.scss b/dashboard/src/app/business/scss-variable.scss deleted file mode 100644 index 11a4a728f..000000000 --- a/dashboard/src/app/business/scss-variable.scss +++ /dev/null @@ -1,75 +0,0 @@ -$color-primary: (normal: #438bd3, hover: #4596e8, active: #1f5fac); -$color-disabled: #c9d1d8; -$color-text: (primary: #657D95, secondary: #8893a6, tertary: #b9c3c8, auxiliary: #c9d1d8); -$color-title: (primary: #2e3039, secondary: #657D95); -$color-splitline: #ecf0f2; -$color-panelbg: #f3f6f7; -$widget-border: (normal: #cfd7db, hover: #98a5bc, focus: #98a5bc, active: #98a5bc); -$widget-bg: (normal: #fdfdfd, hover: #ffffff, focus: #ffffff, active: #f1f1f1); -$border-radius: (small, 3px), -(medium, 10px), -(large, 20px); -@each $type, -$size in $border-radius { - $radius-pos: (tl, $size 0 0 0), (tr, 0 $size 0 0), (br, 0 0 $size 0), (bl, 0 0 0 $size), (top, $size $size 0 0), (right, 0 $size $size 0), (left, $size 0 0 $size), (bottom, 0 0 $size $size), (all, $size); - @each $pos, - $cornerStyle in $radius-pos { - .ui-corner-#{ $pos }-#{ $type } { - -moz-border-radius: $cornerStyle; - -webkit-border-radius: $cornerStyle; - ; - border-radius: $cornerStyle; - } - } -} - -$fontFamily: "Roboto", -"Trebuchet MS", -Arial, -Helvetica, -sans-serif; -$fontSize: 0.14rem; -$borderRadius: 3px; -$disabledOpacity: 0.35; -//Header -$headerBorderWidth: 1px; -$headerBorderColor: #d9d9d9; -$headerBgColor: #f6f7f9; -$headerTextColor: #1b1d1f; -$headerFontWeight: normal; -$headerIconTextColor: #1b1d1f; -//Content -$contentBorderWidth: 1px; -$contentBorderColor: #D5D5D5; -$contentBgColor: #ffffff; -$contentTextColor: map-get($color-text, primary); -//Default State -$stateDefaultBorderWidth: 1px; -$stateDefaultBorderColor: map-get($widget-border, normal); -$stateDefaultBgColor: map-get($widget-bg, normal); -$stateDefaultTextColor: map-get($color-text, primary); -//Active State -$stateActiveBorderColor: map-get($widget-border, active); -$stateActiveBgColor: map-get($widget-bg, active); -$stateActiveTextColor: map-get($color-text, primary); -//Highlight State -$stateHighlightBorderColor: map-get($color-primary, normal); -$stateHighlightBgColor: map-get($color-primary, normal); -$stateHighlightTextColor: #FFFFFF; -//Focus State -$stateFocusBorderColor: map-get($widget-border, focus); -$stateFocusBgColor: map-get($widget-bg, focus); -$stateFocusTextColor: map-get($color-text, primary); -//Error State -$stateErrorBorderColor: #f44336; -$stateErrorBgColor: #f5554a; -$stateErrorTextColor: #cd0a0a; -//Hover State -$stateHoverBorderColor: map-get($widget-border, hover); -$stateHoverBgColor: map-get($widget-bg, hover); -$stateHoverTextColor: map-get($color-text, primary); -//Forms -$inputBgColor: #ffffff; -$inputTextColor: map-get($color-text, primary); -$invalidInputBorderColor: #f44336; -$inputGroupTextColor: map-get($color-text, primary); \ No newline at end of file diff --git a/dashboard/src/app/business/service/service.component.html b/dashboard/src/app/business/service/service.component.html deleted file mode 100644 index 78db672a4..000000000 --- a/dashboard/src/app/business/service/service.component.html +++ /dev/null @@ -1,3 +0,0 @@ -
- 我是service页面 -
\ No newline at end of file diff --git a/dashboard/src/app/business/service/service.component.ts b/dashboard/src/app/business/service/service.component.ts deleted file mode 100644 index 699a7b24b..000000000 --- a/dashboard/src/app/business/service/service.component.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { Router } from '@angular/router'; -import { Component, OnInit, ViewContainerRef, ViewChild, Directive, ElementRef, HostBinding, HostListener } from '@angular/core'; -import { I18NService } from 'app/shared/api'; -import { AppService } from 'app/app.service'; -import { trigger, state, style, transition, animate} from '@angular/animations'; -import { I18nPluralPipe } from '@angular/common'; - -@Component({ - templateUrl: './service.component.html', - styleUrls: [], - animations: [ - trigger('overlayState', [ - state('hidden', style({ - opacity: 0 - })), - state('visible', style({ - opacity: 1 - })), - transition('visible => hidden', animate('400ms ease-in')), - transition('hidden => visible', animate('400ms ease-out')) - ]), - - trigger('notificationTopbar', [ - state('hidden', style({ - height: '0', - opacity: 0 - })), - state('visible', style({ - height: '*', - opacity: 1 - })), - transition('visible => hidden', animate('400ms ease-in')), - transition('hidden => visible', animate('400ms ease-out')) - ]) - ] -}) -export class ServiceComponent implements OnInit{ - - constructor( - // private I18N: I18NService, - // private router: Router - ){} - - ngOnInit() { - - } - -} diff --git a/dashboard/src/app/business/service/service.module.ts b/dashboard/src/app/business/service/service.module.ts deleted file mode 100644 index 107592ee1..000000000 --- a/dashboard/src/app/business/service/service.module.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { NgModule, APP_INITIALIZER } from '@angular/core'; -import { ServiceComponent } from './service.component'; -import { RouterModule } from '@angular/router'; - -let routers = [{ - path: '', - component: ServiceComponent -}] - -@NgModule({ - declarations: [ - ServiceComponent - ], - imports: [ RouterModule.forChild(routers) ], - providers: [] -}) -export class ServiceModule { } \ No newline at end of file diff --git a/dashboard/src/app/components/accordion/accordion.css b/dashboard/src/app/components/accordion/accordion.css deleted file mode 100644 index 606e60390..000000000 --- a/dashboard/src/app/components/accordion/accordion.css +++ /dev/null @@ -1,44 +0,0 @@ -.ui-accordion { - width: 100%; -} - -.ui-accordion .ui-accordion-header { - cursor: pointer; - position: relative; - margin-top: 1px; - zoom: 1; -} - -.ui-accordion .ui-accordion-header a { - display: block; - padding: .5em; -} - -.ui-accordion .ui-accordion-content { - padding: 1em; - border-top: 0; - overflow: visible; - zoom: 1; -} - -.ui-accordion .ui-accordion-header.ui-state-disabled, -.ui-accordion .ui-accordion-header.ui-state-disabled a { - cursor: default; -} - -.ui-accordion-content-wrapper-overflown { - overflow: hidden; -} - -.ui-rtl .ui-accordion .ui-accordion-header a { - padding: .5em 2em .5em .5em; -} - -.ui-rtl .ui-accordion .ui-accordion-header > .fa { - left: initial; - right: .5em; -} - -.ui-rtl .ui-accordion .ui-accordion-header > .fa-caret-right::before { - content: '\f0d9'; -} \ No newline at end of file diff --git a/dashboard/src/app/components/accordion/accordion.spec.ts b/dashboard/src/app/components/accordion/accordion.spec.ts deleted file mode 100644 index f165fb0ea..000000000 --- a/dashboard/src/app/components/accordion/accordion.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { Accordion } from './accordion'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('Accordion', () => { - - let accordion: Accordion; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - Accordion - ] - }); - - fixture = TestBed.createComponent(Accordion); - accordion = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/accordion/accordion.ts b/dashboard/src/app/components/accordion/accordion.ts deleted file mode 100644 index fafd16e8e..000000000 --- a/dashboard/src/app/components/accordion/accordion.ts +++ /dev/null @@ -1,209 +0,0 @@ -import { NgModule, Component, ElementRef, AfterContentInit, OnDestroy, Input, Output, EventEmitter, - ContentChildren, QueryList, ChangeDetectorRef, Inject, forwardRef} from '@angular/core'; -import { trigger, state, style, transition, animate } from '@angular/animations'; -import { CommonModule } from '@angular/common'; -import { SharedModule, Header } from '../common/shared'; -import { BlockableUI } from '../common/blockableui'; -import { Subscription } from 'rxjs/Subscription'; - -let idx: number = 0; - -@Component({ - selector: 'p-accordionTab', - template: ` - -
-
- -
-
- `, - animations: [ - trigger('tabContent', [ - state('hidden', style({ - height: '0' - })), - state('visible', style({ - height: '*' - })), - transition('visible <=> hidden', animate('400ms cubic-bezier(0.86, 0, 0.07, 1)')) - ]) - ] -}) -export class AccordionTab implements OnDestroy { - - @Input() header: string; - - @Input() selected: boolean; - - @Input() disabled: boolean; - - @Output() selectedChange: EventEmitter = new EventEmitter(); - - @ContentChildren(Header) headerFacet: QueryList
; - - animating: boolean; - - id: string = `ui-accordiontab-${idx++}`; - - constructor( @Inject(forwardRef(() => Accordion)) public accordion: Accordion) {} - - toggle(event) { - if (this.disabled || this.animating) { - return false; - } - - this.animating = true; - let index = this.findTabIndex(); - - if (this.selected) { - this.selected = false; - this.accordion.onClose.emit({ originalEvent: event, index: index }); - } - else { - if (!this.accordion.multiple) { - for (var i = 0; i < this.accordion.tabs.length; i++) { - this.accordion.tabs[i].selected = false; - this.accordion.tabs[i].selectedChange.emit(false); - } - } - - this.selected = true; - this.accordion.onOpen.emit({ originalEvent: event, index: index }); - } - - this.selectedChange.emit(this.selected); - - event.preventDefault(); - } - - findTabIndex() { - let index = -1; - for (var i = 0; i < this.accordion.tabs.length; i++) { - if (this.accordion.tabs[i] == this) { - index = i; - break; - } - } - return index; - } - - get lazy(): boolean { - return this.accordion.lazy; - } - - get hasHeaderFacet(): boolean { - return this.headerFacet && this.headerFacet.length > 0; - } - - onToggleDone(event: Event) { - this.animating = false; - } - - ngOnDestroy() { - this.accordion.tabs.splice(this.findTabIndex(), 1); - } -} - -@Component({ - selector: 'p-accordion', - template: ` -
- -
- ` -}) -export class Accordion implements BlockableUI, AfterContentInit, OnDestroy { - - @Input() multiple: boolean; - - @Output() onClose: EventEmitter = new EventEmitter(); - - @Output() onOpen: EventEmitter = new EventEmitter(); - - @Input() style: any; - - @Input() styleClass: string; - - @Input() expandIcon: string = 'fa fa-fw fa-caret-right'; - - @Input() collapseIcon: string = 'fa fa-fw fa-caret-down'; - - @Input() lazy: boolean; - - @ContentChildren(AccordionTab) tabList: QueryList; - - tabListSubscription: Subscription; - - private _activeIndex: any; - - public tabs: AccordionTab[] = []; - - constructor(public el: ElementRef, public changeDetector: ChangeDetectorRef) {} - - ngAfterContentInit() { - this.initTabs(); - - this.tabListSubscription = this.tabList.changes.subscribe(_ => { - this.initTabs(); - this.changeDetector.markForCheck(); - }); - } - - initTabs(): any { - this.tabs = this.tabList.toArray(); - this.updateSelectionState(); - } - - getBlockableElement(): HTMLElement { - return this.el.nativeElement.children[0]; - } - - @Input() get activeIndex(): any { - return this._activeIndex; - } - - set activeIndex(val: any) { - this._activeIndex = val; - this.updateSelectionState(); - } - - updateSelectionState() { - if (this.tabs && this.tabs.length && this._activeIndex != null) { - for (let i = 0; i < this.tabs.length; i++) { - let selected = this.multiple ? this._activeIndex.includes(i) : (i === this._activeIndex); - let changed = selected !== this.tabs[i].selected; - - if (changed) { - this.tabs[i].animating = true; - } - - this.tabs[i].selected = selected; - this.tabs[i].selectedChange.emit(selected); - } - } - } - - ngOnDestroy() { - if(this.tabListSubscription) { - this.tabListSubscription.unsubscribe(); - } - } -} - -@NgModule({ - imports: [CommonModule], - exports: [Accordion,AccordionTab,SharedModule], - declarations: [Accordion,AccordionTab] -}) -export class AccordionModule { } diff --git a/dashboard/src/app/components/autocomplete/autocomplete.css b/dashboard/src/app/components/autocomplete/autocomplete.css deleted file mode 100644 index 637ed7330..000000000 --- a/dashboard/src/app/components/autocomplete/autocomplete.css +++ /dev/null @@ -1,163 +0,0 @@ -.ui-autocomplete { - width: auto; - zoom: 1; - cursor: pointer; - -moz-box-shadow: none; - -webkit-box-shadow: none; - box-shadow: none; - position: relative; - display: inline-block; -} - -.ui-autocomplete .ui-autocomplete-dropdown { - height: 100%; - width: 2em; - margin-right: 0; - vertical-align: top; -} - -.ui-autocomplete .ui-autocomplete-input { - padding-right: 1.5em; -} - -.ui-autocomplete-loader { - position: absolute; - right: .25em; - top: 50%; - margin-top: -.5em; -} - -.ui-autocomplete-query { - font-weight: bold; -} - -.ui-autocomplete .ui-autocomplete-panel { - min-width: 100%; -} - -.ui-autocomplete-panel { - position: absolute; - overflow: auto; -} - -.ui-autocomplete-panel .ui-autocomplete-list { - padding: 0.4em; - border: 0 none; -} - -.ui-autocomplete-panel .ui-autocomplete-list-item { - border: 0 none; - cursor: pointer; - font-weight: normal; - margin: 1px 0; - padding: 0.186em 0.313em; - text-align: left; -} - -.ui-autocomplete .ui-button-icon-only, -.ui-autocomplete .ui-button-icon-only:enabled:hover, -.ui-autocomplete .ui-button-icon-only:enabled:focus, -.ui-autocomplete .ui-button-icon-only:enabled:active { - border-left: 0 none; -} - -/* Multiple Selection */ -.ui-autocomplete-multiple-container { - display: inline-block; - vertical-align: middle; -} - -.ui-autocomplete-multiple-container.ui-inputtext { - clear: left; - cursor: text; - list-style-type: none; - margin: 0; - overflow: hidden; - padding: 0 1.5em 0 .25em; -} - -.ui-autocomplete-token { - cursor: default; - display: inline-block; - vertical-align: middle; - overflow: hidden; - padding: .125em .5em; - white-space: nowrap; - position: relative; - margin-right: .125em; - border: 0 none; - font-size: .9em; -} - -.ui-autocomplete-token-label { - display: block; - margin-right: 2em; -} - -.ui-autocomplete-token-icon { - margin-top: -.5em; - position: absolute; - right: 0.2em; - top: 50%; - cursor: pointer; -} - -.ui-autocomplete-input-token { - display: inline-block; - vertical-align: middle; - list-style-type: none; - margin: 0 0 0 .125em; - padding: .25em .25em .25em 0; -} - -.ui-autocomplete-input-token input { - border: 0 none; - width: 10em; - outline: medium none; - background-color: transparent; - margin: 0; - padding: 0; - box-shadow: none; - -moz-border-radius: 0; - -webkit-border-radius: 0; - border-radius: 0; -} - -.ui-autocomplete-dd .ui-autocomplete-loader { - right: 2.25em; -} - -.ui-autocomplete-dd input.ui-corner-all , -.ui-autocomplete-dd .ui-autocomplete-multiple-container.ui-corner-all { - -moz-border-radius-topright: 0px; - -webkit-border-top-right-radius: 0px; - border-top-right-radius: 0px; - -moz-border-radius-bottomright: 0px; - -webkit-border-bottom-right-radius: 0px; - border-bottom-right-radius: 0px; - } - -.ui-autocomplete-dd .ui-autocomplete-dropdown.ui-corner-all { - -moz-border-radius-topleft: 0px; - -webkit-border-top-left-radius: 0px; - border-top-left-radius: 0px; - -moz-border-radius-bottomleft: 0px; - -webkit-border-bottom-left-radius: 0px; - border-bottom-left-radius: 0px; -} - -/** AutoComplete **/ -.ui-fluid p-autocomplete, -.ui-fluid .ui-autocomplete, -.ui-fluid .ui-autocomplete-input { - width: 100%; -} - -.ui-fluid .ui-autocomplete.ui-autocomplete-dd .ui-autocomplete-input, -.ui-fluid .ui-autocomplete.ui-autocomplete-dd .ui-autocomplete-multiple-container { - width: calc(100% - 2em); -} - -.ui-fluid .ui-autocomplete .ui-autocomplete-dropdown.ui-button { - width: 2em; -} diff --git a/dashboard/src/app/components/autocomplete/autocomplete.spec.ts b/dashboard/src/app/components/autocomplete/autocomplete.spec.ts deleted file mode 100644 index 8272d75f2..000000000 --- a/dashboard/src/app/components/autocomplete/autocomplete.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { AutoComplete } from './autocomplete'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('AutoComplete', () => { - - let autocomplete: AutoComplete; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - AutoComplete - ] - }); - - fixture = TestBed.createComponent(AutoComplete); - autocomplete = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/autocomplete/autocomplete.ts b/dashboard/src/app/components/autocomplete/autocomplete.ts deleted file mode 100644 index edc3c56e4..000000000 --- a/dashboard/src/app/components/autocomplete/autocomplete.ts +++ /dev/null @@ -1,643 +0,0 @@ -import {NgModule,Component,ViewChild,ElementRef,AfterViewInit,AfterContentInit,DoCheck,AfterViewChecked,Input,Output,EventEmitter,ContentChildren,QueryList,TemplateRef,Renderer2,forwardRef,ChangeDetectorRef,IterableDiffers} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {InputTextModule} from '../inputtext/inputtext'; -import {ButtonModule} from '../button/button'; -import {SharedModule,PrimeTemplate} from '../common/shared'; -import {DomHandler} from '../dom/domhandler'; -import {ObjectUtils} from '../utils/objectutils'; -import {NG_VALUE_ACCESSOR, ControlValueAccessor} from '@angular/forms'; - -export const AUTOCOMPLETE_VALUE_ACCESSOR: any = { - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => AutoComplete), - multi: true -}; - -@Component({ - selector: 'p-autoComplete', - template: ` - -
    -
  • - - {{field ? objectUtils.resolveFieldData(val, field): val}} - -
  • -
  • - -
  • -
-
-
    -
  • - {{field ? objectUtils.resolveFieldData(option, field) : option}} - -
  • -
  • {{emptyMessage}}
  • -
-
-
- `, - host: { - '[class.ui-inputwrapper-filled]': 'filled', - '[class.ui-inputwrapper-focus]': 'focus' - }, - providers: [DomHandler,ObjectUtils,AUTOCOMPLETE_VALUE_ACCESSOR] -}) -export class AutoComplete implements AfterViewInit,AfterViewChecked,DoCheck,ControlValueAccessor { - - @Input() minLength: number = 1; - - @Input() delay: number = 300; - - @Input() style: any; - - @Input() styleClass: string; - - @Input() inputStyle: any; - - @Input() inputId: string; - - @Input() inputStyleClass: string; - - @Input() placeholder: string; - - @Input() readonly: boolean; - - @Input() disabled: boolean; - - @Input() maxlength: number; - - @Input() required: boolean; - - @Input() size: number; - - @Input() appendTo: any; - - @Input() autoHighlight: boolean; - - @Input() forceSelection: boolean; - - @Input() type: string = 'text'; - - @Output() completeMethod: EventEmitter = new EventEmitter(); - - @Output() onSelect: EventEmitter = new EventEmitter(); - - @Output() onUnselect: EventEmitter = new EventEmitter(); - - @Output() onFocus: EventEmitter = new EventEmitter(); - - @Output() onBlur: EventEmitter = new EventEmitter(); - - @Output() onDropdownClick: EventEmitter = new EventEmitter(); - - @Output() onClear: EventEmitter = new EventEmitter(); - - @Output() onKeyUp: EventEmitter = new EventEmitter(); - - @Input() field: string; - - @Input() scrollHeight: string = '200px'; - - @Input() dropdown: boolean; - - @Input() dropdownMode: string = 'blank'; - - @Input() multiple: boolean; - - @Input() tabindex: number; - - @Input() dataKey: string; - - @Input() emptyMessage: string; - - @Input() immutable: boolean = true; - - @ViewChild('in') inputEL: ElementRef; - - @ViewChild('multiIn') multiInputEL: ElementRef; - - @ViewChild('panel') panelEL: ElementRef; - - @ViewChild('multiContainer') multiContainerEL: ElementRef; - - @ViewChild('ddBtn') dropdownButton: ElementRef; - - @ContentChildren(PrimeTemplate) templates: QueryList; - - itemTemplate: TemplateRef; - - selectedItemTemplate: TemplateRef; - - value: any; - - _suggestions: any[]; - - onModelChange: Function = () => {}; - - onModelTouched: Function = () => {}; - - timeout: any; - - panelVisible: boolean = false; - - documentClickListener: any; - - suggestionsUpdated: boolean; - - highlightOption: any; - - highlightOptionChanged: boolean; - - focus: boolean = false; - - filled: boolean; - - inputClick: boolean; - - inputKeyDown: boolean; - - noResults: boolean; - - differ: any; - - inputFieldValue: string = null; - - loading: boolean; - - constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer2, public objectUtils: ObjectUtils, public cd: ChangeDetectorRef, public differs: IterableDiffers) { - this.differ = differs.find([]).create(null); - } - - @Input() get suggestions(): any[] { - return this._suggestions; - } - - set suggestions(val:any[]) { - this._suggestions = val; - if(this.immutable) { - this.handleSuggestionsChange(); - } - } - - ngDoCheck() { - if(!this.immutable) { - let changes = this.differ.diff(this.suggestions); - if(changes) { - this.handleSuggestionsChange(); - } - } - } - - handleSuggestionsChange() { - if(this.panelEL && this.panelEL.nativeElement && this.loading) { - this.highlightOption = null; - if(this._suggestions && this._suggestions.length) { - this.noResults = false; - this.show(); - this.suggestionsUpdated = true; - - if(this.autoHighlight) { - this.highlightOption = this._suggestions[0]; - } - } - else { - this.noResults = true; - - if(this.emptyMessage) { - this.show(); - this.suggestionsUpdated = true; - } - else { - this.hide(); - } - } - } - - this.loading = false; - } - - ngAfterContentInit() { - this.templates.forEach((item) => { - switch(item.getType()) { - case 'item': - this.itemTemplate = item.template; - break; - - case 'selectedItem': - this.selectedItemTemplate = item.template; - break; - - default: - this.itemTemplate = item.template; - break; - } - }); - } - - ngAfterViewInit() { - if(this.appendTo) { - if(this.appendTo === 'body') - document.body.appendChild(this.panelEL.nativeElement); - else - this.domHandler.appendChild(this.panelEL.nativeElement, this.appendTo); - } - } - - ngAfterViewChecked() { - //Use timeouts as since Angular 4.2, AfterViewChecked is broken and not called after panel is updated - if(this.suggestionsUpdated && this.panelEL.nativeElement && this.panelEL.nativeElement.offsetParent) { - setTimeout(() => this.align(), 1); - this.suggestionsUpdated = false; - } - - if(this.highlightOptionChanged) { - setTimeout(() => { - let listItem = this.domHandler.findSingle(this.panelEL.nativeElement, 'li.ui-state-highlight'); - if(listItem) { - this.domHandler.scrollInView(this.panelEL.nativeElement, listItem); - } - }, 1); - this.highlightOptionChanged = false; - } - } - - writeValue(value: any) : void { - this.value = value; - this.filled = this.value && this.value != ''; - this.updateInputField(); - } - - registerOnChange(fn: Function): void { - this.onModelChange = fn; - } - - registerOnTouched(fn: Function): void { - this.onModelTouched = fn; - } - - setDisabledState(val: boolean): void { - this.disabled = val; - } - - onInput(event: KeyboardEvent) { - if(!this.inputKeyDown) { - return; - } - - if(this.timeout) { - clearTimeout(this.timeout); - } - - let value = ( event.target).value; - if(!this.multiple && !this.forceSelection) { - this.onModelChange(value); - } - - if(value.length === 0) { - this.hide(); - this.onClear.emit(event); - } - - if(value.length >= this.minLength) { - this.timeout = setTimeout(() => { - this.search(event, value); - }, this.delay); - } - else { - this.suggestions = null; - this.hide(); - } - this.updateFilledState(); - this.inputKeyDown = false; - } - - onInputClick(event: MouseEvent) { - if(this.documentClickListener) { - this.inputClick = true; - } - } - - search(event: any, query: string) { - //allow empty string but not undefined or null - if(query === undefined || query === null) { - return; - } - - this.loading = true; - - this.completeMethod.emit({ - originalEvent: event, - query: query - }); - } - - selectItem(option: any, focus: boolean = true) { - if(this.multiple) { - this.multiInputEL.nativeElement.value = ''; - this.value = this.value||[]; - if(!this.isSelected(option)) { - this.value = [...this.value,option]; - this.onModelChange(this.value); - } - } - else { - this.inputEL.nativeElement.value = this.field ? this.objectUtils.resolveFieldData(option, this.field)||'': option; - this.value = option; - this.onModelChange(this.value); - } - - this.onSelect.emit(option); - this.updateFilledState(); - this._suggestions = null; - - if(focus) { - this.focusInput(); - } - } - - show() { - if(this.multiInputEL || this.inputEL) { - let hasFocus = this.multiple ? document.activeElement == this.multiInputEL.nativeElement : document.activeElement == this.inputEL.nativeElement ; - if(!this.panelVisible && hasFocus) { - this.panelVisible = true; - if(this.appendTo) { - this.panelEL.nativeElement.style.minWidth = this.domHandler.getWidth(this.el.nativeElement.children[0]) + 'px'; - } - this.panelEL.nativeElement.style.zIndex = ++DomHandler.zindex; - this.domHandler.fadeIn(this.panelEL.nativeElement, 200); - this.bindDocumentClickListener(); - } - } - } - - align() { - if(this.appendTo) - this.domHandler.absolutePosition(this.panelEL.nativeElement, (this.multiple ? this.multiContainerEL.nativeElement : this.inputEL.nativeElement)); - else - this.domHandler.relativePosition(this.panelEL.nativeElement, (this.multiple ? this.multiContainerEL.nativeElement : this.inputEL.nativeElement)); - } - - hide() { - this.panelVisible = false; - this.unbindDocumentClickListener(); - } - - handleDropdownClick(event) { - this.focusInput(); - let queryValue = this.multiple ? this.multiInputEL.nativeElement.value : this.inputEL.nativeElement.value; - - if(this.dropdownMode === 'blank') - this.search(event, ''); - else if(this.dropdownMode === 'current') - this.search(event, queryValue); - - this.onDropdownClick.emit({ - originalEvent: event, - query: queryValue - }); - } - - focusInput() { - if(this.multiple) - this.multiInputEL.nativeElement.focus(); - else - this.inputEL.nativeElement.focus(); - } - - removeItem(item: any) { - let itemIndex = this.domHandler.index(item); - let removedValue = this.value[itemIndex]; - this.value = this.value.filter((val, i) => i!=itemIndex); - this.onModelChange(this.value); - this.updateFilledState(); - this.onUnselect.emit(removedValue); - } - - onKeydown(event) { - if(this.panelVisible) { - let highlightItemIndex = this.findOptionIndex(this.highlightOption); - - switch(event.which) { - //down - case 40: - if(highlightItemIndex != -1) { - var nextItemIndex = highlightItemIndex + 1; - if(nextItemIndex != (this.suggestions.length)) { - this.highlightOption = this.suggestions[nextItemIndex]; - this.highlightOptionChanged = true; - } - } - else { - this.highlightOption = this.suggestions[0]; - } - - event.preventDefault(); - break; - - //up - case 38: - if(highlightItemIndex > 0) { - let prevItemIndex = highlightItemIndex - 1; - this.highlightOption = this.suggestions[prevItemIndex]; - this.highlightOptionChanged = true; - } - - event.preventDefault(); - break; - - //enter - case 13: - if(this.highlightOption) { - this.selectItem(this.highlightOption); - this.hide(); - } - event.preventDefault(); - break; - - //escape - case 27: - this.hide(); - event.preventDefault(); - break; - - - //tab - case 9: - if(this.highlightOption) { - this.selectItem(this.highlightOption); - } - this.hide(); - break; - } - } else { - if(event.which === 40 && this.suggestions) { - this.search(event,event.target.value); - } - } - - if(this.multiple) { - switch(event.which) { - //backspace - case 8: - if(this.value && this.value.length && !this.multiInputEL.nativeElement.value) { - this.value = [...this.value]; - let removedValue = this.value.pop(); - this.onUnselect.emit(removedValue); - this.onModelChange(this.value); - } - break; - } - } - - this.inputKeyDown = true; - } - - onKeyup(event) { - this.onKeyUp.emit(event); - } - - onInputFocus(event) { - this.focus = true; - this.onFocus.emit(event); - } - - onInputBlur(event) { - this.focus = false; - this.onModelTouched(); - this.onBlur.emit(event); - } - - onInputChange(event) { - if(this.forceSelection && this.suggestions) { - let valid = false; - let inputValue = event.target.value.trim(); - - if(this.suggestions) { - for(let suggestion of this.suggestions) { - let itemValue = this.field ? this.objectUtils.resolveFieldData(suggestion, this.field) : suggestion; - if(itemValue && inputValue === itemValue.trim()) { - valid = true; - this.selectItem(suggestion, false); - break; - } - } - } - - if(!valid) { - if(this.multiple) { - this.multiInputEL.nativeElement.value = ''; - } - else { - this.value = null; - this.inputEL.nativeElement.value = ''; - } - - this.onModelChange(this.value); - } - } - } - - isSelected(val: any): boolean { - let selected: boolean = false; - if(this.value && this.value.length) { - for(let i = 0; i < this.value.length; i++) { - if(this.objectUtils.equals(this.value[i], val, this.dataKey)) { - selected = true; - break; - } - } - } - return selected; - } - - findOptionIndex(option): number { - let index: number = -1; - if(this.suggestions) { - for(let i = 0; i < this.suggestions.length; i++) { - if(this.objectUtils.equals(option, this.suggestions[i])) { - index = i; - break; - } - } - } - - return index; - } - - updateFilledState() { - if(this.multiple) - this.filled = (this.value && this.value.length) || (this.multiInputEL && this.multiInputEL.nativeElement && this.multiInputEL.nativeElement.value != ''); - else - this.filled = (this.inputFieldValue && this.inputFieldValue != '') || (this.inputEL && this.inputEL.nativeElement && this.inputEL.nativeElement.value != '');; - } - - updateInputField() { - let formattedValue = this.value ? (this.field ? this.objectUtils.resolveFieldData(this.value, this.field)||'' : this.value) : ''; - this.inputFieldValue = formattedValue; - - if(this.inputEL && this.inputEL.nativeElement) { - this.inputEL.nativeElement.value = formattedValue; - } - - this.updateFilledState(); - } - - bindDocumentClickListener() { - if(!this.documentClickListener) { - this.documentClickListener = this.renderer.listen('document', 'click', (event) => { - if(event.which === 3) { - return; - } - - if(!this.inputClick && !this.isDropdownClick(event)) { - this.hide(); - } - - this.inputClick = false; - this.cd.markForCheck(); - }); - } - } - - isDropdownClick(event) { - if(this.dropdown) { - let target = event.target; - return (target === this.dropdownButton.nativeElement || target.parentNode === this.dropdownButton.nativeElement); - } - else { - return false; - } - } - - unbindDocumentClickListener() { - if(this.documentClickListener) { - this.documentClickListener(); - this.documentClickListener = null; - } - } - - ngOnDestroy() { - this.unbindDocumentClickListener(); - - if(this.appendTo) { - this.el.nativeElement.appendChild(this.panelEL.nativeElement); - } - } -} - -@NgModule({ - imports: [CommonModule,InputTextModule,ButtonModule,SharedModule], - exports: [AutoComplete,SharedModule], - declarations: [AutoComplete] -}) -export class AutoCompleteModule { } diff --git a/dashboard/src/app/components/badge/badge.scss b/dashboard/src/app/components/badge/badge.scss deleted file mode 100644 index f99ab601a..000000000 --- a/dashboard/src/app/components/badge/badge.scss +++ /dev/null @@ -1,117 +0,0 @@ -@keyframes statusProcessing { - 0% { - -webkit-transform: scale(.8); - transform: scale(.8); - opacity: .5 - } - to { - -webkit-transform: scale(2.4); - transform: scale(2.4); - opacity: 0 - } -} - -.ui-badge{ - display: inline-block; - height: .2rem; - width:auto; - min-width: .2rem; - position: absolute; - top: -.1rem; - right: 0rem; - overflow: hidden; - border-radius: .1rem; - background: nth(nth($color-alert,2),2); - color: white; - line-height: .2rem; - text-align: center; - padding: 0 .06rem; - font-size: .12rem; - white-space: nowrap; - transform: translateX(50%); - transform-origin: center center; - transition:width ease-in .3s; - z-index:9; - user-select: none; - &.ui-badge-dot{ - width: .1rem; - min-width: .1rem; - height:.1rem; - padding: 0; - top: -.05rem; - &.ui-badge-status-content{ - background-color: transparent; - transform: none; - top: 0; - overflow: visible; - font-size: 0; - line-height: .2rem; - height: .2rem; - width: auto; - position: relative; - .ui-badge-status{ - position:relative; - display: inline-block; - width:.1rem; - height:.1rem; - border-radius: .05rem; - vertical-align: middle; - &.ui-badge-status-success{ - background-color: nth(nth($color-alert,1),2); - } - &.ui-badge-status-processing{ - background-color: nth(nth($color-alert,3),2); - &::after{ - position: absolute; - top: -.01rem; - left: -.01rem; - width: 100%; - height: 100%; - border-radius: 50%; - border: 1px solid nth(nth($color-alert,3),2); - content: ""; - animation: statusProcessing 1.2s infinite ease-in-out; - } - } - &.ui-badge-status-default{ - background-color: nth(nth($color-alert,5),2); - } - &.ui-badge-status-warning{ - background-color: nth(nth($color-alert,4),2); - } - &.ui-badge-status-error{ - background-color: nth(nth($color-alert,2),2); - } - } - .ui-badge-status-text{ - font-size:.14rem; - color: map-get($color-text, primary); - padding-left: .08rem; - vertical-align: middle; - } - } - } - &.ui-badge-hide{ - display: none; - } - .ui-badge-counts{ - width: 100%; - height: 100%; - position: relative; - overflow: hidden; - display: block; - font-size:0; - .ui-badge-counts-item{ - display: inline-block; - transition: transform ease-in-out .3s; - p{ - width: 100%; - padding: 0; - margin:0; - line-height: .2rem; - font-size: .12rem; - color:inherit; - } - } - } -} \ No newline at end of file diff --git a/dashboard/src/app/components/badge/badge.ts b/dashboard/src/app/components/badge/badge.ts deleted file mode 100644 index d5fe91524..000000000 --- a/dashboard/src/app/components/badge/badge.ts +++ /dev/null @@ -1,196 +0,0 @@ -import {NgModule,Directive, ElementRef,OnInit,AfterViewInit,OnDestroy,Input,Output,SimpleChange,EventEmitter,forwardRef,Renderer} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import { DomHandler } from '../dom/domhandler'; - -@Directive({ - selector: '[pBadge]', - providers:[DomHandler] -}) -export class Badge implements OnInit,AfterViewInit{ - @Input('animate') animate:boolean = true; - - public _show:boolean = true; - - @Input('show') get show():boolean{ - return this._show; - } - - set show(val:boolean){ - this._show = val; - this.toggle(); - this.onBadgeChange.emit({'show':this.show,'count':this.count,'overflowCount':this.overflowCount}); - } - - public _count:number; - - get count():number{ - return this._count; - } - - @Input('pBadge') set count(val:number){ - this._count = val>=0?val:0; - this.onCountChange(val); - this.onBadgeChange.emit({'show':this.show,'count':this.count,'overflowCount':this.overflowCount}); - } - - @Input('dot') dot:boolean = false; - - @Input() overflowCount:number = 99; - - @Input() showZero:boolean = false; - - @Input('status') status:string;//Enum{ 'success', 'processing, 'default', 'error', 'warning' } - - @Input('text') text:string; - - @Input('style') style:any; - - @Output() onBadgeChange:EventEmitter = new EventEmitter(); - - public container:any; - - constructor(public el: ElementRef,private domHnadler: DomHandler, public renderer: Renderer) {} - - ngOnInit(){ - if(this.status){ - this.dot = true; - } - this.createContainer(); - } - - ngAfterViewInit(){ - this.el.nativeElement.style.position = 'relative'; - this.el.nativeElement.style.overflow = 'visible'; - if(this.style){ - this.updateContainerStyle(this.style); - } - } - - createContainer(){ - if(this.count == 0 && !this.showZero) return; - if(this.container) this.el.nativeElement.removeChild(this.container); - this.container = document.createElement('span'); - this.container.className = 'ui-badge ui-widget'; - - if(!this.show){ - this.container.classList.add('ui-badge-hide'); - } - - if(this.dot){ - this.container.classList.add('ui-badge-dot'); - if(this.status){ - this.updateStatus(); - return; - } - } else { - this.container.title = '' + this.count || ''; - } - - this.updateContainerStyle(this.style); - this.updateCountsHtml(); - this.el.nativeElement.appendChild(this.container); - } - - updateContainerStyle(style:any){ - if(!this.container || typeof style !== 'object') return; - for(let key in style){ - this.container.style[key] = style[key]; - } - } - - updateCountsHtml(){ - if(!this.container || this.dot) return; - if(this.animate && this.count <= this.overflowCount){ - if(this.domHnadler.find(this.container,'.ui-badge-counts').length > 0) return; - - let countsContainer = document.createElement('span'); - countsContainer.className = 'ui-badge-counts'; - let overflowArr = (this.overflowCount + '').split(''); - let countArr = (this.count + '').split(''); - for(let i = 0;i' + j + '

'; - } - countsContainer.appendChild(countsItem); - } - this.container.innerHTML = ''; - this.container.appendChild(countsContainer); - } else { - this.container.innerText = this.count > this.overflowCount?this.overflowCount + '+':this.count + ''; - } - } - - updateStatus(){ - if(!this.container || !this.status) return; - - this.container.classList.add('ui-badge-status-content'); - this.container.innerHTML = ''; - this.container.innerHTML += ''; - - if(this.text){ - this.container.innerHTML += '' + this.text + ''; - } - this.el.nativeElement.appendChild(this.container); - } - - updateCountsPosition(){ - if(!this.animate || this.count > this.overflowCount || this.dot) return; - let overflowArr = (this.overflowCount + '').split(''); - let countArr = (this.count + '').split(''); - let countsContainer = this.domHnadler.find(this.container,'.ui-badge-counts')[0]; - let counteItems = countsContainer.childNodes; - for(let i = 0;i < overflowArr.length;i++){ - if(countArr[i]){ - counteItems[i].style.display = 'inline-block'; - counteItems[i].style.transform = 'translateY(-' + 10 * parseInt(countArr[i]) + '%)'; - for(let j = 0;j < 10;j++){ - counteItems[i].childNodes[j].classList.remove('active'); - if(countArr[i] == j + ''){ - counteItems[i].childNodes[j].classList.add('active'); - } - } - } else { - counteItems[i].style.display = 'none'; - counteItems[i].style.transform = 'translateY(0%)'; - } - - } - } - - onCountChange(count:number):void{ - if(this.dot || this.status) return; - if(!this.container){ - this.createContainer(); - return; - } - this.container.title = '' + this.count || ''; - if(this.count < this.overflowCount && this.animate){ - this.updateCountsHtml(); - this.updateCountsPosition(); - } else { - this.updateCountsHtml(); - } - - } - - toggle(){ - if(!this.container) return; - if(this.show){ - this.container.classList.remove('ui-badge-hide'); - } else { - this.container.classList.add('ui-badge-hide'); - } - } - -} - -@NgModule({ - imports: [CommonModule], - exports: [Badge], - declarations: [Badge] -}) -export class BadgeModule { } \ No newline at end of file diff --git a/dashboard/src/app/components/blockui/blockui.css b/dashboard/src/app/components/blockui/blockui.css deleted file mode 100644 index 4b00320e6..000000000 --- a/dashboard/src/app/components/blockui/blockui.css +++ /dev/null @@ -1,11 +0,0 @@ -.ui-blockui { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; -} - -.ui-blockui-document { - position: fixed; -} \ No newline at end of file diff --git a/dashboard/src/app/components/blockui/blockui.spec.ts b/dashboard/src/app/components/blockui/blockui.spec.ts deleted file mode 100644 index 34b14af22..000000000 --- a/dashboard/src/app/components/blockui/blockui.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { BlockUI } from './blockui'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('BlockUI', () => { - - let blockui: BlockUI; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - BlockUI - ] - }); - - fixture = TestBed.createComponent(BlockUI); - blockui = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/blockui/blockui.ts b/dashboard/src/app/components/blockui/blockui.ts deleted file mode 100644 index a2c6fcba5..000000000 --- a/dashboard/src/app/components/blockui/blockui.ts +++ /dev/null @@ -1,80 +0,0 @@ -import {NgModule,Component,Input,AfterViewInit,OnDestroy,EventEmitter,ElementRef,ViewChild} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {DomHandler} from '../dom/domhandler'; -import {BlockableUI} from '../common/blockableui'; - -@Component({ - selector: 'p-blockUI', - template: ` -
- -
- `, - providers: [DomHandler] -}) -export class BlockUI implements AfterViewInit,OnDestroy { - - @Input() target: any; - - @Input() autoZIndex: boolean = true; - - @Input() baseZIndex: number = 0; - - @ViewChild('mask') mask: ElementRef; - - _blocked: boolean; - - constructor(public el: ElementRef,public domHandler: DomHandler) {} - - @Input() get blocked(): boolean { - return this._blocked; - } - - set blocked(val: boolean) { - this._blocked = val; - - if(this.mask.nativeElement) { - if(this._blocked) - this.block(); - else - this.unblock(); - } - } - - ngAfterViewInit() { - if(this.target && !this.target.getBlockableElement) { - throw 'Target of BlockUI must implement BlockableUI interface'; - } - } - - block() { - if(this.target) { - this.target.getBlockableElement().appendChild(this.mask.nativeElement); - let style = this.target.style||{}; - style.position = 'relative'; - this.target.style = style; - } - else { - document.body.appendChild(this.mask.nativeElement); - } - - if(this.autoZIndex) { - this.mask.nativeElement.style.zIndex = String(this.baseZIndex + (++DomHandler.zindex)); - } - } - - unblock() { - this.el.nativeElement.appendChild(this.mask.nativeElement); - } - - ngOnDestroy() { - this.unblock(); - } -} - -@NgModule({ - imports: [CommonModule], - exports: [BlockUI], - declarations: [BlockUI] -}) -export class BlockUIModule { } \ No newline at end of file diff --git a/dashboard/src/app/components/breadcrumb/breadcrumb.css b/dashboard/src/app/components/breadcrumb/breadcrumb.css deleted file mode 100644 index ed4a7785a..000000000 --- a/dashboard/src/app/components/breadcrumb/breadcrumb.css +++ /dev/null @@ -1,21 +0,0 @@ -/** Breadcrumb **/ - -.ui-breadcrumb { - margin: 0; - padding: 0; - padding: .3em; -} - -.ui-breadcrumb ul { - margin: 0; - padding: 0; -} - -.ui-breadcrumb ul li { - display: inline-block; - vertical-align: middle; -} - -.ui-breadcrumb ul li .ui-menuitem-link { - text-decoration: none; -} \ No newline at end of file diff --git a/dashboard/src/app/components/breadcrumb/breadcrumb.spec.ts b/dashboard/src/app/components/breadcrumb/breadcrumb.spec.ts deleted file mode 100644 index fe715566f..000000000 --- a/dashboard/src/app/components/breadcrumb/breadcrumb.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { Breadcrumb } from './breadcrumb'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('Breadcrumb', () => { - - let breadcrumb: Breadcrumb; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - Breadcrumb - ] - }); - - fixture = TestBed.createComponent(Breadcrumb); - breadcrumb = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/breadcrumb/breadcrumb.ts b/dashboard/src/app/components/breadcrumb/breadcrumb.ts deleted file mode 100644 index d6d973778..000000000 --- a/dashboard/src/app/components/breadcrumb/breadcrumb.ts +++ /dev/null @@ -1,80 +0,0 @@ -import {NgModule,Component,Input} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {MenuItem} from '../common/menuitem'; -import {Location} from '@angular/common'; -import {RouterModule} from '@angular/router'; - -@Component({ - selector: 'p-breadcrumb', - template: ` - - ` -}) -export class Breadcrumb { - - @Input() model: MenuItem[]; - - @Input() style: any; - - @Input() styleClass: string; - - @Input() home: MenuItem; - - itemClick(event, item: MenuItem) { - if(item.disabled) { - event.preventDefault(); - return; - } - - if(!item.url) { - event.preventDefault(); - } - - if(item.command) { - item.command({ - originalEvent: event, - item: item - }); - } - } - - onHomeClick(event) { - if(this.home) { - this.itemClick(event, this.home); - } - } -} - -@NgModule({ - imports: [CommonModule,RouterModule], - exports: [Breadcrumb,RouterModule], - declarations: [Breadcrumb] -}) -export class BreadcrumbModule { } diff --git a/dashboard/src/app/components/button/button.scss b/dashboard/src/app/components/button/button.scss deleted file mode 100644 index 129671202..000000000 --- a/dashboard/src/app/components/button/button.scss +++ /dev/null @@ -1,324 +0,0 @@ -/* Button */ - -.ui-button { - display: inline-block; - position: relative; - padding: 0 0.25rem; - margin-right: .1rem; - text-decoration: none !important; - cursor: pointer; - text-align: center; - min-width: 1.00rem; - zoom: 1; - overflow: visible; - /* the overflow property removes extra width in IE */ - &:enabled:hover { - box-shadow: 0px 4px 8px #e3e3e3; - border-color: map-get($widget-border, normal); - } - &.ui-button-icon-only { - margin-right: 0; - padding: 0 0.05rem; - border: none; - background: none; - &:hover, - &:active { - border: none; - background: none; - box-shadow: none; - color: map-get($map: $color-primary, $key: hover); - } - &:active { - color: map-get($map: $color-primary, $key: active); - } - } - &.ui-button-large { - padding: 0 0.40rem; - .ui-button-text { - line-height: 0.38rem; - } - } -} - -.ui-button-icon-only { - min-width: 0; -} - -p-button { - display: inline-block; -} - - -/*button text element */ - -.ui-button .ui-button-text { - display: block; - line-height: 0.30rem; -} - -.ui-button-text-only .ui-button-text { - padding: 0; -} - -.ui-button-icon-only .ui-button-text, -.ui-button-text-empty .ui-button-text { - text-indent: -9999999px; - overflow: hidden; -} - -.ui-button-text-icon-left { - padding: 0 0.2rem 0 0.40rem; -} - -.ui-button-text-icon-right { - padding: 0 0.40rem 0 0.2rem; -} - - -/*button icon element(s) */ - -.ui-button-icon-only .fa, -.ui-button-text-icon-left .fa, -.ui-button-text-icon-right .fa { - position: absolute; - top: 50%; - margin-top: -0.08rem; - height: 0.16rem; -} - -.ui-button-icon-only .fa { - top: 50%; - left: 50%; - margin-top: -0.08rem; - margin-left: -0.08rem; - width: 0.16rem; - height: 0.16rem; -} - -.ui-button-icon-left { - left: -0.40rem; -} - -.ui-button-icon-right { - right: -0.40rem; -} - - -/*button sets*/ - -.ui-buttonset .ui-button { - margin-left: 0; - margin-right: 0; -} - - -/* workarounds */ - -button.ui-button::-moz-focus-inner { - border: 0; - padding: 0; - /* reset extra padding in Firefox */ -} - - -/** Fluid **/ - -.ui-fluid .ui-button { - width: 100%; -} - -.ui-fluid .ui-button-text-icon-left .ui-button-text, -.ui-fluid .ui-button-text-icon-right .ui-button-text { - padding-left: 0.1rem; - padding-right: 0.1rem; -} - - -/** ButtonSet **/ - -.ui-fluid .ui-buttonset { - width: 100%; -} - -.ui-fluid .ui-buttonset.ui-buttonset-1 .ui-button { - width: 100%; -} - -.ui-fluid .ui-buttonset.ui-buttonset-2 .ui-button { - width: 50%; -} - -.ui-fluid .ui-buttonset.ui-buttonset-3 .ui-button { - width: 33.3%; -} - -.ui-fluid .ui-buttonset.ui-buttonset-4 .ui-button { - width: 25%; -} - -.ui-fluid .ui-buttonset.ui-buttonset-5 .ui-button { - width: 20%; -} - -.ui-fluid .ui-buttonset.ui-buttonset-6 .ui-button { - width: 16.6%; -} - -@media (max-width: 640px) { - .ui-fluid .ui-buttonset.ui-buttonset-1 .ui-button, - .ui-fluid .ui-buttonset.ui-buttonset-2 .ui-button, - .ui-fluid .ui-buttonset.ui-buttonset-3 .ui-button, - .ui-fluid .ui-buttonset.ui-buttonset-4 .ui-button, - .ui-fluid .ui-buttonset.ui-buttonset-5 .ui-button, - .ui-fluid .ui-buttonset.ui-buttonset-6 .ui-button { - width: 100%; - } -} - - -/* Severity Buttons */ - - -/* secondary */ - -.ui-button.ui-button-secondary.ui-state-default, -.ui-splitbutton.ui-button-secondary .ui-button.ui-state-default { - background-color: map-get($color-primary, normal); - border-color: map-get($color-primary, normal); - color: #fff; -} - -.ui-button.ui-button-secondary:enabled:hover, -.ui-button.ui-button-secondary:focus, -.ui-splitbutton.ui-button-secondary .ui-button:enabled:hover, -.ui-splitbutton.ui-button-secondary .ui-button:focus { - background-color: map-get($color-primary, hover); - border-color: map-get($color-primary, hover); - color: #fff; - box-shadow: 0px 4px 8px rgba(0, 101, 203, 0.4); -} - -.ui-button.ui-button-secondary:enabled:active, -.ui-splitbutton.ui-button-secondary .ui-button:enabled:active { - background-color: map-get($color-primary, active); - border-color: map-get($color-primary, active); - color: #fff; -} - - -/* Success */ - -.ui-button.ui-button-success.ui-state-default, -.ui-splitbutton.ui-button-success .ui-button.ui-state-default { - background-color: #5cb85c; - border-color: #5cb85c; - color: #ffffff; -} - -.ui-button.ui-button-success:enabled:hover, -.ui-button.ui-button-success:focus, -.ui-splitbutton.ui-button-success .ui-button:enabled:hover, -.ui-splitbutton.ui-button-success .ui-button:focus { - background-color: #4cae4c; - border-color: #5cb85c; -} - -.ui-button.ui-button-success:enabled:active, -.ui-splitbutton.ui-button-success .ui-button:enabled:active { - background-color: #449d44; - border-color: #5cb85c; -} - - -/* Info */ - -.ui-button.ui-button-info.ui-state-default, -.ui-splitbutton.ui-button-info .ui-button.ui-state-default { - background-color: #5bc0de; - border-color: #5bc0de; - color: #ffffff; -} - -.ui-button.ui-button-info:enabled:hover, -.ui-button.ui-button-info:focus, -.ui-splitbutton.ui-button-info .ui-button:enabled:hover, -.ui-splitbutton.ui-button-info .ui-button:focus { - background-color: #46b8da; - border-color: #5bc0de; -} - -.ui-button.ui-button-info:enabled:active, -.ui-splitbutton.ui-button-info .ui-button:enabled:active { - background-color: #31b0d5; - border-color: #5bc0de; -} - - -/* Warning */ - -.ui-button.ui-button-warning.ui-state-default, -.ui-splitbutton.ui-button-warning .ui-button.ui-state-default { - background-color: #FF8833; - border-color: #FF8833; - color: #ffffff; -} - -.ui-button.ui-button-warning:enabled:hover, -.ui-button.ui-button-warning:focus, -.ui-splitbutton.ui-button-warning .ui-button:enabled:hover, -.ui-splitbutton.ui-button-warning .ui-button:focus { - background-color: #FF8833; - border-color: #FF8833; -} -.ui-button.ui-button-warning:enabled:hover, -.ui-splitbutton.ui-button-warning .ui-button:enabled:hover{ - box-shadow: 0px 4px 8px rgba(243, 163, 15, 0.4); -} - -.ui-button.ui-button-warning:enabled:active, -.ui-splitbutton.ui-button-warning .ui-button:enabled:active { - background-color: #FF8833; - border-color: #FF8833; -} - - -/* Danger */ - -.ui-button.ui-button-danger.ui-state-default, -.ui-splitbutton.ui-button-danger .ui-button.ui-state-default { - background-color: #d9534f; - border-color: #d9534f; - color: #ffffff; -} - -.ui-button.ui-button-danger:enabled:hover, -.ui-button.ui-button-danger:focus, -.ui-splitbutton.ui-button-danger .ui-button:enabled:hover, -.ui-splitbutton.ui-button-danger .ui-button:focus { - background-color: #d43f3a; - border-color: #d9534f; -} - -.ui-button.ui-button-danger:enabled:active, -.ui-splitbutton.ui-button-danger .ui-button:enabled:active { - background-color: #c9302c; - border-color: #d9534f; -} - -// custom button style -.ui-button.ui-button-icon-only.close-class { - position: absolute; - top: 0; - right: .25rem; - background-color: #fff; - border: 1px solid #B9C3C8 !important; -} - -.cloud-servie-delete-button-radius { - border-radius: 20px !important; -} - -.week-button { - width: 60px !important; - border-radius: 0 !important; -} \ No newline at end of file diff --git a/dashboard/src/app/components/button/button.spec.ts b/dashboard/src/app/components/button/button.spec.ts deleted file mode 100644 index 77588b5a6..000000000 --- a/dashboard/src/app/components/button/button.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { Button } from './button'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('Button', () => { - - let button: Button; - let fixture: ComponentFixture - ` -}) -export class Button { - - @Input() type: string = 'button'; - - @Input() iconPos: string = 'left'; - - @Input() icon: string; - - @Input() label: string; - - @Input() disabled: boolean; - - @Input() style: any; - - @Input() styleClass: string; - - @Output() onClick: EventEmitter = new EventEmitter(); - - @Output() onFocus: EventEmitter = new EventEmitter(); - - @Output() onBlur: EventEmitter = new EventEmitter(); -} - -@NgModule({ - imports: [CommonModule], - exports: [ButtonDirective,Button], - declarations: [ButtonDirective,Button] -}) -export class ButtonModule { } diff --git a/dashboard/src/app/components/calendar/calendar.css b/dashboard/src/app/components/calendar/calendar.css deleted file mode 100644 index bd1b0db02..000000000 --- a/dashboard/src/app/components/calendar/calendar.css +++ /dev/null @@ -1,236 +0,0 @@ -.ui-calendar { - position: relative; - display: inline-block; -} - -.ui-calendar .ui-calendar-button { - position: absolute; - height: 100%; - border-top-left-radius: 0px; - border-bottom-left-radius: 0px; - width: 2em; - border-left: 0 none; -} - -.ui-calendar .ui-calendar-button:enabled:hover, -.ui-calendar .ui-calendar-button:focus { - border-left: 0 none; -} - -/* Fluid */ -.ui-fluid .ui-calendar { - width: 100%; -} - -.ui-fluid .ui-calendar-button { - width: 2em; -} - -.ui-fluid .ui-datepicker-buttonbar button { - width: auto; -} - -.ui-fluid .ui-calendar.ui-calendar-w-btn .ui-inputtext { - width: calc(100% - 2em); -} - -/* Datepicker */ -.ui-datepicker { - width: 17em; - padding: .2em; - display: none; - position: absolute; -} -.ui-datepicker.ui-datepicker-inline { - display: inline-block; - position: static; -} -.ui-datepicker .ui-datepicker-header { - position: relative; - padding: .2em 0; -} -.ui-datepicker .ui-datepicker-prev, -.ui-datepicker .ui-datepicker-next { - position: absolute; - top: .125em; - width: 1.8em; - height: 1.8em; -} - -.ui-datepicker .ui-datepicker-prev { - left: .125em; -} -.ui-datepicker .ui-datepicker-next { - right: .125em; -} -.ui-datepicker .ui-datepicker-prev span, -.ui-datepicker .ui-datepicker-next span { - display: block; - position: absolute; - left: 50%; - top: 50%; - margin-top: -.5em; -} -.ui-datepicker .ui-datepicker-prev span { - margin-left: -.25em; -} -.ui-datepicker .ui-datepicker-next span { - margin-left: -.125em; -} -.ui-datepicker .ui-datepicker-title { - margin: 0 2.3em; - line-height: 1.8em; - text-align: center; -} -.ui-datepicker .ui-datepicker-title select { - font-size: 1em; - margin: .125em 0; - vertical-align: middle; -} -.ui-datepicker select.ui-datepicker-month { - width: 55%; -} -.ui-datepicker select.ui-datepicker-year { - width: 35%; -} -.ui-datepicker select.ui-datepicker-month { - margin-right: .25em; -} -.ui-datepicker table { - width: 100%; - font-size: .9em; - border-collapse: collapse; - margin: 0 0 .4em; -} -.ui-datepicker th { - padding: .7em .3em; - text-align: center; - font-weight: bold; - border: 0; -} -.ui-datepicker td { - border: 0; - padding: .125em; -} -.ui-datepicker td span, -.ui-datepicker td a { - display: block; - padding: .2em; - text-align: right; - text-decoration: none; -} -.ui-datepicker .ui-datepicker-buttonpane { - background-image: none; - margin: .7em 0 0 0; - padding: 0 .2em; - border-left: 0; - border-right: 0; - border-bottom: 0; -} -.ui-datepicker .ui-datepicker-buttonpane button { - float: right; - margin: .5em .2em .4em; - cursor: pointer; - padding: .2em .6em .3em .6em; - width: auto; - overflow: visible; -} -.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { - float: left; -} - -/* with multiple calendars */ -.ui-datepicker.ui-datepicker-multi { - width: auto; -} -.ui-datepicker-multi .ui-datepicker-group { - float: left; -} -.ui-datepicker-multi .ui-datepicker-group table { - width: 95%; - margin: 0 auto .4em; -} -.ui-datepicker-multi-2 .ui-datepicker-group { - width: 50%; -} -.ui-datepicker-multi-3 .ui-datepicker-group { - width: 33.3%; -} -.ui-datepicker-multi-4 .ui-datepicker-group { - width: 25%; -} -.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header, -.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { - border-left-width: 0; -} -.ui-datepicker-multi .ui-datepicker-buttonpane { - clear: left; -} -.ui-datepicker-row-break { - clear: both; - width: 100%; - font-size: 0; -} - -.ui-datepicker .ui-datepicker-buttonbar { - border-left: 0 none; - border-right: 0 none; - border-bottom: 0 none; - padding: .2em; -} - -.ui-datepicker .ui-datepicker-buttonbar > .ui-g > div:last-child { - text-align: right; -} - -.ui-datepicker .ui-datepicker-buttonbar > .ui-g > div { - padding: 0; -} - -.ui-calendar.ui-calendar-w-btn input { - -moz-border-radius-topright: 0px; - -webkit-border-top-right-radius: 0px; - -khtml-border-top-right-radius: 0px; - border-top-right-radius: 0px; - -moz-border-radius-bottomright: 0px; - -webkit-border-bottom-right-radius: 0px; - -khtml-border-bottom-right-radius: 0px; - border-bottom-right-radius: 0px; -} - -.ui-timepicker { - text-align: center; - padding: .5em 0; -} - -.ui-timepicker > div { - display: inline-block; - margin-left: .5em; - min-width: 1.5em; -} - -.ui-timepicker > .ui-minute-picker, -.ui-timepicker > .ui-second-picker { - margin-left: 0; -} - -.ui-timepicker > .ui-separator { - margin-left: 0px; - min-width: .75em; -} - -.ui-timepicker > .ui-separator a { - visibility: hidden; -} - -.ui-timepicker > div a { - display: block; - opacity: 0.7; - filter:Alpha(Opacity=70); -} - -.ui-timepicker > div a:hover { - display: block; - opacity: 1; - filter:Alpha(Opacity=100); -} \ No newline at end of file diff --git a/dashboard/src/app/components/calendar/calendar.spec.ts b/dashboard/src/app/components/calendar/calendar.spec.ts deleted file mode 100644 index 68445f8de..000000000 --- a/dashboard/src/app/components/calendar/calendar.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { Calendar } from './calendar'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('Calendar', () => { - - let calendar: Calendar; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - Calendar - ] - }); - - fixture = TestBed.createComponent(Calendar); - calendar = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/calendar/calendar.ts b/dashboard/src/app/components/calendar/calendar.ts deleted file mode 100644 index ff2fcb40b..000000000 --- a/dashboard/src/app/components/calendar/calendar.ts +++ /dev/null @@ -1,1777 +0,0 @@ -import {NgModule,Component,ElementRef,AfterViewInit,AfterViewChecked,OnDestroy,OnInit,Input,Output,SimpleChange,EventEmitter,forwardRef,Renderer2, - ViewChild,ChangeDetectorRef,TemplateRef,ContentChildren,QueryList} from '@angular/core'; -import {trigger,state,style,transition,animate} from '@angular/animations'; -import {CommonModule} from '@angular/common'; -import {ButtonModule} from '../button/button'; -import {DomHandler} from '../dom/domhandler'; -import {SharedModule,PrimeTemplate} from '../common/shared'; -import {NG_VALUE_ACCESSOR, ControlValueAccessor} from '@angular/forms'; - -export const CALENDAR_VALUE_ACCESSOR: any = { - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => Calendar), - multi: true -}; - -export interface LocaleSettings { - firstDayOfWeek?: number; - dayNames: string[]; - dayNamesShort: string[]; - dayNamesMin: string[]; - monthNames: string[]; - monthNamesShort: string[]; - today: string, - clear: string -} - -@Component({ - selector: 'p-calendar', - template: ` - - - - -
- -
- - - - - - - -
- {{locale.monthNames[currentMonth]}} - - - {{currentYear}} -
-
- - - - - - - - - - - -
- {{weekDay}} -
- - {{date.day}} - - -
-
-
- - - - 0{{currentHour}} - - - -
-
- - - - : - - - -
-
- - - - 0{{currentMinute}} - - - -
-
- - - - : - - - -
-
- - - - 0{{currentSecond}} - - - -
-
- - - - {{pm ? 'PM' : 'AM'}} - - - -
-
-
-
-
- -
-
- -
-
-
- -
-
- `, - animations: [ - trigger('overlayState', [ - state('hidden', style({ - opacity: 0 - })), - state('visible', style({ - opacity: 1 - })), - transition('visible => hidden', animate('400ms ease-in')), - transition('hidden => visible', animate('400ms ease-out')) - ]) - ], - host: { - '[class.ui-inputwrapper-filled]': 'filled', - '[class.ui-inputwrapper-focus]': 'focus' - }, - providers: [DomHandler,CALENDAR_VALUE_ACCESSOR] -}) -export class Calendar implements AfterViewInit,AfterViewChecked,OnInit,OnDestroy,ControlValueAccessor { - - @Input() defaultDate: Date; - - @Input() style: string; - - @Input() styleClass: string; - - @Input() inputStyle: string; - - @Input() inputId: string; - - @Input() name: string; - - @Input() inputStyleClass: string; - - @Input() placeholder: string; - - @Input() disabled: any; - - @Input() dateFormat: string = 'mm/dd/yy'; - - @Input() inline: boolean = false; - - @Input() showOtherMonths: boolean = true; - - @Input() selectOtherMonths: boolean; - - @Input() showIcon: boolean; - - @Input() icon: string = 'fa-calendar'; - - @Input() appendTo: any; - - @Input() readonlyInput: boolean; - - @Input() shortYearCutoff: any = '+10'; - - @Input() monthNavigator: boolean; - - @Input() yearNavigator: boolean; - - @Input() yearRange: string; - - @Input() hourFormat: string = '24'; - - @Input() timeOnly: boolean; - - @Input() stepHour: number = 1; - - @Input() stepMinute: number = 1; - - @Input() stepSecond: number = 1; - - @Input() showSeconds: boolean = false; - - @Input() required: boolean; - - @Input() showOnFocus: boolean = true; - - @Input() dataType: string = 'date'; - - @Input() utc: boolean; - - @Input() selectionMode: string = 'single'; - - @Input() maxDateCount: number; - - @Input() showButtonBar: boolean; - - @Input() todayButtonStyleClass: string = 'ui-button-secondary'; - - @Input() clearButtonStyleClass: string = 'ui-button-secondary'; - - @Input() autoZIndex: boolean = true; - - @Input() baseZIndex: number = 0; - - @Input() panelStyleClass: string; - - @Input() keepInvalid: boolean = false; - - @Output() onFocus: EventEmitter = new EventEmitter(); - - @Output() onBlur: EventEmitter = new EventEmitter(); - - @Output() onClose: EventEmitter = new EventEmitter(); - - @Output() onSelect: EventEmitter = new EventEmitter(); - - @Output() onInput: EventEmitter = new EventEmitter(); - - @Output() onTodayClick: EventEmitter = new EventEmitter(); - - @Output() onClearClick: EventEmitter = new EventEmitter(); - - @Output() onMonthChange: EventEmitter = new EventEmitter(); - - @Output() onYearChange: EventEmitter = new EventEmitter(); - - @ContentChildren(PrimeTemplate) templates: QueryList; - - _locale: LocaleSettings = { - firstDayOfWeek: 0, - dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], - dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], - dayNamesMin: ["Su","Mo","Tu","We","Th","Fr","Sa"], - monthNames: [ "January","February","March","April","May","June","July","August","September","October","November","December" ], - monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun","Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ], - today: 'Today', - clear: 'Clear' - }; - - @Input() tabindex: number; - - @ViewChild('datepicker') overlayViewChild: ElementRef; - - @ViewChild('inputfield') inputfieldViewChild: ElementRef; - - value: any; - - dates: any[]; - - weekDays: string[]; - - currentMonthText: string; - - currentMonth: number; - - currentYear: number; - - currentHour: number; - - currentMinute: number; - - currentSecond: number; - - pm: boolean; - - overlay: HTMLDivElement; - - overlayVisible: boolean; - - overlayShown: boolean; - - datepickerClick: boolean; - - onModelChange: Function = () => {}; - - onModelTouched: Function = () => {}; - - calendarElement: any; - - documentClickListener: any; - - ticksTo1970: number; - - yearOptions: number[]; - - focus: boolean; - - isKeydown: boolean; - - filled: boolean; - - inputFieldValue: string = null; - - _minDate: Date; - - _maxDate: Date; - - _showTime: boolean; - - preventDocumentListener: boolean; - - dateTemplate: TemplateRef; - - _disabledDates: Array; - - _disabledDays: Array; - - @Input() get minDate(): Date { - return this._minDate; - } - - set minDate(date: Date) { - this._minDate = date; - - if(this.currentMonth != undefined && this.currentMonth != null && this.currentYear) { - this.createMonth(this.currentMonth, this.currentYear); - } - } - - @Input() get maxDate(): Date { - return this._maxDate; - } - - set maxDate(date: Date) { - this._maxDate = date; - - if(this.currentMonth != undefined && this.currentMonth != null && this.currentYear) { - this.createMonth(this.currentMonth, this.currentYear); - } - } - - @Input() get disabledDates(): Date[] { - return this._disabledDates; - } - - set disabledDates(disabledDates: Date[]) { - this._disabledDates = disabledDates; - if(this.currentMonth != undefined && this.currentMonth != null && this.currentYear) { - - this.createMonth(this.currentMonth, this.currentYear); - } - } - - @Input() get disabledDays(): number[] { - return this._disabledDays; - } - - set disabledDays(disabledDays: number[]) { - this._disabledDays = disabledDays; - - if(this.currentMonth != undefined && this.currentMonth != null && this.currentYear) { - this.createMonth(this.currentMonth, this.currentYear); - } - } - - @Input() get showTime(): boolean { - return this._showTime; - } - - set showTime(showTime: boolean) { - this._showTime = showTime; - - if(this.currentHour === undefined) { - this.initTime(this.value||new Date()); - } - this.updateInputfield(); - } - - get locale() { - return this._locale; - } - - @Input() - set locale(newLocale: LocaleSettings) { - this._locale = newLocale; - this.createWeekDays(); - this.createMonth(this.currentMonth, this.currentYear); - } - - constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer2, public cd: ChangeDetectorRef) {} - - ngOnInit() { - let date = this.defaultDate||new Date(); - this.createWeekDays(); - - this.currentMonth = date.getMonth(); - this.currentYear = date.getFullYear(); - this.initTime(date); - - this.createMonth(this.currentMonth, this.currentYear); - - this.ticksTo1970 = (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) + - Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000); - - if(this.yearNavigator && this.yearRange) { - this.yearOptions = []; - let years = this.yearRange.split(':'), - yearStart = parseInt(years[0]), - yearEnd = parseInt(years[1]); - - for(let i = yearStart; i <= yearEnd; i++) { - this.yearOptions.push(i); - } - } - } - - ngAfterViewInit() { - if(!this.inline && this.appendTo) { - if(this.appendTo === 'body') - document.body.appendChild(this.overlayViewChild.nativeElement); - else - this.domHandler.appendChild(this.overlayViewChild.nativeElement, this.appendTo); - } - } - - ngAfterViewChecked() { - if(this.overlayShown) { - this.alignOverlay(); - this.overlayShown = false; - } - } - - ngAfterContentInit() { - this.templates.forEach((item) => { - switch(item.getType()) { - case 'date': - this.dateTemplate = item.template; - break; - - default: - this.dateTemplate = item.template; - break; - } - }); - } - - createWeekDays() { - this.weekDays = []; - let dayIndex = this.locale.firstDayOfWeek; - for(let i = 0; i < 7; i++) { - this.weekDays.push(this.locale.dayNamesMin[dayIndex]); - dayIndex = (dayIndex == 6) ? 0 : ++dayIndex; - } - } - - createMonth(month: number, year: number) { - this.dates = []; - this.currentMonth = month; - this.currentYear = year; - this.currentMonthText = this.locale.monthNames[month]; - let firstDay = this.getFirstDayOfMonthIndex(month, year); - let daysLength = this.getDaysCountInMonth(month, year); - let prevMonthDaysLength = this.getDaysCountInPrevMonth(month, year); - let sundayIndex = this.getSundayIndex(); - let dayNo = 1; - let today = new Date(); - - for(let i = 0; i < 6; i++) { - let week = []; - - if(i == 0) { - for(let j = (prevMonthDaysLength - firstDay + 1); j <= prevMonthDaysLength; j++) { - let prev = this.getPreviousMonthAndYear(month, year); - week.push({day: j, month: prev.month, year: prev.year, otherMonth: true, - today: this.isToday(today, j, prev.month, prev.year), selectable: this.isSelectable(j, prev.month, prev.year)}); - } - - let remainingDaysLength = 7 - week.length; - for(let j = 0; j < remainingDaysLength; j++) { - week.push({day: dayNo, month: month, year: year, today: this.isToday(today, dayNo, month, year), - selectable: this.isSelectable(dayNo, month, year)}); - dayNo++; - } - } - else { - for (let j = 0; j < 7; j++) { - if(dayNo > daysLength) { - let next = this.getNextMonthAndYear(month, year); - week.push({day: dayNo - daysLength, month: next.month, year: next.year, otherMonth:true, - today: this.isToday(today, dayNo - daysLength, next.month, next.year), - selectable: this.isSelectable((dayNo - daysLength), next.month, next.year)}); - } - else { - week.push({day: dayNo, month: month, year: year, today: this.isToday(today, dayNo, month, year), - selectable: this.isSelectable(dayNo, month, year)}); - } - - dayNo++; - } - } - - this.dates.push(week); - } - } - - initTime(date: Date) { - this.pm = (!this.utc) ? (date.getHours() > 11) : (date.getUTCHours() > 11); - if (this.showTime) { - if (this.utc) { - this.currentMinute = date.getUTCMinutes(); - this.currentSecond = date.getUTCSeconds(); - - if(this.hourFormat == '12') - this.currentHour = date.getUTCHours() == 0 ? 12 : date.getUTCHours() % 12; - else - this.currentHour = date.getUTCHours(); - } - else { - this.currentMinute = date.getMinutes(); - this.currentSecond = date.getSeconds(); - - if(this.hourFormat == '12') - this.currentHour = date.getHours() == 0 ? 12 : date.getHours() % 12; - else - this.currentHour = date.getHours(); - } - } - else if(this.timeOnly) { - this.currentMinute = 0; - this.currentHour = 0; - this.currentSecond = 0; - } - } - - prevMonth(event) { - if(this.disabled) { - event.preventDefault(); - return; - } - - if(this.currentMonth === 0) { - this.currentMonth = 11; - this.currentYear--; - - if(this.yearNavigator && this.currentYear < this.yearOptions[0]) { - this.currentYear = this.yearOptions[this.yearOptions.length - 1]; - } - } - else { - this.currentMonth--; - } - - this.onMonthChange.emit({ month: this.currentMonth + 1, year: this.currentYear }); - this.createMonth(this.currentMonth, this.currentYear); - event.preventDefault(); - } - - nextMonth(event) { - if(this.disabled) { - event.preventDefault(); - return; - } - - if(this.currentMonth === 11) { - this.currentMonth = 0; - this.currentYear++; - - if(this.yearNavigator && this.currentYear > this.yearOptions[this.yearOptions.length - 1]) { - this.currentYear = this.yearOptions[0]; - } - } - else { - this.currentMonth++; - } - - this.onMonthChange.emit({ month: this.currentMonth + 1, year: this.currentYear }); - this.createMonth(this.currentMonth, this.currentYear); - event.preventDefault(); - } - - onDateSelect(event, dateMeta) { - if(this.disabled || !dateMeta.selectable) { - event.preventDefault(); - return; - } - - if(this.isMultipleSelection() && this.isSelected(dateMeta)) { - this.value = this.value.filter((date, i) => { - return !this.isDateEquals(date, dateMeta); - }); - this.updateModel(this.value); - } - else { - if(this.shouldSelectDate(dateMeta)) { - if(dateMeta.otherMonth) { - if(this.selectOtherMonths) { - this.currentMonth = dateMeta.month; - this.currentYear = dateMeta.year; - this.createMonth(this.currentMonth, this.currentYear); - this.selectDate(dateMeta); - } - } - else { - this.selectDate(dateMeta); - } - } - } - - if(!this.showTime && this.isSingleSelection()) { - this.overlayVisible = false; - } - - this.updateInputfield(); - event.preventDefault(); - } - - shouldSelectDate(dateMeta) { - if(this.isMultipleSelection()) - return !this.maxDateCount || !this.value || this.maxDateCount > this.value.length; - else - return true; - } - - updateInputfield() { - let formattedValue = ''; - - if(this.value) { - if(this.isSingleSelection()) { - formattedValue = this.formatDateTime(this.value); - } - else if(this.isMultipleSelection()) { - for(let i = 0; i < this.value.length; i++) { - let dateAsString = this.formatDateTime(this.value[i]); - formattedValue += dateAsString; - if(i !== (this.value.length - 1)) { - formattedValue += ', '; - } - } - } - else if(this.isRangeSelection()) { - if(this.value && this.value.length) { - let startDate = this.value[0]; - let endDate = this.value[1]; - - formattedValue = this.formatDateTime(startDate); - if(endDate) { - formattedValue += ' - ' + this.formatDateTime(endDate); - } - } - } - } - - this.inputFieldValue = formattedValue; - this.updateFilledState(); - if(this.inputfieldViewChild && this.inputfieldViewChild.nativeElement) { - this.inputfieldViewChild.nativeElement.value = this.inputFieldValue; - } - } - - formatDateTime(date) { - let formattedValue = null; - if(date) { - if(this.timeOnly) { - formattedValue = this.formatTime(date); - } - else { - formattedValue = this.formatDate(date, this.dateFormat); - if(this.showTime) { - formattedValue += ' ' + this.formatTime(date); - } - } - } - - return formattedValue; - } - - selectDate(dateMeta) { - let date; - if(this.utc) - date = new Date(Date.UTC(dateMeta.year, dateMeta.month, dateMeta.day)); - else - date = new Date(dateMeta.year, dateMeta.month, dateMeta.day); - - if(this.showTime) { - if(this.utc) { - if(this.hourFormat === '12' && this.pm && this.currentHour != 12) - date.setUTCHours(this.currentHour + 12); - else - date.setUTCHours(this.currentHour); - - date.setUTCMinutes(this.currentMinute); - date.setUTCSeconds(this.currentSecond); - } - else { - if(this.hourFormat === '12' && this.pm && this.currentHour != 12) - date.setHours(this.currentHour + 12); - else - date.setHours(this.currentHour); - - date.setMinutes(this.currentMinute); - date.setSeconds(this.currentSecond); - } - } - - if(this.minDate && this.minDate > date) { - date = this.minDate; - } - - if(this.maxDate && this.maxDate < date) { - date = this.maxDate; - } - - if(this.isSingleSelection()) { - this.updateModel(date); - } - else if(this.isMultipleSelection()) { - this.updateModel(this.value ? [...this.value, date] : [date]); - } - else if(this.isRangeSelection()) { - if(this.value && this.value.length) { - let startDate = this.value[0]; - let endDate = this.value[1]; - - if(!endDate && date.getTime() >= startDate.getTime()) { - endDate = date; - } - else { - startDate = date; - endDate = null; - } - - this.updateModel([startDate, endDate]); - } - else { - this.updateModel([date, null]); - } - } - - this.onSelect.emit(date); - } - - updateModel(value) { - this.value = value; - - if(this.dataType == 'date') - this.onModelChange(this.value); - else if(this.dataType == 'string') - this.onModelChange(this.formatDateTime(this.value)); - } - - getFirstDayOfMonthIndex(month: number, year: number) { - let day = new Date(); - day.setDate(1); - day.setMonth(month); - day.setFullYear(year); - - let dayIndex = day.getDay() + this.getSundayIndex(); - return dayIndex >= 7 ? dayIndex - 7 : dayIndex; - } - - getDaysCountInMonth(month: number, year: number) { - return 32 - this.daylightSavingAdjust(new Date(year, month, 32)).getDate(); - } - - getDaysCountInPrevMonth(month: number, year: number) { - let prev = this.getPreviousMonthAndYear(month, year); - return this.getDaysCountInMonth(prev.month, prev.year); - } - - getPreviousMonthAndYear(month: number, year: number) { - let m, y; - - if(month === 0) { - m = 11; - y = year - 1; - } - else { - m = month - 1; - y = year; - } - - return {'month':m,'year':y}; - } - - getNextMonthAndYear(month: number, year: number) { - let m, y; - - if(month === 11) { - m = 0; - y = year + 1; - } - else { - m = month + 1; - y = year; - } - - return {'month':m,'year':y}; - } - - getSundayIndex() { - return this.locale.firstDayOfWeek > 0 ? 7 - this.locale.firstDayOfWeek : 0; - } - - isSelected(dateMeta): boolean { - if(this.value) { - if(this.isSingleSelection()) { - return this.isDateEquals(this.value, dateMeta); - } - else if(this.isMultipleSelection()) { - let selected = false; - for(let date of this.value) { - selected = this.isDateEquals(date, dateMeta); - if(selected) { - break; - } - } - - return selected; - } - else if(this.isRangeSelection()) { - if(this.value[1]) - return this.isDateEquals(this.value[0], dateMeta) || this.isDateEquals(this.value[1], dateMeta) || this.isDateBetween(this.value[0], this.value[1], dateMeta); - else - return this.isDateEquals(this.value[0], dateMeta) - } - } - else - return false; - } - - isDateEquals(value, dateMeta) { - if(value) - return value.getDate() === dateMeta.day && value.getMonth() === dateMeta.month && value.getFullYear() === dateMeta.year; - else - return false; - } - - isDateBetween(start, end, dateMeta) { - let between : boolean = false; - if(start && end) { - let date: Date = new Date(dateMeta.year, dateMeta.month, dateMeta.day); - return start.getTime() <= date.getTime() && end.getTime() >= date.getTime(); - } - - return between; - } - - isSingleSelection(): boolean { - return this.selectionMode === 'single'; - } - - isRangeSelection(): boolean { - return this.selectionMode === 'range'; - } - - isMultipleSelection(): boolean { - return this.selectionMode === 'multiple'; - } - - isToday(today, day, month, year): boolean { - return today.getDate() === day && today.getMonth() === month && today.getFullYear() === year; - } - - isSelectable(day, month, year): boolean { - let validMin = true; - let validMax = true; - let validDate = true; - let validDay = true; - - if(this.minDate) { - if(this.minDate.getFullYear() > year) { - validMin = false; - } - else if(this.minDate.getFullYear() === year) { - if(this.minDate.getMonth() > month) { - validMin = false; - } - else if(this.minDate.getMonth() === month) { - if(this.minDate.getDate() > day) { - validMin = false; - } - } - } - } - - if(this.maxDate) { - if(this.maxDate.getFullYear() < year) { - validMax = false; - } - else if(this.maxDate.getFullYear() === year) { - if(this.maxDate.getMonth() < month) { - validMax = false; - } - else if(this.maxDate.getMonth() === month) { - if(this.maxDate.getDate() < day) { - validMax = false; - } - } - } - } - - if(this.disabledDates) { - validDate = !this.isDateDisabled(day,month,year); - } - - if(this.disabledDays) { - validDay = !this.isDayDisabled(day,month,year) - } - - return validMin && validMax && validDate && validDay; - } - - isDateDisabled(day:number, month:number, year:number):boolean { - if(this.disabledDates) { - for(let disabledDate of this.disabledDates) { - if(disabledDate.getFullYear() === year && disabledDate.getMonth() === month && disabledDate.getDate() === day) { - return true; - } - } - } - - return false; - } - - isDayDisabled(day:number, month:number, year:number):boolean { - if(this.disabledDays) { - let weekday = new Date(year, month, day); - let weekdayNumber = weekday.getDay(); - return this.disabledDays.indexOf(weekdayNumber) !== -1; - } - return false; - } - - onInputFocus(event: Event) { - this.focus = true; - if(this.showOnFocus) { - this.showOverlay(); - } - this.onFocus.emit(event); - } - - onInputClick(event: Event) { - this.datepickerClick=true; - if(this.autoZIndex) { - this.overlayViewChild.nativeElement.style.zIndex = String(this.baseZIndex + (++DomHandler.zindex)); - } - } - - onInputBlur(event: Event) { - this.focus = false; - this.onBlur.emit(event); - if(!this.keepInvalid) { - this.updateInputfield(); - } - this.onModelTouched(); - } - - onButtonClick(event,inputfield) { - if(!this.overlayViewChild.nativeElement.offsetParent || this.overlayViewChild.nativeElement.style.display === 'none') { - inputfield.focus(); - this.showOverlay(); - } - else - this.overlayVisible = false; - - this.datepickerClick = true; - } - - onInputKeydown(event) { - this.isKeydown = true; - if(event.keyCode === 9) { - this.overlayVisible = false; - } - } - - onMonthDropdownChange(m: string) { - this.currentMonth = parseInt(m); - this.onMonthChange.emit({ month: this.currentMonth + 1, year: this.currentYear }); - this.createMonth(this.currentMonth, this.currentYear); - } - - onYearDropdownChange(y: string) { - this.currentYear = parseInt(y); - this.onYearChange.emit({ month: this.currentMonth + 1, year: this.currentYear }); - this.createMonth(this.currentMonth, this.currentYear); - } - - incrementHour(event) { - const prevHour = this.currentHour; - const newHour = this.currentHour + this.stepHour; - - if(this.validateHour(newHour)) { - if(this.hourFormat == '24') - this.currentHour = (newHour >= 24) ? (newHour - 24) : newHour; - else if(this.hourFormat == '12') { - // Before the AM/PM break, now after - if (prevHour < 12 && newHour > 11) { - this.pm = !this.pm; - } - - this.currentHour = (newHour >= 13) ? (newHour - 12) : newHour; - } - - this.updateTime(); - } - - event.preventDefault(); - } - - decrementHour(event) { - const newHour = this.currentHour - this.stepHour; - - if(this.validateHour(newHour)) { - if(this.hourFormat == '24') - this.currentHour = (newHour < 0) ? (24 + newHour) : newHour; - else if(this.hourFormat == '12') { - // If we were at noon/midnight, then switch - if (this.currentHour === 12) { - this.pm = !this.pm; - } - this.currentHour = (newHour <= 0) ? (12 + newHour) : newHour; - } - - this.updateTime(); - } - - event.preventDefault(); - } - - validateHour(hour): boolean { - let valid: boolean = true; - let value = this.value; - if(this.isRangeSelection()) { - value = this.value[1] || this.value[0]; - } - if(this.isMultipleSelection()) { - value = this.value[this.value.length - 1]; - } - let valueDateString = value ? value.toDateString() : null; - - if(this.minDate && valueDateString && this.minDate.toDateString() === valueDateString) { - if(this.minDate.getHours() > hour) { - valid = false; - } - } - - if(this.maxDate && valueDateString && this.maxDate.toDateString() === valueDateString) { - if(this.maxDate.getHours() < hour) { - valid = false; - } - } - - return valid; - } - - incrementMinute(event) { - let newMinute = this.currentMinute + this.stepMinute; - if(this.validateMinute(newMinute)) { - this.currentMinute = (newMinute > 59) ? newMinute - 60 : newMinute; - this.updateTime(); - } - - event.preventDefault(); - } - - decrementMinute(event) { - let newMinute = this.currentMinute - this.stepMinute; - if(this.validateMinute(newMinute)) { - this.currentMinute = (newMinute < 0) ? 60 + newMinute : newMinute; - this.updateTime(); - } - - event.preventDefault(); - } - - validateMinute(minute): boolean { - let valid: boolean = true; - let value = this.value; - if(this.isRangeSelection()) { - value = this.value[1] || this.value[0]; - } - if(this.isMultipleSelection()) { - value = this.value[this.value.length - 1]; - } - let valueDateString = value ? value.toDateString() : null; - - if(this.minDate && valueDateString && this.minDate.toDateString() === valueDateString) { - if(this.minDate.getMinutes() > minute) { - valid = false; - } - } - - if(this.maxDate && valueDateString && this.maxDate.toDateString() === valueDateString) { - if(this.maxDate.getMinutes() < minute) { - valid = false; - } - } - - return valid; - } - - incrementSecond(event) { - let newSecond = this.currentSecond + this.stepSecond; - if(this.validateSecond(newSecond)) { - this.currentSecond = (newSecond > 59) ? newSecond - 60 : newSecond; - this.updateTime(); - } - - event.preventDefault(); - } - - decrementSecond(event) { - let newSecond = this.currentSecond - this.stepSecond; - if(this.validateSecond(newSecond)) { - this.currentSecond = (newSecond < 0) ? 60 + newSecond : newSecond; - this.updateTime(); - } - - event.preventDefault(); - } - - validateSecond(second): boolean { - let valid: boolean = true; - let value = this.value; - if(this.isRangeSelection()) { - value = this.value[1] || this.value[0]; - } - if(this.isMultipleSelection()) { - value = this.value[this.value.length - 1]; - } - let valueDateString = value ? value.toDateString() : null; - - if(this.minDate && valueDateString && this.minDate.toDateString() === valueDateString) { - if(this.minDate.getSeconds() > second) { - valid = false; - } - } - - if(this.maxDate && valueDateString && this.maxDate.toDateString() === valueDateString) { - if(this.maxDate.getSeconds() < second) { - valid = false; - } - } - - return valid; - } - - updateTime() { - let value = this.value; - if(this.isRangeSelection()) { - value = this.value[1] || this.value[0]; - } - if(this.isMultipleSelection()) { - value = this.value[this.value.length - 1]; - } - value = value ? new Date(value.getTime()) : new Date(); - - if (this.utc) { - if (this.hourFormat == '12') { - if (this.currentHour === 12) - value.setUTCHours(this.pm ? 12 : 0); - else - value.setUTCHours(this.pm ? this.currentHour + 12 : this.currentHour); - } - else { - value.setUTCHours(this.currentHour); - } - } - else { - if (this.hourFormat == '12') { - if (this.currentHour === 12) - value.setHours(this.pm ? 12 : 0); - else - value.setHours(this.pm ? this.currentHour + 12 : this.currentHour); - } - else { - value.setHours(this.currentHour); - } - } - - value.setMinutes(this.currentMinute); - value.setSeconds(this.currentSecond); - if(this.isRangeSelection()) { - if(this.value[1]) { - value = [this.value[0], value]; - } else { - value = [value, null]; - } - } - if(this.isMultipleSelection()){ - value = [...this.value.slice(0, -1), value]; - } - this.updateModel(value); - this.onSelect.emit(value); - this.updateInputfield(); - } - - toggleAMPM(event) { - this.pm = !this.pm; - this.updateTime(); - event.preventDefault(); - } - - onUserInput(event) { - // IE 11 Workaround for input placeholder : https://github.com/primefaces/primeng/issues/2026 - if(!this.isKeydown) { - return; - } - this.isKeydown = false; - - let val = event.target.value; - try { - let value = this.parseValueFromString(val); - this.updateModel(value); - this.updateUI(); - } - catch(err) { - //invalid date - this.updateModel(null); - } - - this.filled = val != null && val.length; - this.onInput.emit(event); - } - - parseValueFromString(text: string): Date { - if(!text || text.trim().length === 0) { - return null; - } - - let value: any; - - if(this.isSingleSelection()) { - value = this.parseDateTime(text); - } - else if(this.isMultipleSelection()) { - let tokens = text.split(','); - value = []; - for(let token of tokens) { - value.push(this.parseDateTime(token.trim())); - } - } - else if(this.isRangeSelection()) { - let tokens = text.split(' - '); - value = []; - for(let i = 0; i < tokens.length; i++) { - value[i] = this.parseDateTime(tokens[i].trim()); - } - } - - return value; - } - - parseDateTime(text): Date { - let date: Date; - let parts: string[] = text.split(' '); - - if(this.timeOnly) { - date = new Date(); - this.populateTime(date, parts[0], parts[1]); - } - else { - if(this.showTime) { - date = this.parseDate(parts[0], this.dateFormat); - this.populateTime(date, parts[1], parts[2]); - } - else { - date = this.parseDate(text, this.dateFormat); - } - } - - return date; - } - - populateTime(value, timeString, ampm) { - if(this.hourFormat == '12' && !ampm) { - throw 'Invalid Time'; - } - - this.pm = (ampm === 'PM' || ampm === 'pm'); - let time = this.parseTime(timeString); - if (!this.utc) - value.setHours(time.hour); - else - value.setUTCHours(time.hour); - - value.setMinutes(time.minute); - value.setSeconds(time.second); - } - - updateUI() { - let val = this.value||this.defaultDate||new Date(); - - if (Array.isArray(val)){ - val = val[0]; - } - - this.createMonth(val.getMonth(), val.getFullYear()); - - if(this.showTime||this.timeOnly) { - let hours = (this.utc) ? val.getUTCHours : val.getHours(); - - if(this.hourFormat == '12') { - this.pm = hours > 11; - - if(hours >= 12) { - this.currentHour = (hours == 12) ? 12 : hours - 12; - } - else { - this.currentHour = (hours == 0) ? 12 : hours; - } - } - else { - this.currentHour = (this.utc) ? val.getUTCHours() : val.getHours(); - } - - this.currentMinute = val.getMinutes(); - this.currentSecond = val.getSeconds(); - } - } - - onDatePickerClick(event) { - this.datepickerClick = true; - } - - showOverlay() { - this.overlayVisible = true; - this.overlayShown = true; - if(this.autoZIndex) { - this.overlayViewChild.nativeElement.style.zIndex = String(this.baseZIndex + (++DomHandler.zindex)); - } - - this.bindDocumentClickListener(); - } - - alignOverlay() { - if(this.appendTo) - this.domHandler.absolutePosition(this.overlayViewChild.nativeElement, this.inputfieldViewChild.nativeElement); - else - this.domHandler.relativePosition(this.overlayViewChild.nativeElement, this.inputfieldViewChild.nativeElement); - } - - writeValue(value: any) : void { - this.value = value; - if(this.value && typeof this.value === 'string') { - this.value = this.parseValueFromString(this.value); - } - - this.updateInputfield(); - this.updateUI(); - } - - registerOnChange(fn: Function): void { - this.onModelChange = fn; - } - - registerOnTouched(fn: Function): void { - this.onModelTouched = fn; - } - - setDisabledState(val: boolean): void { - this.disabled = val; - } - - // Ported from jquery-ui datepicker formatDate - formatDate(date, format) { - if (!date) { - return ''; - } - - let iFormat; - const lookAhead = (match) => { - const matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); - if (matches) { - iFormat++; - } - return matches; - }, - formatNumber = (match, value, len) => { - let num = '' + value; - if (lookAhead(match)) { - while (num.length < len) { - num = '0' + num; - } - } - return num; - }, - formatName = (match, value, shortNames, longNames) => { - return (lookAhead(match) ? longNames[value] : shortNames[value]); - }; - let output = ''; - let literal = false; - - if (date) { - for (iFormat = 0; iFormat < format.length; iFormat++) { - if (literal) { - if (format.charAt(iFormat) === '\'' && !lookAhead('\'')) { - literal = false; - } else { - output += format.charAt(iFormat); - } - } else { - switch (format.charAt(iFormat)) { - case 'd': - output += formatNumber('d', this.utc ? date.getUTCDate() : date.getDate(), 2); - break; - case 'D': - output += formatName('D', this.utc ? date.getUTCDay() : date.getDay(), this.locale.dayNamesShort, this.locale.dayNames); - break; - case 'o': - if (this.utc) { - output += formatNumber('o', - Math.round(( - new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate()).getTime() - - new Date(date.getUTCFullYear(), 0, 0).getTime()) / 86400000), 3); - } else { - output += formatNumber('o', - Math.round(( - new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3); - } - break; - case 'm': - output += formatNumber('m', (this.utc ? date.getUTCMonth() : date.getMonth()) + 1, 2); - break; - case 'M': - output += formatName('M', this.utc ? date.getUTCMonth() : date.getMonth(), this.locale.monthNamesShort, this.locale.monthNames); - break; - case 'y': - output += (lookAhead('y') ? (this.utc ? date.getUTCFullYear() : date.getFullYear()) : - ((this.utc ? date.getUTCFullYear() : date.getFullYear()) % 100 < 10 ? '0' : '') + - (this.utc ? date.getUTCFullYear() : date.getFullYear()) % 100); - break; - case '@': - output += date.getTime(); - break; - case '!': - output += date.getTime() * 10000 + this.ticksTo1970; - break; - case '\'': - if (lookAhead('\'')) { - output += '\''; - } else { - literal = true; - } - break; - default: - output += format.charAt(iFormat); - } - } - } - } - return output; - } - - formatTime(date) { - if(!date) { - return ''; - } - - let output = ''; - let hours = (this.utc) ? date.getUTCHours() : date.getHours(); - let minutes = date.getMinutes(); - let seconds = date.getSeconds(); - - if(this.hourFormat == '12' && hours > 11 && hours != 12) { - hours-=12; - } - - output += (hours < 10) ? '0' + hours : hours; - output += ':'; - output += (minutes < 10) ? '0' + minutes : minutes; - - if(this.showSeconds) { - output += ':'; - output += (seconds < 10) ? '0' + seconds : seconds; - } - - if(this.hourFormat == '12') { - output += date.getHours() > 11 ? ' PM' : ' AM'; - } - - return output; - } - - parseTime(value) { - let tokens: string[] = value.split(':'); - let validTokenLength = this.showSeconds ? 3 : 2; - - if(tokens.length !== validTokenLength) { - throw "Invalid time"; - } - - let h = parseInt(tokens[0]); - let m = parseInt(tokens[1]); - let s = this.showSeconds ? parseInt(tokens[2]) : null; - - if(isNaN(h) || isNaN(m) || h > 23 || m > 59 || (this.hourFormat == '12' && h > 12) || (this.showSeconds && (isNaN(s) || s > 59))) { - throw "Invalid time"; - } - else { - if(this.hourFormat == '12' && h !== 12 && this.pm) { - h+= 12; - } - - return {hour: h, minute: m, second: s}; - } - } - - // Ported from jquery-ui datepicker parseDate - parseDate(value, format) { - if(format == null || value == null) { - throw "Invalid arguments"; - } - - value = (typeof value === "object" ? value.toString() : value + ""); - if(value === "") { - return null; - } - - let iFormat, dim, extra, - iValue = 0, - shortYearCutoff = (typeof this.shortYearCutoff !== "string" ? this.shortYearCutoff : new Date().getFullYear() % 100 + parseInt(this.shortYearCutoff, 10)), - year = -1, - month = -1, - day = -1, - doy = -1, - literal = false, - date, - lookAhead = (match) => { - let matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); - if(matches) { - iFormat++; - } - return matches; - }, - getNumber = (match) => { - let isDoubled = lookAhead(match), - size = (match === "@" ? 14 : (match === "!" ? 20 : - (match === "y" && isDoubled ? 4 : (match === "o" ? 3 : 2)))), - minSize = (match === "y" ? size : 1), - digits = new RegExp("^\\d{" + minSize + "," + size + "}"), - num = value.substring(iValue).match(digits); - if(!num) { - throw "Missing number at position " + iValue; - } - iValue += num[ 0 ].length; - return parseInt(num[ 0 ], 10); - }, - getName = (match, shortNames, longNames) => { - let index = -1; - let arr = lookAhead(match) ? longNames : shortNames; - let names = []; - - for(let i = 0; i < arr.length; i++) { - names.push([i,arr[i]]); - } - names.sort((a,b) => { - return -(a[ 1 ].length - b[ 1 ].length); - }); - - for(let i = 0; i < names.length; i++) { - let name = names[i][1]; - if(value.substr(iValue, name.length).toLowerCase() === name.toLowerCase()) { - index = names[i][0]; - iValue += name.length; - break; - } - } - - if(index !== -1) { - return index + 1; - } else { - throw "Unknown name at position " + iValue; - } - }, - checkLiteral = () => { - if(value.charAt(iValue) !== format.charAt(iFormat)) { - throw "Unexpected literal at position " + iValue; - } - iValue++; - }; - - for (iFormat = 0; iFormat < format.length; iFormat++) { - if(literal) { - if(format.charAt(iFormat) === "'" && !lookAhead("'")) { - literal = false; - } else { - checkLiteral(); - } - } else { - switch (format.charAt(iFormat)) { - case "d": - day = getNumber("d"); - break; - case "D": - getName("D", this.locale.dayNamesShort, this.locale.dayNames); - break; - case "o": - doy = getNumber("o"); - break; - case "m": - month = getNumber("m"); - break; - case "M": - month = getName("M", this.locale.monthNamesShort, this.locale.monthNames); - break; - case "y": - year = getNumber("y"); - break; - case "@": - date = new Date(getNumber("@")); - year = date.getFullYear(); - month = date.getMonth() + 1; - day = date.getDate(); - break; - case "!": - date = new Date((getNumber("!") - this.ticksTo1970) / 10000); - year = date.getFullYear(); - month = date.getMonth() + 1; - day = date.getDate(); - break; - case "'": - if(lookAhead("'")) { - checkLiteral(); - } else { - literal = true; - } - break; - default: - checkLiteral(); - } - } - } - - if(iValue < value.length) { - extra = value.substr(iValue); - if(!/^\s+/.test(extra)) { - throw "Extra/unparsed characters found in date: " + extra; - } - } - - if(year === -1) { - year = new Date().getFullYear(); - } else if(year < 100) { - year += new Date().getFullYear() - new Date().getFullYear() % 100 + - (year <= shortYearCutoff ? 0 : -100); - } - - if(doy > -1) { - month = 1; - day = doy; - do { - dim = this.getDaysCountInMonth(year, month - 1); - if(day <= dim) { - break; - } - month++; - day -= dim; - } while (true); - } - - if (this.utc) { - date = new Date(Date.UTC(year, month - 1, day)); - if (date.getUTCFullYear() !== year || date.getUTCMonth() + 1 !== month || date.getUTCDate() !== day) { - throw "Invalid date"; // E.g. 31/02/00 - } - } else { - date = this.daylightSavingAdjust(new Date(year, month - 1, day)); - if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day) { - throw "Invalid date"; // E.g. 31/02/00 - } - } - return date; - } - - daylightSavingAdjust(date) { - if(!date) { - return null; - } - - if(!this.utc) { - date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0); - } - - return date; - } - - updateFilledState() { - this.filled = this.inputFieldValue && this.inputFieldValue != ''; - } - - onTodayButtonClick(event) { - let date: Date = new Date(); - let dateMeta = {day: date.getDate(), month: date.getMonth(), year: date.getFullYear(), today: true, selectable: true}; - - this.createMonth(dateMeta.month, dateMeta.year); - this.onDateSelect(event, dateMeta); - this.onTodayClick.emit(event); - } - - onClearButtonClick(event) { - this.updateModel(null); - this.updateInputfield(); - this.overlayVisible = false; - this.onClearClick.emit(event); - } - - bindDocumentClickListener() { - if(!this.documentClickListener) { - this.documentClickListener = this.renderer.listen('document', 'click', (event) => { - if(!this.datepickerClick&&this.overlayVisible) { - this.overlayVisible = false; - this.onClose.emit(event); - } - - this.datepickerClick = false; - this.cd.detectChanges(); - }); - } - } - - unbindDocumentClickListener() { - if(this.documentClickListener) { - this.documentClickListener(); - this.documentClickListener = null; - } - } - - ngOnDestroy() { - this.unbindDocumentClickListener(); - - if(!this.inline && this.appendTo) { - this.el.nativeElement.appendChild(this.overlayViewChild.nativeElement); - } - } -} - -@NgModule({ - imports: [CommonModule,ButtonModule,SharedModule], - exports: [Calendar,ButtonModule,SharedModule], - declarations: [Calendar] -}) -export class CalendarModule { } diff --git a/dashboard/src/app/components/captcha/captcha.spec.ts b/dashboard/src/app/components/captcha/captcha.spec.ts deleted file mode 100644 index b7f89b5cf..000000000 --- a/dashboard/src/app/components/captcha/captcha.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { Captcha } from './captcha'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('Captcha', () => { - - let captcha: Captcha; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - Captcha - ] - }); - - fixture = TestBed.createComponent(Captcha); - captcha = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/captcha/captcha.ts b/dashboard/src/app/components/captcha/captcha.ts deleted file mode 100644 index 004330676..000000000 --- a/dashboard/src/app/components/captcha/captcha.ts +++ /dev/null @@ -1,92 +0,0 @@ -import {NgModule,AfterViewInit,Component,EventEmitter,Input,NgZone,OnDestroy,Output,ElementRef} from '@angular/core'; -import {CommonModule} from '@angular/common'; - -@Component({ - selector: 'p-captcha', - template: `
` -}) -export class Captcha implements AfterViewInit { - - @Input() siteKey: string = null; - - @Input() theme = 'light'; - - @Input() type = 'image'; - - @Input() size = 'normal'; - - @Input() tabindex = 0; - - @Input() language: string = null; - - @Input() initCallback = "initRecaptcha"; - - @Output() onResponse: EventEmitter = new EventEmitter(); - - @Output() onExpire: EventEmitter = new EventEmitter(); - - private _instance: any = null; - - constructor(public el: ElementRef, public _zone: NgZone) {} - - ngAfterViewInit() { - if((window).grecaptcha) { - this.init(); - } - else { - (window)[this.initCallback] = () => { - this.init(); - } - } - } - - init() { - this._instance = (window).grecaptcha.render(this.el.nativeElement.children[0], { - 'sitekey': this.siteKey, - 'theme': this.theme, - 'type': this.type, - 'size': this.size, - 'tabindex': this.tabindex, - 'hl': this.language, - 'callback': (response: string) => {this._zone.run(() => this.recaptchaCallback(response))}, - 'expired-callback': () => {this._zone.run(() => this.recaptchaExpiredCallback())} - }); - } - - reset() { - if(this._instance === null) - return; - - (window).grecaptcha.reset(this._instance); - } - - getResponse(): String { - if (this._instance === null) - return null; - - return (window).grecaptcha.getResponse(this._instance); - } - - recaptchaCallback(response: string) { - this.onResponse.emit({ - response: response - }); - } - - recaptchaExpiredCallback() { - this.onExpire.emit(); - } - - ngOnDestroy() { - if (this._instance != null) { - (window).grecaptcha.reset(this._instance); - } - } -} - -@NgModule({ - imports: [CommonModule], - exports: [Captcha], - declarations: [Captcha] -}) -export class CaptchaModule { } diff --git a/dashboard/src/app/components/card/card.css b/dashboard/src/app/components/card/card.css deleted file mode 100644 index c20fb9c3a..000000000 --- a/dashboard/src/app/components/card/card.css +++ /dev/null @@ -1,50 +0,0 @@ -.ui-card-header img { - width: 100%; -} - -.ui-card-body { - padding: 1em; -} - -.ui-card-title { - font-size: 1.5em; - font-weight: bold; - margin-bottom: .5em; -} - -.ui-card-subtitle { - opacity: .7; - margin-bottom: .5em; - margin-top: -.25em; - font-weight: bold; -} - -.ui-card-content { - line-height: 1.5; -} - -.ui-card-footer { - padding-top: 1em; -} - - -/* .ui-card-shadow { - box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.2), 0 1px 1px 0 rgba(0, 0, 0, 0.14), 0 2px 1px -1px rgba(0, 0, 0, 0.12); - -webkit-box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.2), 0 1px 1px 0 rgba(0, 0, 0, 0.14), 0 2px 1px -1px rgba(0, 0, 0, 0.12); - -moz-box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.2), 0 1px 1px 0 rgba(0, 0, 0, 0.14), 0 2px 1px -1px rgba(0, 0, 0, 0.12); -} */ - -.ui-card-shadow { - box-shadow: 5px 5px 25px rgba(51, 59, 69, 0.149019607843137); - -webkit-box-shadow: 5px 5px 25px rgba(51, 59, 69, 0.149019607843137); - -moz-box-shadow: 5px 5px 25px rgba(51, 59, 69, 0.149019607843137); -} - -.new-card-class { - border: none !important; - border-radius: 12px; - -} -.ui-card-body{ - padding: .15rem .2rem; -} \ No newline at end of file diff --git a/dashboard/src/app/components/card/card.spec.ts b/dashboard/src/app/components/card/card.spec.ts deleted file mode 100644 index 9c5a95b84..000000000 --- a/dashboard/src/app/components/card/card.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { Card } from './card'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('Card', () => { - - let card: Card; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - Card - ] - }); - - fixture = TestBed.createComponent(Card); - card = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/card/card.ts b/dashboard/src/app/components/card/card.ts deleted file mode 100644 index 14e8f4e24..000000000 --- a/dashboard/src/app/components/card/card.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { NgModule, Component, Input, Output, EventEmitter, ElementRef, ContentChild } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { SharedModule, Header, Footer } from '../common/shared'; -import { BlockableUI } from '../common/blockableui'; - -@Component({ - selector: 'p-card', - template: ` -
-
- -
-
-
{{title}}
-
{{subtitle}}
-
- -
- -
-
- ` -}) -export class Card implements BlockableUI { - - @Input() title: string; - - @Input() subtitle: string; - - @Input() style: any; - - @Input() styleClass: string; - - @ContentChild(Header) headerFacet; - - @ContentChild(Footer) footerFacet; - - constructor(private el: ElementRef) { } - - getBlockableElement(): HTMLElement  { - return this.el.nativeElement.children[0]; - } - -} - -@NgModule({ - imports: [CommonModule], - exports: [Card, SharedModule], - declarations: [Card] -}) -export class CardModule { } diff --git a/dashboard/src/app/components/carousel/carousel.css b/dashboard/src/app/components/carousel/carousel.css deleted file mode 100644 index a10453d83..000000000 --- a/dashboard/src/app/components/carousel/carousel.css +++ /dev/null @@ -1,85 +0,0 @@ -.ui-carousel { - position: relative; - padding: .063em; -} - -.ui-carousel .ui-carousel-viewport .ui-carousel-items { - list-style: none outside none; - margin: 0; - padding:0; - position: relative; - width: 32000px; - left: 0; -} - -.ui-carousel .ui-carousel-viewport .ui-carousel-items .ui-carousel-item { - margin: 1px; - padding: 0; - float: left; - box-sizing: border-box; -} - -.ui-carousel .ui-carousel-viewport { - overflow: hidden; - position: relative; - border: 0; -} - -.ui-carousel .ui-carousel-footer { - margin: 1px 1px 0px 1px; - padding: .5em; - overflow: hidden; -} - -.ui-carousel .ui-carousel-header { - margin: 0 1px; - overflow: hidden; - padding: .625em; -} - -.ui-carousel .ui-carousel-header .ui-carousel-header-title { - display: inline-block; - overflow: hidden; -} - -.ui-carousel .ui-carousel-dropdown, -.ui-carousel .ui-carousel-mobiledropdown { - float: right; - margin: 0px .625em; - background-image: none; -} - -.ui-carousel .ui-carousel-dropdown option, -.ui-carousel .ui-carousel-mobiledropdown option{ - background-image: none; - border: 0 none; - box-shadow: none; - -moz-box-shadow: none; - -webkit-box-shadow: none; -} - -.ui-carousel .ui-carousel-button { - float: right; - margin: .125em; -} - -.ui-carousel .ui-carousel-page-link { - float: left; - margin: 0 .125em; - text-decoration: none; -} - -.ui-carousel .ui-carousel-page-link, -.ui-carousel .ui-carousel-button { - cursor: pointer; -} - -.ui-carousel .ui-carousel-page-links { - margin: 0px .5em; - margin-top: .125em; - float: right; -} - -.ui-carousel .ui-carousel-mobiledropdown { - display: none; -} \ No newline at end of file diff --git a/dashboard/src/app/components/carousel/carousel.spec.ts b/dashboard/src/app/components/carousel/carousel.spec.ts deleted file mode 100644 index f51b1ca6d..000000000 --- a/dashboard/src/app/components/carousel/carousel.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { Carousel } from './carousel'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('Carousel', () => { - - let carousel: Carousel; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - Carousel - ] - }); - - fixture = TestBed.createComponent(Carousel); - carousel = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/carousel/carousel.ts b/dashboard/src/app/components/carousel/carousel.ts deleted file mode 100644 index c190a405d..000000000 --- a/dashboard/src/app/components/carousel/carousel.ts +++ /dev/null @@ -1,327 +0,0 @@ -import {NgModule,Component,ElementRef,AfterViewInit,AfterViewChecked,AfterContentInit,EventEmitter,OnDestroy,Input,Output,TemplateRef,ContentChildren,QueryList,Renderer2,ViewChild,ChangeDetectorRef} from '@angular/core'; -import {DomHandler} from '../dom/domhandler'; -import {SharedModule,PrimeTemplate} from '../common/shared'; -import {CommonModule} from '@angular/common'; - -@Component({ - selector: 'p-carousel', - template: ` -
- - -
- `, - providers: [DomHandler] -}) -export class Carousel implements AfterViewChecked,AfterViewInit,OnDestroy{ - - @Input() numVisible: number = 3; - - @Input() firstVisible: number = 0; - - @Input() headerText: string; - - @Input() circular: boolean = false; - - @Input() breakpoint: number = 560; - - @Input() responsive: boolean = true; - - @Input() autoplayInterval: number = 0; - - @Input() effectDuration: any = '1s'; - - @Input() easing: string = 'ease-out'; - - @Input() pageLinks: number = 3; - - @Input() style: any; - - @Input() styleClass: string; - - @Output() onPage: EventEmitter = new EventEmitter(); - - @ContentChildren(PrimeTemplate) templates: QueryList; - - public _value: any[]; - - public itemTemplate: TemplateRef; - - public left: any = 0; - - public items: any; - - public columns: any; - - public page: number; - - public valuesChanged: any; - - public interval: any; - - public anchorPageLinks: any[]; - - public mobileDropdownOptions: any[]; - - public selectDropdownOptions: any[]; - - public shrinked: boolean; - - @ViewChild('container') containerViewChild: ElementRef; - - @ViewChild('viewport') viewportViewChild: ElementRef; - - @ViewChild('items') itemsViewChild: ElementRef; - - documentResponsiveListener: any; - - differ: any; - - constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer2, public cd: ChangeDetectorRef) {} - - ngAfterContentInit() { - this.templates.forEach((item) => { - switch(item.getType()) { - case 'item': - this.itemTemplate = item.template; - break; - - default: - this.itemTemplate = item.template; - break; - } - }); - } - - @Input() get value(): any[] { - return this._value; - } - - set value(val:any[]) { - this._value = val; - this.handleDataChange(); - } - - handleDataChange() { - if(this.value && this.value.length) { - if(this.value.length && this.firstVisible >= this.value.length) { - this.setPage(this.totalPages - 1); - } - } - else { - this.setPage(0); - } - - this.valuesChanged = true; - } - - ngAfterViewChecked() { - if(this.valuesChanged && this.containerViewChild.nativeElement.offsetParent) { - this.render(); - this.valuesChanged = false; - } - } - - ngAfterViewInit() { - if(this.responsive) { - this.documentResponsiveListener = this.renderer.listen('window', 'resize', (event) => { - this.updateState(); - }); - } - } - - updateLinks() { - this.anchorPageLinks = []; - for (let i = 0; i < this.totalPages; i++) { - this.anchorPageLinks.push(i); - } - } - - updateDropdown() { - this.selectDropdownOptions = []; - for (let i = 0; i < this.totalPages; i++) { - this.selectDropdownOptions.push(i); - } - } - - updateMobileDropdown() { - this.mobileDropdownOptions = []; - if(this.value && this.value.length) { - for (let i = 0; i < this.value.length; i++) { - this.mobileDropdownOptions.push(i); - } - } - } - - render() { - if(this.autoplayInterval) { - this.stopAutoplay(); - } - - this.items = this.domHandler.find(this.itemsViewChild.nativeElement, 'li'); - this.calculateColumns(); - this.calculateItemWidths(); - - if(!this.responsive) { - this.containerViewChild.nativeElement.style.width = (this.domHandler.width(this.containerViewChild.nativeElement)) + 'px'; - } - - if(this.autoplayInterval) { - this.circular = true; - this.startAutoplay(); - } - - this.updateMobileDropdown(); - this.updateLinks(); - this.updateDropdown(); - this.cd.detectChanges(); - } - - calculateItemWidths () { - let firstItem = (this.items && this.items.length) ? this.items[0] : null; - if(firstItem) { - for (let i = 0; i < this.items.length; i++) { - this.items[i].style.width = ((this.domHandler.innerWidth(this.viewportViewChild.nativeElement) - (this.domHandler.getHorizontalMargin(firstItem) * this.columns)) / this.columns) + 'px'; - } - } - } - - calculateColumns() { - if(window.innerWidth <= this.breakpoint) { - this.shrinked = true; - this.columns = 1; - } - else { - this.shrinked = false; - this.columns = this.numVisible; - } - this.page = Math.floor(this.firstVisible / this.columns); - } - - onNextNav() { - let lastPage = (this.page === (this.totalPages - 1)); - - if(!lastPage) - this.setPage(this.page + 1); - else if(this.circular) - this.setPage(0); - } - - onPrevNav() { - if(this.page !== 0) - this.setPage(this.page - 1); - else if(this.circular) - this.setPage(this.totalPages - 1); - } - - setPageWithLink(event, p: number) { - this.setPage(p); - event.preventDefault(); - } - - setPage(p, enforce?: boolean) { - if(p !== this.page || enforce) { - this.page = p; - this.left = (-1 * (this.domHandler.innerWidth(this.viewportViewChild.nativeElement) * this.page)); - this.firstVisible = this.page * this.columns; - this.onPage.emit({ - page: this.page - }); - } - } - - onDropdownChange(val: string) { - this.setPage(parseInt(val)); - } - - get displayPageLinks(): boolean { - return (this.totalPages <= this.pageLinks && !this.shrinked); - } - - get displayPageDropdown(): boolean { - return (this.totalPages > this.pageLinks && !this.shrinked); - } - - get totalPages(): number { - return (this.value && this.value.length) ? Math.ceil(this.value.length / this.columns) : 0; - } - - routerDisplay () { - let win = window; - if(win.innerWidth <= this.breakpoint) - return true; - else - return false; - } - - updateState() { - let win = window; - if(win.innerWidth <= this.breakpoint) { - this.shrinked = true; - this.columns = 1; - } - else if(this.shrinked) { - this.shrinked = false; - this.columns = this.numVisible; - this.updateLinks(); - this.updateDropdown(); - } - - this.calculateItemWidths(); - this.setPage(Math.floor(this.firstVisible / this.columns), true); - } - - startAutoplay() { - this.interval = setInterval(() => { - if(this.page === (this.totalPages - 1)) - this.setPage(0); - else - this.setPage(this.page + 1); - }, - this.autoplayInterval); - } - - stopAutoplay() { - clearInterval(this.interval); - } - - ngOnDestroy() { - if(this.documentResponsiveListener) { - this.documentResponsiveListener(); - } - - if(this.autoplayInterval) { - this.stopAutoplay(); - } - } -} - -@NgModule({ - imports: [CommonModule,SharedModule], - exports: [Carousel,SharedModule], - declarations: [Carousel] -}) -export class CarouselModule { } \ No newline at end of file diff --git a/dashboard/src/app/components/chart/chart.spec.ts b/dashboard/src/app/components/chart/chart.spec.ts deleted file mode 100644 index a3285939b..000000000 --- a/dashboard/src/app/components/chart/chart.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { UIChart } from './chart'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('UIChart', () => { - - let chart: UIChart; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - UIChart - ] - }); - - fixture = TestBed.createComponent(UIChart); - chart = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/chart/chart.ts b/dashboard/src/app/components/chart/chart.ts deleted file mode 100644 index c2e9e1981..000000000 --- a/dashboard/src/app/components/chart/chart.ts +++ /dev/null @@ -1,112 +0,0 @@ -import {NgModule,Component,ElementRef,AfterViewInit,OnDestroy,Input,Output,EventEmitter} from '@angular/core'; -import {CommonModule} from '@angular/common'; - -declare var Chart: any; - -@Component({ - selector: 'p-chart', - template: ` -
- -
- ` -}) -export class UIChart implements AfterViewInit, OnDestroy { - - @Input() type: string; - - @Input() options: any = {}; - - @Input() width: string; - - @Input() height: string; - - @Input() responsive: boolean = true; - - @Output() onDataSelect: EventEmitter = new EventEmitter(); - - initialized: boolean; - - _data: any; - - chart: any; - - constructor(public el: ElementRef) {} - - @Input() get data(): any { - return this._data; - } - - set data(val:any) { - this._data = val; - this.reinit(); - } - - ngAfterViewInit() { - this.initChart(); - this.initialized = true; - } - - onCanvasClick(event) { - if(this.chart) { - let element = this.chart.getElementAtEvent(event); - let dataset = this.chart.getDatasetAtEvent(event); - if(element&&element[0]&&dataset) { - this.onDataSelect.emit({originalEvent: event, element: element[0], dataset: dataset}); - } - } - } - - initChart() { - let opts = this.options||{}; - opts.responsive = this.responsive; - - this.chart = new Chart(this.el.nativeElement.children[0].children[0], { - type: this.type, - data: this.data, - options: this.options - }); - } - - getCanvas() { - return this.el.nativeElement.children[0].children[0]; - } - - getBase64Image() { - return this.chart.toBase64Image(); - } - - generateLegend() { - if(this.chart) { - this.chart.generateLegend(); - } - } - - refresh() { - if(this.chart) { - this.chart.update(); - } - } - - reinit() { - if(this.chart) { - this.chart.destroy(); - this.initChart(); - } - } - - ngOnDestroy() { - if(this.chart) { - this.chart.destroy(); - this.initialized = false; - this.chart = null; - } - } -} - -@NgModule({ - imports: [CommonModule], - exports: [UIChart], - declarations: [UIChart] -}) -export class ChartModule { } diff --git a/dashboard/src/app/components/checkbox/checkbox.css b/dashboard/src/app/components/checkbox/checkbox.css deleted file mode 100644 index ac3e56d4f..000000000 --- a/dashboard/src/app/components/checkbox/checkbox.css +++ /dev/null @@ -1,25 +0,0 @@ -.ui-chkbox { - display: inline-block; - cursor: pointer; - vertical-align: middle; - margin-right: .25em; -} - -.ui-chkbox .ui-chkbox-box { - width: 1.125em; - height: 1.125em; - line-height: 1.125em; - -moz-border-radius: 2px; - -webkit-border-radius: 2px; - border-radius: 2px; - text-align: center; -} - -.ui-chkbox .ui-chkbox-icon { - display: block; -} - -.ui-chkbox-label { - vertical-align: middle; -} - diff --git a/dashboard/src/app/components/checkbox/checkbox.spec.ts b/dashboard/src/app/components/checkbox/checkbox.spec.ts deleted file mode 100644 index 0d821c0ec..000000000 --- a/dashboard/src/app/components/checkbox/checkbox.spec.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { Checkbox } from './checkbox'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('Checkbox', () => { - - let checkbox: Checkbox; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - Checkbox - ] - }); - - fixture = TestBed.createComponent(Checkbox); - checkbox = fixture.componentInstance; - }); - - it('should check the input on click', () => { - const boxEl = fixture.nativeElement.querySelector('.ui-chkbox-box'); - boxEl.click(); - fixture.detectChanges(); - - const input = fixture.nativeElement.querySelector('input'); - expect(input.checked).toBe(true); - }); -}); \ No newline at end of file diff --git a/dashboard/src/app/components/checkbox/checkbox.ts b/dashboard/src/app/components/checkbox/checkbox.ts deleted file mode 100644 index cc03b2ac3..000000000 --- a/dashboard/src/app/components/checkbox/checkbox.ts +++ /dev/null @@ -1,157 +0,0 @@ -import {NgModule,Component,Input,Output,EventEmitter,forwardRef,ChangeDetectorRef} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {NG_VALUE_ACCESSOR, ControlValueAccessor, FormControl} from '@angular/forms'; - -export const CHECKBOX_VALUE_ACCESSOR: any = { - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => Checkbox), - multi: true -}; - -@Component({ - selector: 'p-checkbox', - template: ` -
-
- -
-
- -
-
- - `, - providers: [CHECKBOX_VALUE_ACCESSOR] -}) -export class Checkbox implements ControlValueAccessor { - - @Input() value: any; - - @Input() name: string; - - @Input() disabled: boolean; - - @Input() binary: string; - - @Input() label: string; - - @Input() tabindex: number; - - @Input() inputId: string; - - @Input() style: any; - - @Input() styleClass: string; - - @Input() formControl: FormControl; - - @Output() onChange: EventEmitter = new EventEmitter(); - - model: any; - - onModelChange: Function = () => {}; - - onModelTouched: Function = () => {}; - - focused: boolean = false; - - checked: boolean = false; - - constructor(private cd: ChangeDetectorRef) {} - - onClick(event,checkbox,focus:boolean) { - event.preventDefault(); - - if(this.disabled) { - return; - } - - this.checked = !this.checked; - this.updateModel(); - - if(focus) { - checkbox.focus(); - } - } - - updateModel() { - if(!this.binary) { - if(this.checked) - this.addValue(); - else - this.removeValue(); - - this.onModelChange(this.model); - - if(this.formControl) { - this.formControl.setValue(this.model); - } - } - else { - this.onModelChange(this.checked); - } - - this.onChange.emit(this.checked); - } - - handleChange(event) { - this.checked = event.target.checked; - this.updateModel(); - } - - isChecked(): boolean { - if(this.binary) - return this.model; - else - return this.model && this.model.indexOf(this.value) > -1; - } - - removeValue() { - this.model = this.model.filter(val => val !== this.value); - } - - addValue() { - if(this.model) - this.model = [...this.model, this.value]; - else - this.model = [this.value]; - } - - onFocus(event) { - this.focused = true; - } - - onBlur(event) { - this.focused = false; - this.onModelTouched(); - } - - writeValue(model: any) : void { - this.model = model; - this.checked = this.isChecked(); - this.cd.markForCheck(); - } - - registerOnChange(fn: Function): void { - this.onModelChange = fn; - } - - registerOnTouched(fn: Function): void { - this.onModelTouched = fn; - } - - setDisabledState(val: boolean): void { - this.disabled = val; - } -} - -@NgModule({ - imports: [CommonModule], - exports: [Checkbox], - declarations: [Checkbox] -}) -export class CheckboxModule { } \ No newline at end of file diff --git a/dashboard/src/app/components/chips/chips.css b/dashboard/src/app/components/chips/chips.css deleted file mode 100644 index ae3568a93..000000000 --- a/dashboard/src/app/components/chips/chips.css +++ /dev/null @@ -1,59 +0,0 @@ -.ui-chips > ul.ui-inputtext { - clear: left; - cursor: text; - list-style-type: none; - margin: 0; - overflow: hidden; - padding: 0 .25em; -} - -.ui-chips-token { - cursor: default; - display: inline-block; - vertical-align: middle; - overflow: hidden; - padding: .125em .5em; - white-space: nowrap; - position: relative; - margin-right: .125em; - border: 0 none; - font-size: .9em; -} - -.ui-chips-token .ui-chips-token-label { - display: block; - margin-right: 2em; -} - -.ui-chips > .ui-state-disabled .ui-chips-token-label { - margin-right: 0; -} - -.ui-chips-token .ui-chips-token-icon { - margin-top: -.5em; - position: absolute; - right: 0.2em; - top: 50%; - cursor: pointer; -} - -.ui-chips-input-token { - display: inline-block; - vertical-align: middle; - list-style-type: none; - margin: 0 0 0 .125em; - padding: .25em .25em .25em 0; -} - -.ui-chips-input-token input { - border: 0 none; - width: 10em; - outline: medium none; - background-color: transparent; - margin: 0; - padding: 0; - box-shadow: none; - -moz-border-radius: 0; - -webkit-border-radius: 0; - border-radius: 0; -} \ No newline at end of file diff --git a/dashboard/src/app/components/chips/chips.spec.ts b/dashboard/src/app/components/chips/chips.spec.ts deleted file mode 100644 index c473aa28f..000000000 --- a/dashboard/src/app/components/chips/chips.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { Chips } from './chips'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('Chips', () => { - - let chips: Chips; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - Chips - ] - }); - - fixture = TestBed.createComponent(Chips); - chips = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/chips/chips.ts b/dashboard/src/app/components/chips/chips.ts deleted file mode 100644 index a02a4df74..000000000 --- a/dashboard/src/app/components/chips/chips.ts +++ /dev/null @@ -1,227 +0,0 @@ -import {NgModule,Component,ElementRef,Input,Output,EventEmitter,AfterContentInit,ContentChildren,QueryList,TemplateRef,IterableDiffers,forwardRef} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {SharedModule,PrimeTemplate} from '../common/shared'; -import {InputTextModule} from '../inputtext/inputtext'; -import {DomHandler} from '../dom/domhandler'; -import {NG_VALUE_ACCESSOR, ControlValueAccessor} from '@angular/forms'; - -export const CHIPS_VALUE_ACCESSOR: any = { - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => Chips), - multi: true -}; - -@Component({ - selector: 'p-chips', - template: ` -
-
    -
  • - - {{field ? resolveFieldData(item,field) : item}} - -
  • -
  • - -
  • -
-
- `, - providers: [DomHandler,CHIPS_VALUE_ACCESSOR] -}) -export class Chips implements AfterContentInit,ControlValueAccessor { - - @Input() style: any; - - @Input() styleClass: string; - - @Input() disabled: boolean; - - @Output() onAdd: EventEmitter = new EventEmitter(); - - @Output() onRemove: EventEmitter = new EventEmitter(); - - @Input() field: string; - - @Input() placeholder: string; - - @Input() max: number; - - @Input() tabindex: number; - - @Input() inputId: string; - - @Input() allowDuplicate: boolean = true; - - @Input() inputStyle: any; - - @Input() inputStyleClass: any; - - @Input() addOnTab: boolean; - - @Input() addOnBlur: boolean; - - @Output() onFocus: EventEmitter = new EventEmitter(); - - @Output() onBlur: EventEmitter = new EventEmitter(); - - @ContentChildren(PrimeTemplate) templates: QueryList; - - public itemTemplate: TemplateRef; - - value: any; - - onModelChange: Function = () => {}; - - onModelTouched: Function = () => {}; - - valueChanged: boolean; - - focus: boolean; - - constructor(public el: ElementRef, public domHandler: DomHandler) {} - - ngAfterContentInit() { - this.templates.forEach((item) => { - switch(item.getType()) { - case 'item': - this.itemTemplate = item.template; - break; - - default: - this.itemTemplate = item.template; - break; - } - }); - } - - writeValue(value: any) : void { - this.value = value; - } - - registerOnChange(fn: Function): void { - this.onModelChange = fn; - } - - registerOnTouched(fn: Function): void { - this.onModelTouched = fn; - } - - setDisabledState(val: boolean): void { - this.disabled = val; - } - - resolveFieldData(data: any, field: string): any { - if(data && field) { - if(field.indexOf('.') == -1) { - return data[field]; - } - else { - let fields: string[] = field.split('.'); - let value = data; - for(var i = 0, len = fields.length; i < len; ++i) { - value = value[fields[i]]; - } - return value; - } - } - else { - return null; - } - } - - onInputFocus(event: FocusEvent) { - this.focus = true; - this.onFocus.emit(event); - } - - onInputBlur(event: FocusEvent, inputEL: HTMLInputElement) { - this.focus = false; - if(this.addOnBlur && inputEL.value) { - this.addItem(event, inputEL.value); - inputEL.value = ''; - } - this.onModelTouched(); - this.onBlur.emit(event); - } - - removeItem(event: Event, index: number): void { - if(this.disabled) { - return; - } - - let removedItem = this.value[index]; - this.value = this.value.filter((val, i) => i!=index); - this.onModelChange(this.value); - this.onRemove.emit({ - originalEvent: event, - value: removedItem - }); - } - - addItem(event: Event, item: string): void { - this.value = this.value||[]; - if(item && item.trim().length && (!this.max||this.max > item.length)) { - if(this.allowDuplicate || this.value.indexOf(item) === -1) { - this.value = [...this.value, item]; - this.onModelChange(this.value); - this.onAdd.emit({ - originalEvent: event, - value: item - }); - } - } - } - - onKeydown(event: KeyboardEvent, inputEL: HTMLInputElement): void { - switch(event.which) { - //backspace - case 8: - if(inputEL.value.length === 0 && this.value && this.value.length > 0) { - this.value = [...this.value]; - let removedItem = this.value.pop(); - this.onModelChange(this.value); - this.onRemove.emit({ - originalEvent: event, - value: removedItem - }); - } - break; - - //enter - case 13: - this.addItem(event, inputEL.value); - inputEL.value = ''; - - event.preventDefault(); - break; - - case 9: - if(this.addOnTab && inputEL.value !== '') { - this.addItem(event, inputEL.value); - inputEL.value = ''; - - event.preventDefault(); - } - break; - - default: - if(this.max && this.value && this.max === this.value.length) { - event.preventDefault(); - } - break; - } - } - - get maxedOut(): boolean { - return this.max && this.value && this.max === this.value.length; - } -} - -@NgModule({ - imports: [CommonModule,InputTextModule,SharedModule], - exports: [Chips,InputTextModule,SharedModule], - declarations: [Chips] -}) -export class ChipsModule { } diff --git a/dashboard/src/app/components/codehighlighter/codehighlighter.spec.ts b/dashboard/src/app/components/codehighlighter/codehighlighter.spec.ts deleted file mode 100644 index 2ed65aa80..000000000 --- a/dashboard/src/app/components/codehighlighter/codehighlighter.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { CodeHighlighter } from './codehighlighter'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('CodeHighlighter', () => { - - let codehighlighter: CodeHighlighter; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - CodeHighlighter - ] - }); - - fixture = TestBed.createComponent(CodeHighlighter); - codehighlighter = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/codehighlighter/codehighlighter.ts b/dashboard/src/app/components/codehighlighter/codehighlighter.ts deleted file mode 100644 index c66262191..000000000 --- a/dashboard/src/app/components/codehighlighter/codehighlighter.ts +++ /dev/null @@ -1,25 +0,0 @@ -import {NgModule,Directive,ElementRef,OnInit} from '@angular/core'; -import {CommonModule} from '@angular/common'; - -@Directive({ - selector: '[pCode]' -}) -export class CodeHighlighter implements OnInit { - - constructor(public el: ElementRef) {} - - ngOnInit() { - if(window['Prism']) { - window['Prism'].highlightElement(this.el.nativeElement); - } - } -} - -@NgModule({ - imports: [CommonModule], - exports: [CodeHighlighter], - declarations: [CodeHighlighter] -}) -export class CodeHighlighterModule { } - - diff --git a/dashboard/src/app/components/colorpicker/colorpicker.css b/dashboard/src/app/components/colorpicker/colorpicker.css deleted file mode 100644 index af49f4b9b..000000000 --- a/dashboard/src/app/components/colorpicker/colorpicker.css +++ /dev/null @@ -1,87 +0,0 @@ -.ui-colorpicker { - display: inline-block; -} - -.ui-colorpicker-dragging { - cursor: pointer; -} - -.ui-colorpicker-overlay { - position: relative; -} - -.ui-colorpicker-panel { - position: relative; - width: 193px; - height: 166px; - background-color: #323232; - border-color: #191919; -} - -.ui-colorpicker-overlay-panel { - display: none; - position: absolute; -} - -.ui-colorpicker-preview { - width: 2em; - cursor: pointer; -} - -.ui-colorpicker-panel .ui-colorpicker-content { - position: relative; -} - -.ui-colorpicker-panel .ui-colorpicker-color-selector { - width: 150px; - height: 150px; - top: 8px; - left: 8px; - position: absolute; -} - -.ui-colorpicker-panel .ui-colorpicker-color { - width: 150px; - height: 150px; - background: transparent url("./images/color.png") no-repeat left top; -} - -.ui-colorpicker-panel .ui-colorpicker-color-handle { - position: absolute; - top: 0px; - left: 150px; - border-radius: 100%; - width: 10px; - height: 10px; - border: 1px solid #ffffff; - margin: -5px 0 0 -5px; - cursor: pointer; -} - -.ui-colorpicker-panel .ui-colorpicker-hue { - background: transparent url("./images/hue.png") no-repeat left top; - width: 17px; - height: 150px; - top: 8px; - left: 167px; - position: absolute; - opacity: .85; -} - -.ui-colorpicker-panel .ui-colorpicker-hue-handle { - position: absolute; - top: 150px; - left: 0px; - width: 21px; - margin-left: -2px; - margin-top: -5px; - height: 10px; - border: 2px solid #ffffff; - opacity: .85; - cursor: pointer; - } - - .ui-colorpicker-panel.ui-state-disabled .ui-colorpicker-hue-handle, - .ui-colorpicker-panel.ui-state-disabled .ui-colorpicker-color-handle { - opacity: .5; - } \ No newline at end of file diff --git a/dashboard/src/app/components/colorpicker/colorpicker.spec.ts b/dashboard/src/app/components/colorpicker/colorpicker.spec.ts deleted file mode 100644 index f8b09636f..000000000 --- a/dashboard/src/app/components/colorpicker/colorpicker.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { ColorPicker } from './colorpicker'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('ColorPicker', () => { - - let colorpicker: ColorPicker; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - ColorPicker - ] - }); - - fixture = TestBed.createComponent(ColorPicker); - colorpicker = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/colorpicker/colorpicker.ts b/dashboard/src/app/components/colorpicker/colorpicker.ts deleted file mode 100644 index 0d5fc6974..000000000 --- a/dashboard/src/app/components/colorpicker/colorpicker.ts +++ /dev/null @@ -1,507 +0,0 @@ -import { NgModule, Component, ElementRef, Input, Output, AfterViewInit, AfterViewChecked, OnDestroy, EventEmitter, forwardRef, Renderer2, ViewChild, ChangeDetectorRef } from '@angular/core'; -import { trigger, state, style, transition, animate } from '@angular/animations'; -import { CommonModule } from '@angular/common'; -import { DomHandler } from '../dom/domhandler'; -import { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms'; - -export const COLORPICKER_VALUE_ACCESSOR: any = { - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => ColorPicker), - multi: true -}; - -@Component({ - selector: 'p-colorPicker', - template: ` -
- -
-
-
-
-
-
-
-
-
-
-
-
-
- `, - animations: [ - trigger('panelState', [ - state('hidden', style({ - opacity: 0 - })), - state('visible', style({ - opacity: 1 - })), - transition('visible => hidden', animate('400ms ease-in')), - transition('hidden => visible', animate('400ms ease-out')) - ]) - ], - providers: [DomHandler,COLORPICKER_VALUE_ACCESSOR] -}) -export class ColorPicker implements ControlValueAccessor, AfterViewInit, AfterViewChecked, OnDestroy{ - - @Input() style: any; - - @Input() styleClass: string; - - @Input() inline: boolean; - - @Input() format: string = 'hex'; - - @Input() appendTo: string; - - @Input() disabled: boolean; - - @Input() tabindex: string; - - @Input() inputId: string; - - @Output() onChange: EventEmitter = new EventEmitter(); - - @ViewChild('panel') panelViewChild: ElementRef; - - @ViewChild('colorSelector') colorSelectorViewChild: ElementRef; - - @ViewChild('colorHandle') colorHandleViewChild: ElementRef; - - @ViewChild('hue') hueViewChild: ElementRef; - - @ViewChild('hueHandle') hueHandleViewChild: ElementRef; - - @ViewChild('input') inputViewChild: ElementRef; - - value: any; - - inputBgColor: string; - - shown: boolean; - - panelVisible: boolean; - - defaultColor: string = 'ff0000'; - - onModelChange: Function = () => {}; - - onModelTouched: Function = () => {}; - - documentClickListener: Function; - - documentMousemoveListener: Function; - - documentMouseupListener: Function; - - documentHueMoveListener: Function; - - selfClick: boolean; - - colorDragging: boolean; - - hueDragging: boolean; - - constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer2, public cd: ChangeDetectorRef) {} - - ngAfterViewInit() { - if (this.appendTo) { - if (this.appendTo === 'body') - document.body.appendChild(this.panelViewChild.nativeElement); - else - this.domHandler.appendChild(this.panelViewChild.nativeElement, this.appendTo); - } - } - - ngAfterViewChecked() { - if(this.shown) { - this.onShow(); - this.shown = false; - } - } - - onHueMousedown(event: MouseEvent) { - if(this.disabled) { - return; - } - - this.bindDocumentMousemoveListener(); - this.bindDocumentMouseupListener(); - - this.hueDragging = true; - this.pickHue(event); - } - - pickHue(event: MouseEvent) { - let top: number = this.hueViewChild.nativeElement.getBoundingClientRect().top + (window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0); - this.value = this.validateHSB({ - h: Math.floor(360 * (150 - Math.max(0, Math.min(150, (event.pageY - top)))) / 150), - s: this.value.s, - b: this.value.b - }); - - this.updateColorSelector(); - this.updateUI(); - this.updateModel(); - this.onChange.emit({originalEvent: event, value: this.getValueToUpdate()}); - } - - onColorMousedown(event: MouseEvent) { - if(this.disabled) { - return; - } - - this.bindDocumentMousemoveListener(); - this.bindDocumentMouseupListener(); - - this.colorDragging = true; - this.pickColor(event); - } - - pickColor(event: MouseEvent) { - let rect = this.colorSelectorViewChild.nativeElement.getBoundingClientRect(); - let top = rect.top + (window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0); - let left = rect.left + document.body.scrollLeft; - let saturation = Math.floor(100 * (Math.max(0, Math.min(150, (event.pageX - left)))) / 150); - let brightness = Math.floor(100 * (150 - Math.max(0, Math.min(150, (event.pageY - top)))) / 150); - this.value = this.validateHSB({ - h: this.value.h, - s: saturation, - b: brightness - }); - - this.updateUI(); - this.updateModel(); - this.onChange.emit({originalEvent: event, value: this.getValueToUpdate()}); - } - - getValueToUpdate() { - let val: any; - switch(this.format) { - case 'hex': - val = '#' + this.HSBtoHEX(this.value); - break; - - case 'rgb': - val = this.HSBtoRGB(this.value); - break; - - case 'hsb': - val = this.value; - break; - } - - return val; - } - - updateModel(): void { - this.onModelChange(this.getValueToUpdate()); - } - - writeValue(value: any): void { - if(value) { - switch(this.format) { - case 'hex': - this.value = this.HEXtoHSB(value); - break; - - case 'rgb': - this.value = this.RGBtoHSB(value); - break; - - case 'hsb': - this.value = value; - break; - } - } - else { - this.value = this.HEXtoHSB(this.defaultColor); - } - - this.updateColorSelector(); - this.updateUI(); - } - - updateColorSelector() { - this.colorSelectorViewChild.nativeElement.style.backgroundColor = '#' + this.HSBtoHEX(this.value); - } - - updateUI() { - this.colorHandleViewChild.nativeElement.style.left = Math.floor(150 * this.value.s / 100) + 'px'; - this.colorHandleViewChild.nativeElement.style.top = Math.floor(150 * (100 - this.value.b) / 100) + 'px'; - this.hueHandleViewChild.nativeElement.style.top = Math.floor(150 - (150 * this.value.h / 360)) + 'px'; - this.inputBgColor = '#' + this.HSBtoHEX(this.value); - } - - onInputFocus() { - this.onModelTouched(); - } - - show() { - this.panelViewChild.nativeElement.style.zIndex = String(++DomHandler.zindex); - this.panelVisible = true; - this.shown = true; - } - - hide() { - this.panelVisible = false; - this.unbindDocumentClickListener(); - } - - onShow() { - this.alignPanel(); - this.bindDocumentClickListener(); - } - - alignPanel() { - if(this.appendTo) - this.domHandler.absolutePosition(this.panelViewChild.nativeElement, this.inputViewChild.nativeElement); - else - this.domHandler.relativePosition(this.panelViewChild.nativeElement, this.inputViewChild.nativeElement); - } - - onInputClick() { - this.selfClick = true; - this.togglePanel(); - } - - togglePanel() { - if(!this.panelVisible) - this.show(); - else - this.hide(); - } - - onInputKeydown(event: KeyboardEvent) { - switch(event.which) { - //space - case 32: - this.togglePanel(); - event.preventDefault(); - break; - - //escape and tab - case 27: - case 9: - this.hide(); - break; - } - } - - onPanelClick() { - this.selfClick = true; - } - - registerOnChange(fn: Function): void { - this.onModelChange = fn; - } - - registerOnTouched(fn: Function): void { - this.onModelTouched = fn; - } - - setDisabledState(val: boolean): void { - this.disabled = val; - } - - bindDocumentClickListener() { - if(!this.documentClickListener) { - this.documentClickListener = this.renderer.listen('document', 'click', () => { - if(!this.selfClick) { - this.panelVisible = false; - this.unbindDocumentClickListener(); - } - - this.selfClick = false; - this.cd.markForCheck(); - }); - } - } - - unbindDocumentClickListener() { - if(this.documentClickListener) { - this.documentClickListener(); - this.documentClickListener = null; - } - } - - bindDocumentMousemoveListener() { - if(!this.documentMousemoveListener) { - this.documentMousemoveListener = this.renderer.listen('document', 'mousemove', (event: MouseEvent) => { - if(this.colorDragging) { - this.pickColor(event); - } - - if(this.hueDragging) { - this.pickHue(event); - } - }); - } - } - - unbindDocumentMousemoveListener() { - if(this.documentMousemoveListener) { - this.documentMousemoveListener(); - this.documentMousemoveListener = null; - } - } - - bindDocumentMouseupListener() { - if(!this.documentMouseupListener) { - this.documentMouseupListener = this.renderer.listen('document', 'mouseup', () => { - this.colorDragging = false; - this.hueDragging = false; - this.unbindDocumentMousemoveListener(); - this.unbindDocumentMouseupListener(); - }); - } - } - - unbindDocumentMouseupListener() { - if(this.documentMouseupListener) { - this.documentMouseupListener(); - this.documentMouseupListener = null; - } - } - - validateHSB(hsb) { - return { - h: Math.min(360, Math.max(0, hsb.h)), - s: Math.min(100, Math.max(0, hsb.s)), - b: Math.min(100, Math.max(0, hsb.b)) - }; - } - - validateRGB(rgb) { - return { - r: Math.min(255, Math.max(0, rgb.r)), - g: Math.min(255, Math.max(0, rgb.g)), - b: Math.min(255, Math.max(0, rgb.b)) - }; - } - - validateHEX(hex) { - var len = 6 - hex.length; - if (len > 0) { - var o = []; - for (var i=0; i -1) ? hex.substring(1) : hex), 16); - return {r: hexValue >> 16, g: (hexValue & 0x00FF00) >> 8, b: (hexValue & 0x0000FF)}; - } - - HEXtoHSB(hex) { - return this.RGBtoHSB(this.HEXtoRGB(hex)); - } - - RGBtoHSB(rgb) { - var hsb = { - h: 0, - s: 0, - b: 0 - }; - var min = Math.min(rgb.r, rgb.g, rgb.b); - var max = Math.max(rgb.r, rgb.g, rgb.b); - var delta = max - min; - hsb.b = max; - if (max != 0) { - - } - hsb.s = max != 0 ? 255 * delta / max : 0; - if (hsb.s != 0) { - if (rgb.r == max) { - hsb.h = (rgb.g - rgb.b) / delta; - } else if (rgb.g == max) { - hsb.h = 2 + (rgb.b - rgb.r) / delta; - } else { - hsb.h = 4 + (rgb.r - rgb.g) / delta; - } - } else { - hsb.h = -1; - } - hsb.h *= 60; - if (hsb.h < 0) { - hsb.h += 360; - } - hsb.s *= 100/255; - hsb.b *= 100/255; - return hsb; - } - - HSBtoRGB(hsb) { - var rgb = { - r: null, g: null, b: null - }; - var h = Math.round(hsb.h); - var s = Math.round(hsb.s*255/100); - var v = Math.round(hsb.b*255/100); - if(s == 0) { - rgb = { - r: v, - g: v, - b: v - } - } - else { - var t1 = v; - var t2 = (255-s)*v/255; - var t3 = (t1-t2)*(h%60)/60; - if(h==360) h = 0; - if(h<60) {rgb.r=t1; rgb.b=t2; rgb.g=t2+t3} - else if(h<120) {rgb.g=t1; rgb.b=t2; rgb.r=t1-t3} - else if(h<180) {rgb.g=t1; rgb.r=t2; rgb.b=t2+t3} - else if(h<240) {rgb.b=t1; rgb.r=t2; rgb.g=t1-t3} - else if(h<300) {rgb.b=t1; rgb.g=t2; rgb.r=t2+t3} - else if(h<360) {rgb.r=t1; rgb.g=t2; rgb.b=t1-t3} - else {rgb.r=0; rgb.g=0; rgb.b=0} - } - return {r:Math.round(rgb.r), g:Math.round(rgb.g), b:Math.round(rgb.b)}; - } - - RGBtoHEX(rgb) { - var hex = [ - rgb.r.toString(16), - rgb.g.toString(16), - rgb.b.toString(16) - ]; - - for(var key in hex) { - if(hex[key].length == 1) { - hex[key] = '0' + hex[key]; - } - } - - return hex.join(''); - } - - HSBtoHEX(hsb) { - return this.RGBtoHEX(this.HSBtoRGB(hsb)); - } - - ngOnDestroy() { - this.unbindDocumentClickListener(); - - if (this.appendTo) { - this.el.nativeElement.appendChild(this.panelViewChild.nativeElement); - } - } -} - -@NgModule({ - imports: [CommonModule], - exports: [ColorPicker], - declarations: [ColorPicker] -}) -export class ColorPickerModule { } diff --git a/dashboard/src/app/components/colorpicker/images/color.png b/dashboard/src/app/components/colorpicker/images/color.png deleted file mode 100644 index 561cdd9c5..000000000 Binary files a/dashboard/src/app/components/colorpicker/images/color.png and /dev/null differ diff --git a/dashboard/src/app/components/colorpicker/images/hue.png b/dashboard/src/app/components/colorpicker/images/hue.png deleted file mode 100644 index 8efa25257..000000000 Binary files a/dashboard/src/app/components/colorpicker/images/hue.png and /dev/null differ diff --git a/dashboard/src/app/components/common/I18N.ts b/dashboard/src/app/components/common/I18N.ts deleted file mode 100644 index 6baa84ada..000000000 --- a/dashboard/src/app/components/common/I18N.ts +++ /dev/null @@ -1,12 +0,0 @@ -export class I18N { - static language = "en"; - static keyID = {}; - - static get(key, params = []) { - let str = this.keyID[key] || key; - params.forEach((param, index) => { - str = str.replace("{" + index + "}", param); - }); - return str; - } -} \ No newline at end of file diff --git a/dashboard/src/app/components/common/api.ts b/dashboard/src/app/components/common/api.ts deleted file mode 100644 index abac56dc5..000000000 --- a/dashboard/src/app/components/common/api.ts +++ /dev/null @@ -1,44 +0,0 @@ -export { DomHandler } from '../dom/domhandler'; -export { TreeNode } from './treenode'; -export { TreeDragDropService } from './treedragdropservice'; -export { TreeNodeDragEvent } from './treenodedragevent'; -export { BlockableUI } from './blockableui'; -export { Confirmation } from './confirmation'; -export { ConfirmationService } from './confirmationservice'; -export { FilterMetadata } from './filtermetadata'; -export { LazyLoadEvent } from './lazyloadevent'; -export { MenuItem } from './menuitem'; -export { Message } from './message'; -export { SelectItem } from './selectitem'; -export { SelectItemGroup } from './selectitemgroup'; -export { SortMeta } from './sortmeta'; -export { SortEvent } from './sortevent'; -export { I18N } from './I18N'; - -export { FormModule } from '../form/form'; -export { InputTextModule } from '../inputtext/inputtext'; -export { InputTextareaModule } from '../inputtextarea/inputtextarea'; -export { CheckboxModule } from '../checkbox/checkbox'; -export { ConfirmDialogModule } from '../confirmdialog/confirmdialog'; -export { ButtonModule } from '../button/button'; -export { BadgeModule } from '../badge/badge'; -export { TabViewModule } from '../tabview/tabview'; -export { DataTableModule } from '../datatable/datatable'; -export { SplitButtonModule } from '../splitbutton/splitbutton'; -export { DropMenuModule } from '../dropmenu/dropmenu'; -export { DialogModule } from '../dialog/dialog'; -export { DropdownModule } from '../dropdown/dropdown'; -export { PasswordModule } from '../password/password'; -export { CardModule } from '../card/card'; -export { ChartModule } from '../chart/chart'; -export { BreadcrumbModule } from '../breadcrumb/breadcrumb'; -export { TableModule } from '../table/table'; -export { MessageModule } from '../message/message'; -export { MsgBoxModule } from '../msgbox/msgbox'; -export { MultiSelectModule } from '../multiselect/multiselect'; -export { OverlayPanelModule } from '../overlaypanel/overlaypanel'; -export { RadioButtonModule } from '../radiobutton/radiobutton'; -export { SelectButtonModule } from '../selectbutton/selectbutton'; -export { GrowlModule } from '../growl/growl'; -export { PanelModule } from '../panel/panel'; -export { SpinnerModule } from '../spinner/spinner'; diff --git a/dashboard/src/app/components/common/blockableui.ts b/dashboard/src/app/components/common/blockableui.ts deleted file mode 100644 index fd62e1705..000000000 --- a/dashboard/src/app/components/common/blockableui.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface BlockableUI { - getBlockableElement(): HTMLElement; -} \ No newline at end of file diff --git a/dashboard/src/app/components/common/common.scss b/dashboard/src/app/components/common/common.scss deleted file mode 100644 index 51b19e6e9..000000000 --- a/dashboard/src/app/components/common/common.scss +++ /dev/null @@ -1,193 +0,0 @@ -.ui-widget, .ui-widget * { - box-sizing: border-box; -} -.ui-helper-hidden { - display: none !important; -} -.ui-helper-hidden-accessible { - border: 0; - clip: rect(0 0 0 0); - height: 1px; - margin: -1px; - overflow: hidden; - padding: 0; - position: absolute; - width: 1px; -} -.ui-helper-hidden-accessible input, -.ui-helper-hidden-accessible select { - transform: scale(0); -} -.ui-helper-reset { - margin: 0; - padding: 0; - border: 0; - outline: 0; - line-height: 1.3; - text-decoration: none; - font-size: 100%; - list-style: none; -} -.ui-helper-clearfix::before, -.ui-helper-clearfix::after { - content: ""; - display: table; -} -.ui-helper-clearfix::after { - clear: both; -} -.ui-helper-clearfix { - zoom: 1; -} -.ui-helper-zfix { - width: 100%; - height: 100%; - top: 0; - left: 0; - position: absolute; - opacity: 0; - filter: Alpha(Opacity=0); -} -.ui-state-disabled { - cursor: default !important; -} -.ui-state-disabled a { - cursor: default !important; -} -.ui-icon { - display: block; - text-indent: -99999px; - overflow: hidden; - background-repeat: no-repeat; -} -.ui-widget-overlay { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; -} -.ui-resizable { - position: relative; -} -.ui-resizable-handle { - position: absolute; - font-size: 0.1px; - display: block; -} -.ui-resizable-disabled .ui-resizable-handle, -.ui-resizable-autohide .ui-resizable-handle { - display: none; -} -.ui-resizable-n { - cursor: n-resize; - height: 7px; - width: 100%; - top: -5px; - left: 0; -} -.ui-resizable-s { - cursor: s-resize; - height: 7px; - width: 100%; - bottom: -5px; - left: 0; -} -.ui-resizable-e { - cursor: e-resize; - width: 7px; - right: -5px; - top: 0; - height: 100%; -} -.ui-resizable-w { - cursor: w-resize; - width: 7px; - left: -5px; - top: 0; - height: 100%; -} -.ui-resizable-se { - cursor: se-resize; - width: 12px; - height: 12px; - right: 1px; - bottom: 1px; -} -.ui-resizable-sw { - cursor: sw-resize; - width: 9px; - height: 9px; - left: -5px; - bottom: -5px; -} -.ui-resizable-nw { - cursor: nw-resize; - width: 9px; - height: 9px; - left: -5px; - top: -5px; -} -.ui-resizable-ne { - cursor: ne-resize; - width: 9px; - height: 9px; - right: -5px; - top: -5px; -} -.ui-shadow { - -webkit-box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.3); - -moz-box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.3); - box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.3); -} -.ui-unselectable-text { - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -o-user-select: none; - user-select: none; -} -.ui-scrollbar-measure { - width: 100px; - height: 100px; - overflow: scroll; - position: absolute; - top: -9999px; -} -.ui-overflow-hidden { - overflow: hidden; -} - -::-webkit-input-placeholder { /* WebKit, Blink, Edge */ - color: #898989; -} -:-moz-placeholder { /* Mozilla Firefox 4 to 18 */ - color: #898989; - opacity: 1; -} -::-moz-placeholder { /* Mozilla Firefox 19+ */ - color: #898989; - opacity: 1; -} -:-ms-input-placeholder { /* Internet Explorer 10-11 */ - color: #898989; -} -::-ms-input-placeholder { /* Microsoft Edge */ - color: #898989; -} -.ui-placeholder { - color: #898989; -} - -input[type="button"], -input[type="submit"], -input[type="reset"], -input[type="file"]::-webkit-file-upload-button, -button { - // @include border-radius(all, small); - @extend .ui-corner-all-large; -} - -.fa{ - font-size: 0.16rem; -} \ No newline at end of file diff --git a/dashboard/src/app/components/common/confirmation.ts b/dashboard/src/app/components/common/confirmation.ts deleted file mode 100644 index 2988c510e..000000000 --- a/dashboard/src/app/components/common/confirmation.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { EventEmitter } from '@angular/core'; - -export interface Confirmation { - message: string; - key?: string; - icon?: string; - acceptLabel?: string; - rejectLabel?: string; - isWarning?: boolean; - header?: string; - accept?: Function; - reject?: Function; - acceptVisible?: boolean; - rejectVisible?: boolean; - acceptEvent?: EventEmitter; - rejectEvent?: EventEmitter; -} diff --git a/dashboard/src/app/components/common/confirmationservice.ts b/dashboard/src/app/components/common/confirmationservice.ts deleted file mode 100644 index c96f104c4..000000000 --- a/dashboard/src/app/components/common/confirmationservice.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Subject } from 'rxjs/Subject'; -import { Observable } from 'rxjs/Observable'; -import { Confirmation } from './confirmation'; - -@Injectable() -export class ConfirmationService { - - private requireConfirmationSource = new Subject(); - private acceptConfirmationSource = new Subject(); - - requireConfirmation$ = this.requireConfirmationSource.asObservable(); - accept = this.acceptConfirmationSource.asObservable(); - - confirm(confirmation: Confirmation) { - this.requireConfirmationSource.next(confirmation); - return this; - } - - onAccept() { - this.acceptConfirmationSource.next(); - } -} \ No newline at end of file diff --git a/dashboard/src/app/components/common/filtermetadata.ts b/dashboard/src/app/components/common/filtermetadata.ts deleted file mode 100644 index 2fc78e4f4..000000000 --- a/dashboard/src/app/components/common/filtermetadata.ts +++ /dev/null @@ -1,4 +0,0 @@ -export interface FilterMetadata { - value?: any; - matchMode?: string; -} \ No newline at end of file diff --git a/dashboard/src/app/components/common/keys.pipe.ts b/dashboard/src/app/components/common/keys.pipe.ts deleted file mode 100644 index 7a8a3f0ac..000000000 --- a/dashboard/src/app/components/common/keys.pipe.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { Pipe, PipeTransform } from '@angular/core'; - -@Pipe({ name: "Keys", pure: false }) -export class Keys implements PipeTransform{ - transform(value: any, args: any[] = null): any{ - return Object.keys(value); - } -} \ No newline at end of file diff --git a/dashboard/src/app/components/common/lazyloadevent.ts b/dashboard/src/app/components/common/lazyloadevent.ts deleted file mode 100644 index fa962033a..000000000 --- a/dashboard/src/app/components/common/lazyloadevent.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { SortMeta } from './sortmeta'; -import { FilterMetadata } from './filtermetadata'; - -export interface LazyLoadEvent { - first?: number; - rows?: number; - sortField?: string; - sortOrder?: number; - multiSortMeta?: SortMeta[]; - filters?: {[s: string]: FilterMetadata;}; - globalFilter?: any; -} \ No newline at end of file diff --git a/dashboard/src/app/components/common/menuitem.ts b/dashboard/src/app/components/common/menuitem.ts deleted file mode 100644 index 1d46f24bc..000000000 --- a/dashboard/src/app/components/common/menuitem.ts +++ /dev/null @@ -1,24 +0,0 @@ -import {EventEmitter} from '@angular/core'; - -export interface MenuItem { - label?: string; - icon?: string; - command?: (event?: any) => void; - url?: string; - routerLink?: any; - queryParams?: { [k: string]: any }; - items?: MenuItem[]|MenuItem[][]; - expanded?: boolean; - disabled?: boolean; - visible?: boolean; - target?: string; - routerLinkActiveOptions?: any; - separator?: boolean; - badge?: string; - badgeStyleClass?: string; - style?:any; - styleClass?:string; - title?: string; - id?: string; - automationId?: any; -} diff --git a/dashboard/src/app/components/common/message.ts b/dashboard/src/app/components/common/message.ts deleted file mode 100644 index fe2ff526f..000000000 --- a/dashboard/src/app/components/common/message.ts +++ /dev/null @@ -1,7 +0,0 @@ -export interface Message { - severity?: string; - summary?: string; - detail?: string; - id?: any; - key?: string; -} \ No newline at end of file diff --git a/dashboard/src/app/components/common/messageservice.ts b/dashboard/src/app/components/common/messageservice.ts deleted file mode 100644 index fae5e0de1..000000000 --- a/dashboard/src/app/components/common/messageservice.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Subject } from 'rxjs/Subject'; -import { Observable } from 'rxjs/Observable'; -import { Message } from './message'; - -@Injectable() -export class MessageService { - - private messageSource = new Subject(); - - messageObserver = this.messageSource.asObservable(); - - add(message: Message) { - if(message) { - this.messageSource.next(message); - } - } - - addAll(messages: Message[]) { - if(messages && messages.length) { - this.messageSource.next(messages); - } - } - - clear() { - this.messageSource.next(null); - } -} \ No newline at end of file diff --git a/dashboard/src/app/components/common/selectitem.ts b/dashboard/src/app/components/common/selectitem.ts deleted file mode 100644 index 37f427ac6..000000000 --- a/dashboard/src/app/components/common/selectitem.ts +++ /dev/null @@ -1,7 +0,0 @@ -export interface SelectItem { - label?: string; - value: any; - styleClass?: string; - icon?: string; - title?: string; -} \ No newline at end of file diff --git a/dashboard/src/app/components/common/selectitemgroup.ts b/dashboard/src/app/components/common/selectitemgroup.ts deleted file mode 100644 index 73f01d2bf..000000000 --- a/dashboard/src/app/components/common/selectitemgroup.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { SelectItem } from './selectitem'; - -export interface SelectItemGroup { - label: string; - value?: any; - items: SelectItem[]; -} \ No newline at end of file diff --git a/dashboard/src/app/components/common/shared.ts b/dashboard/src/app/components/common/shared.ts deleted file mode 100644 index 949e8ba3e..000000000 --- a/dashboard/src/app/components/common/shared.ts +++ /dev/null @@ -1,153 +0,0 @@ -import {NgModule,EventEmitter,Directive,ViewContainerRef,Input,Output,ContentChildren,ContentChild,TemplateRef,OnInit,OnChanges,OnDestroy,AfterContentInit,QueryList,SimpleChanges,EmbeddedViewRef} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {Component} from '@angular/core'; - -@Component({ - selector: 'p-header', - template: '' -}) -export class Header {} - -@Component({ - selector: 'p-footer', - template: '' -}) -export class Footer {} - -@Directive({ - selector: '[pTemplate]', - host: { - } -}) -export class PrimeTemplate { - - @Input() type: string; - - @Input('pTemplate') name: string; - - constructor(public template: TemplateRef) {} - - getType(): string { - return this.name; - } -} - -/* Deprecated */ -@Component({ - selector: 'p-column', - template: '' -}) -export class Column implements AfterContentInit{ - @Input() field: string; - @Input() colId: string; - @Input() sortField: string; - @Input() filterField: string; - @Input() header: string; - @Input() footer: string; - @Input() sortable: any; - @Input() editable: boolean; - @Input() filter: boolean; - @Input() filterMatchMode: string; - @Input() filterType: string = 'text'; - @Input() excludeGlobalFilter: boolean; - @Input() rowspan: number; - @Input() colspan: number; - @Input() scope: string; - @Input() style: any; - @Input() styleClass: string; - @Input() exportable: boolean = true; - @Input() headerStyle: any; - @Input() headerStyleClass: string; - @Input() bodyStyle: any; - @Input() bodyStyleClass: string; - @Input() footerStyle: any; - @Input() footerStyleClass: string; - @Input() hidden: boolean; - @Input() expander: boolean; - @Input() selectionMode: string; - @Input() filterPlaceholder: string; - @Input() filterMaxlength: number; - @Input() frozen: boolean; - @Input() resizable: boolean = true; - @Output() sortFunction: EventEmitter = new EventEmitter(); - @ContentChildren(PrimeTemplate) templates: QueryList; - @ContentChild(TemplateRef) template: TemplateRef; - - public headerTemplate: TemplateRef; - public bodyTemplate: TemplateRef; - public footerTemplate: TemplateRef; - public filterTemplate: TemplateRef; - public editorTemplate: TemplateRef; - - ngAfterContentInit():void { - this.templates.forEach((item) => { - switch(item.getType()) { - case 'header': - this.headerTemplate = item.template; - break; - - case 'body': - this.bodyTemplate = item.template; - break; - - case 'footer': - this.footerTemplate = item.template; - break; - - case 'filter': - this.filterTemplate = item.template; - break; - - case 'editor': - this.editorTemplate = item.template; - break; - - default: - this.bodyTemplate = item.template; - break; - } - }); - } -} - -/* Deprecated */ -@Component({ - selector: 'p-row', - template: `` -}) -export class Row { - - @ContentChildren(Column) columns: QueryList; - -} - -/* Deprecated */ -@Component({ - selector: 'p-headerColumnGroup', - template: `` -}) -export class HeaderColumnGroup { - - @Input() frozen: boolean; - - @ContentChildren(Row) rows: QueryList; -} - -/* Deprecated */ -@Component({ - selector: 'p-footerColumnGroup', - template: `` -}) -export class FooterColumnGroup { - - @Input() frozen: boolean; - - @ContentChildren(Row) rows: QueryList; -} - -@NgModule({ - imports: [CommonModule], - exports: [Header,Footer,Column,PrimeTemplate,Row,HeaderColumnGroup,FooterColumnGroup], - declarations: [Header,Footer,Column,PrimeTemplate,Row,HeaderColumnGroup,FooterColumnGroup] -}) -export class SharedModule { } diff --git a/dashboard/src/app/components/common/sortevent.ts b/dashboard/src/app/components/common/sortevent.ts deleted file mode 100644 index 5064eedb8..000000000 --- a/dashboard/src/app/components/common/sortevent.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { SortMeta } from './sortmeta'; - -export interface SortEvent { - data?: any[]; - mode?: string; - field?: string; - order?: number; - multiSortMeta?: SortMeta[]; -} \ No newline at end of file diff --git a/dashboard/src/app/components/common/sortmeta.ts b/dashboard/src/app/components/common/sortmeta.ts deleted file mode 100644 index 7b2c7e22f..000000000 --- a/dashboard/src/app/components/common/sortmeta.ts +++ /dev/null @@ -1,4 +0,0 @@ -export interface SortMeta { - field: string; - order: number; -} \ No newline at end of file diff --git a/dashboard/src/app/components/common/treedragdropservice.ts b/dashboard/src/app/components/common/treedragdropservice.ts deleted file mode 100644 index d19bf4a80..000000000 --- a/dashboard/src/app/components/common/treedragdropservice.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Subject } from 'rxjs/Subject'; -import { Observable } from 'rxjs/Observable'; -import { TreeNode } from './treenode'; -import { TreeNodeDragEvent } from './treenodedragevent'; - -@Injectable() -export class TreeDragDropService { - - private dragStartSource = new Subject(); - private dragStopSource = new Subject(); - - dragStart$ = this.dragStartSource.asObservable(); - dragStop$ = this.dragStopSource.asObservable(); - - startDrag(event: TreeNodeDragEvent) { - this.dragStartSource.next(event); - } - - stopDrag(event: TreeNodeDragEvent) { - this.dragStopSource.next(event); - } -} \ No newline at end of file diff --git a/dashboard/src/app/components/common/treenode.ts b/dashboard/src/app/components/common/treenode.ts deleted file mode 100644 index 42016563c..000000000 --- a/dashboard/src/app/components/common/treenode.ts +++ /dev/null @@ -1,17 +0,0 @@ -export interface TreeNode { - label?: string; - data?: any; - icon?: any; - expandedIcon?: any; - collapsedIcon?: any; - children?: TreeNode[]; - leaf?: boolean; - expanded?: boolean; - type?: string; - parent?: TreeNode; - partialSelected?: boolean; - styleClass?: string; - draggable?: boolean; - droppable?: boolean; - selectable?: boolean; -} \ No newline at end of file diff --git a/dashboard/src/app/components/common/treenodedragevent.ts b/dashboard/src/app/components/common/treenodedragevent.ts deleted file mode 100644 index 0509cfa3b..000000000 --- a/dashboard/src/app/components/common/treenodedragevent.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { TreeNode } from './treenode'; - -export interface TreeNodeDragEvent { - tree?: any; - node?: TreeNode; - subNodes?: TreeNode[]; - index?: number; - scope?: any; -} \ No newline at end of file diff --git a/dashboard/src/app/components/confirmdialog/confirmdialog.spec.ts b/dashboard/src/app/components/confirmdialog/confirmdialog.spec.ts deleted file mode 100644 index 76dea012e..000000000 --- a/dashboard/src/app/components/confirmdialog/confirmdialog.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { ConfirmDialog } from './confirmdialog'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('ConfirmDialog', () => { - - let confirmdialog: ConfirmDialog; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - ConfirmDialog - ] - }); - - fixture = TestBed.createComponent(ConfirmDialog); - confirmdialog = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/confirmdialog/confirmdialog.ts b/dashboard/src/app/components/confirmdialog/confirmdialog.ts deleted file mode 100644 index e497c29bd..000000000 --- a/dashboard/src/app/components/confirmdialog/confirmdialog.ts +++ /dev/null @@ -1,314 +0,0 @@ -import {NgModule,Component,ElementRef,AfterViewInit,OnDestroy,Input,Output,AfterViewChecked,EventEmitter,Renderer2,ContentChild,NgZone} from '@angular/core'; -import {trigger,state,style,transition,animate} from '@angular/animations'; -import {CommonModule} from '@angular/common'; -import {DomHandler} from '../dom/domhandler'; -import {Header,Footer,SharedModule} from '../common/shared'; -import {ButtonModule} from '../button/button'; -import {Confirmation} from '../common/confirmation'; -import {ConfirmationService} from '../common/confirmationservice'; -import {Subscription} from 'rxjs/Subscription'; - -@Component({ - selector: 'p-confirmDialog', - template: ` -
-
- {{header}} - - - -
-
- -
-
- - -
- `, - animations: [ - trigger('dialogState', [ - state('hidden', style({ - opacity: 0 - })), - state('visible', style({ - opacity: 1 - })), - transition('visible => hidden', animate('400ms ease-in')), - transition('hidden => visible', animate('400ms ease-out')) - ]) - ], - providers: [DomHandler] -}) -export class ConfirmDialog implements AfterViewInit,AfterViewChecked,OnDestroy { - - @Input() header: string; - - @Input() isWarning: boolean = false; - - @Input() icon: string = 'fa'; - - @Input() message: string; - - @Input() acceptIcon: string; - - @Input() acceptLabel: string = 'Confirm'; - - @Input() acceptVisible: boolean = true; - - @Input() rejectIcon: string; - - @Input() rejectLabel: string = 'Cancel'; - - @Input() rejectVisible: boolean = true; - - @Input() acceptButtonStyleClass: string; - - @Input() rejectButtonStyleClass: string; - - @Input() width: any; - - @Input() height: any; - - @Input() closeOnEscape: boolean = true; - - @Input() rtl: boolean; - - @Input() closable: boolean = true; - - @Input() responsive: boolean = true; - - @Input() appendTo: any; - - @Input() key: string; - - @ContentChild(Footer) footer; - - confirmation: Confirmation; - - _visible: boolean; - - documentEscapeListener: any; - - documentResponsiveListener: any; - - mask: any; - - contentContainer: any; - - positionInitialized: boolean; - - subscription: Subscription; - - executePostShowActions: boolean; - - constructor(public el: ElementRef, public domHandler: DomHandler, - public renderer: Renderer2, private confirmationService: ConfirmationService, public zone: NgZone) { - this.subscription = confirmationService.requireConfirmation$.subscribe(confirmation => { - if(confirmation.key === this.key) { - this.confirmation = confirmation; - this.message = this.confirmation.message||this.message; - this.icon = this.confirmation.icon||this.icon; - this.isWarning = this.confirmation.isWarning||this.isWarning; - this.acceptLabel = this.confirmation.acceptLabel||this.acceptLabel; - this.rejectLabel = this.confirmation.rejectLabel||this.rejectLabel; - this.header = this.confirmation.header||this.header; - this.rejectVisible = this.confirmation.rejectVisible == null ? this.rejectVisible : this.confirmation.rejectVisible; - this.acceptVisible = this.confirmation.acceptVisible == null ? this.acceptVisible : this.confirmation.acceptVisible; - - if(this.confirmation.accept) { - this.confirmation.acceptEvent = new EventEmitter(); - this.confirmation.acceptEvent.subscribe(this.confirmation.accept); - } - - if(this.confirmation.reject) { - this.confirmation.rejectEvent = new EventEmitter(); - this.confirmation.rejectEvent.subscribe(this.confirmation.reject); - } - - this.visible = true; - } - }); - } - - @Input() get visible(): boolean { - return this._visible; - } - - set visible(val:boolean) { - this._visible = val; - - if(this._visible) { - if(!this.positionInitialized) { - this.center(); - this.positionInitialized = true; - } - - this.el.nativeElement.children[0].style.zIndex = ++DomHandler.zindex; - this.bindGlobalListeners(); - this.executePostShowActions = true; - } - - if(this._visible) - this.enableModality(); - else - this.disableModality(); - } - - ngAfterViewInit() { - this.contentContainer = this.domHandler.findSingle(this.el.nativeElement, '.ui-dialog-content'); - - if(this.appendTo) { - if(this.appendTo === 'body') - document.body.appendChild(this.el.nativeElement); - else - this.domHandler.appendChild(this.el.nativeElement, this.appendTo); - } - } - - ngAfterViewChecked() { - if(this.executePostShowActions) { - this.domHandler.findSingle(this.el.nativeElement.children[0], 'button').focus(); - this.executePostShowActions = false; - } - } - - center() { - let container = this.el.nativeElement.children[0]; - let elementWidth = this.domHandler.getOuterWidth(container); - let elementHeight = this.domHandler.getOuterHeight(container); - if(elementWidth == 0 && elementHeight == 0) { - container.style.visibility = 'hidden'; - container.style.display = 'block'; - elementWidth = this.domHandler.getOuterWidth(container); - elementHeight = this.domHandler.getOuterHeight(container); - container.style.display = 'none'; - container.style.visibility = 'visible'; - } - let viewport = this.domHandler.getViewport(); - let x = (viewport.width - elementWidth) / 2; - let y = (viewport.height - elementHeight) / 2; - - container.style.left = x + 'px'; - container.style.top = y + 'px'; - } - - enableModality() { - if(!this.mask) { - this.mask = document.createElement('div'); - this.mask.style.zIndex = this.el.nativeElement.children[0].style.zIndex - 1; - this.domHandler.addMultipleClasses(this.mask, 'ui-widget-overlay ui-dialog-mask'); - document.body.appendChild(this.mask); - this.domHandler.addClass(document.body, 'ui-overflow-hidden'); - } - } - - disableModality() { - if(this.mask) { - document.body.removeChild(this.mask); - this.domHandler.removeClass(document.body, 'ui-overflow-hidden'); - this.mask = null; - } - } - - close(event: Event) { - if(this.confirmation.rejectEvent) { - this.confirmation.rejectEvent.emit(); - } - - this.hide(); - this.isWarning = false; - event.preventDefault(); - } - - hide() { - this.visible = false; - this.unbindGlobalListeners(); - } - - moveOnTop() { - this.el.nativeElement.children[0].style.zIndex = ++DomHandler.zindex; - } - - bindGlobalListeners() { - if(this.closeOnEscape && this.closable && !this.documentEscapeListener) { - this.documentEscapeListener = this.renderer.listen('document', 'keydown', (event) => { - if(event.which == 27) { - if(this.el.nativeElement.children[0].style.zIndex == DomHandler.zindex && this.visible) { - this.close(event); - } - } - }); - } - - if(this.responsive) { - this.zone.runOutsideAngular(() => { - this.documentResponsiveListener = this.center.bind(this); - window.addEventListener('resize', this.documentResponsiveListener); - }); - } - } - - unbindGlobalListeners() { - if(this.documentEscapeListener) { - this.documentEscapeListener(); - this.documentEscapeListener = null; - } - - if(this.documentResponsiveListener) { - window.removeEventListener('resize', this.documentResponsiveListener); - this.documentResponsiveListener = null; - } - } - - ngOnDestroy() { - this.disableModality(); - - if(this.documentResponsiveListener) { - this.documentResponsiveListener(); - } - - if(this.documentEscapeListener) { - this.documentEscapeListener(); - } - - if(this.appendTo && this.appendTo === 'body') { - document.body.removeChild(this.el.nativeElement); - } - - this.subscription.unsubscribe(); - } - - accept() { - if(this.confirmation.acceptEvent) { - this.confirmation.acceptEvent.emit(); - } - - this.hide(); - this.isWarning = false; - this.confirmation = null; - } - - reject() { - if(this.confirmation.rejectEvent) { - this.confirmation.rejectEvent.emit(); - } - - this.hide(); - this.isWarning = false; - this.confirmation = null; - } -} - -@NgModule({ - imports: [CommonModule,ButtonModule], - exports: [ConfirmDialog,ButtonModule,SharedModule], - declarations: [ConfirmDialog] -}) -export class ConfirmDialogModule { } \ No newline at end of file diff --git a/dashboard/src/app/components/contextmenu/contextmenu.css b/dashboard/src/app/components/contextmenu/contextmenu.css deleted file mode 100644 index 67ca57665..000000000 --- a/dashboard/src/app/components/contextmenu/contextmenu.css +++ /dev/null @@ -1,44 +0,0 @@ -.ui-contextmenu { - width: 12.5em; - padding: .25em; - position: absolute; - display: none; -} - -.ui-contextmenu .ui-menu-separator { - border-width: 1px 0 0 0; -} - -.ui-contextmenu ul { - list-style: none; - margin: 0; - padding: 0; -} - -.ui-contextmenu .ui-submenu-list { - display: none; - position: absolute; - width: 12.5em; - padding: .25em; -} - -.ui-contextmenu .ui-menuitem-link { - padding: .25em; - display: block; - position: relative; -} - -.ui-contextmenu .ui-menuitem { - position: relative; -} - -.ui-contextmenu .ui-menuitem-link .ui-submenu-icon { - position: absolute; - margin-top: -.5em; - right: 0; - top: 50%; -} - -.ui-contextmenu .ui-menuitem-active > .ui-submenu > .ui-submenu-list { - display: block !important; -} \ No newline at end of file diff --git a/dashboard/src/app/components/contextmenu/contextmenu.spec.ts b/dashboard/src/app/components/contextmenu/contextmenu.spec.ts deleted file mode 100644 index f2cccb76e..000000000 --- a/dashboard/src/app/components/contextmenu/contextmenu.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { ContextMenu } from './contextmenu'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('Accordion', () => { - - let contextmenu: ContextMenu; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - ContextMenu - ] - }); - - fixture = TestBed.createComponent(ContextMenu); - contextmenu = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/contextmenu/contextmenu.ts b/dashboard/src/app/components/contextmenu/contextmenu.ts deleted file mode 100644 index dfbc0024f..000000000 --- a/dashboard/src/app/components/contextmenu/contextmenu.ts +++ /dev/null @@ -1,284 +0,0 @@ -import {NgModule,Component,ElementRef,AfterViewInit,OnDestroy,Input,Output,Renderer2,Inject,forwardRef,ViewChild} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {DomHandler} from '../dom/domhandler'; -import {MenuItem} from '../common/menuitem'; -import {Location} from '@angular/common'; -import {RouterModule} from '@angular/router'; - -@Component({ - selector: 'p-contextMenuSub', - template: ` - - `, - providers: [DomHandler] -}) -export class ContextMenuSub { - - @Input() item: MenuItem; - - @Input() root: boolean; - - constructor(public domHandler: DomHandler, @Inject(forwardRef(() => ContextMenu)) public contextMenu: ContextMenu) {} - - activeItem: any; - - containerLeft: any; - - hideTimeout: any; - - onItemMouseEnter(event, item, menuitem) { - if(menuitem.disabled) { - return; - } - - if(this.hideTimeout) { - clearTimeout(this.hideTimeout); - this.hideTimeout = null; - } - - this.activeItem = item; - let nextElement = item.children[0].nextElementSibling; - if(nextElement) { - let sublist = nextElement.children[0]; - sublist.style.zIndex = ++DomHandler.zindex; - this.position(sublist, item); - } - } - - onItemMouseLeave(event, link) { - this.hideTimeout = setTimeout(() => { - this.activeItem = null; - }, 1000); - } - - itemClick(event, item: MenuItem) { - if(item.disabled) { - event.preventDefault(); - return; - } - - if(!item.url) { - event.preventDefault(); - } - - if(item.command) { - item.command({ - originalEvent: event, - item: item - }); - } - } - - listClick(event) { - this.activeItem = null; - } - - position(sublist, item) { - this.containerLeft = this.domHandler.getOffset(item.parentElement) - let viewport = this.domHandler.getViewport(); - let sublistWidth = sublist.offsetParent ? sublist.offsetWidth: this.domHandler.getHiddenElementOuterWidth(sublist); - let itemOuterWidth = this.domHandler.getOuterWidth(item.children[0]); - - sublist.style.top = '0px'; - - if((parseInt(this.containerLeft.left) + itemOuterWidth + sublistWidth) > (viewport.width - this.calculateScrollbarWidth())) { - sublist.style.left = -sublistWidth + 'px'; - } - else { - sublist.style.left = itemOuterWidth + 'px'; - } - } - - calculateScrollbarWidth(): number { - let scrollDiv = document.createElement("div"); - scrollDiv.className = "ui-scrollbar-measure"; - document.body.appendChild(scrollDiv); - - let scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth; - document.body.removeChild(scrollDiv); - - return scrollbarWidth; - } -} - -@Component({ - selector: 'p-contextMenu', - template: ` -
- -
- `, - providers: [DomHandler] -}) -export class ContextMenu implements AfterViewInit,OnDestroy { - - @Input() model: MenuItem[]; - - @Input() global: boolean; - - @Input() target: any; - - @Input() style: any; - - @Input() styleClass: string; - - @Input() appendTo: any; - - @Input() autoZIndex: boolean = true; - - @Input() baseZIndex: number = 0; - - @ViewChild('container') containerViewChild: ElementRef; - - documentClickListener: any; - - rightClickListener: any; - - constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer2) {} - - ngAfterViewInit() { - if(this.global) { - this.rightClickListener = this.renderer.listen('document', 'contextmenu', (event) => { - this.show(event); - event.preventDefault(); - }); - } - else if(this.target) { - this.rightClickListener = this.renderer.listen(this.target, 'contextmenu', (event) => { - this.show(event); - event.preventDefault(); - event.stopPropagation(); - }); - } - - if(this.appendTo) { - if(this.appendTo === 'body') - document.body.appendChild( this.containerViewChild.nativeElement); - else - this.domHandler.appendChild(this.containerViewChild.nativeElement, this.appendTo); - } - } - - show(event?: MouseEvent) { - this.position(event); - this.moveOnTop(); - this.containerViewChild.nativeElement.style.display = 'block'; - this.domHandler.fadeIn(this.containerViewChild.nativeElement, 250); - this.bindDocumentClickListener(); - - if(event) { - event.preventDefault(); - } - } - - hide() { - this.containerViewChild.nativeElement.style.display = 'none'; - this.unbindDocumentClickListener(); - } - - moveOnTop() { - if(this.autoZIndex) { - this.containerViewChild.nativeElement.style.zIndex = String(this.baseZIndex + (++DomHandler.zindex)); - } - } - - toggle(event?: MouseEvent) { - if(this.containerViewChild.nativeElement.offsetParent) - this.hide(); - else - this.show(event); - } - - position(event?: MouseEvent) { - if(event) { - let left = event.pageX + 1; - let top = event.pageY + 1; - let width = this.containerViewChild.nativeElement.offsetParent ? this.containerViewChild.nativeElement.offsetWidth: this.domHandler.getHiddenElementOuterWidth(this.containerViewChild.nativeElement); - let height = this.containerViewChild.nativeElement.offsetParent ? this.containerViewChild.nativeElement.offsetHeight: this.domHandler.getHiddenElementOuterHeight(this.containerViewChild.nativeElement); - let viewport = this.domHandler.getViewport(); - - //flip - if(left + width - document.body.scrollLeft > viewport.width) { - left -= width; - } - - //flip - if(top + height - document.body.scrollTop > viewport.height) { - top -= height; - } - - //fit - if(left < document.body.scrollLeft) { - left = document.body.scrollLeft; - } - - //fit - if(top < document.body.scrollTop) { - top = document.body.scrollTop; - } - - this.containerViewChild.nativeElement.style.left = left + 'px'; - this.containerViewChild.nativeElement.style.top = top + 'px'; - } - } - - bindDocumentClickListener() { - if(!this.documentClickListener) { - this.documentClickListener = this.renderer.listen('document', 'click', (event) => { - if (this.containerViewChild.nativeElement.offsetParent && event.button !== 2) { - this.hide(); - } - }); - } - } - - unbindDocumentClickListener() { - if(this.documentClickListener) { - this.documentClickListener(); - this.documentClickListener = null; - } - } - - ngOnDestroy() { - this.unbindDocumentClickListener(); - - if(this.rightClickListener) { - this.rightClickListener(); - } - - if(this.appendTo) { - this.el.nativeElement.appendChild(this.containerViewChild.nativeElement); - } - } - -} - -@NgModule({ - imports: [CommonModule,RouterModule], - exports: [ContextMenu,RouterModule], - declarations: [ContextMenu,ContextMenuSub] -}) -export class ContextMenuModule { } \ No newline at end of file diff --git a/dashboard/src/app/components/datagrid/datagrid.css b/dashboard/src/app/components/datagrid/datagrid.css deleted file mode 100644 index 99cc3d41b..000000000 --- a/dashboard/src/app/components/datagrid/datagrid.css +++ /dev/null @@ -1,34 +0,0 @@ -.ui-datagrid .ui-paginator { - text-align: center; -} - -.ui-datagrid-column { - padding: .25em; -} - -.ui-datagrid-content-empty { - padding: .25em .625em; -} - -.ui-datagrid .ui-datagrid-header, -.ui-datagrid .ui-datagrid-footer { - text-align:center; - padding: .5em .75em; -} - -.ui-datagrid .ui-datagrid-header { - border-bottom: 0 none; -} - -.ui-datagrid .ui-datagrid-footer { - border-top: 0 none; -} - -.ui-datagrid .ui-paginator-top { - border-bottom: 0 none; -} - -.ui-datagrid .ui-paginator-bottom { - border-top: 0 none; -} - diff --git a/dashboard/src/app/components/datagrid/datagrid.spec.ts b/dashboard/src/app/components/datagrid/datagrid.spec.ts deleted file mode 100644 index 26fef3ec4..000000000 --- a/dashboard/src/app/components/datagrid/datagrid.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { DataGrid } from './datagrid'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('DataGrid', () => { - - let datagrid: DataGrid; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - DataGrid - ] - }); - - fixture = TestBed.createComponent(DataGrid); - datagrid = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/datagrid/datagrid.ts b/dashboard/src/app/components/datagrid/datagrid.ts deleted file mode 100644 index ab4da1b09..000000000 --- a/dashboard/src/app/components/datagrid/datagrid.ts +++ /dev/null @@ -1,205 +0,0 @@ -import {NgModule,Component,ElementRef,AfterViewInit,AfterContentInit,DoCheck,OnDestroy,Input,Output,SimpleChange,EventEmitter,ContentChild,ContentChildren,QueryList,TemplateRef,IterableDiffers} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {Header,Footer,PrimeTemplate,SharedModule} from '../common/shared'; -import {PaginatorModule} from '../paginator/paginator'; -import {BlockableUI} from '../common/blockableui'; - -@Component({ - selector: 'p-dataGrid', - template: ` -
-
- -
- -
-
- -
{{emptyMessage}}
-
-
- - -
- ` -}) -export class DataGrid implements AfterViewInit,AfterContentInit,DoCheck,BlockableUI { - - @Input() paginator: boolean; - - @Input() rows: number; - - @Input() totalRecords: number; - - @Input() pageLinks: number = 5; - - @Input() rowsPerPageOptions: number[]; - - @Input() lazy: boolean; - - @Input() emptyMessage: string = 'No records found'; - - @Output() onLazyLoad: EventEmitter = new EventEmitter(); - - @Input() style: any; - - @Input() styleClass: string; - - @Input() paginatorPosition: string = 'bottom'; - - @Input() alwaysShowPaginator: boolean = true; - - @Input() trackBy: Function = (index: number, item: any) => item; - - @Input() immutable: boolean = true; - - @Input() paginatorDropdownAppendTo: any; - - @Output() onPage: EventEmitter = new EventEmitter(); - - @ContentChild(Header) header; - - @ContentChild(Footer) footer; - - @ContentChildren(PrimeTemplate) templates: QueryList; - - _value: any[]; - - itemTemplate: TemplateRef; - - dataToRender: any[]; - - first: number = 0; - - page: number = 0; - - differ: any; - - constructor(public el: ElementRef, public differs: IterableDiffers) { - this.differ = differs.find([]).create(null); - } - - ngAfterViewInit() { - if(this.lazy) { - this.onLazyLoad.emit({ - first: this.first, - rows: this.rows - }); - } - } - - ngAfterContentInit() { - this.templates.forEach((item) => { - switch(item.getType()) { - case 'item': - this.itemTemplate = item.template; - break; - - default: - this.itemTemplate = item.template; - break; - } - }); - } - - @Input() get value(): any[] { - return this._value; - } - - set value(val:any[]) { - this._value = val; - - if(this.immutable) { - this.handleDataChange(); - } - } - - handleDataChange() { - if(this.paginator) { - this.updatePaginator(); - } - this.updateDataToRender(this.value); - } - - ngDoCheck() { - if(!this.immutable) { - let changes = this.differ.diff(this.value); - if(changes) { - this.handleDataChange(); - } - } - } - - updatePaginator() { - //total records - this.totalRecords = this.lazy ? this.totalRecords : (this.value ? this.value.length: 0); - - //first - if(this.totalRecords && this.first >= this.totalRecords) { - let numberOfPages = Math.ceil(this.totalRecords/this.rows); - this.first = Math.max((numberOfPages-1) * this.rows, 0); - } - } - - paginate(event) { - this.first = event.first; - this.rows = event.rows; - - if(this.lazy) { - this.onLazyLoad.emit(this.createLazyLoadMetadata()); - } - else { - this.updateDataToRender(this.value); - } - - this.onPage.emit({ - first: this.first, - rows: this.rows - }); - } - - updateDataToRender(datasource) { - if(this.paginator && datasource) { - this.dataToRender = []; - let startIndex = this.lazy ? 0 : this.first; - for(let i = startIndex; i < (startIndex+ this.rows); i++) { - if(i >= datasource.length) { - break; - } - - this.dataToRender.push(datasource[i]); - } - } - else { - this.dataToRender = datasource; - } - } - - isEmpty() { - return !this.dataToRender||(this.dataToRender.length == 0); - } - - createLazyLoadMetadata(): any { - return { - first: this.first, - rows: this.rows - }; - } - - getBlockableElement(): HTMLElement { - return this.el.nativeElement.children[0]; - } -} - -@NgModule({ - imports: [CommonModule,SharedModule,PaginatorModule], - exports: [DataGrid,SharedModule], - declarations: [DataGrid] -}) -export class DataGridModule { } diff --git a/dashboard/src/app/components/datalist/datalist.css b/dashboard/src/app/components/datalist/datalist.css deleted file mode 100644 index f24cdcab3..000000000 --- a/dashboard/src/app/components/datalist/datalist.css +++ /dev/null @@ -1,39 +0,0 @@ -.ui-datalist .ui-datalist-header, -.ui-datalist .ui-datalist-footer { - text-align:center; - padding: .5em .75em; -} - -.ui-datalist .ui-datalist-header { - border-bottom: 0 none; -} - -.ui-datalist .ui-datalist-footer { - border-top: 0 none; -} - -.ui-datalist .ui-datalist-data { - margin: 0; - padding: 0; -} - -.ui-datalist .ui-datalist-data > li { - list-style-type: none; - -} - -.ui-datalist .ui-datalist-emptymessage { - padding: .5em .75em; -} - -.ui-datalist.ui-datalist-scrollable .ui-datalist-content { - overflow: auto; -} - -.ui-datalist .ui-paginator-top { - border-bottom: 0 none; -} - -.ui-datalist .ui-paginator-bottom { - border-top: 0 none; -} diff --git a/dashboard/src/app/components/datalist/datalist.spec.ts b/dashboard/src/app/components/datalist/datalist.spec.ts deleted file mode 100644 index 00968f70c..000000000 --- a/dashboard/src/app/components/datalist/datalist.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { DataList } from './datalist'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('DataList', () => { - - let datalist: DataList; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - DataList - ] - }); - - fixture = TestBed.createComponent(DataList); - datalist = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/datalist/datalist.ts b/dashboard/src/app/components/datalist/datalist.ts deleted file mode 100644 index 2512372b1..000000000 --- a/dashboard/src/app/components/datalist/datalist.ts +++ /dev/null @@ -1,211 +0,0 @@ -import {NgModule,Component,ElementRef,AfterViewInit,AfterContentInit,DoCheck,OnDestroy,Input,Output,SimpleChange,EventEmitter,ContentChild,ContentChildren,TemplateRef,QueryList,IterableDiffers} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {SharedModule,Header,Footer,PrimeTemplate} from '../common/shared'; -import {PaginatorModule} from '../paginator/paginator'; -import {BlockableUI} from '../common/blockableui'; - -@Component({ - selector: 'p-dataList', - template: ` -
-
- -
- -
-
{{emptyMessage}}
-
    -
  • - -
  • -
-
- - -
- ` -}) -export class DataList implements AfterViewInit,AfterContentInit,DoCheck,BlockableUI { - - @Input() paginator: boolean; - - @Input() rows: number; - - @Input() totalRecords: number; - - @Input() pageLinks: number = 5; - - @Input() rowsPerPageOptions: number[]; - - @Input() lazy: boolean; - - @Output() onLazyLoad: EventEmitter = new EventEmitter(); - - @Input() style: any; - - @Input() styleClass: string; - - @Input() paginatorPosition: string = 'bottom'; - - @Input() emptyMessage: string = 'No records found'; - - @Input() alwaysShowPaginator: boolean = true; - - @Input() trackBy: Function = (index: number, item: any) => item; - - @Input() immutable: boolean = true; - - @Input() scrollable: boolean; - - @Input() scrollHeight: string; - - @Input() paginatorDropdownAppendTo: any; - - @Output() onPage: EventEmitter = new EventEmitter(); - - @ContentChild(Header) header; - - @ContentChild(Footer) footer; - - @ContentChildren(PrimeTemplate) templates: QueryList; - - public _value: any[]; - - public itemTemplate: TemplateRef; - - public dataToRender: any[]; - - public first: number = 0; - - public page: number = 0; - - differ: any; - - constructor(public el: ElementRef, public differs: IterableDiffers) { - this.differ = differs.find([]).create(null); - } - - ngAfterContentInit() { - this.templates.forEach((item) => { - switch(item.getType()) { - case 'item': - this.itemTemplate = item.template; - break; - - default: - this.itemTemplate = item.template; - break; - } - }); - } - - ngAfterViewInit() { - if(this.lazy) { - this.onLazyLoad.emit({ - first: this.first, - rows: this.rows - }); - } - } - - @Input() get value(): any[] { - return this._value; - } - - set value(val:any[]) { - this._value = val; - - if(this.immutable) { - this.handleDataChange(); - } - } - - handleDataChange() { - if(this.paginator) { - this.updatePaginator(); - } - this.updateDataToRender(this.value); - } - - ngDoCheck() { - if(!this.immutable) { - let changes = this.differ.diff(this.value); - if(changes) { - this.handleDataChange(); - } - } - } - - updatePaginator() { - //total records - this.totalRecords = this.lazy ? this.totalRecords : (this.value ? this.value.length: 0); - - //first - if(this.totalRecords && this.first >= this.totalRecords) { - let numberOfPages = Math.ceil(this.totalRecords/this.rows); - this.first = Math.max((numberOfPages-1) * this.rows, 0); - } - } - - paginate(event) { - this.first = event.first; - this.rows = event.rows; - - if(this.lazy) { - this.onLazyLoad.emit(this.createLazyLoadMetadata()); - } - else { - this.updateDataToRender(this.value); - } - - this.onPage.emit({ - first: this.first, - rows: this.rows - }); - } - - updateDataToRender(datasource) { - if(this.paginator && datasource) { - this.dataToRender = []; - let startIndex = this.lazy ? 0 : this.first; - for(let i = startIndex; i < (startIndex+ this.rows); i++) { - if(i >= datasource.length) { - break; - } - - this.dataToRender.push(datasource[i]); - } - } - else { - this.dataToRender = datasource; - } - } - - isEmpty() { - return !this.dataToRender||(this.dataToRender.length == 0); - } - - createLazyLoadMetadata(): any { - return { - first: this.first, - rows: this.rows - }; - } - - getBlockableElement(): HTMLElement { - return this.el.nativeElement.children[0]; - } -} - -@NgModule({ - imports: [CommonModule,PaginatorModule], - exports: [DataList,SharedModule], - declarations: [DataList] -}) -export class DataListModule { } diff --git a/dashboard/src/app/components/datascroller/datascroller.css b/dashboard/src/app/components/datascroller/datascroller.css deleted file mode 100644 index eefe766a8..000000000 --- a/dashboard/src/app/components/datascroller/datascroller.css +++ /dev/null @@ -1,28 +0,0 @@ -.ui-datascroller { -} - -.ui-datascroller .ui-datascroller-header { - text-align: center; - padding: .5em .75em; - border-bottom: 0 none; -} - -.ui-datascroller .ui-datascroller-footer { - text-align: center; - padding: .25em .625em; - border-top: 0px none; -} - -.ui-datascroller .ui-datascroller-content { - padding: .25em .625em; -} - -.ui-datascroller-inline .ui-datascroller-content { - overflow: auto; -} - -.ui-datascroller .ui-datascroller-list { - list-style-type: none; - margin: 0; - padding: 0; -} \ No newline at end of file diff --git a/dashboard/src/app/components/datascroller/datascroller.spec.ts b/dashboard/src/app/components/datascroller/datascroller.spec.ts deleted file mode 100644 index 90ef8659a..000000000 --- a/dashboard/src/app/components/datascroller/datascroller.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { DataScroller } from './datascroller'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('DataScroller', () => { - - let datascroller: DataScroller; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - DataScroller - ] - }); - - fixture = TestBed.createComponent(DataScroller); - datascroller = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/datascroller/datascroller.ts b/dashboard/src/app/components/datascroller/datascroller.ts deleted file mode 100644 index b1efd109f..000000000 --- a/dashboard/src/app/components/datascroller/datascroller.ts +++ /dev/null @@ -1,203 +0,0 @@ -import {NgModule,Component,ElementRef,OnInit,AfterViewInit,AfterContentInit,DoCheck,OnDestroy,Input,Output,Renderer2,NgZone,ViewChild,EventEmitter,ContentChild,ContentChildren,QueryList,TemplateRef} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {Header,Footer,PrimeTemplate,SharedModule} from '../common/shared'; -import {DomHandler} from '../dom/domhandler'; - -@Component({ - selector: 'p-dataScroller', - template:` -
-
- -
-
-
    -
  • - -
  • -
-
- -
- `, - providers: [DomHandler] -}) -export class DataScroller implements OnInit,AfterViewInit,OnDestroy { - - @Input() value: any[]; - - @Input() rows: number; - - @Input() lazy: boolean; - - @Input() style: any; - - @Input() styleClass: string; - - @Input() buffer: number = 0.9; - - @Input() inline: boolean; - - @Input() scrollHeight: any; - - @Input() loader: any; - - @Input() totalRecords: number; - - @Input() trackBy: Function = (index: number, item: any) => item; - - @ContentChild(Header) header; - - @ContentChild(Footer) footer; - - @ContentChildren(PrimeTemplate) templates: QueryList; - - @ViewChild('content') contentViewChild: ElementRef; - - @Output() onLazyLoad: EventEmitter = new EventEmitter(); - - itemTemplate: TemplateRef; - - dataToRender: any[] = []; - - first: number = 0; - - contentElement: HTMLDivElement; - - inlineScrollListener: any; - - windowScrollListener: any; - - loaderClickListener: any; - - page: number = 0; - - constructor(public el: ElementRef, public renderer: Renderer2, public domHandler: DomHandler, public zone: NgZone) {} - - ngOnInit() { - this.load(); - } - - ngAfterViewInit() { - if(this.loader) { - this.loaderClickListener = this.renderer.listen(this.loader, 'click', () => { - this.load(); - }); - } - else { - this.bindScrollListener(); - } - } - - ngAfterContentInit() { - this.templates.forEach((item) => { - switch(item.getType()) { - case 'item': - this.itemTemplate = item.template; - break; - - default: - this.itemTemplate = item.template; - break; - } - }); - } - - load() { - if(this.lazy) { - this.onLazyLoad.emit({ - first: this.page * this.rows, - rows: this.rows - }); - } - - this.page = this.page + 1; - } - - shouldLoad() { - if(this.lazy) - return (this.rows * this.page < this.totalRecords); - else - return this.value && this.value.length && (this.rows * this.page < this.value.length); - } - - reset() { - this.page = 0; - } - - isEmpty() { - return !this.value||(this.value.length == 0); - } - - bindScrollListener() { - this.zone.runOutsideAngular(() => { - if(this.inline) { - this.inlineScrollListener = this.onInlineScroll.bind(this); - this.contentViewChild.nativeElement.addEventListener('scroll', this.inlineScrollListener); - } - else { - this.windowScrollListener = this.onWindowScroll.bind(this); - window.addEventListener('scroll', this.windowScrollListener); - } - }); - } - - unbindScrollListener() { - if(this.inlineScrollListener) { - this.contentViewChild.nativeElement.removeEventListener('scroll', this.inlineScrollListener); - } - - if(this.windowScrollListener) { - window.removeEventListener('scroll', this.windowScrollListener); - } - - if(this.loaderClickListener) { - this.loaderClickListener(); - this.loaderClickListener = null; - } - } - - onInlineScroll() { - let scrollTop = this.contentViewChild.nativeElement.scrollTop; - let scrollHeight = this.contentViewChild.nativeElement.scrollHeight; - let viewportHeight = this.contentViewChild.nativeElement.clientHeight; - - if((scrollTop >= ((scrollHeight * this.buffer) - (viewportHeight)))) { - if(this.shouldLoad()) { - this.zone.run(() => { - this.load(); - }); - } - } - } - - onWindowScroll() { - let docBody = document.body; - let docElement = document.documentElement; - let scrollTop = (window.pageYOffset||document.documentElement.scrollTop); - let winHeight = docElement.clientHeight; - let docHeight = Math.max(docBody.scrollHeight, docBody.offsetHeight, winHeight, docElement.scrollHeight, docElement.offsetHeight); - - if(scrollTop >= ((docHeight * this.buffer) - winHeight)) { - if(this.shouldLoad()) { - this.zone.run(() => { - this.load(); - }); - } - } - } - - ngOnDestroy() { - this.unbindScrollListener(); - } -} - -@NgModule({ - imports: [CommonModule], - exports: [DataScroller,SharedModule], - declarations: [DataScroller] -}) -export class DataScrollerModule { } - diff --git a/dashboard/src/app/components/datatable/datatable.scss b/dashboard/src/app/components/datatable/datatable.scss deleted file mode 100644 index 4252d7bc9..000000000 --- a/dashboard/src/app/components/datatable/datatable.scss +++ /dev/null @@ -1,404 +0,0 @@ -.ui-datatable { - position: relative; -} - -.ui-datatable table { - border-collapse:collapse; - width: 100%; - table-layout: fixed; -} - -.ui-datatable .ui-datatable-header, -.ui-datatable .ui-datatable-caption, -.ui-datatable .ui-datatable-footer { - text-align: center; - padding: .5em .75em; - box-sizing: border-box; -} - -.ui-datatable .ui-datatable-caption, -.ui-datatable .ui-datatable-header { - border-bottom: 0 none; -} - -.ui-datatable .ui-datatable-footer { - border-top: 0 none; -} - -.ui-datatable thead th, .ui-datatable tfoot td { - text-align: left; -} - -.ui-datatable thead tr { - border-width: 0; -} - -.ui-datatable thead th:not(:first-of-type) span.ui-column-title{ - border-left:1px solid #b4c3c9; - margin-left: -0.1rem; - padding-left: 0.1rem; -} - -.ui-datatable .ui-datatable-thead > tr > th, -.ui-datatable .ui-datatable-tfoot > tr > td, -.ui-datatable .ui-datatable-data > tr > td { - border-color: inherit; - box-sizing: border-box; - padding: .09rem .1rem; - border: none; -} -.ui-datatable .ui-datatable-thead > tr > th, -.ui-datatable .ui-datatable-tfoot > tr > td{ - padding: .1rem .1rem; -} - - -.ui-datatable.ui-datatable-resizable .ui-datatable-thead > tr > th, -.ui-datatable.ui-datatable-resizable .ui-datatable-tfoot > tr > td, -.ui-datatable.ui-datatable-resizable .ui-datatable-data > tr > td { - overflow: hidden; -} - -.ui-datatable .ui-datatable-thead > tr > th, -.ui-datatable .ui-datatable-tfoot > tr > td { - font-weight: normal; -} - -.ui-datatable tbody { - outline: 0; -} - -.ui-datatable tbody.ui-widget-content, -.ui-datatable tbody tr.ui-widget-content{ - border: 0; -} - -.ui-datatable tbody .ui-cell-data { - height: .32rem; - line-height: .32rem; - text-overflow: ellipsis; - overflow: hidden; - white-space: nowrap; - display: block; -} - -.ui-datatable tbody .ui-cell-data > a{ - margin-right: 0.2rem; -} - -.ui-datatable tbody tr.ui-expanded-row-content { - background: #fbfdff; - border-bottom: 1px solid #ebf0f2; - border-top: 1px solid #ebf0f2; -} - -.ui-datatable .ui-sortable-column { - cursor: pointer; -} - -.ui-datatable .ui-sortable-column-icon { - display: inline-block; - margin-left: .125em; -} - -.ui-datatable tr.ui-state-highlight { - cursor: pointer; -} - -/* Scrollable */ -.ui-datatable-scrollable-body { - overflow: auto; - overflow-anchor: none; - min-height: 0%; -} - -.ui-datatable-scrollable-header, -.ui-datatable-scrollable-footer { - overflow: hidden; -} - -.ui-datatable-scrollable .ui-datatable-scrollable-header, -.ui-datatable-scrollable .ui-datatable-scrollable-footer { - position: relative; - border: 0 none; -} - -.ui-datatable-scrollable .ui-datatable-scrollable-header td { - font-weight: normal; -} - -.ui-datatable-scrollable-body .ui-datatable-data, -.ui-datatable-scrollable-body .ui-datatable-data > tr:first-child { - border-top-color: transparent; -} - -.ui-datatable .ui-datatable-data tr.ui-state-hover, -.ui-datatable .ui-datatable-data tr.ui-state-highlight { - border-color: inherit; - font-weight: inherit; - cursor: pointer; -} - -.ui-datatable .ui-datatable-data tr.ui-rowgroup-header td a, -.ui-datatable .ui-datatable-data tr.ui-rowgroup-header td span.ui-rowgroup-header-name { - display: inline-block; - vertical-align: middle; -} - -.ui-datatable-scrollable-theadclone { - height: 0; -} - -.ui-datatable-scrollable-theadclone tr { - height: 0; -} - -.ui-datatable-scrollable-theadclone th.ui-state-default { - height: 0; - border-bottom-width: 0; - border-top-width: 0; - padding-top: 0; - padding-bottom: 0; - outline: 0 none; -} - -.ui-datatable-scrollable-theadclone th span.ui-column-title { - display: block; - height: 0; -} - -.ui-datatable .ui-paginator { - padding: .125em; -} - -.ui-datatable .ui-paginator-top { - border-bottom-width: 0; -} - -.ui-datatable .ui-paginator-bottom { - border-top-width: 0; -} - -.ui-datatable-rtl { - direction: rtl; -} - -.ui-datatable-rtl.ui-datatable thead th, -.ui-datatable-rtl.ui-datatable tfoot td { - text-align: right; -} - -/* Row Toggler */ -.ui-row-toggler { - cursor: pointer; - font-size: .20rem; -} - -/* Resizable */ -.ui-datatable .ui-column-resizer { - display: block; - position: absolute !important; - top: 0; - right: 0; - margin: 0; - width: .5em; - height: 100%; - padding: 0px; - cursor:col-resize; - border: 1px solid transparent; -} - -.ui-datatable .ui-column-resizer-helper { - width: 1px; - position: absolute; - z-index: 10; - display: none; -} - -.ui-datatable-resizable { - padding-bottom: 1px; /*fix for webkit overlow*/ - overflow:auto; -} - -.ui-datatable-resizable thead th, -.ui-datatable-resizable tbody td, -.ui-datatable-resizable tfoot td { - white-space: nowrap; -} - -.ui-datatable-resizable th.ui-resizable-column { - background-clip: padding-box; - position: relative; -} - -/** Reflow **/ -.ui-datatable-reflow .ui-datatable-data td .ui-column-title { - display: none; -} - -/* Filter */ -.ui-datatable .ui-column-filter { - display: block; - width: 100%; - box-sizing: border-box; - margin-top: .25em; -} - -/* Editing */ -.ui-datatable .ui-editable-column input { - width: 100%; - outline: 0; -} - -.ui-datatable .ui-datatable-data > tr > td.ui-editable-column { - padding: .5em; -} - -.ui-datatable .ui-editable-column > .ui-cell-editor { - display: none; -} - -.ui-datatable .ui-datatable-data > tr > td.ui-editable-column.ui-cell-editing { - padding: 1px; -} - -.ui-datatable .ui-editable-column.ui-cell-editing > .ui-cell-editor { - display: block; -} - -.ui-datatable .ui-editable-column.ui-cell-editing > .ui-cell-data { - display: none; -} - -.ui-datatable-stacked thead th, -.ui-datatable-stacked tfoot td { - display: none !important; -} - -.ui-datatable.ui-datatable-stacked .ui-datatable-data > tr > td { - text-align: left; - display: block; - border: 0 none; - width: 100%; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; - float: left; - clear: left; -} - -.ui-datatable.ui-datatable-stacked .ui-datatable-data.ui-widget-content { - border: 0 none; -} - -.ui-datatable-stacked .ui-datatable-data tr.ui-widget-content { - border-left: 0 none; - border-right: 0 none; -} - -.ui-datatable-stacked .ui-datatable-data td .ui-column-title { - padding: .4em; - min-width: 30%; - display: inline-block; - margin: -.4em 1em -.4em -.4em; - font-weight: bold; -} - -.ui-datatable .ui-selection-column .ui-chkbox, -.ui-datatable .ui-selection-column .ui-radiobutton { - margin: 0; - display: block; -} - -.ui-datatable .ui-selection-column .ui-chkbox-box, -.ui-datatable .ui-selection-column .ui-radiobutton-box { - display: block; - box-sizing: border-box; - margin: 0; -} - -.ui-datatable-scrollable-wrapper { - position: relative; -} - -.ui-datatable-scrollable-view { - -} - -.ui-datatable-frozen-view .ui-datatable-scrollable-body { - overflow: hidden; -} - -.ui-datatable-unfrozen-view { - position: absolute; - top: 0px; -} - -.ui-datatable .ui-datatable-load-status { - width: 100%; - height: 100%; - top: 0px; - left: 0px; -} - -.ui-datatable .ui-datatable-virtual-table { - position: absolute; - top: 0px; - left: 0px; -} - -.ui-datatable .ui-datatable-loading { - position: absolute; - width: 100%; - height: 100%; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=10)"; - opacity: 0.1; - z-index: 1; -} - -.ui-datatable .ui-datatable-loading-content { - position: absolute; - left: 50%; - top: 25%; - z-index: 2; -} - -@media ( max-width: 35em ) { - .ui-datatable-reflow thead th, - .ui-datatable-reflow tfoot td { - display: none !important; - } - - .ui-datatable-reflow .ui-datatable-data > tr > td { - text-align: left; - display: block; - border: 0 none; - width: 100% !important; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; - float: left; - clear: left; - } - - .ui-datatable-reflow .ui-datatable-data.ui-widget-content { - border: 0 none; - } - - .ui-datatable-reflow .ui-datatable-data tr.ui-widget-content { - border-left: 0 none; - border-right: 0 none; - } - - .ui-datatable-reflow .ui-datatable-data td .ui-column-title { - padding: .4em; - min-width: 30%; - display: inline-block; - margin: -.4em 1em -.4em -.4em; - font-weight: bold; - } - - .ui-datatable-reflow.ui-datatable-scrollable .ui-datatable-scrollable-body colgroup { - display: block; - } -} \ No newline at end of file diff --git a/dashboard/src/app/components/datatable/datatable.spec.ts b/dashboard/src/app/components/datatable/datatable.spec.ts deleted file mode 100644 index 58d2368b0..000000000 --- a/dashboard/src/app/components/datatable/datatable.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { DataTable } from './datatable'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('DataTable', () => { - - let datatable: DataTable; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - DataTable - ] - }); - - fixture = TestBed.createComponent(DataTable); - datatable = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/datatable/datatable.ts b/dashboard/src/app/components/datatable/datatable.ts deleted file mode 100644 index 5c5a34851..000000000 --- a/dashboard/src/app/components/datatable/datatable.ts +++ /dev/null @@ -1,2671 +0,0 @@ -import {NgModule, Component, ElementRef, AfterContentInit, AfterViewInit, AfterViewChecked, OnInit, OnDestroy, Input, - ViewContainerRef, ViewChild, IterableDiffers, - Output, EventEmitter, ContentChild, ContentChildren, Renderer2, QueryList, TemplateRef, - ChangeDetectorRef, Inject, forwardRef, EmbeddedViewRef, NgZone -} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {FormsModule} from '@angular/forms' -import {SharedModule} from '../common/shared'; -import {PaginatorModule} from '../paginator/paginator'; -import {Column,Header,Footer,HeaderColumnGroup,FooterColumnGroup,PrimeTemplate} from '../common/shared'; -import {LazyLoadEvent} from '../common/lazyloadevent'; -import {FilterMetadata} from '../common/filtermetadata'; -import {SortMeta} from '../common/sortmeta'; -import {DomHandler} from '../dom/domhandler'; -import {ObjectUtils} from '../utils/objectutils'; -import {Subscription} from 'rxjs/Subscription'; -import {BlockableUI} from '../common/blockableui'; - -@Component({ - selector: 'p-dtRadioButton', - template: ` -
-
- -
-
- -
-
- ` -}) -export class DTRadioButton { - - @Input() checked: boolean; - - @Output() onClick: EventEmitter = new EventEmitter(); - - public hover: boolean; - - handleClick(event) { - this.onClick.emit(event); - } -} - -@Component({ - selector: 'p-dtCheckbox', - template: ` -
-
- -
-
- -
-
- ` -}) -export class DTCheckbox { - - @Input() checked: boolean; - - @Input() disabled: boolean; - - @Output() onChange: EventEmitter = new EventEmitter(); - - public hover: boolean; - - handleClick(event) { - if(!this.disabled) { - this.onChange.emit({originalEvent: event, checked: !this.checked}); - } - } -} - -@Component({ - selector: '[pColumnHeaders]', - template: ` - - - - {{col.header}} - - - - - - - - - - - - ` -}) -export class ColumnHeaders { - - constructor(@Inject(forwardRef(() => DataTable)) public dt:DataTable) {} - - @Input("pColumnHeaders") columns: Column[]; -} - -@Component({ - selector: '[pColumnFooters]', - template: ` - - {{col.footer}} - - - - - ` -}) -export class ColumnFooters { - - constructor(@Inject(forwardRef(() => DataTable)) public dt:DataTable) {} - - @Input("pColumnFooters") columns: Column[]; -} - -@Component({ - selector: '[pTableBody]', - template: ` - - - - - - - - - - - - - - - {{col.header}} - {{dt.resolveFieldData(rowData,col.field)}} - - - -
- - - - -
- - - - - - -
- - - - - - - - - -
- - - - {{dt.emptyMessage}} - - - - - - ` -}) -export class TableBody { - - constructor(@Inject(forwardRef(() => DataTable)) public dt:DataTable) {} - - @Input("pTableBody") columns: Column[]; - - @Input() data: any[]; - - visibleColumns() { - return this.columns ? this.columns.filter(c => !c.hidden): []; - } -} - -@Component({ - selector: '[pScrollableView]', - template: ` -
-
- - - - - - - - -
-
-
-
-
- - - - - -
-
-
- - ` -}) -export class ScrollableView implements AfterViewInit,AfterViewChecked,OnDestroy { - - constructor(@Inject(forwardRef(() => DataTable)) public dt:DataTable, public domHandler: DomHandler, public el: ElementRef, public renderer: Renderer2, public zone: NgZone) {} - - @Input("pScrollableView") columns: Column[]; - - @Input() headerColumnGroup: HeaderColumnGroup; - - @Input() footerColumnGroup: HeaderColumnGroup; - - @ViewChild('scrollHeader') scrollHeaderViewChild: ElementRef; - - @ViewChild('scrollHeaderBox') scrollHeaderBoxViewChild: ElementRef; - - @ViewChild('scrollBody') scrollBodyViewChild: ElementRef; - - @ViewChild('scrollTable') scrollTableViewChild: ElementRef; - - @ViewChild('scrollTableWrapper') scrollTableWrapperViewChild: ElementRef; - - @ViewChild('scrollFooter') scrollFooterViewChild: ElementRef; - - @ViewChild('scrollFooterBox') scrollFooterBoxViewChild: ElementRef; - - @Input() frozen: boolean; - - @Input() width: string; - - @Input() virtualScroll: boolean; - - @Output() onVirtualScroll: EventEmitter = new EventEmitter(); - - public scrollBody: HTMLDivElement; - - public scrollHeader: HTMLDivElement; - - public scrollHeaderBox: HTMLDivElement; - - public scrollTable: HTMLDivElement; - - public scrollTableWrapper: HTMLDivElement; - - public scrollFooter: HTMLDivElement; - - public scrollFooterBox: HTMLDivElement; - - public bodyScrollListener: Function; - - public headerScrollListener: Function; - - public scrollBodyMouseWheelListener: Function; - - public scrollFunction: Function; - - public rowHeight: number; - - public scrollTimeout: any; - - ngAfterViewInit() { - this.initScrolling(); - } - - ngAfterViewChecked() { - if(this.virtualScroll && !this.rowHeight) { - let row = this.domHandler.findSingle(this.scrollTable, 'tr.ui-widget-content:not(.ui-datatable-emptymessage-row)'); - if(row) { - this.rowHeight = this.domHandler.getOuterHeight(row); - } - } - - if(!this.frozen) { - this.zone.runOutsideAngular(() => { - setTimeout(() => { - this.alignScrollBar(); - }, 1); - }); - } - } - - initScrolling() { - this.scrollHeader = this.scrollHeaderViewChild.nativeElement; - this.scrollHeaderBox = this.scrollHeaderBoxViewChild.nativeElement; - this.scrollBody = this.scrollBodyViewChild.nativeElement; - this.scrollTable = this.scrollTableViewChild.nativeElement; - this.scrollTableWrapper = this.scrollTableWrapperViewChild.nativeElement; - this.scrollFooter = this.scrollFooterViewChild ? this.scrollFooterViewChild.nativeElement : null; - this.scrollFooterBox = this.scrollFooterBoxViewChild ? this.scrollFooterBoxViewChild.nativeElement : null; - - this.setScrollHeight(); - - if(!this.frozen) { - this.zone.runOutsideAngular(() => { - this.scrollHeader.addEventListener('scroll', this.onHeaderScroll.bind(this)); - this.scrollBody.addEventListener('scroll', this.onBodyScroll.bind(this)); - }); - } - - if(!this.frozen) { - this.alignScrollBar(); - } - else { - this.scrollBody.style.paddingBottom = this.domHandler.calculateScrollbarWidth() + 'px'; - } - } - - onBodyScroll(event) { - let frozenView = this.el.nativeElement.previousElementSibling; - if(frozenView) { - var frozenScrollBody = this.domHandler.findSingle(frozenView, '.ui-datatable-scrollable-body'); - } - - this.scrollHeaderBox.style.marginLeft = -1 * this.scrollBody.scrollLeft + 'px'; - if(this.scrollFooterBox) { - this.scrollFooterBox.style.marginLeft = -1 * this.scrollBody.scrollLeft + 'px'; - } - - if(frozenScrollBody) { - frozenScrollBody.scrollTop = this.scrollBody.scrollTop; - } - - if(this.virtualScroll) { - let viewport = this.domHandler.getOuterHeight(this.scrollBody); - let tableHeight = this.domHandler.getOuterHeight(this.scrollTable); - let pageHeight = this.rowHeight * this.dt.rows; - let virtualTableHeight = this.domHandler.getOuterHeight(this.scrollTableWrapper); - let pageCount = (virtualTableHeight / pageHeight)||1; - - if(this.scrollBody.scrollTop + viewport > parseFloat(this.scrollTable.style.top) + tableHeight || this.scrollBody.scrollTop < parseFloat(this.scrollTable.style.top)) { - let page = Math.floor((this.scrollBody.scrollTop * pageCount) / (this.scrollBody.scrollHeight)) + 1; - this.onVirtualScroll.emit({ - page: page, - callback: () => { - this.scrollTable.style.top = ((page - 1) * pageHeight) + 'px'; - } - }); - } - } - } - - setScrollHeight() { - if(this.dt.scrollHeight) { - if(this.dt.scrollHeight.indexOf('%') !== -1) { - this.scrollBody.style.visibility = 'hidden'; - this.scrollBody.style.height = '100px'; //temporary height to calculate static height - let containerHeight = this.domHandler.getOuterHeight(this.dt.el.nativeElement.children[0]); - let relativeHeight = this.domHandler.getOuterHeight(this.dt.el.nativeElement.parentElement) * parseInt(this.dt.scrollHeight) / 100; - let staticHeight = containerHeight - 100; //total height of headers, footers, paginators - let scrollBodyHeight = (relativeHeight - staticHeight); - - this.scrollBody.style.height = 'auto'; - this.scrollBody.style.maxHeight = scrollBodyHeight + 'px'; - this.scrollBody.style.visibility = 'visible'; - } - else { - this.scrollBody.style.maxHeight = this.dt.scrollHeight; - } - } - } - - onHeaderScroll(event) { - this.scrollHeader.scrollLeft = 0; - } - - hasVerticalOverflow() { - return this.domHandler.getOuterHeight(this.scrollTable) > this.domHandler.getOuterHeight(this.scrollBody); - } - - alignScrollBar() { - let scrollBarWidth = this.hasVerticalOverflow() ? this.domHandler.calculateScrollbarWidth() : 0; - this.scrollHeaderBox.style.marginRight = scrollBarWidth + 'px'; - if(this.scrollFooterBox) { - this.scrollFooterBox.style.marginRight = scrollBarWidth + 'px'; - } - } - - ngOnDestroy() { - this.scrollHeader.removeEventListener('scroll', this.onHeaderScroll); - this.scrollBody.removeEventListener('scroll', this.onBodyScroll); - } -} - -@Component({ - selector: 'p-dataTable', - template: ` -
-
-
- -
-
- -
- -
- - - - - - - - - - - - - - -
-
- - -
-
-
-
-
- - - - - - - -
- `, - providers: [DomHandler,ObjectUtils] -}) -export class DataTable implements AfterViewChecked,AfterViewInit,AfterContentInit,OnInit,OnDestroy,BlockableUI { - - @Input() paginator: boolean; - - @Input() rows: number; - - @Input() pageLinks: number = 5; - - @Input() rowsPerPageOptions: number[]; - - @Input() responsive: boolean; - - @Input() stacked: boolean; - - @Input() selectionMode: string; - - @Output() selectionChange: EventEmitter = new EventEmitter(); - - @Input() editable: boolean; - - @Input() showHeaderCheckbox: boolean = true; - - @Output() onRowClick: EventEmitter = new EventEmitter(); - - @Output() onRowSelect: EventEmitter = new EventEmitter(); - - @Output() onRowUnselect: EventEmitter = new EventEmitter(); - - @Output() onRowDblclick: EventEmitter = new EventEmitter(); - - @Output() onHeaderCheckboxToggle: EventEmitter = new EventEmitter(); - - @Input() headerCheckboxToggleAllPages: boolean; - - @Output() onContextMenuSelect: EventEmitter = new EventEmitter(); - - @Input() filterDelay: number = 300; - - @Input() lazy: boolean; - - @Output() onLazyLoad: EventEmitter = new EventEmitter(); - - @Input() resizableColumns: boolean; - - @Input() columnResizeMode: string = 'fit'; - - @Output() onColResize: EventEmitter = new EventEmitter(); - - @Input() reorderableColumns: boolean; - - @Output() onColReorder: EventEmitter = new EventEmitter(); - - @Input() scrollable: boolean; - - @Input() virtualScroll: boolean; - - @Input() scrollHeight: any; - - @Input() scrollWidth: any; - - @Input() frozenWidth: any; - - @Input() unfrozenWidth: any; - - @Input() style: any; - - @Input() styleClass: string; - - @Input() tableStyle: any; - - @Input() tableStyleClass: string; - - @Input() globalFilter: any; - - @Input() sortMode: string = 'single'; - - @Input() defaultSortOrder: number = 1; - - @Input() groupField: string; - - @Input() contextMenu: any; - - @Input() csvSeparator: string = ','; - - @Input() exportFilename: string = 'download'; - - @Input() emptyMessage: string = 'No records found'; - - @Input() paginatorPosition: string = 'bottom'; - - @Input() alwaysShowPaginator: boolean = true; - - @Input() metaKeySelection: boolean = true; - - @Input() rowTrackBy: Function = (index: number, item: any) => item; - - @Input() immutable: boolean = true; - - @Input() frozenValue: any[]; - - @Input() compareSelectionBy: string = 'deepEquals'; - - @Output() onEditInit: EventEmitter = new EventEmitter(); - - @Output() onEditComplete: EventEmitter = new EventEmitter(); - - @Output() onEdit: EventEmitter = new EventEmitter(); - - @Output() onEditCancel: EventEmitter = new EventEmitter(); - - @Output() onPage: EventEmitter = new EventEmitter(); - - @Output() onSort: EventEmitter = new EventEmitter(); - - @Output() onFilter: EventEmitter = new EventEmitter(); - - @ContentChild(Header) header; - - @ContentChild(Footer) footer; - - @Input() expandableRows: boolean; - - @Input() expandedRows: any[]; - - @Input() expandableRowGroups: boolean; - - @Input() rowExpandMode: string = 'multiple'; - - @Input() public expandedRowsGroups: any[]; - - @Input() expandedIcon: string = 'fa-angle-down'; - - @Input() collapsedIcon: string = 'fa-angle-right'; - - @Input() tabindex: number = 1; - - @Input() rowStyleClass: Function; - - @Input() rowStyleMap: Object; - - @Input() rowGroupMode: string; - - @Input() sortableRowGroup: boolean = true; - - @Input() sortFile: string; - - @Input() rowHover: boolean; - - @Input() public filters: {[s: string]: FilterMetadata;} = {}; - - @Input() dataKey: string; - - @Input() loading: boolean; - - @Input() loadingIcon: string = 'fa-circle-o-notch'; - - @Input() virtualScrollDelay: number = 500; - - @Input() rowGroupExpandMode: string = 'multiple'; - - @Output() valueChange: EventEmitter = new EventEmitter(); - - @Output() firstChange: EventEmitter = new EventEmitter(); - - @Output() onRowExpand: EventEmitter = new EventEmitter(); - - @Output() onRowCollapse: EventEmitter = new EventEmitter(); - - @Output() onRowGroupExpand: EventEmitter = new EventEmitter(); - - @Output() onRowGroupCollapse: EventEmitter = new EventEmitter(); - - @ContentChildren(PrimeTemplate) templates: QueryList; - - @ContentChildren(Column) cols: QueryList; - - @ContentChildren(HeaderColumnGroup) headerColumnGroups: QueryList; - - @ContentChildren(FooterColumnGroup) footerColumnGroups: QueryList; - - public _value: any[]; - - public dataToRender: any[]; - - public page: number = 0; - - public filterTimeout: any; - - public filteredValue: any[]; - - public columns: Column[]; - - public frozenColumns: Column[]; - - public scrollableColumns: Column[]; - - public frozenHeaderColumnGroup: HeaderColumnGroup; - - public scrollableHeaderColumnGroup: HeaderColumnGroup; - - public frozenFooterColumnGroup: HeaderColumnGroup; - - public scrollableFooterColumnGroup: HeaderColumnGroup; - - public columnsChanged: boolean = false; - - public sortColumn: Column; - - public columnResizing: boolean; - - public lastResizerHelperX: number; - - public documentEditListener: Function; - - public documentColumnResizeEndListener: Function; - - public resizerHelper: any; - - public resizeColumn: any; - - public reorderIndicatorUp: any; - - public reorderIndicatorDown: any; - - public iconWidth: number; - - public iconHeight: number; - - public draggedColumn: any; - - public dropPosition: number; - - public tbody: any; - - public rowTouched: boolean; - - public rowGroupToggleClick: boolean; - - public editingCell: any; - - public virtualTableHeight: number; - - public rowGroupMetadata: any; - - public rowGroupHeaderTemplate: TemplateRef; - - public rowGroupFooterTemplate: TemplateRef; - - public rowExpansionTemplate: TemplateRef; - - public emptyMessageTemplate: TemplateRef; - - public paginatorLeftTemplate: TemplateRef; - - public paginatorRightTemplate: TemplateRef; - - public scrollBarWidth: number; - - public editorClick: boolean; - - public _first: number = 0; - - public selectionKeys: any; - - public preventSelectionKeysPropagation: boolean; - - public preventSortPropagation: boolean; - - public preventRowClickPropagation: boolean; - - _multiSortMeta: SortMeta[]; - - _sortField: string; - - _sortOrder: number = 1; - - differ: any; - - _selection: any; - - _totalRecords: number; - - globalFilterFunction: any; - - columnsSubscription: Subscription; - - totalRecordsChanged: boolean; - - anchorRowIndex: number; - - rangeRowIndex: number; - - initialized: boolean; - - virtualScrollTimer: any; - - virtualScrollableTableWrapper: HTMLDivElement; - - virtualScrollCallback: Function; - - editChanged: boolean; - - constructor(public el: ElementRef, public domHandler: DomHandler, public differs: IterableDiffers, - public renderer: Renderer2, public changeDetector: ChangeDetectorRef, public objectUtils: ObjectUtils, - public zone: NgZone) { - this.differ = differs.find([]).create(null); - } - - ngOnInit() { - if(this.lazy) { - this.onLazyLoad.emit(this.createLazyLoadMetadata()); - } - } - - ngAfterContentInit() { - this.initColumns(); - this.initColumnGroups(); - - this.columnsSubscription = this.cols.changes.subscribe(_ => { - this.initColumns(); - this.changeDetector.markForCheck(); - }); - - this.templates.forEach((item) => { - switch(item.getType()) { - case 'rowexpansion': - this.rowExpansionTemplate = item.template; - break; - - case 'rowgroupheader': - this.rowGroupHeaderTemplate = item.template; - break; - - case 'rowgroupfooter': - this.rowGroupFooterTemplate = item.template; - break; - - case 'emptymessage': - this.emptyMessageTemplate = item.template; - break; - - case 'paginatorLeft': - this.paginatorLeftTemplate = item.template; - break; - - case 'paginatorRight': - this.paginatorRightTemplate = item.template; - break; - } - }); - } - - ngAfterViewChecked() { - if(this.columnsChanged && this.el.nativeElement.offsetParent) { - if(this.resizableColumns) { - this.initResizableColumns(); - } - - if(this.reorderableColumns) { - this.initColumnReordering(); - } - - this.columnsChanged = false; - } - - if(this.totalRecordsChanged && this.virtualScroll && this.virtualScrollableTableWrapper && this.virtualScrollableTableWrapper.offsetParent) { - let row = this.domHandler.findSingle(this.virtualScrollableTableWrapper,'tr.ui-widget-content'); - let rowHeight = this.domHandler.getOuterHeight(row); - this.virtualTableHeight = this._totalRecords * rowHeight; - this.virtualScrollableTableWrapper.style.height = this.virtualTableHeight + 'px'; - this.totalRecordsChanged = false; - } - } - - ngAfterViewInit() { - if(this.globalFilter) { - this.globalFilterFunction = this.renderer.listen(this.globalFilter, 'keyup', () => { - if (this.filterTimeout) { - clearTimeout(this.filterTimeout); - } - this.filterTimeout = setTimeout(() => { - this._filter(); - this.filterTimeout = null; - }, this.filterDelay); - }); - } - - this.virtualScrollableTableWrapper = this.domHandler.findSingle(this.el.nativeElement, 'div.ui-datatable-scrollable-table-wrapper'); - - this.initialized = true; - } - - @Input() get multiSortMeta(): SortMeta[]{ - return this._multiSortMeta; - } - - set multiSortMeta(val: SortMeta[]){ - this._multiSortMeta = val; - if(this.sortMode === 'multiple') { - this.sortMultiple(); - } - } - - @Input() get sortField(): string{ - return this._sortField; - } - - set sortField(val: string){ - this._sortField = val; - if(this.sortMode === 'single') { - this.sortSingle(); - } - } - - @Input() get sortOrder(): number { - return this._sortOrder; - } - set sortOrder(val: number) { - this._sortOrder = val; - if(this.sortMode === 'single') { - this.sortSingle(); - } - } - - @Input() get value(): any[] { - return this._value; - } - set value(val:any[]) { - if(this.immutable) { - this._value = val ? [...val] : null; - this.handleDataChange(); - } - else { - this._value = val; - } - - this.valueChange.emit(this.value); - } - - @Input() get first(): number { - return this._first; - } - - set first(val:number) { - let shouldPaginate = this.initialized && this._first !== val; - - this._first = val; - - if(shouldPaginate) { - this.paginate(); - } - } - - @Input() get totalRecords(): number { - return this._totalRecords; - } - - set totalRecords(val:number) { - this._totalRecords = val; - this.totalRecordsChanged = true; - } - - @Input() get selection(): any { - return this._selection; - } - - set selection(val: any) { - this._selection = val; - - if(this.dataKey && !this.preventSelectionKeysPropagation) { - this.selectionKeys = {}; - if(this._selection) { - if(Array.isArray(this._selection)) { - for(let data of this._selection) { - this.selectionKeys[String(this.objectUtils.resolveFieldData(data, this.dataKey))] = 1; - } - } - else { - this.selectionKeys[String(this.objectUtils.resolveFieldData(this._selection, this.dataKey))] = 1; - } - } - } - this.preventSelectionKeysPropagation = false; - } - - ngDoCheck() { - if(!this.immutable) { - let changes = this.differ.diff(this.value); - if(changes) { - this.handleDataChange(); - } - } - } - - handleDataChange() { - if(this.paginator) { - this.updatePaginator(); - } - - if(this.virtualScroll && this.virtualScrollCallback) { - this.virtualScrollCallback(); - } - - if(!this.lazy) { - if(this.hasFilter()) { - this._filter(); - } - - if(this.preventSortPropagation) { - this.preventSortPropagation = false; - } - else if(this.sortField||this.multiSortMeta) { - if(!this.sortColumn && this.columns) { - this.sortColumn = this.columns.find(col => col.field === this.sortField && col.sortable === 'custom'); - } - - if(this.sortMode == 'single') - this.sortSingle(); - else if(this.sortMode == 'multiple') - this.sortMultiple(); - } - } - - this.updateDataToRender(this.filteredValue||this.value); - } - - initColumns(): void { - this.columns = this.cols.toArray(); - this.initScrollableColumns(); - - this.columnsChanged = true; - } - - initScrollableColumns() { - this.scrollableColumns = []; - this.frozenColumns = []; - - for(let col of this.columns) { - if(col.frozen) - this.frozenColumns.push(col); - else - this.scrollableColumns.push(col); - } - } - - initColumnGroups(): void { - let headerColumnsGroups = this.headerColumnGroups.toArray(); - let footerColumnsGroups = this.footerColumnGroups.toArray(); - - for(let columnGroup of headerColumnsGroups) { - if(columnGroup.frozen) - this.frozenHeaderColumnGroup = columnGroup; - else - this.scrollableHeaderColumnGroup = columnGroup; - } - - for(let columnGroup of footerColumnsGroups) { - if(columnGroup.frozen) - this.frozenFooterColumnGroup = columnGroup; - else - this.scrollableFooterColumnGroup = columnGroup; - } - } - - resolveFieldData(data: any, field: string): any { - return this.objectUtils.resolveFieldData(data, field); - } - - updateRowGroupMetadata() { - this.rowGroupMetadata = {}; - if(this.dataToRender) { - for(let i = 0; i < this.dataToRender.length; i++) { - let rowData = this.dataToRender[i]; - let group = this.resolveFieldData(rowData, this.sortField); - if(i == 0) { - this.rowGroupMetadata[group] = {index:0, size: 1}; - } - else { - let previousRowData = this.dataToRender[i-1]; - let previousRowGroup = this.resolveFieldData(previousRowData, this.sortField); - if(group === previousRowGroup) { - this.rowGroupMetadata[group].size++; - } - else { - this.rowGroupMetadata[group] = {index:i, size: 1}; - } - } - } - } - } - - updatePaginator() { - //total records - this.updateTotalRecords(); - - //first - if(this.totalRecords && this.first >= this.totalRecords) { - let numberOfPages = Math.ceil(this.totalRecords/this.rows); - this._first = Math.max((numberOfPages-1) * this.rows, 0); - } - } - - updateTotalRecords() { - this.totalRecords = this.lazy ? this.totalRecords : (this.value ? this.value.length: 0); - } - - onPageChange(event) { - this._first = event.first; - this.firstChange.emit(this.first); - this.rows = event.rows; - this.paginate(); - } - - paginate() { - if(this.lazy) - this.onLazyLoad.emit(this.createLazyLoadMetadata()); - else - this.updateDataToRender(this.filteredValue||this.value); - - this.onPage.emit({ - first: this.first, - rows: this.rows - }); - } - - updateDataToRender(datasource) { - if((this.paginator || this.virtualScroll) && datasource) { - this.dataToRender = []; - let startIndex: number = this.lazy ? 0 : this.first; - let endIndex: number = this.virtualScroll ? this.first + this.rows * 2 : startIndex + this.rows; - - for(let i = startIndex; i < endIndex; i++) { - if(i >= datasource.length) { - break; - } - - this.dataToRender.push(datasource[i]); - } - } - else { - this.dataToRender = datasource; - } - - if(this.rowGroupMode) { - this.updateRowGroupMetadata(); - } - - this.changeDetector.markForCheck(); - } - - onVirtualScroll(event) { - this._first = (event.page - 1) * this.rows; - this.virtualScrollCallback = event.callback; - - this.zone.run(() => { - if(this.virtualScrollTimer) { - clearTimeout(this.virtualScrollTimer); - } - - this.virtualScrollTimer = setTimeout(() => { - if(this.lazy) - this.onLazyLoad.emit(this.createLazyLoadMetadata()); - else - this.updateDataToRender(this.filteredValue||this.value); - }, this.virtualScrollDelay); - }); - } - - onHeaderKeydown(event, column: Column) { - if(event.keyCode == 13) { - this.sort(event, column); - event.preventDefault(); - } - } - - onHeaderMousedown(event, header: any) { - if(this.reorderableColumns) { - if(event.target.nodeName !== 'INPUT') { - header.draggable = true; - } else if(event.target.nodeName === 'INPUT') { - header.draggable = false; - } - } - } - - sort(event, column: Column) { - if(!column.sortable) { - return; - } - let targetNode = event.target; - if(this.domHandler.hasClass(targetNode, 'ui-sortable-column') || this.domHandler.hasClass(targetNode, 'ui-column-title') || this.domHandler.hasClass(targetNode, 'ui-sortable-column-icon')) { - if(!this.immutable) { - this.preventSortPropagation = true; - } - - let columnSortField = column.sortField||column.field; - this._sortOrder = (this.sortField === columnSortField) ? this.sortOrder * -1 : this.defaultSortOrder; - this._sortField = columnSortField; - this.sortColumn = column; - let metaKey = event.metaKey||event.ctrlKey; - - if(this.sortMode == 'multiple') { - if(!this.multiSortMeta||!metaKey) { - this._multiSortMeta = []; - } - - this.addSortMeta({field: this.sortField, order: this.sortOrder}); - } - - if(this.lazy) { - this._first = 0; - this.onLazyLoad.emit(this.createLazyLoadMetadata()); - } - else { - if(this.sortMode == 'multiple') - this.sortMultiple(); - else - this.sortSingle(); - } - - this.onSort.emit({ - field: this.sortField, - order: this.sortOrder, - multisortmeta: this.multiSortMeta - }); - } - - this.updateDataToRender(this.filteredValue||this.value); - } - - sortSingle() { - if(this.value) { - if(this.sortColumn && this.sortColumn.sortable === 'custom') { - this.preventSortPropagation = true; - this.sortColumn.sortFunction.emit({ - field: this.sortField, - order: this.sortOrder - }); - } - else { - this.value.sort((data1, data2) => { - let value1 = this.resolveFieldData(data1, this.sortField); - let value2 = this.resolveFieldData(data2, this.sortField); - let result = null; - - if (value1 == null && value2 != null) - result = -1; - else if (value1 != null && value2 == null) - result = 1; - else if (value1 == null && value2 == null) - result = 0; - else if (typeof value1 === 'string' && typeof value2 === 'string') - result = value1.localeCompare(value2); - else - result = (value1 < value2) ? -1 : (value1 > value2) ? 1 : 0; - - return (this.sortOrder * result); - }); - } - - this._first = 0; - - if(this.hasFilter()) { - this._filter(); - } - } - } - - sortMultiple() { - if(this.value) { - this.value.sort((data1,data2) => { - return this.multisortField(data1, data2, this.multiSortMeta, 0); - }); - - if(this.hasFilter()) { - this._filter(); - } - } - } - - multisortField(data1,data2,multiSortMeta,index) { - let value1 = this.resolveFieldData(data1, multiSortMeta[index].field); - let value2 = this.resolveFieldData(data2, multiSortMeta[index].field); - let result = null; - - if (typeof value1 == 'string' || value1 instanceof String) { - if (value1.localeCompare && (value1 != value2)) { - return (multiSortMeta[index].order * value1.localeCompare(value2)); - } - } - else { - result = (value1 < value2) ? -1 : 1; - } - - if(value1 == value2) { - return (multiSortMeta.length - 1) > (index) ? (this.multisortField(data1, data2, multiSortMeta, index + 1)) : 0; - } - - return (multiSortMeta[index].order * result); - } - - addSortMeta(meta) { - var index = -1; - for(var i = 0; i < this.multiSortMeta.length; i++) { - if(this.multiSortMeta[i].field === meta.field) { - index = i; - break; - } - } - - if(index >= 0) - this.multiSortMeta[index] = meta; - else - this.multiSortMeta.push(meta); - } - - isSorted(column: Column) { - if(!column.sortable) { - return false; - } - - let columnSortField = column.sortField||column.field; - - if(this.sortMode === 'single') { - return (this.sortField && columnSortField === this.sortField); - } - else if(this.sortMode === 'multiple') { - let sorted = false; - if(this.multiSortMeta) { - for(let i = 0; i < this.multiSortMeta.length; i++) { - if(this.multiSortMeta[i].field == columnSortField) { - sorted = true; - break; - } - } - } - return sorted; - } - } - - getSortOrder(column: Column) { - let order = 0; - let columnSortField = column.sortField||column.field; - - if(this.sortMode === 'single') { - if(this.sortField && columnSortField === this.sortField) { - order = this.sortOrder; - } - } - else if(this.sortMode === 'multiple') { - if(this.multiSortMeta) { - for(let i = 0; i < this.multiSortMeta.length; i++) { - if(this.multiSortMeta[i].field == columnSortField) { - order = this.multiSortMeta[i].order; - break; - } - } - } - } - return order; - } - - onRowGroupClick(event) { - if(this.rowGroupToggleClick) { - this.rowGroupToggleClick = false; - return; - } - - if(this.sortableRowGroup) { - let targetNode = event.target.nodeName; - if((targetNode == 'TD' || (targetNode == 'SPAN' && !this.domHandler.hasClass(event.target, 'ui-clickable')))) { - if(this.sortField != this.groupField) { - this._sortField = this.groupField; - this.sortSingle(); - } - else { - this._sortOrder = -1 * this.sortOrder; - this.sortSingle(); - } - } - } - } - - clearSelectionRange(event: MouseEvent) { - let rangeStart, rangeEnd; - - if(this.rangeRowIndex > this.anchorRowIndex) { - rangeStart = this.anchorRowIndex; - rangeEnd = this.rangeRowIndex; - } - else if(this.rangeRowIndex < this.anchorRowIndex) { - rangeStart = this.rangeRowIndex; - rangeEnd = this.anchorRowIndex; - } - else { - rangeStart = this.rangeRowIndex; - rangeEnd = this.rangeRowIndex; - } - - for(let i = rangeStart; i <= rangeEnd; i++) { - let rangeRowData = this.dataToRender[i]; - let selectionIndex = this.findIndexInSelection(rangeRowData); - this._selection = this.selection.filter((val,i) => i!=selectionIndex); - let dataKeyValue: string = this.dataKey ? String(this.resolveFieldData(rangeRowData, this.dataKey)) : null; - if(dataKeyValue) { - delete this.selectionKeys[dataKeyValue]; - } - this.onRowUnselect.emit({originalEvent: event, data: rangeRowData, type: 'row'}); - } - } - - selectRange(event: MouseEvent, rowIndex: number) { - let rangeStart, rangeEnd; - - if(this.anchorRowIndex > rowIndex) { - rangeStart = rowIndex; - rangeEnd = this.anchorRowIndex; - } - else if(this.anchorRowIndex < rowIndex) { - rangeStart = this.anchorRowIndex; - rangeEnd = rowIndex; - } - else { - rangeStart = rowIndex; - rangeEnd = rowIndex; - } - - for(let i = rangeStart; i <= rangeEnd; i++) { - let rangeRowData = this.dataToRender[i]; - this._selection = [...this.selection, rangeRowData]; - this.selectionChange.emit(this.selection); - let dataKeyValue: string = this.dataKey ? String(this.resolveFieldData(rangeRowData, this.dataKey)) : null; - if(dataKeyValue) { - this.selectionKeys[dataKeyValue] = 1; - } - this.onRowSelect.emit({originalEvent: event, data: rangeRowData, type: 'row'}); - } - } - - handleRowClick(event: MouseEvent, rowData: any, index: number) { - if(this.preventRowClickPropagation) { - this.preventRowClickPropagation = false; - return; - } - - let targetNode = ( event.target).nodeName; - - if(targetNode == 'INPUT' || targetNode == 'BUTTON' || targetNode == 'A' || (this.domHandler.hasClass(event.target, 'ui-clickable'))) { - return; - } - - this.onRowClick.next({originalEvent: event, data: rowData}); - - if(this.selectionMode) { - if(this.isMultipleSelectionMode() && event.shiftKey && this.anchorRowIndex != null) { - this.domHandler.clearSelection(); - if(this.rangeRowIndex != null) { - this.clearSelectionRange(event); - } - - this.rangeRowIndex = index; - this.selectRange(event, index); - } - else { - let selected = this.isSelected(rowData); - let metaSelection = this.rowTouched ? false : this.metaKeySelection; - let dataKeyValue: string = this.dataKey ? String(this.resolveFieldData(rowData, this.dataKey)) : null; - this.anchorRowIndex = index; - this.rangeRowIndex = index; - - if(metaSelection) { - let metaKey = event.metaKey||event.ctrlKey; - - if(selected && metaKey) { - if(this.isSingleSelectionMode()) { - this._selection = null; - this.selectionKeys = {}; - this.selectionChange.emit(null); - } - else { - let selectionIndex = this.findIndexInSelection(rowData); - this._selection = this.selection.filter((val,i) => i!=selectionIndex); - this.selectionChange.emit(this.selection); - if(dataKeyValue) { - delete this.selectionKeys[dataKeyValue]; - } - } - - this.onRowUnselect.emit({originalEvent: event, data: rowData, type: 'row'}); - } - else { - if(this.isSingleSelectionMode()) { - this._selection = rowData; - this.selectionChange.emit(rowData); - if(dataKeyValue) { - this.selectionKeys = {}; - this.selectionKeys[dataKeyValue] = 1; - } - } - else if(this.isMultipleSelectionMode()) { - if(metaKey) { - this._selection = this.selection||[]; - } - else { - this._selection = []; - this.selectionKeys = {}; - } - - if(!rowData.disabled){ - this._selection = [...this.selection,rowData]; - } - - this.selectionChange.emit(this.selection); - if(dataKeyValue) { - this.selectionKeys[dataKeyValue] = 1; - } - } - - this.onRowSelect.emit({originalEvent: event, data: rowData, type: 'row'}); - } - } - else { - if(this.isSingleSelectionMode()) { - if(selected) { - this._selection = null; - this.selectionKeys = {}; - this.selectionChange.emit(this.selection); - this.onRowUnselect.emit({originalEvent: event, data: rowData, type: 'row'}); - } - else { - this._selection = rowData; - this.selectionChange.emit(this.selection); - this.onRowSelect.emit({originalEvent: event, data: rowData, type: 'row'}); - if(dataKeyValue) { - this.selectionKeys = {}; - this.selectionKeys[dataKeyValue] = 1; - } - } - } - else { - if(selected) { - let selectionIndex = this.findIndexInSelection(rowData); - this._selection = this.selection.filter((val,i) => i!=selectionIndex); - this.selectionChange.emit(this.selection); - this.onRowUnselect.emit({originalEvent: event, data: rowData, type: 'row'}); - if(dataKeyValue) { - delete this.selectionKeys[dataKeyValue]; - } - } - else { - this._selection = [...this.selection||[],rowData]; - this.selectionChange.emit(this.selection); - this.onRowSelect.emit({originalEvent: event, data: rowData, type: 'row'}); - if(dataKeyValue) { - this.selectionKeys[dataKeyValue] = 1; - } - } - } - - } - } - - this.preventSelectionKeysPropagation = true; - } - - this.rowTouched = false; - } - - handleRowTouchEnd(event: Event) { - this.rowTouched = true; - } - - selectRowWithRadio(event: Event, rowData:any) { - if(this.selection != rowData) { - this._selection = rowData; - this.selectionChange.emit(this.selection); - this.onRowSelect.emit({originalEvent: event, data: rowData, type: 'radiobutton'}); - - if(this.dataKey) { - this.selectionKeys = {}; - this.selectionKeys[String(this.resolveFieldData(rowData, this.dataKey))] = 1; - } - } - else { - this._selection = null; - this.selectionChange.emit(this.selection); - this.onRowUnselect.emit({originalEvent: event, data: rowData, type: 'radiobutton'}); - } - - this.preventSelectionKeysPropagation = true; - this.preventRowClickPropagation = true; - } - - toggleRowWithCheckbox(event, rowData: any) { - let selectionIndex = this.findIndexInSelection(rowData); - this.selection = this.selection||[]; - let dataKeyValue: string = this.dataKey ? String(this.resolveFieldData(rowData, this.dataKey)) : null; - - if(selectionIndex != -1) { - this._selection = this.selection.filter((val,i) => i!=selectionIndex); - this.selectionChange.emit(this.selection); - this.onRowUnselect.emit({originalEvent: event, data: rowData, type: 'checkbox'}); - if(dataKeyValue) { - delete this.selectionKeys[dataKeyValue]; - } - } - else { - if(!rowData.disabled){ - this._selection = [...this.selection,rowData]; - } - - this.selectionChange.emit(this.selection); - this.onRowSelect.emit({originalEvent: event, data: rowData, type: 'checkbox'}); - if(dataKeyValue) { - this.selectionKeys[dataKeyValue] = 1; - } - } - - this.preventSelectionKeysPropagation = true; - this.preventRowClickPropagation = true; - } - - toggleRowsWithCheckbox(event) { - if(event.checked){ - this.selection = this.headerCheckboxToggleAllPages ? this.value.slice() : this.dataToRender.slice(); - let [...selectionTemp] = this.selection; - this.selection.forEach((ele, i)=>{ - if(ele.disabled){ - let index = selectionTemp.findIndex((value, index, arr)=>{ - return value === ele; - }) - selectionTemp.splice(index, 1); - } - }) - this.selection = selectionTemp; - }else{ - this.selection = []; - } - this.selectionChange.emit(this.selection); - - this.onHeaderCheckboxToggle.emit({originalEvent: event, checked: event.checked}); - } - - onRowRightClick(event, rowData) { - if(this.contextMenu) { - let selectionIndex = this.findIndexInSelection(rowData); - let selected = selectionIndex != -1; - let dataKeyValue: string = this.dataKey ? String(this.resolveFieldData(rowData, this.dataKey)) : null; - - if(!selected) { - if(this.isSingleSelectionMode()) { - this.selection = rowData; - this.selectionChange.emit(rowData); - } - else if(this.isMultipleSelectionMode()) { - this.selection = [rowData]; - this.selectionChange.emit(this.selection); - } - - if(this.dataKey) { - this.selectionKeys[String(this.resolveFieldData(rowData, this.dataKey))] = 1; - this.preventSelectionKeysPropagation = true; - } - } - - this.contextMenu.show(event); - this.onContextMenuSelect.emit({originalEvent: event, data: rowData}); - } - } - - rowDblclick(event, rowData) { - this.onRowDblclick.emit({originalEvent: event, data: rowData}); - } - - isSingleSelectionMode() { - return this.selectionMode === 'single'; - } - - isMultipleSelectionMode() { - return this.selectionMode === 'multiple'; - } - - findIndexInSelection(rowData: any) { - let index: number = -1; - if(this.selection) { - for(let i = 0; i < this.selection.length; i++) { - if(this.equals(rowData, this.selection[i])) { - index = i; - break; - } - } - } - - return index; - } - - isSelected(rowData) { - if(rowData && this.selection) { - if(this.dataKey) { - return this.selectionKeys[this.objectUtils.resolveFieldData(rowData, this.dataKey)] !== undefined; - } - else { - if(this.selection instanceof Array) - return this.findIndexInSelection(rowData) > -1; - else - return this.equals(rowData, this.selection); - } - } - - return false; - } - - equals(data1, data2) { - return this.compareSelectionBy === 'equals' ? (data1 === data2) : this.objectUtils.equals(data1, data2, this.dataKey); - } - - get allSelected() { - if(this.headerCheckboxToggleAllPages) { - return this.selection && this.value && this.selection.length === this.value.length; - } - else { - let val = true; - let num = 0; - this.dataToRender && this.dataToRender.map(ele=>{ - if(ele.disabled) - num++; - }) - - if(this.dataToRender && this.selection && (this.dataToRender.length <= (this.selection.length + num))) { - for(let data of this.dataToRender) { - if(!this.isSelected(data) && !data.disabled) { - val = false; - break; - } - } - } - else { - val = false; - } - - if(this.selection.length == 0){ - val = false; - } - - return val; - } - } - - onFilterKeyup(value, field, matchMode) { - if(this.filterTimeout) { - clearTimeout(this.filterTimeout); - } - - this.filterTimeout = setTimeout(() => { - this.filter(value, field, matchMode); - this.filterTimeout = null; - }, this.filterDelay); - } - - filter(value, field, matchMode) { - if(!this.isFilterBlank(value)) - this.filters[field] = {value: value, matchMode: matchMode}; - else if(this.filters[field]) - delete this.filters[field]; - - this._filter(); - } - - isFilterBlank(filter: any): boolean { - if(filter !== null && filter !== undefined) { - if((typeof filter === 'string' && filter.trim().length == 0) || (filter instanceof Array && filter.length == 0)) - return true; - else - return false; - } - return true; - } - - _filter() { - this._first = 0; - - if(this.lazy) { - this.onLazyLoad.emit(this.createLazyLoadMetadata()); - } - else { - if(!this.value || !this.columns) { - return; - } - - this.filteredValue = []; - - for(let i = 0; i < this.value.length; i++) { - let localMatch = true; - let globalMatch = false; - - for(let j = 0; j < this.columns.length; j++) { - let col = this.columns[j], - filterMeta = this.filters[col.filterField||col.field]; - - //local - if(filterMeta) { - let filterValue = filterMeta.value, - filterField = col.filterField||col.field, - filterMatchMode = filterMeta.matchMode||'startsWith', - dataFieldValue = this.resolveFieldData(this.value[i], filterField); - let filterConstraint = this.filterConstraints[filterMatchMode]; - - if(!filterConstraint(dataFieldValue, filterValue)) { - localMatch = false; - } - - if(!localMatch) { - break; - } - } - - //global - if(!col.excludeGlobalFilter && this.globalFilter && !globalMatch) { - globalMatch = this.filterConstraints['contains'](this.resolveFieldData(this.value[i], col.filterField||col.field), this.globalFilter.value); - } - } - - let matches = localMatch; - if(this.globalFilter) { - matches = localMatch&&globalMatch; - } - - if(matches) { - this.filteredValue.push(this.value[i]); - } - } - - if(this.filteredValue.length === this.value.length) { - this.filteredValue = null; - } - - if(this.paginator) { - this.totalRecords = this.filteredValue ? this.filteredValue.length: this.value ? this.value.length: 0; - } - - this.updateDataToRender(this.filteredValue||this.value); - } - - this.onFilter.emit({ - filters: this.filters, - filteredValue: this.filteredValue||this.value - }); - } - - hasFilter() { - let empty = true; - for(let prop in this.filters) { - if(this.filters.hasOwnProperty(prop)) { - empty = false; - break; - } - } - - return !empty || (this.globalFilter && this.globalFilter.value && this.globalFilter.value.trim().length); - } - - onFilterInputClick(event) { - event.stopPropagation(); - } - - filterConstraints = { - - startsWith(value, filter): boolean { - if(filter === undefined || filter === null || filter.trim() === '') { - return true; - } - - if(value === undefined || value === null) { - return false; - } - - let filterValue = filter.toLowerCase(); - return value.toString().toLowerCase().slice(0, filterValue.length) === filterValue; - }, - - contains(value, filter): boolean { - if(filter === undefined || filter === null || (typeof filter === 'string' && filter.trim() === '')) { - return true; - } - - if(value === undefined || value === null) { - return false; - } - - return value.toString().toLowerCase().indexOf(filter.toLowerCase()) !== -1; - }, - - endsWith(value, filter): boolean { - if(filter === undefined || filter === null || filter.trim() === '') { - return true; - } - - if(value === undefined || value === null) { - return false; - } - - let filterValue = filter.toString().toLowerCase(); - return value.toString().toLowerCase().indexOf(filterValue, value.toString().length - filterValue.length) !== -1; - }, - - equals(value, filter): boolean { - if(filter === undefined || filter === null || (typeof filter === 'string' && filter.trim() === '')) { - return true; - } - - if(value === undefined || value === null) { - return false; - } - - return value.toString().toLowerCase() == filter.toString().toLowerCase(); - }, - - notEquals(value, filter): boolean { - if(filter === undefined || filter === null || (typeof filter === 'string' && filter.trim() === '')) { - return false; - } - - if(value === undefined || value === null) { - return true; - } - - return value.toString().toLowerCase() != filter.toString().toLowerCase(); - }, - - in(value, filter: any[]): boolean { - if(filter === undefined || filter === null || filter.length === 0) { - return true; - } - - if(value === undefined || value === null) { - return false; - } - - for(let i = 0; i < filter.length; i++) { - if(filter[i] === value) - return true; - } - - return false; - } - } - - switchCellToEditMode(cell: any, column: Column, rowData: any) { - if(!this.selectionMode && this.editable && column.editable) { - this.editorClick = true; - this.bindDocumentEditListener(); - - if(cell != this.editingCell) { - if(this.editingCell && this.domHandler.find(this.editingCell, '.ng-invalid.ng-dirty').length == 0) { - this.domHandler.removeClass(this.editingCell, 'ui-cell-editing'); - } - - this.editingCell = cell; - this.onEditInit.emit({column: column, data: rowData}); - this.domHandler.addClass(cell, 'ui-cell-editing'); - let focusable = this.domHandler.findSingle(cell, '.ui-cell-editor input, .ui-cell-editor textarea'); - if(focusable) { - setTimeout(() => this.domHandler.invokeElementMethod(focusable, 'focus'), 50); - } - } - } - } - - switchCellToViewMode(element: any) { - this.editingCell = null; - let cell = this.findCell(element); - this.domHandler.removeClass(cell, 'ui-cell-editing'); - this.unbindDocumentEditListener(); - } - - closeCell() { - if(this.editingCell) { - this.domHandler.removeClass(this.editingCell, 'ui-cell-editing'); - this.editingCell = null; - this.unbindDocumentEditListener(); - } - } - - bindDocumentEditListener() { - if(!this.documentEditListener) { - this.documentEditListener = this.renderer.listen('document', 'click', (event) => { - if(!this.editorClick) { - this.closeCell(); - } - this.editorClick = false; - }); - } - } - - unbindDocumentEditListener() { - if(this.documentEditListener) { - this.documentEditListener(); - this.documentEditListener = null; - } - } - - onCellEditorKeydown(event, column: Column, rowData: any, rowIndex: number) { - if(this.editable) { - //enter - if(event.keyCode == 13) { - if(this.domHandler.find(this.editingCell, '.ng-invalid.ng-dirty').length == 0) { - this.switchCellToViewMode(event.target); - event.preventDefault(); - } - } - - //escape - else if(event.keyCode == 27) { - this.switchCellToViewMode(event.target); - event.preventDefault(); - } - - //tab - else if(event.keyCode == 9) { - if(event.shiftKey) - this.moveToPreviousCell(event); - else - this.moveToNextCell(event); - } - } - } - - onCellEditorInput(event, column: Column, rowData: any, rowIndex: number) { - if(this.editable) { - this.onEdit.emit({originalEvent: event, column: column, data: rowData, index: rowIndex}); - } - } - - onCellEditorChange(event, column: Column, rowData: any, rowIndex: number) { - if(this.editable) { - this.editChanged = true; - - this.onEditComplete.emit({column: column, data: rowData, index: rowIndex}); - } - } - - onCellEditorBlur(event, column: Column, rowData: any, rowIndex: number) { - if(this.editable) { - if(this.editChanged) - this.editChanged = false; - else - this.onEditCancel.emit({column: column, data: rowData, index: rowIndex}); - } - } - - moveToPreviousCell(event: KeyboardEvent) { - let currentCell = this.findCell(event.target); - let row = currentCell.parentElement; - let targetCell = this.findPreviousEditableColumn(currentCell); - - if(targetCell) { - this.domHandler.invokeElementMethod(targetCell, 'click'); - event.preventDefault(); - } - } - - moveToNextCell(event: KeyboardEvent) { - let currentCell = this.findCell(event.target); - let row = currentCell.parentElement; - let targetCell = this.findNextEditableColumn(currentCell); - - if(targetCell) { - this.domHandler.invokeElementMethod(targetCell, 'click'); - event.preventDefault(); - } - } - - findPreviousEditableColumn(cell: Element) { - let prevCell = cell.previousElementSibling; - - if(!prevCell) { - let previousRow = cell.parentElement.previousElementSibling; - if(previousRow) { - prevCell = previousRow.lastElementChild; - } - } - - if(prevCell) { - if(this.domHandler.hasClass(prevCell, 'ui-editable-column')) - return prevCell; - else - return this.findPreviousEditableColumn(prevCell); - } - else { - return null; - } - } - - findNextEditableColumn(cell: Element) { - let nextCell = cell.nextElementSibling; - - if(!nextCell) { - let nextRow = cell.parentElement.nextElementSibling; - if(nextRow) { - nextCell = nextRow.firstElementChild; - } - } - - if(nextCell) { - if(this.domHandler.hasClass(nextCell, 'ui-editable-column')) - return nextCell; - else - return this.findNextEditableColumn(nextCell); - } - else { - return null; - } - } - - onCustomEditorFocusPrev(event: KeyboardEvent) { - this.moveToPreviousCell(event); - } - - onCustomEditorFocusNext(event: KeyboardEvent) { - this.moveToNextCell(event); - } - - findCell(element) { - if(element) { - let cell = element; - while(cell && cell.tagName != 'TD') { - cell = cell.parentElement; - } - - return cell; - } - else { - return null; - } - } - - initResizableColumns() { - this.tbody = this.domHandler.findSingle(this.el.nativeElement, 'tbody.ui-datatable-data'); - this.resizerHelper = this.domHandler.findSingle(this.el.nativeElement, 'div.ui-column-resizer-helper'); - this.fixColumnWidths(); - } - - onDocumentMouseMove(event) { - if(this.columnResizing) { - this.onColumnResize(event); - } - } - - onDocumentMouseUp(event) { - if(this.columnResizing) { - this.columnResizing = false; - this.onColumnResizeEnd(event); - } - } - - bindColumnResizeEvents() { - this.zone.runOutsideAngular(() => { - window.document.addEventListener('mousemove', this.onDocumentMouseMove.bind(this)); - }); - - this.documentColumnResizeEndListener = this.renderer.listen('document', 'mouseup', (event) => { - if(this.columnResizing) { - this.columnResizing = false; - this.onColumnResizeEnd(event); - } - }); - } - - unbindColumnResizeEvents() { - window.document.removeEventListener('mousemove', this.onDocumentMouseMove); - - if(this.documentColumnResizeEndListener) { - this.documentColumnResizeEndListener(); - this.documentColumnResizeEndListener = null; - } - } - - initColumnResize(event) { - this.bindColumnResizeEvents(); - - let container = this.el.nativeElement.children[0]; - let containerLeft = this.domHandler.getOffset(container).left; - this.resizeColumn = event.target.parentElement; - this.columnResizing = true; - this.lastResizerHelperX = (event.pageX - containerLeft + container.scrollLeft); - } - - onColumnResize(event) { - let container = this.el.nativeElement.children[0]; - let containerLeft = this.domHandler.getOffset(container).left; - this.domHandler.addClass(container, 'ui-unselectable-text'); - this.resizerHelper.style.height = container.offsetHeight + 'px'; - this.resizerHelper.style.top = 0 + 'px'; - this.resizerHelper.style.left = (event.pageX - containerLeft + container.scrollLeft) + 'px'; - - this.resizerHelper.style.display = 'block'; - } - - onColumnResizeEnd(event) { - let delta = this.resizerHelper.offsetLeft - this.lastResizerHelperX; - let columnWidth = this.resizeColumn.offsetWidth; - let newColumnWidth = columnWidth + delta; - let minWidth = this.resizeColumn.style.minWidth||15; - - if(columnWidth + delta > parseInt(minWidth)) { - if(this.columnResizeMode === 'fit') { - let nextColumn = this.resizeColumn.nextElementSibling; - while (this.domHandler.hasClass(nextColumn, 'ui-helper-hidden')) { - nextColumn = nextColumn.nextElementSibling; - } - - if(nextColumn) { - let nextColumnWidth = nextColumn.offsetWidth - delta; - let nextColumnMinWidth = nextColumn.style.minWidth || 15; - - if (newColumnWidth > 15 && nextColumnWidth > parseInt(nextColumnMinWidth)) { - this.resizeColumn.style.width = newColumnWidth + 'px'; - if (nextColumn) { - nextColumn.style.width = nextColumnWidth + 'px'; - } - - if (this.scrollable) { - let colGroup = this.domHandler.findSingle(this.el.nativeElement, 'colgroup.ui-datatable-scrollable-colgroup'); - let resizeColumnIndex = this.domHandler.index(this.resizeColumn); - colGroup.children[resizeColumnIndex].style.width = newColumnWidth + 'px'; - - if (nextColumn) { - colGroup.children[resizeColumnIndex + 1].style.width = nextColumnWidth + 'px'; - } - } - } - } - } - else if(this.columnResizeMode === 'expand') { - this.tbody.parentElement.style.width = this.tbody.parentElement.offsetWidth + delta + 'px'; - this.resizeColumn.style.width = newColumnWidth + 'px'; - let containerWidth = this.tbody.parentElement.style.width; - - if(this.scrollable) { - this.domHandler.findSingle(this.el.nativeElement, '.ui-datatable-scrollable-header-box').children[0].style.width = containerWidth; - let colGroup = this.domHandler.findSingle(this.el.nativeElement, 'colgroup.ui-datatable-scrollable-colgroup'); - let resizeColumnIndex = this.domHandler.index(this.resizeColumn); - colGroup.children[resizeColumnIndex].style.width = newColumnWidth + 'px'; - } - else { - this.el.nativeElement.children[0].style.width = containerWidth; - } - } - - this.onColResize.emit({ - element: this.resizeColumn, - delta: delta - }); - } - - this.resizerHelper.style.display = 'none'; - this.resizeColumn = null; - this.domHandler.removeClass(this.el.nativeElement.children[0], 'ui-unselectable-text'); - this.unbindColumnResizeEvents(); - } - - fixColumnWidths() { - let columns = this.domHandler.find(this.el.nativeElement, 'th.ui-resizable-column'); - let bodyCols; - - for(let i = 0; i < columns.length; i++) { - columns[i].style.width = columns[i].offsetWidth + 'px'; - } - - if(this.scrollable) { - let colGroup = this.domHandler.findSingle(this.el.nativeElement, 'colgroup.ui-datatable-scrollable-colgroup'); - bodyCols = colGroup.children; - - if(bodyCols) { - for (let i = 0; i < bodyCols.length; i++) { - bodyCols[i].style.width = columns[i].offsetWidth + 'px'; - } - } - } - } - - onColumnDragStart(event) { - if (this.columnResizing) { - event.preventDefault(); - return; - } - - this.draggedColumn = this.findParentHeader(event.target); - event.dataTransfer.setData('text', 'b'); // Firefox requires this to make dragging possible - this.zone.runOutsideAngular(() => { - window.document.addEventListener('dragover', this.onColumnDragover.bind(this)); - }); - } - - onColumnDragover(event) { - let dropHeader = this.findParentHeader(event.target); - if(this.reorderableColumns && this.draggedColumn && dropHeader) { - event.preventDefault(); - let container = this.el.nativeElement.children[0]; - let containerOffset = this.domHandler.getOffset(container); - let dropHeaderOffset = this.domHandler.getOffset(dropHeader); - - if(this.draggedColumn != dropHeader) { - let targetLeft = dropHeaderOffset.left - containerOffset.left; - let targetTop = containerOffset.top - dropHeaderOffset.top; - let columnCenter = dropHeaderOffset.left + dropHeader.offsetWidth / 2; - - this.reorderIndicatorUp.style.top = dropHeaderOffset.top - containerOffset.top - (this.iconHeight - 1) + 'px'; - this.reorderIndicatorDown.style.top = dropHeaderOffset.top - containerOffset.top + dropHeader.offsetHeight + 'px'; - - if(event.pageX > columnCenter) { - this.reorderIndicatorUp.style.left = (targetLeft + dropHeader.offsetWidth - Math.ceil(this.iconWidth / 2)) + 'px'; - this.reorderIndicatorDown.style.left = (targetLeft + dropHeader.offsetWidth - Math.ceil(this.iconWidth / 2))+ 'px'; - this.dropPosition = 1; - } - else { - this.reorderIndicatorUp.style.left = (targetLeft - Math.ceil(this.iconWidth / 2)) + 'px'; - this.reorderIndicatorDown.style.left = (targetLeft - Math.ceil(this.iconWidth / 2))+ 'px'; - this.dropPosition = -1; - } - - this.reorderIndicatorUp.style.display = 'block'; - this.reorderIndicatorDown.style.display = 'block'; - } - else { - event.dataTransfer.dropEffect = 'none'; - } - } - } - - onColumnDragleave(event) { - if(this.reorderableColumns && this.draggedColumn) { - event.preventDefault(); - this.reorderIndicatorUp.style.display = 'none'; - this.reorderIndicatorDown.style.display = 'none'; - window.document.removeEventListener('dragover', this.onColumnDragover); - } - } - - onColumnDrop(event) { - event.preventDefault(); - if(this.draggedColumn) { - let dragIndex = this.domHandler.index(this.draggedColumn); - let dropIndex = this.domHandler.index(this.findParentHeader(event.target)); - let allowDrop = (dragIndex != dropIndex); - if(allowDrop && ((dropIndex - dragIndex == 1 && this.dropPosition === -1) || (dragIndex - dropIndex == 1 && this.dropPosition === 1))) { - allowDrop = false; - } - - if(allowDrop) { - this.objectUtils.reorderArray(this.columns, dragIndex, dropIndex); - if(this.scrollable) { - this.initScrollableColumns(); - } - - this.onColReorder.emit({ - dragIndex: dragIndex, - dropIndex: dropIndex, - columns: this.columns - }); - } - - this.reorderIndicatorUp.style.display = 'none'; - this.reorderIndicatorDown.style.display = 'none'; - this.draggedColumn.draggable = false; - this.draggedColumn = null; - this.dropPosition = null; - } - } - - initColumnReordering() { - this.reorderIndicatorUp = this.domHandler.findSingle(this.el.nativeElement.children[0], 'span.ui-datatable-reorder-indicator-up'); - this.reorderIndicatorDown = this.domHandler.findSingle(this.el.nativeElement.children[0], 'span.ui-datatable-reorder-indicator-down'); - this.iconWidth = this.domHandler.getHiddenElementOuterWidth(this.reorderIndicatorUp); - this.iconHeight = this.domHandler.getHiddenElementOuterHeight(this.reorderIndicatorUp); - } - - findParentHeader(element) { - if(element.nodeName == 'TH') { - return element; - } - else { - let parent = element.parentElement; - while(parent.nodeName != 'TH') { - parent = parent.parentElement; - if(!parent) break; - } - return parent; - } - } - - hasFooter() { - if(this.footerColumnGroups && this.footerColumnGroups.first) { - return true; - } - else { - if(this.columns) { - for(let i = 0; i < this.columns.length; i++) { - if(this.columns[i].footer || this.columns[i].footerTemplate) { - return true; - } - } - } - - } - return false; - } - - isEmpty() { - return !this.dataToRender||(this.dataToRender.length == 0); - } - - createLazyLoadMetadata(): LazyLoadEvent { - return { - first: this.first, - rows: this.virtualScroll ? this.rows * 2 : this.rows, - sortField: this.sortField, - sortOrder: this.sortOrder, - filters: this.filters, - globalFilter: this.globalFilter ? this.globalFilter.value : null, - multiSortMeta: this.multiSortMeta - }; - } - - toggleRow(row: any, event?: Event) { - if(!this.expandedRows) { - this.expandedRows = []; - } - - let expandedRowIndex = this.findExpandedRowIndex(row); - - if(expandedRowIndex != -1) { - this.expandedRows.splice(expandedRowIndex, 1); - this.onRowCollapse.emit({ - originalEvent: event, - data: row - }); - } - else { - if(this.rowExpandMode === 'single') { - this.expandedRows = []; - } - - this.expandedRows.push(row); - this.onRowExpand.emit({ - originalEvent: event, - data: row - }); - } - - if(event) { - event.preventDefault(); - } - } - - findExpandedRowIndex(row: any): number { - let index = -1; - if(this.expandedRows) { - for(let i = 0; i < this.expandedRows.length; i++) { - if(this.expandedRows[i] == row) { - index = i; - break; - } - } - } - return index; - } - - isRowExpanded(row: any): boolean { - return this.findExpandedRowIndex(row) != -1; - } - - findExpandedRowGroupIndex(row: any): number { - let index = -1; - if(this.expandedRowsGroups && this.expandedRowsGroups.length) { - for(let i = 0; i < this.expandedRowsGroups.length; i++) { - let group = this.expandedRowsGroups[i]; - let rowGroupField = this.resolveFieldData(row, this.groupField); - if(rowGroupField === group) { - index = i; - break; - } - } - } - return index; - } - - isRowGroupExpanded(row: any): boolean { - return this.findExpandedRowGroupIndex(row) != -1; - } - - toggleRowGroup(event: Event, row: any): void { - - if(!this.expandedRowsGroups) { - this.expandedRowsGroups = []; - } - - this.rowGroupToggleClick = true; - let index = this.findExpandedRowGroupIndex(row); - let rowGroupField = this.resolveFieldData(row, this.groupField); - if(index >= 0) { - this.expandedRowsGroups.splice(index, 1); - this.onRowGroupCollapse.emit({ - originalEvent: event, - group: rowGroupField - }); - } - else { - - if(this.rowGroupExpandMode === 'single') { - this.expandedRowsGroups = []; - } - - this.expandedRowsGroups.push(rowGroupField); - this.onRowGroupExpand.emit({ - originalEvent: event, - group: rowGroupField - }); - } - event.preventDefault(); - } - - public reset() { - this._sortField = null; - this._sortOrder = 1; - - this.filteredValue = null; - this.filters = {}; - - this._first = 0; - this.firstChange.emit(this._first); - this.updateTotalRecords(); - - if(this.lazy) - this.onLazyLoad.emit(this.createLazyLoadMetadata()); - else - this.updateDataToRender(this.value); - } - - public exportCSV(options?:any) { - let data = this.filteredValue||this.value; - let csv = '\ufeff'; - - if(options && options.selectionOnly) { - data = this.selection||[]; - } - - //headers - for(let i = 0; i < this.columns.length; i++) { - let column = this.columns[i]; - if(column.exportable && column.field) { - csv += '"' + (column.header || column.field) + '"'; - - if(i < (this.columns.length - 1)) { - csv += this.csvSeparator; - } - } - } - - //body - data.forEach((record, i) => { - csv += '\n'; - for(let i = 0; i < this.columns.length; i++) { - let column = this.columns[i]; - if(column.exportable && column.field) { - let cellData = this.resolveFieldData(record, column.field); - - if(cellData != null) - cellData = String(cellData).replace(/"/g, '""'); - else - cellData = ''; - - csv += '"' + cellData + '"'; - - if(i < (this.columns.length - 1)) { - csv += this.csvSeparator; - } - } - } - }); - - let blob = new Blob([csv],{ - type: 'text/csv;charset=utf-8;' - }); - - if(window.navigator.msSaveOrOpenBlob) { - navigator.msSaveOrOpenBlob(blob, this.exportFilename + '.csv'); - } - else { - let link = document.createElement("a"); - link.style.display = 'none'; - document.body.appendChild(link); - if(link.download !== undefined) { - link.setAttribute('href', URL.createObjectURL(blob)); - link.setAttribute('download', this.exportFilename + '.csv'); - link.click(); - } - else { - csv = 'data:text/csv;charset=utf-8,' + csv; - window.open(encodeURI(csv)); - } - document.body.removeChild(link); - } - } - - getBlockableElement(): HTMLElement { - return this.el.nativeElement.children[0]; - } - - getRowStyleClass(rowData: any, rowIndex: number) { - let styleClass = 'ui-widget-content'; - if(this.rowStyleClass) { - let rowClass = this.rowStyleClass.call(this, rowData, rowIndex); - if(rowClass) { - styleClass += ' ' + rowClass; - } - } - else if (this.rowStyleMap && this.dataKey) { - let rowClass = this.rowStyleMap[rowData[this.dataKey]]; - if (rowClass) { - styleClass += ' ' + rowClass; - } - } - - return styleClass; - } - - visibleColumns() { - return this.columns ? this.columns.filter(c => !c.hidden): []; - } - - get containerWidth() { - if(this.scrollable) { - if(this.scrollWidth) { - return this.scrollWidth; - } - else if(this.frozenWidth && this.unfrozenWidth) { - return parseFloat(this.frozenWidth) + parseFloat(this.unfrozenWidth) + 'px'; - } - } - else { - return this.style ? this.style.width : null; - } - } - - hasFrozenColumns() { - return this.frozenColumns && this.frozenColumns.length > 0; - } - - ngOnDestroy() { - //remove event listener - if(this.globalFilterFunction) { - this.globalFilterFunction(); - } - - if(this.resizableColumns) { - this.unbindColumnResizeEvents(); - } - - this.unbindDocumentEditListener(); - - if(this.columnsSubscription) { - this.columnsSubscription.unsubscribe(); - } - - if(this.virtualScrollCallback) { - this.virtualScrollCallback = null; - } - } -} - -@NgModule({ - imports: [CommonModule,SharedModule,PaginatorModule,FormsModule], - exports: [DataTable,SharedModule], - declarations: [DataTable,DTRadioButton,DTCheckbox,ColumnHeaders,ColumnFooters,TableBody,ScrollableView] -}) -export class DataTableModule { } diff --git a/dashboard/src/app/components/dataview/dataview.css b/dashboard/src/app/components/dataview/dataview.css deleted file mode 100644 index c811ae704..000000000 --- a/dashboard/src/app/components/dataview/dataview.css +++ /dev/null @@ -1,37 +0,0 @@ -.ui-dataview .ui-paginator { - text-align: center; -} - -.ui-dataview-column { - padding: .25em; -} - -.ui-dataview-content-empty { - padding: .25em .625em; -} - -.ui-dataview .ui-dataview-header, -.ui-dataview .ui-dataview-footer { - padding: .5em .75em; -} - -.ui-dataview .ui-dataview-header { - border-bottom: 0 none; -} - -.ui-dataview .ui-dataview-footer { - border-top: 0 none; -} - -.ui-dataview .ui-paginator-top { - border-bottom: 0 none; -} - -.ui-dataview .ui-paginator-bottom { - border-top: 0 none; -} - -.ui-dataview.ui-dataview-list > .ui-dataview-content > div.ui-g > div { - width: 100%; -} - diff --git a/dashboard/src/app/components/dataview/dataview.ts b/dashboard/src/app/components/dataview/dataview.ts deleted file mode 100644 index 40689c85d..000000000 --- a/dashboard/src/app/components/dataview/dataview.ts +++ /dev/null @@ -1,293 +0,0 @@ -import {NgModule,Component,ElementRef,OnInit,AfterContentInit,DoCheck,OnDestroy,Input,Output,SimpleChange,EventEmitter,ContentChild,ContentChildren,QueryList,TemplateRef} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {ObjectUtils} from '../utils/objectutils'; -import {Header,Footer,PrimeTemplate,SharedModule} from '../common/shared'; -import {PaginatorModule} from '../paginator/paginator'; -import {BlockableUI} from '../common/blockableui'; -import {SelectItem} from '../common/selectitem'; - -@Component({ - selector: 'p-dataView', - template: ` -
-
- -
- -
-
- - - -
{{emptyMessage}}
-
-
- - -
- `, - providers: [ObjectUtils] -}) -export class DataView implements OnInit,AfterContentInit,BlockableUI { - - @Input() layout: string = 'list'; - - @Input() paginator: boolean; - - @Input() rows: number; - - @Input() totalRecords: number; - - @Input() pageLinks: number = 5; - - @Input() rowsPerPageOptions: number[]; - - @Input() paginatorPosition: string = 'bottom'; - - @Input() alwaysShowPaginator: boolean = true; - - @Input() paginatorDropdownAppendTo: any; - - @Input() lazy: boolean; - - @Input() emptyMessage: string = 'No records found'; - - @Output() onLazyLoad: EventEmitter = new EventEmitter(); - - @Input() style: any; - - @Input() styleClass: string; - - @Input() trackBy: Function = (index: number, item: any) => item; - - @Input() filterBy: string; - - @Output() onPage: EventEmitter = new EventEmitter(); - - @Output() onSort: EventEmitter = new EventEmitter(); - - @ContentChild(Header) header; - - @ContentChild(Footer) footer; - - @ContentChildren(PrimeTemplate) templates: QueryList; - - _value: any[]; - - listItemTemplate: TemplateRef; - - gridItemTemplate: TemplateRef; - - itemTemplate: TemplateRef; - - first: number = 0; - - filteredValue: any[]; - - _sortField: string; - - _sortOrder: number = 1; - - initialized: boolean; - - constructor(public el: ElementRef, public objectUtils: ObjectUtils) {} - - ngOnInit() { - if(this.lazy) { - this.onLazyLoad.emit(this.createLazyLoadMetadata()); - } - this.initialized = true; - } - - @Input() get sortField(): string { - return this._sortField; - } - - set sortField(val: string) { - this._sortField = val; - - //avoid triggering lazy load prior to lazy initialization at onInit - if ( !this.lazy || this.initialized ) { - this.sort(); - } - } - - @Input() get sortOrder(): number { - return this._sortOrder; - } - set sortOrder(val: number) { - this._sortOrder = val; - - //avoid triggering lazy load prior to lazy initialization at onInit - if ( !this.lazy || this.initialized ) { - this.sort(); - } - } - - ngAfterContentInit() { - this.templates.forEach((item) => { - switch(item.getType()) { - case 'listItem': - this.listItemTemplate = item.template; - break; - - case 'gridItem': - this.gridItemTemplate = item.template; - break; - } - }); - - this.updateItemTemplate(); - } - - updateItemTemplate() { - switch(this.layout) { - case 'list': - this.itemTemplate = this.listItemTemplate; - break; - - case 'grid': - this.itemTemplate = this.gridItemTemplate; - break; - } - } - - @Input() get value(): any[] { - return this._value; - } - - set value(val:any[]) { - this._value = val; - this.updateTotalRecords(); - } - - changeLayout(layout: string) { - this.layout = layout; - this.updateItemTemplate(); - } - - updateTotalRecords() { - this.totalRecords = this.lazy ? this.totalRecords : (this._value ? this._value.length : 0); - } - - paginate(event) { - this.first = event.first; - this.rows = event.rows; - - if (this.lazy) { - this.onLazyLoad.emit(this.createLazyLoadMetadata()); - } - - this.onPage.emit({ - first: this.first, - rows: this.rows - }); - } - - sort() { - this.first = 0; - - if(this.lazy) { - this.onLazyLoad.emit(this.createLazyLoadMetadata()); - } - else if (this.value) { - this.value.sort((data1, data2) => { - let value1 = this.objectUtils.resolveFieldData(data1, this.sortField); - let value2 = this.objectUtils.resolveFieldData(data2, this.sortField); - let result = null; - - if (value1 == null && value2 != null) - result = -1; - else if (value1 != null && value2 == null) - result = 1; - else if (value1 == null && value2 == null) - result = 0; - else if (typeof value1 === 'string' && typeof value2 === 'string') - result = value1.localeCompare(value2); - else - result = (value1 < value2) ? -1 : (value1 > value2) ? 1 : 0; - - return (this.sortOrder * result); - }); - } - - this.onSort.emit({ - sortField: this.sortField, - sortOrder: this.sortOrder - }); - } - - isEmpty() { - let data = this.filteredValue||this.value; - return data == null || data.length == 0; - } - - createLazyLoadMetadata(): any { - return { - first: this.first, - rows: this.rows - }; - } - - getBlockableElement(): HTMLElement { - return this.el.nativeElement.children[0]; - } - - filter(value: string) { - if (this.value && this.value.length) { - let searchFields = this.filterBy.split(','); - this.filteredValue = this.objectUtils.filter(this.value, searchFields, value); - - if (this.filteredValue.length === this.value.length ) { - this.filteredValue = null; - } - - if (this.paginator) { - this.totalRecords = this.filteredValue ? this.filteredValue.length : this.value ? this.value.length : 0; - } - } - - } -} - -@Component({ - selector: 'p-dataViewLayoutOptions', - template: ` - - ` -}) -export class DataViewLayoutOptions { - - @Input() style: any; - - @Input() styleClass: string; - - constructor(public dv: DataView) {} - - changeLayout(event: Event, layout: string) { - this.dv.changeLayout(layout); - event.preventDefault(); - } -} -@NgModule({ - imports: [CommonModule,SharedModule,PaginatorModule], - exports: [DataView,SharedModule,DataViewLayoutOptions], - declarations: [DataView,DataViewLayoutOptions] -}) -export class DataViewModule { } diff --git a/dashboard/src/app/components/defer/defer.ts b/dashboard/src/app/components/defer/defer.ts deleted file mode 100644 index c90e31ed9..000000000 --- a/dashboard/src/app/components/defer/defer.ts +++ /dev/null @@ -1,66 +0,0 @@ -import {NgModule,Directive,ElementRef,AfterViewInit,OnDestroy,Input,TemplateRef,EmbeddedViewRef, - ViewContainerRef,Renderer2,EventEmitter,Output,ContentChild} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {DomHandler} from '../dom/domhandler'; - -@Directive({ - selector: '[pDefer]', - host: { - }, - providers: [DomHandler] -}) -export class DeferredLoader implements AfterViewInit,OnDestroy { - - @Output() onLoad: EventEmitter = new EventEmitter(); - - @ContentChild(TemplateRef) template: TemplateRef; - - documentScrollListener: Function; - - view: EmbeddedViewRef; - - constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer2, public viewContainer: ViewContainerRef) {} - - ngAfterViewInit() { - if(this.shouldLoad()) { - this.load(); - } - - this.documentScrollListener = this.renderer.listen('window', 'scroll', () => { - if(this.shouldLoad()) { - this.load(); - this.documentScrollListener(); - this.documentScrollListener = null; - } - }); - } - - shouldLoad(): boolean { - let rect = this.el.nativeElement.getBoundingClientRect(); - let docElement = document.documentElement; - let scrollTop = (window.pageYOffset||document.documentElement.scrollTop); - let winHeight = docElement.clientHeight; - - return (winHeight >= rect.top); - } - - load(): void { - this.view = this.viewContainer.createEmbeddedView(this.template); - this.onLoad.emit(); - } - - ngOnDestroy() { - this.view = null; - - if(this.documentScrollListener) { - this.documentScrollListener(); - } - } -} - -@NgModule({ - imports: [CommonModule], - exports: [DeferredLoader], - declarations: [DeferredLoader] -}) -export class DeferModule { } \ No newline at end of file diff --git a/dashboard/src/app/components/dialog/dialog.scss b/dashboard/src/app/components/dialog/dialog.scss deleted file mode 100644 index a1832fa30..000000000 --- a/dashboard/src/app/components/dialog/dialog.scss +++ /dev/null @@ -1,165 +0,0 @@ -.ui-dialog { - position: fixed; - padding: 0; - background: #f3f6f7; - border: none; - box-shadow: 0px 5px 20px 0px rgba(0, 0, 0, 0.3); - @extend .ui-corner-all-small; -} - -.ui-dialog.ui-widget .ui-dialog-titlebar{ - padding: .3rem .4rem .2rem; - position: relative; - border: 0; - background: none; - @extend .ui-corner-top-small; - .ui-dialog-title{ - font-size: .24rem; - } -} - -.ui-dialog.ui-widget .ui-dialog-content { - position: relative; - border: 0; - padding: .1rem .4rem .3rem; - background: none; - overflow: auto; - zoom: 1; -} -.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { - float: right; -} - -.ui-dialog .ui-dialog-buttonpane button { - margin: .5em .4em .5em 0; - cursor: pointer; - float: right; -} -.ui-dialog .ui-resizable-se { - width: 14px; - height: 14px; - right: 3px; - bottom: 3px; -} -.ui-draggable .ui-dialog-titlebar { - cursor: move; -} -.ui-dialog .ui-dialog-titlebar-icon { - text-decoration: none -} -.ui-dialog .ui-dialog-titlebar-close { - float: right; - width: .24rem; - height: .24rem; - padding: .03rem .01rem 0.05rem; - margin: -.12rem -.22rem 0 0; - background: #9ba9b7; - cursor: pointer; - @extend .ui-corner-all-large; - &:hover{ - background: map-get($map: $color-primary, $key: hover); - box-shadow: 0px 4px 8px #e3e3e3; - } -} -.ui-dialog .ui-dialog-titlebar-close span { - display: block; - margin: 0; - color: #fff; - width: .22rem; - font-size: .14rem; - line-height: .16rem; -} - -.ui-dialog-footer { - padding: .18rem 0 .20rem 0; - text-align: center; - background: #e6edef; - @extend .ui-corner-bottom-small; -} -.ui-dialog .ui-dialog-footer { - border: none; -} - -.ui-dialog-mask { - position: fixed; - width: 100%; - height: 100%; -} - -/* ConfirmDialog */ -.ui-confirmdialog { - width: 5.00rem; -} - -.ui-confirmdialog.ui-dialog .ui-dialog-content { - display: flex; - display: -webkit-flex; - justify-content: flex-start; - align-items: center; -} -.ui-confirmdialog.ui-dialog .ui-dialog-content h3{ - margin-top: .10rem; -} -.ui-confirmdialog .ui-dialog-content .fa { - font-size: .48rem; - vertical-align: middle; - margin-right: .2rem; - color: #438bd3; -} -.ui-confirmdialog.ui-confirmdialog-warning .ui-dialog-content .fa { - color:#FF8833; -} - -/* Fluid */ -.ui-fluid .ui-dialog-footer .ui-button { - width: auto; -} - -/* RTL */ -.ui-rtl .ui-dialog .ui-dialog-titlebar-close { - float: left; -} - -.ui-rtl .ui-dialog .ui-dialog-buttonpane button { - text-align: right; -} - -@media screen and (max-width: 40em) { - .ui-confirmdialog { - width: 90%; - } -} - - - -/*增加msgBox样式*/ -.ui-dialog .ui-dialog-content .msgbox >div{ - display: table-cell; -} -.ui-dialog .ui-dialog-content .msgbox div:first-child{ - vertical-align: top; -} -.ui-dialog .ui-dialog-content .msgbox div:last-child{ - vertical-align: middle; - padding-left: 20px; -} -.ui-dialog .ui-dialog-content .msgbox .fa { - font-size: .48rem; - color: #438bd3; - &.error{ - color: #FF8833; - } - &.success{ - color: #3DCCA6; - } -} -.ui-dialog .ui-dialog-content .msgbox h3{ - margin-bottom: 5px; -} -.ui-dialog .ui-dialog-content .msgbox .success-title{ - color: #3DCCA6; -} -.ui-dialog .ui-dialog-content .msgbox .error-title{ - color: #FF8833; -} - diff --git a/dashboard/src/app/components/dialog/dialog.spec.ts b/dashboard/src/app/components/dialog/dialog.spec.ts deleted file mode 100644 index 39c13b21f..000000000 --- a/dashboard/src/app/components/dialog/dialog.spec.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { TestBed, ComponentFixture, fakeAsync, tick } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { Dialog } from './dialog'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('Dialog', () => { - - let dialog: Dialog; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - Dialog - ] - }); - - fixture = TestBed.createComponent(Dialog); - dialog = fixture.componentInstance; - }); - - it('should display the header', () => { - dialog.header = 'PrimeNG Dialog Header'; - fixture.detectChanges(); - const headerEl = fixture.debugElement.query(By.css('.ui-dialog-title')); - expect(headerEl.nativeElement.textContent).toContain('PrimeNG Dialog Header') - }); - - it('should display close icon when closable', () => { - fixture.detectChanges(); - const closeEl = fixture.debugElement.query(By.css('.ui-dialog-titlebar-close')); - expect(closeEl).not.toBeNull(); - }); - - it('should display resizer when resizable', () => { - fixture.detectChanges(); - const resizeEl = fixture.debugElement.query(By.css('.ui-resizable-handle')); - expect(resizeEl).not.toBeNull(); - }); - - it('should be hidden by default', () => { - fixture.detectChanges(); - expect(fixture.debugElement.children[0].styles.display).toEqual('none'); - }); - - it('should add rtl class when rtl is enabled', () => { - dialog.rtl = true; - fixture.detectChanges(); - expect(fixture.debugElement.children[0].classes['ui-dialog-rtl']).toEqual(true); - }); - - it('should add draggable class when dragging is enabled', () => { - fixture.detectChanges(); - expect(fixture.debugElement.children[0].classes['ui-dialog-draggable']).toEqual(true); - }); - - it('should show the dialog when visible is true', () => { - spyOn(dialog, 'show'); - dialog.visible = true; - fixture.detectChanges(); - expect(fixture.debugElement.children[0].styles.display).toEqual('block'); - expect(dialog.show).toHaveBeenCalled(); - }); - - it('should call hide if visible is true and dialog gets hidden', () => { - dialog.visible = true; - fixture.detectChanges(); - - spyOn(dialog, 'hide'); - dialog.visible = false; - fixture.detectChanges(); - - expect(fixture.debugElement.children[0].styles.display).toEqual('none'); - expect(dialog.hide).toHaveBeenCalled(); - }); - - it('should update visible as false binding when close icon is clicked', () => { - let show = true; - dialog.visible = show; - fixture.detectChanges(); - dialog.visibleChange.subscribe(value => show = value); - - const closeEl = fixture.nativeElement.querySelector('.ui-dialog-titlebar-close'); - closeEl.click(); - - expect(show).toEqual(false); - }); - -}); diff --git a/dashboard/src/app/components/dialog/dialog.ts b/dashboard/src/app/components/dialog/dialog.ts deleted file mode 100644 index 6af43786a..000000000 --- a/dashboard/src/app/components/dialog/dialog.ts +++ /dev/null @@ -1,593 +0,0 @@ -import {NgModule,Component,ElementRef,AfterViewInit,AfterViewChecked,OnDestroy,Input,Output,EventEmitter,Renderer2, - ContentChildren,QueryList,ViewChild,NgZone} from '@angular/core'; -import {trigger,state,style,transition,animate} from '@angular/animations'; -import {CommonModule} from '@angular/common'; -import {DomHandler} from '../dom/domhandler'; -import {Header,Footer,SharedModule} from '../common/shared'; -import {ButtonModule } from '../button/button'; - -let idx: number = 0; - -@Component({ - selector: 'p-dialog', - template: ` -
-
- {{header}} - - - - - - -
-
- -
- - -
-
- `, - animations: [ - trigger('dialogState', [ - state('hidden', style({ - opacity: 0 - })), - state('visible', style({ - opacity: 1 - })), - transition('visible => hidden', animate('400ms ease-in')), - transition('hidden => visible', animate('400ms ease-out')) - ]) - ], - providers: [DomHandler] -}) -export class Dialog implements AfterViewInit,AfterViewChecked,OnDestroy { - - @Input() header: string; - - @Input() draggable: boolean = true; - - @Input() resizable: boolean = true; - - @Input() minWidth: number = 150; - - @Input() minHeight: number = 150; - - @Input() width: any; - - @Input() height: any; - - @Input() positionLeft: number; - - @Input() positionTop: number; - - @Input() contentStyle: any; - - @Input() modal: boolean; - - @Input() closeOnEscape: boolean = true; - - @Input() dismissableMask: boolean; - - @Input() rtl: boolean; - - @Input() closable: boolean = true; - - @Input() responsive: boolean = true; - - @Input() isMsgBox: boolean = false; - - @Input() appendTo: any; - - @Input() style: any; - - @Input() styleClass: string; - - @Input() showHeader: boolean = true; - - @Input() showCloseBtn: boolean = true; - - @Input() closeBtnLabel: string = "Close"; - - @Input() breakpoint: number = 640; - - @Input() blockScroll: boolean = false; - - @Input() autoZIndex: boolean = true; - - @Input() baseZIndex: number = 0; - - @Input() minX: number = 0; - - @Input() minY: number = 0; - - @Input() autoAlign: boolean = true; - - @ContentChildren(Header, {descendants: false}) headerFacet: QueryList
; - - @ContentChildren(Footer, {descendants: false}) footerFacet: QueryList
; - - @ViewChild('container') containerViewChild: ElementRef; - - @ViewChild('titlebar') headerViewChild: ElementRef; - - @ViewChild('content') contentViewChild: ElementRef; - - @Output() onShow: EventEmitter = new EventEmitter(); - - @Output() onHide: EventEmitter = new EventEmitter(); - - @Output() visibleChange:EventEmitter = new EventEmitter(); - - @Output() onOk: EventEmitter = new EventEmitter(); - - _visible: boolean; - - dragging: boolean; - - documentDragListener: any; - - documentDragEndListener: any; - - resizing: boolean; - - documentResizeListener: any; - - documentResizeEndListener: any; - - documentResponsiveListener: any; - - documentEscapeListener: Function; - - maskClickListener: Function; - - lastPageX: number; - - lastPageY: number; - - mask: HTMLDivElement; - - closeIconMouseDown: boolean; - - preWidth: number; - - preventVisibleChangePropagation: boolean; - - executePostDisplayActions: boolean; - - initialized: boolean; - - currentHeight: number; - - id: string = `ui-dialog-${idx++}`; - - constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer2, public zone: NgZone) {} - - @Input() get visible(): boolean { - return this._visible; - } - - set visible(val:boolean) { - this._visible = val; - - if(this.initialized && this.containerViewChild && this.containerViewChild.nativeElement) { - if(this._visible) - this.show(); - else { - if(this.preventVisibleChangePropagation) - this.preventVisibleChangePropagation = false; - else - this.hide(); - } - } - } - - ngAfterViewChecked() { - if(this.executePostDisplayActions) { - this.onShow.emit({}); - this.positionOverlay(); - this.focus(); - this.currentHeight = this.domHandler.getOuterHeight(this.containerViewChild.nativeElement); - this.executePostDisplayActions = false; - } - else if(this.autoAlign && this.visible) { - this.zone.runOutsideAngular(() => { - setTimeout(() => { - let height = this.domHandler.getOuterHeight(this.containerViewChild.nativeElement); - - if(height !== this.currentHeight) { - this.currentHeight = height; - this.positionOverlay(); - } - }, 50); - }); - } - } - - focus() { - let focusable = this.domHandler.findSingle(this.containerViewChild.nativeElement, 'button'); - if(focusable) { - focusable.focus(); - } - } - - show() { - this.executePostDisplayActions = true; - this.moveOnTop(); - this.bindGlobalListeners(); - - if(this.modal) { - this.enableModality(); - } - } - - positionOverlay() { - let viewport = this.domHandler.getViewport(); - if(this.domHandler.getOuterHeight(this.containerViewChild.nativeElement) > viewport.height) { - this.contentViewChild.nativeElement.style.height = (viewport.height * .75) + 'px'; - } - - if(this.positionLeft >= 0 && this.positionTop >= 0) { - this.containerViewChild.nativeElement.style.left = this.positionLeft + 'px'; - this.containerViewChild.nativeElement.style.top = this.positionTop + 'px'; - } - else if (this.positionTop >= 0) { - this.center(); - this.containerViewChild.nativeElement.style.top = this.positionTop + 'px'; - } - else{ - this.center(); - } - } - - hide() { - this.onHide.emit({}); - this.unbindMaskClickListener(); - this.unbindGlobalListeners(); - this.dragging = false; - - if(this.modal) { - this.disableModality(); - } - } - - close(event: Event) { - this.preventVisibleChangePropagation = true; - this.hide(); - this.visibleChange.emit(false); - event.preventDefault(); - } - - ngAfterViewInit() { - this.initialized = true; - - if(this.appendTo) { - if(this.appendTo === 'body') - document.body.appendChild(this.containerViewChild.nativeElement); - else - this.domHandler.appendChild(this.containerViewChild.nativeElement, this.appendTo); - } - - if(this.visible) { - this.show(); - } - } - - center() { - let elementWidth = this.domHandler.getOuterWidth(this.containerViewChild.nativeElement); - let elementHeight = this.domHandler.getOuterHeight(this.containerViewChild.nativeElement); - if(elementWidth == 0 && elementHeight == 0) { - this.containerViewChild.nativeElement.style.visibility = 'hidden'; - this.containerViewChild.nativeElement.style.display = 'block'; - elementWidth = this.domHandler.getOuterWidth(this.containerViewChild.nativeElement); - elementHeight = this.domHandler.getOuterHeight(this.containerViewChild.nativeElement); - this.containerViewChild.nativeElement.style.display = 'none'; - this.containerViewChild.nativeElement.style.visibility = 'visible'; - } - let viewport = this.domHandler.getViewport(); - let x = Math.max((viewport.width - elementWidth) / 2, 0); - let y = Math.max((viewport.height - elementHeight) / 2, 0); - - this.containerViewChild.nativeElement.style.left = x + 'px'; - this.containerViewChild.nativeElement.style.top = y + 'px'; - } - - enableModality() { - if(!this.mask) { - this.mask = document.createElement('div'); - this.mask.style.zIndex = String(parseInt(this.containerViewChild.nativeElement.style.zIndex) - 1); - let maskStyleClass = 'ui-widget-overlay ui-dialog-mask'; - if(this.blockScroll) { - maskStyleClass += ' ui-dialog-mask-scrollblocker'; - } - this.domHandler.addMultipleClasses(this.mask, maskStyleClass); - - if(this.closable && this.dismissableMask) { - this.maskClickListener = this.renderer.listen(this.mask, 'click', (event: any) => { - this.close(event); - }); - } - document.body.appendChild(this.mask); - if(this.blockScroll) { - this.domHandler.addClass(document.body, 'ui-overflow-hidden'); - } - } - } - - disableModality() { - if(this.mask) { - document.body.removeChild(this.mask); - if(this.blockScroll) { - let bodyChildren = document.body.children; - let hasBlockerMasks: boolean; - for(let i = 0; i < bodyChildren.length; i++) { - let bodyChild = bodyChildren[i]; - if(this.domHandler.hasClass(bodyChild, 'ui-dialog-mask-scrollblocker')) { - hasBlockerMasks = true; - break; - } - } - - if(!hasBlockerMasks) { - this.domHandler.removeClass(document.body, 'ui-overflow-hidden'); - } - } - this.mask = null; - } - } - - unbindMaskClickListener() { - if(this.maskClickListener) { - this.maskClickListener(); - this.maskClickListener = null; - } - } - - moveOnTop() { - if(this.autoZIndex) { - this.containerViewChild.nativeElement.style.zIndex = String(this.baseZIndex + (++DomHandler.zindex)); - } - } - - onCloseMouseDown(event: Event) { - this.closeIconMouseDown = true; - } - - initDrag(event: MouseEvent) { - if(this.closeIconMouseDown) { - this.closeIconMouseDown = false; - return; - } - - if(this.draggable) { - this.dragging = true; - this.lastPageX = event.pageX; - this.lastPageY = event.pageY; - this.domHandler.addClass(document.body, 'ui-unselectable-text'); - } - } - - onDrag(event: MouseEvent) { - if(this.dragging) { - let deltaX = event.pageX - this.lastPageX; - let deltaY = event.pageY - this.lastPageY; - let leftPos = parseInt(this.containerViewChild.nativeElement.style.left) + deltaX; - let topPos = parseInt(this.containerViewChild.nativeElement.style.top) + deltaY; - - if(leftPos >= this.minX) { - this.containerViewChild.nativeElement.style.left = leftPos + 'px'; - } - - if(topPos >= this.minY) { - this.containerViewChild.nativeElement.style.top = topPos + 'px'; - } - - this.lastPageX = event.pageX; - this.lastPageY = event.pageY; - } - } - - endDrag(event: MouseEvent) { - if(this.draggable) { - this.dragging = false; - this.domHandler.removeClass(document.body, 'ui-unselectable-text'); - } - } - - initResize(event: MouseEvent) { - if(this.resizable) { - this.preWidth = null; - this.resizing = true; - this.lastPageX = event.pageX; - this.lastPageY = event.pageY; - this.domHandler.addClass(document.body, 'ui-unselectable-text'); - } - } - - onResize(event: MouseEvent) { - if(this.resizing) { - let deltaX = event.pageX - this.lastPageX; - let deltaY = event.pageY - this.lastPageY; - let containerWidth = this.domHandler.getOuterWidth(this.containerViewChild.nativeElement); - let containerHeight = this.domHandler.getOuterHeight(this.containerViewChild.nativeElement); - let contentHeight = this.domHandler.getOuterHeight(this.contentViewChild.nativeElement); - let newWidth = containerWidth + deltaX; - let newHeight = containerHeight + deltaY; - - if(newWidth > this.minWidth) { - this.containerViewChild.nativeElement.style.width = newWidth + 'px'; - } - - if(newHeight > this.minHeight) { - this.containerViewChild.nativeElement.style.height = newHeight + 'px'; - this.contentViewChild.nativeElement.style.height = contentHeight + deltaY + 'px'; - } - - this.lastPageX = event.pageX; - this.lastPageY = event.pageY; - } - } - - ok(evt) { - this.onOk.emit(evt); - } - - onResizeEnd(event: MouseEvent) { - if(this.resizing) { - this.resizing = false; - this.domHandler.removeClass(document.body, 'ui-unselectable-text'); - } - } - - bindGlobalListeners() { - if(this.draggable) { - this.bindDocumentDragListener(); - this.bindDocumentDragEndListener(); - } - - if(this.resizable) { - this.bindDocumentResizeListeners(); - } - - if(this.responsive) { - this.bindDocumentResponsiveListener(); - } - - if(this.closeOnEscape && this.closable) { - this.bindDocumentEscapeListener(); - } - } - - unbindGlobalListeners() { - this.unbindDocumentDragListener(); - this.unbindDocumentDragEndListener(); - this.unbindDocumentResizeListeners(); - this.unbindDocumentResponsiveListener(); - this.unbindDocumentEscapeListener(); - } - - bindDocumentDragListener() { - this.zone.runOutsideAngular(() => { - this.documentDragListener = this.onDrag.bind(this); - window.document.addEventListener('mousemove', this.documentDragListener); - }); - } - - unbindDocumentDragListener() { - if(this.documentDragListener) { - window.document.removeEventListener('mousemove', this.documentDragListener); - this.documentDragListener = null; - } - } - - bindDocumentDragEndListener() { - this.zone.runOutsideAngular(() => { - this.documentDragEndListener = this.endDrag.bind(this); - window.document.addEventListener('mouseup', this.documentDragEndListener); - }); - } - - unbindDocumentDragEndListener() { - if(this.documentDragEndListener) { - window.document.removeEventListener('mouseup', this.documentDragEndListener); - this.documentDragEndListener = null; - } - } - - bindDocumentResizeListeners() { - this.zone.runOutsideAngular(() => { - this.documentResizeListener = this.onResize.bind(this); - this.documentResizeEndListener = this.onResizeEnd.bind(this); - window.document.addEventListener('mousemove', this.documentResizeListener); - window.document.addEventListener('mouseup', this.documentResizeEndListener); - }); - } - - unbindDocumentResizeListeners() { - if(this.documentResizeListener && this.documentResizeEndListener) { - window.document.removeEventListener('mouseup', this.documentResizeListener); - window.document.removeEventListener('mouseup', this.documentResizeEndListener); - this.documentResizeListener = null; - this.documentResizeEndListener = null; - } - } - - bindDocumentResponsiveListener() { - this.zone.runOutsideAngular(() => { - this.documentResponsiveListener = this.onWindowResize.bind(this); - window.addEventListener('resize', this.documentResponsiveListener); - }); - } - - unbindDocumentResponsiveListener() { - if(this.documentResponsiveListener) { - window.removeEventListener('resize', this.documentResponsiveListener); - this.documentResponsiveListener = null; - } - } - - onWindowResize(event) { - let viewport = this.domHandler.getViewport(); - let width = this.domHandler.getOuterWidth(this.containerViewChild.nativeElement); - if(viewport.width <= this.breakpoint) { - if(!this.preWidth) { - this.preWidth = width; - } - this.containerViewChild.nativeElement.style.left = '0px'; - this.containerViewChild.nativeElement.style.width = '100%'; - } - else { - this.containerViewChild.nativeElement.style.width = this.preWidth + 'px'; - this.positionOverlay(); - } - } - - bindDocumentEscapeListener() { - this.documentEscapeListener = this.renderer.listen('document', 'keydown', (event) => { - if(event.which == 27) { - if(parseInt(this.containerViewChild.nativeElement.style.zIndex) == DomHandler.zindex) { - this.close(event); - } - } - }); - } - - unbindDocumentEscapeListener() { - if(this.documentEscapeListener) { - this.documentEscapeListener(); - this.documentEscapeListener = null; - } - } - - ngOnDestroy() { - this.initialized = false; - - this.disableModality(); - - this.unbindGlobalListeners(); - - if(this.appendTo) { - this.el.nativeElement.appendChild(this.containerViewChild.nativeElement); - } - - this.unbindMaskClickListener(); - } - -} - -@NgModule({ - imports: [CommonModule, ButtonModule], - exports: [Dialog,SharedModule], - declarations: [Dialog] -}) -export class DialogModule { } diff --git a/dashboard/src/app/components/dom/domhandler.ts b/dashboard/src/app/components/dom/domhandler.ts deleted file mode 100644 index 82a232098..000000000 --- a/dashboard/src/app/components/dom/domhandler.ts +++ /dev/null @@ -1,468 +0,0 @@ -import { Injectable } from '@angular/core'; - -@Injectable() -export class DomHandler { - - public static zindex: number = 1000; - - private calculatedScrollbarWidth: number = null; - - private browser: any; - - public addClass(element: any, className: string): void { - if (element.classList) - element.classList.add(className); - else - element.className += ' ' + className; - } - - public addMultipleClasses(element: any, className: string): void { - if (element.classList) { - let styles: string[] = className.split(' '); - for (let i = 0; i < styles.length; i++) { - element.classList.add(styles[i]); - } - - } - else { - let styles: string[] = className.split(' '); - for (let i = 0; i < styles.length; i++) { - element.className += ' ' + styles[i]; - } - } - } - - public removeClass(element: any, className: string): void { - if (element.classList) - element.classList.remove(className); - else - element.className = element.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' '); - } - - public hasClass(element: any, className: string): boolean { - if (element.classList) - return element.classList.contains(className); - else - return new RegExp('(^| )' + className + '( |$)', 'gi').test(element.className); - } - - public siblings(element: any): any { - return Array.prototype.filter.call(element.parentNode.children, function (child) { - return child !== element; - }); - } - - public find(element: any, selector: string): any[] { - return element.querySelectorAll(selector); - } - - public findSingle(element: any, selector: string): any { - return element.querySelector(selector); - } - - public index(element: any): number { - let children = element.parentNode.childNodes; - let num = 0; - for (var i = 0; i < children.length; i++) { - if (children[i] == element) return num; - if (children[i].nodeType == 1) num++; - } - return -1; - } - - public indexWithinGroup(element: any, attributeName: string): number { - let children = element.parentNode.childNodes; - let num = 0; - for (var i = 0; i < children.length; i++) { - if (children[i] == element) return num; - if (children[i].attributes && children[i].attributes[attributeName] && children[i].nodeType == 1) num++; - } - return -1; - } - - public relativePosition(element: any, target: any): void { - let elementDimensions = element.offsetParent ? { width: element.offsetWidth, height: element.offsetHeight } : this.getHiddenElementDimensions(element); - let targetHeight = target.offsetHeight; - let targetWidth = target.offsetWidth; - let targetOffset = target.getBoundingClientRect(); - let windowScrollTop = this.getWindowScrollTop(); - let viewport = this.getViewport(); - let top, left; - - if ((targetOffset.top + targetHeight + elementDimensions.height) > viewport.height) { - top = -1 * (elementDimensions.height); - if(targetOffset.top + top < 0) { - top = 0; - } - } - else { - top = targetHeight; - } - - - if ((targetOffset.left + elementDimensions.width) > viewport.width) - left = targetWidth - elementDimensions.width; - else - left = 0; - - element.style.top = top + 'px'; - element.style.left = left + 'px'; - } - - public absolutePosition(element: any, target: any): void { - let elementDimensions = element.offsetParent ? { width: element.offsetWidth, height: element.offsetHeight } : this.getHiddenElementDimensions(element); - let elementOuterHeight = elementDimensions.height; - let elementOuterWidth = elementDimensions.width; - let targetOuterHeight = target.offsetHeight; - let targetOuterWidth = target.offsetWidth; - let targetOffset = target.getBoundingClientRect(); - let windowScrollTop = this.getWindowScrollTop(); - let windowScrollLeft = this.getWindowScrollLeft(); - let viewport = this.getViewport(); - let top, left; - - if (targetOffset.top + targetOuterHeight + elementOuterHeight > viewport.height) { - top = targetOffset.top + windowScrollTop - elementOuterHeight; - if(top < 0) { - top = 0 + windowScrollTop; - } - } - else { - top = targetOuterHeight + targetOffset.top + windowScrollTop; - } - - if (targetOffset.left + targetOuterWidth + elementOuterWidth > viewport.width) - left = targetOffset.left + windowScrollLeft + targetOuterWidth - elementOuterWidth; - else - left = targetOffset.left + windowScrollLeft; - - element.style.top = top + 'px'; - element.style.left = left + 'px'; - } - - public getHiddenElementOuterHeight(element: any): number { - element.style.visibility = 'hidden'; - element.style.display = 'block'; - let elementHeight = element.offsetHeight; - element.style.display = 'none'; - element.style.visibility = 'visible'; - - return elementHeight; - } - - public getHiddenElementOuterWidth(element: any): number { - element.style.visibility = 'hidden'; - element.style.display = 'block'; - let elementWidth = element.offsetWidth; - element.style.display = 'none'; - element.style.visibility = 'visible'; - - return elementWidth; - } - - public getHiddenElementDimensions(element: any): any { - let dimensions: any = {}; - element.style.visibility = 'hidden'; - element.style.display = 'block'; - dimensions.width = element.offsetWidth; - dimensions.height = element.offsetHeight; - element.style.display = 'none'; - element.style.visibility = 'visible'; - - return dimensions; - } - - public scrollInView(container, item) { - let borderTopValue: string = getComputedStyle(container).getPropertyValue('borderTopWidth'); - let borderTop: number = borderTopValue ? parseFloat(borderTopValue) : 0; - let paddingTopValue: string = getComputedStyle(container).getPropertyValue('paddingTop'); - let paddingTop: number = paddingTopValue ? parseFloat(paddingTopValue) : 0; - let containerRect = container.getBoundingClientRect(); - let itemRect = item.getBoundingClientRect(); - let offset = (itemRect.top + document.body.scrollTop) - (containerRect.top + document.body.scrollTop) - borderTop - paddingTop; - let scroll = container.scrollTop; - let elementHeight = container.clientHeight; - let itemHeight = this.getOuterHeight(item); - - if (offset < 0) { - container.scrollTop = scroll + offset; - } - else if ((offset + itemHeight) > elementHeight) { - container.scrollTop = scroll + offset - elementHeight + itemHeight; - } - } - - public fadeIn(element, duration: number): void { - element.style.opacity = 0; - - let last = +new Date(); - let opacity = 0; - let tick = function () { - opacity = +element.style.opacity.replace(",", ".") + (new Date().getTime() - last) / duration; - element.style.opacity = opacity; - last = +new Date(); - - if (+opacity < 1) { - (window.requestAnimationFrame && requestAnimationFrame(tick)) || setTimeout(tick, 16); - } - }; - - tick(); - } - - public fadeOut(element, ms) { - var opacity = 1, - interval = 50, - duration = ms, - gap = interval / duration; - - let fading = setInterval(() => { - opacity = opacity - gap; - - if (opacity <= 0) { - opacity = 0; - clearInterval(fading); - } - - element.style.opacity = opacity; - }, interval); - } - - public getWindowScrollTop(): number { - let doc = document.documentElement; - return (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0); - } - - public getWindowScrollLeft(): number { - let doc = document.documentElement; - return (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0); - } - - public matches(element, selector: string): boolean { - var p = Element.prototype; - var f = p['matches'] || p.webkitMatchesSelector || p['mozMatchesSelector'] || p.msMatchesSelector || function (s) { - return [].indexOf.call(document.querySelectorAll(s), this) !== -1; - }; - return f.call(element, selector); - } - - public getOuterWidth(el, margin?) { - let width = el.offsetWidth; - - if (margin) { - let style = getComputedStyle(el); - width += parseFloat(style.marginLeft) + parseFloat(style.marginRight); - } - - return width; - } - - public getHorizontalPadding(el) { - let style = getComputedStyle(el); - return parseFloat(style.paddingLeft) + parseFloat(style.paddingRight); - } - - public getHorizontalMargin(el) { - let style = getComputedStyle(el); - return parseFloat(style.marginLeft) + parseFloat(style.marginRight); - } - - public innerWidth(el) { - let width = el.offsetWidth; - let style = getComputedStyle(el); - - width += parseFloat(style.paddingLeft) + parseFloat(style.paddingRight); - return width; - } - - public width(el) { - let width = el.offsetWidth; - let style = getComputedStyle(el); - - width -= parseFloat(style.paddingLeft) + parseFloat(style.paddingRight); - return width; - } - - public getInnerHeight(el) { - let height = el.offsetHeight; - let style = getComputedStyle(el); - - height += parseFloat(style.paddingTop) + parseFloat(style.paddingBottom); - return height; - } - - public getOuterHeight(el, margin?) { - let height = el.offsetHeight; - - if (margin) { - let style = getComputedStyle(el); - height += parseFloat(style.marginTop) + parseFloat(style.marginBottom); - } - - return height; - } - - public getHeight(el): number { - let height = el.offsetHeight; - let style = getComputedStyle(el); - - height -= parseFloat(style.paddingTop) + parseFloat(style.paddingBottom) + parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth); - - return height; - } - - public getWidth(el): number { - let width = el.offsetWidth; - let style = getComputedStyle(el); - - width -= parseFloat(style.paddingLeft) + parseFloat(style.paddingRight) + parseFloat(style.borderLeftWidth) + parseFloat(style.borderRightWidth); - - return width; - } - - public getViewport(): any { - let win = window, - d = document, - e = d.documentElement, - g = d.getElementsByTagName('body')[0], - w = win.innerWidth || e.clientWidth || g.clientWidth, - h = win.innerHeight || e.clientHeight || g.clientHeight; - - return { width: w, height: h }; - } - - public getOffset(el) { - let rect = el.getBoundingClientRect(); - - return { - top: rect.top + document.body.scrollTop, - left: rect.left + document.body.scrollLeft - }; - } - - getUserAgent(): string { - return navigator.userAgent; - } - - isIE() { - var ua = window.navigator.userAgent; - - var msie = ua.indexOf('MSIE '); - if (msie > 0) { - // IE 10 or older => return version number - return true; - } - - var trident = ua.indexOf('Trident/'); - if (trident > 0) { - // IE 11 => return version number - var rv = ua.indexOf('rv:'); - return true; - } - - var edge = ua.indexOf('Edge/'); - if (edge > 0) { - // Edge (IE 12+) => return version number - return true; - } - - // other browser - return false; - } - - appendChild(element: any, target: any) { - if(this.isElement(target)) - target.appendChild(element); - else if(target.el && target.el.nativeElement) - target.el.nativeElement.appendChild(element); - else - throw 'Cannot append ' + target + ' to ' + element; - } - - removeChild(element: any, target: any) { - if(this.isElement(target)) - target.removeChild(element); - else if(target.el && target.el.nativeElement) - target.el.nativeElement.removeChild(element); - else - throw 'Cannot remove ' + element + ' from ' + target; - } - - isElement(obj: any) { - return (typeof HTMLElement === "object" ? obj instanceof HTMLElement : - obj && typeof obj === "object" && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === "string" - ); - } - - calculateScrollbarWidth(): number { - if(this.calculatedScrollbarWidth !== null) - return this.calculatedScrollbarWidth; - - let scrollDiv = document.createElement("div"); - scrollDiv.className = "ui-scrollbar-measure"; - document.body.appendChild(scrollDiv); - - let scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth; - document.body.removeChild(scrollDiv); - - this.calculatedScrollbarWidth = scrollbarWidth; - - return scrollbarWidth; - } - - invokeElementMethod(element: any, methodName: string, args?: any[]): void { - (element as any)[methodName].apply(element, args); - } - - clearSelection(): void { - if(window.getSelection) { - if(window.getSelection().empty) { - window.getSelection().empty(); - } else if(window.getSelection().removeAllRanges && window.getSelection().rangeCount > 0 && window.getSelection().getRangeAt(0).getClientRects().length > 0) { - window.getSelection().removeAllRanges(); - } - } - else if(document['selection'] && document['selection'].empty) { - try { - document['selection'].empty(); - } catch(error) { - //ignore IE bug - } - } - } - - getBrowser() { - if(!this.browser) { - let matched = this.resolveUserAgent(); - this.browser = {}; - - if (matched.browser) { - this.browser[matched.browser] = true; - this.browser['version'] = matched.version; - } - - if (this.browser['chrome']) { - this.browser['webkit'] = true; - } else if (this.browser['webkit']) { - this.browser['safari'] = true; - } - } - - return this.browser; - } - - resolveUserAgent() { - let ua = navigator.userAgent.toLowerCase(); - let match = /(chrome)[ \/]([\w.]+)/.exec(ua) || - /(webkit)[ \/]([\w.]+)/.exec(ua) || - /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || - /(msie) ([\w.]+)/.exec(ua) || - ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || - []; - - return { - browser: match[1] || "", - version: match[2] || "0" - }; - } -} diff --git a/dashboard/src/app/components/dragdrop/dragdrop.spec.ts b/dashboard/src/app/components/dragdrop/dragdrop.spec.ts deleted file mode 100644 index f8e8918a6..000000000 --- a/dashboard/src/app/components/dragdrop/dragdrop.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { Draggable } from './dragdrop'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('Draggable', () => { - - let draggable: Draggable; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - Draggable - ] - }); - - fixture = TestBed.createComponent(Draggable); - draggable = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/dragdrop/dragdrop.ts b/dashboard/src/app/components/dragdrop/dragdrop.ts deleted file mode 100644 index 96dc821f0..000000000 --- a/dashboard/src/app/components/dragdrop/dragdrop.ts +++ /dev/null @@ -1,226 +0,0 @@ -import {NgModule,Directive,OnDestroy,AfterViewInit,ElementRef,HostListener,Input,Output,EventEmitter,NgZone} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {DomHandler} from '../dom/domhandler'; - -@Directive({ - selector: '[pDraggable]', - host: { - '[draggable]': 'true' - }, - providers: [DomHandler] -}) -export class Draggable implements AfterViewInit, OnDestroy { - - @Input('pDraggable') scope: string; - - @Input() dragEffect: string; - - @Input() dragHandle: string; - - @Output() onDragStart: EventEmitter = new EventEmitter(); - - @Output() onDragEnd: EventEmitter = new EventEmitter(); - - @Output() onDrag: EventEmitter = new EventEmitter(); - - handle: any; - - dragListener: any; - - mouseOverListener: any; - - mouseLeaveListener: any; - - constructor(public el: ElementRef, public domHandler: DomHandler, public zone: NgZone) {} - - ngAfterViewInit() { - this.bindMouseListeners(); - } - - bindDragListener() { - if (!this.dragListener) { - this.zone.runOutsideAngular(() => { - this.dragListener = this.drag.bind(this); - this.el.nativeElement.addEventListener('drag', this.dragListener); - }); - } - } - - unbindDragListener() { - if (this.dragListener) { - this.zone.runOutsideAngular(() => { - this.el.nativeElement.removeEventListener('drag', this.dragListener); - this.dragListener = null; - }); - } - } - - bindMouseListeners() { - if (!this.mouseOverListener && this.mouseLeaveListener) { - this.zone.runOutsideAngular(() => { - this.mouseOverListener = this.mouseover.bind(this); - this.mouseLeaveListener = this.mouseleave.bind(this); - this.el.nativeElement.addEventListener('mouseover', this.mouseOverListener); - this.el.nativeElement.addEventListener('mouseleave', this.mouseLeaveListener); - }); - } - } - - unbindMouseListeners() { - if (this.mouseOverListener && this.mouseLeaveListener) { - this.zone.runOutsideAngular(() => { - this.el.nativeElement.removeEventListener('mouseover', this.mouseOverListener); - this.el.nativeElement.removeEventListener('mouseleave', this.mouseLeaveListener); - this.mouseOverListener = null; - this.mouseLeaveListener = null; - }); - } - } - - drag(event) { - this.onDrag.emit(event); - } - - @HostListener('dragstart', ['$event']) - dragStart(event) { - if(this.allowDrag()) { - if(this.dragEffect) { - event.dataTransfer.effectAllowed = this.dragEffect; - } - event.dataTransfer.setData('text', this.scope); - - this.onDragStart.emit(event); - - this.bindDragListener(); - } - else { - event.preventDefault(); - } - } - - @HostListener('dragend', ['$event']) - dragEnd(event) { - this.onDragEnd.emit(event); - this.unbindDragListener(); - } - - mouseover(event) { - this.handle = event.target; - } - - mouseleave(event) { - this.handle = null; - } - - allowDrag() : boolean { - if(this.dragHandle && this.handle) - return this.domHandler.matches(this.handle, this.dragHandle); - else - return true; - } - - ngOnDestroy() { - this.unbindDragListener(); - this.unbindMouseListeners(); - } - -} - -@Directive({ - selector: '[pDroppable]', - providers: [DomHandler] -}) -export class Droppable implements AfterViewInit, OnDestroy { - - @Input('pDroppable') scope: string|string[]; - - @Input() dropEffect: string; - - @Output() onDragEnter: EventEmitter = new EventEmitter(); - - @Output() onDragLeave: EventEmitter = new EventEmitter(); - - @Output() onDrop: EventEmitter = new EventEmitter(); - - constructor(public el: ElementRef, public domHandler: DomHandler, public zone: NgZone) {} - - dragOverListener: any; - - ngAfterViewInit() { - this.bindDragOverListener(); - } - - bindDragOverListener() { - if (!this.dragOverListener) { - this.zone.runOutsideAngular(() => { - this.dragOverListener = this.dragOver.bind(this); - this.el.nativeElement.addEventListener('dragover', this.dragOverListener); - }); - } - } - - unbindDragOverListener() { - if (this.dragOverListener) { - this.zone.runOutsideAngular(() => { - this.el.nativeElement.removeEventListener('dragover', this.dragOverListener); - this.dragOverListener = null; - }); - } - } - - dragOver(event) { - event.preventDefault(); - } - - @HostListener('drop', ['$event']) - drop(event) { - if(this.allowDrop(event)) { - event.preventDefault(); - this.onDrop.emit(event); - } - } - - @HostListener('dragenter', ['$event']) - dragEnter(event) { - event.preventDefault(); - - if(this.dropEffect) { - event.dataTransfer.dropEffect = this.dropEffect; - } - - this.onDragEnter.emit(event); - } - - @HostListener('dragleave', ['$event']) - dragLeave(event) { - event.preventDefault(); - - this.onDragLeave.emit(event); - } - - allowDrop(event): boolean { - let dragScope = event.dataTransfer.getData('text'); - if(typeof (this.scope) == "string" && dragScope == this.scope) { - return true; - } - else if(this.scope instanceof Array) { - for(let j = 0; j < this.scope.length; j++) { - if(dragScope == this.scope[j]) { - return true; - } - } - } - return false; - } - - ngOnDestroy() { - this.unbindDragOverListener(); - } -} - -@NgModule({ - imports: [CommonModule], - exports: [Draggable,Droppable], - declarations: [Draggable,Droppable] -}) -export class DragDropModule { } \ No newline at end of file diff --git a/dashboard/src/app/components/dropdown/dropdown.scss b/dashboard/src/app/components/dropdown/dropdown.scss deleted file mode 100644 index 3a64356cf..000000000 --- a/dashboard/src/app/components/dropdown/dropdown.scss +++ /dev/null @@ -1,131 +0,0 @@ -.ui-dropdown { - display: inline-block; - position: relative; - cursor: pointer; - vertical-align: middle; - @extend .ui-corner-all-small; -} - -.ui-dropdown .ui-dropdown-clear-icon { - position: absolute; - right: 2em; - top: 50%; - font-size: .75em; - height: 1em; - margin-top: -.5em; - right: 2.5em; -} - -.ui-dropdown .ui-dropdown-trigger { - border-right: none; - border-top: none; - border-bottom: none; - cursor: pointer; - width: .25rem; - height: 100%; - position: absolute; - right: 0; - top: 0; - padding: 0; - @extend .ui-corner-right-small; -} - -.ui-dropdown .ui-dropdown-trigger .fa { - margin-top: .07rem; - margin-left: .02rem; //原为.03rem,改为.02rem更居中 -} - -.ui-dropdown .ui-dropdown-label { - display: block; - border: none; - white-space: nowrap; - overflow: hidden; - font-weight: normal; - width: 100%; - padding-right: 2.5em; -} - -.ui-dropdown .ui-inputtext { - min-height: .30rem; - min-width: .80rem; - line-height: .20rem; -} - -.ui-dropdown-item-empty, -.ui-dropdown-label-empty { - text-indent: -9999px; - overflow: hidden; -} - -.ui-dropdown.ui-state-disabled .ui-dropdown-trigger, -.ui-dropdown.ui-state-disabled .ui-dropdown-label { - cursor: default; -} - -.ui-dropdown label.ui-dropdown-label { - cursor: pointer; -} - -.ui-dropdown input.ui-dropdown-label { - cursor: default; -} - -.ui-dropdown .ui-dropdown-panel { - min-width: 100%; -} - -.ui-dropdown-panel { - position: absolute; - height: auto; - display: none; -} - -.ui-dropdown-panel .ui-dropdown-items-wrapper { - overflow: auto; -} - -.ui-dropdown-panel .ui-dropdown-item { - font-weight: normal; - border: 0 none; - cursor: pointer; - margin: 1px 0; - padding: .125em .25em; - text-align: left; -} - -.ui-dropdown-panel .ui-dropdown-item-group { - font-weight: bold; - cursor: default; -} - -.ui-dropdown-panel .ui-dropdown-list { - padding: 0.4em; - border: 0 none; -} - -.ui-dropdown-panel .ui-dropdown-filter { - width: 100%; - box-sizing: border-box; - padding-right: 1.5em; -} - -.ui-dropdown-panel .ui-dropdown-filter-container { - position: relative; - margin: 0; - padding: 0.4em; - display: inline-block; - width: 100%; -} - -.ui-dropdown-panel .ui-dropdown-filter-container .fa { - position: absolute; - top: .8em; - right: 1em; -} - - -/** Dropdown **/ - -.ui-fluid .ui-dropdown { - width: 100%; -} \ No newline at end of file diff --git a/dashboard/src/app/components/dropdown/dropdown.spec.ts b/dashboard/src/app/components/dropdown/dropdown.spec.ts deleted file mode 100644 index 83edc4102..000000000 --- a/dashboard/src/app/components/dropdown/dropdown.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { Dropdown } from './dropdown'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('Dropdown', () => { - - let dropdown: Dropdown; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - Dropdown - ] - }); - - fixture = TestBed.createComponent(Dropdown); - dropdown = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/dropdown/dropdown.ts b/dashboard/src/app/components/dropdown/dropdown.ts deleted file mode 100644 index 34113c61d..000000000 --- a/dashboard/src/app/components/dropdown/dropdown.ts +++ /dev/null @@ -1,761 +0,0 @@ -import {NgModule,Component,ElementRef,OnInit,AfterViewInit,AfterContentInit,AfterViewChecked,OnDestroy,Input,Output,Renderer2,EventEmitter,ContentChildren, - QueryList,ViewChild,TemplateRef,forwardRef,ChangeDetectorRef,NgZone} from '@angular/core'; -import {trigger,state,style,transition,animate} from '@angular/animations'; -import {CommonModule} from '@angular/common'; -import {SelectItem} from '../common/selectitem'; -import {SharedModule,PrimeTemplate} from '../common/shared'; -import {DomHandler} from '../dom/domhandler'; -import {ObjectUtils} from '../utils/objectutils'; -import {NG_VALUE_ACCESSOR, ControlValueAccessor} from '@angular/forms'; - -export const DROPDOWN_VALUE_ACCESSOR: any = { - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => Dropdown), - multi: true -}; - -@Component({ - selector: 'p-dropdown', - template: ` -
-
- -
-
- -
- - - - -
- -
-
-
- - -
-
-
    - - -
  • - {{optgroup.label||'empty'}} - -
  • - -
    -
    - - - - -
  • - {{option.label||'empty'}} - -
  • -
    -
  • {{emptyFilterMessage}}
  • -
-
-
-
- `, - animations: [ - trigger('panelState', [ - state('hidden', style({ - opacity: 0 - })), - state('visible', style({ - opacity: 1 - })), - transition('visible => hidden', animate('400ms ease-in')), - transition('hidden => visible', animate('400ms ease-out')) - ]) - ], - host: { - '[class.ui-inputwrapper-filled]': 'filled', - '[class.ui-inputwrapper-focus]': 'focus' - }, - providers: [DomHandler,ObjectUtils,DROPDOWN_VALUE_ACCESSOR] -}) -export class Dropdown implements OnInit,AfterViewInit,AfterContentInit,AfterViewChecked,OnDestroy,ControlValueAccessor { - - @Input() scrollHeight: string = '200px'; - - @Input() filter: boolean; - - @Input() name: string; - - @Input() style: any; - - @Input() panelStyle: any; - - @Input() styleClass: string; - - @Input() panelStyleClass: string; - - @Input() disabled: boolean; - - @Input() readonly: boolean; - - @Input() autoWidth: boolean = true; - - @Input() required: boolean; - - @Input() editable: boolean; - - @Input() appendTo: any; - - @Input() tabindex: number; - - @Input() placeholder: string; - - @Input() filterPlaceholder: string; - - @Input() inputId: string; - - @Input() dataKey: string; - - @Input() filterBy: string = 'label'; - - @Input() lazy: boolean = true; - - @Input() autofocus: boolean; - - @Input() resetFilterOnHide: boolean = false; - - @Input() dropdownIcon: string = 'fa fa-fw fa-caret-down'; - - @Input() optionLabel: string; - - @Input() autoDisplayFirst: boolean = true; - - @Input() group: boolean; - - @Input() showClear: boolean; - - @Input() emptyFilterMessage: string = 'No results found'; - - @Output() onChange: EventEmitter = new EventEmitter(); - - @Output() onFocus: EventEmitter = new EventEmitter(); - - @Output() onBlur: EventEmitter = new EventEmitter(); - - @ViewChild('container') containerViewChild: ElementRef; - - @ViewChild('panel') panelViewChild: ElementRef; - - @ViewChild('itemswrapper') itemsWrapperViewChild: ElementRef; - - @ViewChild('filter') filterViewChild: ElementRef; - - @ViewChild('in') focusViewChild: ElementRef; - - @ViewChild('editableInput') editableInputViewChild: ElementRef; - - @ContentChildren(PrimeTemplate) templates: QueryList; - - public itemTemplate: TemplateRef; - - public groupTemplate: TemplateRef; - - public selectedItemTemplate: TemplateRef; - - selectedOption: any; - - _options: any[]; - - value: any; - - onModelChange: Function = () => {}; - - onModelTouched: Function = () => {}; - - optionsToDisplay: any[]; - - hover: boolean; - - focus: boolean; - - filled: boolean; - - public panelVisible: boolean = false; - - public shown: boolean; - - public documentClickListener: any; - - public optionsChanged: boolean; - - public panel: HTMLDivElement; - - public container: HTMLDivElement; - - public itemsWrapper: HTMLDivElement; - - public initialized: boolean; - - public selfClick: boolean; - - public itemClick: boolean; - - public clearClick: boolean; - - public hoveredItem: any; - - public selectedOptionUpdated: boolean; - - public filterValue: string; - - constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer2, private cd: ChangeDetectorRef, - public objectUtils: ObjectUtils, public zone: NgZone) {} - - ngAfterContentInit() { - this.templates.forEach((item) => { - switch(item.getType()) { - case 'item': - this.itemTemplate = item.template; - break; - - case 'selectedItem': - this.selectedItemTemplate = item.template; - break; - - case 'group': - this.groupTemplate = item.template; - break; - - default: - this.itemTemplate = item.template; - break; - } - }); - } - - ngOnInit() { - this.optionsToDisplay = this.options; - this.updateSelectedOption(null); - } - - @Input() get options(): any[] { - return this._options; - } - - set options(val: any[]) { - let opts = this.optionLabel ? this.objectUtils.generateSelectItems(val, this.optionLabel) : val; - this._options = opts; - this.optionsToDisplay = this._options; - this.updateSelectedOption(this.value); - this.optionsChanged = true; - - if(this.filterValue && this.filterValue.length) { - this.activateFilter(); - } - } - - ngAfterViewInit() { - this.container = this.containerViewChild.nativeElement; - this.panel = this.panelViewChild.nativeElement; - this.itemsWrapper = this.itemsWrapperViewChild.nativeElement; - - if(this.editable) { - this.updateEditableLabel(); - } - - this.updateDimensions(); - this.initialized = true; - - if(this.appendTo) { - if(this.appendTo === 'body') - document.body.appendChild(this.panel); - else - this.domHandler.appendChild(this.panel, this.appendTo); - } - } - - get label(): string { - return (this.selectedOption ? this.selectedOption.label : null); - } - - updateEditableLabel(): void { - if(this.editableInputViewChild && this.editableInputViewChild.nativeElement) { - this.editableInputViewChild.nativeElement.value = (this.selectedOption ? this.selectedOption.label : this.value||''); - } - } - - onItemClick(event, option) { - this.itemClick = true; - this.selectItem(event, option); - this.focusViewChild.nativeElement.focus(); - this.filled = true; - this.hide(); - } - - selectItem(event, option) { - if(this.selectedOption != option) { - this.selectedOption = option; - this.value = option.value; - - this.onModelChange(this.value); - this.updateEditableLabel(); - this.onChange.emit({ - originalEvent: event, - value: this.value - }); - } - } - - ngAfterViewChecked() { - if(this.shown) { - this.onShow(); - this.shown = false; - } - - if(this.optionsChanged && this.panelVisible) { - this.optionsChanged = false; - - this.zone.runOutsideAngular(() => { - setTimeout(() => { - this.updateDimensions(); - this.alignPanel(); - }, 1); - }); - } - - if(this.selectedOptionUpdated && this.itemsWrapper) { - let selectedItem = this.domHandler.findSingle(this.panel, 'li.ui-state-highlight'); - if(selectedItem) { - this.domHandler.scrollInView(this.itemsWrapper, this.domHandler.findSingle(this.panel, 'li.ui-state-highlight')); - } - this.selectedOptionUpdated = false; - } - } - - writeValue(value: any): void { - if(this.filter) { - this.resetFilter(); - } - - this.value = value; - this.updateSelectedOption(value); - this.updateEditableLabel(); - this.updateFilledState(); - this.cd.markForCheck(); - } - - resetFilter(): void { - if(this.filterViewChild && this.filterViewChild.nativeElement) { - this.filterViewChild.nativeElement.value = ''; - } - - this.optionsToDisplay = this.options; - } - - updateSelectedOption(val: any): void { - this.selectedOption = this.findOption(val, this.optionsToDisplay); - if(this.autoDisplayFirst && !this.placeholder && !this.selectedOption && this.optionsToDisplay && this.optionsToDisplay.length && !this.editable) { - this.selectedOption = this.optionsToDisplay[0]; - } - this.selectedOptionUpdated = true; - } - - registerOnChange(fn: Function): void { - this.onModelChange = fn; - } - - registerOnTouched(fn: Function): void { - this.onModelTouched = fn; - } - - setDisabledState(val: boolean): void { - this.disabled = val; - } - - updateDimensions() { - if(this.autoWidth) { - let select = this.domHandler.findSingle(this.el.nativeElement, 'select'); - if(!this.style||(!this.style['width']&&!this.style['min-width'])) { - this.el.nativeElement.children[0].style.width = select.offsetWidth + 30 + 'px'; - } - } - } - - onMouseclick(event) { - if(this.disabled||this.readonly) { - return; - } - - this.selfClick = true; - this.clearClick = this.domHandler.hasClass(event.target, 'ui-dropdown-clear-icon'); - - if(!this.itemClick && !this.clearClick) { - this.focusViewChild.nativeElement.focus(); - - if(this.panelVisible) - this.hide(); - else { - this.show(); - - if (this.filterViewChild != undefined) { - setTimeout(() => { - this.filterViewChild.nativeElement.focus(); - }, 200); - } - } - } - } - - onEditableInputClick(event) { - this.itemClick = true; - this.bindDocumentClickListener(); - } - - onEditableInputFocus(event) { - this.focus = true; - this.hide(); - } - - onEditableInputChange(event) { - this.value = event.target.value; - this.updateSelectedOption(this.value); - this.onModelChange(this.value); - this.onChange.emit({ - originalEvent: event, - value: this.value - }); - } - - onShow() { - this.bindDocumentClickListener(); - - if(this.options && this.options.length) { - this.alignPanel(); - - let selectedListItem = this.domHandler.findSingle(this.itemsWrapper, '.ui-dropdown-item.ui-state-highlight'); - if(selectedListItem) { - this.domHandler.scrollInView(this.itemsWrapper, selectedListItem); - } - } - } - - show() { - if(this.appendTo) { - this.panel.style.minWidth = this.domHandler.getWidth(this.container) + 'px'; - } - - this.panel.style.zIndex = String(++DomHandler.zindex); - this.panelVisible = true; - this.shown = true; - } - - hide() { - this.panelVisible = false; - - if(this.filter && this.resetFilterOnHide) { - this.resetFilter(); - } - } - - alignPanel() { - if(this.appendTo) - this.domHandler.absolutePosition(this.panel, this.container); - else - this.domHandler.relativePosition(this.panel, this.container); - } - - onInputFocus(event) { - this.focus = true; - this.onFocus.emit(event); - } - - onInputBlur(event) { - this.focus = false; - this.onModelTouched(); - this.onBlur.emit(event); - } - - onKeydown(event) { - if(this.readonly || !this.optionsToDisplay || this.optionsToDisplay.length === null) { - return; - } - - switch(event.which) { - //down - case 40: - if(!this.panelVisible && event.altKey) { - this.show(); - } - else { - if(this.group) { - let selectedItemIndex = this.selectedOption ? this.findOptionGroupIndex(this.selectedOption.value, this.optionsToDisplay) : -1; - - if(selectedItemIndex !== -1) { - let nextItemIndex = selectedItemIndex.itemIndex + 1; - if(nextItemIndex < (this.optionsToDisplay[selectedItemIndex.groupIndex].items.length)) { - this.selectItem(event, this.optionsToDisplay[selectedItemIndex.groupIndex].items[nextItemIndex]); - this.selectedOptionUpdated = true; - } - else if(this.optionsToDisplay[selectedItemIndex.groupIndex + 1]) { - this.selectItem(event, this.optionsToDisplay[selectedItemIndex.groupIndex + 1].items[0]); - this.selectedOptionUpdated = true; - } - } - else { - this.selectItem(event, this.optionsToDisplay[0].items[0]); - } - } - else { - let selectedItemIndex = this.selectedOption ? this.findOptionIndex(this.selectedOption.value, this.optionsToDisplay) : -1; - let nextItemIndex = selectedItemIndex + 1; - if(nextItemIndex != (this.optionsToDisplay.length)) { - this.selectItem(event, this.optionsToDisplay[nextItemIndex]); - this.selectedOptionUpdated = true; - } - else { - this.selectItem(event, this.optionsToDisplay[0]); - } - } - } - - event.preventDefault(); - - break; - - //up - case 38: - if(this.group) { - let selectedItemIndex = this.selectedOption ? this.findOptionGroupIndex(this.selectedOption.value, this.optionsToDisplay) : -1; - if(selectedItemIndex !== -1) { - let prevItemIndex = selectedItemIndex.itemIndex - 1; - if(prevItemIndex >= 0) { - this.selectItem(event, this.optionsToDisplay[selectedItemIndex.groupIndex].items[prevItemIndex]); - this.selectedOptionUpdated = true; - } - else if(prevItemIndex < 0) { - let prevGroup = this.optionsToDisplay[selectedItemIndex.groupIndex - 1]; - if(prevGroup) { - this.selectItem(event, prevGroup.items[prevGroup.items.length - 1]); - this.selectedOptionUpdated = true; - } - } - } - } - else { - let selectedItemIndex = this.selectedOption ? this.findOptionIndex(this.selectedOption.value, this.optionsToDisplay) : -1; - if(selectedItemIndex > 0) { - let prevItemIndex = selectedItemIndex - 1; - this.selectItem(event, this.optionsToDisplay[prevItemIndex]); - this.selectedOptionUpdated = true; - } - } - - event.preventDefault(); - break; - - //space - case 32: - case 32: - if(!this.panelVisible){ - this.show(); - event.preventDefault(); - } - break; - - //enter - case 13: - if (!this.filter || (this.optionsToDisplay && this.optionsToDisplay.length > 0)) { - this.hide(); - } - - event.preventDefault(); - break; - - //escape and tab - case 27: - case 9: - this.hide(); - break; - } - } - - findOptionIndex(val: any, opts: any[]): number { - let index: number = -1; - if(opts) { - for(let i = 0; i < opts.length; i++) { - if((val == null && opts[i].value == null) || this.objectUtils.equals(val, opts[i].value, this.dataKey)) { - index = i; - break; - } - } - } - - return index; - } - - findOptionGroupIndex(val: any, opts: any[]): any { - let groupIndex, itemIndex; - - if(opts) { - for(let i = 0; i < opts.length; i++) { - groupIndex = i; - itemIndex = this.findOptionIndex(val, opts[i].items); - - if(itemIndex !== -1) { - break; - } - } - } - - if(itemIndex !== -1) { - return {groupIndex: groupIndex, itemIndex: itemIndex}; - } - else { - return -1; - } - } - - findOption(val: any, opts: any[], inGroup?: boolean): SelectItem { - if(this.group && !inGroup) { - let opt: SelectItem; - if(opts && opts.length) { - for(let optgroup of opts) { - opt = this.findOption(val, optgroup.items, true); - if(opt) { - break; - } - } - } - return opt; - } - else { - let index: number = this.findOptionIndex(val, opts); - return (index != -1) ? opts[index] : null; - } - } - - onFilter(event): void { - let inputValue = event.target.value.toLowerCase(); - if(inputValue && inputValue.length) { - this.filterValue = inputValue; - this.activateFilter(); - } - else { - this.filterValue = null; - this.optionsToDisplay = this.options; - } - - this.optionsChanged = true; - } - - activateFilter() { - let searchFields: string[] = this.filterBy.split(','); - if(this.options && this.options.length) { - if(this.group) { - let filteredGroups = []; - for(let optgroup of this.options) { - let filteredSubOptions = this.objectUtils.filter(optgroup.items, searchFields, this.filterValue); - if(filteredSubOptions && filteredSubOptions.length) { - filteredGroups.push({ - label: optgroup.label, - value: optgroup.value, - items: filteredSubOptions - }); - } - } - - this.optionsToDisplay = filteredGroups; - } - else { - this.optionsToDisplay = this.objectUtils.filter(this.options, searchFields, this.filterValue); - } - - this.optionsChanged = true; - } - } - - applyFocus(): void { - if(this.editable) - this.domHandler.findSingle(this.el.nativeElement, '.ui-dropdown-label.ui-inputtext').focus(); - else - this.domHandler.findSingle(this.el.nativeElement, 'input[readonly]').focus(); - } - - bindDocumentClickListener() { - if(!this.documentClickListener) { - this.documentClickListener = this.renderer.listen('document', 'click', () => { - if(!this.selfClick&&!this.itemClick) { - this.panelVisible = false; - this.unbindDocumentClickListener(); - } - - this.selfClick = false; - this.itemClick = false; - this.cd.markForCheck(); - }); - } - } - - unbindDocumentClickListener() { - if(this.documentClickListener) { - this.documentClickListener(); - this.documentClickListener = null; - } - } - - updateFilledState() { - this.filled = (this.value != null); - } - - clear(event: Event) { - this.clearClick = true; - this.value = null; - this.onModelChange(this.value); - this.onChange.emit({ - originalEvent: event, - value: this.value - }); - this.updateSelectedOption(this.value); - this.updateEditableLabel(); - this.updateFilledState(); - } - - ngOnDestroy() { - this.initialized = false; - - this.unbindDocumentClickListener(); - - if(this.appendTo) { - this.el.nativeElement.appendChild(this.panel); - } - } -} - -@NgModule({ - imports: [CommonModule,SharedModule], - exports: [Dropdown,SharedModule], - declarations: [Dropdown] -}) -export class DropdownModule { } diff --git a/dashboard/src/app/components/dropmenu/dropmenu.scss b/dashboard/src/app/components/dropmenu/dropmenu.scss deleted file mode 100644 index 839dfa41b..000000000 --- a/dashboard/src/app/components/dropmenu/dropmenu.scss +++ /dev/null @@ -1,145 +0,0 @@ -.ui-dropmenu { - position: relative; - display: inline-block; - zoom: 1; -} - -.ui-dropmenu > .ui-widget.ui-button { - padding-right: 0.20rem; - padding-left: 0; - width: auto; - min-width: 0; - vertical-align: top; - background: none; - border: none; - color: map-get($color-primary, 'normal'); - &:hover { - background: none; - border: none; - color: map-get($color-primary, 'hover'); - box-shadow: none; - } - &:active { - background: none; - border: none; - color: map-get($color-primary, 'active'); - } - &:disabled{ - background: none; - border: none; - color: $color-disabled; - } - & > .ui-button-icon-right{ - right: 0; - } - &.ui-button-icon-only{ - padding-right: 0; - } -} - -.ui-dropmenu.ui-state-disabled button { - cursor: default; -} - -/* ui-dropmenu-list */ -.ui-dropmenu-list { - position: absolute; - display: none; - border: none; - box-shadow: 0px 3px 10px 0px rgba(0, 0, 0, 0.18); - @extend .ui-corner-all-small; -} - -.ui-dropmenu-list .ui-menu-separator { - border: none; - border-top: 10px solid #f5f5f5; - & + li.ui-menuitem{ - border-top: solid 1px #f2f2f2; - } -} - -.ui-dropmenu-list ul { - list-style: none; - margin: 0; - padding: 0; -} - -.ui-dropmenu-list .ui-submenu-list { - display: none; - position: absolute; - border: none; - box-shadow: 0px 3px 10px 0px rgba(0, 0, 0, 0.18); - @extend .ui-corner-all-small; -} - -.ui-dropmenu-list .ui-menuitem-link { - padding: 0 .20rem 0 .15rem; - display: block; - position: relative; - line-height: .40rem; - &:hover{ - color: map-get($map: $color-primary, $key: hover); - background: #f9f9f9; - } -} - -.ui-dropmenu-list .ui-menuitem { - position: relative; - white-space: nowrap; - min-width: 1.50rem; - border-bottom: solid 1px #f2f2f2; - &:first-of-type { - .ui-menuitem-link{ - @extend .ui-corner-top-small; - } - } - &:last-of-type { - border: none; - .ui-menuitem-link{ - @extend .ui-corner-bottom-small; - } - } -} - -.ui-dropmenu-list .ui-menuitem-link .ui-submenu-icon { - position: absolute; - margin-top: -.5em; - right: 0; - top: 50%; -} - -.ui-dropmenu-list .ui-menuitem-active > .ui-submenu > .ui-submenu-list { - display: block !important; -} - - -.ui-fluid .ui-dropmenu { - width: 100%; -} - -.ui-fluid .ui-dropmenu .ui-button { - width: 100%; -} - -.ui-dropmenu-list.ui-dropmenu-large { - @extend .ui-corner-all-medium; - .ui-submenu-list{ - @extend .ui-corner-all-medium; - } - .ui-menuitem{ - min-width: 1.80rem; - &:first-of-type { - .ui-menuitem-link{ - padding-top: 0.05rem; - @extend .ui-corner-top-medium; - } - } - &:last-of-type { - .ui-menuitem-link{ - padding-top: 0; - padding-bottom: 0.05rem; - @extend .ui-corner-bottom-medium; - } - } - } -} \ No newline at end of file diff --git a/dashboard/src/app/components/dropmenu/dropmenu.ts b/dashboard/src/app/components/dropmenu/dropmenu.ts deleted file mode 100644 index ef46af1b9..000000000 --- a/dashboard/src/app/components/dropmenu/dropmenu.ts +++ /dev/null @@ -1,266 +0,0 @@ -import {NgModule,Component,ElementRef,AfterViewInit,OnDestroy,Input,Output,Renderer2,Inject,forwardRef,ViewChild,AfterViewChecked,ContentChildren,EventEmitter,QueryList,ChangeDetectorRef} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {DomHandler} from '../dom/domhandler'; -import {MenuItem} from '../common/menuitem'; -import {Location} from '@angular/common'; -import {trigger,state,style,transition,animate} from '@angular/animations'; -import {ButtonModule} from '../button/button'; -import {Router} from '@angular/router'; -import {RouterModule} from '@angular/router'; - -@Component({ - selector: 'p-dropMenuSub', - template: ` - - `, - providers: [DomHandler] -}) -export class ContextMenuSub { - - @Input() item: MenuItem; - - @Input() root: boolean; - - constructor(public domHandler: DomHandler, @Inject(forwardRef(() => DropMenu)) public contextMenu: DropMenu) {} - - activeItem: any; - - containerLeft: any; - - hideTimeout: any; - - onItemMouseEnter(event, item, menuitem) { - if(menuitem.disabled) { - return; - } - - if(this.hideTimeout) { - clearTimeout(this.hideTimeout); - this.hideTimeout = null; - } - - this.activeItem = item; - let nextElement = item.children[0].nextElementSibling; - if(nextElement) { - let sublist = nextElement.children[0]; - sublist.style.zIndex = ++DomHandler.zindex; - this.position(sublist, item); - } - } - - onItemMouseLeave(event, link) { - this.hideTimeout = setTimeout(() => { - this.activeItem = null; - }, 1000); - } - - itemClick(event, item: MenuItem) { - if(item.disabled) { - event.preventDefault(); - return; - } - - if(!item.url) { - event.preventDefault(); - } - - if(item.command) { - item.command({ - originalEvent: event, - item: item - }); - } - } - - listClick(event) { - this.activeItem = null; - } - - position(sublist, item) { - this.containerLeft = this.domHandler.getOffset(item.parentElement) - let viewport = this.domHandler.getViewport(); - let sublistWidth = sublist.offsetParent ? sublist.offsetWidth: this.domHandler.getHiddenElementOuterWidth(sublist); - let itemOuterWidth = this.domHandler.getOuterWidth(item.children[0]); - - sublist.style.top = '0px'; - - if((parseInt(this.containerLeft.left) + itemOuterWidth + sublistWidth) > (viewport.width - this.calculateScrollbarWidth())) { - sublist.style.left = -sublistWidth + 'px'; - } - else { - sublist.style.left = itemOuterWidth + 'px'; - } - } - - calculateScrollbarWidth(): number { - let scrollDiv = document.createElement("div"); - scrollDiv.className = "ui-scrollbar-measure"; - document.body.appendChild(scrollDiv); - - let scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth; - document.body.removeChild(scrollDiv); - - return scrollbarWidth; - } -} - -@Component({ - selector: 'p-dropmenu', - template: ` -
- -
- -
-
- `, - providers: [DomHandler] -}) -export class DropMenu implements AfterViewInit,OnDestroy { - - @Input() model: MenuItem[]; - - @Input() label: string; - - @Input() icon: string = "fa-caret-down"; - - @Input() disabled: boolean; - - @Input() global: boolean; - - @Input() target: any; - - @Input() style: any; - - @Input() styleClass: string; - - @Input() appendTo: any = "body"; - - @Input() autoZIndex: boolean = true; - - @Input() baseZIndex: number = 0; - - @Output() onDropdownClick: EventEmitter = new EventEmitter(); - - @ViewChild('container') containerViewChild: ElementRef; - - @ViewChild('overlay') overlayViewChild: ElementRef; - - documentClickListener: any; - - public dropdownClick: boolean; - - public shown: boolean; - - constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer2) {} - - ngAfterViewInit() { - if(this.appendTo) { - if(this.appendTo === 'body') - document.body.appendChild( this.overlayViewChild.nativeElement); - else - this.domHandler.appendChild(this.overlayViewChild.nativeElement, this.appendTo); - } - } - - onDropdownButtonClick(event: Event) { - if(!this.shown) { - this.dropdownClick = true; - }else{ - this.dropdownClick = false; - } - this.onDropdownClick.emit(event); - this.show(event); - } - - show(event?) { - this.alignPanel(); - this.moveOnTop(); - this.overlayViewChild.nativeElement.style.display = 'block'; - this.domHandler.fadeIn(this.overlayViewChild.nativeElement, 250); - this.bindDocumentClickListener(); - - if(event) { - event.preventDefault(); - } - } - - hide() { - this.overlayViewChild.nativeElement.style.display = 'none'; - this.unbindDocumentClickListener(); - } - - alignPanel() { - if(this.appendTo) - this.domHandler.absolutePosition(this.overlayViewChild.nativeElement, this.containerViewChild.nativeElement); - else - this.domHandler.relativePosition(this.overlayViewChild.nativeElement, this.containerViewChild.nativeElement); - } - - moveOnTop() { - if(this.autoZIndex) { - this.overlayViewChild.nativeElement.style.zIndex = String(this.baseZIndex + (++DomHandler.zindex)); - } - } - - bindDocumentClickListener() { - if(!this.documentClickListener) { - this.documentClickListener = this.renderer.listen('document', 'click', (event) => { - if(this.dropdownClick) { - this.dropdownClick = false; - this.shown = true; - } - else { - this.hide(); - this.shown = false; - this.unbindDocumentClickListener(); - } - }); - } - } - - unbindDocumentClickListener() { - if(this.documentClickListener) { - this.documentClickListener(); - this.documentClickListener = null; - } - } - - ngOnDestroy() { - this.unbindDocumentClickListener(); - - if(this.appendTo) { - this.el.nativeElement.appendChild(this.overlayViewChild.nativeElement); - } - } - -} - -@NgModule({ - imports: [CommonModule, ButtonModule, RouterModule], - exports: [DropMenu, ButtonModule, RouterModule], - declarations: [DropMenu,ContextMenuSub] -}) -export class DropMenuModule { } \ No newline at end of file diff --git a/dashboard/src/app/components/editor/editor.spec.ts b/dashboard/src/app/components/editor/editor.spec.ts deleted file mode 100644 index 90dc4c2a9..000000000 --- a/dashboard/src/app/components/editor/editor.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { Editor } from './editor'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('Editor', () => { - - let editor: Editor; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - Editor - ] - }); - - fixture = TestBed.createComponent(Editor); - editor = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/editor/editor.ts b/dashboard/src/app/components/editor/editor.ts deleted file mode 100644 index c53b8ba18..000000000 --- a/dashboard/src/app/components/editor/editor.ts +++ /dev/null @@ -1,193 +0,0 @@ -import {NgModule,Component,ElementRef,AfterViewInit,Input,Output,EventEmitter,ContentChild,OnChanges,forwardRef} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {SharedModule,Header} from '../common/shared' -import {DomHandler} from '../dom/domhandler'; -import {NG_VALUE_ACCESSOR, ControlValueAccessor} from '@angular/forms'; - -declare var Quill: any; - -export const EDITOR_VALUE_ACCESSOR: any = { - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => Editor), - multi: true -}; - -@Component({ - selector: 'p-editor', - template: ` -
-
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- `, - providers: [DomHandler,EDITOR_VALUE_ACCESSOR] -}) -export class Editor implements AfterViewInit,ControlValueAccessor { - - @Output() onTextChange: EventEmitter = new EventEmitter(); - - @Output() onSelectionChange: EventEmitter = new EventEmitter(); - - @ContentChild(Header) toolbar; - - @Input() style: any; - - @Input() styleClass: string; - - @Input() placeholder: string; - - @Input() formats: string[]; - - @Output() onInit: EventEmitter = new EventEmitter(); - - value: string; - - _readonly: boolean; - - onModelChange: Function = () => {}; - - onModelTouched: Function = () => {}; - - quill: any; - - constructor(public el: ElementRef, public domHandler: DomHandler) {} - - ngAfterViewInit() { - let editorElement = this.domHandler.findSingle(this.el.nativeElement ,'div.ui-editor-content'); - let toolbarElement = this.domHandler.findSingle(this.el.nativeElement ,'div.ui-editor-toolbar'); - - this.quill = new Quill(editorElement, { - modules: { - toolbar: toolbarElement - }, - placeholder: this.placeholder, - readOnly: this.readonly, - theme: 'snow', - formats: this.formats - }); - - if(this.value) { - this.quill.pasteHTML(this.value); - } - - this.quill.on('text-change', (delta, oldContents, source) => { - if (source === 'user') { - let html = editorElement.children[0].innerHTML; - let text = this.quill.getText(); - if (html == '


') { - html = null; - } - - this.onTextChange.emit({ - htmlValue: html, - textValue: text, - delta: delta, - source: source - }); - - this.onModelChange(html); - this.onModelTouched(); - } - }); - - this.quill.on('selection-change', (range, oldRange, source) => { - this.onSelectionChange.emit({ - range: range, - oldRange: oldRange, - source: source - }); - }); - - this.onInit.emit({ - editor: this.quill - }); - } - - writeValue(value: any) : void { - this.value = value; - - if(this.quill) { - if(value) - this.quill.pasteHTML(value); - else - this.quill.setText(''); - } - } - - registerOnChange(fn: Function): void { - this.onModelChange = fn; - } - - registerOnTouched(fn: Function): void { - this.onModelTouched = fn; - } - - getQuill() { - return this.quill; - } - - @Input() get readonly(): boolean { - return this._readonly; - } - - set readonly(val:boolean) { - this._readonly = val; - - if(this.quill) { - if(this._readonly) - this.quill.disable(); - else - this.quill.enable(); - } - } -} - -@NgModule({ - imports: [CommonModule], - exports: [Editor,SharedModule], - declarations: [Editor] -}) -export class EditorModule { } \ No newline at end of file diff --git a/dashboard/src/app/components/fieldset/fieldset.css b/dashboard/src/app/components/fieldset/fieldset.css deleted file mode 100644 index 823e1f178..000000000 --- a/dashboard/src/app/components/fieldset/fieldset.css +++ /dev/null @@ -1,29 +0,0 @@ -.ui-fieldset, -.ui-fieldset .ui-fieldset-legend { - padding: 0.5em 1em; -} - -.ui-fieldset-toggleable .ui-fieldset-legend { - padding: 0; -} - -.ui-fieldset-toggleable .ui-fieldset-legend a { - padding: 0.5em 1em; - cursor:pointer; - white-space: nowrap; - display: block; -} - -.ui-fieldset .ui-fieldset-toggler { - margin-right: .1em; - display: inline-block; - vertical-align: middle; -} - -.ui-fieldset .ui-fieldset-legend-text { - vertical-align: middle; -} - -.ui-fieldset .ui-fieldset-content-wrapper-overflown { - overflow: hidden; -} \ No newline at end of file diff --git a/dashboard/src/app/components/fieldset/fieldset.spec.ts b/dashboard/src/app/components/fieldset/fieldset.spec.ts deleted file mode 100644 index 47b014d34..000000000 --- a/dashboard/src/app/components/fieldset/fieldset.spec.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { TestBed, ComponentFixture, fakeAsync, tick } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { Fieldset } from './fieldset'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('Fieldset', () => { - - let fieldset: Fieldset; - let fixture: ComponentFixture
; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - Fieldset - ] - }); - - fixture = TestBed.createComponent(Fieldset); - fieldset = fixture.componentInstance; - }); - - it('should display the legend', () => { - fieldset.legend = 'PrimeNG Fieldset Legend'; - fixture.detectChanges(); - const headerEl = fixture.debugElement.query(By.css('.ui-fieldset-legend-text')); - expect(headerEl.nativeElement.textContent).toContain('PrimeNG Fieldset Legend') - }); - - it('should not render toggle icon when not toggleable', () => { - fixture.detectChanges(); - const toggleIcon = fixture.debugElement.query(By.css('.ui-fieldset-toggler')); - expect(toggleIcon).toBeNull(); - }); - - it('should render toggle icon when toggleable', () => { - fieldset.toggleable = true; - fixture.detectChanges(); - const toggleIcon = fixture.debugElement.query(By.css('.ui-fieldset-toggler')); - expect(toggleIcon).not.toBeNull(); - }); - - it('should toggle the fieldset when toggler is clicked', fakeAsync(() => { - fieldset.toggleable = true; - fixture.detectChanges(); - const togglerEl = fixture.nativeElement.querySelector('.ui-fieldset-legend').children[0]; - - togglerEl.click(); - expect(fieldset.collapsed).toEqual(true); - - tick(500); - - togglerEl.click(); - expect(fieldset.collapsed).toEqual(false); - })); - -}); diff --git a/dashboard/src/app/components/fieldset/fieldset.ts b/dashboard/src/app/components/fieldset/fieldset.ts deleted file mode 100644 index 631e2842d..000000000 --- a/dashboard/src/app/components/fieldset/fieldset.ts +++ /dev/null @@ -1,113 +0,0 @@ -import {NgModule,Component,Input,Output,EventEmitter,ElementRef} from '@angular/core'; -import {trigger,state,style,transition,animate} from '@angular/animations'; -import {CommonModule} from '@angular/common'; -import {SharedModule} from '../common/shared'; -import {BlockableUI} from '../common/blockableui'; - -let idx: number = 0; - -@Component({ - selector: 'p-fieldset', - template: ` -
- - - - - - - - - {{legend}} - - - -
-
- -
-
-
- `, - animations: [ - trigger('fieldsetContent', [ - state('hidden', style({ - height: '0px' - })), - state('visible', style({ - height: '*' - })), - transition('visible => hidden', animate('400ms cubic-bezier(0.86, 0, 0.07, 1)')), - transition('hidden => visible', animate('400ms cubic-bezier(0.86, 0, 0.07, 1)')) - ]) - ] -}) -export class Fieldset implements BlockableUI { - - @Input() legend: string; - - @Input() toggleable: boolean; - - @Input() collapsed: boolean = false; - - @Output() collapsedChange: EventEmitter = new EventEmitter(); - - @Output() onBeforeToggle: EventEmitter = new EventEmitter(); - - @Output() onAfterToggle: EventEmitter = new EventEmitter(); - - @Input() style: any; - - @Input() styleClass: string - - public animating: boolean; - - constructor(private el: ElementRef) {} - - id: string = `ui-fieldset-${idx++}`; - - toggle(event) { - if(this.animating) { - return false; - } - - this.animating = true; - this.onBeforeToggle.emit({originalEvent: event, collapsed: this.collapsed}); - - if(this.collapsed) - this.expand(event); - else - this.collapse(event); - - this.onAfterToggle.emit({originalEvent: event, collapsed: this.collapsed}); - event.preventDefault(); - } - - expand(event) { - this.collapsed = false; - this.collapsedChange.emit(this.collapsed); - } - - collapse(event) { - this.collapsed = true; - this.collapsedChange.emit(this.collapsed); - } - - getBlockableElement(): HTMLElement { - return this.el.nativeElement.children[0]; - } - - onToggleDone(event: Event) { - this.animating = false; - } - -} - -@NgModule({ - imports: [CommonModule], - exports: [Fieldset,SharedModule], - declarations: [Fieldset] -}) -export class FieldsetModule { } \ No newline at end of file diff --git a/dashboard/src/app/components/fileupload/fileupload.css b/dashboard/src/app/components/fileupload/fileupload.css deleted file mode 100644 index 11b4ac301..000000000 --- a/dashboard/src/app/components/fileupload/fileupload.css +++ /dev/null @@ -1,96 +0,0 @@ -/* - * FileUpload - */ -.ui-fileupload-buttonbar .ui-fileupload-choose.ui-state-disabled input { - cursor: default; -} - -.ui-fileupload-buttonbar { - padding: .5em; - border-bottom: 0 none; -} - -.ui-fileupload-buttonbar .ui-button { - vertical-align: middle; - margin-right: .25em; -} - -.ui-fileupload-content { - padding: 1em; - position: relative; - transition: border-color .3s; -} - -.ui-fileupload-content.ui-fileupload-highlight { - border-color: #156090; -} - -.ui-fileupload-files img { - border: none; -} - -.ui-fileupload-files { - display: table; -} - -.ui-fileupload-row { - display: table-row; -} - -.ui-fileupload-row > div { - display: table-cell; - padding: .5em 1em; - vertical-align: middle; -} - -.ui-fileupload-content .ui-progressbar { - width: 100%; - position: absolute; - top: 1px; - left: 0; - height: .25em; - border: 0 none; -} - -.ui-fileupload-content .ui-progressbar-value { - -moz-border-radius: 0; - -webkit-border-radius: 0; - border-radius: 0; - border: 0 none; -} - -/* Simple */ -.ui-fileupload-choose { - position: relative; - overflow: hidden; -} - -.ui-fileupload-choose input[type=file] { - position: absolute; - top: 0; - right: 0; - margin: 0; - opacity: 0; - min-height: 100%; - font-size: 100px; - text-align: right; - filter: alpha(opacity=0); - direction: ltr; - cursor: pointer; -} - -.ui-fileupload-choose.ui-fileupload-choose-selected input[type=file] { - display: none; -} - -/* ui-fluid */ -.ui-fluid .ui-fileupload .ui-button { - width: auto; -} - -.ui-fluid .ui-fileupload-content .ui-button-icon-only { - width: 2em; -} - - - diff --git a/dashboard/src/app/components/fileupload/fileupload.spec.ts b/dashboard/src/app/components/fileupload/fileupload.spec.ts deleted file mode 100644 index 0a74fa1bf..000000000 --- a/dashboard/src/app/components/fileupload/fileupload.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { FileUpload } from './fileupload'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('FileUpload', () => { - - let fileupload: FileUpload; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - FileUpload - ] - }); - - fixture = TestBed.createComponent(FileUpload); - fileupload = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/fileupload/fileupload.ts b/dashboard/src/app/components/fileupload/fileupload.ts deleted file mode 100644 index c0f32503e..000000000 --- a/dashboard/src/app/components/fileupload/fileupload.ts +++ /dev/null @@ -1,459 +0,0 @@ -import {NgModule,Component,OnInit,OnDestroy,Input,Output,EventEmitter,TemplateRef,AfterViewInit,AfterContentInit, - ContentChildren,QueryList,ViewChild,ElementRef,NgZone} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {DomSanitizer} from '@angular/platform-browser'; -import {ButtonModule} from '../button/button'; -import {MessagesModule} from '../messages/messages'; -import {ProgressBarModule} from '../progressbar/progressbar'; -import {DomHandler} from '../dom/domhandler'; -import {Message} from '../common/message'; -import {PrimeTemplate,SharedModule} from '../common/shared'; -import {BlockableUI} from '../common/blockableui'; - -@Component({ - selector: 'p-fileUpload', - template: ` -
-
- - - - - - - - -
-
- - - - -
-
-
-
-
{{file.name}}
-
{{formatSize(file.size)}}
-
-
-
-
- -
-
- -
-
- - - {{auto ? chooseLabel : hasFiles() ? files[0].name : chooseLabel}} - - - `, - providers: [DomHandler] -}) -export class FileUpload implements OnInit,AfterViewInit,AfterContentInit,OnDestroy,BlockableUI { - - @Input() name: string; - - @Input() url: string; - - @Input() method: string = 'POST'; - - @Input() multiple: boolean; - - @Input() accept: string; - - @Input() disabled: boolean; - - @Input() auto: boolean; - - @Input() withCredentials: boolean; - - @Input() maxFileSize: number; - - @Input() invalidFileSizeMessageSummary: string = '{0}: Invalid file size, '; - - @Input() invalidFileSizeMessageDetail: string = 'maximum upload size is {0}.'; - - @Input() invalidFileTypeMessageSummary: string = '{0}: Invalid file type, '; - - @Input() invalidFileTypeMessageDetail: string = 'allowed file types: {0}.'; - - @Input() style: string; - - @Input() styleClass: string; - - @Input() previewWidth: number = 50; - - @Input() chooseLabel: string = 'Choose'; - - @Input() uploadLabel: string = 'Upload'; - - @Input() cancelLabel: string = 'Cancel'; - - @Input() showUploadButton: boolean = true; - - @Input() showCancelButton: boolean = true; - - @Input() mode: string = 'advanced'; - - @Input() customUpload: boolean; - - @Output() onBeforeUpload: EventEmitter = new EventEmitter(); - - @Output() onBeforeSend: EventEmitter = new EventEmitter(); - - @Output() onUpload: EventEmitter = new EventEmitter(); - - @Output() onError: EventEmitter = new EventEmitter(); - - @Output() onClear: EventEmitter = new EventEmitter(); - - @Output() onRemove: EventEmitter = new EventEmitter(); - - @Output() onSelect: EventEmitter = new EventEmitter(); - - @Output() onProgress: EventEmitter = new EventEmitter(); - - @Output() uploadHandler: EventEmitter = new EventEmitter(); - - @ContentChildren(PrimeTemplate) templates: QueryList; - - @ViewChild('advancedfileinput') advancedFileInput: ElementRef; - - @ViewChild('basicfileinput') basicFileInput: ElementRef; - - @ViewChild('content') content: ElementRef; - - @Input() files: File[]; - - public progress: number = 0; - - public dragHighlight: boolean; - - public msgs: Message[]; - - public fileTemplate: TemplateRef; - - public contentTemplate: TemplateRef; - - public toolbarTemplate: TemplateRef; - - focus: boolean; - - duplicateIEEvent: boolean; // flag to recognize duplicate onchange event for file input - - constructor(private el: ElementRef, public domHandler: DomHandler, public sanitizer: DomSanitizer, public zone: NgZone){} - - ngOnInit() { - this.files = []; - } - - ngAfterContentInit() { - this.templates.forEach((item) => { - switch(item.getType()) { - case 'file': - this.fileTemplate = item.template; - break; - - case 'content': - this.contentTemplate = item.template; - break; - - case 'toolbar': - this.toolbarTemplate = item.template; - break; - - default: - this.fileTemplate = item.template; - break; - } - }); - } - - ngAfterViewInit() { - if(this.mode === 'advanced') { - this.zone.runOutsideAngular(() => { - this.content.nativeElement.addEventListener('dragover', this.onDragOver.bind(this)); - }); - } - } - - onFileSelect(event) { - if(event.type !== 'drop' && this.isIE11() && this.duplicateIEEvent) { - this.duplicateIEEvent = false; - return; - } - - this.msgs = []; - if(!this.multiple) { - this.files = []; - } - - let files = event.dataTransfer ? event.dataTransfer.files : event.target.files; - for(let i = 0; i < files.length; i++) { - let file = files[i]; - - if(!this.isFileSelected(file)){ - if(this.validate(file)) { - if(this.isImage(file)) { - file.objectURL = this.sanitizer.bypassSecurityTrustUrl((window.URL.createObjectURL(files[i]))); - } - - this.files.push(files[i]); - } - } - } - - this.onSelect.emit({originalEvent: event, files: files}); - - if(this.hasFiles() && this.auto) { - this.upload(); - } - - if (event.type !== 'drop' && this.isIE11()) { - this.clearIEInput(); - } else { - this.clearInputElement(); - } - } - - isFileSelected(file: File): boolean{ - for(let sFile of this.files){ - if((sFile.name + sFile.type + sFile.size) === (file.name + file.type+file.size)) { - return true; - } - } - - return false; - } - - isIE11() { - return !!window['MSInputMethodContext'] && !!document['documentMode']; - } - - validate(file: File): boolean { - if(this.accept && !this.isFileTypeValid(file)) { - this.msgs.push({ - severity: 'error', - summary: this.invalidFileTypeMessageSummary.replace('{0}', file.name), - detail: this.invalidFileTypeMessageDetail.replace('{0}', this.accept) - }); - return false; - } - - if(this.maxFileSize && file.size > this.maxFileSize) { - this.msgs.push({ - severity: 'error', - summary: this.invalidFileSizeMessageSummary.replace('{0}', file.name), - detail: this.invalidFileSizeMessageDetail.replace('{0}', this.formatSize(this.maxFileSize)) - }); - return false; - } - - return true; - } - - private isFileTypeValid(file: File): boolean { - let acceptableTypes = this.accept.split(','); - for(let type of acceptableTypes) { - let acceptable = this.isWildcard(type) ? this.getTypeClass(file.type) === this.getTypeClass(type) - : file.type == type || this.getFileExtension(file) === type; - - if(acceptable) { - return true; - } - } - - return false; - } - - getTypeClass(fileType: string): string { - return fileType.substring(0, fileType.indexOf('/')); - } - - isWildcard(fileType: string): boolean { - return fileType.indexOf('*') !== -1; - } - - getFileExtension(file: File): string { - return '.' + file.name.split('.').pop(); - } - - isImage(file: File): boolean { - return /^image\//.test(file.type); - } - - onImageLoad(img: any) { - window.URL.revokeObjectURL(img.src); - } - - upload() { - if(this.customUpload) { - this.uploadHandler.emit({ - files: this.files - }); - } - else { - this.msgs = []; - let xhr = new XMLHttpRequest(), - formData = new FormData(); - - this.onBeforeUpload.emit({ - 'xhr': xhr, - 'formData': formData - }); - - for(let i = 0; i < this.files.length; i++) { - formData.append(this.name, this.files[i], this.files[i].name); - } - - xhr.upload.addEventListener('progress', (e: ProgressEvent) => { - if(e.lengthComputable) { - this.progress = Math.round((e.loaded * 100) / e.total); - } - - this.onProgress.emit({originalEvent: e, progress: this.progress}); - }, false); - - xhr.onreadystatechange = () => { - if(xhr.readyState == 4) { - this.progress = 0; - - if(xhr.status >= 200 && xhr.status < 300) - this.onUpload.emit({xhr: xhr, files: this.files}); - else - this.onError.emit({xhr: xhr, files: this.files}); - - this.clear(); - } - }; - - xhr.open(this.method, this.url, true); - - this.onBeforeSend.emit({ - 'xhr': xhr, - 'formData': formData - }); - - xhr.withCredentials = this.withCredentials; - - xhr.send(formData); - } - } - - clear() { - this.files = []; - this.onClear.emit(); - this.clearInputElement(); - } - - remove(event: Event, index: number) { - this.clearInputElement(); - this.onRemove.emit({originalEvent: event, file: this.files[index]}); - this.files.splice(index, 1); - } - - clearInputElement() { - if (this.advancedFileInput && this.advancedFileInput.nativeElement) { - this.advancedFileInput.nativeElement.value = ''; - } - } - - clearIEInput() { - if (this.advancedFileInput && this.advancedFileInput.nativeElement) { - this.duplicateIEEvent = true; //IE11 fix to prevent onFileChange trigger again - this.advancedFileInput.nativeElement.value = ''; - } - } - - hasFiles(): boolean { - return this.files && this.files.length > 0; - } - - onDragEnter(e) { - if(!this.disabled) { - e.stopPropagation(); - e.preventDefault(); - } - } - - onDragOver(e) { - if(!this.disabled) { - this.domHandler.addClass(this.content.nativeElement, 'ui-fileupload-highlight'); - this.dragHighlight = true; - e.stopPropagation(); - e.preventDefault(); - } - } - - onDragLeave(event) { - if(!this.disabled) { - this.domHandler.removeClass(this.content.nativeElement, 'ui-fileupload-highlight'); - } - } - - onDrop(event) { - if(!this.disabled) { - this.domHandler.removeClass(this.content.nativeElement, 'ui-fileupload-highlight'); - event.stopPropagation(); - event.preventDefault(); - - let files = event.dataTransfer ? event.dataTransfer.files : event.target.files; - let allowDrop = this.multiple||(files && files.length === 1); - - if(allowDrop) { - this.onFileSelect(event); - } - } - } - - onFocus() { - this.focus = true; - } - - onBlur() { - this.focus = false; - } - - formatSize(bytes) { - if(bytes == 0) { - return '0 B'; - } - let k = 1000, - dm = 3, - sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], - i = Math.floor(Math.log(bytes) / Math.log(k)); - - return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; - } - - onSimpleUploaderClick(event: Event) { - if(this.hasFiles()) { - this.upload(); - } - } - - getBlockableElement(): HTMLElement { - return this.el.nativeElement.children[0]; - } - - ngOnDestroy() { - if(this.content && this.content.nativeElement) { - this.content.nativeElement.removeEventListener('dragover', this.onDragOver); - } - } -} - -@NgModule({ - imports: [CommonModule,SharedModule,ButtonModule,ProgressBarModule,MessagesModule], - exports: [FileUpload,SharedModule,ButtonModule,ProgressBarModule,MessagesModule], - declarations: [FileUpload] -}) -export class FileUploadModule { } diff --git a/dashboard/src/app/components/form/form.scss b/dashboard/src/app/components/form/form.scss deleted file mode 100644 index 54f8bd931..000000000 --- a/dashboard/src/app/components/form/form.scss +++ /dev/null @@ -1,103 +0,0 @@ -.form{ - .form-item{ - margin-bottom: 0.1rem; - flex-wrap: nowrap; - .form-label{ - padding:0; - line-height: 0.32rem; - flex-shrink: 0; - &::before{ - content: "*"; - display: inline; - color: transparent; - padding-right: 0; - margin-left: -0.09rem; - } - &.required::before{ - color: $stateErrorTextColor; - } - label{ - color: map-get($map: $color-text, $key: secondary); - &::after{ - content: ":"; - display: inline; - padding-left: 0.05rem; - } - } - } - .form-content{ - .text-only{ - line-height: .32rem; - } - } - } - .hide .form-item .form-label{ - display: none; - } - .button-group{ - margin-top: 0.3rem; - } - p{ - margin-bottom: 0.2rem; - } - .form-nest{ - .form-item{ - margin-bottom: 0.1rem; - } - } - - .ui-g-1, .ui-g-2, .ui-g-3, .ui-g-4, .ui-g-5, .ui-g-6, .ui-g-7, .ui-g-8, .ui-g-9, .ui-g-10, .ui-g-11, .ui-g-12 { - padding: 0; - } -} - -.form-group-container{ - .form-item{ - margin-bottom: 0!important; - } -} - -.form > .title-secondary:first-of-type{ - margin-top: 0; -} - -.form > * > .title-secondary:first-of-type{ - margin-top: 0; -} - -[name^="form-template"]{ - display: none; -} - -.ui-message-container{ - padding: 0; - margin: 0; - animation: fadeInDown 150ms cubic-bezier(0.4, 0, 0.2, 1),fadeIn 150ms cubic-bezier(0.4, 0 0.2, 1); - animation-fill-mode: forwards; - - .ui-message{ - border: none; - margin: .05rem 0; - padding: 0; - color: $stateErrorTextColor; - } - - .ui-messages-error{ - background: inherit; - color: $stateErrorTextColor; - border: none; - list-style-type: none; - margin: 0; - padding: 10px 0 0 0 ; - } - - .fa{ - vertical-align: middle; - margin-right: 2px; - margin-top: -2px; - } - - .ui-message-error-text{ - vertical-align: middle; - } -} \ No newline at end of file diff --git a/dashboard/src/app/components/form/form.ts b/dashboard/src/app/components/form/form.ts deleted file mode 100644 index cf700a6c6..000000000 --- a/dashboard/src/app/components/form/form.ts +++ /dev/null @@ -1,136 +0,0 @@ -import { NgModule, Component, Directive, Input, Output, ElementRef, Injector, OnInit, AfterViewInit, AfterContentChecked } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormsModule, ReactiveFormsModule, FormGroup, AbstractControl } from '@angular/forms'; -import { Keys } from '../common/keys.pipe'; - -@Directive({ - selector: 'form' -}) - -export class Form{ - @Input() grid: {label: string, content: string }; - - @Input() errorMessage: {[key: string]: {[key: string]: any}}; - - @Input() formGroup: FormGroup; - - @Input() columns: any; - - constructor(el: ElementRef) { - el.nativeElement.classList.add('form'); - } -} - -@Component({ - selector: 'form-item', - template: ` -
-
- -
-
- -
-
- - - {{ (errorMessage && errorMessage[errKey]) || formCtrl.errors[errKey] }} - -
-
-
-
- ` -}) - -export class FormItem implements OnInit, AfterViewInit, AfterContentChecked { - - @Input() required: boolean; - - @Input() label: string; - - @Input() hide: string; - - errorMessage: {[Key:string]:{[key:string]:any}}; - - itemStyleClass: string; - - labelStyleClass: string; - - contentStyleClass: string; - - formInstance: Form; - - formCtrl: AbstractControl; - - formctrls: { name:string, formCtrl: AbstractControl, errorMessage: {[Key:string]:{[key:string]:any}}}[] = []; - - constructor( private el: ElementRef, private injector: Injector){} - - ngOnInit(): void{ - //栅格样式 - this.formInstance = this.injector.get(Form); - - if( !this.formInstance ){ - throw "require Form"; - } - - if( this.formInstance.grid ){ - this.labelStyleClass = this.formInstance.grid.label; - this.contentStyleClass = this.formInstance.grid.content; - } - - if( this.formInstance.columns ){ - let className = "ui-g-" + 12 / this.formInstance.columns; - this.itemStyleClass = className; - } - } - - ngAfterViewInit(): void{ - let ctrlElems =this.el.nativeElement.querySelectorAll(".form-content [formControlName]"); - if( this.formInstance.formGroup && ctrlElems.length > 0){ - ctrlElems.forEach(elem => { - let name = elem.getAttribute("formControlName"); - let formCtrl = this.formInstance.formGroup.get(name); - - if( formCtrl ){ - this.formctrls.push({ - name: name, - formCtrl: formCtrl, - errorMessage: this.formInstance.errorMessage && this.formInstance.errorMessage[name] - }); - } - }) - } - } - - ngAfterContentChecked(){ - this.updateFormCtrl(); - } - - //显示第一个错误 - updateFormCtrl(): void { - let firstErrorCtrl = this.formctrls.filter( item => { - let formCtrl = item.formCtrl; - return formCtrl.invalid && (formCtrl.dirty || formCtrl.touched); - })[0]; - - if( firstErrorCtrl ){ - this.formCtrl = firstErrorCtrl.formCtrl; - this.errorMessage = firstErrorCtrl.errorMessage; - } - else{ - this.formCtrl = null; - this.errorMessage = null; - } - } - -} - -@NgModule({ - imports: [CommonModule, FormsModule ], - exports: [Form, FormItem, Keys ], - declarations: [Form, FormItem, Keys ] -}) -export class FormModule{} - diff --git a/dashboard/src/app/components/galleria/galleria.css b/dashboard/src/app/components/galleria/galleria.css deleted file mode 100644 index 8226a610b..000000000 --- a/dashboard/src/app/components/galleria/galleria.css +++ /dev/null @@ -1,81 +0,0 @@ -.ui-galleria { - overflow: hidden; - visibility: hidden; - position: relative; -} - -.ui-galleria-panel-wrapper { - position: relative; - padding: 0; - margin: 0; -} - -.ui-galleria-panel { - filter: inherit; - position: absolute; - top: 0; - left: 0; - list-style-type: none; -} - -.ui-galleria-filmstrip-wrapper { - overflow: hidden; - margin: .25em auto; - position: relative; -} - -.ui-galleria-filmstrip { - list-style: none outside none; - margin: 0; - padding: 0; - width: 2340px; - z-index: 900; - position: absolute; - top: 0; - left: 0; -} - -.ui-galleria-frame { - float:left; - margin-right: 5px; - opacity: 0.3; - cursor: pointer; -} - -.ui-galleria-frame-active { - opacity: 1; -} - -.ui-galleria-frame-content { - overflow: hidden; -} - -.ui-galleria-nav-next, .ui-galleria-nav-prev { - cursor: pointer; - position: absolute; -} - -.ui-galleria-nav-prev { - left: 5px; -} - -.ui-galleria-nav-next { - right: 5px; -} - -.ui-galleria-caption { - position: absolute; - left:1px; - background-color: rgba(0,0,0,0.5); - display: none; - color: #ededed; - padding: 0.2em 1em; -} - -.ui-galleria-caption h4 { - color: #ededed; -} - -.ui-galleria-panel-content { - padding: 1em 1.4em; -} \ No newline at end of file diff --git a/dashboard/src/app/components/galleria/galleria.spec.ts b/dashboard/src/app/components/galleria/galleria.spec.ts deleted file mode 100644 index 0124eae2d..000000000 --- a/dashboard/src/app/components/galleria/galleria.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { Galleria } from './galleria'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('Galleria', () => { - - let galleria: Galleria; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - Galleria - ] - }); - - fixture = TestBed.createComponent(Galleria); - galleria = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/galleria/galleria.ts b/dashboard/src/app/components/galleria/galleria.ts deleted file mode 100644 index cc4c6c952..000000000 --- a/dashboard/src/app/components/galleria/galleria.ts +++ /dev/null @@ -1,246 +0,0 @@ -import {NgModule,Component,ElementRef,AfterViewChecked,AfterViewInit,OnDestroy,Input,Output,EventEmitter} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {DomHandler} from '../dom/domhandler'; - -@Component({ - selector: 'p-galleria', - template: ` -
-
    -
  • - -
  • -
-
-
    -
  • -
    - -
    -
  • -
-
-
-
-
-

{{images[activeIndex]?.title}}

{{images[activeIndex]?.alt}}

-
-
- `, - providers: [DomHandler] -}) -export class Galleria implements AfterViewChecked,AfterViewInit,OnDestroy { - - @Input() style: any; - - @Input() styleClass: string; - - @Input() panelWidth: number = 600; - - @Input() panelHeight: number = 400; - - @Input() frameWidth: number = 60; - - @Input() frameHeight: number = 40; - - @Input() activeIndex: number = 0; - - @Input() showFilmstrip: boolean = true; - - @Input() autoPlay: boolean = true; - - @Input() transitionInterval: number = 4000; - - @Input() showCaption: boolean = true; - - @Output() onImageClicked = new EventEmitter(); - - @Output() onImageChange = new EventEmitter(); - - _images: any[]; - - slideshowActive: boolean; - - public container: any; - - public panelWrapper: any; - - public panels: any; - - public caption: any; - - public stripWrapper: any; - - public strip: any; - - public frames: any; - - public interval: any; - - public stripLeft: number = 0; - - public imagesChanged: boolean; - - public initialized: boolean; - - constructor(public el: ElementRef, public domHandler: DomHandler) {} - - ngAfterViewChecked() { - if(this.imagesChanged) { - this.stopSlideshow(); - this.render(); - this.imagesChanged = false; - } - } - - @Input() get images(): any[] { - return this._images; - } - - set images(value:any[]) { - this._images = value; - this.activeIndex = 0; - this.imagesChanged = true; - } - - ngAfterViewInit() { - this.container = this.el.nativeElement.children[0]; - this.panelWrapper = this.domHandler.findSingle(this.el.nativeElement, 'ul.ui-galleria-panel-wrapper'); - this.initialized = true; - - if(this.showFilmstrip) { - this.stripWrapper = this.domHandler.findSingle(this.container,'div.ui-galleria-filmstrip-wrapper'); - this.strip = this.domHandler.findSingle(this.stripWrapper,'ul.ui-galleria-filmstrip'); - } - - if(this.images && this.images.length) { - this.render(); - } - } - - render() { - this.panels = this.domHandler.find(this.panelWrapper, 'li.ui-galleria-panel'); - - if(this.showFilmstrip) { - this.frames = this.domHandler.find(this.strip,'li.ui-galleria-frame'); - this.stripWrapper.style.width = this.domHandler.width(this.panelWrapper) - 50 + 'px'; - this.stripWrapper.style.height = this.frameHeight + 'px'; - } - - if(this.showCaption) { - this.caption = this.domHandler.findSingle(this.container,'div.ui-galleria-caption'); - this.caption.style.bottom = this.showFilmstrip ? this.domHandler.getOuterHeight(this.stripWrapper,true) + 'px' : 0 + 'px'; - this.caption.style.width = this.domHandler.width(this.panelWrapper) + 'px'; - } - - if(this.autoPlay) { - this.startSlideshow(); - } - - this.container.style.visibility = 'visible'; - } - - startSlideshow() { - this.interval = setInterval(() => { - this.next(); - }, this.transitionInterval); - - this.slideshowActive = true; - } - - stopSlideshow() { - if(this.interval) { - clearInterval(this.interval); - } - - this.slideshowActive = false; - } - - clickNavRight() { - if(this.slideshowActive) { - this.stopSlideshow(); - } - this.next(); - } - - clickNavLeft() { - if(this.slideshowActive) { - this.stopSlideshow(); - } - this.prev(); - } - - frameClick(frame) { - if(this.slideshowActive) { - this.stopSlideshow(); - } - - this.select(this.domHandler.index(frame), false); - } - - prev() { - if(this.activeIndex !== 0) { - this.select(this.activeIndex - 1, true); - } - } - - next() { - if(this.activeIndex !== (this.panels.length-1)) { - this.select(this.activeIndex + 1, true); - } - else { - this.select(0, false); - this.stripLeft = 0; - } - } - - select(index, reposition) { - if(index !== this.activeIndex) { - let oldPanel = this.panels[this.activeIndex], - newPanel = this.panels[index]; - - this.domHandler.fadeIn(newPanel, 500); - - if(this.showFilmstrip) { - let oldFrame = this.frames[this.activeIndex], - newFrame = this.frames[index]; - - if(reposition === undefined || reposition === true) { - let frameLeft = newFrame.offsetLeft, - stepFactor = this.frameWidth + parseInt(getComputedStyle(newFrame)['margin-right'], 10), - stripLeft = this.strip.offsetLeft, - frameViewportLeft = frameLeft + stripLeft, - frameViewportRight = frameViewportLeft + this.frameWidth; - - if(frameViewportRight > this.domHandler.width(this.stripWrapper)) - this.stripLeft -= stepFactor; - else if(frameViewportLeft < 0) - this.stripLeft += stepFactor; - } - } - - this.activeIndex = index; - - this.onImageChange.emit({index: index}); - } - } - - clickImage(event, image, i) { - this.onImageClicked.emit({originalEvent: event, image: image, index: i}) - } - - ngOnDestroy() { - this.stopSlideshow(); - } - -} - -@NgModule({ - imports: [CommonModule], - exports: [Galleria], - declarations: [Galleria] -}) -export class GalleriaModule { } \ No newline at end of file diff --git a/dashboard/src/app/components/gmap/gmap.spec.ts b/dashboard/src/app/components/gmap/gmap.spec.ts deleted file mode 100644 index e2ca75344..000000000 --- a/dashboard/src/app/components/gmap/gmap.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { GMap } from './gmap'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('GMap', () => { - - let gmap: GMap; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - GMap - ] - }); - - fixture = TestBed.createComponent(GMap); - gmap = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/gmap/gmap.ts b/dashboard/src/app/components/gmap/gmap.ts deleted file mode 100644 index cd6a72ecd..000000000 --- a/dashboard/src/app/components/gmap/gmap.ts +++ /dev/null @@ -1,165 +0,0 @@ -import {NgModule,Component,ElementRef,OnInit,AfterViewChecked,DoCheck,OnDestroy,Input,Output,EventEmitter,IterableDiffers,ChangeDetectorRef,NgZone} from '@angular/core'; -import {CommonModule} from '@angular/common'; - -declare var google: any; - -@Component({ - selector: 'p-gmap', - template: `
` -}) -export class GMap implements AfterViewChecked,DoCheck { - - @Input() style: any; - - @Input() styleClass: string; - - @Input() options: any; - - @Input() overlays: any[]; - - @Output() onMapClick: EventEmitter = new EventEmitter(); - - @Output() onOverlayClick: EventEmitter = new EventEmitter(); - - @Output() onOverlayDragStart: EventEmitter = new EventEmitter(); - - @Output() onOverlayDrag: EventEmitter = new EventEmitter(); - - @Output() onOverlayDragEnd: EventEmitter = new EventEmitter(); - - @Output() onMapReady: EventEmitter = new EventEmitter(); - - @Output() onMapDragEnd: EventEmitter = new EventEmitter(); - - @Output() onZoomChanged: EventEmitter = new EventEmitter(); - - differ: any; - - map: any; - - constructor(public el: ElementRef,differs: IterableDiffers, public cd: ChangeDetectorRef, public zone:NgZone) { - this.differ = differs.find([]).create(null); - } - - ngAfterViewChecked() { - if(!this.map && this.el.nativeElement.offsetParent) { - this.initialize(); - } - } - - initialize() { - this.map = new google.maps.Map(this.el.nativeElement.children[0], this.options); - this.onMapReady.emit({ - map: this.map - }); - - if(this.overlays) { - for(let overlay of this.overlays) { - overlay.setMap(this.map); - this.bindOverlayEvents(overlay); - } - } - - this.map.addListener('click', (event) => { - this.zone.run(() => { - this.onMapClick.emit(event); - }); - }); - - this.map.addListener('dragend', (event) => { - this.zone.run(() => { - this.onMapDragEnd.emit(event); - }); - }); - - this.map.addListener('zoom_changed', (event) => { - this.zone.run(() => { - this.onZoomChanged.emit(event); - }); - }); - } - - bindOverlayEvents(overlay: any) { - overlay.addListener('click', (event) => { - this.zone.run(() => { - this.onOverlayClick.emit({ - originalEvent: event, - 'overlay': overlay, - map: this.map - }); - }); - }); - - if(overlay.getDraggable()) { - this.bindDragEvents(overlay); - } - } - - ngDoCheck() { - let changes = this.differ.diff(this.overlays); - - if(changes && this.map) { - changes.forEachRemovedItem((record) => {record.item.setMap(null)}); - changes.forEachAddedItem((record) => { - record.item.setMap(this.map); - record.item.addListener('click', (event) => { - this.zone.run(() => { - this.onOverlayClick.emit({ - originalEvent: event, - overlay: record.item, - map: this.map - }); - }); - }); - - if(record.item.getDraggable()) { - this.bindDragEvents(record.item); - } - }); - } - } - - bindDragEvents(overlay) { - overlay.addListener('dragstart', (event) => { - this.zone.run(() => { - this.onOverlayDragStart.emit({ - originalEvent: event, - overlay: overlay, - map: this.map - }); - }); - }); - - overlay.addListener('drag', (event) => { - this.zone.run(() => { - this.onOverlayDrag.emit({ - originalEvent: event, - overlay: overlay, - map: this.map - }); - }); - }); - - overlay.addListener('dragend', (event) => { - this.zone.run(() => { - this.onOverlayDragEnd.emit({ - originalEvent: event, - overlay: overlay, - map: this.map - }); - }); - - }); - } - - getMap() { - return this.map; - } -} - -@NgModule({ - imports: [CommonModule], - exports: [GMap], - declarations: [GMap] -}) -export class GMapModule { } \ No newline at end of file diff --git a/dashboard/src/app/components/grid/grid.css b/dashboard/src/app/components/grid/grid.css deleted file mode 100644 index 3771df8cc..000000000 --- a/dashboard/src/app/components/grid/grid.css +++ /dev/null @@ -1,774 +0,0 @@ -/* Deprecated Grid CSS */ -.ui-grid { - clear: both; - padding: 0; - margin: 0; -} - -.ui-grid::before, -.ui-grid::after { - content:""; - display:table; -} - -.ui-grid::after { - clear:both; -} - -.ui-grid .ui-grid-row { - display: -webkit-box; - display: -moz-box; - display: -ms-flexbox; - display: -webkit-flex; - display: flex; - clear:both; -} - -.ui-grid-row::after { - clear: both; - content: ""; - display: table; -} - -.ui-grid-col-1, -.ui-grid-col-2, -.ui-grid-col-3, -.ui-grid-col-4, -.ui-grid-col-5, -.ui-grid-col-6, -.ui-grid-col-7, -.ui-grid-col-8, -.ui-grid-col-9, -.ui-grid-col-10, -.ui-grid-col-11, -.ui-grid-col-12 { - float: left; - box-sizing: border-box; -} - -.ui-grid-col-1 { - width: 8.33333%; -} - -.ui-grid-col-2 { - width: 16.66666%; -} - -.ui-grid-col-3 { - width: 25%; -} - -.ui-grid-col-4 { - width: 33.33333%; -} - -.ui-grid-col-5 { - width: 41.66666%; -} - -.ui-grid-col-6 { - width: 50%; -} - -.ui-grid-col-7 { - width: 58.33333%; -} - -.ui-grid-col-8 { - width: 66.66666%; -} - -.ui-grid-col-9 { - width: 75%; -} - -.ui-grid-col-10 { - width: 83.33333%; -} - -.ui-grid-col-11 { - width: 91.66666%; -} - -.ui-grid-col-12 { - width: 100%; -} - -@media (min-width: 480px) { - .ui-grid-fixed { - width: 480px; - } -} - -@media (min-width: 768px) { - .ui-grid-fixed { - width: 768px; - } -} - -@media (min-width: 960px) { - .ui-grid-fixed { - width: 960px; - } -} - -@media (min-width: 1024px) { - .ui-grid-fixed { - width: 1024px; - } -} - -/* Responsive */ -@media (max-width: 640px) { - .ui-grid-responsive .ui-grid-row { - display: block; - } - - .ui-grid-responsive .ui-grid-col-1, - .ui-grid-responsive .ui-grid-col-2, - .ui-grid-responsive .ui-grid-col-3, - .ui-grid-responsive .ui-grid-col-4, - .ui-grid-responsive .ui-grid-col-5, - .ui-grid-responsive .ui-grid-col-6, - .ui-grid-responsive .ui-grid-col-7, - .ui-grid-responsive .ui-grid-col-8, - .ui-grid-responsive .ui-grid-col-9, - .ui-grid-responsive .ui-grid-col-10, - .ui-grid-responsive .ui-grid-col-11, - .ui-grid-responsive .ui-grid-col-12 { - width: 100%; - float: none; - } -} - -.ui-grid.ui-grid-pad > .ui-grid-row > div { - padding: .25em .5em; -} - -/* Responsive */ -@media (max-width: 640px) { - .ui-grid-responsive .ui-grid-row { - display: block; - } - - .ui-grid-responsive .ui-grid-col-1, - .ui-grid-responsive .ui-grid-col-2, - .ui-grid-responsive .ui-grid-col-3, - .ui-grid-responsive .ui-grid-col-4, - .ui-grid-responsive .ui-grid-col-5, - .ui-grid-responsive .ui-grid-col-6, - .ui-grid-responsive .ui-grid-col-7, - .ui-grid-responsive .ui-grid-col-8, - .ui-grid-responsive .ui-grid-col-9, - .ui-grid-responsive .ui-grid-col-10, - .ui-grid-responsive .ui-grid-col-11, - .ui-grid-responsive .ui-grid-col-12 { - width: 100%; - float: none; - } -} - -/* New Grid CSS */ -.ui-g { - display: -webkit-box; - display: -moz-box; - display: -ms-flexbox; - display: -webkit-flex; - display: flex; - flex-wrap: wrap; -} - -.ui-g::after { - clear: both; - content: ""; - display: table; -} - -.ui-g-1, -.ui-g-2, -.ui-g-3, -.ui-g-4, -.ui-g-5, -.ui-g-6, -.ui-g-7, -.ui-g-8, -.ui-g-9, -.ui-g-10, -.ui-g-11, -.ui-g-12 { - float: left; - box-sizing: border-box; - padding: 0.5em; -} - -.ui-g-1 { - width: 8.3333%; -} - -.ui-g-2 { - width: 16.6667%; -} - -.ui-g-3 { - width: 25%; -} - -.ui-g-4 { - width: 33.3333%; -} - -.ui-g-5 { - width: 41.6667%; -} - -.ui-g-6 { - width: 50%; -} - -.ui-g-7 { - width: 58.3333%; -} - -.ui-g-8 { - width: 66.6667%; -} - -.ui-g-9 { - width: 75%; -} - -.ui-g-10 { - width: 83.3333%; -} - -.ui-g-11 { - width: 91.6667%; -} - -.ui-g-12 { - width: 100%; -} - -.ui-g-offset-12 { - margin-left: 100%; -} - -.ui-g-offset-11 { - margin-left: 91.66666667%; -} - -.ui-g-offset-10 { - margin-left: 83.33333333%; -} - -.ui-g-offset-9 { - margin-left: 75%; -} - -.ui-g-offset-8 { - margin-left: 66.66666667%; -} - -.ui-g-offset-7 { - margin-left: 58.33333333%; -} - -.ui-g-offset-6 { - margin-left: 50%; -} - -.ui-g-offset-5 { - margin-left: 41.66666667%; -} - -.ui-g-offset-4 { - margin-left: 33.33333333%; -} - -.ui-g-offset-3 { - margin-left: 25%; -} - -.ui-g-offset-2 { - margin-left: 16.66666667%; -} - -.ui-g-offset-1 { - margin-left: 8.33333333%; -} - -.ui-g-offset-0 { - margin-left: 0%; -} - -@media screen and (max-width: 40em) { - .ui-sm-1, - .ui-sm-2, - .ui-sm-3, - .ui-sm-4, - .ui-sm-5, - .ui-sm-6, - .ui-sm-7, - .ui-sm-8, - .ui-sm-9, - .ui-sm-10, - .ui-sm-11, - .ui-sm-12 { - padding: 0.5em; - } - - .ui-sm-1 { - width: 8.3333%; - } - - .ui-sm-2 { - width: 16.6667%; - } - - .ui-sm-3 { - width: 25%; - } - - .ui-sm-4 { - width: 33.3333%; - } - - .ui-sm-5 { - width: 41.6667%; - } - - .ui-sm-6 { - width: 50%; - } - - .ui-sm-7 { - width: 58.3333%; - } - - .ui-sm-8 { - width: 66.6667%; - } - - .ui-sm-9 { - width: 75%; - } - - .ui-sm-10 { - width: 83.3333%; - } - - .ui-sm-11 { - width: 91.6667%; - } - - .ui-sm-12 { - width: 100%; - } - - .ui-sm-offset-12 { - margin-left: 100%; - } - - .ui-sm-offset-11 { - margin-left: 91.66666667%; - } - - .ui-sm-offset-10 { - margin-left: 83.33333333%; - } - - .ui-sm-offset-9 { - margin-left: 75%; - } - - .ui-sm-offset-8 { - margin-left: 66.66666667%; - } - - .ui-sm-offset-7 { - margin-left: 58.33333333%; - } - - .ui-sm-offset-6 { - margin-left: 50%; - } - - .ui-sm-offset-5 { - margin-left: 41.66666667%; - } - - .ui-sm-offset-4 { - margin-left: 33.33333333%; - } - - .ui-sm-offset-3 { - margin-left: 25%; - } - - .ui-sm-offset-2 { - margin-left: 16.66666667%; - } - - .ui-sm-offset-1 { - margin-left: 8.33333333%; - } - - .ui-sm-offset-0 { - margin-left: 0%; - } -} - -@media screen and (min-width: 40.063em) { - .ui-md-1, - .ui-md-2, - .ui-md-3, - .ui-md-4, - .ui-md-5, - .ui-md-6, - .ui-md-7, - .ui-md-8, - .ui-md-9, - .ui-md-10, - .ui-md-11, - .ui-md-12 { - padding: 0.5em; - } - - .ui-md-1 { - width: 8.3333%; - } - - .ui-md-2 { - width: 16.6667%; - } - - .ui-md-3 { - width: 25%; - } - - .ui-md-4 { - width: 33.3333%; - } - - .ui-md-5 { - width: 41.6667%; - } - - .ui-md-6 { - width: 50%; - } - - .ui-md-7 { - width: 58.3333%; - } - - .ui-md-8 { - width: 66.6667%; - } - - .ui-md-9 { - width: 75%; - } - - .ui-md-10 { - width: 83.3333%; - } - - .ui-md-11 { - width: 91.6667%; - } - - .ui-md-12 { - width: 100%; - } - - .ui-md-offset-12 { - margin-left: 100%; - } - - .ui-md-offset-11 { - margin-left: 91.66666667%; - } - - .ui-md-offset-10 { - margin-left: 83.33333333%; - } - - .ui-md-offset-9 { - margin-left: 75%; - } - - .ui-md-offset-8 { - margin-left: 66.66666667%; - } - - .ui-md-offset-7 { - margin-left: 58.33333333%; - } - - .ui-md-offset-6 { - margin-left: 50%; - } - - .ui-md-offset-5 { - margin-left: 41.66666667%; - } - - .ui-md-offset-4 { - margin-left: 33.33333333%; - } - - .ui-md-offset-3 { - margin-left: 25%; - } - - .ui-md-offset-2 { - margin-left: 16.66666667%; - } - - .ui-md-offset-1 { - margin-left: 8.33333333%; - } - - .ui-md-offset-0 { - margin-left: 0%; - } -} - -@media screen and (min-width: 64.063em) { - .ui-lg-1, - .ui-lg-2, - .ui-lg-3, - .ui-lg-4, - .ui-lg-5, - .ui-lg-6, - .ui-lg-7, - .ui-lg-8, - .ui-lg-9, - .ui-lg-10, - .ui-lg-11, - .ui-lg-12 { - padding: 0.5em; - } - - .ui-lg-1 { - width: 8.3333%; - } - - .ui-lg-2 { - width: 16.6667%; - } - - .ui-lg-3 { - width: 25%; - } - - .ui-lg-4 { - width: 33.3333%; - } - - .ui-lg-5 { - width: 41.6667%; - } - - .ui-lg-6 { - width: 50%; - } - - .ui-lg-7 { - width: 58.3333%; - } - - .ui-lg-8 { - width: 66.6667%; - } - - .ui-lg-9 { - width: 75%; - } - - .ui-lg-10 { - width: 83.3333%; - } - - .ui-lg-11 { - width: 91.6667%; - } - - .ui-lg-12 { - width: 100%; - } - - .ui-lg-offset-12 { - margin-left: 100%; - } - - .ui-lg-offset-11 { - margin-left: 91.66666667%; - } - - .ui-lg-offset-10 { - margin-left: 83.33333333%; - } - - .ui-lg-offset-9 { - margin-left: 75%; - } - - .ui-lg-offset-8 { - margin-left: 66.66666667%; - } - - .ui-lg-offset-7 { - margin-left: 58.33333333%; - } - - .ui-lg-offset-6 { - margin-left: 50%; - } - - .ui-lg-offset-5 { - margin-left: 41.66666667%; - } - - .ui-lg-offset-4 { - margin-left: 33.33333333%; - } - - .ui-lg-offset-3 { - margin-left: 25%; - } - - .ui-lg-offset-2 { - margin-left: 16.66666667%; - } - - .ui-lg-offset-1 { - margin-left: 8.33333333%; - } - - .ui-lg-offset-0 { - margin-left: 0%; - } -} - -@media screen and (min-width: 90.063em) { - .ui-xl-1, - .ui-xl-2, - .ui-xl-3, - .ui-xl-4, - .ui-xl-5, - .ui-xl-6, - .ui-xl-7, - .ui-xl-8, - .ui-xl-9, - .ui-xl-10, - .ui-xl-11, - .ui-xl-12 { - padding: 0.5em; - } - - .ui-xl-1 { - width: 8.3333%; - } - - .ui-xl-2 { - width: 16.6667%; - } - - .ui-xl-3 { - width: 25%; - } - - .ui-xl-4 { - width: 33.3333%; - } - - .ui-xl-5 { - width: 41.6667%; - } - - .ui-xl-6 { - width: 50%; - } - - .ui-xl-7 { - width: 58.3333%; - } - - .ui-xl-8 { - width: 66.6667%; - } - - .ui-xl-9 { - width: 75%; - } - - .ui-xl-10 { - width: 83.3333%; - } - - .ui-xl-11 { - width: 91.6667%; - } - - .ui-xl-12 { - width: 100%; - } - - .ui-xl-offset-12 { - margin-left: 100%; - } - - .ui-xl-offset-11 { - margin-left: 91.66666667%; - } - - .ui-xl-offset-10 { - margin-left: 83.33333333%; - } - - .ui-xl-offset-9 { - margin-left: 75%; - } - - .ui-xl-offset-8 { - margin-left: 66.66666667%; - } - - .ui-xl-offset-7 { - margin-left: 58.33333333%; - } - - .ui-xl-offset-6 { - margin-left: 50%; - } - - .ui-xl-offset-5 { - margin-left: 41.66666667%; - } - - .ui-xl-offset-4 { - margin-left: 33.33333333%; - } - - .ui-xl-offset-3 { - margin-left: 25%; - } - - .ui-xl-offset-2 { - margin-left: 16.66666667%; - } - - .ui-xl-offset-1 { - margin-left: 8.33333333%; - } - - .ui-xl-offset-0 { - margin-left: 0%; - } -} - -.ui-g-nopad { - padding: 0; -} diff --git a/dashboard/src/app/components/growl/growl.css b/dashboard/src/app/components/growl/growl.css deleted file mode 100644 index 228b722bd..000000000 --- a/dashboard/src/app/components/growl/growl.css +++ /dev/null @@ -1,54 +0,0 @@ -.ui-growl { - position:fixed; - top: 20px; - right: 20px; - width: 20em; -} - -.ui-growl-item-container { - position:relative; - margin:0 0 10px 0; - opacity:0.95; - filter:alpha(opacity=95); -} - -.ui-growl-item { - position: relative; - display: block; - padding: .5em 1em; -} - -.ui-growl-item p { - padding: 0; - margin: 0; -} - -.ui-growl-icon-close { - position: absolute; - top: 4px; - right: 4px; - cursor: pointer; -} - -.ui-growl-title { - font-weight: bold; - padding: 0 0 .5em 0; - display: block; -} - -.ui-growl-image { - position: absolute; - display: inline-block; - left: .5em; - top: .25em; - padding: 0; -} - -.ui-growl-message { - padding: 0 0 .25em 0; - margin-left: 2.5em; -} - -.ui-growl-message p { - font-weight: normal; -} \ No newline at end of file diff --git a/dashboard/src/app/components/growl/growl.spec.ts b/dashboard/src/app/components/growl/growl.spec.ts deleted file mode 100644 index 801a68b76..000000000 --- a/dashboard/src/app/components/growl/growl.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { Growl } from './growl'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('Growl', () => { - - let growl: Growl; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - Growl - ] - }); - - fixture = TestBed.createComponent(Growl); - growl = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/growl/growl.ts b/dashboard/src/app/components/growl/growl.ts deleted file mode 100644 index 7b835656f..000000000 --- a/dashboard/src/app/components/growl/growl.ts +++ /dev/null @@ -1,218 +0,0 @@ -import {NgModule,Component,ElementRef,AfterViewInit,DoCheck,OnDestroy,Input,Output,ViewChild,EventEmitter,IterableDiffers,Optional} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {Message} from '../common/message'; -import {DomHandler} from '../dom/domhandler'; -import {MessageService} from '../common/messageservice'; -import {Subscription} from 'rxjs/Subscription'; - -@Component({ - selector: 'p-growl', - template: ` -
-
-
-
- -
- {{msg.summary}} -

-
-
-
-
-
- `, - providers: [DomHandler] -}) -export class Growl implements AfterViewInit,DoCheck,OnDestroy { - - @Input() life: number = 3000; - - @Input() style: any; - - @Input() styleClass: string; - - @Input() immutable: boolean = true; - - @Input() autoZIndex: boolean = true; - - @Input() baseZIndex: number = 0; - - @Input() key: string; - - @Output() onClick: EventEmitter = new EventEmitter(); - - @Output() onHover: EventEmitter = new EventEmitter(); - - @Output() onClose: EventEmitter = new EventEmitter(); - - @Output() valueChange: EventEmitter = new EventEmitter(); - - @ViewChild('container') containerViewChild: ElementRef; - - _sticky: boolean; - - _value: Message[]; - - timeout: any; - - preventRerender: boolean; - - differ: any; - - subscription: Subscription; - - closeIconClick: boolean; - - constructor(public el: ElementRef, public domHandler: DomHandler, public differs: IterableDiffers, @Optional() public messageService: MessageService) { - this.differ = differs.find([]).create(null); - - if(messageService) { - this.subscription = messageService.messageObserver.subscribe(messages => { - if(messages) { - if(messages instanceof Array) { - let filteredMessages = messages.filter(m => this.key === m.key); - this.value = this.value ? [...this.value, ...filteredMessages] : [...filteredMessages]; - } - else if (this.key === messages.key) { - this.value = this.value ? [...this.value, ...[messages]] : [messages]; - } - } - else { - this.value = null; - } - }); - } - } - - ngAfterViewInit() { - if(!this.sticky) { - this.initTimeout(); - } - } - - @Input() get value(): Message[] { - return this._value; - } - - set value(val:Message[]) { - this._value = val; - if(this.containerViewChild && this.containerViewChild.nativeElement && this.immutable) { - this.handleValueChange(); - } - } - - @Input() get sticky(): boolean { - return this._sticky; - } - - set sticky(value: boolean) { - if(value && this.timeout) { - clearTimeout(this.timeout); - } - this._sticky = value; - } - - ngDoCheck() { - if(!this.immutable && this.containerViewChild && this.containerViewChild.nativeElement) { - let changes = this.differ.diff(this.value); - if(changes) { - this.handleValueChange(); - } - } - } - - handleValueChange() { - if(this.preventRerender) { - this.preventRerender = false; - return; - } - - if(this.autoZIndex) { - this.containerViewChild.nativeElement.style.zIndex = String(this.baseZIndex + (++DomHandler.zindex)); - } - this.domHandler.fadeIn(this.containerViewChild.nativeElement, 250); - - if(!this.sticky) { - this.initTimeout(); - } - } - - initTimeout() { - if(this.timeout) { - clearTimeout(this.timeout); - } - this.timeout = setTimeout(() => { - this.removeAll(); - }, this.life); - } - - remove(index: number, msgel: any) { - this.closeIconClick = true; - this.domHandler.fadeOut(msgel, 250); - - setTimeout(() => { - this.preventRerender = true; - this.onClose.emit({message:this.value[index]}); - - if(this.immutable) { - this._value = this.value.filter((val,i) => i!=index); - this.valueChange.emit(this._value); - } - else { - this._value.splice(index, 1); - } - }, 250); - } - - removeAll() { - if(this.value && this.value.length) { - this.domHandler.fadeOut(this.containerViewChild.nativeElement, 250); - - setTimeout(() => { - this.value.forEach((msg,index) => this.onClose.emit({message:this.value[index]})); - if(this.immutable) { - this.value = []; - this.valueChange.emit(this.value); - } - else { - this.value.splice(0, this.value.length); - } - }, 250); - } - } - - onMessageClick(i: number) { - if(this.closeIconClick) - this.closeIconClick = false; - else - this.onClick.emit({message: this.value[i]}); - } - - onMessageHover(i: number) { - this.onHover.emit({message: this.value[i]}); - } - - ngOnDestroy() { - if(!this.sticky) { - clearTimeout(this.timeout); - } - - if(this.subscription) { - this.subscription.unsubscribe(); - } - } - -} - -@NgModule({ - imports: [CommonModule], - exports: [Growl], - declarations: [Growl] -}) -export class GrowlModule { } \ No newline at end of file diff --git a/dashboard/src/app/components/inplace/inplace.css b/dashboard/src/app/components/inplace/inplace.css deleted file mode 100644 index 05ed40149..000000000 --- a/dashboard/src/app/components/inplace/inplace.css +++ /dev/null @@ -1,11 +0,0 @@ -.ui-inplace .ui-inplace-display { - display: inline; - cursor: pointer; - border: 0 none; - padding: .25em; - font-weight: normal; -} - -.ui-inplace .ui-inplace-content { - display: inline; -} \ No newline at end of file diff --git a/dashboard/src/app/components/inplace/inplace.spec.ts b/dashboard/src/app/components/inplace/inplace.spec.ts deleted file mode 100644 index c39a2d9fa..000000000 --- a/dashboard/src/app/components/inplace/inplace.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { Inplace } from './inplace'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('Inplace', () => { - - let inplace: Inplace; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - Inplace - ] - }); - - fixture = TestBed.createComponent(Inplace); - inplace = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/inplace/inplace.ts b/dashboard/src/app/components/inplace/inplace.ts deleted file mode 100644 index 8270f3e18..000000000 --- a/dashboard/src/app/components/inplace/inplace.ts +++ /dev/null @@ -1,71 +0,0 @@ -import {NgModule,Component,Input,Output,EventEmitter} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {ButtonModule} from '../button/button'; - -@Component({ - selector: 'p-inplaceDisplay', - template: '' -}) -export class InplaceDisplay {} - -@Component({ - selector: 'p-inplaceContent', - template: '' -}) -export class InplaceContent {} - -@Component({ - selector: 'p-inplace', - template: ` -
-
- -
-
- - -
-
- ` -}) -export class Inplace { - - @Input() active: boolean; - - @Input() closable: boolean; - - @Input() disabled: boolean; - - @Input() style: any; - - @Input() styleClass: string; - - @Output() onActivate: EventEmitter = new EventEmitter(); - - @Output() onDeactivate: EventEmitter = new EventEmitter(); - - hover: boolean; - - activate(event) { - if(!this.disabled) { - this.active = true; - this.onActivate.emit(event); - } - } - - deactivate(event) { - if(!this.disabled) { - this.active = false; - this.hover = false; - this.onDeactivate.emit(event); - } - } -} - -@NgModule({ - imports: [CommonModule,ButtonModule], - exports: [Inplace,InplaceDisplay,InplaceContent,ButtonModule], - declarations: [Inplace,InplaceDisplay,InplaceContent] -}) -export class InplaceModule { } \ No newline at end of file diff --git a/dashboard/src/app/components/inputmask/inputmask.spec.ts b/dashboard/src/app/components/inputmask/inputmask.spec.ts deleted file mode 100644 index c7c9c8901..000000000 --- a/dashboard/src/app/components/inputmask/inputmask.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { InputMask } from './inputmask'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('InputMask', () => { - - let inputmask: InputMask; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - InputMask - ] - }); - - fixture = TestBed.createComponent(InputMask); - inputmask = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/inputmask/inputmask.ts b/dashboard/src/app/components/inputmask/inputmask.ts deleted file mode 100644 index e3e474087..000000000 --- a/dashboard/src/app/components/inputmask/inputmask.ts +++ /dev/null @@ -1,620 +0,0 @@ -/* - Port of jQuery MaskedInput by DigitalBush as a Native Angular2 Component in Typescript without jQuery - https://github.com/digitalBush/jquery.maskedinput/ - - Copyright (c) 2007-2014 Josh Bush (digitalbush.com) - - Permission is hereby granted, free of charge, to any person - obtaining a copy of this software and associated documentation - files (the "Software"), to deal in the Software without - restriction, including without limitation the rights to use, - copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the - Software is furnished to do so, subject to the following - conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. -*/ -import {NgModule,Component,ElementRef,OnInit,OnDestroy,HostBinding,HostListener,Input,forwardRef,Output,EventEmitter,ViewChild} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {DomHandler} from '../dom/domhandler'; -import {InputTextModule} from '../inputtext/inputtext'; -import {NG_VALUE_ACCESSOR, ControlValueAccessor} from '@angular/forms'; - -export const INPUTMASK_VALUE_ACCESSOR: any = { - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => InputMask), - multi: true -}; - -@Component({ - selector: 'p-inputMask', - template: ``, - host: { - '[class.ui-inputwrapper-filled]': 'filled', - '[class.ui-inputwrapper-focus]': 'focus' - }, - providers: [INPUTMASK_VALUE_ACCESSOR,DomHandler] -}) -export class InputMask implements OnInit,OnDestroy,ControlValueAccessor { - - @Input() type: string = 'text'; - - @Input() slotChar: string = '_'; - - @Input() autoClear: boolean = true; - - @Input() style: string; - - @Input() inputId: string; - - @Input() styleClass: string; - - @Input() placeholder: string; - - @Input() size: number; - - @Input() maxlength: number; - - @Input() tabindex: string; - - @Input() disabled: boolean; - - @Input() readonly: boolean; - - @Input() unmask: boolean; - - @Input() name: string; - - @Input() required: boolean; - - @Input() characterPattern: string = '[A-Za-z]'; - - @ViewChild('input') inputViewChild: ElementRef; - - @Output() onComplete: EventEmitter = new EventEmitter(); - - @Output() onFocus: EventEmitter = new EventEmitter(); - - @Output() onBlur: EventEmitter = new EventEmitter(); - - value: any; - - _mask: string; - - onModelChange: Function = () => {}; - - onModelTouched: Function = () => {}; - - input: HTMLInputElement; - - filled: boolean; - - defs: any; - - tests: any[]; - - partialPosition: any; - - firstNonMaskPos: number; - - lastRequiredNonMaskPos: any; - - len: number; - - oldVal: string; - - buffer: any; - - defaultBuffer: string; - - focusText: string; - - caretTimeoutId: any; - - androidChrome: boolean; - - focus: boolean; - - constructor(public el: ElementRef, public domHandler: DomHandler) {} - - ngOnInit() { - let ua = this.domHandler.getUserAgent(); - this.androidChrome = /chrome/i.test(ua) && /android/i.test(ua); - - this.initMask(); - } - - @Input() get mask(): string { - return this._mask; - } - - set mask(val:string) { - this._mask = val; - - this.initMask(); - this.writeValue(''); - this.onModelChange(this.value); - } - - initMask() { - this.tests = []; - this.partialPosition = this.mask.length; - this.len = this.mask.length; - this.firstNonMaskPos = null; - this.defs = { - '9': '[0-9]', - 'a': this.characterPattern, - '*': `${this.characterPattern}|[0-9]` - }; - - let maskTokens = this.mask.split(''); - for(let i = 0; i < maskTokens.length; i++) { - let c = maskTokens[i]; - if (c == '?') { - this.len--; - this.partialPosition = i; - } - else if (this.defs[c]) { - this.tests.push(new RegExp(this.defs[c])); - if(this.firstNonMaskPos === null) { - this.firstNonMaskPos = this.tests.length - 1; - } - if(i < this.partialPosition){ - this.lastRequiredNonMaskPos = this.tests.length - 1; - } - } - else { - this.tests.push(null); - } - } - - this.buffer = []; - for(let i = 0; i < maskTokens.length; i++) { - let c = maskTokens[i]; - if(c != '?') { - if(this.defs[c]) - this.buffer.push(this.getPlaceholder(i)); - else - this.buffer.push(c); - } - } - this.defaultBuffer = this.buffer.join(''); - } - - writeValue(value: any) : void { - this.value = value; - - if(this.inputViewChild.nativeElement) { - if(this.value == undefined || this.value == null) - this.inputViewChild.nativeElement.value = ''; - else - this.inputViewChild.nativeElement.value = this.value; - - this.checkVal(); - this.focusText = this.inputViewChild.nativeElement.value; - this.updateFilledState(); - } - } - - registerOnChange(fn: Function): void { - this.onModelChange = fn; - } - - registerOnTouched(fn: Function): void { - this.onModelTouched = fn; - } - - setDisabledState(val: boolean): void { - this.disabled = val; - } - - caret(first?: number, last?: number) { - let range, begin, end; - - if(!this.inputViewChild.nativeElement.offsetParent||this.inputViewChild.nativeElement !== document.activeElement) { - return; - } - - if(typeof first == 'number') { - begin = first; - end = (typeof last === 'number') ? last : begin; - if(this.inputViewChild.nativeElement.setSelectionRange) { - this.inputViewChild.nativeElement.setSelectionRange(begin, end); - } - else if(this.inputViewChild.nativeElement['createTextRange']) { - range = this.inputViewChild.nativeElement['createTextRange'](); - range.collapse(true); - range.moveEnd('character', end); - range.moveStart('character', begin); - range.select(); - } - } - else { - if (this.inputViewChild.nativeElement.setSelectionRange) { - begin = this.inputViewChild.nativeElement.selectionStart; - end = this.inputViewChild.nativeElement.selectionEnd; - } - else if (document['selection'] && document['selection'].createRange) { - range = document['selection'].createRange(); - begin = 0 - range.duplicate().moveStart('character', -100000); - end = begin + range.text.length; - } - - return {begin: begin, end: end}; - } - } - - isCompleted(): boolean { - let completed: boolean; - for (let i = this.firstNonMaskPos; i <= this.lastRequiredNonMaskPos; i++) { - if (this.tests[i] && this.buffer[i] === this.getPlaceholder(i)) { - return false; - } - } - - return true; - } - - getPlaceholder(i: number) { - if(i < this.slotChar.length) { - return this.slotChar.charAt(i); - } - return this.slotChar.charAt(0); - } - - seekNext(pos) { - while (++pos < this.len && !this.tests[pos]); - return pos; - } - - seekPrev(pos) { - while (--pos >= 0 && !this.tests[pos]); - return pos; - } - - shiftL(begin:number,end:number) { - let i, j; - - if (begin<0) { - return; - } - - for (i = begin, j = this.seekNext(end); i < this.len; i++) { - if (this.tests[i]) { - if (j < this.len && this.tests[i].test(this.buffer[j])) { - this.buffer[i] = this.buffer[j]; - this.buffer[j] = this.getPlaceholder(j); - } else { - break; - } - - j = this.seekNext(j); - } - } - this.writeBuffer(); - this.caret(Math.max(this.firstNonMaskPos, begin)); - } - - shiftR(pos) { - let i, c, j, t; - - for (i = pos, c = this.getPlaceholder(pos); i < this.len; i++) { - if (this.tests[i]) { - j = this.seekNext(i); - t = this.buffer[i]; - this.buffer[i] = c; - if (j < this.len && this.tests[j].test(t)) { - c = t; - } else { - break; - } - } - } - } - - handleAndroidInput(e) { - var curVal = this.inputViewChild.nativeElement.value; - var pos = this.caret(); - if (this.oldVal && this.oldVal.length && this.oldVal.length > curVal.length ) { - // a deletion or backspace happened - this.checkVal(true); - while (pos.begin > 0 && !this.tests[pos.begin-1]) - pos.begin--; - if (pos.begin === 0) - { - while (pos.begin < this.firstNonMaskPos && !this.tests[pos.begin]) - pos.begin++; - } - this.caret(pos.begin,pos.begin); - } else { - this.checkVal(true); - const newPos = this.seekNext(pos.begin); - - setTimeout(() => this.caret(newPos, newPos)); - } - - setTimeout(() => { - this.updateModel(e); - if (this.isCompleted()) { - this.onComplete.emit(); - } - }, 0); - } - - onInputBlur(e) { - this.focus = false; - this.onModelTouched(); - this.checkVal(); - this.updateModel(e); - this.updateFilledState(); - this.onBlur.emit(e); - - if (this.inputViewChild.nativeElement.value != this.focusText) { - let event = document.createEvent('HTMLEvents'); - event.initEvent('change', true, false); - this.inputViewChild.nativeElement.dispatchEvent(event); - } - } - - onKeyDown(e) { - if (this.readonly) { - return; - } - - let k = e.which||e.keyCode, - pos, - begin, - end; - let iPhone = /iphone/i.test(this.domHandler.getUserAgent()); - this.oldVal = this.inputViewChild.nativeElement.value; - - //backspace, delete, and escape get special treatment - if (k === 8 || k === 46 || (iPhone && k === 127)) { - pos = this.caret(); - begin = pos.begin; - end = pos.end; - - - if (end - begin === 0) { - begin=k!==46?this.seekPrev(begin):(end=this.seekNext(begin-1)); - end=k===46?this.seekNext(end):end; - } - - this.clearBuffer(begin, end); - this.shiftL(begin, end - 1); - this.updateModel(e); - - e.preventDefault(); - } else if( k === 13 ) { // enter - this.onInputBlur(e); - this.updateModel(e); - } else if (k === 27) { // escape - this.inputViewChild.nativeElement.value = this.focusText; - this.caret(0, this.checkVal()); - this.updateModel(e); - e.preventDefault(); - } - } - - onKeyPress(e) { - if (this.readonly){ - return; - } - - var k = e.which || e.keyCode, - pos = this.caret(), - p, - c, - next, - completed; - - if (e.ctrlKey || e.altKey || e.metaKey || k < 32) {//Ignore - return; - } else if ( k && k !== 13 ) { - if (pos.end - pos.begin !== 0){ - this.clearBuffer(pos.begin, pos.end); - this.shiftL(pos.begin, pos.end-1); - } - - p = this.seekNext(pos.begin - 1); - if (p < this.len) { - c = String.fromCharCode(k); - if (this.tests[p].test(c)) { - this.shiftR(p); - - this.buffer[p] = c; - this.writeBuffer(); - next = this.seekNext(p); - - if(/android/i.test(this.domHandler.getUserAgent())){ - //Path for CSP Violation on FireFox OS 1.1 - let proxy = () => { - this.caret(next); - }; - - setTimeout(proxy,0); - }else{ - this.caret(next); - } - if(pos.begin <= this.lastRequiredNonMaskPos){ - completed = this.isCompleted(); - } - } - } - e.preventDefault(); - } - - this.updateModel(e); - - this.updateFilledState(); - - if(completed) { - this.onComplete.emit(); - } - } - - clearBuffer(start, end) { - let i; - for (i = start; i < end && i < this.len; i++) { - if (this.tests[i]) { - this.buffer[i] = this.getPlaceholder(i); - } - } - } - - writeBuffer() { - this.inputViewChild.nativeElement.value = this.buffer.join(''); - } - - checkVal(allow?: boolean) { - //try to place characters where they belong - let test = this.inputViewChild.nativeElement.value, - lastMatch = -1, - i, - c, - pos; - - for (i = 0, pos = 0; i < this.len; i++) { - if (this.tests[i]) { - this.buffer[i] = this.getPlaceholder(i); - while (pos++ < test.length) { - c = test.charAt(pos - 1); - if (this.tests[i].test(c)) { - this.buffer[i] = c; - lastMatch = i; - break; - } - } - if (pos > test.length) { - this.clearBuffer(i + 1, this.len); - break; - } - } else { - if (this.buffer[i] === test.charAt(pos)) { - pos++; - } - if( i < this.partialPosition){ - lastMatch = i; - } - } - } - if (allow) { - this.writeBuffer(); - } else if (lastMatch + 1 < this.partialPosition) { - if (this.autoClear || this.buffer.join('') === this.defaultBuffer) { - // Invalid value. Remove it and replace it with the - // mask, which is the default behavior. - if(this.inputViewChild.nativeElement.value) this.inputViewChild.nativeElement.value = ''; - this.clearBuffer(0, this.len); - } else { - // Invalid value, but we opt to show the value to the - // user and allow them to correct their mistake. - this.writeBuffer(); - } - } else { - this.writeBuffer(); - this.inputViewChild.nativeElement.value = this.inputViewChild.nativeElement.value.substring(0, lastMatch + 1); - } - return (this.partialPosition ? i : this.firstNonMaskPos); - } - - onInputFocus(event) { - if (this.readonly){ - return; - } - - this.focus = true; - - clearTimeout(this.caretTimeoutId); - let pos; - - this.focusText = this.inputViewChild.nativeElement.value; - - pos = this.checkVal(); - - this.caretTimeoutId = setTimeout(() => { - if(this.inputViewChild.nativeElement !== document.activeElement){ - return; - } - this.writeBuffer(); - if (pos == this.mask.replace("?","").length) { - this.caret(0, pos); - } else { - this.caret(pos); - } - }, 10); - - this.onFocus.emit(event); - } - - onInput(event) { - if (this.androidChrome) - this.handleAndroidInput(event); - else - this.handleInputChange(event); - } - - handleInputChange(event) { - if (this.readonly){ - return; - } - - setTimeout(() => { - var pos = this.checkVal(true); - this.caret(pos); - this.updateModel(event); - if(this.isCompleted()) { - this.onComplete.emit(); - } - }, 0); - } - - getUnmaskedValue() { - let unmaskedBuffer = []; - for(let i = 0; i < this.buffer.length; i++) { - let c = this.buffer[i]; - if(this.tests[i] && c != this.getPlaceholder(i)) { - unmaskedBuffer.push(c); - } - } - - return unmaskedBuffer.join(''); - } - - updateModel(e) { - const updatedValue = this.unmask ? this.getUnmaskedValue() : e.target.value; - if(updatedValue) { - this.value = updatedValue; - this.onModelChange(this.value); - } - } - - updateFilledState() { - this.filled = this.inputViewChild.nativeElement && this.inputViewChild.nativeElement.value != ''; - } - - ngOnDestroy() { - - } -} - -@NgModule({ - imports: [CommonModule,InputTextModule], - exports: [InputMask], - declarations: [InputMask] -}) -export class InputMaskModule { } diff --git a/dashboard/src/app/components/inputswitch/inputswitch.css b/dashboard/src/app/components/inputswitch/inputswitch.css deleted file mode 100644 index da01d4378..000000000 --- a/dashboard/src/app/components/inputswitch/inputswitch.css +++ /dev/null @@ -1,58 +0,0 @@ -.ui-inputswitch { - display: inline-block; - padding: 0; - position: relative; - overflow: hidden; - cursor: pointer; - user-select: none; - -moz-user-select: none; - -khtml-user-select: none; - -webkit-user-select: none; - height: 1.5em; -} - -.ui-inputswitch .ui-inputswitch-on, -.ui-inputswitch .ui-inputswitch-off { - white-space: nowrap; - display: inline-block; - position: absolute; - top: 0; - width: auto; - overflow: hidden; - user-select: none; - -moz-user-select: none; - -khtml-user-select: none; - -webkit-user-select: none; - font-weight: bold; - height: 100%; - line-height: 1.5em; -} - -.ui-inputswitch .ui-inputswitch-on { - left: 0; - border: 0 none; -} - -.ui-inputswitch .ui-inputswitch-off { - right: 0; - text-align: right; -} - -.ui-inputswitch .ui-inputswitch-on span, -.ui-inputswitch .ui-inputswitch-off span { - display: inline-block; - text-align: center; - height: 100%; - line-height: inherit; -} - -.ui-inputswitch .ui-inputswitch-handle { - display: block; - width: 0; - position: absolute; - top: 0; - left: 0; - height: 100%; - border-top: 0 none; - border-bottom: 0 none; -} \ No newline at end of file diff --git a/dashboard/src/app/components/inputswitch/inputswitch.spec.ts b/dashboard/src/app/components/inputswitch/inputswitch.spec.ts deleted file mode 100644 index dfaddf2ce..000000000 --- a/dashboard/src/app/components/inputswitch/inputswitch.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { InputSwitch } from './inputswitch'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('InputSwitch', () => { - - let inputswitch: InputSwitch; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - InputSwitch - ] - }); - - fixture = TestBed.createComponent(InputSwitch); - inputswitch = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/inputswitch/inputswitch.ts b/dashboard/src/app/components/inputswitch/inputswitch.ts deleted file mode 100644 index f1431c5d9..000000000 --- a/dashboard/src/app/components/inputswitch/inputswitch.ts +++ /dev/null @@ -1,215 +0,0 @@ -import {NgModule,Component,ElementRef,AfterViewInit,AfterViewChecked,OnChanges,Input,forwardRef,EventEmitter,Output} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {NG_VALUE_ACCESSOR,ControlValueAccessor} from '@angular/forms'; -import {DomHandler} from '../dom/domhandler'; - -export const INPUTSWITCH_VALUE_ACCESSOR: any = { - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => InputSwitch), - multi: true -}; - -@Component({ - selector: 'p-inputSwitch', - template: ` -
-
- {{offLabel}} -
-
- {{onLabel}} -
-
-
- -
-
- `, - providers: [INPUTSWITCH_VALUE_ACCESSOR,DomHandler] -}) -export class InputSwitch implements ControlValueAccessor,AfterViewInit,AfterViewChecked { - - @Input() onLabel: string = 'On'; - - @Input() offLabel: string = 'Off'; - - @Input() disabled: boolean; - - @Input() style: any; - - @Input() styleClass: string; - - @Input() tabindex: number; - - @Input() inputId: string; - - @Input() ariaLabelTemplate: string = "InputSwitch {0}"; - - @Output() onChange: EventEmitter = new EventEmitter(); - - checked: boolean = false; - - focused: boolean = false; - - onModelChange: Function = () => {}; - - onModelTouched: Function = () => {}; - - public container: any; - - public handle: any; - - public onContainer: any; - - public offContainer: any; - - public onLabelChild: any; - - public offLabelChild: any; - - public offset: any; - - public ariaLabel: string; - - public ariaLabelledBy: string; - - initialized: boolean = false; - - constructor(public el: ElementRef, public domHandler: DomHandler) {} - - ngAfterViewInit() { - this.container = this.el.nativeElement.children[0]; - this.handle = this.domHandler.findSingle(this.el.nativeElement, 'div.ui-inputswitch-handle'); - this.onContainer = this.domHandler.findSingle(this.container,'div.ui-inputswitch-on'); - this.offContainer = this.domHandler.findSingle(this.container,'div.ui-inputswitch-off'); - this.onLabelChild = this.domHandler.findSingle(this.onContainer,'span.ui-inputswitch-onlabel'); - this.offLabelChild = this.domHandler.findSingle(this.offContainer,'span.ui-inputswitch-offlabel'); - } - - ngAfterViewChecked() { - if(this.container && this.container.offsetParent && !this.initialized) { - this.render(); - } - } - - render() { - let onContainerWidth = this.domHandler.width(this.onContainer), - offContainerWidth = this.domHandler.width(this.offContainer), - spanPadding = this.domHandler.innerWidth(this.offLabelChild) - this.domHandler.width(this.offLabelChild), - handleMargins = this.domHandler.getOuterWidth(this.handle) - this.domHandler.innerWidth(this.handle); - - var containerWidth = (onContainerWidth > offContainerWidth) ? onContainerWidth : offContainerWidth, - handleWidth = containerWidth; - - this.handle.style.width = handleWidth + 'px'; - handleWidth = this.domHandler.width(this.handle); - containerWidth = containerWidth + handleWidth + 6; - - var labelWidth = containerWidth - handleWidth - spanPadding - handleMargins; - - this.container.style.width = containerWidth + 'px'; - this.onLabelChild.style.width = labelWidth + 'px'; - this.offLabelChild.style.width = labelWidth + 'px'; - - //position - this.offContainer.style.width = (this.domHandler.width(this.container) - 5) + 'px'; - this.offset = this.domHandler.width(this.container) - this.domHandler.getOuterWidth(this.handle); - - //default value - if(this.checked) { - this.handle.style.left = this.offset + 'px'; - this.onContainer.style.width = this.offset + 'px'; - this.offLabelChild.style.marginRight = -this.offset + 'px'; - } - else { - this.onContainer.style.width = 0 + 'px'; - this.onLabelChild.style.marginLeft = -this.offset + 'px'; - } - - this.initialized = true; - } - - toggle(event,checkbox) { - if(!this.disabled) { - if(this.checked) { - this.checked = false; - this.uncheckUI(); - } - else { - this.checked = true; - this.checkUI(); - } - - this.onModelChange(this.checked); - this.onChange.emit({ - originalEvent: event, - checked: this.checked - }); - checkbox.focus(); - } - } - - checkUI() { - this.onContainer.style.width = this.offset + 'px'; - this.onLabelChild.style.marginLeft = 0 + 'px'; - this.offLabelChild.style.marginRight = -this.offset + 'px'; - this.handle.style.left = this.offset + 'px'; - this.updateAriaLabel(); - } - - uncheckUI() { - this.onContainer.style.width = 0 + 'px'; - this.onLabelChild.style.marginLeft = -this.offset + 'px'; - this.offLabelChild.style.marginRight = 0 + 'px'; - this.handle.style.left = 0 + 'px'; - this.updateAriaLabel(); - } - - onFocus(event) { - this.focused = true; - } - - onBlur(event) { - this.focused = false; - this.onModelTouched(); - } - - writeValue(checked: any) : void { - this.checked = checked; - - if(this.initialized) { - if(this.checked === true) - this.checkUI(); - else - this.uncheckUI(); - } - } - - registerOnChange(fn: Function): void { - this.onModelChange = fn; - } - - registerOnTouched(fn: Function): void { - this.onModelTouched = fn; - } - - setDisabledState(val: boolean): void { - this.disabled = val; - } - - updateAriaLabel() { - let pattern = /{(.*?)}/, - value = this.checked ? this.onLabel : this.offLabel; - - this.ariaLabel = this.ariaLabelTemplate.replace(this.ariaLabelTemplate.match(pattern)[0], value); - } -} - -@NgModule({ - imports: [CommonModule], - exports: [InputSwitch], - declarations: [InputSwitch] -}) -export class InputSwitchModule { } diff --git a/dashboard/src/app/components/inputtext/inputtext.scss b/dashboard/src/app/components/inputtext/inputtext.scss deleted file mode 100644 index 8d33f4df0..000000000 --- a/dashboard/src/app/components/inputtext/inputtext.scss +++ /dev/null @@ -1,112 +0,0 @@ -.ui-inputtext { - margin: 0; - outline: medium none; - font-weight: normal; - padding: .05rem; - min-height: 32px; - min-width: 220px; - @extend .ui-corner-all-small; -} - -.ui-widget-header .ui-inputtext, -.ui-widget-content .ui-inputtext { - font-weight: normal; -} - -.ui-fluid .ui-inputtext { - width: 100%; - min-width: 0; - box-sizing: border-box; - -webkit-box-sizing:border-box; - -moz-box-sizing: border-box; -} - -.ui-inputgroup { - display: -webkit-box; - display: -webkit-flex; - display: flex; -} - -.ui-inputgroup .ui-inputgroup-addon { - display: inline-block; - text-align: center; - min-width: 1.5em; - padding: .25em; - border-width: 1px; - border-style: solid; -} - -.ui-inputgroup .ui-inputgroup-addon + .ui-inputgroup-addon { - border-left: 0 none; -} - -.ui-inputgroup .ui-inputtext { - padding-left: .5em; -} - -.ui-inputgroup .ui-inputtext:not(:first-child) { - border-top-left-radius: 0; - border-bottom-left-radius: 0; - border-left: 0 none; -} - -.ui-inputgroup .ui-inputtext:not(:last-child) { - border-top-right-radius: 0; - border-bottom-right-radius: 0; - border-right: 0 none; -} - -.ui-inputgroup .ui-button { - margin-right: 0; - border-radius: 0; -} - -.ui-fluid .ui-inputgroup .ui-button { - width: auto; -} - -.ui-fluid .ui-inputgroup .ui-inputtext { - -webkit-box-flex: 1; - -webkit-flex: 1 1 auto; - -ms-flex: 1 1 auto; - flex: 1 1 auto; -} - -.ui-inputgroup .ui-chkbox, -.ui-inputgroup .ui-radiobutton { - margin-right: 0; - vertical-align: bottom; -} - -/* Floating Label */ -.ui-float-label { - display: block; - position:relative; -} - -.ui-float-label > label { - font-weight:normal; - position:absolute; - pointer-events:none; - left: .25em; - top: 50%; - margin-top: -.5em; - transition: 0.3s ease all; - -moz-transition: 0.3s ease all; - -webkit-transition: 0.3s ease all; - color: #898989; - line-height: 1; -} - -.ui-float-label > input:focus ~ label, -.ui-float-label > input.ui-state-filled ~ label, -.ui-float-label > .ui-inputwrapper-focus ~ label, -.ui-float-label > .ui-inputwrapper-filled ~ label { - top:-.75em; - font-size:12px; -} - -.ui-float-label > .input:-webkit-autofill ~ label { - top:-20px; - font-size:12px; -} \ No newline at end of file diff --git a/dashboard/src/app/components/inputtext/inputtext.spec.ts b/dashboard/src/app/components/inputtext/inputtext.spec.ts deleted file mode 100644 index 2e0d9836a..000000000 --- a/dashboard/src/app/components/inputtext/inputtext.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { InputText } from './inputtext'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('InputText', () => { - - let inputtext: InputText; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - InputText - ] - }); - - fixture = TestBed.createComponent(InputText); - inputtext = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/inputtext/inputtext.ts b/dashboard/src/app/components/inputtext/inputtext.ts deleted file mode 100644 index b1d670e7e..000000000 --- a/dashboard/src/app/components/inputtext/inputtext.ts +++ /dev/null @@ -1,42 +0,0 @@ -import {NgModule,Directive,ElementRef,HostListener,Input,DoCheck,Optional} from '@angular/core'; -import {NgModel} from '@angular/forms'; -import {CommonModule} from '@angular/common'; - -@Directive({ - selector: '[pInputText]', - host: { - '[class.ui-inputtext]': 'true', - '[class.ui-corner-all]': 'true', - '[class.ui-state-default]': 'true', - '[class.ui-widget]': 'true', - '[class.ui-state-filled]': 'filled' - } -}) -export class InputText implements DoCheck { - - filled: boolean; - - constructor(public el: ElementRef, @Optional() public ngModel: NgModel) {} - - ngDoCheck() { - this.updateFilledState(); - } - - //To trigger change detection to manage ui-state-filled for material labels when there is no value binding - @HostListener('input', ['$event']) - onInput(e) { - this.updateFilledState(); - } - - updateFilledState() { - this.filled = (this.el.nativeElement.value && this.el.nativeElement.value.length) || - (this.ngModel && this.ngModel.model); - } -} - -@NgModule({ - imports: [CommonModule], - exports: [InputText], - declarations: [InputText] -}) -export class InputTextModule { } \ No newline at end of file diff --git a/dashboard/src/app/components/inputtextarea/inputtextarea.css b/dashboard/src/app/components/inputtextarea/inputtextarea.css deleted file mode 100644 index 3b1cb8ccc..000000000 --- a/dashboard/src/app/components/inputtextarea/inputtextarea.css +++ /dev/null @@ -1,15 +0,0 @@ -.ui-inputtextarea-resizable { - overflow: hidden; - resize:none; -} - -.ui-fluid .ui-inputtextarea { - width: 100%; -} - -.ui-float-label textarea:focus ~ label, -.ui-float-label textarea.ui-state-filled ~ label, -.ui-float-label textarea:-webkit-autofill ~ label { - top:-.75em; - font-size:12px; -} \ No newline at end of file diff --git a/dashboard/src/app/components/inputtextarea/inputtextarea.spec.ts b/dashboard/src/app/components/inputtextarea/inputtextarea.spec.ts deleted file mode 100644 index 8cfb5d61a..000000000 --- a/dashboard/src/app/components/inputtextarea/inputtextarea.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { InputTextarea } from './inputtextarea'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('InputTextarea', () => { - - let inputtextarea: InputTextarea; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - InputTextarea - ] - }); - - fixture = TestBed.createComponent(InputTextarea); - inputtextarea = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/inputtextarea/inputtextarea.ts b/dashboard/src/app/components/inputtextarea/inputtextarea.ts deleted file mode 100644 index 8fdb9be7e..000000000 --- a/dashboard/src/app/components/inputtextarea/inputtextarea.ts +++ /dev/null @@ -1,94 +0,0 @@ -import {NgModule,Directive,ElementRef,HostListener,Input,Output,OnInit,DoCheck,EventEmitter,Optional} from '@angular/core'; -import {NgModel} from '@angular/forms'; -import {CommonModule} from '@angular/common'; - -@Directive({ - selector: '[pInputTextarea]', - host: { - '[class.ui-inputtext]': 'true', - '[class.ui-corner-all]': 'true', - '[class.ui-state-default]': 'true', - '[class.ui-widget]': 'true', - '[class.ui-state-filled]': 'filled', - '[attr.rows]': 'rows', - '[attr.cols]': 'cols' - } -}) -export class InputTextarea implements OnInit,DoCheck { - - @Input() autoResize: boolean; - - @Input() rows: number; - - @Input() cols: number; - - @Output() onResize: EventEmitter = new EventEmitter(); - - rowsDefault: number; - - colsDefault: number; - - filled: boolean; - - constructor(public el: ElementRef, @Optional() public ngModel: NgModel) {} - - ngOnInit() { - this.rowsDefault = this.rows; - this.colsDefault = this.cols; - } - - ngDoCheck() { - this.updateFilledState(); - } - - //To trigger change detection to manage ui-state-filled for material labels when there is no value binding - @HostListener('input', ['$event']) - onInput(e) { - this.updateFilledState(); - } - - updateFilledState() { - this.filled = (this.el.nativeElement.value && this.el.nativeElement.value.length) || - (this.ngModel && this.ngModel.model); - } - - @HostListener('focus', ['$event']) - onFocus(e) { - if(this.autoResize) { - this.resize(e); - } - } - - @HostListener('blur', ['$event']) - onBlur(e) { - if(this.autoResize) { - this.resize(e); - } - } - - @HostListener('keyup', ['$event']) - onKeyup(e) { - if(this.autoResize) { - this.resize(e); - } - } - - resize(event?: Event) { - let linesCount = 0, - lines = this.el.nativeElement.value.split('\n'); - - for(let i = lines.length-1; i >= 0 ; --i) { - linesCount += Math.floor((lines[i].length / this.colsDefault) + 1); - } - - this.rows = (linesCount >= this.rowsDefault) ? (linesCount + 1) : this.rowsDefault; - this.onResize.emit(event||{}); - } -} - -@NgModule({ - imports: [CommonModule], - exports: [InputTextarea], - declarations: [InputTextarea] -}) -export class InputTextareaModule { } \ No newline at end of file diff --git a/dashboard/src/app/components/keyfilter/keyfilter.spec.ts b/dashboard/src/app/components/keyfilter/keyfilter.spec.ts deleted file mode 100644 index 512f3b04e..000000000 --- a/dashboard/src/app/components/keyfilter/keyfilter.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { KeyFilter } from './keyfilter'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('KeyFilter', () => { - - let keyfilter: KeyFilter; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - KeyFilter - ] - }); - - fixture = TestBed.createComponent(KeyFilter); - keyfilter = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/keyfilter/keyfilter.ts b/dashboard/src/app/components/keyfilter/keyfilter.ts deleted file mode 100644 index c5e935513..000000000 --- a/dashboard/src/app/components/keyfilter/keyfilter.ts +++ /dev/null @@ -1,140 +0,0 @@ -import { NgModule, Directive, ElementRef, HostBinding, HostListener, Input, forwardRef } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { DomHandler } from '../dom/domhandler'; -import { Validator, AbstractControl, NG_VALIDATORS } from '@angular/forms'; - -export const KEYFILTER_VALIDATOR: any = { - provide: NG_VALIDATORS, - useExisting: forwardRef(() => KeyFilter), - multi: true -}; - -@Directive({ - selector: '[pKeyFilter]', - providers: [DomHandler, KEYFILTER_VALIDATOR] -}) -export class KeyFilter implements Validator { - - static DEFAULT_MASKS = { - pint: /[\d]/, - 'int': /[\d\-]/, - pnum: /[\d\.]/, - money: /[\d\.\s,]/, - num: /[\d\-\.]/, - hex: /[0-9a-f]/i, - email: /[a-z0-9_\.\-@]/i, - alpha: /[a-z_]/i, - alphanum: /[a-z0-9_]/i - }; - - static KEYS = { - TAB: 9, - RETURN: 13, - ESC: 27, - BACKSPACE: 8, - DELETE: 46 - }; - - static SAFARI_KEYS = { - 63234: 37, // left - 63235: 39, // right - 63232: 38, // up - 63233: 40, // down - 63276: 33, // page up - 63277: 34, // page down - 63272: 46, // delete - 63273: 36, // home - 63275: 35 // end - }; - - @Input() pValidateOnly: boolean; - - regex: RegExp; - - _pattern: any; - - constructor(public el: ElementRef, public domHandler: DomHandler) { } - - get pattern(): any { - return this._pattern; - } - - @Input('pKeyFilter') set pattern(_pattern: any) { - this._pattern = _pattern; - this.regex = KeyFilter.DEFAULT_MASKS[this._pattern] || this._pattern; - } - - isNavKeyPress(e: KeyboardEvent) { - let k = e.keyCode; - k = this.domHandler.getBrowser().safari ? (KeyFilter.SAFARI_KEYS[k] || k) : k; - - return (k >= 33 && k <= 40) || k == KeyFilter.KEYS.RETURN || k == KeyFilter.KEYS.TAB || k == KeyFilter.KEYS.ESC; - }; - - isSpecialKey(e: KeyboardEvent) { - let k = e.keyCode; - let c = e.charCode; - - return k == 9 || k == 13 || k == 27 || k == 16 || k == 17 ||(k >= 18 && k <= 20) || - (this.domHandler.getBrowser().opera && !e.shiftKey && (k == 8 || (k >= 33 && k <= 35) || (k >= 36 && k <= 39) || (k >= 44 && k <= 45))); - } - - - getKey(e: KeyboardEvent) { - let k = e.keyCode || e.charCode; - return this.domHandler.getBrowser().safari ? (KeyFilter.SAFARI_KEYS[k] || k) : k; - } - - getCharCode(e: KeyboardEvent) { - return e.charCode || e.keyCode || e.which; - }; - - @HostListener('keypress', ['$event']) - onKeyPress(e: KeyboardEvent) { - if(this.pValidateOnly) { - return; - } - - let browser = this.domHandler.getBrowser(); - - if (e.ctrlKey || e.altKey) { - return; - } - - let k = this.getKey(e); - if (browser.mozilla && (this.isNavKeyPress(e) || k == KeyFilter.KEYS.BACKSPACE || (k == KeyFilter.KEYS.DELETE && e.charCode == 0))) { - return; - } - - let c = this.getCharCode(e); - let cc = String.fromCharCode(c); - let ok = true; - - if (browser.mozilla && (this.isSpecialKey(e) || !cc)) { - return; - } - - ok = this.regex.test(cc); - - if (!ok) { - e.preventDefault(); - } - } - - validate(c: AbstractControl): { [key: string]: any } { - let value = this.el.nativeElement.value; - if (!this.regex.test(value)) { - return { - validatePattern: false - } - } - } - -} - -@NgModule({ - imports: [CommonModule], - exports: [KeyFilter], - declarations: [KeyFilter] -}) -export class KeyFilterModule { } diff --git a/dashboard/src/app/components/lightbox/images/loading.gif b/dashboard/src/app/components/lightbox/images/loading.gif deleted file mode 100644 index 19c67bbd0..000000000 Binary files a/dashboard/src/app/components/lightbox/images/loading.gif and /dev/null differ diff --git a/dashboard/src/app/components/lightbox/lightbox.css b/dashboard/src/app/components/lightbox/lightbox.css deleted file mode 100644 index e74b36fb5..000000000 --- a/dashboard/src/app/components/lightbox/lightbox.css +++ /dev/null @@ -1,61 +0,0 @@ -.ui-lightbox { - position: fixed; - display: none; -} - -.ui-lightbox-content-wrapper { - position: relative; -} - -.ui-lightbox-content { - position: relative; - margin: 0; - padding: 0; - background-color: #000000; -} - -.ui-lightbox-nav-right, .ui-lightbox-nav-left { - position: absolute; - top: 50%; - cursor: pointer; -} - -.ui-lightbox-nav-left { - left: 0; -} - -.ui-lightbox-nav-right { - right: 0; -} - -.ui-lightbox-loading .ui-lightbox-content { - background: url("./images/loading.gif") #000000 center center no-repeat; -} - -.ui-lightbox-caption { - padding: 0.2em 0.4em; - display: none; -} - -.ui-lightbox-caption-text { - margin: 0.3em 0 0.1em 0; - float:left; -} - -.ui-lightbox-close { - float:right; - margin: 0; - padding: .125em; -} - -.ui-lightbox-close.ui-state-hover { - padding: 0; -} - -.ui-lightbox-nav-left, .ui-lightbox-nav-right { - opacity: .5; -} - -.ui-lightbox-nav-left:hover, .ui-lightbox-nav-right:hover{ - opacity: 1; -} \ No newline at end of file diff --git a/dashboard/src/app/components/lightbox/lightbox.spec.ts b/dashboard/src/app/components/lightbox/lightbox.spec.ts deleted file mode 100644 index cdd027e16..000000000 --- a/dashboard/src/app/components/lightbox/lightbox.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { Lightbox } from './lightbox'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('Lightbox', () => { - - let lightbox: Lightbox; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - Lightbox - ] - }); - - fixture = TestBed.createComponent(Lightbox); - lightbox = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/lightbox/lightbox.ts b/dashboard/src/app/components/lightbox/lightbox.ts deleted file mode 100644 index 3cf448a4b..000000000 --- a/dashboard/src/app/components/lightbox/lightbox.ts +++ /dev/null @@ -1,231 +0,0 @@ -import {NgModule,Component,ElementRef,Input,Output,Renderer2,AfterViewInit,OnDestroy} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {DomHandler} from '../dom/domhandler'; - -@Component({ - selector: 'p-lightbox', - template: ` -
- - - -
- - - -
-
- -
- - -
- -
-
- {{captionText}} -
-
-
- `, - providers: [DomHandler] -}) -export class Lightbox implements AfterViewInit,OnDestroy { - - @Input() images: any[]; - - @Input() type: string = 'image'; - - @Input() style: any; - - @Input() styleClass: string; - - @Input() appendTo: any; - - @Input() easing: 'ease-out'; - - @Input() effectDuration: any = '500ms'; - - public visible: boolean; - - public loading: boolean; - - public currentImage: any; - - public captionText: string; - - public zindex: any; - - public panel: any; - - public index: number; - - public mask: any; - - public preventDocumentClickListener: boolean; - - public documentClickListener: any; - - constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer2) {} - - onImageClick(event,image,i,content) { - this.index = i; - this.loading = true; - content.style.width = 32 + 'px'; - content.style.height = 32 + 'px'; - this.show(); - this.displayImage(image); - - this.preventDocumentClickListener = true; - event.preventDefault(); - } - - ngAfterViewInit() { - this.panel = this.domHandler.findSingle(this.el.nativeElement, '.ui-lightbox '); - - if(this.appendTo) { - if(this.appendTo === 'body') - document.body.appendChild(this.panel); - else - this.domHandler.appendChild(this.panel, this.appendTo); - } - - this.documentClickListener = this.renderer.listen('document', 'click', (event) => { - if(!this.preventDocumentClickListener&&this.visible) { - this.hide(event); - } - this.preventDocumentClickListener = false; - }); - } - - onLinkClick(event,content) { - this.show(); - this.preventDocumentClickListener = true; - event.preventDefault(); - } - - displayImage(image) { - setTimeout(() => { - this.currentImage = image; - this.captionText = image.title; - this.center(); - }, 1000); - } - - show() { - this.mask = document.createElement('div'); - this.mask.style.zIndex = ++DomHandler.zindex; - this.domHandler.addMultipleClasses(this.mask, 'ui-widget-overlay ui-dialog-mask'); - document.body.appendChild(this.mask); - - this.zindex = ++DomHandler.zindex; - this.center(); - this.visible = true; - } - - hide(event) { - this.captionText = null; - this.index = null; - this.currentImage = null; - this.visible = false; - this.panel.style.left = 'auto'; - this.panel.style.top = 'auto'; - - if(this.mask) { - document.body.removeChild(this.mask); - this.mask = null; - } - - event.preventDefault(); - } - - center() { - let elementWidth = this.domHandler.getOuterWidth(this.panel); - let elementHeight = this.domHandler.getOuterHeight(this.panel); - if(elementWidth == 0 && elementHeight == 0) { - this.panel.style.visibility = 'hidden'; - this.panel.style.display = 'block'; - elementWidth = this.domHandler.getOuterWidth(this.panel); - elementHeight = this.domHandler.getOuterHeight(this.panel); - this.panel.style.display = 'none'; - this.panel.style.visibility = 'visible'; - } - let viewport = this.domHandler.getViewport(); - let x = (viewport.width - elementWidth) / 2; - let y = (viewport.height - elementHeight) / 2; - - this.panel.style.left = x + 'px'; - this.panel.style.top = y + 'px'; - } - - onImageLoad(event,content) { - let image = event.target; - image.style.visibility = 'hidden'; - image.style.display = 'block'; - let imageWidth = this.domHandler.getOuterWidth(image); - let imageHeight = this.domHandler.getOuterHeight(image); - image.style.display = 'none'; - image.style.visibility = 'visible'; - - content.style.width = imageWidth + 'px'; - content.style.height = imageHeight + 'px'; - this.panel.style.left = parseInt(this.panel.style.left) + (this.domHandler.getOuterWidth(this.panel) - imageWidth) / 2 + 'px'; - this.panel.style.top = parseInt(this.panel.style.top) + (this.domHandler.getOuterHeight(this.panel) - imageHeight) / 2 + 'px'; - - setTimeout(() => { - this.domHandler.fadeIn(image, 500); - image.style.display = 'block'; - //this.captionText = this.currentImage.title; - this.loading = false; - }, parseInt(this.effectDuration)); - } - - prev(placeholder: any) { - this.captionText = null; - this.loading = true; - placeholder.style.display = 'none'; - if(this.index > 0) { - this.displayImage(this.images[--this.index]); - } - } - - next(placeholder: any) { - this.captionText = null; - this.loading = true; - placeholder.style.display = 'none'; - if(this.index <= (this.images.length - 1)) { - this.displayImage(this.images[++this.index]); - } - } - - get leftVisible():boolean { - return this.images && this.images.length && this.index != 0 && !this.loading; - } - - get rightVisible():boolean { - return this.images && this.images.length && this.index < (this.images.length - 1) && !this.loading; - } - - ngOnDestroy() { - if(this.documentClickListener) { - this.documentClickListener(); - } - - if(this.appendTo) { - this.el.nativeElement.appendChild(this.panel); - } - } - -} - -@NgModule({ - imports: [CommonModule], - exports: [Lightbox], - declarations: [Lightbox] -}) -export class LightboxModule { } diff --git a/dashboard/src/app/components/listbox/listbox.css b/dashboard/src/app/components/listbox/listbox.css deleted file mode 100644 index a73fd1364..000000000 --- a/dashboard/src/app/components/listbox/listbox.css +++ /dev/null @@ -1,72 +0,0 @@ -.ui-listbox { - padding: .25em; - width: 10em; -} - -.ui-listbox .ui-listbox-list-wrapper { - overflow:auto; -} - -.ui-listbox .ui-listbox-list { - list-style-type: none; - margin: 0; - padding: 0; -} - -.ui-listbox .ui-listbox-item { - padding: .25em; - border: 0 none; - cursor: pointer; - font-weight: normal; - margin-bottom: 1px; -} - -.ui-listbox .ui-listbox-item > span { - vertical-align: middle; -} - -.ui-listbox .ui-listbox-item:last-child { - margin-bottom: 0; -} - -.ui-listbox.ui-state-disabled .ui-listbox-item { - cursor: default; -} - -.ui-listbox-header { - margin-bottom: 0.3em; - padding: .125em .2em; - position: relative; -} - -.ui-listbox-header .ui-chkbox { - display: inline-block; - vertical-align: middle; - cursor: pointer; -} - -.ui-listbox-header .ui-listbox-filter-container { - display: inline-block; - vertical-align: middle; - position: relative; - width: 100%; -} - -.ui-listbox-header.ui-listbox-header-w-checkbox .ui-listbox-filter-container { - width: calc(100% - 2em); -} - -.ui-listbox-header .ui-listbox-filter-container .fa { - position: absolute; - top: .25em; - left: .25em; -} - -.ui-listbox-header .ui-inputtext { - padding: .125em .125em .125em 1.25em; - width: 100%; -} - -.ui-listbox-footer { - padding: .125em .2em; -} \ No newline at end of file diff --git a/dashboard/src/app/components/listbox/listbox.spec.ts b/dashboard/src/app/components/listbox/listbox.spec.ts deleted file mode 100644 index b9eb30138..000000000 --- a/dashboard/src/app/components/listbox/listbox.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { Listbox } from './listbox'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('Listbox', () => { - - let listbox: Listbox; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - Listbox - ] - }); - - fixture = TestBed.createComponent(Listbox); - listbox = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/listbox/listbox.ts b/dashboard/src/app/components/listbox/listbox.ts deleted file mode 100644 index f7274a65a..000000000 --- a/dashboard/src/app/components/listbox/listbox.ts +++ /dev/null @@ -1,416 +0,0 @@ -import {NgModule,Component,ElementRef,Input,Output,EventEmitter,AfterContentInit,ContentChildren,ContentChild,QueryList,TemplateRef,IterableDiffers,forwardRef,ChangeDetectorRef} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {SelectItem} from '../common/selectitem'; -import {SharedModule,PrimeTemplate,Footer, Header} from '../common/shared'; -import {DomHandler} from '../dom/domhandler'; -import {ObjectUtils} from '../utils/objectutils'; -import {NG_VALUE_ACCESSOR, ControlValueAccessor} from '@angular/forms'; - -export const LISTBOX_VALUE_ACCESSOR: any = { - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => Listbox), - multi: true -}; - -@Component({ - selector: 'p-listbox', - template: ` -
-
- -
-
- -
-
-
-
- -
-
- -
-
-
- - -
-
-
-
    -
  • -
    -
    - -
    -
    - -
    -
    - {{option.label}} - -
  • -
-
- -
- `, - providers: [DomHandler,ObjectUtils,LISTBOX_VALUE_ACCESSOR] -}) -export class Listbox implements AfterContentInit,ControlValueAccessor { - - @Input() multiple: boolean; - - @Input() style: any; - - @Input() styleClass: string; - - @Input() listStyle: any; - - @Input() readonly: boolean; - - @Input() disabled: boolean; - - @Input() checkbox: boolean = false; - - @Input() filter: boolean = false; - - @Input() filterMode: string = 'contains'; - - @Input() metaKeySelection: boolean = true; - - @Input() dataKey: string; - - @Input() showToggleAll: boolean = true; - - @Input() optionLabel: string; - - @Output() onChange: EventEmitter = new EventEmitter(); - - @Output() onDblClick: EventEmitter = new EventEmitter(); - - @ContentChild(Header) headerFacet; - - @ContentChild(Footer) footerFacet; - - @ContentChildren(PrimeTemplate) templates: QueryList; - - public itemTemplate: TemplateRef; - - public filterValue: string; - - public filtered: boolean; - - public value: any; - - public onModelChange: Function = () => { }; - - public onModelTouched: Function = () => { }; - - public checkboxClick: boolean; - - public optionTouched: boolean; - - public focus: boolean; - - public _options: any[]; - - constructor(public el: ElementRef, public domHandler: DomHandler, public objectUtils: ObjectUtils, public cd: ChangeDetectorRef) {} - - @Input() get options(): any[] { - return this._options; - } - - set options(val: any[]) { - let opts = this.optionLabel ? this.objectUtils.generateSelectItems(val, this.optionLabel) : val; - this._options = opts; - } - - ngAfterContentInit() { - this.templates.forEach((item) => { - switch(item.getType()) { - case 'item': - this.itemTemplate = item.template; - break; - - default: - this.itemTemplate = item.template; - break; - } - }); - } - - writeValue(value: any): void { - this.value = value; - this.cd.markForCheck(); - } - - registerOnChange(fn: Function): void { - this.onModelChange = fn; - } - - registerOnTouched(fn: Function): void { - this.onModelTouched = fn; - } - - setDisabledState(val: boolean): void { - this.disabled = val; - } - - onOptionClick(event, option) { - if(this.disabled) { - return; - } - - if(!this.checkboxClick) { - if(this.multiple) - this.onOptionClickMultiple(event, option); - else - this.onOptionClickSingle(event, option); - } - else { - this.checkboxClick = false; - } - - this.optionTouched = false; - } - - onOptionTouchEnd(event, option) { - if(this.disabled) { - return; - } - - this.optionTouched = true; - } - - onOptionClickSingle(event, option) { - let selected = this.isSelected(option); - let valueChanged = false; - let metaSelection = this.optionTouched ? false : this.metaKeySelection; - - if(metaSelection) { - let metaKey = (event.metaKey || event.ctrlKey); - - if(selected) { - if(metaKey) { - this.value = null; - valueChanged = true; - } - } - else { - this.value = option.value; - valueChanged = true; - } - } - else { - this.value = selected ? null : option.value; - valueChanged = true; - } - - if(valueChanged) { - this.onModelChange(this.value); - this.onChange.emit({ - originalEvent: event, - value: this.value - }); - } - } - - onOptionClickMultiple(event, option) { - let selected = this.isSelected(option); - let valueChanged = false; - let metaSelection = this.optionTouched ? false : this.metaKeySelection; - - if(metaSelection) { - let metaKey = (event.metaKey || event.ctrlKey); - - if(selected) { - if(metaKey) { - this.removeOption(option); - } - else { - this.value = [option.value]; - } - valueChanged = true; - } - else { - this.value = (metaKey) ? this.value || [] : []; - this.value = [...this.value, option.value]; - valueChanged = true; - } - } - else { - if(selected) { - this.removeOption(option); - } - else { - this.value = [...this.value||[],option.value]; - } - - valueChanged = true; - } - - if (valueChanged) { - this.onModelChange(this.value); - this.onChange.emit({ - originalEvent: event, - value: this.value - }); - } - } - - removeOption(option: any): void { - this.value = this.value.filter(val => !this.objectUtils.equals(val, option.value, this.dataKey)); - } - - isSelected(option: SelectItem) { - let selected = false; - - if(this.multiple) { - if(this.value) { - for(let val of this.value) { - if(this.objectUtils.equals(val, option.value, this.dataKey)) { - selected = true; - break; - } - } - } - } - else { - selected = this.objectUtils.equals(this.value, option.value, this.dataKey); - } - - return selected; - } - - get allChecked(): boolean { - if(this.filterValue) - return this.allFilteredSelected(); - else - return this.value && this.options && (this.value.length === this.options.length); - } - - allFilteredSelected(): boolean { - let allSelected: boolean; - if(this.value && this.options && this.options.length) { - allSelected = true; - for(let opt of this.options) { - if(this.isItemVisible(opt)) { - if(!this.isSelected(opt)) { - allSelected = false; - break; - } - } - } - } - - return allSelected; - } - - onFilter(event) { - let query = event.target.value.trim().toLowerCase(); - this.filterValue = query.length ? query : null; - } - - toggleAll(event, checkbox) { - if(this.disabled || !this.options || this.options.length === 0) { - return; - } - - if(checkbox.checked) { - this.value = []; - } - else { - if(this.options) { - this.value = []; - for(let i = 0; i < this.options.length; i++) { - let opt = this.options[i]; - if(this.isItemVisible(opt)) { - this.value.push(opt.value); - } - } - } - } - checkbox.checked = !checkbox.checked; - this.onModelChange(this.value); - this.onChange.emit({originalEvent: event, value: this.value}); - } - - isItemVisible(option: SelectItem): boolean { - if(this.filterValue) { - let visible; - - switch(this.filterMode) { - case 'startsWith': - visible = option.label.toLowerCase().indexOf(this.filterValue.toLowerCase()) === 0; - break; - - case 'contains': - visible = option.label.toLowerCase().indexOf(this.filterValue.toLowerCase()) > -1; - break; - - default: - visible = true; - } - - return visible; - } - else { - return true; - } - } - - onDoubleClick(event: Event, option: SelectItem): any { - if(this.disabled) { - return; - } - - this.onDblClick.emit({ - originalEvent: event, - value: this.value - }) - } - - onCheckboxClick(event: Event, option: SelectItem) { - if(this.disabled) { - return; - } - - this.checkboxClick = true; - let selected = this.isSelected(option); - - if(selected) { - this.removeOption(option); - } - else { - this.value = this.value ? this.value : []; - this.value = [...this.value,option.value]; - } - - this.onModelChange(this.value); - this.onChange.emit({ - originalEvent: event, - value: this.value - }); - } - - onInputFocus(event) { - this.focus = true; - } - - onInputBlur(event) { - this.focus = false; - } -} - -@NgModule({ - imports: [CommonModule, SharedModule], - exports: [Listbox, SharedModule], - declarations: [Listbox] -}) -export class ListboxModule { } - diff --git a/dashboard/src/app/components/megamenu/megamenu.css b/dashboard/src/app/components/megamenu/megamenu.css deleted file mode 100644 index 5b4c4da38..000000000 --- a/dashboard/src/app/components/megamenu/megamenu.css +++ /dev/null @@ -1,76 +0,0 @@ -.ui-megamenu { - padding: .25em; -} - -.ui-megamenu-root-list { - margin: 0; - padding: 0; - list-style: none; -} - -.ui-megamenu-root-list > .ui-menuitem { - position: relative; -} - -.ui-megamenu .ui-menuitem-link { - padding: .25em; - display: block; - text-decoration: none; -} - -.ui-megamenu-panel { - display: none; - position: absolute; - width: auto; -} - -.ui-megamenu-root-list > .ui-menuitem-active > .ui-megamenu-panel { - display: block; -} - -.ui-megamenu-panel .ui-menuitem { - margin: .125em 0; -} - -.ui-megamenu-submenu { - margin: 0; - padding: 0; - list-style: none; - width: 12.5em; -} - -.ui-megamenu-submenu-header { - padding: .25em; -} - -/* Horizontal */ -.ui-megamenu-horizontal .ui-megamenu-root-list > .ui-menuitem { - display: inline-block; -} - -/* Vertical */ -.ui-megamenu-vertical { - width: 12.5em; -} - -.ui-megamenu-vertical .ui-megamenu-root-list > .ui-menuitem { - display: block; -} - -.ui-megamenu-vertical .ui-megamenu-root-list > .ui-menuitem > .ui-menuitem-link { - position: relative; -} - -.ui-megamenu-vertical .ui-megamenu-root-list > .ui-menuitem > .ui-menuitem-link > .ui-submenu-icon { - position: absolute; - width: 1em; - height: 1em; - top: 50%; - right: 0; - margin-top: -.5em; -} - -.ui-megamenu .ui-g { - -ms-flex-wrap: nowrap; - flex-wrap: nowrap; -} \ No newline at end of file diff --git a/dashboard/src/app/components/megamenu/megamenu.spec.ts b/dashboard/src/app/components/megamenu/megamenu.spec.ts deleted file mode 100644 index f8fa4f9f0..000000000 --- a/dashboard/src/app/components/megamenu/megamenu.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { MegaMenu } from './megamenu'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('MegaMenu', () => { - - let megamenu: MegaMenu; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - MegaMenu - ] - }); - - fixture = TestBed.createComponent(MegaMenu); - megamenu = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/megamenu/megamenu.ts b/dashboard/src/app/components/megamenu/megamenu.ts deleted file mode 100644 index ef9a9fae8..000000000 --- a/dashboard/src/app/components/megamenu/megamenu.ts +++ /dev/null @@ -1,183 +0,0 @@ -import {NgModule,Component,ElementRef,AfterViewInit,Input,Output,Renderer2} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {DomHandler} from '../dom/domhandler'; -import {MenuItem} from '../common/menuitem'; -import {Location} from '@angular/common'; -import {RouterModule} from '@angular/router'; - -@Component({ - selector: 'p-megaMenu', - template: ` -
- -
- `, - providers: [DomHandler] -}) -export class MegaMenu { - - @Input() model: MenuItem[]; - - @Input() style: any; - - @Input() styleClass: string; - - @Input() orientation: string = 'horizontal'; - - @Input() autoZIndex: boolean = true; - - @Input() baseZIndex: number = 0; - - activeItem: any; - - hideTimeout: any; - - constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer2) {} - - onItemMouseEnter(event, item, menuitem: MenuItem) { - if(menuitem.disabled) { - return; - } - - if(this.hideTimeout) { - clearTimeout(this.hideTimeout); - this.hideTimeout = null; - } - - this.activeItem = item; - - if(menuitem.items) { - let submenu = item.children[0].nextElementSibling; - if (submenu) { - if (this.autoZIndex) { - submenu.style.zIndex = String(this.baseZIndex + (++DomHandler.zindex)); - } - - if (this.orientation === 'horizontal') { - submenu.style.top = this.domHandler.getOuterHeight(item.children[0]) + 'px'; - submenu.style.left = '0px'; - } - else if (this.orientation === 'vertical') { - submenu.style.top = '0px'; - submenu.style.left = this.domHandler.getOuterWidth(item.children[0]) + 'px'; - } - } - } - } - - onItemMouseLeave(event, link) { - this.hideTimeout = setTimeout(() => { - this.activeItem = null; - }, 1000); - } - - itemClick(event, item: MenuItem) { - if(item.disabled) { - event.preventDefault(); - return; - } - - if(!item.url) { - event.preventDefault(); - } - - if(item.command) { - item.command({ - originalEvent: event, - item: item - }); - } - - this.activeItem = null; - } - - getColumnClass(menuitem: MenuItem) { - let length = menuitem.items ? menuitem.items.length: 0; - let columnClass; - switch(length) { - case 2: - columnClass= 'ui-g-6'; - break; - - case 3: - columnClass= 'ui-g-4'; - break; - - case 4: - columnClass= 'ui-g-3'; - break; - - case 6: - columnClass= 'ui-g-2'; - break; - - default: - columnClass= 'ui-g-12'; - break; - } - - return columnClass; - } -} - -@NgModule({ - imports: [CommonModule,RouterModule], - exports: [MegaMenu,RouterModule], - declarations: [MegaMenu] -}) -export class MegaMenuModule { } \ No newline at end of file diff --git a/dashboard/src/app/components/menu/menu.css b/dashboard/src/app/components/menu/menu.css deleted file mode 100644 index 504d81429..000000000 --- a/dashboard/src/app/components/menu/menu.css +++ /dev/null @@ -1,34 +0,0 @@ -.ui-menu { - width: 12.5em; - padding: .25em; -} - -.ui-menu.ui-menu-dynamic { - position: absolute; - display: none; -} - -.ui-menu .ui-menu-separator { - border-width: 1px 0 0 0; -} - -.ui-menu ul { - list-style: none; - margin: 0; - padding: 0; -} - -.ui-menu .ui-submenu-header { - padding: .25em .5em; - margin: .125em 0; -} - -.ui-menu .ui-menuitem { - margin: .125em 0; -} - -.ui-menu .ui-menuitem-link { - padding: .25em; - display: block; - text-decoration: none; -} \ No newline at end of file diff --git a/dashboard/src/app/components/menu/menu.spec.ts b/dashboard/src/app/components/menu/menu.spec.ts deleted file mode 100644 index 1925e5c5e..000000000 --- a/dashboard/src/app/components/menu/menu.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { Menu } from './menu'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('Menu', () => { - - let menu: Menu; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - Menu - ] - }); - - fixture = TestBed.createComponent(Menu); - menu = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/menu/menu.ts b/dashboard/src/app/components/menu/menu.ts deleted file mode 100644 index e4d78dd05..000000000 --- a/dashboard/src/app/components/menu/menu.ts +++ /dev/null @@ -1,188 +0,0 @@ -import {NgModule,Component,ElementRef,AfterViewInit,OnDestroy,Input,Output,Renderer2,HostListener,ViewChild,Inject,forwardRef} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {DomHandler} from '../dom/domhandler'; -import {MenuItem} from '../common/menuitem'; -import {RouterModule} from '@angular/router'; - -@Component({ - selector: '[pMenuItemContent]', - template: ` - - - {{item.label}} - - - - {{item.label}} - - ` -}) -export class MenuItemContent { - - @Input("pMenuItemContent") item: MenuItem; - - constructor(@Inject(forwardRef(() => Menu)) public menu: Menu) {} -} - -@Component({ - selector: 'p-menu', - template: ` -
-
    - -
  • -
  • {{submenu.label}}
  • - -
  • -
  • -
    -
    - -
  • -
  • -
    -
-
- `, - providers: [DomHandler], - host: {'(window:resize)': 'onResize($event)'} -}) -export class Menu implements AfterViewInit,OnDestroy { - - @Input() model: MenuItem[]; - - @Input() popup: boolean; - - @Input() style: any; - - @Input() styleClass: string; - - @Input() appendTo: any; - - @Input() autoZIndex: boolean = true; - - @Input() baseZIndex: number = 0; - - @ViewChild('container') containerViewChild: ElementRef; - - container: HTMLDivElement; - - documentClickListener: any; - - preventDocumentDefault: any; - - onResizeTarget: any; - - constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer2) {} - - ngAfterViewInit() { - this.container = this.containerViewChild.nativeElement; - - if(this.popup) { - if(this.appendTo) { - if(this.appendTo === 'body') - document.body.appendChild(this.container); - else - this.domHandler.appendChild(this.container, this.appendTo); - } - - this.documentClickListener = this.renderer.listen('document', 'click', () => { - if(!this.preventDocumentDefault) { - this.hide(); - } - this.preventDocumentDefault = false; - }); - } - } - - toggle(event) { - if(this.container.offsetParent) - this.hide(); - else - this.show(event); - - this.preventDocumentDefault = true; - } - - onResize(event) { - if(this.onResizeTarget && this.container.offsetParent) { - this.domHandler.absolutePosition(this.container, this.onResizeTarget); - } - } - - show(event) { - let target = event.currentTarget; - this.onResizeTarget = event.currentTarget; - this.moveOnTop(); - this.container.style.display = 'block'; - this.domHandler.absolutePosition(this.container, target); - this.domHandler.fadeIn(this.container, 250); - this.preventDocumentDefault = true; - } - - moveOnTop() { - if(this.autoZIndex) { - this.containerViewChild.nativeElement.style.zIndex = String(this.baseZIndex + (++DomHandler.zindex)); - } - } - - hide() { - this.container.style.display = 'none'; - } - - itemClick(event, item: MenuItem) { - if(item.disabled) { - event.preventDefault(); - return; - } - - if(!item.url) { - event.preventDefault(); - } - - if(item.command) { - item.command({ - originalEvent: event, - item: item - }); - } - - if(this.popup) { - this.hide(); - } - } - - ngOnDestroy() { - if(this.popup) { - if(this.documentClickListener) { - this.documentClickListener(); - } - - if(this.appendTo) { - this.el.nativeElement.appendChild(this.container); - } - } - } - - hasSubMenu(): boolean { - if(this.model) { - for(var item of this.model) { - if(item.items) { - return true; - } - } - } - return false; - } -} - -@NgModule({ - imports: [CommonModule,RouterModule], - exports: [Menu,RouterModule], - declarations: [Menu,MenuItemContent] -}) -export class MenuModule { } diff --git a/dashboard/src/app/components/menubar/menubar.css b/dashboard/src/app/components/menubar/menubar.css deleted file mode 100644 index a7ae54758..000000000 --- a/dashboard/src/app/components/menubar/menubar.css +++ /dev/null @@ -1,70 +0,0 @@ -.ui-menubar { - padding: .25em; -} - -.ui-menubar .ui-menu-separator { - border-width: 1px 0 0 0; -} - -.ui-menubar:after { - content: ""; - clear: both; - display: table; -} - -.ui-menubar ul { - margin: 0; - padding: 0; - list-style: none; -} - -.ui-menubar .ui-menuitem-link { - display: block; - padding: .25em; - position: relative; - text-decoration: none; -} - -.ui-menubar .ui-menubar-root-list { - display: inline-block; -} - -.ui-menubar .ui-menubar-root-list > .ui-menuitem { - display: inline-block; - position: relative; -} - -.ui-menubar .ui-menubar-root-list > .ui-menuitem > .ui-menuitem-link { - padding: .5em; -} - -.ui-menubar .ui-menubar-root-list > li ul { - display: none; -} - -.ui-menubar .ui-submenu-list { - display: none; - position: absolute; - min-width: 12.5em; - padding: .25em; -} - -.ui-menubar .ui-submenu-list .ui-menuitem { - margin: .125em 0; -} - -.ui-menubar .ui-submenu-list .ui-menuitem-link .ui-submenu-icon { - position: absolute; - margin-top: -.5em; - right: 0; - top: 50%; -} - -.ui-menubar .ui-menuitem-active > .ui-submenu > .ui-submenu-list { - display: block; -} - -.ui-menubar .ui-menubar-custom { - float: right; - padding: .25em; -} \ No newline at end of file diff --git a/dashboard/src/app/components/menubar/menubar.spec.ts b/dashboard/src/app/components/menubar/menubar.spec.ts deleted file mode 100644 index ba8b45288..000000000 --- a/dashboard/src/app/components/menubar/menubar.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { Menubar } from './menubar'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('Menubar', () => { - - let menubar: Menubar; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - Menubar - ] - }); - - fixture = TestBed.createComponent(Menubar); - menubar = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/menubar/menubar.ts b/dashboard/src/app/components/menubar/menubar.ts deleted file mode 100644 index 78403dcaf..000000000 --- a/dashboard/src/app/components/menubar/menubar.ts +++ /dev/null @@ -1,219 +0,0 @@ -import { NgModule, Component, ElementRef, Input, Renderer2, OnDestroy } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { DomHandler } from '../dom/domhandler'; -import { MenuItem } from '../common/menuitem'; -import { Location } from '@angular/common'; -import { RouterModule } from '@angular/router'; - -@Component({ - selector: 'p-menubarSub', - template: ` - - `, - providers: [DomHandler] -}) -export class MenubarSub implements OnDestroy { - - @Input() item: MenuItem; - - @Input() root: boolean; - - @Input() autoDisplay: boolean; - - @Input() autoZIndex: boolean = true; - - @Input() baseZIndex: number = 0; - - documentClickListener: any; - - menuClick: boolean; - - menuHoverActive: boolean = false; - - activeItem: any; - - hideTimeout: any; - - activeMenu: any; - - constructor(public domHandler: DomHandler, public renderer: Renderer2) { } - - onItemMenuClick(event: Event, item: HTMLLIElement, menuitem: MenuItem) { - if (!this.autoDisplay) { - - if (menuitem.disabled) { - return; - } - - this.activeItem = this.activeMenu ? (this.activeMenu.isEqualNode(item)? null: item) : item; - let nextElement = item.children[0].nextElementSibling; - if (nextElement) { - let sublist = nextElement.children[0]; - if (this.autoZIndex) { - sublist.style.zIndex = String(this.baseZIndex + (++DomHandler.zindex)); - } - - if (this.root) { - sublist.style.top = this.domHandler.getOuterHeight(item.children[0]) + 'px'; - sublist.style.left = '0px' - } - else { - sublist.style.top = '0px'; - sublist.style.left = this.domHandler.getOuterWidth(item.children[0]) + 'px'; - } - } - - this.menuClick = true; - this.menuHoverActive = this.activeMenu ? (!this.activeMenu.isEqualNode(item)) : true; - this.activeMenu = this.activeMenu ? (this.activeMenu.isEqualNode(item)? null: item) : item; - this.bindEventListener(); - } - } - - bindEventListener() { - if (!this.documentClickListener) { - this.documentClickListener = this.renderer.listen('document', 'click',(event) => { - if (!this.menuClick) { - this.activeItem = null; - this.menuHoverActive = false; - } - this.menuClick = false; - }); - } - } - - onItemMouseEnter(event: Event, item: HTMLLIElement, menuitem: MenuItem) { - if (this.autoDisplay || (!this.autoDisplay && this.root && this.menuHoverActive)) { - if (menuitem.disabled) { - return; - } - - if(this.hideTimeout) { - clearTimeout(this.hideTimeout); - this.hideTimeout = null; - } - - this.activeItem = item; - let nextElement = item.children[0].nextElementSibling; - if (nextElement) { - let sublist = nextElement.children[0]; - sublist.style.zIndex = String(++DomHandler.zindex); - - if (this.root) { - sublist.style.top = this.domHandler.getOuterHeight(item.children[0]) + 'px'; - sublist.style.left = '0px' - } - else { - sublist.style.top = '0px'; - sublist.style.left = this.domHandler.getOuterWidth(item.children[0]) + 'px'; - } - } - - this.activeMenu = this.activeMenu ? (this.activeMenu.isEqualNode(item)? null: item) : item; - } - } - - onItemMouseLeave(event: Event) { - if (this.autoDisplay) { - this.hideTimeout = setTimeout(() => { - this.activeItem = null; - }, 1000); - } - } - - itemClick(event, item: MenuItem)  { - if (item.disabled) { - event.preventDefault(); - return; - } - - if (!item.url) { - event.preventDefault(); - } - - if (item.command) { - item.command({ - originalEvent: event, - item: item - }); - } - - this.activeItem = null; - } - - listClick(event) { - if (this.autoDisplay) { - this.activeItem = null; - } - } - - ngOnDestroy() { - if(this.documentClickListener) { - this.documentClickListener(); - this.documentClickListener = null; - } - - } - -} - -@Component({ - selector: 'p-menubar', - template: ` -
- - - -
- -
-
- `, - providers: [DomHandler] -}) -export class Menubar { - - @Input() model: MenuItem[]; - - @Input() style: any; - - @Input() styleClass: string; - - @Input() autoDisplay: boolean = true; - - @Input() autoZIndex: boolean = true; - - @Input() baseZIndex: number = 0; - - constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer2) { } -} - -@NgModule({ - imports: [CommonModule, RouterModule], - exports: [Menubar, RouterModule], - declarations: [Menubar, MenubarSub] -}) -export class MenubarModule { } diff --git a/dashboard/src/app/components/message/message.css b/dashboard/src/app/components/message/message.css deleted file mode 100644 index 897befc80..000000000 --- a/dashboard/src/app/components/message/message.css +++ /dev/null @@ -1,10 +0,0 @@ -.ui-message { - border: 1px solid; - margin: 0px .25em; - padding: .25em .5em; - display: inline-block; -} - -.ui-fluid .ui-message { - display: block; -} \ No newline at end of file diff --git a/dashboard/src/app/components/message/message.spec.ts b/dashboard/src/app/components/message/message.spec.ts deleted file mode 100644 index 2b1bde599..000000000 --- a/dashboard/src/app/components/message/message.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { UIMessage } from './message'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('UIMessage', () => { - - let message: UIMessage; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - UIMessage - ] - }); - - fixture = TestBed.createComponent(UIMessage); - message = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/message/message.ts b/dashboard/src/app/components/message/message.ts deleted file mode 100644 index f4ab23122..000000000 --- a/dashboard/src/app/components/message/message.ts +++ /dev/null @@ -1,59 +0,0 @@ -import {NgModule,Component,Input,Output,EventEmitter,Optional} from '@angular/core'; -import {CommonModule} from '@angular/common'; - -@Component({ - selector: 'p-message', - template: ` -
- - {{text}} -
- ` -}) -export class UIMessage { - - @Input() severity: string; - - @Input() text: string; - - get icon(): string { - let icon: string = null; - - if(this.severity) { - switch(this.severity) { - case 'success': - icon = 'fa fa-check'; - break; - - case 'info': - icon = 'fa fa-info-circle'; - break; - - case 'error': - icon = 'fa fa-close'; - break; - - case 'warn': - icon = 'fa fa-warning'; - break; - - default: - icon = 'fa fa-info-circle'; - break; - } - } - - return icon; - } -} - -@NgModule({ - imports: [CommonModule], - exports: [UIMessage], - declarations: [UIMessage] -}) -export class MessageModule { } diff --git a/dashboard/src/app/components/messages/messages.css b/dashboard/src/app/components/messages/messages.css deleted file mode 100644 index 4617a322d..000000000 --- a/dashboard/src/app/components/messages/messages.css +++ /dev/null @@ -1,81 +0,0 @@ -.ui-messages { - border: 1px solid; - margin: .5em 0; - padding: 1em 1em 1em .5em; - display: none; - position: relative; -} - -.ui-messages-icon { - display:inline-block; - padding: 0; - vertical-align: middle; -} - -.ui-messages-summary { - font-weight: bold; - margin-left: .25em; -} - -.ui-messages-detail { - margin-left: .25em; -} - -.ui-messages-success { - color: #2C832f; - background-color: #B4F0B6; - border-color: #B4F0B6; -} - -.ui-messages-success .ui-messages-close { - color: #2C832f; -} - -.ui-messages-info { - color: #1765A3; - background-color: #BFE0FA; - border-color: #BFE0FA; -} - -.ui-messages-info .ui-messages-close { - color: #1765A3; -} - -.ui-messages-warn { - color: #8A6714; - background-color: #FFE9B5; - border-color: #FFE9B5; -} - -.ui-messages-warn .ui-messages-close { - color: #8A6714; -} - -.ui-messages-error { - color: #AB1A0F; - background-color: #FFCBC8; - border-color: #FFCBC8; -} - -.ui-messages-error .ui-messages-close { - color: #AB1A0F; -} - -.ui-messages ul { - margin: 0; - padding: 0; - list-style-type: none; - display: inline-block; - vertical-align: middle; -} - -.ui-messages.ui-messages-noicon ul { - margin: 0 1.5em 0 0; -} - -.ui-messages .ui-messages-close { - cursor: pointer; - position: absolute; - top: 5px; - right: 5px; -} \ No newline at end of file diff --git a/dashboard/src/app/components/messages/messages.spec.ts b/dashboard/src/app/components/messages/messages.spec.ts deleted file mode 100644 index 19ded9142..000000000 --- a/dashboard/src/app/components/messages/messages.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { Messages } from './messages'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('Messages', () => { - - let messages: Messages; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - Messages - ] - }); - - fixture = TestBed.createComponent(Messages); - messages = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/messages/messages.ts b/dashboard/src/app/components/messages/messages.ts deleted file mode 100644 index c4a5b40ef..000000000 --- a/dashboard/src/app/components/messages/messages.ts +++ /dev/null @@ -1,125 +0,0 @@ -import {NgModule,Component,OnInit,OnDestroy,Input,Output,EventEmitter,Optional} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {Message} from '../common/message'; -import {MessageService} from '../common/messageservice'; -import {Subscription} from 'rxjs/Subscription'; - -@Component({ - selector: 'p-messages', - template: ` -
- - - - -
    -
  • - - -
  • -
-
- ` -}) -export class Messages implements OnInit, OnDestroy { - - @Input() value: Message[]; - - @Input() closable: boolean = true; - - @Input() style: any; - - @Input() styleClass: string; - - @Input() enableService: boolean = true; - - @Input() key: string; - - @Output() valueChange: EventEmitter = new EventEmitter(); - - subscription: Subscription; - - constructor(@Optional() public messageService: MessageService) {} - - ngOnInit() { - if(this.messageService && this.enableService) { - this.subscription = this.messageService.messageObserver.subscribe((messages: any) => { - if(messages) { - if(messages instanceof Array) { - let filteredMessages = messages.filter(m => this.key === m.key); - this.value = this.value ? [...this.value, ...filteredMessages] : [...filteredMessages]; - } - else if (this.key === messages.key) { - this.value = this.value ? [...this.value, ...[messages]] : [messages]; - } - } - else { - this.value = null; - } - }); - } - } - - hasMessages() { - return this.value && this.value.length > 0; - } - - getSeverityClass() { - return this.value[0].severity; - } - - clear(event) { - this.value = []; - this.valueChange.emit(this.value); - - event.preventDefault(); - } - - get icon(): string { - let icon: string = null; - if(this.hasMessages()) { - let msg = this.value[0]; - switch(msg.severity) { - case 'success': - icon = 'fa-check'; - break; - - case 'info': - icon = 'fa-info-circle'; - break; - - case 'error': - icon = 'fa-close'; - break; - - case 'warn': - icon = 'fa-warning'; - break; - - default: - icon = 'fa-info-circle'; - break; - } - } - - return icon; - } - - ngOnDestroy() { - if(this.subscription) { - this.subscription.unsubscribe(); - } - } -} - -@NgModule({ - imports: [CommonModule], - exports: [Messages], - declarations: [Messages] -}) -export class MessagesModule { } diff --git a/dashboard/src/app/components/msgbox/msgbox.ts b/dashboard/src/app/components/msgbox/msgbox.ts deleted file mode 100644 index 5fd43330c..000000000 --- a/dashboard/src/app/components/msgbox/msgbox.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { NgModule, Component, Input, Pipe } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { DomSanitizer, SafeHtml } from '@angular/platform-browser'; -import { DialogModule } from '../dialog/dialog'; - -@Pipe({ name: 'safeHtml'}) -export class Safe{ - constructor(private sanitizer: DomSanitizer){} - - transform (style): SafeHtml { - return this.sanitizer.bypassSecurityTrustHtml(style); - } -} - -@Component({ - template:` - -
-
- -
-
-

{{config.title}}

-

-
-
-
` -}) - -export class MsgBox{ - @Input() config; -} - -@NgModule({ - imports: [DialogModule, CommonModule], - entryComponents: [MsgBox], - exports: [MsgBox], - declarations: [MsgBox, Safe] -}) - -export class MsgBoxModule{} \ No newline at end of file diff --git a/dashboard/src/app/components/multiselect/multiselect.css b/dashboard/src/app/components/multiselect/multiselect.css deleted file mode 100644 index f0d98e5ca..000000000 --- a/dashboard/src/app/components/multiselect/multiselect.css +++ /dev/null @@ -1,149 +0,0 @@ -.ui-multiselect { - display: inline-block; - position: relative; - width: 220px; - height: 32px; - cursor: pointer; -} - -.ui-multiselect .ui-multiselect-trigger { - border-right: none; - border-top: none; - border-bottom: none; - cursor: pointer; - width: 1.5em; - height: 100%; - position: absolute; - right: 0; - top: 0; - padding: 0 .25em; -} - -.ui-multiselect .ui-multiselect-trigger .fa { - margin-top: .4em; - margin-left: -0.25em; -} - -.ui-multiselect .ui-multiselect-label-container { - overflow: hidden; -} - -.ui-multiselect .ui-multiselect-label { - display: block; - padding: .25em 2em .25em .25em; - line-height: 22px; - width: auto; - border: none; - cursor: pointer; - text-overflow: ellipsis; - overflow: hidden; -} - -.ui-multiselect.ui-state-disabled .ui-multiselect-trigger, -.ui-multiselect.ui-state-disabled .ui-multiselect-label { - cursor: auto -} - -.ui-multiselect-panel { - padding: 0.2em; - position: absolute; - min-width: 12em; -} - -.ui-multiselect .ui-multiselect-panel { - min-width: 100%; - display: none; -} - -.ui-multiselect-panel .ui-multiselect-items-wrapper { - overflow: auto; - position: relative; - padding: 0.2em 0; -} - -.ui-multiselect-panel .ui-multiselect-list { - border: 0 none; -} - -.ui-multiselect-panel .ui-multiselect-item { - border: 0 none; - cursor: pointer; - font-weight: normal; - margin: 1px 0; - padding: .125em .25em; - text-align: left; - white-space: nowrap; - display: block; - position: relative; -} - -.ui-multiselect-panel .ui-multiselect-item .ui-chkbox { - display: inline-block; - vertical-align: middle; -} - -.ui-multiselect-panel .ui-multiselect-item label { - display: inline-block; - vertical-align: middle; -} - -.ui-multiselect-header { - margin-bottom: 0.3em; - padding: .25em; - position: relative; - text-align: left; - min-height: 2em; -} - -.ui-multiselect-header .ui-chkbox { - display: inline-block; - vertical-align: middle; - cursor:pointer; -} - -.ui-multiselect-header .ui-multiselect-filter-container { - position: relative; - display: inline-block; - vertical-align: middle; - width: 65%; -} - -.ui-multiselect-header.ui-multiselect-header-no-toggleall .ui-multiselect-filter-container { - width: 85%; -} - -.ui-multiselect-header .ui-multiselect-filter-container .fa { - position: absolute; - top: .25em; - left: .125em; -} - -.ui-multiselect-header .ui-inputtext { - padding: .125em .125em .125em 1.25em; - width: 100%; -} - -.ui-multiselect-header .ui-multiselect-close { - position: absolute; - right: .375em; - top: .375em; - display: block; - font-size: 1em; - border: 0 none; -} - -.ui-multiselect-header a.ui-multiselect-all, -.ui-multiselect-header a.ui-multiselect-none { - float:left; - margin-right: 10px; - display: block; -} - -.ui-multiselect-header .ui-multiselect-close.ui-state-hover { - padding:0px; -} - -.ui-fluid .ui-multiselect { - width: 100%; - box-sizing: border-box; -} diff --git a/dashboard/src/app/components/multiselect/multiselect.spec.ts b/dashboard/src/app/components/multiselect/multiselect.spec.ts deleted file mode 100644 index 028afa5e0..000000000 --- a/dashboard/src/app/components/multiselect/multiselect.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { MultiSelect } from './multiselect'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('MultiSelect', () => { - - let multiselect: MultiSelect; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - MultiSelect - ] - }); - - fixture = TestBed.createComponent(MultiSelect); - multiselect = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/multiselect/multiselect.ts b/dashboard/src/app/components/multiselect/multiselect.ts deleted file mode 100644 index 288114225..000000000 --- a/dashboard/src/app/components/multiselect/multiselect.ts +++ /dev/null @@ -1,504 +0,0 @@ -import {NgModule,Component,ElementRef,OnInit,AfterViewInit,AfterContentInit,AfterViewChecked,OnDestroy,Input,Output,Renderer2,EventEmitter, - forwardRef,ViewChild,ChangeDetectorRef,TemplateRef,ContentChildren,QueryList} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {SelectItem} from '../common/selectitem'; -import {DomHandler} from '../dom/domhandler'; -import {ObjectUtils} from '../utils/objectutils'; -import {SharedModule,PrimeTemplate} from '../common/shared'; -import {NG_VALUE_ACCESSOR, ControlValueAccessor} from '@angular/forms'; - -export const MULTISELECT_VALUE_ACCESSOR: any = { - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => MultiSelect), - multi: true -}; - -@Component({ - selector: 'p-multiSelect', - template: ` -
-
- -
-
- -
-
- -
-
-
-
-
- -
-
- -
-
-
- - -
- - - -
-
-
    -
  • -
    -
    - -
    -
    - -
    -
    - - -
  • -
-
-
-
- `, - host: { - '[class.ui-inputwrapper-filled]': 'filled', - '[class.ui-inputwrapper-focus]': 'focus' - }, - providers: [DomHandler,ObjectUtils,MULTISELECT_VALUE_ACCESSOR] -}) -export class MultiSelect implements OnInit,AfterViewInit,AfterContentInit,AfterViewChecked,OnDestroy,ControlValueAccessor { - - @Input() scrollHeight: string = '200px'; - - @Input() defaultLabel: string = 'Choose'; - - @Input() style: any; - - @Input() styleClass: string; - - @Input() panelStyle: any; - - @Input() panelStyleClass: string; - - @Input() inputId: string; - - @Input() disabled: boolean; - - @Input() filter: boolean = true; - - @Input() filterPlaceHolder: string; - - @Input() overlayVisible: boolean; - - @Input() tabindex: number; - - @Input() appendTo: any; - - @Input() dataKey: string; - - @Input() displaySelectedLabel: boolean = true; - - @Input() maxSelectedLabels: number = 3; - - @Input() selectedItemsLabel: string = '{0} items selected'; - - @Input() showToggleAll: boolean = true; - - @Input() resetFilterOnHide: boolean = false; - - @Input() dropdownIcon: string = 'fa fa-fw fa-caret-down'; - - @Input() optionLabel: string; - - @ViewChild('container') containerViewChild: ElementRef; - - @ViewChild('panel') panelViewChild: ElementRef; - - @ViewChild('filterInput') filterInputChild: ElementRef; - - @ContentChildren(PrimeTemplate) templates: QueryList; - - @Output() onChange: EventEmitter = new EventEmitter(); - - @Output() onFocus: EventEmitter = new EventEmitter(); - - @Output() onBlur: EventEmitter = new EventEmitter(); - - @Output() onPanelShow: EventEmitter = new EventEmitter(); - - @Output() onPanelHide: EventEmitter = new EventEmitter(); - - public value: any[]; - - public onModelChange: Function = () => {}; - - public onModelTouched: Function = () => {}; - - public valuesAsString: string; - - public focus: boolean; - - filled: boolean; - - public documentClickListener: any; - - public container: HTMLDivElement; - - public panel: HTMLDivElement; - - public selfClick: boolean; - - public panelClick: boolean; - - public filterValue: string; - - public visibleOptions: SelectItem[]; - - public filtered: boolean; - - public itemTemplate: TemplateRef; - - public focusedItemCheckbox: HTMLInputElement; - - _options: any[]; - - constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer2, public objectUtils: ObjectUtils, private cd: ChangeDetectorRef) {} - - @Input() get options(): any[] { - return this._options; - } - - set options(val: any[]) { - let opts = this.optionLabel ? this.objectUtils.generateSelectItems(val, this.optionLabel) : val; - this._options = opts; - this.updateLabel(); - } - - ngOnInit() { - this.updateLabel(); - } - - ngAfterContentInit() { - this.templates.forEach((item) => { - switch(item.getType()) { - case 'item': - this.itemTemplate = item.template; - break; - - default: - this.itemTemplate = item.template; - break; - } - }); - } - - ngAfterViewInit() { - this.container = this.containerViewChild.nativeElement; - this.panel = this.panelViewChild.nativeElement; - - if(this.appendTo) { - if(this.appendTo === 'body') - document.body.appendChild(this.panel); - else - this.domHandler.appendChild(this.panel, this.appendTo); - } - - if(this.overlayVisible) { - this.show(); - } - } - - ngAfterViewChecked() { - if(this.filtered) { - if(this.appendTo) - this.domHandler.absolutePosition(this.panel, this.container); - else - this.domHandler.relativePosition(this.panel, this.container); - - this.filtered = false; - } - } - - writeValue(value: any) : void { - this.value = value; - this.updateLabel(); - this.updateFilledState(); - this.cd.markForCheck(); - } - - updateFilledState() { - this.filled = (this.valuesAsString != null && this.valuesAsString.length > 0); - } - - registerOnChange(fn: Function): void { - this.onModelChange = fn; - } - - registerOnTouched(fn: Function): void { - this.onModelTouched = fn; - } - - setDisabledState(val: boolean): void { - this.disabled = val; - } - - onItemClick(event, value) { - let selectionIndex = this.findSelectionIndex(value); - if(selectionIndex != -1) - this.value = this.value.filter((val,i) => i!=selectionIndex); - else - this.value = [...this.value||[],value]; - - this.onModelChange(this.value); - this.onChange.emit({originalEvent: event, value: this.value, itemValue: value}); - this.updateLabel(); - this.updateFilledState(); - } - - isSelected(value) { - return this.findSelectionIndex(value) != -1; - } - - findSelectionIndex(val: any): number { - let index = -1; - - if(this.value) { - for(let i = 0; i < this.value.length; i++) { - if(this.objectUtils.equals(this.value[i], val, this.dataKey)) { - index = i; - break; - } - } - } - - return index; - } - - toggleAll(event, checkbox) { - if(checkbox.checked) { - this.value = []; - } - else { - let opts = this.getVisibleOptions(); - if(opts) { - this.value = []; - for(let i = 0; i < opts.length; i++) { - this.value.push(opts[i].value); - } - } - } - - checkbox.checked = !checkbox.checked; - this.onModelChange(this.value); - this.onChange.emit({originalEvent: event, value: this.value}); - this.updateLabel(); - } - - isAllChecked() { - if(this.filterValue && this.filterValue.trim().length) - return this.value&&this.visibleOptions&&this.visibleOptions.length&&(this.value.length == this.visibleOptions.length); - else - return this.value&&this.options&&(this.value.length == this.options.length); - } - - show() { - this.overlayVisible = true; - this.panel.style.zIndex = String(++DomHandler.zindex); - this.bindDocumentClickListener(); - - if(this.appendTo) - this.domHandler.absolutePosition(this.panel, this.container); - else - this.domHandler.relativePosition(this.panel, this.container); - - this.domHandler.fadeIn(this.panel, 250); - this.onPanelShow.emit(); - } - - hide() { - this.overlayVisible = false; - this.unbindDocumentClickListener(); - if(this.resetFilterOnHide){ - this.filterValue = null; - this.filterInputChild.nativeElement.value = null; - } - this.onPanelHide.emit(); - } - - close(event) { - this.hide(); - event.preventDefault(); - event.stopPropagation(); - } - - onMouseclick(event,input) { - if(this.disabled) { - return; - } - - if(!this.panelClick) { - if(this.overlayVisible) { - this.hide(); - } - else { - input.focus(); - this.show(); - } - } - - this.selfClick = true; - } - - onInputFocus(event) { - this.focus = true; - this.onFocus.emit({originalEvent: event}); - } - - onInputBlur(event) { - this.focus = false; - this.onBlur.emit({originalEvent: event}); - this.onModelTouched(); - } - - onInputKeydown(event) { - switch(event.which) { - //down - case 40: - if(!this.overlayVisible && event.altKey) { - this.show(); - } - - event.preventDefault(); - break; - - //escape and tab - case 27: - case 9: - this.hide(); - break; - } - } - - updateLabel() { - if(this.value && this.options && this.value.length && this.displaySelectedLabel) { - let label = ''; - for(let i = 0; i < this.value.length; i++) { - let itemLabel = this.findLabelByValue(this.value[i]); - if (itemLabel) { - if(label.length > 0) { - label = label + ', '; - } - label = label + itemLabel; - } - } - - if(this.value.length <= this.maxSelectedLabels) { - this.valuesAsString = label; - } - else { - let pattern = /{(.*?)}/, - newSelectedItemsLabel = this.selectedItemsLabel.replace(this.selectedItemsLabel.match(pattern)[0], this.value.length + ''); - this.valuesAsString = newSelectedItemsLabel; - } - } - else { - this.valuesAsString = this.defaultLabel; - } - } - - findLabelByValue(val: any): string { - let label = null; - for(let i = 0; i < this.options.length; i++) { - let option = this.options[i]; - if(val == null && option.value == null || this.objectUtils.equals(val, option.value, this.dataKey)) { - label = option.label; - break; - } - } - return label; - } - - onFilter(event) { - this.filterValue = event.target.value.trim().toLowerCase(); - this.visibleOptions = []; - for(let i = 0; i < this.options.length; i++) { - let option = this.options[i]; - if(option.label.toLowerCase().indexOf(this.filterValue.toLowerCase()) > -1) { - this.visibleOptions.push(option); - } - } - this.filtered = true; - } - - isItemVisible(option: SelectItem): boolean { - if(this.filterValue && this.filterValue.trim().length) { - for(let i = 0; i < this.visibleOptions.length; i++) { - if(this.visibleOptions[i].value == option.value) { - return true; - } - } - } - else { - return true; - } - } - - getVisibleOptions(): SelectItem[] { - if(this.filterValue && this.filterValue.trim().length) { - let items = []; - for(let i = 0; i < this.options.length; i++) { - let option = this.options[i]; - if(option.label.toLowerCase().includes(this.filterValue.toLowerCase())) { - items.push(option); - } - } - return items; - } - else { - return this.options; - } - } - - bindDocumentClickListener() { - if(!this.documentClickListener) { - this.documentClickListener = this.renderer.listen('document', 'click', () => { - if(!this.selfClick && !this.panelClick && this.overlayVisible) { - this.hide(); - } - - this.selfClick = false; - this.panelClick = false; - this.cd.markForCheck(); - }); - } - } - - unbindDocumentClickListener() { - if(this.documentClickListener) { - this.documentClickListener(); - this.documentClickListener = null; - } - } - - ngOnDestroy() { - this.unbindDocumentClickListener(); - - if(this.appendTo) { - this.container.appendChild(this.panel); - } - } - -} - -@NgModule({ - imports: [CommonModule,SharedModule], - exports: [MultiSelect,SharedModule], - declarations: [MultiSelect] -}) -export class MultiSelectModule { } diff --git a/dashboard/src/app/components/orderlist/orderlist.css b/dashboard/src/app/components/orderlist/orderlist.css deleted file mode 100644 index 714660176..000000000 --- a/dashboard/src/app/components/orderlist/orderlist.css +++ /dev/null @@ -1,118 +0,0 @@ -.ui-orderlist { - display: table; -} - -.ui-orderlist .ui-orderlist-controls { - height: 12.5em; - padding: 0 .25em; - vertical-align: middle; - display: table-cell; -} - -.ui-orderlist .ui-orderlist-controls .ui-button { - display: block; - margin-bottom: 0.25em; -} - -.ui-orderlist .ui-orderlist-container { - display: table-cell; - vertical-align: top; -} - -.ui-orderlist .ui-orderlist-list { - list-style-type: none; - margin: 0; - padding: 0; - overflow:auto; - height: 12.5em; - width: 12.5em; -} - -.ui-orderlist .ui-orderlist-caption { - text-align: center; - padding: .5em .75em; - border-bottom: 0 none; -} - -.ui-orderlist .ui-orderlist-list .ui-orderlist-item { - margin: 1px; - padding: .125em; - cursor: pointer; - border: 0 none; - font-weight: inherit; -} - -.ui-orderlist .ui-orderlist-filter-container { - position: relative; - width: 100%; - padding: .5em .6em; - border-bottom: 0 none; -} - -.ui-orderlist .ui-orderlist-filter-container .ui-inputtext { - text-indent: 1.1em; - width: 100%; -} - -.ui-orderlist .ui-orderlist-filter-container .fa { - position: absolute; - top: 50%; - left: 1em; - margin-top: -.6em; -} - -.ui-orderlist.ui-state-disabled .ui-orderlist-item, -.ui-orderlist.ui-state-disabled .ui-button { - cursor: default; -} - -.ui-orderlist.ui-state-disabled .ui-orderlist-list { - overflow:hidden; -} - -/* Responsive */ -.ui-orderlist.ui-orderlist-responsive { - width: 100%; -} - -.ui-orderlist.ui-orderlist-responsive .ui-orderlist-controls { - width: 16.66666%; - padding-right: .5em; -} - -.ui-orderlist.ui-orderlist-responsive .ui-orderlist-list-container { - width: 83.33333%; -} - -.ui-orderlist.ui-orderlist-responsive .ui-orderlist-list, -.ui-orderlist.ui-orderlist-responsive .ui-orderlist-caption { - width: 100%; -} - -.ui-orderlist.ui-orderlist-responsive .ui-orderlist-controls > .ui-button { - width: 100%; -} - -.ui-orderlist .ui-orderlist-droppoint { - height: 6px; - list-style-type: none; -} - -@media (max-width: 40em) { - .ui-orderlist.ui-orderlist-responsive .ui-orderlist-controls { - text-align: center; - width: 100%; - display: inline-block; - height: auto; - } - - .ui-orderlist.ui-orderlist-responsive .ui-orderlist-controls .ui-button { - display: inline; - width: 20%; - display: inline-block; - } - - .ui-orderlist.ui-orderlist-responsive .ui-orderlist-list-container { - width: 100%; - } -} \ No newline at end of file diff --git a/dashboard/src/app/components/orderlist/orderlist.spec.ts b/dashboard/src/app/components/orderlist/orderlist.spec.ts deleted file mode 100644 index e7f1a9295..000000000 --- a/dashboard/src/app/components/orderlist/orderlist.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { OrderList } from './orderlist'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('OrderList', () => { - - let orderlist: OrderList; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - OrderList - ] - }); - - fixture = TestBed.createComponent(OrderList); - orderlist = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/orderlist/orderlist.ts b/dashboard/src/app/components/orderlist/orderlist.ts deleted file mode 100644 index 33df69d37..000000000 --- a/dashboard/src/app/components/orderlist/orderlist.ts +++ /dev/null @@ -1,354 +0,0 @@ -import {NgModule,Component,ElementRef,AfterViewChecked,AfterContentInit,Input,Output,ContentChildren,QueryList,TemplateRef,EventEmitter,ViewChild} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {ButtonModule} from '../button/button'; -import {SharedModule,PrimeTemplate} from '../common/shared'; -import {DomHandler} from '../dom/domhandler'; -import {ObjectUtils} from '../utils/objectutils'; - -@Component({ - selector: 'p-orderList', - template: ` -
-
- - - - -
-
-
{{header}}
-
- - -
-
    - -
  • -
  • - -
  • -
  • -
    -
-
-
- `, - providers: [DomHandler,ObjectUtils] -}) -export class OrderList implements AfterViewChecked,AfterContentInit { - - @Input() header: string; - - @Input() style: any; - - @Input() styleClass: string; - - @Input() listStyle: any; - - @Input() responsive: boolean; - - @Input() filterBy: string; - - @Input() filterPlaceholder: string; - - @Input() metaKeySelection: boolean = true; - - @Input() dragdrop: boolean; - - @Input() dragdropScope: string; - - @Output() onReorder: EventEmitter = new EventEmitter(); - - @Output() onSelectionChange: EventEmitter = new EventEmitter(); - - @Output() onFilterEvent: EventEmitter = new EventEmitter(); - - @ViewChild('listelement') listViewChild: ElementRef; - - @ContentChildren(PrimeTemplate) templates: QueryList; - - public itemTemplate: TemplateRef; - - selectedItems: any[]; - - movedUp: boolean; - - movedDown: boolean; - - listContainer: any; - - itemTouched: boolean; - - draggedItemIndex: number; - - dragOverItemIndex: number; - - dragging: boolean; - - public filterValue: string; - - public visibleOptions: any[]; - - public _value: any[]; - - constructor(public el: ElementRef, public domHandler: DomHandler, public objectUtils: ObjectUtils) {} - - ngAfterViewInit() { - this.listContainer = this.domHandler.findSingle(this.el.nativeElement, 'ul.ui-orderlist-list'); - } - - ngAfterContentInit() { - this.templates.forEach((item) => { - switch(item.getType()) { - case 'item': - this.itemTemplate = item.template; - break; - - default: - this.itemTemplate = item.template; - break; - } - }); - } - - ngAfterViewChecked() { - if(this.movedUp||this.movedDown) { - let listItems = this.domHandler.find(this.listContainer, 'li.ui-state-highlight'); - let listItem; - - if(listItems.length > 0) { - if(this.movedUp) - listItem = listItems[0]; - else - listItem = listItems[listItems.length - 1]; - - this.domHandler.scrollInView(this.listContainer, listItem); - } - this.movedUp = false; - this.movedDown = false; - } - } - - get value(): any[] { - return this._value; - } - - @Input() set value(val:any[]) { - this._value = val; - if(this.filterValue) { - this.filter(); - } - } - - onItemClick(event, item, index) { - let selectedIndex = this.objectUtils.findIndexInList(item, this.selectedItems); - let selected = (selectedIndex != -1); - let metaSelection = this.itemTouched ? false : this.metaKeySelection; - - if(metaSelection) { - let metaKey = (event.metaKey||event.ctrlKey); - - if(selected && metaKey) { - this.selectedItems.splice(selectedIndex, 1); - } - else { - this.selectedItems = (metaKey) ? this.selectedItems||[] : []; - this.selectItem(item, index); - } - } - else { - if(selected) { - this.selectedItems.splice(selectedIndex, 1); - } - else { - this.selectedItems = this.selectedItems||[]; - this.selectItem(item, index); - } - } - - this.onSelectionChange.emit({originalEvent:event, value:this.selectedItems}); - this.itemTouched = false; - } - - selectItem(item, index) { - this.selectedItems = this.selectedItems||[]; - this.objectUtils.insertIntoOrderedArray(item, index, this.selectedItems, this.value); - } - - onFilterKeyup(event) { - this.filterValue = event.target.value.trim().toLowerCase(); - this.filter(); - - this.onFilterEvent.emit({ - originalEvent: event, - value: this.visibleOptions - }); - } - - filter() { - let searchFields: string[] = this.filterBy.split(','); - this.visibleOptions = this.objectUtils.filter(this.value, searchFields, this.filterValue); - } - - isItemVisible(item: any): boolean { - if(this.filterValue && this.filterValue.trim().length) { - for(let i = 0; i < this.visibleOptions.length; i++) { - if(item == this.visibleOptions[i]) { - return true; - } - } - } - else { - return true; - } - } - - onItemTouchEnd(event) { - this.itemTouched = true; - } - - isSelected(item: any) { - return this.objectUtils.findIndexInList(item, this.selectedItems) != -1; - } - - moveUp(event,listElement) { - if(this.selectedItems) { - for(let i = 0; i < this.selectedItems.length; i++) { - let selectedItem = this.selectedItems[i]; - let selectedItemIndex: number = this.objectUtils.findIndexInList(selectedItem, this.value); - - if(selectedItemIndex != 0) { - let movedItem = this.value[selectedItemIndex]; - let temp = this.value[selectedItemIndex-1]; - this.value[selectedItemIndex-1] = movedItem; - this.value[selectedItemIndex] = temp; - } - else { - break; - } - } - - this.movedUp = true; - this.onReorder.emit(event); - } - } - - moveTop(event,listElement) { - if(this.selectedItems) { - for(let i = 0; i < this.selectedItems.length; i++) { - let selectedItem = this.selectedItems[i]; - let selectedItemIndex: number = this.objectUtils.findIndexInList(selectedItem, this.value); - - if(selectedItemIndex != 0) { - let movedItem = this.value.splice(selectedItemIndex,1)[0]; - this.value.unshift(movedItem); - listElement.scrollTop = 0; - } - else { - break; - } - } - - this.onReorder.emit(event); - listElement.scrollTop = 0; - } - } - - moveDown(event,listElement) { - if(this.selectedItems) { - for(let i = this.selectedItems.length - 1; i >= 0; i--) { - let selectedItem = this.selectedItems[i]; - let selectedItemIndex: number = this.objectUtils.findIndexInList(selectedItem, this.value); - - if(selectedItemIndex != (this.value.length - 1)) { - let movedItem = this.value[selectedItemIndex]; - let temp = this.value[selectedItemIndex+1]; - this.value[selectedItemIndex+1] = movedItem; - this.value[selectedItemIndex] = temp; - } - else { - break; - } - } - - this.movedDown = true; - this.onReorder.emit(event); - } - } - - moveBottom(event,listElement) { - if(this.selectedItems) { - for(let i = this.selectedItems.length - 1; i >= 0; i--) { - let selectedItem = this.selectedItems[i]; - let selectedItemIndex: number = this.objectUtils.findIndexInList(selectedItem, this.value); - - if(selectedItemIndex != (this.value.length - 1)) { - let movedItem = this.value.splice(selectedItemIndex,1)[0]; - this.value.push(movedItem); - } - else { - break; - } - } - - this.onReorder.emit(event); - listElement.scrollTop = listElement.scrollHeight; - } - } - - onDragStart(event: DragEvent, index: number) { - this.dragging = true; - this.draggedItemIndex = index; - if(this.dragdropScope) { - event.dataTransfer.setData("text", this.dragdropScope); - } - } - - onDragOver(event: DragEvent, index: number) { - if(this.draggedItemIndex !== index && this.draggedItemIndex + 1 !== index) { - this.dragOverItemIndex = index; - event.preventDefault(); - } - } - - onDragLeave(event: DragEvent, index: number) { - this.dragOverItemIndex = null; - } - - onDrop(event: DragEvent, index: number) { - let dropIndex = (this.draggedItemIndex > index) ? index : (index === 0) ? 0 : index - 1; - this.objectUtils.reorderArray(this.value, this.draggedItemIndex, dropIndex); - this.dragOverItemIndex = null; - this.onReorder.emit(event); - event.preventDefault(); - } - - onDragEnd(event: DragEvent) { - this.dragging = false; - } - - onListMouseMove(event: MouseEvent) { - if(this.dragging) { - let offsetY = this.listViewChild.nativeElement.getBoundingClientRect().top + document.body.scrollTop; - let bottomDiff = (offsetY + this.listViewChild.nativeElement.clientHeight) - event.pageY; - let topDiff = (event.pageY - offsetY); - if(bottomDiff < 25 && bottomDiff > 0) - this.listViewChild.nativeElement.scrollTop += 15; - else if(topDiff < 25 && topDiff > 0) - this.listViewChild.nativeElement.scrollTop -= 15; - } - } -} - -@NgModule({ - imports: [CommonModule,ButtonModule,SharedModule], - exports: [OrderList,SharedModule], - declarations: [OrderList] -}) -export class OrderListModule { } diff --git a/dashboard/src/app/components/organizationchart/organizationchart.css b/dashboard/src/app/components/organizationchart/organizationchart.css deleted file mode 100644 index ed3ba6a99..000000000 --- a/dashboard/src/app/components/organizationchart/organizationchart.css +++ /dev/null @@ -1,46 +0,0 @@ -.ui-organizationchart .ui-organizationchart-table { - border-spacing: 0; - border-collapse: separate; -} - -.ui-organizationchart .ui-organizationchart-table > tr > td { - text-align: center; - vertical-align: top; - padding: 0; - padding: 0 .75em; -} - -.ui-organizationchart .ui-organizationchart-node-content { - padding: .5em .75em; - display: inline-block; - position: relative; -} - -.ui-organizationchart .ui-organizationchart-node-content .ui-node-toggler { - position: absolute; - bottom: -9px; - margin-left: -8px; - z-index: 2; - left: 50%; -} - -.ui-organizationchart .ui-organizationchart-line-down { - margin: 0 auto; - height: 20px; - width: 1px; - float: none; -} - -.ui-organizationchart .ui-organizationchart-line-right { - float: none; - border-radius: 0px; -} - -.ui-organizationchart .ui-organizationchart-line-left { - float: none; - border-radius: 0; -} - -.ui-organizationchart .ui-organizationchart-node-content.ui-organizationchart-selectable-node { - cursor: pointer; -} diff --git a/dashboard/src/app/components/organizationchart/organizationchart.spec.ts b/dashboard/src/app/components/organizationchart/organizationchart.spec.ts deleted file mode 100644 index f2a13aabd..000000000 --- a/dashboard/src/app/components/organizationchart/organizationchart.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { OrganizationChart } from './organizationchart'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('OrganizationChart', () => { - - let organizationchart: OrganizationChart; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - OrganizationChart - ] - }); - - fixture = TestBed.createComponent(OrganizationChart); - organizationchart = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/organizationchart/organizationchart.ts b/dashboard/src/app/components/organizationchart/organizationchart.ts deleted file mode 100644 index 88c09e484..000000000 --- a/dashboard/src/app/components/organizationchart/organizationchart.ts +++ /dev/null @@ -1,215 +0,0 @@ -import {NgModule,Component,ElementRef,Input,Output,OnInit,AfterContentInit,OnDestroy,EventEmitter,TemplateRef,EmbeddedViewRef,ViewContainerRef, - Inject,forwardRef,ContentChildren,QueryList} from '@angular/core'; -import {trigger,state,style,transition,animate} from '@angular/animations'; -import {CommonModule} from '@angular/common'; -import {DomHandler} from '../dom/domhandler'; -import {SharedModule} from '../common/shared'; -import {TreeNode} from '../common/treenode'; -import {PrimeTemplate} from '../common/shared'; - -@Component({ - selector: '[pOrganizationChartNode]', - template: ` - - -
-
{{node.label}}
-
- -
- - - -
- - - - -
- - - - -   -   - - - - -
- - - `, - animations: [ - trigger('childState', [ - state('in', style({opacity: 1})), - transition('void => *', [ - style({opacity: 0}), - animate(150) - ]), - transition('* => void', [ - animate(150, style({opacity:0})) - ]) - ]) - ], -}) -export class OrganizationChartNode { - - @Input() node: TreeNode; - - @Input() root: boolean; - - @Input() first: boolean; - - @Input() last: boolean; - - constructor(@Inject(forwardRef(() => OrganizationChart)) public chart:OrganizationChart) {} - - get leaf(): boolean { - return this.node.leaf == false ? false : !(this.node.children&&this.node.children.length); - } - - get colspan() { - return (this.node.children && this.node.children.length) ? this.node.children.length * 2: null; - } - - onNodeClick(event: Event, node: TreeNode) { - this.chart.onNodeClick(event, node) - } - - toggleNode(event: Event, node: TreeNode) { - node.expanded = !node.expanded; - event.preventDefault(); - } - - isSelected() { - return this.chart.isSelected(this.node); - } -} - -@Component({ - selector: 'p-organizationChart', - template: ` -
-
-
- `, - providers: [DomHandler] -}) -export class OrganizationChart implements AfterContentInit { - - @Input() value: TreeNode[]; - - @Input() style: any; - - @Input() styleClass: string; - - @Input() selectionMode: string; - - @Input() selection: any; - - @Output() selectionChange: EventEmitter = new EventEmitter(); - - @Output() onNodeSelect: EventEmitter = new EventEmitter(); - - @Output() onNodeUnselect: EventEmitter = new EventEmitter(); - - @ContentChildren(PrimeTemplate) templates: QueryList; - - public templateMap: any; - - constructor(public el: ElementRef, public domHandler: DomHandler) {} - - get root(): TreeNode { - return this.value && this.value.length ? this.value[0] : null; - } - - ngAfterContentInit() { - if(this.templates.length) { - this.templateMap = {}; - } - - this.templates.forEach((item) => { - this.templateMap[item.getType()] = item.template; - }); - } - - getTemplateForNode(node: TreeNode): TemplateRef { - if(this.templateMap) - return node.type ? this.templateMap[node.type] : this.templateMap['default']; - else - return null; - } - - onNodeClick(event: Event, node: TreeNode) { - let eventTarget = ( event.target); - - if(eventTarget.className && (eventTarget.className.indexOf('ui-node-toggler') !== -1 || eventTarget.className.indexOf('ui-node-toggler-icon') !== -1)) { - return; - } - else if(this.selectionMode) { - if(node.selectable === false) { - return; - } - - let index = this.findIndexInSelection(node); - let selected = (index >= 0); - - if(this.selectionMode === 'single') { - if(selected) { - this.selection = null; - this.onNodeUnselect.emit({originalEvent: event, node: node}); - } - else { - this.selection = node; - this.onNodeSelect.emit({originalEvent: event, node: node}); - } - } - else if(this.selectionMode === 'multiple') { - if(selected) { - this.selection = this.selection.filter((val,i) => i!=index); - this.onNodeUnselect.emit({originalEvent: event, node: node}); - } - else { - this.selection = [...this.selection||[],node]; - this.onNodeSelect.emit({originalEvent: event, node: node}); - } - } - - this.selectionChange.emit(this.selection); - } - } - - findIndexInSelection(node: TreeNode) { - let index: number = -1; - - if(this.selectionMode && this.selection) { - if(this.selectionMode === 'single') { - index = (this.selection == node) ? 0 : - 1; - } - else if(this.selectionMode === 'multiple') { - for(let i = 0; i < this.selection.length; i++) { - if(this.selection[i] == node) { - index = i; - break; - } - } - } - } - - return index; - } - - isSelected(node: TreeNode) { - return this.findIndexInSelection(node) != -1; - } -} - -@NgModule({ - imports: [CommonModule], - exports: [OrganizationChart,SharedModule], - declarations: [OrganizationChart,OrganizationChartNode] -}) -export class OrganizationChartModule { } \ No newline at end of file diff --git a/dashboard/src/app/components/overlaypanel/overlaypanel.css b/dashboard/src/app/components/overlaypanel/overlaypanel.css deleted file mode 100644 index b4955daf1..000000000 --- a/dashboard/src/app/components/overlaypanel/overlaypanel.css +++ /dev/null @@ -1,18 +0,0 @@ -.ui-overlaypanel { - padding: 0; - margin: 0; - position: absolute; -} - -.ui-overlaypanel-content { - padding: 0.5em 1em; -} - -.ui-overlaypanel-close { - position: absolute; - top: -.5em; - right: -.5em; - -moz-border-radius: 100%; - -webkit-border-radius: 100%; - border-radius: 100%; -} \ No newline at end of file diff --git a/dashboard/src/app/components/overlaypanel/overlaypanel.spec.ts b/dashboard/src/app/components/overlaypanel/overlaypanel.spec.ts deleted file mode 100644 index 3b20ccc9f..000000000 --- a/dashboard/src/app/components/overlaypanel/overlaypanel.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { OverlayPanel } from './overlaypanel'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('OverlayPanel', () => { - - let overlaypanel: OverlayPanel; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - OverlayPanel - ] - }); - - fixture = TestBed.createComponent(OverlayPanel); - overlaypanel = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/overlaypanel/overlaypanel.ts b/dashboard/src/app/components/overlaypanel/overlaypanel.ts deleted file mode 100644 index 57edf5bf4..000000000 --- a/dashboard/src/app/components/overlaypanel/overlaypanel.ts +++ /dev/null @@ -1,186 +0,0 @@ -import {NgModule,Component,Input,Output,AfterViewInit,AfterViewChecked,OnDestroy,EventEmitter,Renderer2,ElementRef,ChangeDetectorRef} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {DomHandler} from '../dom/domhandler'; -import {trigger,state,style,transition,animate} from '@angular/animations'; - -@Component({ - selector: 'p-overlayPanel', - template: ` -
-
- -
- - - -
- `, - animations: [ - trigger('panelState', [ - state('hidden', style({ - opacity: 0 - })), - state('visible', style({ - opacity: 1 - })), - transition('visible => hidden', animate('400ms ease-in')), - transition('hidden => visible', animate('400ms ease-out')) - ]) - ], - providers: [DomHandler] -}) -export class OverlayPanel implements AfterViewInit,AfterViewChecked,OnDestroy { - - @Input() dismissable: boolean = true; - - @Input() showCloseIcon: boolean; - - @Input() style: any; - - @Input() styleClass: string; - - @Input() appendTo: any; - - @Output() onBeforeShow: EventEmitter = new EventEmitter(); - - @Output() onAfterShow: EventEmitter = new EventEmitter(); - - @Output() onBeforeHide: EventEmitter = new EventEmitter(); - - @Output() onAfterHide: EventEmitter = new EventEmitter(); - - container: any; - - visible: boolean = false; - - documentClickListener: any; - - selfClick: boolean; - - target: any; - - willHide: boolean; - - willShow: boolean; - - targetClickEvent: boolean; - - closeClick: boolean; - - constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer2, private cd: ChangeDetectorRef) {} - - ngAfterViewInit() { - this.container = this.el.nativeElement.children[0]; - - if(this.appendTo) { - if(this.appendTo === 'body') - document.body.appendChild(this.container); - else - this.domHandler.appendChild(this.container, this.appendTo); - } - } - - ngAfterViewChecked() { - if(this.willShow) { - this.domHandler.absolutePosition(this.container, this.target); - this.bindDocumentClickListener(); - this.onAfterShow.emit(null); - this.willShow = false; - } - - if(this.willHide) { - this.onAfterHide.emit(null); - this.willHide = false; - } - } - - bindDocumentClickListener() { - if(!this.documentClickListener && this.dismissable) { - this.documentClickListener = this.renderer.listen('document', 'click', () => { - if(!this.selfClick && !this.targetClickEvent) { - this.hide(); - } - - this.selfClick = false; - this.targetClickEvent = false; - this.cd.markForCheck(); - }); - } - } - - unbindDocumentClickListener() { - if(this.documentClickListener) { - this.documentClickListener(); - this.documentClickListener = null; - } - } - - toggle(event, target?) { - if(!this.target || this.target === (target||event.currentTarget||event.target)) { - if(this.visible) - this.hide(); - else - this.show(event, target); - } - else { - this.show(event, target); - } - } - - show(event, target?) { - this.onBeforeShow.emit(null); - this.target = target||event.currentTarget||event.target; - this.container.style.zIndex = ++DomHandler.zindex; - - this.visible = true; - this.willShow = true; - - if(event.type === 'click') { - this.targetClickEvent = true; - } - } - - hide() { - if(this.visible) { - this.onBeforeHide.emit(null); - this.willHide = true; - this.visible = false; - this.selfClick = false; - this.targetClickEvent = false; - this.unbindDocumentClickListener(); - } - } - - onPanelClick(event) { - if(this.closeClick) { - this.hide(); - this.closeClick = false; - } - else if(this.dismissable) { - this.selfClick = true; - } - } - - onCloseClick(event) { - this.closeClick = true; - event.preventDefault(); - } - - ngOnDestroy() { - this.unbindDocumentClickListener(); - - if(this.appendTo) { - this.el.nativeElement.appendChild(this.container); - } - - this.target = null; - } -} - -@NgModule({ - imports: [CommonModule], - exports: [OverlayPanel], - declarations: [OverlayPanel] -}) -export class OverlayPanelModule { } diff --git a/dashboard/src/app/components/paginator/paginator.scss b/dashboard/src/app/components/paginator/paginator.scss deleted file mode 100644 index 1722a8e1d..000000000 --- a/dashboard/src/app/components/paginator/paginator.scss +++ /dev/null @@ -1,114 +0,0 @@ -.ui-paginator { - margin: 0; - text-align: center; - padding: .125em; -} - -.ui-paginator .ui-paginator-top { - border-bottom: 0 none; -} - -.ui-paginator .ui-paginator-bottom { - border-top:0 none; -} - -.ui-paginator .ui-paginator-left-content { - float: left; -} - -.ui-paginator .ui-paginator-right-content { - float: right; -} - -.ui-paginator .ui-paginator-pages, -.ui-paginator .ui-paginator-page, -.ui-paginator .ui-paginator-next, -.ui-paginator .ui-paginator-last, -.ui-paginator .ui-paginator-first, -.ui-paginator .ui-paginator-prev, -.ui-paginator .ui-paginator-current { - width: .26rem; - height: .26rem; - border: none; - display: inline-block; - padding: .04rem; - zoom: 1; - text-decoration: none; - vertical-align: middle; -} - -.ui-paginator .ui-paginator-pages{ - width: auto; - padding: 0 0.04rem; - text-align: center; - .ui-paginator-page{ - margin: 0 .03rem; - border: 1px solid #ddd; - @extend .ui-corner-all-small; - } -} - -.ui-paginator .fa{ - display: inline-block; - width: .18rem; - height: .18rem; -} - -.ui-paginator .ui-paginator-next, -.ui-paginator .ui-paginator-prev{ - padding: 0; - .fa{ - width: .26rem; - height: .26rem; - font-size: .26rem; - text-align: center; - } -} - -.ui-paginator .ui-paginator-last, -.ui-paginator .ui-paginator-first{ - padding: .05rem; - .fa{ - width: .18rem; - height: .18rem; - font-size: .18rem; - text-align: center; - } -} - -.ui-paginator .ui-paginator-page, -.ui-paginator .ui-paginator-next, -.ui-paginator .ui-paginator-last, -.ui-paginator .ui-paginator-first, -.ui-paginator .ui-paginator-prev{ - cursor: pointer; -} - -.ui-paginator .ui-paginator-current, -.ui-paginator .ui-paginator-rpp-options { - margin-left: 1em; - margin-right: 1em; - background-image: none; -} - -.ui-paginator .ui-paginator-jtp-select option, -.ui-paginator .ui-paginator-rpp-options option { - background-image: none; - border: 0 none; - box-shadow: none; - -moz-box-shadow: none; - -webkit-box-shadow: none; -} - -.ui-paginator a.ui-state-disabled { - outline: 0 none; -} - -.ui-paginator .ui-dropdown { - min-width: 4em; - margin-left: .375em; -} - -.ui-fluid .ui-paginator .ui-dropdown { - width: auto; -} \ No newline at end of file diff --git a/dashboard/src/app/components/paginator/paginator.spec.ts b/dashboard/src/app/components/paginator/paginator.spec.ts deleted file mode 100644 index ba6ef692a..000000000 --- a/dashboard/src/app/components/paginator/paginator.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { Paginator } from './paginator'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('Paginator', () => { - - let paginator: Paginator; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - Paginator - ] - }); - - fixture = TestBed.createComponent(Paginator); - paginator = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/paginator/paginator.ts b/dashboard/src/app/components/paginator/paginator.ts deleted file mode 100644 index 63308cc61..000000000 --- a/dashboard/src/app/components/paginator/paginator.ts +++ /dev/null @@ -1,231 +0,0 @@ -import {NgModule,Component,OnInit,ElementRef,Input,Output,SimpleChange,EventEmitter,TemplateRef} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {FormsModule} from '@angular/forms'; -import {DropdownModule} from '../dropdown/dropdown'; -import {SelectItem} from '../common/selectitem'; -import {SharedModule} from '../common/shared'; - -@Component({ - selector: 'p-paginator', - template: ` -
-
- -
- - - - - - - - {{pageLink}} - - - - - - - - -
- -
-
- ` -}) -export class Paginator implements OnInit { - - @Input() pageLinkSize: number = 5; - - @Output() onPageChange: EventEmitter = new EventEmitter(); - - @Input() style: any; - - @Input() styleClass: string; - - @Input() alwaysShow: boolean = true; - - @Input() templateLeft: TemplateRef; - - @Input() templateRight: TemplateRef; - - @Input() dropdownAppendTo: any; - - pageLinks: number[]; - - _totalRecords: number = 0; - - _first: number = 0; - - _rows: number = 0; - - _rowsPerPageOptions: number[]; - - rowsPerPageItems: SelectItem[]; - - paginatorState: any; - - ngOnInit() { - this.updatePaginatorState(); - } - - @Input() get totalRecords(): number { - return this._totalRecords; - } - - set totalRecords(val:number) { - this._totalRecords = val; - this.updatePageLinks(); - } - - @Input() get first(): number { - return this._first; - } - - set first(val:number) { - this._first = val; - this.updatePageLinks(); - } - - @Input() get rows(): number { - return this._rows; - } - - set rows(val:number) { - this._rows = val; - this.updatePageLinks(); - } - - @Input() get rowsPerPageOptions(): number[] { - return this._rowsPerPageOptions; - } - - set rowsPerPageOptions(val:number[]) { - this._rowsPerPageOptions = val; - if(this._rowsPerPageOptions) { - this.rowsPerPageItems = []; - for(let opt of this._rowsPerPageOptions) { - this.rowsPerPageItems.push({label: String(opt), value: opt}); - } - } - } - - isFirstPage() { - return this.getPage() === 0; - } - - isLastPage() { - return this.getPage() === this.getPageCount() - 1; - } - - getPageCount() { - return Math.ceil(this.totalRecords/this.rows)||1; - } - - calculatePageLinkBoundaries() { - let numberOfPages = this.getPageCount(), - visiblePages = Math.min(this.pageLinkSize, numberOfPages); - - //calculate range, keep current in middle if necessary - let start = Math.max(0, Math.ceil(this.getPage() - ((visiblePages) / 2))), - end = Math.min(numberOfPages - 1, start + visiblePages - 1); - - //check when approaching to last page - var delta = this.pageLinkSize - (end - start + 1); - start = Math.max(0, start - delta); - - return [start, end]; - } - - updatePageLinks() { - this.pageLinks = []; - let boundaries = this.calculatePageLinkBoundaries(), - start = boundaries[0], - end = boundaries[1]; - - for(let i = start; i <= end; i++) { - this.pageLinks.push(i + 1); - } - } - - changePage(p :number) { - var pc = this.getPageCount(); - - if(p >= 0 && p < pc) { - this.first = this.rows * p; - var state = { - page: p, - first: this.first, - rows: this.rows, - pageCount: pc - }; - this.updatePageLinks(); - - this.onPageChange.emit(state); - this.updatePaginatorState(); - } - } - - getPage(): number { - return Math.floor(this.first / this.rows); - } - - changePageToFirst(event) { - if(!this.isFirstPage()){ - this.changePage(0); - } - - event.preventDefault(); - } - - changePageToPrev(event) { - this.changePage(this.getPage() - 1); - event.preventDefault(); - } - - changePageToNext(event) { - this.changePage(this.getPage() + 1); - event.preventDefault(); - } - - changePageToLast(event) { - if(!this.isLastPage()){ - this.changePage(this.getPageCount() - 1); - } - - event.preventDefault(); - } - - onPageLinkClick(event, page) { - this.changePage(page); - event.preventDefault(); - } - - onRppChange(event) { - this.changePage(this.getPage()); - } - - updatePaginatorState() { - this.paginatorState = { - page: this.getPage(), - rows: this.rows, - first: this.first, - totalRecords: this.totalRecords - } - } -} - -@NgModule({ - imports: [CommonModule,DropdownModule,FormsModule,SharedModule], - exports: [Paginator,DropdownModule,FormsModule,SharedModule], - declarations: [Paginator] -}) -export class PaginatorModule { } diff --git a/dashboard/src/app/components/panel/panel.css b/dashboard/src/app/components/panel/panel.css deleted file mode 100644 index d29522867..000000000 --- a/dashboard/src/app/components/panel/panel.css +++ /dev/null @@ -1,33 +0,0 @@ -.ui-panel { - padding: 0.2em; -} - -.ui-panel .ui-panel-titlebar { - padding: .5em .75em; -} - -.ui-panel .ui-panel-titlebar-icon { - float: right; - cursor: pointer; -} - -.ui-panel .ui-panel-titlebar-icon { - margin-left: 0.2em; - margin-top: -0.1em; -} - -.ui-panel .ui-panel-content { - border: 0; - background: none; - padding: .5em .75em; -} - -.ui-panel .ui-panel-footer { - border-width: 1px 0 0; - padding: .25em .5em; - text-align:left; -} - -.ui-panel-content-wrapper-overflown { - overflow: hidden; -} \ No newline at end of file diff --git a/dashboard/src/app/components/panel/panel.spec.ts b/dashboard/src/app/components/panel/panel.spec.ts deleted file mode 100644 index 8c7b6936a..000000000 --- a/dashboard/src/app/components/panel/panel.spec.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { TestBed, ComponentFixture, fakeAsync, tick } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { Panel } from './panel'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('Panel', () => { - - let panel: Panel; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - Panel - ] - }); - - fixture = TestBed.createComponent(Panel); - panel = fixture.componentInstance; - }); - - it('should display the header', () => { - panel.header = 'PrimeNG Panel Header'; - fixture.detectChanges(); - const headerEl = fixture.debugElement.query(By.css('.ui-panel-title')); - expect(headerEl.nativeElement.textContent).toContain('PrimeNG Panel Header') - }); - - it('should not render toggle icon when not toggleable', () => { - fixture.detectChanges(); - const togglerEl = fixture.debugElement.query(By.css('.ui-panel-titlebar-toggler')); - expect(togglerEl).toBeNull(); - }); - - it('should render toggle icon when toggleable', () => { - panel.toggleable = true; - fixture.detectChanges(); - const togglerEl = fixture.debugElement.query(By.css('.ui-panel-titlebar-toggler')); - expect(togglerEl).not.toBeNull(); - }); - - it('should toggle the panel when toggler is clicked', fakeAsync(() => { - panel.toggleable = true; - fixture.detectChanges(); - const togglerEl = fixture.nativeElement.querySelector('.ui-panel-titlebar-toggler'); - - togglerEl.click(); - expect(panel.collapsed).toEqual(true); - - tick(500); - - togglerEl.click(); - expect(panel.collapsed).toEqual(false); - })); - -}); diff --git a/dashboard/src/app/components/panel/panel.ts b/dashboard/src/app/components/panel/panel.ts deleted file mode 100644 index 8a54e2e05..000000000 --- a/dashboard/src/app/components/panel/panel.ts +++ /dev/null @@ -1,122 +0,0 @@ -import {NgModule,Component,Input,Output,EventEmitter,ElementRef,ContentChild} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {SharedModule,Footer} from '../common/shared'; -import {BlockableUI} from '../common/blockableui'; -import {trigger,state,style,transition,animate} from '@angular/animations'; - -let idx: number = 0; - -@Component({ - selector: 'p-panel', - template: ` -
-
- {{header}} - - - - -
-
-
- -
- - -
-
- `, - animations: [ - trigger('panelContent', [ - state('hidden', style({ - height: '0' - })), - state('visible', style({ - height: '*' - })), - transition('visible <=> hidden', animate('400ms cubic-bezier(0.86, 0, 0.07, 1)')) - ]) - ] -}) -export class Panel implements BlockableUI { - - @Input() toggleable: boolean; - - @Input() header: string; - - @Input() collapsed: boolean = false; - - @Input() style: any; - - @Input() styleClass: string; - - @Input() expandIcon: string = 'fa-plus'; - - @Input() collapseIcon: string = 'fa-minus'; - - @Input() showHeader: boolean = true; - - @Output() collapsedChange: EventEmitter = new EventEmitter(); - - @Output() onBeforeToggle: EventEmitter = new EventEmitter(); - - @Output() onAfterToggle: EventEmitter = new EventEmitter(); - - @ContentChild(Footer) footerFacet; - - animating: boolean; - - id: string = `ui-panel-${idx++}`; - - constructor(private el: ElementRef) {} - - toggle(event) { - if(this.animating) { - return false; - } - - this.animating = true; - this.onBeforeToggle.emit({originalEvent: event, collapsed: this.collapsed}); - - if(this.toggleable) { - if(this.collapsed) - this.expand(event); - else - this.collapse(event); - } - - event.preventDefault(); - } - - expand(event) { - this.collapsed = false; - this.collapsedChange.emit(this.collapsed); - } - - collapse(event) { - this.collapsed = true; - this.collapsedChange.emit(this.collapsed); - } - - getBlockableElement(): HTMLElement { - return this.el.nativeElement.children[0]; - } - - onToggleDone(event: Event) { - this.animating = false; - this.onAfterToggle.emit({originalEvent: event, collapsed: this.collapsed}); - } - -} - -@NgModule({ - imports: [CommonModule], - exports: [Panel,SharedModule], - declarations: [Panel] -}) -export class PanelModule { } diff --git a/dashboard/src/app/components/panelmenu/panelmenu.css b/dashboard/src/app/components/panelmenu/panelmenu.css deleted file mode 100644 index 969878b8f..000000000 --- a/dashboard/src/app/components/panelmenu/panelmenu.css +++ /dev/null @@ -1,54 +0,0 @@ -.ui-panelmenu { - width: auto; -} - -.ui-panelmenu .ui-menu-separator { - border-width: 1px 0 0 0; -} - -.ui-panelmenu .ui-panelmenu-content-wrapper { - overflow: hidden; -} - -.ui-panelmenu .ui-panelmenu-header { - margin: -1px 0 0 0; - zoom: 1; -} - -.ui-panelmenu .ui-panelmenu-header-link { - padding: .5em; - display: block; - text-decoration: none; -} - -.ui-panelmenu .ui-menuitem-icon { - margin-right: .25em; -} - -.ui-panelmenu .ui-panelmenu-content { - padding: 0.25em; - border-top: 0; - margin-bottom: 1px; -} - -.ui-panelmenu .ui-submenu-list { - margin: 0; - padding: 0; - list-style: none; - margin-left: 1.5em; -} - -.ui-panelmenu .ui-panelmenu-content > .ui-panelmenu-root-submenu >.ui-submenu-list { - margin-left: 0; -} - -.ui-panelmenu .ui-menuitem { - overflow: hidden; - margin: .125em 0; -} - -.ui-panelmenu .ui-menuitem-link { - padding: .25em; - display: block; - text-decoration: none; -} \ No newline at end of file diff --git a/dashboard/src/app/components/panelmenu/panelmenu.spec.ts b/dashboard/src/app/components/panelmenu/panelmenu.spec.ts deleted file mode 100644 index adeb7e295..000000000 --- a/dashboard/src/app/components/panelmenu/panelmenu.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { PanelMenu } from './panelmenu'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('PanelMenu', () => { - - let panelmenu: PanelMenu; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - PanelMenu - ] - }); - - fixture = TestBed.createComponent(PanelMenu); - panelmenu = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/panelmenu/panelmenu.ts b/dashboard/src/app/components/panelmenu/panelmenu.ts deleted file mode 100644 index 964c7ce21..000000000 --- a/dashboard/src/app/components/panelmenu/panelmenu.ts +++ /dev/null @@ -1,164 +0,0 @@ -import {NgModule,Component,ElementRef,OnDestroy,Input} from '@angular/core'; -import {trigger,state,style,transition,animate} from '@angular/animations'; -import {CommonModule} from '@angular/common'; -import {MenuItem} from '../common/menuitem'; -import {RouterModule} from '@angular/router'; - -export class BasePanelMenuItem { - - handleClick(event, item) { - if(item.disabled) { - event.preventDefault(); - return; - } - - item.expanded = !item.expanded; - - if(!item.url) { - event.preventDefault(); - } - - if(item.command) { - item.command({ - originalEvent: event, - item: item - }); - } - } -} - -@Component({ - selector: 'p-panelMenuSub', - template: ` - - `, - animations: [ - trigger('submenu', [ - state('hidden', style({ - height: '0px' - })), - state('visible', style({ - height: '*' - })), - transition('visible => hidden', animate('400ms cubic-bezier(0.86, 0, 0.07, 1)')), - transition('hidden => visible', animate('400ms cubic-bezier(0.86, 0, 0.07, 1)')) - ]) - ] -}) -export class PanelMenuSub extends BasePanelMenuItem { - - @Input() item: MenuItem; - - @Input() expanded: boolean; -} - -@Component({ - selector: 'p-panelMenu', - template: ` -
- - - -
- `, - animations: [ - trigger('rootItem', [ - state('hidden', style({ - height: '0px' - })), - state('visible', style({ - height: '*' - })), - transition('visible => hidden', animate('400ms cubic-bezier(0.86, 0, 0.07, 1)')), - transition('hidden => visible', animate('400ms cubic-bezier(0.86, 0, 0.07, 1)')) - ]) - ] -}) -export class PanelMenu extends BasePanelMenuItem { - - @Input() model: MenuItem[]; - - @Input() style: any; - - @Input() styleClass: string; - - @Input() multiple: boolean = true; - - public animating: boolean; - - collapseAll() { - for(let item of this.model) { - if(item.expanded) { - item.expanded = false; - } - } - } - - handleClick(event, item) { - if(!this.multiple) { - for(let modelItem of this.model) { - if(item !== modelItem && modelItem.expanded) { - modelItem.expanded = false; - } - } - } - - this.animating = true; - super.handleClick(event, item); - } - - onToggleDone() { - this.animating = false; - } - -} - -@NgModule({ - imports: [CommonModule,RouterModule], - exports: [PanelMenu,RouterModule], - declarations: [PanelMenu,PanelMenuSub] -}) -export class PanelMenuModule { } diff --git a/dashboard/src/app/components/password/images/password-meter.png b/dashboard/src/app/components/password/images/password-meter.png deleted file mode 100644 index eec05cfb4..000000000 Binary files a/dashboard/src/app/components/password/images/password-meter.png and /dev/null differ diff --git a/dashboard/src/app/components/password/password.css b/dashboard/src/app/components/password/password.css deleted file mode 100644 index f72f179a3..000000000 --- a/dashboard/src/app/components/password/password.css +++ /dev/null @@ -1,20 +0,0 @@ -.ui-password-panel { - padding: .25em .5em; - width: 10em; - margin-top: 2px; -} - -.ui-password-panel .ui-password-meter { - height: 10px; - background:transparent url("./images/password-meter.png") no-repeat left top; - padding: 0; - margin: 0; -} - -.ui-password-info { - margin-top: .25em; -} - -.ui-password-panel-overlay { - position: absolute; -} \ No newline at end of file diff --git a/dashboard/src/app/components/password/password.spec.ts b/dashboard/src/app/components/password/password.spec.ts deleted file mode 100644 index 16d9ca301..000000000 --- a/dashboard/src/app/components/password/password.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { Password } from './password'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('Password', () => { - - let password: Password; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - Password - ] - }); - - fixture = TestBed.createComponent(Password); - password = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/password/password.ts b/dashboard/src/app/components/password/password.ts deleted file mode 100644 index 5a1bcbc7c..000000000 --- a/dashboard/src/app/components/password/password.ts +++ /dev/null @@ -1,164 +0,0 @@ -import {NgModule,Directive,ElementRef,HostListener,Input,AfterViewInit,OnDestroy,DoCheck} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {DomHandler} from '../dom/domhandler'; - -@Directive({ - selector: '[pPassword]', - host: { - '[class.ui-inputtext]': 'true', - '[class.ui-corner-all]': 'true', - '[class.ui-state-default]': 'true', - '[class.ui-widget]': 'true', - '[class.ui-state-filled]': 'filled' - }, - providers: [DomHandler] -}) -export class Password implements AfterViewInit,OnDestroy,DoCheck { - - @Input() promptLabel: string = 'Please enter a password'; - - @Input() weakLabel: string = 'Weak'; - - @Input() mediumLabel: string = 'Medium'; - - @Input() strongLabel: string = 'Strong'; - - @Input() feedback: boolean = true; - - panel: any; - - meter: any; - - info: any; - - filled: boolean; - - constructor(public el: ElementRef, public domHandler: DomHandler) {} - - ngAfterViewInit() { - this.panel = document.createElement('div'); - this.panel.className = 'ui-password-panel ui-widget ui-state-highlight ui-corner-all ui-helper-hidden ui-password-panel-overlay'; - this.meter = document.createElement('div'); - this.meter.className = 'ui-password-meter'; - this.info = document.createElement('div'); - this.info.className = 'ui-password-info'; - this.info.textContent = this.promptLabel; - - if(this.feedback) { - this.panel.appendChild(this.meter); - this.panel.appendChild(this.info); - document.body.appendChild(this.panel); - } - } - - ngDoCheck() { - this.updateFilledState(); - } - - //To trigger change detection to manage ui-state-filled for material labels when there is no value binding - @HostListener('input', ['$event']) - onInput(e) { - this.updateFilledState(); - } - - updateFilledState() { - this.filled = this.el.nativeElement.value && this.el.nativeElement.value.length; - } - - @HostListener('focus', ['$event']) - onFocus(e) { - this.panel.style.zIndex = String(++DomHandler.zindex); - this.domHandler.removeClass(this.panel, 'ui-helper-hidden'); - this.domHandler.absolutePosition(this.panel, this.el.nativeElement); - this.domHandler.fadeIn(this.panel, 250); - } - - @HostListener('blur', ['$event']) - onBlur(e) { - this.domHandler.addClass(this.panel, 'ui-helper-hidden'); - } - - @HostListener('keyup', ['$event']) - onKeyup(e) { - let value = e.target.value, - label = null, - meterPos = null; - - if(value.length === 0) { - label = this.promptLabel; - meterPos = '0px 0px'; - } - else { - var score = this.testStrength(value); - - if(score < 30) { - label = this.weakLabel; - meterPos = '0px -10px'; - } - else if(score >= 30 && score < 80) { - label = this.mediumLabel; - meterPos = '0px -20px'; - } - else if(score >= 80) { - label = this.strongLabel; - meterPos = '0px -30px'; - } - } - - this.meter.style.backgroundPosition = meterPos; - this.info.textContent = label; - } - - testStrength(str: string) { - let grade: number = 0; - let val; - - val = str.match('[0-9]'); - grade += this.normalize(val ? val.length : 1/4, 1) * 25; - - val = str.match('[a-zA-Z]'); - grade += this.normalize(val ? val.length : 1/2, 3) * 10; - - val = str.match('[!@#$%^&*?_~.,;=]'); - grade += this.normalize(val ? val.length : 1/6, 1) * 35; - - val = str.match('[A-Z]'); - grade += this.normalize(val ? val.length : 1/6, 1) * 30; - - grade *= str.length / 8; - - return grade > 100 ? 100 : grade; - } - - normalize(x, y) { - let diff = x - y; - - if(diff <= 0) - return x / y; - else - return 1 + 0.5 * (x / (x + y/4)); - } - - get disabled(): boolean { - return this.el.nativeElement.disabled; - } - - ngOnDestroy() { - if (!this.feedback) - return; - - this.panel.removeChild(this.meter); - this.panel.removeChild(this.info); - document.body.removeChild(this.panel); - this.panel = null; - this.meter = null; - this.info = null; - } -} - -@NgModule({ - imports: [CommonModule], - exports: [Password], - declarations: [Password] -}) -export class PasswordModule { } diff --git a/dashboard/src/app/components/picklist/picklist.css b/dashboard/src/app/components/picklist/picklist.css deleted file mode 100644 index d6605d49f..000000000 --- a/dashboard/src/app/components/picklist/picklist.css +++ /dev/null @@ -1,202 +0,0 @@ -.ui-picklist > div { - float: left; -} - -.ui-picklist .ui-picklist-buttons { - height: 12.5em; - padding: 0 .25em; -} - -.ui-picklist .ui-picklist-list { - list-style-type: none; - margin: 0; - padding: 0; - overflow:auto; - height: 12.5em; - width: 12.5em; -} - -.ui-picklist .ui-picklist-list li { - margin: 1px; - padding: .125em; -} - -.ui-picklist .ui-button { - display:block; - margin-bottom: 0.25em; -} - -.ui-picklist .ui-button-text-icon-left { - width: 100%; -} - -.ui-picklist .ui-picklist-item { - cursor: pointer; - border: 0 none; - font-weight: inherit; -} - -.ui-picklist .ui-picklist-caption { - text-align: center; - padding: .5em .75em; - border-bottom:0 none; -} - -.ui-picklist table { - width: 100%; - border-collapse:collapse; -} - -.ui-picklist .ui-picklist-filter-container { - position: relative; - width: 100%; - padding: .5em .6em; - border-bottom: 0 none; -} - -.ui-picklist .ui-picklist-filter-container .ui-picklist-filter { - text-indent: 1.1em; - width: 100%; -} - -.ui-picklist .ui-picklist-filter-container .fa { - position: absolute; - top: 50%; - left: 1em; - margin-top: -.6em; -} - -.ui-picklist { - display: table; -} - -.ui-picklist > div { - float: none; - display: table-cell; - vertical-align: top; -} - -.ui-picklist .ui-picklist-buttons { - vertical-align: middle; -} - -/* Vertical */ -.ui-picklist.ui-picklist-vertical { - display: table; -} - -.ui-picklist.ui-picklist-vertical > div { - float: none; - display: table-row; - vertical-align: top; -} - -.ui-picklist.ui-picklist-vertical .ui-picklist-buttons { - text-align:center; - height: auto; -} - -.ui-picklist.ui-picklist-vertical .ui-picklist-buttons .ui-button { - display: inline-block; -} - -.ui-picklist.ui-picklist-vertical .ui-button { - margin-top: 0.25em; -} - -.ui-picklist-outline { - outline: 1px dotted black; - z-index: 1; -} - -.ui-picklist .ui-picklist-droppoint { - height: 6px; - list-style-type: none; -} - -.ui-picklist .ui-picklist-list .ui-picklist-droppoint-empty { - height: 100%; - list-style-type: none; -} - -.ui-picklist-list.ui-picklist-source, -.ui-picklist-list.ui-picklist-target { - outline: none; -} - -/* Responsive */ -.ui-picklist.ui-picklist-responsive * { - box-sizing: border-box; -} - -.ui-picklist.ui-picklist-responsive { - width: 100%; -} - -.ui-picklist.ui-picklist-responsive .ui-picklist-listwrapper { - width: 35%; -} - -.ui-picklist.ui-picklist-responsive .ui-picklist-listwrapper.ui-picklist-listwrapper-nocontrols { - width: 45%; -} - -.ui-picklist.ui-picklist-responsive .ui-picklist-buttons { - width: 10%; -} - -.ui-picklist.ui-picklist-responsive .ui-picklist-buttons button { - width: 100%; -} - -.ui-picklist.ui-picklist-responsive .ui-picklist-list { - width: auto; -} - -/* Responsive */ -@media (max-width: 40em) { - .ui-picklist.ui-picklist-responsive { - display: block; - } - - .ui-picklist.ui-picklist-responsive > div { - display: block; - width: 100% !important; - } - - .ui-picklist.ui-picklist-responsive .ui-picklist-buttons { - text-align: center; - height: auto; - padding: .4em 0; - } - - .ui-picklist.ui-picklist-responsive .ui-picklist-buttons button { - display: inline; - width: 20%; - margin-bottom: 0; - } - - .ui-picklist.ui-picklist-responsive .ui-picklist-source-controls.ui-picklist-buttons { - padding-bottom: .4em; - } - - .ui-picklist.ui-picklist-responsive .ui-picklist-target-controls.ui-picklist-buttons { - padding-top: .4em; - } - - .ui-picklist.ui-picklist-responsive .ui-picklist-buttons .fa-angle-right::before { - content: "\f107"; - } - - .ui-picklist.ui-picklist-responsive .ui-picklist-buttons .fa-angle-double-right::before { - content: "\f103"; - } - - .ui-picklist.ui-picklist-responsive .ui-picklist-buttons .fa-angle-left::before { - content: "\f106"; - } - - .ui-picklist.ui-picklist-responsive .ui-picklist-buttons .fa-angle-double-left::before { - content: "\f102"; - } -} diff --git a/dashboard/src/app/components/picklist/picklist.spec.ts b/dashboard/src/app/components/picklist/picklist.spec.ts deleted file mode 100644 index d1886f6b7..000000000 --- a/dashboard/src/app/components/picklist/picklist.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { PickList } from './picklist'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('PickList', () => { - - let picklist: PickList; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - PickList - ] - }); - - fixture = TestBed.createComponent(PickList); - picklist = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/picklist/picklist.ts b/dashboard/src/app/components/picklist/picklist.ts deleted file mode 100644 index 46a6b62dd..000000000 --- a/dashboard/src/app/components/picklist/picklist.ts +++ /dev/null @@ -1,660 +0,0 @@ -import {NgModule,Component,ElementRef,AfterViewInit,AfterContentInit,AfterViewChecked,DoCheck,Input,Output,ContentChildren,QueryList,TemplateRef,EventEmitter,ViewChild} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {ButtonModule} from '../button/button'; -import {SharedModule,PrimeTemplate} from '../common/shared'; -import {DomHandler} from '../dom/domhandler'; -import {ObjectUtils} from '../utils/objectutils'; - -@Component({ - selector: 'p-pickList', - template: ` -
-
-
- - - - -
-
-
-
{{sourceHeader}}
-
- - -
-
    - -
  • -
  • - -
  • -
  • -
    -
-
-
-
- - - - -
-
-
-
{{targetHeader}}
-
- - -
-
    - -
  • -
  • - -
  • -
  • -
    -
-
-
-
- - - - -
-
-
- `, - providers: [DomHandler,ObjectUtils] -}) -export class PickList implements AfterViewChecked,AfterContentInit { - - @Input() source: any[]; - - @Input() target: any[]; - - @Input() sourceHeader: string; - - @Input() targetHeader: string; - - @Input() responsive: boolean; - - @Input() filterBy: string; - - @Input() showSourceFilter: boolean = true; - - @Input() showTargetFilter: boolean = true; - - @Input() metaKeySelection: boolean = true; - - @Input() dragdrop: boolean; - - @Input() dragdropScope: string; - - @Input() style: any; - - @Input() styleClass: string; - - @Input() sourceStyle: any; - - @Input() targetStyle: any; - - @Input() showSourceControls: boolean = true; - - @Input() showTargetControls: boolean = true; - - @Input() sourceFilterPlaceholder: string; - - @Input() targetFilterPlaceholder: string; - - @Input() disabled: boolean = false; - - @Output() onMoveToSource: EventEmitter = new EventEmitter(); - - @Output() onMoveAllToSource: EventEmitter = new EventEmitter(); - - @Output() onMoveAllToTarget: EventEmitter = new EventEmitter(); - - @Output() onMoveToTarget: EventEmitter = new EventEmitter(); - - @Output() onSourceReorder: EventEmitter = new EventEmitter(); - - @Output() onTargetReorder: EventEmitter = new EventEmitter(); - - @Output() onSourceSelect: EventEmitter = new EventEmitter(); - - @Output() onTargetSelect: EventEmitter = new EventEmitter(); - - @ViewChild('sourcelist') listViewSourceChild: ElementRef; - - @ViewChild('targetlist') listViewTargetChild: ElementRef; - - @ViewChild('sourceFilter') sourceFilterViewChild: ElementRef; - - @ViewChild('targetFilter') targetFilterViewChild: ElementRef; - - @ContentChildren(PrimeTemplate) templates: QueryList; - - public itemTemplate: TemplateRef; - - public visibleOptionsSource: any[]; - - public visibleOptionsTarget: any[]; - - selectedItemsSource: any[] = []; - - selectedItemsTarget: any[] = []; - - reorderedListElement: any; - - draggedItemIndexSource: number; - - draggedItemIndexTarget: number; - - dragOverItemIndexSource: number; - - dragOverItemIndexTarget: number; - - dragging: boolean; - - movedUp: boolean; - - movedDown: boolean; - - itemTouched: boolean; - - filterValueSource: string; - - filterValueTarget: string; - - fromListType: number; - - toListType: number; - - onListItemDroppoint: boolean; - - listHighlightTarget: boolean; - - listHighlightSource: boolean; - - constructor(public el: ElementRef, public domHandler: DomHandler, public objectUtils: ObjectUtils) {} - - ngAfterContentInit() { - this.templates.forEach((item) => { - switch(item.getType()) { - case 'item': - this.itemTemplate = item.template; - break; - - default: - this.itemTemplate = item.template; - break; - } - }); - } - - ngAfterViewChecked() { - if(this.movedUp||this.movedDown) { - let listItems = this.domHandler.find(this.reorderedListElement, 'li.ui-state-highlight'); - let listItem; - - if(this.movedUp) - listItem = listItems[0]; - else - listItem = listItems[listItems.length - 1]; - - this.domHandler.scrollInView(this.reorderedListElement, listItem); - this.movedUp = false; - this.movedDown = false; - this.reorderedListElement = null; - } - } - - onItemClick(event, item: any, selectedItems: any[], callback: EventEmitter) { - if(this.disabled) { - return; - } - - let index = this.findIndexInSelection(item,selectedItems); - let selected = (index != -1); - let metaSelection = this.itemTouched ? false : this.metaKeySelection; - - if(metaSelection) { - let metaKey = (event.metaKey||event.ctrlKey); - - if(selected && metaKey) { - selectedItems.splice(index, 1); - } - else { - if(!metaKey) { - selectedItems.length = 0; - } - selectedItems.push(item); - } - } - else { - if(selected) - selectedItems.splice(index, 1); - else - selectedItems.push(item); - } - - callback.emit({originalEvent: event, items: selectedItems}); - - this.itemTouched = false; - } - - onSourceItemDblClick() { - if(this.disabled) { - return; - } - - this.moveRight(); - } - - onTargetItemDblClick() { - if(this.disabled) { - return; - } - - this.moveLeft(); - } - - onFilter(event: KeyboardEvent, data: any[], listType: number) { - let query = ( event.target).value.trim().toLowerCase(); - - if(listType === -1) - this.filterValueSource = query; - else - this.filterValueTarget = query; - - this.activateFilter(data, listType); - } - - activateFilter(data: any[], listType: number) { - let searchFields = this.filterBy.split(','); - - if(listType === -1) - this.visibleOptionsSource = this.objectUtils.filter(data, searchFields, this.filterValueSource); - else - this.visibleOptionsTarget = this.objectUtils.filter(data, searchFields, this.filterValueTarget); - } - - isItemVisible(item: any, listType: number): boolean { - if(listType == -1) - return this.isVisibleInList(this.visibleOptionsSource, item, this.filterValueSource); - else - return this.isVisibleInList(this.visibleOptionsTarget, item, this.filterValueTarget); - } - - isVisibleInList(data: any[], item: any, filterValue: string): boolean { - if(filterValue && filterValue.trim().length) { - for(let i = 0; i < data.length; i++) { - if(item == data[i]) { - return true; - } - } - } - else { - return true; - } - } - - onItemTouchEnd(event) { - if(this.disabled) { - return; - } - - this.itemTouched = true; - } - - private sortByIndexInList(items: any[], list: any) { - return items.sort((item1, item2) => - this.findIndexInList(item1, list) - this.findIndexInList(item2, list)); - } - - moveUp(listElement, list, selectedItems, callback) { - if(selectedItems && selectedItems.length) { - selectedItems = this.sortByIndexInList(selectedItems, list); - for(let i = 0; i < selectedItems.length; i++) { - let selectedItem = selectedItems[i]; - let selectedItemIndex: number = this.findIndexInList(selectedItem, list); - - if(selectedItemIndex != 0) { - let movedItem = list[selectedItemIndex]; - let temp = list[selectedItemIndex-1]; - list[selectedItemIndex-1] = movedItem; - list[selectedItemIndex] = temp; - } - else { - break; - } - } - - this.movedUp = true; - this.reorderedListElement = listElement; - callback.emit({items: selectedItems}); - } - } - - moveTop(listElement, list, selectedItems, callback) { - if(selectedItems && selectedItems.length) { - selectedItems = this.sortByIndexInList(selectedItems, list); - for(let i = 0; i < selectedItems.length; i++) { - let selectedItem = selectedItems[i]; - let selectedItemIndex: number = this.findIndexInList(selectedItem, list); - - if(selectedItemIndex != 0) { - let movedItem = list.splice(selectedItemIndex,1)[0]; - list.unshift(movedItem); - } - else { - break; - } - } - - listElement.scrollTop = 0; - callback.emit({items: selectedItems}); - } - } - - moveDown(listElement, list, selectedItems, callback) { - if(selectedItems && selectedItems.length) { - selectedItems = this.sortByIndexInList(selectedItems, list); - for(let i = selectedItems.length - 1; i >= 0; i--) { - let selectedItem = selectedItems[i]; - let selectedItemIndex: number = this.findIndexInList(selectedItem, list); - - if(selectedItemIndex != (list.length - 1)) { - let movedItem = list[selectedItemIndex]; - let temp = list[selectedItemIndex+1]; - list[selectedItemIndex+1] = movedItem; - list[selectedItemIndex] = temp; - } - else { - break; - } - } - - this.movedDown = true; - this.reorderedListElement = listElement; - callback.emit({items: selectedItems}); - } - } - - moveBottom(listElement, list, selectedItems, callback) { - if(selectedItems && selectedItems.length) { - selectedItems = this.sortByIndexInList(selectedItems, list); - for(let i = selectedItems.length - 1; i >= 0; i--) { - let selectedItem = selectedItems[i]; - let selectedItemIndex: number = this.findIndexInList(selectedItem, list); - - if(selectedItemIndex != (list.length - 1)) { - let movedItem = list.splice(selectedItemIndex,1)[0]; - list.push(movedItem); - } - else { - break; - } - } - - listElement.scrollTop = listElement.scrollHeight; - callback.emit({items: selectedItems}); - } - } - - moveRight() { - if(this.selectedItemsSource && this.selectedItemsSource.length) { - for(let i = 0; i < this.selectedItemsSource.length; i++) { - let selectedItem = this.selectedItemsSource[i]; - if(this.findIndexInList(selectedItem, this.target) == -1) { - this.target.push(this.source.splice(this.findIndexInList(selectedItem, this.source),1)[0]); - } - } - this.onMoveToTarget.emit({ - items: this.selectedItemsSource - }); - this.selectedItemsSource = []; - } - } - - moveAllRight() { - if(this.source) { - let movedItems = []; - - for(let i = 0; i < this.source.length; i++) { - if(this.isItemVisible(this.source[i], -1)) { - let removedItem = this.source.splice(i, 1)[0]; - this.target.push(removedItem); - movedItems.push(removedItem); - i--; - } - } - - this.onMoveToTarget.emit({ - items: movedItems - }); - - this.onMoveAllToTarget.emit({ - items: movedItems - }); - - this.selectedItemsSource = []; - } - } - - moveLeft() { - if(this.selectedItemsTarget && this.selectedItemsTarget.length) { - for(let i = 0; i < this.selectedItemsTarget.length; i++) { - let selectedItem = this.selectedItemsTarget[i]; - if(this.findIndexInList(selectedItem, this.source) == -1) { - this.source.push(this.target.splice(this.findIndexInList(selectedItem, this.target),1)[0]); - } - } - this.onMoveToSource.emit({ - items: this.selectedItemsTarget - }); - - this.selectedItemsTarget = []; - } - } - - moveAllLeft() { - if(this.target) { - let movedItems = []; - - for(let i = 0; i < this.target.length; i++) { - if(this.isItemVisible(this.target[i], 1)) { - let removedItem = this.target.splice(i, 1)[0]; - this.source.push(removedItem); - movedItems.push(removedItem); - i--; - } - } - - this.onMoveToSource.emit({ - items: movedItems - }); - - this.onMoveAllToSource.emit({ - items: movedItems - }); - - this.selectedItemsTarget = []; - } - } - - isSelected(item: any, selectedItems: any[]) { - return this.findIndexInSelection(item, selectedItems) != -1; - } - - findIndexInSelection(item: any, selectedItems: any[]): number { - return this.findIndexInList(item, selectedItems); - } - - findIndexInList(item: any, list: any): number { - let index: number = -1; - - if(list) { - for(let i = 0; i < list.length; i++) { - if(list[i] == item) { - index = i; - break; - } - } - } - - return index; - } - - onDragStart(event: DragEvent, index: number, listType: number) { - this.dragging = true; - this.fromListType = listType; - if(listType === -1) - this.draggedItemIndexSource = index; - else - this.draggedItemIndexTarget = index; - - if(this.dragdropScope) { - event.dataTransfer.setData("text", this.dragdropScope); - } - } - - onDragOver(event: DragEvent, index: number, listType: number) { - if(listType == -1) { - if(this.draggedItemIndexSource !== index && this.draggedItemIndexSource + 1 !== index || (this.fromListType === 1)) { - this.dragOverItemIndexSource = index; - event.preventDefault(); - } - } - else { - if(this.draggedItemIndexTarget !== index && this.draggedItemIndexTarget + 1 !== index || (this.fromListType === -1)) { - this.dragOverItemIndexTarget = index; - event.preventDefault(); - } - } - this.onListItemDroppoint = true; - } - - onDragLeave(event: DragEvent, listType: number) { - this.dragOverItemIndexSource = null; - this.dragOverItemIndexTarget = null; - this.onListItemDroppoint = false; - } - - onDrop(event: DragEvent, index: number, listType: number) { - if(this.onListItemDroppoint) { - if(listType === -1) { - if(this.fromListType === 1) - this.insert(this.draggedItemIndexTarget, this.target, index, this.source, this.onMoveToSource); - else - this.objectUtils.reorderArray(this.source, this.draggedItemIndexSource, (this.draggedItemIndexSource > index) ? index : (index === 0) ? 0 : index - 1); - - this.dragOverItemIndexSource = null; - } - else { - if(this.fromListType === -1) - this.insert(this.draggedItemIndexSource, this.source, index, this.target, this.onMoveToTarget); - else - this.objectUtils.reorderArray(this.target, this.draggedItemIndexTarget, (this.draggedItemIndexTarget > index) ? index : (index === 0) ? 0 : index - 1); - - this.dragOverItemIndexTarget = null; - } - - this.listHighlightTarget = false; - this.listHighlightSource = false; - event.preventDefault(); - } - } - - onDragEnd(event: DragEvent) { - this.dragging = false; - } - - onListDrop(event: DragEvent, listType: number) { - if(!this.onListItemDroppoint) { - if(listType === -1) { - if(this.fromListType === 1) - this.insert(this.draggedItemIndexTarget, this.target, null, this.source, this.onMoveToSource); - } - else { - if(this.fromListType === -1) - this.insert(this.draggedItemIndexSource, this.source, null, this.target, this.onMoveToTarget); - } - - this.listHighlightTarget = false; - this.listHighlightSource = false; - event.preventDefault(); - } - } - - insert(fromIndex, fromList, toIndex, toList, callback) { - const elementtomove = fromList[fromIndex]; - - if(toIndex === null) - toList.push(fromList.splice(fromIndex, 1)[0]); - else - toList.splice(toIndex, 0, fromList.splice(fromIndex, 1)[0]); - - callback.emit({ - items: [elementtomove] - }); - } - - onListMouseMove(event: MouseEvent, listType: number) { - if(this.dragging) { - let moveListType = (listType == 0 ? this.listViewSourceChild : this.listViewTargetChild); - let offsetY = moveListType.nativeElement.getBoundingClientRect().top + document.body.scrollTop; - let bottomDiff = (offsetY + moveListType.nativeElement.clientHeight) - event.pageY; - let topDiff = (event.pageY - offsetY); - if(bottomDiff < 25 && bottomDiff > 0) - moveListType.nativeElement.scrollTop += 15; - else if(topDiff < 25 && topDiff > 0) - moveListType.nativeElement.scrollTop -= 15; - } - - if(listType === -1) { - if(this.fromListType === 1) - this.listHighlightSource = true; - } - else { - if(this.fromListType === -1) - this.listHighlightTarget = true; - } - event.preventDefault(); - } - - onListDragLeave() { - this.listHighlightTarget = false; - this.listHighlightSource = false; - } - - resetFilter() { - this.visibleOptionsSource = null; - this.filterValueSource = null; - this.visibleOptionsTarget = null; - this.filterValueTarget = null; - - ( this.sourceFilterViewChild.nativeElement).value = ''; - ( this.targetFilterViewChild.nativeElement).value = ''; - } -} - -@NgModule({ - imports: [CommonModule,ButtonModule,SharedModule], - exports: [PickList,SharedModule], - declarations: [PickList] -}) -export class PickListModule { } diff --git a/dashboard/src/app/components/progressbar/progressbar.css b/dashboard/src/app/components/progressbar/progressbar.css deleted file mode 100644 index d2e100039..000000000 --- a/dashboard/src/app/components/progressbar/progressbar.css +++ /dev/null @@ -1,110 +0,0 @@ -.ui-progressbar { - height: 1.2em; - text-align: left; - position: relative; - overflow: hidden; -} - -.ui-progressbar-determinate .ui-progressbar-value { - height: 100%; - width: 0%; - position: absolute; - display: none; - border: 0 none; -} - -.ui-progressbar-determinate .ui-progressbar-value-animate { - -webkit-transition: width 1s ease-in-out; - -moz-transition: width 1s ease-in-out; - -o-transition: width 1s ease-in-out; - transition: width 1s ease-in-out; -} - -.ui-progressbar-determinate .ui-progressbar-label { - text-align: center; - height: 100%; - width: 100%; - position: absolute; - display: none; - font-weight: bold; -} - -.ui-progressbar-indeterminate { - height: .5em; -} - -.ui-progressbar-indeterminate .ui-progressbar-value { - border: 0 none; -} - -.ui-progressbar-indeterminate .ui-progressbar-value::before { - content: ''; - position: absolute; - background-color: inherit; - top: 0; - left: 0; - bottom: 0; - will-change: left, right; - -webkit-animation: ui-progressbar-indeterminate-anim 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite; - animation: ui-progressbar-indeterminate-anim 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite; -} - -.ui-progressbar-indeterminate .ui-progressbar-value::after { - content: ''; - position: absolute; - background-color: inherit; - top: 0; - left: 0; - bottom: 0; - will-change: left, right; - -webkit-animation: ui-progressbar-indeterminate-anim-short 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) infinite; - animation: ui-progressbar-indeterminate-anim-short 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) infinite; - -webkit-animation-delay: 1.15s; - animation-delay: 1.15s; -} - -@-webkit-keyframes ui-progressbar-indeterminate-anim { - 0% { - left: -35%; - right: 100%; } - 60% { - left: 100%; - right: -90%; } - 100% { - left: 100%; - right: -90%; } -} -@keyframes ui-progressbar-indeterminate-anim { - 0% { - left: -35%; - right: 100%; } - 60% { - left: 100%; - right: -90%; } - 100% { - left: 100%; - right: -90%; } -} - -@-webkit-keyframes ui-progressbar-indeterminate-anim-short { - 0% { - left: -200%; - right: 100%; } - 60% { - left: 107%; - right: -8%; } - 100% { - left: 107%; - right: -8%; } -} -@keyframes ui-progressbar-indeterminate-anim-short { - 0% { - left: -200%; - right: 100%; } - 60% { - left: 107%; - right: -8%; } - 100% { - left: 107%; - right: -8%; } -} \ No newline at end of file diff --git a/dashboard/src/app/components/progressbar/progressbar.spec.ts b/dashboard/src/app/components/progressbar/progressbar.spec.ts deleted file mode 100644 index 8579e46f5..000000000 --- a/dashboard/src/app/components/progressbar/progressbar.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { ProgressBar } from './progressbar'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('ProgressBar', () => { - - let progressbar: ProgressBar; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - ProgressBar - ] - }); - - fixture = TestBed.createComponent(ProgressBar); - progressbar = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/progressbar/progressbar.ts b/dashboard/src/app/components/progressbar/progressbar.ts deleted file mode 100644 index b102759fb..000000000 --- a/dashboard/src/app/components/progressbar/progressbar.ts +++ /dev/null @@ -1,35 +0,0 @@ -import {NgModule,Component,Input} from '@angular/core'; -import {CommonModule} from '@angular/common'; - -@Component({ - selector: 'p-progressBar', - template: ` -
-
-
{{value}}{{unit}}
-
- ` -}) -export class ProgressBar { - - @Input() value: any; - - @Input() showValue: boolean = true; - - @Input() style: any; - - @Input() styleClass: string; - - @Input() unit: string = '%'; - - @Input() mode: string = 'determinate'; - -} - -@NgModule({ - imports: [CommonModule], - exports: [ProgressBar], - declarations: [ProgressBar] -}) -export class ProgressBarModule { } \ No newline at end of file diff --git a/dashboard/src/app/components/progressspinner/progressspinner.css b/dashboard/src/app/components/progressspinner/progressspinner.css deleted file mode 100644 index 0a0396e2c..000000000 --- a/dashboard/src/app/components/progressspinner/progressspinner.css +++ /dev/null @@ -1,71 +0,0 @@ -.ui-progress-spinner { - position: relative; - margin: 0 auto; - width: 100px; - height: 100px; - display: inline-block; -} - -.ui-progress-spinner::before { - content: ''; - display: block; - padding-top: 100%; -} - -.ui-progress-spinner-svg { - animation: ui-progress-spinner-rotate 2s linear infinite; - height: 100%; - transform-origin: center center; - width: 100%; - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; - margin: auto; -} - -.ui-progress-spinner-circle { - stroke-dasharray: 1, 200; - stroke-dashoffset: 0; - animation: ui-progress-spinner-dash 1.5s ease-in-out infinite, ui-progress-spinner-color 6s ease-in-out infinite; - stroke-linecap: round; -} - -@keyframes ui-progress-spinner-rotate { - 100% { - transform: rotate(360deg); - } -} - -@keyframes ui-progress-spinner-dash { - 0% { - stroke-dasharray: 1, 200; - stroke-dashoffset: 0; - } - 50% { - stroke-dasharray: 89, 200; - stroke-dashoffset: -35px; - } - 100% { - stroke-dasharray: 89, 200; - stroke-dashoffset: -124px; - } -} - -@keyframes ui-progress-spinner-color { - 100%, - 0% { - stroke: #d62d20; - } - 40% { - stroke: #0057e7; - } - 66% { - stroke: #008744; - } - 80%, - 90% { - stroke: #ffa700; - } -} \ No newline at end of file diff --git a/dashboard/src/app/components/progressspinner/progressspinner.spec.ts b/dashboard/src/app/components/progressspinner/progressspinner.spec.ts deleted file mode 100644 index ffec9c8b0..000000000 --- a/dashboard/src/app/components/progressspinner/progressspinner.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { ProgressSpinner } from './progressspinner'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('ProgressSpinner', () => { - - let progressspinner: ProgressSpinner; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - ProgressSpinner - ] - }); - - fixture = TestBed.createComponent(ProgressSpinner); - progressspinner = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/progressspinner/progressspinner.ts b/dashboard/src/app/components/progressspinner/progressspinner.ts deleted file mode 100644 index db6fe47e9..000000000 --- a/dashboard/src/app/components/progressspinner/progressspinner.ts +++ /dev/null @@ -1,33 +0,0 @@ -import {NgModule,Component,Input} from '@angular/core'; -import {CommonModule} from '@angular/common'; - -@Component({ - selector: 'p-progressSpinner', - template: ` -
- - - -
- ` -}) -export class ProgressSpinner { - - @Input() style: any; - - @Input() styleClass: string; - - @Input() strokeWidth: string = "2"; - - @Input() fill: string = "none"; - - @Input() animationDuration: string = "2s"; - -} - -@NgModule({ - imports: [CommonModule], - exports: [ProgressSpinner], - declarations: [ProgressSpinner] -}) -export class ProgressSpinnerModule { } \ No newline at end of file diff --git a/dashboard/src/app/components/radiobutton/radiobutton.css b/dashboard/src/app/components/radiobutton/radiobutton.css deleted file mode 100644 index 15831a41c..000000000 --- a/dashboard/src/app/components/radiobutton/radiobutton.css +++ /dev/null @@ -1,33 +0,0 @@ -.ui-radiobutton { - display:inline-block; - cursor: pointer; - vertical-align: middle; - margin-right: .25em; -} - -.ui-radiobutton-box { - width: .16rem; - height: .16rem; - line-height: .16rem; - -moz-border-radius: 100%; - -webkit-border-radius: 100%; - border-radius: 100%; - text-align: center; -} - -.ui-radiobutton-icon { - display: block; - margin: .04rem; - background: #fff; - - width: .06rem; - height: .06rem; - line-height: .06rem; - -moz-border-radius: 100%; - -webkit-border-radius: 100%; - border-radius: 100%; -} - -.ui-radiobutton, .ui-radiobutton-label { - vertical-align: middle; -} \ No newline at end of file diff --git a/dashboard/src/app/components/radiobutton/radiobutton.spec.ts b/dashboard/src/app/components/radiobutton/radiobutton.spec.ts deleted file mode 100644 index d118f7e1d..000000000 --- a/dashboard/src/app/components/radiobutton/radiobutton.spec.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { RadioButton } from './radiobutton'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('RadioButton', () => { - - let radiobutton: RadioButton; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - RadioButton - ] - }); - - fixture = TestBed.createComponent(RadioButton); - radiobutton = fixture.componentInstance; - }); - - it('should display active state initially when checked by default', () => { - radiobutton.checked = true; - fixture.detectChanges(); - - const boxEl = fixture.nativeElement.querySelector('.ui-radiobutton-box'); - expect(boxEl.class).toContain('ui-state-active'); - }); -}); diff --git a/dashboard/src/app/components/radiobutton/radiobutton.ts b/dashboard/src/app/components/radiobutton/radiobutton.ts deleted file mode 100644 index f3001a785..000000000 --- a/dashboard/src/app/components/radiobutton/radiobutton.ts +++ /dev/null @@ -1,119 +0,0 @@ -import {NgModule,Component,Input,Output,ElementRef,EventEmitter,forwardRef,ViewChild,ChangeDetectorRef} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {NG_VALUE_ACCESSOR, ControlValueAccessor} from '@angular/forms'; - -export const RADIO_VALUE_ACCESSOR: any = { - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => RadioButton), - multi: true -}; - -@Component({ - selector: 'p-radioButton', - template: ` -
-
- -
-
- -
-
- - `, - providers: [RADIO_VALUE_ACCESSOR] -}) -export class RadioButton implements ControlValueAccessor { - - @Input() value: any; - - @Input() name: string; - - @Input() disabled: boolean; - - @Input() label: string; - - @Input() tabindex: number; - - @Input() inputId: string; - - @Input() style: any; - - @Input() styleClass: string; - - @Output() onClick: EventEmitter = new EventEmitter(); - - @ViewChild('rb') inputViewChild: ElementRef; - - public onModelChange: Function = () => {}; - - public onModelTouched: Function = () => {}; - - public checked: boolean; - - public focused: boolean; - - constructor(private cd: ChangeDetectorRef) {} - - handleClick() { - if(!this.disabled) { - this.select(); - } - } - - select() { - if(!this.disabled) { - this.onClick.emit(null); - this.inputViewChild.nativeElement.checked = true; - this.checked = true; - this.onModelChange(this.value); - } - } - - writeValue(value: any) : void { - this.checked = (value == this.value); - - if(this.inputViewChild.nativeElement) { - this.inputViewChild.nativeElement.checked = this.checked; - } - - this.cd.markForCheck(); - } - - registerOnChange(fn: Function): void { - this.onModelChange = fn; - } - - registerOnTouched(fn: Function): void { - this.onModelTouched = fn; - } - - setDisabledState(val: boolean): void { - this.disabled = val; - } - - onFocus(event) { - this.focused = true; - } - - onBlur(event) { - this.focused = false; - this.onModelTouched(); - } - - onChange(event) { - this.select(); - } -} - -@NgModule({ - imports: [CommonModule], - exports: [RadioButton], - declarations: [RadioButton] -}) -export class RadioButtonModule { } \ No newline at end of file diff --git a/dashboard/src/app/components/rating/rating.spec.ts b/dashboard/src/app/components/rating/rating.spec.ts deleted file mode 100644 index 4a16d55b6..000000000 --- a/dashboard/src/app/components/rating/rating.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { Rating } from './rating'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('Rating', () => { - - let rating: Rating; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - Rating - ] - }); - - fixture = TestBed.createComponent(Rating); - rating = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/rating/rating.ts b/dashboard/src/app/components/rating/rating.ts deleted file mode 100644 index 686143644..000000000 --- a/dashboard/src/app/components/rating/rating.ts +++ /dev/null @@ -1,117 +0,0 @@ -import {NgModule,Component,ElementRef,OnInit,Input,Output,EventEmitter,forwardRef,ChangeDetectorRef} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {NG_VALUE_ACCESSOR, ControlValueAccessor} from '@angular/forms'; - -export const RATING_VALUE_ACCESSOR: any = { - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => Rating), - multi: true -}; - -@Component({ - selector: 'p-rating', - template: ` - - `, - providers: [RATING_VALUE_ACCESSOR] -}) -export class Rating implements ControlValueAccessor { - - @Input() disabled: boolean; - - @Input() readonly: boolean; - - @Input() stars: number = 5; - - @Input() cancel: boolean = true; - - @Input() iconOnClass: string = 'fa-star'; - - @Input() iconOnStyle: any; - - @Input() iconOffClass: string = 'fa-star-o'; - - @Input() iconOffStyle: any; - - @Input() iconCancelClass: string = 'fa-ban'; - - @Input() iconCancelStyle: any; - - @Output() onRate: EventEmitter = new EventEmitter(); - - @Output() onCancel: EventEmitter = new EventEmitter(); - - constructor(private cd: ChangeDetectorRef) {} - - value: number; - - onModelChange: Function = () => {}; - - onModelTouched: Function = () => {}; - - public starsArray: number[]; - - ngOnInit() { - this.starsArray = []; - for(let i = 0; i < this.stars; i++) { - this.starsArray[i] = i; - } - } - - rate(event, i: number): void { - if(!this.readonly&&!this.disabled) { - this.value = (i + 1); - this.onModelChange(this.value); - this.onModelTouched(); - this.onRate.emit({ - originalEvent: event, - value: (i+1) - }); - } - event.preventDefault(); - } - - clear(event): void { - if(!this.readonly&&!this.disabled) { - this.value = null; - this.onModelChange(this.value); - this.onModelTouched(); - this.onCancel.emit(event); - } - event.preventDefault(); - } - - writeValue(value: any) : void { - this.value = value; - this.cd.detectChanges(); - } - - registerOnChange(fn: Function): void { - this.onModelChange = fn; - } - - registerOnTouched(fn: Function): void { - this.onModelTouched = fn; - } - - setDisabledState(val: boolean): void { - this.disabled = val; - } -} - -@NgModule({ - imports: [CommonModule], - exports: [Rating], - declarations: [Rating] -}) -export class RatingModule { } \ No newline at end of file diff --git a/dashboard/src/app/components/schedule/schedule.css b/dashboard/src/app/components/schedule/schedule.css deleted file mode 100644 index 838a51d44..000000000 --- a/dashboard/src/app/components/schedule/schedule.css +++ /dev/null @@ -1,3 +0,0 @@ -.ui-fluid .fc .ui-button { - width: auto; -} \ No newline at end of file diff --git a/dashboard/src/app/components/schedule/schedule.spec.ts b/dashboard/src/app/components/schedule/schedule.spec.ts deleted file mode 100644 index ab080446e..000000000 --- a/dashboard/src/app/components/schedule/schedule.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { Schedule } from './schedule'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('Schedule', () => { - - let schedule: Schedule; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - Schedule - ] - }); - - fixture = TestBed.createComponent(Schedule); - schedule = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/schedule/schedule.ts b/dashboard/src/app/components/schedule/schedule.ts deleted file mode 100644 index 2f133ad82..000000000 --- a/dashboard/src/app/components/schedule/schedule.ts +++ /dev/null @@ -1,402 +0,0 @@ -import {NgModule,Component,ElementRef,OnDestroy,DoCheck,OnChanges,Input,Output,EventEmitter,IterableDiffers,OnInit,AfterViewChecked,SimpleChanges} from '@angular/core'; -import {CommonModule} from '@angular/common'; - -declare var jQuery: any; - -@Component({ - selector: 'p-schedule', - template: '
' -}) -export class Schedule implements DoCheck,OnDestroy,OnInit,OnChanges,AfterViewChecked { - - @Input() events: any[]; - - @Input() header: any; - - @Input() style: any; - - @Input() styleClass: string; - - @Input() rtl: boolean; - - @Input() weekends: boolean; - - @Input() hiddenDays: number[]; - - @Input() fixedWeekCount: boolean; - - @Input() weekNumbers: boolean; - - @Input() businessHours: any; - - @Input() height: any; - - @Input() contentHeight: any; - - @Input() aspectRatio: number = 1.35; - - @Input() eventLimit: any; - - @Input() defaultDate: any; - - @Input() editable: boolean; - - @Input() droppable: boolean; - - @Input() eventStartEditable: boolean; - - @Input() eventDurationEditable: boolean; - - @Input() defaultView: string = 'month'; - - @Input() allDaySlot: boolean = true; - - @Input() allDayText: string = 'all-day'; - - @Input() slotDuration: any = '00:30:00'; - - @Input() slotLabelInterval: any; - - @Input() snapDuration: any; - - @Input() scrollTime: any = '06:00:00'; - - @Input() minTime: any = '00:00:00'; - - @Input() maxTime: any = '24:00:00'; - - @Input() slotEventOverlap: boolean = true; - - @Input() nowIndicator: boolean; - - @Input() dragRevertDuration: number = 500; - - @Input() dragOpacity: number = .75; - - @Input() dragScroll: boolean = true; - - @Input() eventOverlap: any; - - @Input() eventConstraint: any; - - @Input() locale: string; - - @Input() timezone: boolean | string = false; - - @Input() timeFormat:string | null = null; - - @Input() eventRender: Function; - - @Input() dayRender: Function; - - @Input() navLinks: boolean; - - @Input() options: any; - - @Output() onDayClick: EventEmitter = new EventEmitter(); - - @Output() onDrop: EventEmitter = new EventEmitter(); - - @Output() onEventClick: EventEmitter = new EventEmitter(); - - @Output() onEventMouseover: EventEmitter = new EventEmitter(); - - @Output() onEventMouseout: EventEmitter = new EventEmitter(); - - @Output() onEventDragStart: EventEmitter = new EventEmitter(); - - @Output() onEventDragStop: EventEmitter = new EventEmitter(); - - @Output() onEventDrop: EventEmitter = new EventEmitter(); - - @Output() onEventResizeStart: EventEmitter = new EventEmitter(); - - @Output() onEventResizeStop: EventEmitter = new EventEmitter(); - - @Output() onEventResize: EventEmitter = new EventEmitter(); - - @Output() onViewRender: EventEmitter = new EventEmitter(); - - @Output() onViewDestroy: EventEmitter = new EventEmitter(); - - initialized: boolean; - - stopNgOnChangesPropagation: boolean; - - differ: any; - - schedule: any; - - config: any; - - constructor(public el: ElementRef, differs: IterableDiffers) { - this.differ = differs.find([]).create(null); - this.initialized = false; - } - - ngOnInit() { - this.config = { - theme: true, - header: this.header, - isRTL: this.rtl, - weekends: this.weekends, - hiddenDays: this.hiddenDays, - fixedWeekCount: this.fixedWeekCount, - weekNumbers: this.weekNumbers, - businessHours: this.businessHours, - height: this.height, - contentHeight: this.contentHeight, - aspectRatio: this.aspectRatio, - eventLimit: this.eventLimit, - defaultDate: this.defaultDate, - locale: this.locale, - timezone: this.timezone, - timeFormat: this.timeFormat, - editable: this.editable, - droppable: this.droppable, - eventStartEditable: this.eventStartEditable, - eventDurationEditable: this.eventDurationEditable, - defaultView: this.defaultView, - allDaySlot: this.allDaySlot, - allDayText: this.allDayText, - slotDuration: this.slotDuration, - slotLabelInterval: this.slotLabelInterval, - snapDuration: this.snapDuration, - scrollTime: this.scrollTime, - minTime: this.minTime, - maxTime: this.maxTime, - slotEventOverlap: this.slotEventOverlap, - nowIndicator: this.nowIndicator, - dragRevertDuration: this.dragRevertDuration, - dragOpacity: this.dragOpacity, - dragScroll: this.dragScroll, - eventOverlap: this.eventOverlap, - eventConstraint: this.eventConstraint, - eventRender: this.eventRender, - dayRender: this.dayRender, - navLinks: this.navLinks, - dayClick: (date, jsEvent, view) => { - this.onDayClick.emit({ - 'date': date, - 'jsEvent': jsEvent, - 'view': view - }); - }, - drop: (date, jsEvent, ui, resourceId) => { - this.onDrop.emit({ - 'date': date, - 'jsEvent': jsEvent, - 'ui': ui, - 'resourceId': resourceId - }); - }, - eventClick: (calEvent, jsEvent, view) => { - this.onEventClick.emit({ - 'calEvent': calEvent, - 'jsEvent': jsEvent, - 'view': view - }); - }, - eventMouseover: (calEvent, jsEvent, view) => { - this.onEventMouseover.emit({ - 'calEvent': calEvent, - 'jsEvent': jsEvent, - 'view': view - }); - }, - eventMouseout: (calEvent, jsEvent, view) => { - this.onEventMouseout.emit({ - 'calEvent': calEvent, - 'jsEvent': jsEvent, - 'view': view - }); - }, - eventDragStart: (event, jsEvent, ui, view) => { - this.onEventDragStart.emit({ - 'event': event, - 'jsEvent': jsEvent, - 'view': view - }); - }, - eventDragStop: (event, jsEvent, ui, view) => { - this.onEventDragStop.emit({ - 'event': event, - 'jsEvent': jsEvent, - 'view': view - }); - }, - eventDrop: (event, delta, revertFunc, jsEvent, ui, view) => { - this._updateEvent(event); - - this.onEventDrop.emit({ - 'event': event, - 'delta': delta, - 'revertFunc': revertFunc, - 'jsEvent': jsEvent, - 'view': view - }); - }, - eventResizeStart: (event, jsEvent, ui, view) => { - this.onEventResizeStart.emit({ - 'event': event, - 'jsEvent': jsEvent, - 'view': view - }); - }, - eventResizeStop: (event, jsEvent, ui, view) => { - this.onEventResizeStop.emit({ - 'event': event, - 'jsEvent': jsEvent, - 'view': view - }); - }, - eventResize: (event, delta, revertFunc, jsEvent, ui, view) => { - this._updateEvent(event); - - this.onEventResize.emit({ - 'event': event, - 'delta': delta, - 'revertFunc': revertFunc, - 'jsEvent': jsEvent, - 'view': view - }); - }, - viewRender: (view, element) => { - this.onViewRender.emit({ - 'view': view, - 'element': element - }); - }, - viewDestroy: (view, element) => { - this.onViewDestroy.emit({ - 'view': view, - 'element': element - }); - } - }; - - if(this.options) { - for(let prop in this.options) { - this.config[prop] = this.options[prop]; - } - } - } - - ngAfterViewChecked() { - if(!this.initialized && this.el.nativeElement.offsetParent) { - this.initialize(); - } - } - - ngOnChanges(changes: SimpleChanges) { - if(this.schedule) { - let options = {}; - for(let change in changes) { - if(change !== 'events') { - options[change] = changes[change].currentValue; - } - } - - if(Object.keys(options).length) { - this.schedule.fullCalendar('option', options); - } - } - } - - initialize() { - this.schedule = jQuery(this.el.nativeElement.children[0]); - this.schedule.fullCalendar(this.config); - if(this.events) { - this.schedule.fullCalendar('addEventSource', this.events); - } - this.initialized = true; - } - - ngDoCheck() { - let changes = this.differ.diff(this.events); - - if(this.schedule && changes) { - this.schedule.fullCalendar('removeEventSources'); - - if(this.events) { - this.schedule.fullCalendar('addEventSource', this.events); - } - } - } - - ngOnDestroy() { - jQuery(this.el.nativeElement.children[0]).fullCalendar('destroy'); - this.initialized = false; - this.schedule = null; - } - - gotoDate(date: any) { - this.schedule.fullCalendar('gotoDate', date); - } - - prev() { - this.schedule.fullCalendar('prev'); - } - - next() { - this.schedule.fullCalendar('next'); - } - - prevYear() { - this.schedule.fullCalendar('prevYear'); - } - - nextYear() { - this.schedule.fullCalendar('nextYear'); - } - - today() { - this.schedule.fullCalendar('today'); - } - - incrementDate(duration: any) { - this.schedule.fullCalendar('incrementDate', duration); - } - - changeView(viewName: string) { - this.schedule.fullCalendar('changeView', viewName); - } - - getDate() { - return this.schedule.fullCalendar('getDate'); - } - - updateEvent(event: any) { - this.schedule.fullCalendar('updateEvent', event); - } - - _findEvent(id: string) { - let event; - if(this.events) { - for(let e of this.events) { - if(e.id === id) { - event = e; - break; - } - } - } - return event; - } - - _updateEvent(event: any) { - let sourceEvent = this._findEvent(event.id); - if(sourceEvent) { - sourceEvent.start = event.start.format(); - if(event.end) { - sourceEvent.end = event.end.format(); - } - } - } -} - -@NgModule({ - imports: [CommonModule], - exports: [Schedule], - declarations: [Schedule] -}) -export class ScheduleModule { } diff --git a/dashboard/src/app/components/scrollpanel/scrollpanel.css b/dashboard/src/app/components/scrollpanel/scrollpanel.css deleted file mode 100644 index c44787c76..000000000 --- a/dashboard/src/app/components/scrollpanel/scrollpanel.css +++ /dev/null @@ -1,54 +0,0 @@ -.ui-scrollpanel-wrapper { - overflow: hidden; - width: 100%; - height: 100%; - position: relative; - z-index: 1; - float: left; -} - -.ui-scrollpanel-content { - height: calc(100% + 18px); - width: calc(100% + 18px); - padding: 0 0 0 0; - position: relative; - overflow: auto; - box-sizing: border-box; -} - -.ui-scrollpanel-bar { - position: relative; - background: #c1c1c1; - border-radius: 3px; - z-index: 2; - cursor: pointer; - opacity: 0; - transition: opacity 0.25s linear; -} - -.ui-scrollpanel-bar-y { - width: 9px; - top: 0; -} - -.ui-scrollpanel-bar-x { - height: 9px; - bottom: 0; -} - -.ui-scrollpanel-hidden { - visibility: hidden; -} - -.ui-scrollpanel:hover .ui-scrollpanel-bar, -.ui-scrollpanel:active .ui-scrollpanel-bar { - opacity: 1; -} - -.ui-scrollpanel-grabbed { - -o-user-select: none; - -ms-user-select: none; - -moz-user-select: none; - -webkit-user-select: none; - user-select: none; -} \ No newline at end of file diff --git a/dashboard/src/app/components/scrollpanel/scrollpanel.spec.ts b/dashboard/src/app/components/scrollpanel/scrollpanel.spec.ts deleted file mode 100644 index 092c92dc0..000000000 --- a/dashboard/src/app/components/scrollpanel/scrollpanel.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { ScrollPanel } from './scrollpanel'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('ScrollPanel', () => { - - let scrollpanel: ScrollPanel; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - ScrollPanel - ] - }); - - fixture = TestBed.createComponent(ScrollPanel); - scrollpanel = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/scrollpanel/scrollpanel.ts b/dashboard/src/app/components/scrollpanel/scrollpanel.ts deleted file mode 100644 index c404a21d0..000000000 --- a/dashboard/src/app/components/scrollpanel/scrollpanel.ts +++ /dev/null @@ -1,202 +0,0 @@ -import { NgModule, Component, Input, AfterViewInit, OnDestroy, ElementRef, NgZone, ViewChild } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { DomHandler } from '../dom/domhandler'; - -@Component({ - selector: 'p-scrollPanel', - template: ` -
-
-
- -
-
-
-
-
- `, - providers: [DomHandler] -}) -export class ScrollPanel implements AfterViewInit, OnDestroy { - - @Input() style: any; - - @Input() styleClass: string; - - constructor(public el: ElementRef, public zone: NgZone, public domHandler: DomHandler) {} - - @ViewChild('container') containerViewChild: ElementRef; - - @ViewChild('content') contentViewChild: ElementRef; - - @ViewChild('xBar') xBarViewChild: ElementRef; - - @ViewChild('yBar') yBarViewChild: ElementRef; - - scrollYRatio: number; - - scrollXRatio: number; - - timeoutFrame: any = (fn) => setTimeout(fn, 0); - - initialized: boolean; - - lastPageY: number; - - lastPageX: number; - - isXBarClicked: boolean; - - isYBarClicked: boolean; - - ngAfterViewInit() { - this.zone.runOutsideAngular(() => { - this.moveBar(); - this.moveBar = this.moveBar.bind(this); - this.onXBarMouseDown = this.onXBarMouseDown.bind(this); - this.onYBarMouseDown = this.onYBarMouseDown.bind(this); - this.onDocumentMouseMove = this.onDocumentMouseMove.bind(this); - this.onDocumentMouseUp = this.onDocumentMouseUp.bind(this); - - window.addEventListener('resize', this.moveBar); - this.contentViewChild.nativeElement.addEventListener('scroll', this.moveBar); - this.contentViewChild.nativeElement.addEventListener('mouseenter', this.moveBar); - this.xBarViewChild.nativeElement.addEventListener('mousedown', this.onXBarMouseDown); - this.yBarViewChild.nativeElement.addEventListener('mousedown', this.onYBarMouseDown); - this.initialized = true; - }); - } - - moveBar() { - let container = this.containerViewChild.nativeElement; - let content = this.contentViewChild.nativeElement; - - /* horizontal scroll */ - let xBar = this.xBarViewChild.nativeElement; - let totalWidth = content.scrollWidth; - let ownWidth = content.clientWidth; - let bottom = (container.clientHeight - xBar.clientHeight) * -1; - - this.scrollXRatio = ownWidth / totalWidth; - - /* vertical scroll */ - let yBar = this.yBarViewChild.nativeElement; - let totalHeight = content.scrollHeight; - let ownHeight = content.clientHeight; - let right = (container.clientWidth - yBar.clientWidth) * -1; - - this.scrollYRatio = ownHeight / totalHeight; - - this.requestAnimationFrame(() => { - if (this.scrollXRatio >= 1) { - this.domHandler.addClass(xBar, 'ui-scrollpanel-hidden'); - } - else { - this.domHandler.removeClass(xBar, 'ui-scrollpanel-hidden'); - xBar.style.cssText = 'width:' + Math.max(this.scrollXRatio * 100, 10) + '%; left:' + (content.scrollLeft / totalWidth) * 100 + '%;bottom:' + bottom + 'px;'; - } - - if (this.scrollYRatio >= 1) { - this.domHandler.addClass(yBar, 'ui-scrollpanel-hidden'); - } - else { - this.domHandler.removeClass(yBar, 'ui-scrollpanel-hidden'); - yBar.style.cssText = 'height:' + Math.max(this.scrollYRatio * 100, 10) + '%; top: calc(' + (content.scrollTop / totalHeight) * 100 + '% - ' + xBar.clientHeight + 'px);right:' + right + 'px;'; - } - }); - } - - onYBarMouseDown(e: MouseEvent) { - this.isYBarClicked = true; - this.lastPageY = e.pageY; - this.domHandler.addClass(this.yBarViewChild.nativeElement, 'ui-scrollpanel-grabbed'); - - this.domHandler.addClass(document.body, 'ui-scrollpanel-grabbed'); - - document.addEventListener('mousemove', this.onDocumentMouseMove); - document.addEventListener('mouseup', this.onDocumentMouseUp); - e.preventDefault(); - } - - onXBarMouseDown(e: MouseEvent) { - this.isXBarClicked = true; - this.lastPageX = e.pageX; - this.domHandler.addClass(this.xBarViewChild.nativeElement, 'ui-scrollpanel-grabbed'); - - this.domHandler.addClass(document.body, 'ui-scrollpanel-grabbed'); - - document.addEventListener('mousemove', this.onDocumentMouseMove); - document.addEventListener('mouseup', this.onDocumentMouseUp); - e.preventDefault(); - } - - onDocumentMouseMove(e: MouseEvent) { - if(this.isXBarClicked) { - this.onMouseMoveForXBar(e); - } - else if(this.isYBarClicked) { - this.onMouseMoveForYBar(e); - } - else { - this.onMouseMoveForXBar(e); - this.onMouseMoveForYBar(e); - } - - } - - onMouseMoveForXBar(e: MouseEvent) { - let deltaX = e.pageX - this.lastPageX; - this.lastPageX = e.pageX; - - this.requestAnimationFrame(() => { - this.contentViewChild.nativeElement.scrollLeft += deltaX / this.scrollXRatio; - }); - } - - onMouseMoveForYBar(e: MouseEvent) { - let deltaY = e.pageY - this.lastPageY; - this.lastPageY = e.pageY; - - this.requestAnimationFrame(() => { - this.contentViewChild.nativeElement.scrollTop += deltaY / this.scrollYRatio; - }); - } - - onDocumentMouseUp(e: Event) { - this.domHandler.removeClass(this.yBarViewChild.nativeElement, 'ui-scrollpanel-grabbed'); - this.domHandler.removeClass(this.xBarViewChild.nativeElement, 'ui-scrollpanel-grabbed'); - this.domHandler.removeClass(document.body, 'ui-scrollpanel-grabbed'); - - document.removeEventListener('mousemove', this.onDocumentMouseMove); - document.removeEventListener('mouseup', this.onDocumentMouseUp); - this.isXBarClicked = false; - this.isYBarClicked = false; - } - - requestAnimationFrame(f: Function) { - let frame = window.requestAnimationFrame || this.timeoutFrame; - frame(f); - } - - ngOnDestroy() { - if (this.initialized) { - window.removeEventListener('resize', this.moveBar); - this.contentViewChild.nativeElement.removeEventListener('scroll', this.moveBar); - this.contentViewChild.nativeElement.removeEventListener('mouseenter', this.moveBar); - this.xBarViewChild.nativeElement.removeEventListener('mousedown', this.onXBarMouseDown); - this.yBarViewChild.nativeElement.removeEventListener('mousedown', this.onYBarMouseDown); - } - } - - refresh() { - this.moveBar(); - } - -} - -@NgModule({ - imports: [CommonModule], - exports: [ScrollPanel], - declarations: [ScrollPanel] -}) -export class ScrollPanelModule { } diff --git a/dashboard/src/app/components/selectbutton/selectbutton.css b/dashboard/src/app/components/selectbutton/selectbutton.css deleted file mode 100644 index 58dba7378..000000000 --- a/dashboard/src/app/components/selectbutton/selectbutton.css +++ /dev/null @@ -1,19 +0,0 @@ -.ui-selectbutton { - display: inline-block; -} - -.ui-selectbutton.ui-state-error { - padding: 0; -} - -.ui-selectbutton .ui-button.ui-state-focus { - outline: none; -} - - -/* 自定义部分 */ - -.week-select-list { - width: 70px !important; - margin-right: 0.5em !important; -} \ No newline at end of file diff --git a/dashboard/src/app/components/selectbutton/selectbutton.spec.ts b/dashboard/src/app/components/selectbutton/selectbutton.spec.ts deleted file mode 100644 index 0ae95e0f3..000000000 --- a/dashboard/src/app/components/selectbutton/selectbutton.spec.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { TestBed, ComponentFixture, tick, fakeAsync } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { SelectButton } from './selectbutton'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('SelectButton', () => { - - let selectButton: SelectButton; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - SelectButton - ] - }); - - fixture = TestBed.createComponent(SelectButton); - selectButton = fixture.componentInstance; - }); - - it('should display the label', () => { - selectButton.options = [{label: 'Apartment', value: 'Apartment'},{label: 'House', value: 'House'},{label: 'Studio', value: 'Studio'}]; - fixture.detectChanges(); - const labelEl = fixture.debugElement.query(By.css('.ui-selectbutton')).children[0]; - expect(labelEl.nativeElement.querySelector('.ui-button-text').textContent).toContain('Apartment') - }); - - it('should display the preselected button', () => { - - selectButton.options = [{label: 'Apartment', value: {name:'Apartment'}},{label: 'House', value: {name:'House'}},{label: 'Studio', value: {name:'Studio'}}]; - selectButton.dataKey = 'name'; - selectButton.writeValue({name:'Studio'}); - fixture.detectChanges(); - - const active = fixture.nativeElement.querySelector('.ui-state-active').children[0]; - expect(active.textContent).toContain('Studio'); - }); - - it('should display the active when click', fakeAsync(() => { - selectButton.options = [{label: 'Apartment', value: 'Apartment'},{label: 'House', value: 'House'},{label: 'Studio', value: 'Studio'}]; - fixture.detectChanges(); - - const activeEl = fixture.nativeElement.querySelector('.ui-selectbutton').children[0]; - activeEl.click(); - - fixture.detectChanges(); - - const active = fixture.nativeElement.querySelector('.ui-state-active').children[0]; - expect(active.textContent).toContain('Apartment'); - })); -}); diff --git a/dashboard/src/app/components/selectbutton/selectbutton.ts b/dashboard/src/app/components/selectbutton/selectbutton.ts deleted file mode 100644 index d86c13386..000000000 --- a/dashboard/src/app/components/selectbutton/selectbutton.ts +++ /dev/null @@ -1,155 +0,0 @@ -import {NgModule,Component,Input,Output,EventEmitter,forwardRef,ChangeDetectorRef} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {SelectItem} from '../common/selectitem'; -import {ObjectUtils} from '../utils/objectutils'; -import {NG_VALUE_ACCESSOR, ControlValueAccessor} from '@angular/forms'; - -export const SELECTBUTTON_VALUE_ACCESSOR: any = { - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => SelectButton), - multi: true -}; - -@Component({ - selector: 'p-selectButton', - template: ` -
-
- - {{option.label||'ui-btn'}} -
- -
-
-
- `, - providers: [ObjectUtils,SELECTBUTTON_VALUE_ACCESSOR] -}) -export class SelectButton implements ControlValueAccessor { - - @Input() tabindex: number; - - @Input() multiple: boolean; - - @Input() style: any; - - @Input() styleClass: string; - - @Input() disabled: boolean; - - @Input() dataKey: string - - @Input() optionLabel: string; - - @Output() onOptionClick: EventEmitter = new EventEmitter(); - - @Output() onChange: EventEmitter = new EventEmitter(); - - value: any; - - focusedItem: HTMLInputElement; - - _options: any[]; - - onModelChange: Function = () => {}; - - onModelTouched: Function = () => {}; - - constructor(public objectUtils: ObjectUtils, private cd: ChangeDetectorRef) {} - - @Input() get options(): any[] { - return this._options; - } - - set options(val: any[]) { - let opts = this.optionLabel ? this.objectUtils.generateSelectItems(val, this.optionLabel) : val; - this._options = opts; - } - - writeValue(value: any) : void { - this.value = value; - this.cd.markForCheck(); - } - - registerOnChange(fn: Function): void { - this.onModelChange = fn; - } - - registerOnTouched(fn: Function): void { - this.onModelTouched = fn; - } - - setDisabledState(val: boolean): void { - this.disabled = val; - } - - onItemClick(event, option: SelectItem, checkbox: HTMLInputElement, index: number) { - if(this.disabled) { - return; - } - - checkbox.focus(); - - if(this.multiple) { - let itemIndex = this.findItemIndex(option); - if(itemIndex != -1) - this.value = this.value.filter((val,i) => i!=itemIndex); - else - this.value = [...this.value||[], option.value]; - } - else { - this.value = option.value; - } - - this.onOptionClick.emit({ - originalEvent: event, - option: option, - index: index - }); - - this.onModelChange(this.value); - - this.onChange.emit({ - originalEvent: event, - value: this.value - }); - } - - onFocus(event: Event) { - this.focusedItem = event.target; - } - - onBlur(event) { - this.focusedItem = null; - this.onModelTouched(); - } - - isSelected(option: SelectItem) { - if(this.multiple) - return this.findItemIndex(option) != -1; - else - return this.objectUtils.equals(option.value, this.value, this.dataKey); - } - - findItemIndex(option: SelectItem) { - let index = -1; - if(this.value) { - for(let i = 0; i < this.value.length; i++) { - if(this.value[i] == option.value) { - index = i; - break; - } - } - } - return index; - } -} - -@NgModule({ - imports: [CommonModule], - exports: [SelectButton], - declarations: [SelectButton] -}) -export class SelectButtonModule { } diff --git a/dashboard/src/app/components/sidebar/sidebar.css b/dashboard/src/app/components/sidebar/sidebar.css deleted file mode 100644 index 49848fd98..000000000 --- a/dashboard/src/app/components/sidebar/sidebar.css +++ /dev/null @@ -1,117 +0,0 @@ -.ui-sidebar { - position: fixed; - padding: .5em 1em; - -webkit-transition: transform .3s; - transition: transform .3s; -} - -.ui-sidebar-left { - top: 0; - left: 0; - width: 20em; - height: 100%; - -webkit-transform: translateX(-100%); - -ms-transform: translateX(-100%); - transform: translateX(-100%); -} - -.ui-sidebar-right { - top: 0; - right: 0; - width: 20em; - height: 100%; - -webkit-transform: translateX(100%); - -ms-transform: translateX(100%); - transform: translateX(100%); -} - -.ui-sidebar-top { - top: 0; - left: 0; - width: 100%; - height: 10em; - -webkit-transform: translateY(-100%); - -ms-transform: translateY(-100%); - transform: translateY(-100%); -} - -.ui-sidebar-bottom { - bottom: 0; - left: 0; - width: 100%; - height: 10em; - -webkit-transform: translateY(100%); - -ms-transform: translateY(100%); - transform: translateY(100%); -} - -.ui-sidebar-full { - width: 100%; - height: 100%; - left: 0; - -webkit-transition: transform 0s; - transition: transform 0s; -} - -.ui-sidebar-left.ui-sidebar-active, -.ui-sidebar-right.ui-sidebar-active { - -webkit-transform: translateX(0); - -ms-transform: translateX(0); - transform: translateX(0) -} - -.ui-sidebar-left.ui-sidebar-sm, -.ui-sidebar-right.ui-sidebar-sm { - width: 20em; -} - -.ui-sidebar-left.ui-sidebar-md, -.ui-sidebar-right.ui-sidebar-md { - width: 40em; -} - -.ui-sidebar-left.ui-sidebar-lg, -.ui-sidebar-right.ui-sidebar-lg { - width: 60em; -} - -.ui-sidebar-top.ui-sidebar-active, -.ui-sidebar-bottom.ui-sidebar-active { - -webkit-transform: translateY(0); - -ms-transform: translateY(0); - transform: translateY(0) -} - -.ui-sidebar-top.ui-sidebar-sm, -.ui-sidebar-bottom.ui-sidebar-sm { - height: 10em; -} - -.ui-sidebar-top.ui-sidebar-md, -.ui-sidebar-bottom.ui-sidebar-md { - height: 20em; -} - -.ui-sidebar-top.ui-sidebar-lg, -.ui-sidebar-bottom.ui-sidebar-lg { - height: 30em; -} - -.ui-sidebar-mask { - position: fixed; - width: 100%; - height: 100%; -} - -.ui-sidebar-close { - float: right; -} - -@media screen and (max-width: 64em) { - .ui-sidebar-left.ui-sidebar-lg, - .ui-sidebar-left.ui-sidebar-md, - .ui-sidebar-right.ui-sidebar-lg, - .ui-sidebar-right.ui-sidebar-md { - width: 20em; - } -} \ No newline at end of file diff --git a/dashboard/src/app/components/sidebar/sidebar.spec.ts b/dashboard/src/app/components/sidebar/sidebar.spec.ts deleted file mode 100644 index 359a481c1..000000000 --- a/dashboard/src/app/components/sidebar/sidebar.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { Sidebar } from './sidebar'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('Sidebar', () => { - - let sidebar: Sidebar; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - Sidebar - ] - }); - - fixture = TestBed.createComponent(Sidebar); - sidebar = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/sidebar/sidebar.ts b/dashboard/src/app/components/sidebar/sidebar.ts deleted file mode 100644 index cdf400d81..000000000 --- a/dashboard/src/app/components/sidebar/sidebar.ts +++ /dev/null @@ -1,188 +0,0 @@ -import {NgModule,Component,AfterViewInit,AfterViewChecked,OnDestroy,Input,Output,EventEmitter,ViewChild,ElementRef,Renderer2} from '@angular/core'; -import {trigger, state, style, transition, animate} from '@angular/animations'; -import {CommonModule} from '@angular/common'; -import {DomHandler} from '../dom/domhandler'; - -@Component({ - selector: 'p-sidebar', - template: ` -
- - - - -
- `, - animations: [ - trigger('panelState', [ - state('hidden', style({ - opacity: 0 - })), - state('visible', style({ - opacity: 1 - })), - transition('visible => hidden', animate('300ms ease-in')), - transition('hidden => visible', animate('300ms ease-out')) - ]) - ], - providers: [DomHandler] -}) -export class Sidebar implements AfterViewInit, AfterViewChecked, OnDestroy { - - @Input() position: string = 'left'; - - @Input() fullScreen: boolean; - - @Input() appendTo: string; - - @Input() blockScroll: boolean = false; - - @Input() style: any; - - @Input() styleClass: string; - - @Input() autoZIndex: boolean = true; - - @Input() baseZIndex: number = 0; - - @ViewChild('container') containerViewChild: ElementRef; - - @Output() onShow: EventEmitter = new EventEmitter(); - - @Output() onHide: EventEmitter = new EventEmitter(); - - @Output() visibleChange:EventEmitter = new EventEmitter(); - - initialized: boolean; - - _visible: boolean; - - preventVisibleChangePropagation: boolean; - - mask: HTMLDivElement; - - maskClickListener: Function; - - executePostDisplayActions: boolean; - - constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer2) {} - - ngAfterViewInit() { - this.initialized = true; - - if(this.appendTo) { - if(this.appendTo === 'body') - document.body.appendChild(this.containerViewChild.nativeElement); - else - this.domHandler.appendChild(this.containerViewChild.nativeElement, this.appendTo); - } - - if(this.visible) { - this.show(); - } - } - - @Input() get visible(): boolean { - return this._visible; - } - - set visible(val:boolean) { - this._visible = val; - - if(this.initialized && this.containerViewChild && this.containerViewChild.nativeElement) { - if(this._visible) - this.show(); - else { - if(this.preventVisibleChangePropagation) - this.preventVisibleChangePropagation = false; - else - this.hide(); - } - } - } - - ngAfterViewChecked() { - if(this.executePostDisplayActions) { - this.onShow.emit({}); - this.executePostDisplayActions = false; - } - } - - show() { - this.executePostDisplayActions = true; - if(this.autoZIndex) { - this.containerViewChild.nativeElement.style.zIndex = String(this.baseZIndex + (++DomHandler.zindex)); - } - this.enableModality(); - } - - hide() { - this.onHide.emit({}); - this.disableModality(); - } - - close(event: Event) { - this.preventVisibleChangePropagation = true; - this.hide(); - this.visibleChange.emit(false); - event.preventDefault(); - } - - enableModality() { - if(!this.mask) { - this.mask = document.createElement('div'); - this.mask.style.zIndex = String(parseInt(this.containerViewChild.nativeElement.style.zIndex) - 1); - this.domHandler.addMultipleClasses(this.mask, 'ui-widget-overlay ui-sidebar-mask'); - this.maskClickListener = this.renderer.listen(this.mask, 'click', (event: any) => { - this.close(event); - }); - document.body.appendChild(this.mask); - if(this.blockScroll) { - this.domHandler.addClass(document.body, 'ui-overflow-hidden'); - } - } - } - - disableModality() { - if(this.mask) { - this.unbindMaskClickListener(); - document.body.removeChild(this.mask); - if(this.blockScroll) { - this.domHandler.removeClass(document.body, 'ui-overflow-hidden'); - } - this.mask = null; - } - } - - unbindMaskClickListener() { - if(this.maskClickListener) { - this.maskClickListener(); - this.maskClickListener = null; - } - } - - ngOnDestroy() { - this.initialized = false; - - if(this.visible) { - this.hide(); - } - - if(this.appendTo) { - this.el.nativeElement.appendChild(this.containerViewChild.nativeElement); - } - - this.unbindMaskClickListener(); - } -} - -@NgModule({ - imports: [CommonModule], - exports: [Sidebar], - declarations: [Sidebar] -}) -export class SidebarModule { } diff --git a/dashboard/src/app/components/slidemenu/slidemenu.css b/dashboard/src/app/components/slidemenu/slidemenu.css deleted file mode 100644 index fa05ac8e6..000000000 --- a/dashboard/src/app/components/slidemenu/slidemenu.css +++ /dev/null @@ -1,86 +0,0 @@ -.ui-slidemenu { - width: 12.5em; - padding: .25em; -} - -.ui-slidemenu.ui-slidemenu-dynamic { - position: absolute; - display: none; -} - -.ui-slidemenu .ui-menu-separator { - border-width: 1px 0 0 0; -} - -.ui-slidemenu ul { - list-style: none; - margin: 0; - padding: 0; -} - -.ui-slidemenu .ui-slidemenu-rootlist { - position: absolute; - top: 0; -} - -.ui-slidemenu .ui-submenu-list { - display: none; - position: absolute; - top: 0; - width: 12.5em; - padding: .25em; -} - -.ui-slidemenu .ui-menuitem-link { - padding: .25em; - display: block; - position: relative; - text-decoration: none; -} - -.ui-slidemenu .ui-menuitem { - position: relative; - margin: .125em 0; -} - -.ui-slidemenu .ui-menuitem-link .ui-submenu-icon { - position: absolute; - margin-top: -.5em; - right: 0; - top: 50%; -} - -.ui-slidemenu .ui-slidemenu-wrapper { - position: relative; -} - -.ui-slidemenu .ui-slidemenu-content { - overflow-x: hidden; - overflow-y: auto; - position: relative; -} - -.ui-slidemenu-backward { - position: absolute; - bottom: 0; - width: 100%; - padding: 0.25em; - cursor: pointer; - display: none; -} - -.ui-slidemenu-backward .ui-slidemenu-backward-icon { - vertical-align: middle; -} - -.ui-slidemenu-backward span { - vertical-align: middle; -} - -.ui-slidemenu .ui-menuitem-active { - position: static; -} - -.ui-slidemenu .ui-menuitem-active > .ui-submenu > .ui-submenu-list { - display: block; -} diff --git a/dashboard/src/app/components/slidemenu/slidemenu.spec.ts b/dashboard/src/app/components/slidemenu/slidemenu.spec.ts deleted file mode 100644 index f7f26bd6f..000000000 --- a/dashboard/src/app/components/slidemenu/slidemenu.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { SlideMenu } from './slidemenu'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('SlideMenu', () => { - - let slidemenu: SlideMenu; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - SlideMenu - ] - }); - - fixture = TestBed.createComponent(SlideMenu); - slidemenu = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/slidemenu/slidemenu.ts b/dashboard/src/app/components/slidemenu/slidemenu.ts deleted file mode 100644 index 15b5acd33..000000000 --- a/dashboard/src/app/components/slidemenu/slidemenu.ts +++ /dev/null @@ -1,228 +0,0 @@ -import {NgModule,Component,ElementRef,AfterViewInit,OnDestroy,Input,Output,Renderer2,Inject,forwardRef,ViewChild} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {DomHandler} from '../dom/domhandler'; -import {MenuItem} from '../common/menuitem'; -import {Location} from '@angular/common'; -import {RouterModule} from '@angular/router'; - -@Component({ - selector: 'p-slideMenuSub', - template: ` - - ` -}) -export class SlideMenuSub implements OnDestroy { - - @Input() item: MenuItem; - - @Input() root: boolean; - - @Input() backLabel: string = 'Back'; - - @Input() menuWidth: string; - - @Input() effectDuration: any; - - @Input() easing: string = 'ease-out'; - - constructor(@Inject(forwardRef(() => SlideMenu)) public slideMenu: SlideMenu) {} - - activeItem: any; - - itemClick(event, item: MenuItem, listitem: any) { - if(item.disabled) { - event.preventDefault(); - return; - } - - if(!item.url) { - event.preventDefault(); - } - - if(item.command) { - item.command({ - originalEvent: event, - item: item - }); - } - - if(item.items && !this.slideMenu.animating) { - this.slideMenu.left -= this.slideMenu.menuWidth; - this.activeItem = listitem; - this.slideMenu.animating = true; - setTimeout(() => this.slideMenu.animating = false, this.effectDuration); - } - } - - ngOnDestroy() { - this.activeItem = null; - } -} - -@Component({ - selector: 'p-slideMenu', - template: ` -
-
-
- -
-
- {{backLabel}} -
-
-
- `, - providers: [DomHandler] -}) -export class SlideMenu implements AfterViewInit,OnDestroy { - - @Input() model: MenuItem[]; - - @Input() popup: boolean; - - @Input() style: any; - - @Input() styleClass: string; - - @Input() menuWidth: number = 190; - - @Input() viewportHeight: number = 180; - - @Input() effectDuration: any = 250; - - @Input() easing: string = 'ease-out'; - - @Input() backLabel: string = 'Back'; - - @Input() appendTo: any; - - @Input() autoZIndex: boolean = true; - - @Input() baseZIndex: number = 0; - - @ViewChild('container') containerViewChild: ElementRef; - - @ViewChild('backward') backwardViewChild: ElementRef; - - @ViewChild('slideMenuContent') slideMenuContentViewChild: ElementRef; - - public container: HTMLDivElement; - - public backwardElement: HTMLDivElement; - - public slideMenuContentElement: HTMLDivElement; - - public documentClickListener: any; - - public preventDocumentDefault: any; - - public left: number = 0; - - public animating: boolean = false; - - constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer2) {} - - ngAfterViewInit() { - this.container = this.containerViewChild.nativeElement; - this.backwardElement = this.backwardViewChild.nativeElement; - this.slideMenuContentElement = this.slideMenuContentViewChild.nativeElement; - this.slideMenuContentElement.style.height = this.viewportHeight - this.domHandler.getHiddenElementOuterHeight(this.backwardElement) + 'px'; - - if(this.popup) { - if(this.appendTo) { - if(this.appendTo === 'body') - document.body.appendChild(this.container); - else - this.domHandler.appendChild(this.container, this.appendTo); - } - - this.documentClickListener = this.renderer.listen('document', 'click', () => { - if(!this.preventDocumentDefault) { - this.hide(); - } - this.preventDocumentDefault = false; - }); - } - } - - toggle(event) { - if(this.container.offsetParent) - this.hide(); - else - this.show(event); - } - - show(event) { - this.preventDocumentDefault = true; - this.moveOnTop(); - this.container.style.display = 'block'; - this.domHandler.absolutePosition(this.container, event.target); - this.domHandler.fadeIn(this.container, 250); - } - - hide() { - this.container.style.display = 'none'; - } - - moveOnTop() { - if(this.autoZIndex) { - this.container.style.zIndex = String(this.baseZIndex + (++DomHandler.zindex)); - } - } - - onClick(event) { - this.preventDocumentDefault = true; - } - - goBack() { - this.left += this.menuWidth; - } - - ngOnDestroy() { - if(this.popup) { - if(this.documentClickListener) { - this.documentClickListener(); - } - - if(this.appendTo) { - this.el.nativeElement.appendChild(this.container); - } - } - } - -} - -@NgModule({ - imports: [CommonModule,RouterModule], - exports: [SlideMenu,RouterModule], - declarations: [SlideMenu,SlideMenuSub] -}) -export class SlideMenuModule { } diff --git a/dashboard/src/app/components/slider/slider.css b/dashboard/src/app/components/slider/slider.css deleted file mode 100644 index 00dafd730..000000000 --- a/dashboard/src/app/components/slider/slider.css +++ /dev/null @@ -1,65 +0,0 @@ -.ui-slider { - position: relative; - text-align: left; -} -.ui-slider .ui-slider-handle { - position: absolute; - width: 1.2em; - height: 1.2em; - cursor: default; - -ms-touch-action: none; - touch-action: none; - z-index: 1; -} -.ui-slider .ui-slider-handle.ui-slider-handle-active { - z-index: 2; -} -.ui-slider .ui-slider-range { - position: absolute; - font-size: .7em; - display: block; - border: 0; - background-position: 0 0; -} - -.ui-slider-horizontal { - height: .8em; -} -.ui-slider-horizontal .ui-slider-handle { - top: -.25em; - margin-left: -.6em; -} -.ui-slider-horizontal .ui-slider-range { - top: 0; - height: 100%; -} -.ui-slider-horizontal .ui-slider-range-min { - left: 0; -} -.ui-slider-horizontal .ui-slider-range-max { - right: 0; -} - -.ui-slider-vertical { - width: .8em; - height: 100px; -} -.ui-slider-vertical .ui-slider-handle { - left: -.25em; - margin-left: 0; - margin-bottom: -.6em; -} -.ui-slider-vertical .ui-slider-range { - left: 0; - width: 100%; -} -.ui-slider-vertical .ui-slider-range-min { - bottom: 0; -} -.ui-slider-vertical .ui-slider-range-max { - top: 0; -} - -.ui-slider-animate .ui-slider-handle { - transition: left .3s; -} \ No newline at end of file diff --git a/dashboard/src/app/components/slider/slider.spec.ts b/dashboard/src/app/components/slider/slider.spec.ts deleted file mode 100644 index f8684b76b..000000000 --- a/dashboard/src/app/components/slider/slider.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { Slider } from './slider'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('Slider', () => { - - let slider: Slider; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - Slider - ] - }); - - fixture = TestBed.createComponent(Slider); - slider = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/slider/slider.ts b/dashboard/src/app/components/slider/slider.ts deleted file mode 100644 index f4cdf2c90..000000000 --- a/dashboard/src/app/components/slider/slider.ts +++ /dev/null @@ -1,369 +0,0 @@ -import { - NgModule, Component, ElementRef, OnDestroy, Input, Output, SimpleChange, EventEmitter, forwardRef, Renderer2, - NgZone -} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {DomHandler} from '../dom/domhandler'; -import {NG_VALUE_ACCESSOR, ControlValueAccessor} from '@angular/forms'; - -export const SLIDER_VALUE_ACCESSOR: any = { - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => Slider), - multi: true -}; - -@Component({ - selector: 'p-slider', - template: ` -
- - - - - - - -
- `, - providers: [SLIDER_VALUE_ACCESSOR,DomHandler] -}) -export class Slider implements OnDestroy,ControlValueAccessor { - - @Input() animate: boolean; - - @Input() disabled: boolean; - - @Input() min: number = 0; - - @Input() max: number = 100; - - @Input() orientation: string = 'horizontal'; - - @Input() step: number; - - @Input() range: boolean; - - @Input() style: any; - - @Input() styleClass: string; - - @Output() onChange: EventEmitter = new EventEmitter(); - - @Output() onSlideEnd: EventEmitter = new EventEmitter(); - - public value: number; - - public values: number; - - public handleValue: number; - - public handleValues: number[] = []; - - public onModelChange: Function = () => {}; - - public onModelTouched: Function = () => {}; - - public dragging: boolean; - - public dragListener: any; - - public mouseupListener: any; - - public initX: number; - - public initY: number; - - public barWidth: number; - - public barHeight: number; - - public sliderHandleClick: boolean; - - public handleIndex: number = 0; - - public startHandleValue: any; - - public startx: number; - - public starty: number; - - constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer2, private ngZone: NgZone) {} - - onMouseDown(event:Event, index?:number) { - if(this.disabled) { - return; - } - - this.dragging = true; - this.updateDomData(); - this.sliderHandleClick = true; - this.handleIndex = index; - this.bindDragListeners(); - event.preventDefault(); - } - - onTouchStart(event, index?:number) { - var touchobj = event.changedTouches[0]; - this.startHandleValue = (this.range) ? this.handleValues[index] : this.handleValue; - this.dragging = true; - this.handleIndex = index; - - if (this.orientation === 'horizontal') { - this.startx = parseInt(touchobj.clientX, 10); - this.barWidth = this.el.nativeElement.children[0].offsetWidth; - } - else { - this.starty = parseInt(touchobj.clientY, 10); - this.barHeight = this.el.nativeElement.children[0].offsetHeight; - } - - event.preventDefault(); - } - - onTouchMove(event, index?:number) { - var touchobj = event.changedTouches[0], - handleValue = 0; - - if (this.orientation === 'horizontal') { - handleValue = Math.floor(((parseInt(touchobj.clientX, 10) - this.startx) * 100) / (this.barWidth)) + this.startHandleValue; - } - else { - handleValue = Math.floor(((this.starty - parseInt(touchobj.clientY, 10)) * 100) / (this.barHeight)) + this.startHandleValue; - } - - this.setValueFromHandle(event, handleValue); - - event.preventDefault(); - } - - onBarClick(event) { - if(this.disabled) { - return; - } - - if(!this.sliderHandleClick) { - this.updateDomData(); - this.handleChange(event); - } - - this.sliderHandleClick = false; - } - - handleChange(event: Event) { - let handleValue = this.calculateHandleValue(event); - this.setValueFromHandle(event, handleValue); - } - - bindDragListeners() { - this.ngZone.runOutsideAngular(() => { - if (!this.dragListener) { - this.dragListener = this.renderer.listen('document', 'mousemove', (event) => { - if (this.dragging) { - this.ngZone.run(() => { - this.handleChange(event); - }); - } - }); - } - - if (!this.mouseupListener) { - this.mouseupListener = this.renderer.listen('document', 'mouseup', (event) => { - if (this.dragging) { - this.dragging = false; - this.ngZone.run(() => { - if (this.range) { - this.onSlideEnd.emit({originalEvent: event, values: this.values}); - } else { - this.onSlideEnd.emit({originalEvent: event, value: this.value}); - } - }); - } - }); - } - }); - } - - unbindDragListeners() { - if(this.dragListener) { - this.dragListener(); - } - - if(this.mouseupListener) { - this.mouseupListener(); - } - } - - setValueFromHandle(event: Event, handleValue: any) { - let newValue = this.getValueFromHandle(handleValue); - - if(this.range) { - if(this.step) { - this.handleStepChange(newValue, this.values[this.handleIndex]); - } - else { - this.handleValues[this.handleIndex] = handleValue; - this.updateValue(newValue, event); - } - } - else { - if(this.step) { - this.handleStepChange(newValue, this.value); - } - else { - this.handleValue = handleValue; - this.updateValue(newValue, event); - } - } - } - - handleStepChange(newValue: number, oldValue: number) { - let diff = (newValue - oldValue); - let val = oldValue; - - if(diff < 0) { - val = oldValue + Math.ceil((newValue - oldValue) / this.step) * this.step; - } - else if(diff > 0) { - val = oldValue + Math.floor((newValue - oldValue) / this.step) * this.step; - } - - this.updateValue(val); - this.updateHandleValue(); - } - - writeValue(value: any) : void { - if(this.range) - this.values = value||[0,0]; - else - this.value = value||0; - - this.updateHandleValue(); - } - - registerOnChange(fn: Function): void { - this.onModelChange = fn; - } - - registerOnTouched(fn: Function): void { - this.onModelTouched = fn; - } - - setDisabledState(val: boolean): void { - this.disabled = val; - } - - get rangeStartLeft() { - return this.isVertical() ? 'auto' : this.handleValues[0] + '%'; - } - - get rangeStartBottom() { - return this.isVertical() ? this.handleValues[0] + '%' : 'auto'; - } - - get rangeEndLeft() { - return this.isVertical() ? 'auto' : this.handleValues[1] + '%'; - } - - get rangeEndBottom() { - return this.isVertical() ? this.handleValues[1] + '%' : 'auto'; - } - - isVertical(): boolean { - return this.orientation === 'vertical'; - } - - updateDomData(): void { - let rect = this.el.nativeElement.children[0].getBoundingClientRect(); - this.initX = rect.left + this.domHandler.getWindowScrollLeft(); - this.initY = rect.top + this.domHandler.getWindowScrollTop(); - this.barWidth = this.el.nativeElement.children[0].offsetWidth; - this.barHeight = this.el.nativeElement.children[0].offsetHeight; - } - - calculateHandleValue(event): number { - if(this.orientation === 'horizontal') - return ((event.pageX - this.initX) * 100) / (this.barWidth); - else - return(((this.initY + this.barHeight) - event.pageY) * 100) / (this.barHeight); - } - - updateHandleValue(): void { - if(this.range) { - this.handleValues[0] = (this.values[0] < this.min ? 0 : this.values[0] - this.min) * 100 / (this.max - this.min); - this.handleValues[1] = (this.values[1] > this.max ? 100 : this.values[1] - this.min) * 100 / (this.max - this.min); - } - else { - if(this.value < this.min) - this.handleValue = 0; - else if(this.value > this.max) - this.handleValue = 100; - else - this.handleValue = (this.value - this.min) * 100 / (this.max - this.min); - } - } - - updateValue(val: number, event?: Event): void { - if(this.range) { - let value = val; - - if(this.handleIndex == 0) { - if(value < this.min) { - value = this.min; - this.handleValues[0] = 0; - } - else if (value > this.values[1]) { - value = this.values[1]; - this.handleValues[0] = this.handleValues[1]; - } - } - else { - if(value > this.max) { - value = this.max; - this.handleValues[1] = 100; - } - else if (value < this.values[0]) { - value = this.values[0]; - this.handleValues[1] = this.handleValues[0]; - } - } - - this.values[this.handleIndex] = Math.floor(value); - this.onModelChange(this.values); - this.onChange.emit({event: event, values: this.values}); - } - else { - if(val < this.min) { - val = this.min; - this.handleValue = 0; - } - else if (val > this.max) { - val = this.max; - this.handleValue = 100; - } - - this.value = Math.floor(val); - this.onModelChange(this.value); - this.onChange.emit({event: event, value: this.value}); - } - } - - getValueFromHandle(handleValue: number): number { - return (this.max - this.min) * (handleValue / 100) + this.min; - } - - ngOnDestroy() { - this.unbindDragListeners(); - } -} - -@NgModule({ - imports: [CommonModule], - exports: [Slider], - declarations: [Slider] -}) -export class SliderModule { } diff --git a/dashboard/src/app/components/spinner/spinner.css b/dashboard/src/app/components/spinner/spinner.css deleted file mode 100644 index 90b58fd87..000000000 --- a/dashboard/src/app/components/spinner/spinner.css +++ /dev/null @@ -1,72 +0,0 @@ -.ui-spinner { - display: inline-block; - overflow: visible; - padding: 0; - position: relative; - vertical-align: middle; -} - -.ui-spinner-input { - vertical-align: middle; - padding-right: 1.5em; -} - -.ui-spinner-button { - cursor: default; - display: block; - height: 50%; - margin: 0 !important; - /* !important 覆盖掉.ui-button 给的样式*/ - overflow: hidden; - padding: 0 !important; - /* !important 覆盖掉.ui-button 给的样式*/ - position: absolute !important; - /* !important 覆盖掉.ui-button 给的样式*/ - right: 0; - text-align: center !important; - /* 覆盖掉.ui-button 给的样式*/ - vertical-align: middle; - width: 1.5em; - min-width: 2em !important; - /* 覆盖掉.ui-button 给的样式*/ - border-radius: 0 !important; - /* 覆盖掉.ui-button 给的样式*/ -} - -.ui-spinner .fa { - position: absolute; - top: 50%; - left: 50%; - margin-top: -.5em; - margin-left: -.5em; - width: 1em; -} - -.ui-spinner-up { - top: 0; -} - -.ui-spinner-down { - bottom: 0; -} - - -/* Fluid */ - -.ui-fluid .ui-spinner { - width: 100%; -} - -.ui-fluid .ui-spinner .ui-spinner-input { - padding-right: 2em; - width: 100%; -} - -.ui-fluid .ui-spinner .ui-spinner-button { - width: 1.5em; -} - -.ui-fluid .ui-spinner .ui-spinner-button .fa { - left: 50%; - /* 避免上下箭头没有居中 */ -} \ No newline at end of file diff --git a/dashboard/src/app/components/spinner/spinner.spec.ts b/dashboard/src/app/components/spinner/spinner.spec.ts deleted file mode 100644 index 6938eef49..000000000 --- a/dashboard/src/app/components/spinner/spinner.spec.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { Spinner } from './spinner'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('Spinner', () => { - - let spinner: Spinner; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - Spinner - ] - }); - - fixture = TestBed.createComponent(Spinner); - spinner = fixture.componentInstance; - }); - - const triggerEvent = (el, type) => { - const e = document.createEvent('HTMLEvents'); - e.initEvent(type, false, true); - el.dispatchEvent(e); - }; - - it('should have value as 3 when up clicked 3 times', () => { - fixture.detectChanges(); - const spinnerUp = fixture.nativeElement.querySelector('.ui-spinner-up'); - triggerEvent(spinnerUp, 'mousedown'); - triggerEvent(spinnerUp, 'mousedown'); - triggerEvent(spinnerUp, 'mousedown'); - fixture.detectChanges(); - - expect(spinner.value).toBe(3); - expect(spinner.valueAsString).toBe('3'); - }); - - it('should have value as -3 when down clicked 3 times', () => { - fixture.detectChanges(); - const spinnerDown = fixture.nativeElement.querySelector('.ui-spinner-down'); - triggerEvent(spinnerDown, 'mousedown'); - triggerEvent(spinnerDown, 'mousedown'); - triggerEvent(spinnerDown, 'mousedown'); - fixture.detectChanges(); - - expect(spinner.value).toBe(-3); - expect(spinner.valueAsString).toBe('-3'); - }); - - it('Should display the spinner value 0.75 ', () => { - spinner.step = 0.25; - fixture.detectChanges(); - - const spinnerUp = fixture.nativeElement.querySelector('.ui-spinner-up'); - triggerEvent(spinnerUp, 'mousedown'); - triggerEvent(spinnerUp, 'mousedown'); - triggerEvent(spinnerUp, 'mousedown'); - - expect(spinner.value).toEqual(0.75); - expect(spinner.valueAsString).toEqual('0.75'); - }); -}); diff --git a/dashboard/src/app/components/spinner/spinner.ts b/dashboard/src/app/components/spinner/spinner.ts deleted file mode 100644 index f1a223531..000000000 --- a/dashboard/src/app/components/spinner/spinner.ts +++ /dev/null @@ -1,316 +0,0 @@ -import {NgModule,Component,ElementRef,OnInit,Input,Output,EventEmitter,forwardRef,ViewChild} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {InputTextModule} from '../inputtext/inputtext'; -import {DomHandler} from '../dom/domhandler'; -import {NG_VALUE_ACCESSOR, ControlValueAccessor} from '@angular/forms'; - -export const SPINNER_VALUE_ACCESSOR: any = { - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => Spinner), - multi: true -}; - -@Component({ - selector: 'p-spinner', - template: ` - - - - - - `, - host: { - '[class.ui-inputwrapper-filled]': 'filled', - '[class.ui-inputwrapper-focus]': 'focus' - }, - providers: [DomHandler,SPINNER_VALUE_ACCESSOR], -}) -export class Spinner implements OnInit,ControlValueAccessor { - - @Output() onChange: EventEmitter = new EventEmitter(); - - @Output() onFocus: EventEmitter = new EventEmitter(); - - @Output() onBlur: EventEmitter = new EventEmitter(); - - @Input() step: number = 1; - - @Input() min: number; - - @Input() max: number; - - @Input() maxlength: number; - - @Input() size: number; - - @Input() placeholder: string; - - @Input() inputId: string; - - @Input() disabled: boolean; - - @Input() readonly: boolean; - - @Input() decimalSeparator: string = '.'; - - @Input() thousandSeparator: string = ','; - - @Input() tabindex: number; - - @Input() formatInput: boolean = true; - - @Input() type: string = 'text'; - - @Input() required: boolean; - - value: number; - - valueAsString: string = ''; - - onModelChange: Function = () => {}; - - onModelTouched: Function = () => {}; - - keyPattern: RegExp = /[0-9\+\-]/; - - public precision: number; - - public timer: any; - - public focus: boolean; - - public filled: boolean; - - @ViewChild('inputfield') inputfieldViewChild: ElementRef; - - constructor(public el: ElementRef, public domHandler: DomHandler) {} - - ngOnInit() { - if(Math.floor(this.step) === 0) { - this.precision = this.step.toString().split(/[,]|[.]/)[1].length; - } - } - - repeat(event: Event, interval: number, dir: number) { - let i = interval||500; - - this.clearTimer(); - this.timer = setTimeout(() => { - this.repeat(event, 40, dir); - }, i); - - this.spin(event, dir); - } - - spin(event: Event, dir: number) { - let step = this.step * dir; - let currentValue = this.value||0; - let newValue: number = null; - - if(this.precision) - this.value = parseFloat(this.toFixed(currentValue + step, this.precision)); - else - this.value = currentValue + step; - - if(this.maxlength !== undefined && this.value.toString().length > this.maxlength) { - this.value = currentValue; - } - - if(this.min !== undefined && this.value < this.min) { - this.value = this.min; - } - - if(this.max !== undefined && this.value > this.max) { - this.value = this.max; - } - - this.formatValue(); - this.onModelChange(this.value); - this.onChange.emit(event); - } - - toFixed(value: number, precision: number) { - let power = Math.pow(10, precision||0); - return String(Math.round(value * power) / power); - } - - onUpButtonMousedown(event: Event) { - if(!this.disabled) { - this.inputfieldViewChild.nativeElement.focus(); - this.repeat(event, null, 1); - this.updateFilledState(); - } - } - - onUpButtonMouseup(event: Event) { - if(!this.disabled) { - this.clearTimer(); - } - } - - onUpButtonMouseleave(event: Event) { - if(!this.disabled) { - this.clearTimer(); - } - } - - onDownButtonMousedown(event: Event) { - if(!this.disabled) { - this.inputfieldViewChild.nativeElement.focus(); - this.repeat(event, null, -1); - this.updateFilledState(); - } - } - - onDownButtonMouseup(event: Event) { - if(!this.disabled) { - this.clearTimer(); - } - } - - onDownButtonMouseleave(event: Event) { - if(!this.disabled) { - this.clearTimer(); - } - } - - onInputKeydown(event: KeyboardEvent) { - if(event.which == 38) { - this.spin(event, 1); - event.preventDefault(); - } - else if(event.which == 40) { - this.spin(event, -1); - event.preventDefault(); - } - } - - onInputKeyPress(event: KeyboardEvent) { - let inputChar = String.fromCharCode(event.charCode); - if(!this.keyPattern.test(inputChar) && inputChar != this.decimalSeparator && event.keyCode != 9 && event.keyCode != 8 && event.keyCode != 37 && event.keyCode != 39 && event.keyCode != 46) { - event.preventDefault(); - } - } - - onInputKeyup(event: KeyboardEvent) { - let inputValue = ( event.target).value; - if (event.key !== this.decimalSeparator && event.key !== this.thousandSeparator) { - this.value = this.parseValue(inputValue); - this.formatValue(); - } - - this.onModelChange(this.value); - this.updateFilledState(); - } - - onInputBlur(event) { - this.focus = false; - this.onModelTouched(); - this.onBlur.emit(event); - } - - onInputFocus(event) { - this.focus = true; - this.onFocus.emit(event); - } - - parseValue(val: string): number { - let value: number; - - if(this.formatInput) { - val = val.split(this.thousandSeparator).join(''); - } - - if(val.trim() === '') { - value = null; - } - else { - if(this.precision) { - value = parseFloat(val.replace(',','.')); - } - else { - value = parseInt(val); - } - - if(!isNaN(value)) { - if(this.max !== undefined && value > this.max) { - value = this.max; - } - - if(this.min !== undefined && value < this.min) { - value = this.min; - } - } - else { - value = null; - } - } - - return value; - } - - formatValue(): void { - if(this.value !== null && this.value !== undefined) { - let textValue = String(this.value).replace('.', this.decimalSeparator); - - if(this.formatInput) { - textValue = textValue.replace(/\B(?=(\d{3})+(?!\d))/g, this.thousandSeparator); - } - - this.valueAsString = textValue; - } - else { - this.valueAsString = ''; - } - - this.inputfieldViewChild.nativeElement.value = this.valueAsString; - } - - handleChange(event: Event) { - this.onChange.emit(event); - } - - clearTimer() { - if(this.timer) { - clearInterval(this.timer); - } - } - - writeValue(value: any) : void { - this.value = value; - this.formatValue(); - this.updateFilledState(); - } - - registerOnChange(fn: Function): void { - this.onModelChange = fn; - } - - registerOnTouched(fn: Function): void { - this.onModelTouched = fn; - } - - setDisabledState(val: boolean): void { - this.disabled = val; - } - - updateFilledState() { - this.filled = (this.value !== undefined && this.value != null); - } -} - - -@NgModule({ - imports: [CommonModule,InputTextModule], - exports: [Spinner], - declarations: [Spinner] -}) -export class SpinnerModule { } diff --git a/dashboard/src/app/components/splitbutton/splitbutton.css b/dashboard/src/app/components/splitbutton/splitbutton.css deleted file mode 100644 index ae8f52a6f..000000000 --- a/dashboard/src/app/components/splitbutton/splitbutton.css +++ /dev/null @@ -1,29 +0,0 @@ -.ui-splitbutton { - position: relative; - display: inline-block; - zoom: 1; -} - -.ui-splitbutton .ui-button.ui-splitbutton-menubutton { - width: 2em; -} - -.ui-splitbutton .ui-button { - vertical-align: top; -} - -.ui-splitbutton.ui-state-disabled button { - cursor: default; -} - -.ui-fluid .ui-splitbutton { - width: 100%; -} - -.ui-fluid .ui-splitbutton .ui-button:first-child { - width: calc(100% - 2em); -} - -.ui-fluid .ui-splitbutton .ui-button.ui-splitbutton-menubutton { - width: 2em; -} \ No newline at end of file diff --git a/dashboard/src/app/components/splitbutton/splitbutton.spec.ts b/dashboard/src/app/components/splitbutton/splitbutton.spec.ts deleted file mode 100644 index f763c159e..000000000 --- a/dashboard/src/app/components/splitbutton/splitbutton.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { SplitButton } from './splitbutton'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('SplitButton', () => { - - let splitbutton: SplitButton; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - SplitButton - ] - }); - - fixture = TestBed.createComponent(SplitButton); - splitbutton = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/splitbutton/splitbutton.ts b/dashboard/src/app/components/splitbutton/splitbutton.ts deleted file mode 100644 index 294d7364e..000000000 --- a/dashboard/src/app/components/splitbutton/splitbutton.ts +++ /dev/null @@ -1,194 +0,0 @@ -import {NgModule,Component,ElementRef,AfterViewInit,AfterViewChecked,OnDestroy,Input,Output,ContentChildren,EventEmitter,QueryList,Renderer2,ChangeDetectorRef,ViewChild} from '@angular/core'; -import {trigger,state,style,transition,animate} from '@angular/animations'; -import {CommonModule} from '@angular/common'; -import {DomHandler} from '../dom/domhandler'; -import {MenuItem} from '../common/menuitem'; -import {ButtonModule} from '../button/button'; -import {Router} from '@angular/router'; -import {RouterModule} from '@angular/router'; - -@Component({ - selector: 'p-splitButton', - template: ` - - `, - animations: [ - trigger('overlayState', [ - state('hidden', style({ - opacity: 0 - })), - state('visible', style({ - opacity: 1 - })), - transition('visible => hidden', animate('400ms ease-in')), - transition('hidden => visible', animate('400ms ease-out')) - ]) - ], - providers: [DomHandler] -}) -export class SplitButton implements AfterViewInit,AfterViewChecked,OnDestroy { - - @Input() model: MenuItem[]; - - @Input() icon: string; - - @Input() iconPos: string = 'left'; - - @Input() label: string; - - @Output() onClick: EventEmitter = new EventEmitter(); - - @Output() onDropdownClick: EventEmitter = new EventEmitter(); - - @Input() style: any; - - @Input() styleClass: string; - - @Input() menuStyle: any; - - @Input() menuStyleClass: string; - - @Input() disabled: boolean; - - @Input() tabindex: number; - - @Input() appendTo: any; - - @Input() dir: string; - - @ViewChild('container') containerViewChild: ElementRef; - - @ViewChild('defaultbtn') buttonViewChild: ElementRef; - - @ViewChild('overlay') overlayViewChild: ElementRef; - - public menuVisible: boolean = false; - - public documentClickListener: any; - - public dropdownClick: boolean; - - public shown: boolean; - - constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer2, public router: Router, public cd: ChangeDetectorRef) {} - - ngAfterViewInit() { - if(this.appendTo) { - if(this.appendTo === 'body') - document.body.appendChild(this.overlayViewChild.nativeElement); - else - this.domHandler.appendChild(this.overlayViewChild.nativeElement, this.appendTo); - } - } - - ngAfterViewChecked() { - if(this.shown) { - this.onShow(); - this.shown = false; - } - } - - onDefaultButtonClick(event: Event) { - this.onClick.emit(event); - } - - itemClick(event: Event, item: MenuItem) { - if(item.disabled) { - event.preventDefault(); - return; - } - - if(!item.url) { - event.preventDefault(); - } - - if(item.command) { - item.command({ - originalEvent: event, - item: item - }); - } - - this.menuVisible = false; - } - - show() { - this.shown = true; - this.menuVisible= !this.menuVisible; - this.alignPanel(); - this.overlayViewChild.nativeElement.style.zIndex = String(++DomHandler.zindex); - } - - onShow() { - this.alignPanel(); - this.bindDocumentClickListener(); - } - - onDropdownButtonClick(event: Event) { - this.onDropdownClick.emit(event); - this.dropdownClick = true; - this.show(); - } - - alignPanel() { - if(this.appendTo) - this.domHandler.absolutePosition(this.overlayViewChild.nativeElement, this.containerViewChild.nativeElement); - else - this.domHandler.relativePosition(this.overlayViewChild.nativeElement, this.containerViewChild.nativeElement); - } - - bindDocumentClickListener() { - if(!this.documentClickListener) { - this.documentClickListener = this.renderer.listen('document', 'click', () => { - if(this.dropdownClick) { - this.dropdownClick = false; - } - else { - this.menuVisible = false; - this.unbindDocumentClickListener(); - this.cd.markForCheck(); - } - }); - } - } - - unbindDocumentClickListener() { - if(this.documentClickListener) { - this.documentClickListener(); - this.documentClickListener = null; - } - } - - ngOnDestroy() { - this.unbindDocumentClickListener(); - } -} - -@NgModule({ - imports: [CommonModule,ButtonModule,RouterModule], - exports: [SplitButton,ButtonModule,RouterModule], - declarations: [SplitButton] -}) -export class SplitButtonModule { } diff --git a/dashboard/src/app/components/steps/steps.css b/dashboard/src/app/components/steps/steps.css deleted file mode 100644 index 0c6039c87..000000000 --- a/dashboard/src/app/components/steps/steps.css +++ /dev/null @@ -1,49 +0,0 @@ -.ui-steps ul { - list-style-type: none; - padding: 0; - margin: 0; -} - -.ui-steps .ui-steps-item { - float: left; - box-sizing: border-box; - cursor: pointer; -} - -.ui-steps.ui-steps-readonly .ui-steps-item { - cursor: auto; -} - -.ui-steps .ui-steps-item .ui-menuitem-link { - text-decoration: none; - display: block; - padding: 1em; - position: relative; - text-align: center; -} - -.ui-steps .ui-steps-item.ui-state-highlight .ui-menuitem-link, -.ui-steps .ui-steps-item.ui-state-disabled .ui-menuitem-link { - cursor: default; -} - -.ui-steps .ui-steps-number { - font-size: 200%; - display: block; -} - -.ui-steps .ui-steps-title { - display: block; - white-space: nowrap; -} - -/* Responsive */ -@media (max-width: 40em) { - .ui-steps .ui-steps-item .ui-menuitem-link { - padding: 0.5em; - } - - .ui-steps .ui-steps-item .ui-steps-title { - display: none; - } -} \ No newline at end of file diff --git a/dashboard/src/app/components/steps/steps.spec.ts b/dashboard/src/app/components/steps/steps.spec.ts deleted file mode 100644 index 4d04bb233..000000000 --- a/dashboard/src/app/components/steps/steps.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { Steps } from './steps'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('Steps', () => { - - let steps: Steps; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - Steps - ] - }); - - fixture = TestBed.createComponent(Steps); - steps = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/steps/steps.ts b/dashboard/src/app/components/steps/steps.ts deleted file mode 100644 index 141ad056a..000000000 --- a/dashboard/src/app/components/steps/steps.ts +++ /dev/null @@ -1,69 +0,0 @@ -import {NgModule,Component,Input,Output,EventEmitter} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {MenuItem} from '../common/menuitem'; -import {RouterModule} from '@angular/router'; - -@Component({ - selector: 'p-steps', - template: ` - - ` -}) -export class Steps { - - @Input() activeIndex: number = 0; - - @Input() model: MenuItem[]; - - @Input() readonly: boolean = true; - - @Input() style: any; - - @Input() styleClass: string; - - @Output() activeIndexChange: EventEmitter = new EventEmitter(); - - itemClick(event: Event, item: MenuItem, i: number) { - if(this.readonly || item.disabled) { - event.preventDefault(); - return; - } - - this.activeIndexChange.emit(i); - - if(!item.url) { - event.preventDefault(); - } - - if(item.command) { - item.command({ - originalEvent: event, - item: item, - index: i - }); - } - } - -} - -@NgModule({ - imports: [CommonModule,RouterModule], - exports: [Steps,RouterModule], - declarations: [Steps] -}) -export class StepsModule { } \ No newline at end of file diff --git a/dashboard/src/app/components/table/table.css b/dashboard/src/app/components/table/table.css deleted file mode 100644 index 4b6e0713d..000000000 --- a/dashboard/src/app/components/table/table.css +++ /dev/null @@ -1,224 +0,0 @@ -.ui-table { - position: relative; -} - -.ui-table table { - border-collapse: collapse; - width: 100%; - table-layout: fixed; -} - -.ui-table .ui-table-thead>tr>th, -.ui-table .ui-table-tbody>tr>td, -.ui-table .ui-table-tfoot>tr>td { - padding: .25em .5em; -} - -.ui-table .ui-sortable-column { - cursor: pointer; -} - -.ui-table-auto-layout>.ui-table-wrapper { - overflow-x: auto; -} - -.ui-table-auto-layout>.ui-table-wrapper>table { - table-layout: auto; -} - - -/* Sections */ - -.ui-table-caption, -.ui-table-summary { - padding: .25em .5em; - text-align: center; - font-weight: bold; -} - -.ui-table-caption { - border-bottom: 0 none; -} - -.ui-table-summary { - border-top: 0 none; -} - - -/* Paginator */ - -.ui-table .ui-paginator-top { - border-bottom: 0 none; -} - -.ui-table .ui-paginator-bottom { - border-top: 0 none; -} - - -/* Scrollable */ - -.ui-table-scrollable-header, -.ui-table-scrollable-footer { - overflow: hidden; - border: 0 none; -} - -.ui-table-scrollable-body { - overflow: auto; - position: relative; -} - -.ui-table-scrollable-body>table>.ui-table-tbody>tr:first-child>td { - border-top: 0 none; -} - -.ui-table-virtual-table { - position: absolute; -} - - -/* Frozen Columns */ - -.ui-table-frozen-view .ui-table-scrollable-body { - overflow: hidden; -} - -.ui-table-frozen-view>.ui-table-scrollable-body>table>.ui-table-tbody>tr>td:last-child { - border-right: 0 none; -} - -.ui-table-unfrozen-view { - position: absolute; - top: 0px; -} - - -/* Resizable */ - -.ui-table-resizable>.ui-table-wrapper { - overflow-x: auto; -} - -.ui-table-resizable .ui-table-thead>tr>th, -.ui-table-resizable .ui-table-tfoot>tr>td, -.ui-table-resizable .ui-table-data>tr>td { - overflow: hidden; -} - -.ui-resizable-column { - background-clip: padding-box; - position: relative; -} - -.ui-table-resizable-fit .ui-resizable-column:last-child .ui-column-resizer { - display: none; -} - -.ui-table .ui-column-resizer { - display: block; - position: absolute !important; - top: 0; - right: 0; - margin: 0; - width: .5em; - height: 100%; - padding: 0px; - cursor: col-resize; - border: 1px solid transparent; -} - -.ui-table .ui-column-resizer-helper { - width: 1px; - position: absolute; - z-index: 10; - display: none; -} - - -/* Edit */ - -.ui-table .ui-table-tbody>tr>td.ui-editing-cell { - padding: 0; -} - -.ui-table .ui-table-tbody>tr>td.ui-editing-cell p-celleditor>* { - width: 100%; -} - - -/* Reorder */ - -.ui-table-reorder-indicator-up, -.ui-table-reorder-indicator-down { - position: absolute; - display: none; -} - - -/* Responsive */ - -.ui-table-responsive .ui-table-tbody>tr>td .ui-column-title { - display: none; -} - -@media screen and (max-width: 40em) { - .ui-table-responsive .ui-table-thead>tr>th, - .ui-table-responsive .ui-table-tfoot>tr>td { - display: none !important; - } - .ui-table-responsive .ui-table-tbody>tr>td { - text-align: left; - display: block; - border: 0 none; - width: 100% !important; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; - float: left; - clear: left; - } - .ui-table-responsive .ui-table-tbody>tr>td .ui-column-title { - padding: .4em; - min-width: 30%; - display: inline-block; - margin: -.4em 1em -.4em -.4em; - font-weight: bold; - } -} - - -/* Loader */ - -.ui-table-loading { - position: absolute; - width: 100%; - height: 100%; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=10)"; - opacity: 0.1; - z-index: 1; -} - -.ui-table-loading-content { - position: absolute; - left: 50%; - top: 50%; - z-index: 2; - margin-top: -1em; - margin-left: -1em; -} - - -/* 自定义table modifyProfile start */ - -.custom-table-class tr td, -.custom-table-class th { - color: #657D95 !important; - font-weight: normal; - text-align: left; - line-height: 2em; - border: none !important; -} - - -/* 自定义table modifyProfile end */ \ No newline at end of file diff --git a/dashboard/src/app/components/table/table.ts b/dashboard/src/app/components/table/table.ts deleted file mode 100644 index 985237856..000000000 --- a/dashboard/src/app/components/table/table.ts +++ /dev/null @@ -1,2889 +0,0 @@ -import { NgModule, Component, HostListener, OnInit, AfterViewInit, Directive, AfterContentInit, Input, Output, EventEmitter, ElementRef, ContentChildren, TemplateRef, QueryList, ViewChild, NgZone, EmbeddedViewRef, ViewContainerRef} from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { Column, PrimeTemplate, SharedModule } from '../common/shared'; -import { PaginatorModule } from '../paginator/paginator'; -import { DomHandler } from '../dom/domhandler'; -import { ObjectUtils } from '../utils/objectutils'; -import { SortMeta } from '../common/sortmeta'; -import { FilterMetadata } from '../common/filtermetadata'; -import { OnDestroy } from '@angular/core/src/metadata/lifecycle_hooks'; -import { Injectable } from '@angular/core'; -import { Subject } from 'rxjs/Subject'; -import { Subscription } from 'rxjs/Subscription'; -import { Observable } from 'rxjs/Observable'; - -@Injectable() -export class TableService { - - private sortSource = new Subject(); - private selectionSource = new Subject(); - private contextMenuSource = new Subject(); - private valueSource = new Subject(); - - sortSource$ = this.sortSource.asObservable(); - selectionSource$ = this.selectionSource.asObservable(); - contextMenuSource$ = this.contextMenuSource.asObservable(); - valueSource$ = this.valueSource.asObservable(); - - onSort(sortMeta: SortMeta|SortMeta[]) { - this.sortSource.next(sortMeta); - } - - onSelectionChange() { - this.selectionSource.next(); - } - - onContextMenu(data: any) { - this.contextMenuSource.next(data); - } - - onValueChange(value: any) { - this.valueSource.next(value); - } -} - -@Component({ - selector: 'p-table', - template: ` -
-
-
- -
-
- -
- - -
- - - - - - - - - -
-
- -
-
-
-
- - -
- -
- - - - - -
- `, - providers: [DomHandler, ObjectUtils, TableService] -}) -export class Table implements OnInit, AfterContentInit { - - @Input() columns: any[]; - - @Input() frozenColumns: any[]; - - @Input() frozenValue: any[]; - - @Input() style: any; - - @Input() styleClass: string; - - @Input() paginator: boolean; - - @Input() rows: number; - - @Input() first: number = 0; - - @Input() totalRecords: number = 0; - - @Input() pageLinks: number = 5; - - @Input() rowsPerPageOptions: number[]; - - @Input() alwaysShowPaginator: boolean = true; - - @Input() paginatorPosition: string = 'bottom'; - - @Input() paginatorDropdownAppendTo: any; - - @Input() defaultSortOrder: number = 1; - - @Input() sortMode: string = 'single'; - - @Input() selectionMode: string; - - @Output() selectionChange: EventEmitter = new EventEmitter(); - - @Input() contextMenuSelection: any; - - @Output() contextMenuSelectionChange: EventEmitter = new EventEmitter(); - - @Input() dataKey: string; - - @Input() metaKeySelection: boolean; - - @Input() rowTrackBy: Function = (index: number, item: any) => item; - - @Input() lazy: boolean = false; - - @Input() compareSelectionBy: string = 'deepEquals'; - - @Input() csvSeparator: string = ','; - - @Input() exportFilename: string = 'download'; - - @Input() filters: { [s: string]: FilterMetadata; } = {}; - - @Input() globalFilterFields: string[]; - - @Input() filterDelay: number = 300; - - @Input() expandedRowKeys: { [s: string]: number; } = {}; - - @Input() rowExpandMode: string = 'multiple'; - - @Input() scrollable: boolean; - - @Input() scrollHeight: string; - - @Input() virtualScroll: boolean; - - @Input() virtualScrollDelay: number = 500; - - @Input() virtualRowHeight: number = 27; - - @Input() frozenWidth: string; - - @Input() responsive: boolean; - - @Input() contextMenu: any; - - @Input() resizableColumns: boolean; - - @Input() columnResizeMode: string = 'fit'; - - @Input() reorderableColumns: boolean; - - @Input() loading: boolean; - - @Input() loadingIcon: string = 'fa fa-spin fa-2x fa-circle-o-notch'; - - @Input() rowHover: boolean; - - @Input() customSort: boolean; - - @Input() autoLayout: boolean; - - @Output() onRowSelect: EventEmitter = new EventEmitter(); - - @Output() onRowUnselect: EventEmitter = new EventEmitter(); - - @Output() onPage: EventEmitter = new EventEmitter(); - - @Output() onSort: EventEmitter = new EventEmitter(); - - @Output() onFilter: EventEmitter = new EventEmitter(); - - @Output() onLazyLoad: EventEmitter = new EventEmitter(); - - @Output() onRowExpand: EventEmitter = new EventEmitter(); - - @Output() onRowCollapse: EventEmitter = new EventEmitter(); - - @Output() onContextMenuSelect: EventEmitter = new EventEmitter(); - - @Output() onColResize: EventEmitter = new EventEmitter(); - - @Output() onColReorder: EventEmitter = new EventEmitter(); - - @Output() onRowReorder: EventEmitter = new EventEmitter(); - - @Output() onEditInit: EventEmitter = new EventEmitter(); - - @Output() onEditComplete: EventEmitter = new EventEmitter(); - - @Output() onEditCancel: EventEmitter = new EventEmitter(); - - @Output() onHeaderCheckboxToggle: EventEmitter = new EventEmitter(); - - @Output() sortFunction: EventEmitter = new EventEmitter(); - - @ViewChild('container') containerViewChild: ElementRef; - - @ViewChild('resizeHelper') resizeHelperViewChild: ElementRef; - - @ViewChild('reorderIndicatorUp') reorderIndicatorUpViewChild: ElementRef; - - @ViewChild('reorderIndicatorDown') reorderIndicatorDownViewChild: ElementRef; - - @ViewChild('table') tableViewChild: ElementRef; - - @ContentChildren(PrimeTemplate) templates: QueryList; - - _value: any[] = []; - - filteredValue: any[]; - - headerTemplate: TemplateRef; - - bodyTemplate: TemplateRef; - - captionTemplate: TemplateRef; - - frozenRowsTemplate: TemplateRef; - - footerTemplate: TemplateRef; - - summaryTemplate: TemplateRef; - - colGroupTemplate: TemplateRef; - - expandedRowTemplate: TemplateRef; - - frozenHeaderTemplate: TemplateRef; - - frozenBodyTemplate: TemplateRef; - - frozenFooterTemplate: TemplateRef; - - frozenColGroupTemplate: TemplateRef; - - emptyMessageTemplate: TemplateRef; - - paginatorLeftTemplate: TemplateRef; - - paginatorRightTemplate: TemplateRef; - - selectionKeys: any = {}; - - lastResizerHelperX: number; - - reorderIconWidth: number; - - reorderIconHeight: number; - - draggedColumn: any; - - draggedRowIndex: number; - - droppedRowIndex: number; - - rowDragging: boolean; - - dropPosition: number; - - editingCell: Element; - - _multiSortMeta: SortMeta[]; - - _sortField: string; - - _sortOrder: number = 1; - - virtualScrollTimer: any; - - virtualScrollCallback: Function; - - preventSelectionSetterPropagation: boolean; - - _selection: any; - - anchorRowIndex: number; - - rangeRowIndex: number; - - filterTimeout: any; - - initialized: boolean; - - rowTouched: boolean; - - constructor(public el: ElementRef, public domHandler: DomHandler, public objectUtils: ObjectUtils, public zone: NgZone, public tableService: TableService) {} - - ngOnInit() { - if (this.lazy) { - this.onLazyLoad.emit(this.createLazyLoadMetadata()); - } - this.initialized = true; - } - - ngAfterContentInit() { - this.templates.forEach((item) => { - switch (item.getType()) { - case 'caption': - this.captionTemplate = item.template; - break; - - case 'header': - this.headerTemplate = item.template; - break; - - case 'body': - this.bodyTemplate = item.template; - break; - - case 'footer': - this.footerTemplate = item.template; - break; - - case 'summary': - this.summaryTemplate = item.template; - break; - - case 'colgroup': - this.colGroupTemplate = item.template; - break; - - case 'rowexpansion': - this.expandedRowTemplate = item.template; - break; - - case 'frozenrows': - this.frozenRowsTemplate = item.template; - break; - - case 'frozenheader': - this.frozenHeaderTemplate = item.template; - break; - - case 'frozenbody': - this.frozenBodyTemplate = item.template; - break; - - case 'frozenfooter': - this.frozenFooterTemplate = item.template; - break; - - case 'frozencolgroup': - this.frozenColGroupTemplate = item.template; - break; - - case 'emptymessage': - this.emptyMessageTemplate = item.template; - break; - - case 'paginatorleft': - this.paginatorLeftTemplate = item.template; - break; - - case 'paginatorright': - this.paginatorRightTemplate = item.template; - break; - } - }); - } - - @Input() get value(): any[] { - return this._value; - } - set value(val: any[]) { - this._value = val; - this.updateTotalRecords(); - - if (!this.lazy) { - if (this.sortMode == 'single') - this.sortSingle(); - else if (this.sortMode == 'multiple') - this.sortMultiple(); - } - - if(this.virtualScroll && this.virtualScrollCallback) { - this.virtualScrollCallback(); - } - - this.tableService.onValueChange(val); - } - - @Input() get sortField(): string { - return this._sortField; - } - - set sortField(val: string) { - this._sortField = val; - - //avoid triggering lazy load prior to lazy initialization at onInit - if ( !this.lazy || this.initialized ) { - if (this.sortMode === 'single') { - this.sortSingle(); - } - } - } - - @Input() get sortOrder(): number { - return this._sortOrder; - } - set sortOrder(val: number) { - this._sortOrder = val; - - //avoid triggering lazy load prior to lazy initialization at onInit - if ( !this.lazy || this.initialized ) { - if (this.sortMode === 'single') { - this.sortSingle(); - } - } - } - - @Input() get multiSortMeta(): SortMeta[] { - return this._multiSortMeta; - } - - set multiSortMeta(val: SortMeta[]) { - this._multiSortMeta = val; - if (this.sortMode === 'multiple') { - this.sortMultiple(); - } - } - - @Input() get selection(): any { - return this._selection; - } - - set selection(val: any) { - this._selection = val; - - if(!this.preventSelectionSetterPropagation) { - this.updateSelectionKeys(); - this.tableService.onSelectionChange(); - } - this.preventSelectionSetterPropagation = false; - } - - updateSelectionKeys() { - if(this.dataKey && this._selection) { - this.selectionKeys = {}; - if(Array.isArray(this._selection)) { - for(let data of this._selection) { - this.selectionKeys[String(this.objectUtils.resolveFieldData(data, this.dataKey))] = 1; - } - } - else { - this.selectionKeys[String(this.objectUtils.resolveFieldData(this._selection, this.dataKey))] = 1; - } - } - } - - updateTotalRecords() { - this.totalRecords = this.lazy ? this.totalRecords : (this._value ? this._value.length : 0); - } - - onPageChange(event) { - this.first = event.first; - this.rows = event.rows; - - if (this.lazy) { - this.onLazyLoad.emit(this.createLazyLoadMetadata()); - } - - this.onPage.emit({ - first: this.first, - rows: this.rows - }); - - this.tableService.onValueChange(this.value); - } - - sort(event) { - let originalEvent = event.originalEvent; - - if(this.sortMode === 'single') { - this._sortOrder = (this.sortField === event.field) ? this.sortOrder * -1 : this.defaultSortOrder; - this._sortField = event.field; - this.sortSingle(); - } - if (this.sortMode === 'multiple') { - let metaKey = originalEvent.metaKey || originalEvent.ctrlKey; - let sortMeta = this.getSortMeta(event.field); - - if (sortMeta) { - if (!metaKey) { - this._multiSortMeta = [{ field: event.field, order: sortMeta.order * -1 }] - } - else { - sortMeta.order = sortMeta.order * -1; - } - } - else { - if (!metaKey || !this.multiSortMeta) { - this._multiSortMeta = []; - } - this.multiSortMeta.push({ field: event.field, order: this.defaultSortOrder }); - } - - this.sortMultiple(); - } - } - - sortSingle() { - if(this.sortField && this.sortOrder) { - this.first = 0; - - if(this.lazy) { - this.onLazyLoad.emit(this.createLazyLoadMetadata()); - } - else if (this.value) { - if(this.customSort) { - this.sortFunction.emit({ - data: this.value, - mode: this.sortMode, - field: this.sortField, - order: this.sortOrder - }); - } - else { - this.value.sort((data1, data2) => { - let value1 = this.objectUtils.resolveFieldData(data1, this.sortField); - let value2 = this.objectUtils.resolveFieldData(data2, this.sortField); - let result = null; - - if (value1 == null && value2 != null) - result = -1; - else if (value1 != null && value2 == null) - result = 1; - else if (value1 == null && value2 == null) - result = 0; - else if (typeof value1 === 'string' && typeof value2 === 'string') - result = value1.localeCompare(value2); - else - result = (value1 < value2) ? -1 : (value1 > value2) ? 1 : 0; - - return (this.sortOrder * result); - }); - } - - if(this.hasFilter()) { - this._filter(); - } - } - - let sortMeta: SortMeta = { - field: this.sortField, - order: this.sortOrder - }; - - this.onSort.emit(sortMeta); - this.tableService.onSort(sortMeta); - } - } - - sortMultiple() { - if(this.multiSortMeta) { - if (this.lazy) { - this.onLazyLoad.emit(this.createLazyLoadMetadata()); - } - else if (this.value) { - if(this.customSort) { - this.sortFunction.emit({ - data: this.value, - mode: this.sortMode, - multiSortMeta: this.multiSortMeta - }); - } - else { - this.value.sort((data1, data2) => { - return this.multisortField(data1, data2, this.multiSortMeta, 0); - }); - } - - if(this.hasFilter()) { - this._filter(); - } - } - - this.onSort.emit({ - multisortmeta: this.multiSortMeta - }); - this.tableService.onSort(this.multiSortMeta); - } - } - - multisortField(data1, data2, multiSortMeta, index) { - let value1 = this.objectUtils.resolveFieldData(data1, multiSortMeta[index].field); - let value2 = this.objectUtils.resolveFieldData(data2, multiSortMeta[index].field); - let result = null; - - if (typeof value1 == 'string' || value1 instanceof String) { - if (value1.localeCompare && (value1 != value2)) { - return (multiSortMeta[index].order * value1.localeCompare(value2)); - } - } - else { - result = (value1 < value2) ? -1 : 1; - } - - if (value1 == value2) { - return (multiSortMeta.length - 1) > (index) ? (this.multisortField(data1, data2, multiSortMeta, index + 1)) : 0; - } - - return (multiSortMeta[index].order * result); - } - - getSortMeta(field: string) { - if (this.multiSortMeta && this.multiSortMeta.length) { - for (let i = 0; i < this.multiSortMeta.length; i++) { - if (this.multiSortMeta[i].field === field) { - return this.multiSortMeta[i]; - } - } - } - - return null; - } - - isSorted(field: string) { - if(this.sortMode === 'single') { - return (this.sortField && this.sortField === field); - } - else if(this.sortMode === 'multiple') { - let sorted = false; - if(this.multiSortMeta) { - for(let i = 0; i < this.multiSortMeta.length; i++) { - if(this.multiSortMeta[i].field == field) { - sorted = true; - break; - } - } - } - return sorted; - } - } - - handleRowClick(event) { - let targetNode = ( event.originalEvent.target).nodeName; - if (targetNode == 'INPUT' || targetNode == 'BUTTON' || targetNode == 'A' || (this.domHandler.hasClass(event.originalEvent.target, 'ui-clickable'))) { - return; - } - - if(this.selectionMode) { - this.preventSelectionSetterPropagation = true; - if(this.isMultipleSelectionMode() && event.originalEvent.shiftKey && this.anchorRowIndex != null) { - this.domHandler.clearSelection(); - if(this.rangeRowIndex != null) { - this.clearSelectionRange(event.originalEvent); - } - - this.rangeRowIndex = event.rowIndex; - this.selectRange(event.originalEvent, event.rowIndex); - } - else { - let rowData = event.rowData; - let selected = this.isSelected(rowData); - let metaSelection = this.rowTouched ? false : this.metaKeySelection; - let dataKeyValue = this.dataKey ? String(this.objectUtils.resolveFieldData(rowData, this.dataKey)) : null; - this.anchorRowIndex = event.rowIndex; - this.rangeRowIndex = event.rowIndex; - - if(metaSelection) { - let metaKey = event.originalEvent.metaKey||event.originalEvent.ctrlKey; - - if(selected && metaKey) { - if(this.isSingleSelectionMode()) { - this._selection = null; - this.selectionKeys = {}; - this.selectionChange.emit(null); - } - else { - let selectionIndex = this.findIndexInSelection(rowData); - this._selection = this.selection.filter((val,i) => i!=selectionIndex); - this.selectionChange.emit(this.selection); - if(dataKeyValue) { - delete this.selectionKeys[dataKeyValue]; - } - } - - this.onRowUnselect.emit({originalEvent: event.originalEvent, data: rowData, type: 'row'}); - } - else { - if(this.isSingleSelectionMode()) { - this._selection = rowData; - this.selectionChange.emit(rowData); - if(dataKeyValue) { - this.selectionKeys = {}; - this.selectionKeys[dataKeyValue] = 1; - } - } - else if(this.isMultipleSelectionMode()) { - if(metaKey) { - this._selection = this.selection||[]; - } - else { - this._selection = []; - this.selectionKeys = {}; - } - - this._selection = [...this.selection,rowData]; - this.selectionChange.emit(this.selection); - if(dataKeyValue) { - this.selectionKeys[dataKeyValue] = 1; - } - } - - this.onRowSelect.emit({originalEvent: event.originalEvent, data: rowData, type: 'row'}); - } - } - else { - if (this.selectionMode === 'single') { - if (selected) { - this._selection = null; - this.selectionKeys = {}; - this.selectionChange.emit(this.selection); - this.onRowUnselect.emit({ originalEvent: event.originalEvent, data: rowData, type: 'row' }); - } - else { - this._selection = rowData; - this.selectionChange.emit(this.selection); - this.onRowSelect.emit({ originalEvent: event.originalEvent, data: rowData, type: 'row' }); - if (dataKeyValue) { - this.selectionKeys = {}; - this.selectionKeys[dataKeyValue] = 1; - } - } - } - else if (this.selectionMode === 'multiple') { - if (selected) { - let selectionIndex = this.findIndexInSelection(rowData); - this._selection = this.selection.filter((val, i) => i != selectionIndex); - this.selectionChange.emit(this.selection); - this.onRowUnselect.emit({ originalEvent: event.originalEvent, data: rowData, type: 'row' }); - if (dataKeyValue) { - delete this.selectionKeys[dataKeyValue]; - } - } - else { - this._selection = this.selection ? [...this.selection, rowData] : [rowData]; - this.selectionChange.emit(this.selection); - this.onRowSelect.emit({ originalEvent: event.originalEvent, data: rowData, type: 'row' }); - if (dataKeyValue) { - this.selectionKeys[dataKeyValue] = 1; - } - } - } - } - } - - this.tableService.onSelectionChange(); - } - - this.rowTouched = false; - } - - handleRowTouchEnd(event) { - this.rowTouched = true; - } - - handleRowRightClick(event) { - if (this.contextMenu) { - this.contextMenuSelection = event.rowData; - this.contextMenuSelectionChange.emit(event.rowData); - this.onContextMenuSelect.emit({ originalEvent: event.originalEvent, data: event.rowData }); - this.contextMenu.show(event.originalEvent); - this.tableService.onContextMenu(event.rowData); - } - } - - selectRange(event: MouseEvent, rowIndex: number) { - let rangeStart, rangeEnd; - - if(this.anchorRowIndex > rowIndex) { - rangeStart = rowIndex; - rangeEnd = this.anchorRowIndex; - } - else if(this.anchorRowIndex < rowIndex) { - rangeStart = this.anchorRowIndex; - rangeEnd = rowIndex; - } - else { - rangeStart = rowIndex; - rangeEnd = rowIndex; - } - - for(let i = rangeStart; i <= rangeEnd; i++) { - let rangeRowData = this.value[i]; - if(!this.isSelected(rangeRowData)) { - this._selection = [...this.selection, rangeRowData]; - let dataKeyValue: string = this.dataKey ? String(this.objectUtils.resolveFieldData(rangeRowData, this.dataKey)) : null; - if(dataKeyValue) { - this.selectionKeys[dataKeyValue] = 1; - } - this.onRowSelect.emit({originalEvent: event, data: rangeRowData, type: 'row'}); - } - } - - this.selectionChange.emit(this.selection); - } - - clearSelectionRange(event: MouseEvent) { - let rangeStart, rangeEnd; - - if(this.rangeRowIndex > this.anchorRowIndex) { - rangeStart = this.anchorRowIndex; - rangeEnd = this.rangeRowIndex; - } - else if(this.rangeRowIndex < this.anchorRowIndex) { - rangeStart = this.rangeRowIndex; - rangeEnd = this.anchorRowIndex; - } - else { - rangeStart = this.rangeRowIndex; - rangeEnd = this.rangeRowIndex; - } - - for(let i = rangeStart; i <= rangeEnd; i++) { - let rangeRowData = this.value[i]; - let selectionIndex = this.findIndexInSelection(rangeRowData); - this._selection = this.selection.filter((val,i) => i!=selectionIndex); - let dataKeyValue: string = this.dataKey ? String(this.objectUtils.resolveFieldData(rangeRowData, this.dataKey)) : null; - if(dataKeyValue) { - delete this.selectionKeys[dataKeyValue]; - } - this.onRowUnselect.emit({originalEvent: event, data: rangeRowData, type: 'row'}); - } - } - - isSelected(rowData) { - if (rowData && this.selection) { - if (this.dataKey) { - return this.selectionKeys[this.objectUtils.resolveFieldData(rowData, this.dataKey)] !== undefined; - } - else { - if (this.selection instanceof Array) - return this.findIndexInSelection(rowData) > -1; - else - return this.equals(rowData, this.selection); - } - } - - return false; - } - - findIndexInSelection(rowData: any) { - let index: number = -1; - if (this.selection && this.selection.length) { - for (let i = 0; i < this.selection.length; i++) { - if (this.equals(rowData, this.selection[i])) { - index = i; - break; - } - } - } - - return index; - } - - toggleRowWithRadio(event: Event, rowData:any) { - this.preventSelectionSetterPropagation = true; - - if(this.selection != rowData) { - this._selection = rowData; - this.selectionChange.emit(this.selection); - this.onRowSelect.emit({originalEvent: event, data: rowData, type: 'radiobutton'}); - - if(this.dataKey) { - this.selectionKeys = {}; - this.selectionKeys[String(this.objectUtils.resolveFieldData(rowData, this.dataKey))] = 1; - } - } - else { - this._selection = null; - this.selectionChange.emit(this.selection); - this.onRowUnselect.emit({originalEvent: event, data: rowData, type: 'radiobutton'}); - } - - this.tableService.onSelectionChange(); - } - - toggleRowWithCheckbox(event, rowData: any) { - this.selection = this.selection||[]; - let selected = this.isSelected(rowData); - let dataKeyValue = this.dataKey ? String(this.objectUtils.resolveFieldData(rowData, this.dataKey)) : null; - this.preventSelectionSetterPropagation = true; - - if (selected) { - let selectionIndex = this.findIndexInSelection(rowData); - this._selection = this.selection.filter((val, i) => i != selectionIndex); - this.selectionChange.emit(this.selection); - this.onRowUnselect.emit({ originalEvent: event.originalEvent, data: rowData, type: 'checkbox' }); - if (dataKeyValue) { - delete this.selectionKeys[dataKeyValue]; - } - } - else { - this._selection = this.selection ? [...this.selection, rowData] : [rowData]; - this.selectionChange.emit(this.selection); - this.onRowSelect.emit({ originalEvent: event.originalEvent, data: rowData, type: 'checkbox' }); - if (dataKeyValue) { - this.selectionKeys[dataKeyValue] = 1; - } - } - - this.tableService.onSelectionChange(); - } - - toggleRowsWithCheckbox(event: Event, check: boolean) { - this._selection = check ? this.value.slice() : []; - this.preventSelectionSetterPropagation = true; - this.updateSelectionKeys(); - this.selectionChange.emit(this._selection); - this.tableService.onSelectionChange(); - this.onHeaderCheckboxToggle.emit({originalEvent: event, checked: check}); - } - - equals(data1, data2) { - return this.compareSelectionBy === 'equals' ? (data1 === data2) : this.objectUtils.equals(data1, data2, this.dataKey); - } - - filter(value, field, matchMode) { - if(this.filterTimeout) { - clearTimeout(this.filterTimeout); - } - - this.filterTimeout = setTimeout(() => { - if (!this.isFilterBlank(value)) - this.filters[field] = { value: value, matchMode: matchMode }; - else if (this.filters[field]) - delete this.filters[field]; - - this._filter(); - this.filterTimeout = null; - }, this.filterDelay); - } - - filterGlobal(value, matchMode) { - this.filter(value, 'global', matchMode); - } - - isFilterBlank(filter: any): boolean { - if (filter !== null && filter !== undefined) { - if ((typeof filter === 'string' && filter.trim().length == 0) || (filter instanceof Array && filter.length == 0)) - return true; - else - return false; - } - return true; - } - - _filter() { - this.first = 0; - - if (this.lazy) { - this.onLazyLoad.emit(this.createLazyLoadMetadata()); - } - else { - if (!this.value) { - return; - } - - if(!this.hasFilter()) { - this.filteredValue = null; - if (this.paginator) { - this.totalRecords = this.value ? this.value.length : 0; - } - } - else { - let globalFilterFieldsArray; - if (this.filters['global']) { - if (!this.columns && !this.globalFilterFields) - throw new Error('Global filtering requires dynamic columns or globalFilterFields to be defined.'); - else - globalFilterFieldsArray = this.globalFilterFields||this.columns; - } - - this.filteredValue = []; - - for (let i = 0; i < this.value.length; i++) { - let localMatch = true; - let globalMatch = false; - let localFiltered = false; - - for (let prop in this.filters) { - if (this.filters.hasOwnProperty(prop) && prop !== 'global') { - localFiltered = true; - let filterMeta = this.filters[prop]; - let filterField = prop; - let filterValue = filterMeta.value; - let filterMatchMode = filterMeta.matchMode || 'startsWith'; - let dataFieldValue = this.objectUtils.resolveFieldData(this.value[i], filterField); - let filterConstraint = this.filterConstraints[filterMatchMode]; - - if (!filterConstraint(dataFieldValue, filterValue)) { - localMatch = false; - } - - if (!localMatch) { - break; - } - } - } - - if (this.filters['global'] && !globalMatch && globalFilterFieldsArray) { - for(let j = 0; j < globalFilterFieldsArray.length; j++) { - let globalFilterField = globalFilterFieldsArray[j].field||globalFilterFieldsArray[j]; - globalMatch = this.filterConstraints[this.filters['global'].matchMode](this.objectUtils.resolveFieldData(this.value[i], globalFilterField), this.filters['global'].value); - - if(globalMatch) { - break; - } - } - } - - let matches: boolean; - if(this.filters['global']) { - matches = localFiltered ? (localFiltered && localMatch && globalMatch) : globalMatch; - } - else { - matches = localFiltered && localMatch; - } - - if (matches) { - this.filteredValue.push(this.value[i]); - } - } - - if (this.filteredValue.length === this.value.length) { - this.filteredValue = null; - } - - if (this.paginator) { - this.totalRecords = this.filteredValue ? this.filteredValue.length : this.value ? this.value.length : 0; - } - } - } - - this.onFilter.emit({ - filters: this.filters, - filteredValue: this.filteredValue || this.value - }); - - this.tableService.onValueChange(this.value); - } - - hasFilter() { - let empty = true; - for (let prop in this.filters) { - if (this.filters.hasOwnProperty(prop)) { - empty = false; - break; - } - } - - return !empty; - } - - filterConstraints = { - - startsWith(value, filter): boolean { - if (filter === undefined || filter === null || filter.trim() === '') { - return true; - } - - if (value === undefined || value === null) { - return false; - } - - let filterValue = filter.toLowerCase(); - return value.toString().toLowerCase().slice(0, filterValue.length) === filterValue; - }, - - contains(value, filter): boolean { - if (filter === undefined || filter === null || (typeof filter === 'string' && filter.trim() === '')) { - return true; - } - - if (value === undefined || value === null) { - return false; - } - - return value.toString().toLowerCase().indexOf(filter.toLowerCase()) !== -1; - }, - - endsWith(value, filter): boolean { - if (filter === undefined || filter === null || filter.trim() === '') { - return true; - } - - if (value === undefined || value === null) { - return false; - } - - let filterValue = filter.toString().toLowerCase(); - return value.toString().toLowerCase().indexOf(filterValue, value.toString().length - filterValue.length) !== -1; - }, - - equals(value, filter): boolean { - if (filter === undefined || filter === null || (typeof filter === 'string' && filter.trim() === '')) { - return true; - } - - if (value === undefined || value === null) { - return false; - } - - return value.toString().toLowerCase() == filter.toString().toLowerCase(); - }, - - notEquals(value, filter): boolean { - if (filter === undefined || filter === null || (typeof filter === 'string' && filter.trim() === '')) { - return false; - } - - if (value === undefined || value === null) { - return true; - } - - return value.toString().toLowerCase() != filter.toString().toLowerCase(); - }, - - in(value, filter: any[]): boolean { - if (filter === undefined || filter === null || filter.length === 0) { - return true; - } - - if (value === undefined || value === null) { - return false; - } - - for (let i = 0; i < filter.length; i++) { - if (filter[i] === value) - return true; - } - - return false; - }, - - lt(value, filter): boolean { - if (filter === undefined || filter === null) { - return true; - } - - if (value === undefined || value === null) { - return false; - } - - return value < filter; - }, - - gt(value, filter): boolean { - if (filter === undefined || filter === null) { - return true; - } - - if (value === undefined || value === null) { - return false; - } - - return value > filter; - } - } - - createLazyLoadMetadata(): any { - return { - first: this.first, - rows: this.virtualScroll ? this.rows * 2: this.rows, - sortField: this.sortField, - sortOrder: this.sortOrder, - filters: this.filters, - globalFilter: this.filters && this.filters['global'] ? this.filters['global'].value : null, - multiSortMeta: this.multiSortMeta - }; - } - - public reset() { - this._sortField = null; - this._sortOrder = 1; - this._multiSortMeta = null; - - this.filteredValue = null; - this.filters = {}; - - this.first = 0; - this.updateTotalRecords(); - - if(this.lazy) { - this.onLazyLoad.emit(this.createLazyLoadMetadata()); - } - } - - public exportCSV(options?: any) { - let data = this.filteredValue || this.value; - let csv = '\ufeff'; - - if (options && options.selectionOnly) { - data = this.selection || []; - } - - //headers - for (let i = 0; i < this.columns.length; i++) { - let column = this.columns[i]; - if (column.exportable !== false && column.field) { - csv += '"' + (column.header || column.field) + '"'; - - if (i < (this.columns.length - 1)) { - csv += this.csvSeparator; - } - } - } - - //body - data.forEach((record, i) => { - csv += '\n'; - for (let i = 0; i < this.columns.length; i++) { - let column = this.columns[i]; - if (column.exportable !== false && column.field) { - let cellData = this.objectUtils.resolveFieldData(record, column.field); - - if (cellData != null) - cellData = String(cellData).replace(/"/g, '""'); - else - cellData = ''; - - csv += '"' + cellData + '"'; - - if (i < (this.columns.length - 1)) { - csv += this.csvSeparator; - } - } - } - }); - - let blob = new Blob([csv], { - type: 'text/csv;charset=utf-8;' - }); - - if (window.navigator.msSaveOrOpenBlob) { - navigator.msSaveOrOpenBlob(blob, this.exportFilename + '.csv'); - } - else { - let link = document.createElement("a"); - link.style.display = 'none'; - document.body.appendChild(link); - if (link.download !== undefined) { - link.setAttribute('href', URL.createObjectURL(blob)); - link.setAttribute('download', this.exportFilename + '.csv'); - link.click(); - } - else { - csv = 'data:text/csv;charset=utf-8,' + csv; - window.open(encodeURI(csv)); - } - document.body.removeChild(link); - } - } - - toggleRow(rowData: any, event?: Event) { - if(!this.dataKey) { - throw new Error('dataKey must be defined to use row expansion'); - } - - let dataKeyValue = String(this.objectUtils.resolveFieldData(rowData, this.dataKey)); - - if (this.expandedRowKeys[dataKeyValue] != null) { - delete this.expandedRowKeys[dataKeyValue]; - this.onRowCollapse.emit({ - originalEvent: event, - data: rowData - }); - } - else { - if (this.rowExpandMode === 'single') { - this.expandedRowKeys = {}; - } - - this.expandedRowKeys[dataKeyValue] = 1; - this.onRowExpand.emit({ - originalEvent: event, - data: rowData - }); - } - - if (event) { - event.preventDefault(); - } - } - - isRowExpanded(rowData: any): boolean { - return this.expandedRowKeys[String(this.objectUtils.resolveFieldData(rowData, this.dataKey))] === 1; - } - - isSingleSelectionMode() { - return this.selectionMode === 'single'; - } - - isMultipleSelectionMode() { - return this.selectionMode === 'multiple'; - } - - onColumnResizeBegin(event) { - let containerLeft = this.domHandler.getOffset(this.containerViewChild.nativeElement).left; - this.lastResizerHelperX = (event.pageX - containerLeft + this.containerViewChild.nativeElement.scrollLeft); - } - - onColumnResize(event) { - let containerLeft = this.domHandler.getOffset(this.containerViewChild.nativeElement).left; - this.domHandler.addClass(this.containerViewChild.nativeElement, 'ui-unselectable-text'); - this.resizeHelperViewChild.nativeElement.style.height = this.containerViewChild.nativeElement.offsetHeight + 'px'; - this.resizeHelperViewChild.nativeElement.style.top = 0 + 'px'; - this.resizeHelperViewChild.nativeElement.style.left = (event.pageX - containerLeft + this.containerViewChild.nativeElement.scrollLeft) + 'px'; - - this.resizeHelperViewChild.nativeElement.style.display = 'block'; - } - - onColumnResizeEnd(event, column) { - let delta = this.resizeHelperViewChild.nativeElement.offsetLeft - this.lastResizerHelperX; - let columnWidth = column.offsetWidth; - let newColumnWidth = columnWidth + delta; - let minWidth = column.style.minWidth || 15; - - if (columnWidth + delta > parseInt(minWidth)) { - if (this.columnResizeMode === 'fit') { - let nextColumn = column.nextElementSibling; - while (!nextColumn.offsetParent) { - nextColumn = nextColumn.nextElementSibling; - } - - if (nextColumn) { - let nextColumnWidth = nextColumn.offsetWidth - delta; - let nextColumnMinWidth = nextColumn.style.minWidth || 15; - - if (newColumnWidth > 15 && nextColumnWidth > parseInt(nextColumnMinWidth)) { - if (this.scrollable) { - let scrollableBodyTable = this.domHandler.findSingle(this.el.nativeElement, 'table.ui-table-scrollable-body-table'); - let scrollableHeaderTable = this.domHandler.findSingle(this.el.nativeElement, 'table.ui-table-scrollable-header-table'); - let scrollableFooterTable = this.domHandler.findSingle(this.el.nativeElement, 'table.ui-table-scrollable-footer-table'); - let resizeColumnIndex = this.domHandler.index(column); - - this.resizeColGroup(scrollableHeaderTable, resizeColumnIndex, newColumnWidth, nextColumnWidth); - this.resizeColGroup(scrollableBodyTable, resizeColumnIndex, newColumnWidth, nextColumnWidth); - this.resizeColGroup(scrollableFooterTable, resizeColumnIndex, newColumnWidth, nextColumnWidth); - } - else { - column.style.width = newColumnWidth + 'px'; - if (nextColumn) { - nextColumn.style.width = nextColumnWidth + 'px'; - } - } - } - } - } - else if (this.columnResizeMode === 'expand') { - if (this.scrollable) { - let scrollableBodyTable = this.domHandler.findSingle(this.el.nativeElement, 'table.ui-table-scrollable-body-table'); - let scrollableHeaderTable = this.domHandler.findSingle(this.el.nativeElement, 'table.ui-table-scrollable-header-table'); - let scrollableFooterTable = this.domHandler.findSingle(this.el.nativeElement, 'table.ui-table-scrollable-footer-table'); - scrollableBodyTable.style.width = scrollableBodyTable.offsetWidth + delta + 'px'; - scrollableHeaderTable.style.width = scrollableHeaderTable.offsetWidth + delta + 'px'; - if(scrollableFooterTable) { - scrollableFooterTable.style.width = scrollableHeaderTable.offsetWidth + delta + 'px'; - } - let resizeColumnIndex = this.domHandler.index(column); - - this.resizeColGroup(scrollableHeaderTable, resizeColumnIndex, newColumnWidth, null); - this.resizeColGroup(scrollableBodyTable, resizeColumnIndex, newColumnWidth, null); - this.resizeColGroup(scrollableFooterTable, resizeColumnIndex, newColumnWidth, null); - } - else { - this.tableViewChild.nativeElement.style.width = this.tableViewChild.nativeElement.offsetWidth + delta + 'px'; - column.style.width = newColumnWidth + 'px'; - let containerWidth = this.tableViewChild.nativeElement.style.width; - this.containerViewChild.nativeElement.style.width = containerWidth + 'px'; - } - } - - this.onColResize.emit({ - element: column, - delta: delta - }); - } - - this.resizeHelperViewChild.nativeElement.style.display = 'none'; - this.domHandler.removeClass(this.containerViewChild.nativeElement, 'ui-unselectable-text'); - } - - resizeColGroup(table, resizeColumnIndex, newColumnWidth, nextColumnWidth) { - if(table) { - let colGroup = table.children[0].nodeName === 'COLGROUP' ? table.children[0] : null; - - if(colGroup) { - let col = colGroup.children[resizeColumnIndex]; - let nextCol = col.nextElementSibling; - col.style.width = newColumnWidth + 'px'; - - if (nextCol && nextColumnWidth) { - nextCol.style.width = nextColumnWidth + 'px'; - } - } - else { - throw "Scrollable tables require a colgroup to support resizable columns"; - } - } - } - - onColumnDragStart(event, columnElement) { - if (this.domHandler.hasClass(event.target, 'ui-column-resizer')) { - event.preventDefault(); - return; - } - - this.reorderIconWidth = this.domHandler.getHiddenElementOuterWidth(this.reorderIndicatorUpViewChild.nativeElement); - this.reorderIconHeight = this.domHandler.getHiddenElementOuterHeight(this.reorderIndicatorDownViewChild.nativeElement); - this.draggedColumn = columnElement; - event.dataTransfer.setData('text', 'b'); // For firefox - } - - onColumnDragEnter(event, dropHeader) { - if (this.reorderableColumns && this.draggedColumn && dropHeader) { - event.preventDefault(); - let containerOffset = this.domHandler.getOffset(this.containerViewChild.nativeElement); - let dropHeaderOffset = this.domHandler.getOffset(dropHeader); - - if (this.draggedColumn != dropHeader) { - let targetLeft = dropHeaderOffset.left - containerOffset.left; - let targetTop = containerOffset.top - dropHeaderOffset.top; - let columnCenter = dropHeaderOffset.left + dropHeader.offsetWidth / 2; - - this.reorderIndicatorUpViewChild.nativeElement.style.top = dropHeaderOffset.top - containerOffset.top - (this.reorderIconHeight - 1) + 'px'; - this.reorderIndicatorDownViewChild.nativeElement.style.top = dropHeaderOffset.top - containerOffset.top + dropHeader.offsetHeight + 'px'; - - if (event.pageX > columnCenter) { - this.reorderIndicatorUpViewChild.nativeElement.style.left = (targetLeft + dropHeader.offsetWidth - Math.ceil(this.reorderIconWidth / 2)) + 'px'; - this.reorderIndicatorDownViewChild.nativeElement.style.left = (targetLeft + dropHeader.offsetWidth - Math.ceil(this.reorderIconWidth / 2)) + 'px'; - this.dropPosition = 1; - } - else { - this.reorderIndicatorUpViewChild.nativeElement.style.left = (targetLeft - Math.ceil(this.reorderIconWidth / 2)) + 'px'; - this.reorderIndicatorDownViewChild.nativeElement.style.left = (targetLeft - Math.ceil(this.reorderIconWidth / 2)) + 'px'; - this.dropPosition = -1; - } - - this.reorderIndicatorUpViewChild.nativeElement.style.display = 'block'; - this.reorderIndicatorDownViewChild.nativeElement.style.display = 'block'; - } - else { - event.dataTransfer.dropEffect = 'none'; - } - } - } - - onColumnDragLeave(event) { - if (this.reorderableColumns && this.draggedColumn) { - event.preventDefault(); - this.reorderIndicatorUpViewChild.nativeElement.style.display = 'none'; - this.reorderIndicatorDownViewChild.nativeElement.style.display = 'none'; - } - } - - onColumnDrop(event, dropColumn) { - event.preventDefault(); - if (this.draggedColumn) { - let dragIndex = this.domHandler.indexWithinGroup(this.draggedColumn, 'preorderablecolumn'); - let dropIndex = this.domHandler.indexWithinGroup(dropColumn, 'preorderablecolumn'); - let allowDrop = (dragIndex != dropIndex); - if (allowDrop && ((dropIndex - dragIndex == 1 && this.dropPosition === -1) || (dragIndex - dropIndex == 1 && this.dropPosition === 1))) { - allowDrop = false; - } - - if (allowDrop) { - this.objectUtils.reorderArray(this.columns, dragIndex, dropIndex); - - this.onColReorder.emit({ - dragIndex: dragIndex, - dropIndex: dropIndex, - columns: this.columns - }); - } - - this.reorderIndicatorUpViewChild.nativeElement.style.display = 'none'; - this.reorderIndicatorDownViewChild.nativeElement.style.display = 'none'; - this.draggedColumn.draggable = false; - this.draggedColumn = null; - this.dropPosition = null; - } - } - - onRowDragStart(event, index) { - this.rowDragging = true; - this.draggedRowIndex = index; - event.dataTransfer.setData('text', 'b'); // For firefox - } - - onRowDragOver(event, index, rowElement) { - if (this.rowDragging && this.draggedRowIndex !== index) { - let rowY = this.domHandler.getOffset(rowElement).top + this.domHandler.getWindowScrollTop(); - let pageY = event.pageY; - let rowMidY = rowY + this.domHandler.getOuterHeight(rowElement) / 2; - let prevRowElement = rowElement.previousElementSibling; - - if (pageY < rowMidY) { - this.domHandler.removeClass(rowElement, 'ui-table-dragpoint-bottom'); - - this.droppedRowIndex = index; - if (prevRowElement) - this.domHandler.addClass(prevRowElement, 'ui-table-dragpoint-bottom'); - else - this.domHandler.addClass(rowElement, 'ui-table-dragpoint-top'); - } - else { - if (prevRowElement) - this.domHandler.removeClass(prevRowElement, 'ui-table-dragpoint-bottom'); - else - this.domHandler.addClass(rowElement, 'ui-table-dragpoint-top'); - - this.droppedRowIndex = index + 1; - this.domHandler.addClass(rowElement, 'ui-table-dragpoint-bottom'); - } - } - } - - onRowDragLeave(event, rowElement) { - let prevRowElement = rowElement.previousElementSibling; - if (prevRowElement) { - this.domHandler.removeClass(prevRowElement, 'ui-table-dragpoint-bottom'); - } - - this.domHandler.removeClass(rowElement, 'ui-table-dragpoint-bottom'); - this.domHandler.removeClass(rowElement, 'ui-table-dragpoint-top'); - } - - onRowDragEnd(event) { - this.rowDragging = false; - this.draggedRowIndex = null; - this.droppedRowIndex = null; - } - - onRowDrop(event, rowElement) { - if (this.droppedRowIndex != null) { - let dropIndex = (this.draggedRowIndex > this.droppedRowIndex) ? this.droppedRowIndex : (this.droppedRowIndex === 0) ? 0 : this.droppedRowIndex - 1; - this.objectUtils.reorderArray(this.value, this.draggedRowIndex, dropIndex); - - this.onRowReorder.emit({ - dragIndex: this.draggedRowIndex, - dropIndex: this.droppedRowIndex - }); - } - - //cleanup - this.onRowDragLeave(event, rowElement); - this.onRowDragEnd(event); - } - - handleVirtualScroll(event) { - this.first = (event.page - 1) * this.rows; - this.virtualScrollCallback = event.callback; - - this.zone.run(() => { - if(this.virtualScrollTimer) { - clearTimeout(this.virtualScrollTimer); - } - - this.virtualScrollTimer = setTimeout(() => { - this.onLazyLoad.emit(this.createLazyLoadMetadata()); - }, this.virtualScrollDelay); - }); - } - - isEmpty() { - let data = this.filteredValue||this.value; - return data == null || data.length == 0; - } - - ngOnDestroy() { - this.editingCell = null; - this.initialized = null; - } -} - -@Component({ - selector: '[pTableBody]', - template: ` - - - - - - - - - - - - - - - - - - - - ` -}) -export class TableBody { - - @Input("pTableBody") columns: Column[]; - - @Input("pTableBodyTemplate") template: TemplateRef; - - constructor(public dt: Table) {} -} - -@Component({ - selector: '[pScrollableView]', - template: ` -
-
- - - - - - - - - - -
-
-
-
- - - -
-
-
- - ` -}) -export class ScrollableView implements AfterViewInit,OnDestroy { - - @Input("pScrollableView") columns: Column[]; - - @Input() frozen: boolean; - - @ViewChild('scrollHeader') scrollHeaderViewChild: ElementRef; - - @ViewChild('scrollHeaderBox') scrollHeaderBoxViewChild: ElementRef; - - @ViewChild('scrollBody') scrollBodyViewChild: ElementRef; - - @ViewChild('scrollTable') scrollTableViewChild: ElementRef; - - @ViewChild('scrollFooter') scrollFooterViewChild: ElementRef; - - @ViewChild('scrollFooterBox') scrollFooterBoxViewChild: ElementRef; - - @ViewChild('virtualScroller') virtualScrollerViewChild: ElementRef; - - headerScrollListener: Function; - - bodyScrollListener: Function; - - footerScrollListener: Function; - - frozenSiblingBody: Element; - - _scrollHeight: string; - - subscription: Subscription; - - constructor(public dt: Table, public el: ElementRef, public domHandler: DomHandler, public zone: NgZone) { - this.subscription = this.dt.tableService.valueSource$.subscribe(() => { - this.zone.runOutsideAngular(() => { - setTimeout(() => { - this.alignScrollBar(); - }, 50); - }); - }); - } - - @Input() get scrollHeight(): string { - return this._scrollHeight; - } - set scrollHeight(val: string) { - this._scrollHeight = val; - this.setScrollHeight(); - } - - ngAfterViewInit() { - this.bindEvents(); - this.setScrollHeight(); - this.alignScrollBar(); - - if(!this.frozen) { - if (this.dt.frozenColumns || this.dt.frozenBodyTemplate) { - this.domHandler.addClass(this.el.nativeElement, 'ui-table-unfrozen-view'); - } - - if(this.dt.frozenWidth) { - this.el.nativeElement.style.left = this.dt.frozenWidth; - this.el.nativeElement.style.width = 'calc(100% - ' + this.dt.frozenWidth + ')'; - } - - let frozenView = this.el.nativeElement.previousElementSibling; - if (frozenView) { - this.frozenSiblingBody = this.domHandler.findSingle(frozenView, '.ui-table-scrollable-body'); - } - } - else { - this.scrollBodyViewChild.nativeElement.style.paddingBottom = this.domHandler.calculateScrollbarWidth() + 'px'; - } - - if(this.dt.virtualScroll) { - this.virtualScrollerViewChild.nativeElement.style.height = this.dt.totalRecords * this.dt.virtualRowHeight + 'px'; - } - } - - bindEvents() { - this.zone.runOutsideAngular(() => { - let scrollBarWidth = this.domHandler.calculateScrollbarWidth(); - - if (this.scrollHeaderViewChild && this.scrollHeaderViewChild.nativeElement) { - this.headerScrollListener = this.onHeaderScroll.bind(this); - this.scrollHeaderBoxViewChild.nativeElement.addEventListener('scroll', this.headerScrollListener); - } - - if (this.scrollFooterViewChild && this.scrollFooterViewChild.nativeElement) { - this.footerScrollListener = this.onFooterScroll.bind(this); - this.scrollFooterViewChild.nativeElement.addEventListener('scroll', this.footerScrollListener); - } - - if(!this.frozen) { - this.bodyScrollListener = this.onBodyScroll.bind(this); - this.scrollBodyViewChild.nativeElement.addEventListener('scroll', this.bodyScrollListener); - } - }); - } - - unbindEvents() { - if (this.scrollHeaderViewChild && this.scrollHeaderViewChild.nativeElement) { - this.scrollHeaderBoxViewChild.nativeElement.removeEventListener('scroll', this.headerScrollListener); - } - - if (this.scrollFooterViewChild && this.scrollFooterViewChild.nativeElement) { - this.scrollFooterViewChild.nativeElement.removeEventListener('scroll', this.footerScrollListener); - } - - this.scrollBodyViewChild.nativeElement.addEventListener('scroll', this.bodyScrollListener); - } - - onHeaderScroll(event) { - this.scrollHeaderViewChild.nativeElement.scrollLeft = 0; - } - - onFooterScroll(event) { - this.scrollFooterViewChild.nativeElement.scrollLeft = 0; - } - - onBodyScroll(event) { - if (this.scrollHeaderViewChild && this.scrollHeaderViewChild.nativeElement) { - this.scrollHeaderBoxViewChild.nativeElement.style.marginLeft = -1 * this.scrollBodyViewChild.nativeElement.scrollLeft + 'px'; - } - - if (this.scrollFooterViewChild && this.scrollFooterViewChild.nativeElement) { - this.scrollFooterBoxViewChild.nativeElement.style.marginLeft = -1 * this.scrollBodyViewChild.nativeElement.scrollLeft + 'px'; - } - - if (this.frozenSiblingBody) { - this.frozenSiblingBody.scrollTop = this.scrollBodyViewChild.nativeElement.scrollTop; - } - - if(this.dt.virtualScroll) { - let viewport = this.domHandler.getOuterHeight(this.scrollBodyViewChild.nativeElement); - let tableHeight = this.domHandler.getOuterHeight(this.scrollTableViewChild.nativeElement); - let pageHeight = 28 * this.dt.rows; - let virtualTableHeight = this.domHandler.getOuterHeight(this.virtualScrollerViewChild.nativeElement); - let pageCount = (virtualTableHeight / pageHeight)||1; - let scrollBodyTop = this.scrollTableViewChild.nativeElement.style.top||'0'; - - if((this.scrollBodyViewChild.nativeElement.scrollTop + viewport > parseFloat(scrollBodyTop) + tableHeight) || (this.scrollBodyViewChild.nativeElement.scrollTop < parseFloat(scrollBodyTop))) { - let page = Math.floor((this.scrollBodyViewChild.nativeElement.scrollTop * pageCount) / (this.scrollBodyViewChild.nativeElement.scrollHeight)) + 1; - this.dt.handleVirtualScroll({ - page: page, - callback: () => { - this.scrollTableViewChild.nativeElement.style.top = ((page - 1) * pageHeight) + 'px'; - - if (this.frozenSiblingBody) { - ( this.frozenSiblingBody.children[0]).style.top = this.scrollTableViewChild.nativeElement.style.top; - } - } - }); - } - } - } - - setScrollHeight() { - if(this.scrollHeight && this.scrollBodyViewChild && this.scrollBodyViewChild.nativeElement) { - if(this.scrollHeight.indexOf('%') !== -1) { - this.scrollBodyViewChild.nativeElement.style.visibility = 'hidden'; - this.scrollBodyViewChild.nativeElement.style.height = '100px'; //temporary height to calculate static height - let containerHeight = this.domHandler.getOuterHeight(this.dt.el.nativeElement.children[0]); - let relativeHeight = this.domHandler.getOuterHeight(this.dt.el.nativeElement.parentElement) * parseInt(this.scrollHeight) / 100; - let staticHeight = containerHeight - 100; //total height of headers, footers, paginators - let scrollBodyHeight = (relativeHeight - staticHeight); - - this.scrollBodyViewChild.nativeElement.style.height = 'auto'; - this.scrollBodyViewChild.nativeElement.style.maxHeight = scrollBodyHeight + 'px'; - this.scrollBodyViewChild.nativeElement.style.visibility = 'visible'; - } - else { - this.scrollBodyViewChild.nativeElement.style.maxHeight = this.scrollHeight; - } - } - } - - hasVerticalOverflow() { - return this.domHandler.getOuterHeight(this.scrollTableViewChild.nativeElement) > this.domHandler.getOuterHeight(this.scrollBodyViewChild.nativeElement); - } - - alignScrollBar() { - if(!this.frozen) { - let scrollBarWidth = this.hasVerticalOverflow() ? this.domHandler.calculateScrollbarWidth() : 0; - this.scrollHeaderBoxViewChild.nativeElement.style.marginRight = scrollBarWidth + 'px'; - if(this.scrollFooterBoxViewChild && this.scrollFooterBoxViewChild.nativeElement) { - this.scrollFooterBoxViewChild.nativeElement.style.marginRight = scrollBarWidth + 'px'; - } - } - } - - ngOnDestroy() { - this.unbindEvents(); - - this.frozenSiblingBody = null; - - if(this.subscription) { - this.subscription.unsubscribe(); - } - } -} - -@Directive({ - selector: '[pSortableColumn]', - providers: [DomHandler], - host: { - '[class.ui-sortable-column]': 'true', - '[class.ui-state-highlight]': 'sorted' - } -}) -export class SortableColumn implements OnInit, OnDestroy { - - @Input("pSortableColumn") field: string; - - @Input() pSortableColumnDisabled: boolean; - - sorted: boolean; - - subscription: Subscription; - - constructor(public dt: Table, public domHandler: DomHandler) { - if (this.isEnabled()) { - this.subscription = this.dt.tableService.sortSource$.subscribe(sortMeta => { - this.updateSortState(); - }); - } - } - - ngOnInit() { - if (this.isEnabled()) { - this.updateSortState(); - } - } - - updateSortState() { - this.sorted = this.dt.isSorted(this.field); - } - - @HostListener('click', ['$event']) - onClick(event: MouseEvent) { - if (this.isEnabled()) { - this.updateSortState(); - this.dt.sort({ - originalEvent: event, - field: this.field - }); - - this.domHandler.clearSelection(); - } - } - - isEnabled() { - return this.pSortableColumnDisabled !== true; - } - - ngOnDestroy() { - if (this.subscription) { - this.subscription.unsubscribe(); - } - } - -} - - -@Component({ - selector: 'p-sortIcon', - template: ` - - ` -}) -export class SortIcon implements OnInit, OnDestroy { - - @Input() field: string; - - subscription: Subscription; - - sortOrder: number; - - sorted: boolean; - - constructor(public dt: Table) { - this.subscription = this.dt.tableService.sortSource$.subscribe(sortMeta => { - this.updateSortState(); - }); - } - - ngOnInit() { - this.updateSortState(); - } - - updateSortState() { - if (this.dt.sortMode === 'single') { - this.sortOrder = this.dt.isSorted(this.field) ? this.dt.sortOrder : 0; - } - else if (this.dt.sortMode === 'multiple') { - let sortMeta = this.dt.getSortMeta(this.field); - this.sortOrder = sortMeta ? sortMeta.order: 0; - } - } - - ngOnDestroy() { - if (this.subscription) { - this.subscription.unsubscribe(); - } - } -} - -@Directive({ - selector: '[pSelectableRow]', - providers: [DomHandler], - host: { - '[class.ui-state-highlight]': 'selected' - } -}) -export class SelectableRow implements OnInit, OnDestroy { - - @Input("pSelectableRow") data: any; - - @Input("pSelectableRowIndex") index: number; - - @Input() pSelectableRowDisabled: boolean; - - selected: boolean; - - subscription: Subscription; - - constructor(public dt: Table, public domHandler: DomHandler, public tableService: TableService) { - if (this.isEnabled()) { - this.subscription = this.dt.tableService.selectionSource$.subscribe(() => { - this.selected = this.dt.isSelected(this.data); - }); - } - } - - ngOnInit() { - if (this.isEnabled()) { - this.selected = this.dt.isSelected(this.data); - } - } - - @HostListener('click', ['$event']) - onClick(event: Event) { - if (this.isEnabled()) { - this.dt.handleRowClick({ - originalEvent: event, - rowData: this.data, - rowIndex: this.index - }); - } - } - - @HostListener('touchend', ['$event']) - onTouchEnd(event: Event) { - if (this.isEnabled()) { - this.dt.handleRowTouchEnd(event); - } - } - - isEnabled() { - return this.pSelectableRowDisabled !== true; - } - - ngOnDestroy() { - if (this.subscription) { - this.subscription.unsubscribe(); - } - } - -} - -@Directive({ - selector: '[pSelectableRowDblClick]', - providers: [DomHandler], - host: { - '[class.ui-state-highlight]': 'selected' - } -}) -export class SelectableRowDblClick implements OnInit, OnDestroy { - - @Input("pSelectableRowDblClick") data: any; - - @Input("pSelectableRowIndex") index: number; - - @Input() pSelectableRowDisabled: boolean; - - selected: boolean; - - subscription: Subscription; - - constructor(public dt: Table, public domHandler: DomHandler, public tableService: TableService) { - if (this.isEnabled()) { - this.subscription = this.dt.tableService.selectionSource$.subscribe(() => { - this.selected = this.dt.isSelected(this.data); - }); - } - } - - ngOnInit() { - if (this.isEnabled()) { - this.selected = this.dt.isSelected(this.data); - } - } - - @HostListener('dblclick', ['$event']) - onClick(event: Event) { - if (this.isEnabled()) { - this.dt.handleRowClick({ - originalEvent: event, - rowData: this.data, - rowIndex: this.index - }); - } - } - - isEnabled() { - return this.pSelectableRowDisabled !== true; - } - - ngOnDestroy() { - if (this.subscription) { - this.subscription.unsubscribe(); - } - } - -} - -@Directive({ - selector: '[pContextMenuRow]', - host: { - '[class.ui-contextmenu-selected]': 'selected' - } -}) -export class ContextMenuRow { - - @Input("pContextMenuRow") data: any; - - @Input() pContextMenuRowDisabled: boolean; - - selected: boolean; - - subscription: Subscription; - - constructor(public dt: Table, public tableService: TableService) { - if (this.isEnabled()) { - this.subscription = this.dt.tableService.contextMenuSource$.subscribe((data) => { - this.selected = this.dt.equals(this.data, data); - }); - } - } - - @HostListener('contextmenu', ['$event']) - onContextMenu(event: Event) { - if (this.isEnabled()) { - this.dt.handleRowRightClick({ - originalEvent: event, - rowData: this.data - }); - - event.preventDefault(); - } - } - - isEnabled() { - return this.pContextMenuRowDisabled !== true; - } - - ngOnDestroy() { - if (this.subscription) { - this.subscription.unsubscribe(); - } - } - -} - -@Directive({ - selector: '[pRowToggler]' -}) -export class RowToggler { - - @Input('pRowToggler') data: any; - - @Input() pRowTogglerDisabled: boolean; - - constructor(public dt: Table) { } - - @HostListener('click', ['$event']) - onClick(event: Event) { - if (this.isEnabled()) { - this.dt.toggleRow(this.data, event); - event.preventDefault(); - } - } - - isEnabled() { - return this.pRowTogglerDisabled !== true; - } -} - -@Directive({ - selector: '[pResizableColumn]' -}) -export class ResizableColumn implements AfterViewInit, OnDestroy { - - @Input() pResizableColumnDisabled: boolean; - - resizer: HTMLSpanElement; - - resizerMouseDownListener: any; - - documentMouseMoveListener: any; - - documentMouseUpListener: any; - - constructor(public dt: Table, public el: ElementRef, public domHandler: DomHandler, public zone: NgZone) { } - - ngAfterViewInit() { - if (this.isEnabled()) { - this.domHandler.addClass(this.el.nativeElement, 'ui-resizable-column'); - this.resizer = document.createElement('span'); - this.resizer.className = 'ui-column-resizer ui-clickable'; - this.el.nativeElement.appendChild(this.resizer); - - this.zone.runOutsideAngular(() => { - this.resizerMouseDownListener = this.onMouseDown.bind(this); - this.resizer.addEventListener('mousedown', this.resizerMouseDownListener); - }); - } - } - - bindDocumentEvents() { - this.zone.runOutsideAngular(() => { - this.documentMouseMoveListener = this.onDocumentMouseMove.bind(this); - document.addEventListener('mousemove', this.documentMouseMoveListener); - - this.documentMouseUpListener = this.onDocumentMouseUp.bind(this); - document.addEventListener('mouseup', this.documentMouseUpListener); - }); - } - - unbindDocumentEvents() { - if (this.documentMouseMoveListener) { - document.removeEventListener('mousemove', this.documentMouseMoveListener); - this.documentMouseMoveListener = null; - } - - if (this.documentMouseUpListener) { - document.removeEventListener('mouseup', this.documentMouseUpListener); - this.documentMouseUpListener = null; - } - } - - onMouseDown(event: Event) { - this.dt.onColumnResizeBegin(event); - this.bindDocumentEvents(); - } - - onDocumentMouseMove(event: Event) { - this.dt.onColumnResize(event); - } - - onDocumentMouseUp(event: Event) { - this.dt.onColumnResizeEnd(event, this.el.nativeElement); - this.unbindDocumentEvents(); - } - - isEnabled() { - return this.pResizableColumnDisabled !== true; - } - - ngOnDestroy() { - if (this.resizerMouseDownListener) { - this.resizer.removeEventListener('mousedown', this.resizerMouseDownListener); - } - - this.unbindDocumentEvents(); - } -} - -@Directive({ - selector: '[pReorderableColumn]' -}) -export class ReorderableColumn implements AfterViewInit, OnDestroy { - - @Input() pReorderableColumnDisabled: boolean; - - dragStartListener: any; - - dragOverListener: any; - - dragEnterListener: any; - - dragLeaveListener: any; - - mouseDownListener: any; - - constructor(public dt: Table, public el: ElementRef, public domHandler: DomHandler, public zone: NgZone) { } - - ngAfterViewInit() { - if (this.isEnabled()) { - this.bindEvents(); - } - } - - bindEvents() { - this.zone.runOutsideAngular(() => { - this.mouseDownListener = this.onMouseDown.bind(this); - this.el.nativeElement.addEventListener('mousedown', this.mouseDownListener); - - this.dragStartListener = this.onDragStart.bind(this); - this.el.nativeElement.addEventListener('dragstart', this.dragStartListener); - - this.dragOverListener = this.onDragEnter.bind(this); - this.el.nativeElement.addEventListener('dragover', this.dragOverListener); - - this.dragEnterListener = this.onDragEnter.bind(this); - this.el.nativeElement.addEventListener('dragenter', this.dragEnterListener); - - this.dragLeaveListener = this.onDragLeave.bind(this); - this.el.nativeElement.addEventListener('dragleave', this.dragLeaveListener); - }); - } - - unbindEvents() { - if (this.mouseDownListener) { - document.removeEventListener('mousedown', this.mouseDownListener); - this.mouseDownListener = null; - } - - if (this.dragOverListener) { - document.removeEventListener('dragover', this.dragOverListener); - this.dragOverListener = null; - } - - if (this.dragEnterListener) { - document.removeEventListener('dragenter', this.dragEnterListener); - this.dragEnterListener = null; - } - - if (this.dragEnterListener) { - document.removeEventListener('dragenter', this.dragEnterListener); - this.dragEnterListener = null; - } - - if (this.dragLeaveListener) { - document.removeEventListener('dragleave', this.dragLeaveListener); - this.dragLeaveListener = null; - } - } - - onMouseDown(event) { - if (event.target.nodeName === 'INPUT') - this.el.nativeElement.draggable = false; - else - this.el.nativeElement.draggable = true; - } - - onDragStart(event) { - this.dt.onColumnDragStart(event, this.el.nativeElement); - } - - onDragOver(event) { - event.preventDefault(); - } - - onDragEnter(event) { - this.dt.onColumnDragEnter(event, this.el.nativeElement); - } - - onDragLeave(event) { - this.dt.onColumnDragLeave(event); - } - - @HostListener('drop', ['$event']) - onDrop(event) { - if (this.isEnabled()) { - this.dt.onColumnDrop(event, this.el.nativeElement); - } - } - - isEnabled() { - return this.pReorderableColumnDisabled !== true; - } - - ngOnDestroy() { - this.unbindEvents(); - } - -} - -@Directive({ - selector: '[pEditableColumn]' -}) -export class EditableColumn implements AfterViewInit { - - @Input("pEditableColumn") data: any; - - @Input("pEditableColumnField") field: any; - - @Input() pEditableColumnDisabled: boolean; - - constructor(public dt: Table, public el: ElementRef, public domHandler: DomHandler, public zone: NgZone) {} - - ngAfterViewInit() { - if (this.isEnabled()) { - this.domHandler.addClass(this.el.nativeElement, 'ui-editable-column'); - } - } - - isValid() { - return (this.dt.editingCell && this.domHandler.find(this.dt.editingCell, '.ng-invalid.ng-dirty').length === 0); - } - - @HostListener('click', ['$event']) - onClick(event: MouseEvent) { - if (this.isEnabled()) { - if (this.dt.editingCell) { - if (this.dt.editingCell !== this.el.nativeElement) { - if (!this.isValid()) { - return; - } - - this.domHandler.removeClass(this.dt.editingCell, 'ui-editing-cell'); - this.openCell(); - } - } - else { - this.openCell(); - } - } - } - - openCell() { - this.dt.editingCell = this.el.nativeElement; - this.domHandler.addClass(this.el.nativeElement, 'ui-editing-cell'); - this.dt.onEditInit.emit({ field: this.field, data: this.data}); - this.zone.runOutsideAngular(() => { - setTimeout(() => { - let focusable = this.domHandler.findSingle(this.el.nativeElement, 'input, textarea'); - if (focusable) { - focusable.focus(); - } - }, 50); - }); - } - - @HostListener('keydown', ['$event']) - onKeyDown(event: KeyboardEvent) { - if (this.isEnabled()) { - //enter - if (event.keyCode == 13) { - if (this.isValid()) { - this.domHandler.removeClass(this.dt.editingCell, 'ui-editing-cell'); - this.dt.editingCell = null; - this.dt.onEditComplete.emit({ field: this.field, data: this.data }); - } - - event.preventDefault(); - } - - //escape - else if (event.keyCode == 27) { - if (this.isValid()) { - this.domHandler.removeClass(this.dt.editingCell, 'ui-editing-cell'); - this.dt.editingCell = null; - this.dt.onEditCancel.emit({ field: this.field, data: this.data }); - } - - event.preventDefault(); - } - - //tab - else if (event.keyCode == 9) { - if (event.shiftKey) - this.moveToPreviousCell(event); - else - this.moveToNextCell(event); - } - } - } - - findCell(element) { - if (element) { - let cell = element; - while (cell && !this.domHandler.hasClass(cell, 'ui-editing-cell')) { - cell = cell.parentElement; - } - - return cell; - } - else { - return null; - } - } - - moveToPreviousCell(event: KeyboardEvent) { - let currentCell = this.findCell(event.target); - let row = currentCell.parentElement; - let targetCell = this.findPreviousEditableColumn(currentCell); - - if (targetCell) { - this.domHandler.invokeElementMethod(targetCell, 'click'); - event.preventDefault(); - } - } - - moveToNextCell(event: KeyboardEvent) { - let currentCell = this.findCell(event.target); - let row = currentCell.parentElement; - let targetCell = this.findNextEditableColumn(currentCell); - - if (targetCell) { - this.domHandler.invokeElementMethod(targetCell, 'click'); - event.preventDefault(); - } - } - - findPreviousEditableColumn(cell: Element) { - let prevCell = cell.previousElementSibling; - - if (!prevCell) { - let previousRow = cell.parentElement.previousElementSibling; - if (previousRow) { - prevCell = previousRow.lastElementChild; - } - } - - if (prevCell) { - if (this.domHandler.hasClass(prevCell, 'ui-editable-column')) - return prevCell; - else - return this.findPreviousEditableColumn(prevCell); - } - else { - return null; - } - } - - findNextEditableColumn(cell: Element) { - let nextCell = cell.nextElementSibling; - - if (!nextCell) { - let nextRow = cell.parentElement.nextElementSibling; - if (nextRow) { - nextCell = nextRow.firstElementChild; - } - } - - if (nextCell) { - if (this.domHandler.hasClass(nextCell, 'ui-editable-column')) - return nextCell; - else - return this.findNextEditableColumn(nextCell); - } - else { - return null; - } - } - - isEnabled() { - return this.pEditableColumnDisabled !== true; - } - -} - -@Component({ - selector: 'p-cellEditor', - template: ` - - - - - - - ` -}) -export class CellEditor implements AfterContentInit { - - @ContentChildren(PrimeTemplate) templates: QueryList; - - inputTemplate: TemplateRef; - - outputTemplate: TemplateRef; - - constructor(public dt: Table, public editableColumn: EditableColumn) { } - - ngAfterContentInit() { - this.templates.forEach((item) => { - switch (item.getType()) { - case 'input': - this.inputTemplate = item.template; - break; - - case 'output': - this.outputTemplate = item.template; - break; - } - }); - } - -} - -@Component({ - selector: 'p-tableRadioButton', - template: ` -
-
- -
-
- -
-
- ` -}) -export class TableRadioButton { - - @Input() disabled: boolean; - - @Input() value: any; - - @ViewChild('box') boxViewChild: ElementRef; - - checked: boolean; - - subscription: Subscription; - - constructor(public dt: Table, public domHandler: DomHandler, public tableService: TableService) { - this.subscription = this.dt.tableService.selectionSource$.subscribe(() => { - this.checked = this.dt.isSelected(this.value); - }); - } - - ngOnInit() { - this.checked = this.dt.isSelected(this.value); - } - - onClick(event: Event) { - this.dt.toggleRowWithRadio(event, this.value); - this.domHandler.clearSelection(); - } - - onFocus() { - this.domHandler.addClass(this.boxViewChild.nativeElement, 'ui-state-focus'); - } - - onBlur() { - this.domHandler.removeClass(this.boxViewChild.nativeElement, 'ui-state-focus'); - } - - ngOnDestroy() { - if (this.subscription) { - this.subscription.unsubscribe(); - } - } - -} - -@Component({ - selector: 'p-tableCheckbox', - template: ` -
-
- -
-
- -
-
- ` -}) -export class TableCheckbox { - - @Input() disabled: boolean; - - @Input() value: any; - - @ViewChild('box') boxViewChild: ElementRef; - - checked: boolean; - - subscription: Subscription; - - constructor(public dt: Table, public domHandler: DomHandler, public tableService: TableService) { - this.subscription = this.dt.tableService.selectionSource$.subscribe(() => { - this.checked = this.dt.isSelected(this.value); - }); - } - - ngOnInit() { - this.checked = this.dt.isSelected(this.value); - } - - onClick(event: Event) { - this.dt.toggleRowWithCheckbox(event, this.value); - this.domHandler.clearSelection(); - } - - onFocus() { - this.domHandler.addClass(this.boxViewChild.nativeElement, 'ui-state-focus'); - } - - onBlur() { - this.domHandler.removeClass(this.boxViewChild.nativeElement, 'ui-state-focus'); - } - - ngOnDestroy() { - if (this.subscription) { - this.subscription.unsubscribe(); - } - } - -} - -@Component({ - selector: 'p-tableHeaderCheckbox', - template: ` -
-
- -
-
- -
-
- ` -}) -export class TableHeaderCheckbox { - - @ViewChild('box') boxViewChild: ElementRef; - - checked: boolean; - - disabled: boolean; - - subscription: Subscription; - - constructor(public dt: Table, public domHandler: DomHandler, public tableService: TableService) { - this.subscription = this.dt.tableService.selectionSource$.subscribe(() => { - this.checked = this.updateCheckedState(); - }); - } - - ngOnInit() { - this.checked = this.updateCheckedState(); - } - - onClick(event: Event, checked) { - if(this.dt.value && this.dt.value.length > 0) { - this.dt.toggleRowsWithCheckbox(event, !checked); - } - - this.domHandler.clearSelection(); - } - - onFocus() { - this.domHandler.addClass(this.boxViewChild.nativeElement, 'ui-state-focus'); - } - - onBlur() { - this.domHandler.removeClass(this.boxViewChild.nativeElement, 'ui-state-focus'); - } - - ngOnDestroy() { - if (this.subscription) { - this.subscription.unsubscribe(); - } - } - - updateCheckedState() { - return (this.dt.value && this.dt.value.length > 0 && this.dt.selection && this.dt.selection.length > 0 && this.dt.selection.length === this.dt.value.length); - } - -} - -@Directive({ - selector: '[pReorderableRowHandle]' -}) -export class ReorderableRowHandle implements AfterViewInit { - - @Input("pReorderableRowHandle") index: number; - - constructor(public el: ElementRef, public domHandler: DomHandler) {} - - ngAfterViewInit() { - this.domHandler.addClass(this.el.nativeElement, 'ui-table-reorderablerow-handle'); - } -} - -@Directive({ - selector: '[pReorderableRow]' -}) -export class ReorderableRow implements AfterViewInit { - - @Input("pReorderableRow") index: number; - - @Input() pReorderableRowDisabled: boolean; - - mouseDownListener: any; - - dragStartListener: any; - - dragEndListener: any; - - dragOverListener: any; - - dragLeaveListener: any; - - dropListener: any; - - constructor(public dt: Table, public el: ElementRef, public domHandler: DomHandler, public zone: NgZone) {} - - ngAfterViewInit() { - if (this.isEnabled()) { - this.el.nativeElement.droppable = true; - this.bindEvents(); - } - } - - bindEvents() { - this.zone.runOutsideAngular(() => { - this.mouseDownListener = this.onMouseDown.bind(this); - this.el.nativeElement.addEventListener('mousedown', this.mouseDownListener); - - this.dragStartListener = this.onDragStart.bind(this); - this.el.nativeElement.addEventListener('dragstart', this.dragStartListener); - - this.dragEndListener = this.onDragEnd.bind(this); - this.el.nativeElement.addEventListener('dragend', this.dragEndListener); - - this.dragOverListener = this.onDragOver.bind(this); - this.el.nativeElement.addEventListener('dragover', this.dragOverListener); - - this.dragLeaveListener = this.onDragLeave.bind(this); - this.el.nativeElement.addEventListener('dragleave', this.dragLeaveListener); - }); - } - - unbindEvents() { - if (this.mouseDownListener) { - document.removeEventListener('mousedown', this.mouseDownListener); - this.mouseDownListener = null; - } - - if (this.dragStartListener) { - document.removeEventListener('dragstart', this.dragStartListener); - this.dragStartListener = null; - } - - if (this.dragEndListener) { - document.removeEventListener('dragend', this.dragEndListener); - this.dragEndListener = null; - } - - if (this.dragOverListener) { - document.removeEventListener('dragover', this.dragOverListener); - this.dragOverListener = null; - } - - if (this.dragLeaveListener) { - document.removeEventListener('dragleave', this.dragLeaveListener); - this.dragLeaveListener = null; - } - } - - onMouseDown(event) { - if (this.domHandler.hasClass(event.target, 'ui-table-reorderablerow-handle')) - this.el.nativeElement.draggable = true; - else - this.el.nativeElement.draggable = false; - } - - onDragStart(event) { - this.dt.onRowDragStart(event, this.index); - } - - onDragEnd(event) { - this.dt.onRowDragEnd(event); - this.el.nativeElement.draggable = false; - } - - onDragOver(event) { - this.dt.onRowDragOver(event, this.index, this.el.nativeElement); - event.preventDefault(); - } - - onDragLeave(event) { - this.dt.onRowDragLeave(event, this.el.nativeElement); - } - - isEnabled() { - return this.pReorderableRowDisabled !== true; - } - - @HostListener('drop', ['$event']) - onDrop(event) { - if (this.isEnabled() && this.dt.rowDragging) { - this.dt.onRowDrop(event, this.el.nativeElement); - } - } -} - -@NgModule({ - imports: [CommonModule,PaginatorModule], - exports: [Table,SharedModule,SortableColumn,SelectableRow,RowToggler,ContextMenuRow,ResizableColumn,ReorderableColumn,EditableColumn,CellEditor,SortIcon,TableRadioButton,TableCheckbox,TableHeaderCheckbox,ReorderableRowHandle,ReorderableRow,SelectableRowDblClick], - declarations: [Table,SortableColumn,SelectableRow,RowToggler,ContextMenuRow,ResizableColumn,ReorderableColumn,EditableColumn,CellEditor,TableBody,ScrollableView,SortIcon,TableRadioButton,TableCheckbox,TableHeaderCheckbox,ReorderableRowHandle,ReorderableRow,SelectableRowDblClick] -}) -export class TableModule { } \ No newline at end of file diff --git a/dashboard/src/app/components/tabmenu/tabmenu.css b/dashboard/src/app/components/tabmenu/tabmenu.css deleted file mode 100644 index 506b2cf24..000000000 --- a/dashboard/src/app/components/tabmenu/tabmenu.css +++ /dev/null @@ -1,35 +0,0 @@ -/** TabMenu **/ -.ui-tabmenu .ui-tabmenu-nav { - margin: 0; - padding: .25em .5em 0 .25em; -} - -.ui-tabmenu .ui-tabmenu-nav .ui-tabmenuitem { - list-style: none; - float: left; - position: relative; - margin: 0 .2em 1px 0; - padding: 0; - white-space: nowrap; - display: block; - border-bottom: 0; - top: 1px; -} - -.ui-tabmenu .ui-tabmenu-nav .ui-tabmenuitem a { - float: left; - padding: 0.5em 1em; - text-decoration: none; -} - -.ui-tabmenu .ui-tabmenu-nav a { - padding: 0.5em 1em; -} - -.ui-tabmenu .ui-tabmenu-nav .ui-tabmenuitem .ui-icon { - float: left; -} - -.ui-tabmenu .ui-tabmenu-nav .ui-tabmenuitem.ui-state-disabled a { - cursor: default; -} \ No newline at end of file diff --git a/dashboard/src/app/components/tabmenu/tabmenu.spec.ts b/dashboard/src/app/components/tabmenu/tabmenu.spec.ts deleted file mode 100644 index 7c15af923..000000000 --- a/dashboard/src/app/components/tabmenu/tabmenu.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { TabMenu } from './tabmenu'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('TabMenu', () => { - - let tabmenu: TabMenu; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - TabMenu - ] - }); - - fixture = TestBed.createComponent(TabMenu); - tabmenu = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/tabmenu/tabmenu.ts b/dashboard/src/app/components/tabmenu/tabmenu.ts deleted file mode 100644 index 7e3ffea6b..000000000 --- a/dashboard/src/app/components/tabmenu/tabmenu.ts +++ /dev/null @@ -1,71 +0,0 @@ -import {NgModule,Component,ElementRef,Input,Output} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {DomHandler} from '../dom/domhandler'; -import {MenuItem} from '../common/menuitem'; -import {Location} from '@angular/common'; -import {RouterModule} from '@angular/router'; - -@Component({ - selector: 'p-tabMenu', - template: ` - - `, - providers: [DomHandler] -}) -export class TabMenu { - - @Input() model: MenuItem[]; - - @Input() activeItem: MenuItem; - - @Input() popup: boolean; - - @Input() style: any; - - @Input() styleClass: string; - - itemClick(event: Event, item: MenuItem) { - if(item.disabled) { - event.preventDefault(); - return; - } - - if(!item.url) { - event.preventDefault(); - } - - if(item.command) { - item.command({ - originalEvent: event, - item: item - }); - } - - this.activeItem = item; - } -} - -@NgModule({ - imports: [CommonModule,RouterModule], - exports: [TabMenu,RouterModule], - declarations: [TabMenu] -}) -export class TabMenuModule { } diff --git a/dashboard/src/app/components/tabview/tabview.scss b/dashboard/src/app/components/tabview/tabview.scss deleted file mode 100644 index 15fff9f80..000000000 --- a/dashboard/src/app/components/tabview/tabview.scss +++ /dev/null @@ -1,143 +0,0 @@ -.ui-tabview { - padding: 0; -} - -.ui-tabview .ui-tabview-nav { - margin: 0; -} - -.ui-tabview .ui-tabview-nav li { - list-style: none; - float: left; - top: 0.01rem; - position: relative; - margin-right: 0.30rem; - padding: 0; - white-space: nowrap; -} - -.ui-tabview .ui-tabview-nav li a { - float: left; - padding: 0 0.05rem; - font-size: 0.16rem; - line-height: 0.20rem; - height: 0.32rem; - text-decoration: none; -} - -.ui-tabview.ui-tabview-large .ui-tabview-nav li a { - padding: 0 0.05rem; - font-size: 0.20rem; - line-height: 0.24rem; - height: 0.40rem; -} - -.ui-tabview .ui-tabview-nav li.ui-tabview-selected a, -.ui-tabview .ui-tabview-nav li.ui-state-disabled a, -.ui-tabview .ui-tabview-nav li.ui-state-processing a { - cursor: text; -} - -.ui-tabview .ui-tabview-nav li a, -.ui-tabview.ui-tabview-collapsible .ui-tabview-nav li.ui-tabview-selected a { - cursor: pointer; -} - -.ui-tabview .ui-tabview-panel { - border-width: 0; - padding: 0.3rem 0; - background: none; -} - -.ui-tabview .ui-tabview-nav li { - display: block; -} - -.ui-tabview .ui-tabview-nav li .ui-tabview-left-icon, -.ui-tabview .ui-tabview-nav li .ui-tabview-right-icon, -.ui-tabview .ui-tabview-nav li .ui-tabview-title { - vertical-align: middle; -} - -.ui-tabview .ui-tabview-nav li .ui-tabview-close { - margin: 0.5em 0.3em 0 0; - cursor: pointer; -} - -/* per orientation settings */ -/* top and bottom */ -.ui-tabview.ui-tabview-top > .ui-tabview-nav li { - border-bottom: 0; -} - -.ui-tabview.ui-tabview-top > .ui-tabview-nav { - padding: 0; - border-bottom: 1px solid $color-splitline; -} - -.ui-tabview.ui-tabview-bottom > .ui-tabview-nav { - padding: 0 .2em .2em; -} - -.ui-tabview.ui-tabview-bottom > .ui-tabview-nav li { - border-top: 0; -} - -/* left and right*/ -.ui-tabview-left::after, -.ui-tabview-right::after { - clear:both; - content: "."; - display: block; - height: 0; - visibility: hidden; -} - -.ui-tabview-left > .ui-tabview-nav { - float:left; - width: 25%; - height: 300px; - background-image: none; - padding-top: 1px; -} - -.ui-tabview-left > .ui-tabview-panels { - float:right; - width: 75%; -} - -.ui-tabview.ui-tabview-left > .ui-tabview-nav li, -.ui-tabview.ui-tabview-right > .ui-tabview-nav li{ - display: block; - float: right; - white-space: normal; - width: 99%; -} - -.ui-tabview.ui-tabview-left > .ui-tabview-nav li { - margin: 0 0 1px 0; - border-right:0 none; -} - -.ui-tabview.ui-tabview-right > .ui-tabview-nav { - float:right; - width: 25%; - height: 300px; - background-image: none; - padding-top: 1px; -} - -.ui-tabview.ui-tabview-right > .ui-tabview-panels { - float:left; - width: 75%; -} - -.ui-tabview.ui-tabview-right > .ui-tabview-nav li { - margin: 0 0 1px 0; - border-left:0 none; -} - -/* RTL */ -.ui-rtl .ui-tabview .ui-tabview-nav li { - float: right; -} diff --git a/dashboard/src/app/components/tabview/tabview.spec.ts b/dashboard/src/app/components/tabview/tabview.spec.ts deleted file mode 100644 index bd6abcfaf..000000000 --- a/dashboard/src/app/components/tabview/tabview.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { TabView } from './tabview'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('TabView', () => { - - let tabview: TabView; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - TabView - ] - }); - - fixture = TestBed.createComponent(TabView); - tabview = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/tabview/tabview.ts b/dashboard/src/app/components/tabview/tabview.ts deleted file mode 100644 index f57ddb1a6..000000000 --- a/dashboard/src/app/components/tabview/tabview.ts +++ /dev/null @@ -1,310 +0,0 @@ -import {NgModule,Component,ElementRef,OnDestroy,Input,Output,EventEmitter,HostListener,AfterContentInit, - ContentChildren,ContentChild,QueryList,TemplateRef,EmbeddedViewRef,ViewContainerRef} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {SharedModule,PrimeTemplate} from '../common/shared'; -import {BlockableUI} from '../common/blockableui'; - -let idx: number = 0; - -@Component({ - selector: '[p-tabViewNav]', - host:{ - '[class.ui-tabview-nav]': 'true', - '[class.ui-helper-reset]': 'true', - '[class.ui-helper-clearfix]': 'true', - '[class.ui-widget-header]': 'true', - '[class.ui-corner-all]': 'true' - }, - template: ` - -
  • - - - {{tab.header}} - - - -
  • -
    - `, -}) -export class TabViewNav { - - @Input() tabs: TabPanel[]; - - @Input() orientation: string = 'top'; - - @Output() onTabClick: EventEmitter = new EventEmitter(); - - @Output() onTabCloseClick: EventEmitter = new EventEmitter(); - - getDefaultHeaderClass(tab:TabPanel) { - let styleClass = 'ui-state-default ui-corner-' + this.orientation; - if(tab.headerStyleClass) { - styleClass = styleClass + " " + tab.headerStyleClass; - } - return styleClass; - } - - clickTab(event, tab: TabPanel) { - this.onTabClick.emit({ - originalEvent: event, - tab: tab - }) - } - - clickClose(event, tab: TabPanel) { - this.onTabCloseClick.emit({ - originalEvent: event, - tab: tab - }) - } -} - -@Component({ - selector: 'p-tabPanel', - template: ` -
    - - - - -
    - ` -}) -export class TabPanel implements AfterContentInit,OnDestroy { - - @Input() header: string; - - @Input() disabled: boolean; - - @Input() closable: boolean; - - @Input() headerStyle: any; - - @Input() headerStyleClass: string; - - @Input() leftIcon: string; - - @Input() rightIcon: string; - - @Input() cache: boolean = true; - - @ContentChildren(PrimeTemplate) templates: QueryList; - - constructor(public viewContainer: ViewContainerRef) {} - - closed: boolean; - - view: EmbeddedViewRef; - - _selected: boolean; - - loaded: boolean; - - id: string = `ui-tabpanel-${idx++}`; - - contentTemplate: TemplateRef; - - ngAfterContentInit() { - this.templates.forEach((item) => { - switch(item.getType()) { - case 'content': - this.contentTemplate = item.template; - break; - - default: - this.contentTemplate = item.template; - break; - } - }); - } - - @Input() get selected(): boolean { - return this._selected; - } - - set selected(val: boolean) { - this._selected = val; - this.loaded = true; - } - - ngOnDestroy() { - this.view = null; - } -} - -@Component({ - selector: 'p-tabView', - template: ` -
    -
      -
      - -
      -
        -
        - `, -}) -export class TabView implements AfterContentInit,BlockableUI { - - @Input() orientation: string = 'top'; - - @Input() style: any; - - @Input() styleClass: string; - - @Input() controlClose: boolean; - - @ContentChildren(TabPanel) tabPanels: QueryList; - - @Output() onChange: EventEmitter = new EventEmitter(); - - @Output() onClose: EventEmitter = new EventEmitter(); - - initialized: boolean; - - tabs: TabPanel[]; - - _activeIndex: number; - - _lazy: boolean; - - constructor(public el: ElementRef) {} - - @Input() get lazy(): boolean { - return this._lazy; - } - - set lazy(val: boolean) { - this._lazy = val; - console.log('Lazy property of TabView is deprecated, use an ngTemplate inside a TabPanel instead for Lazy Loading'); - } - - ngAfterContentInit() { - this.initTabs(); - - this.tabPanels.changes.subscribe(_ => { - this.initTabs(); - }); - } - - initTabs(): void { - this.tabs = this.tabPanels.toArray(); - let selectedTab: TabPanel = this.findSelectedTab(); - if(!selectedTab && this.tabs.length) { - if(this.activeIndex != null && this.tabs.length > this.activeIndex) - this.tabs[this.activeIndex].selected = true; - else - this.tabs[0].selected = true; - } - } - - open(event: Event, tab: TabPanel) { - if(tab.disabled) { - if(event) { - event.preventDefault(); - } - return; - } - - if(!tab.selected) { - let selectedTab: TabPanel = this.findSelectedTab(); - if(selectedTab) { - selectedTab.selected = false - } - tab.selected = true; - this.onChange.emit({originalEvent: event, index: this.findTabIndex(tab)}); - } - - if(event) { - event.preventDefault(); - } - } - - close(event: Event, tab: TabPanel) { - if(this.controlClose) { - this.onClose.emit({ - originalEvent: event, - index: this.findTabIndex(tab), - close: () => { - this.closeTab(tab); - }} - ); - } - else { - this.closeTab(tab); - this.onClose.emit({ - originalEvent: event, - index: this.findTabIndex(tab) - }); - } - - event.stopPropagation(); - } - - closeTab(tab: TabPanel) { - if(tab.selected) { - tab.selected = false; - for(let i = 0; i < this.tabs.length; i++) { - let tabPanel = this.tabs[i]; - if(!tabPanel.closed&&!tab.disabled) { - tabPanel.selected = true; - break; - } - } - } - - tab.closed = true; - } - - findSelectedTab() { - for(let i = 0; i < this.tabs.length; i++) { - if(this.tabs[i].selected) { - return this.tabs[i]; - } - } - return null; - } - - findTabIndex(tab: TabPanel) { - let index = -1; - for(let i = 0; i < this.tabs.length; i++) { - if(this.tabs[i] == tab) { - index = i; - break; - } - } - return index; - } - - getBlockableElement(): HTMLElement { - return this.el.nativeElement.children[0]; - } - - @Input() get activeIndex(): number { - return this._activeIndex; - } - - set activeIndex(val:number) { - this._activeIndex = val; - - if(this.tabs && this.tabs.length && this._activeIndex != null && this.tabs.length > this._activeIndex) { - this.findSelectedTab().selected = false; - this.tabs[this._activeIndex].selected = true; - } - } -} - - -@NgModule({ - imports: [CommonModule,SharedModule], - exports: [TabView,TabPanel,TabViewNav,SharedModule], - declarations: [TabView,TabPanel,TabViewNav] -}) -export class TabViewModule { } \ No newline at end of file diff --git a/dashboard/src/app/components/terminal/terminal.css b/dashboard/src/app/components/terminal/terminal.css deleted file mode 100644 index 86fe6028e..000000000 --- a/dashboard/src/app/components/terminal/terminal.css +++ /dev/null @@ -1,25 +0,0 @@ -.ui-terminal { - height: 18em; - overflow: auto; - padding: .25em; -} - -.ui-terminal-input { - border: 0 none; - background-color: transparent; - color: inherit; - padding: 0; - margin: 0 0 0 .125em; - width: 75%; - outline: none; - vertical-align: baseline; -} - -.ui-terminal-command { - margin-left: .125em; - -moz-margin-start: .125em; -} - -.ui-terminal-input::-ms-clear { - display: none; -} \ No newline at end of file diff --git a/dashboard/src/app/components/terminal/terminal.spec.ts b/dashboard/src/app/components/terminal/terminal.spec.ts deleted file mode 100644 index 0d12d090b..000000000 --- a/dashboard/src/app/components/terminal/terminal.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { Terminal } from './terminal'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('Terminal', () => { - - let terminal: Terminal; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - Terminal - ] - }); - - fixture = TestBed.createComponent(Terminal); - terminal = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/terminal/terminal.ts b/dashboard/src/app/components/terminal/terminal.ts deleted file mode 100644 index 7257379e5..000000000 --- a/dashboard/src/app/components/terminal/terminal.ts +++ /dev/null @@ -1,99 +0,0 @@ -import {NgModule,Component,AfterViewInit,AfterViewChecked,OnDestroy,Input,Output,EventEmitter,ElementRef} from '@angular/core'; -import {FormsModule} from '@angular/forms'; -import {CommonModule} from '@angular/common'; -import {DomHandler} from '../dom/domhandler'; -import {TerminalService} from './terminalservice'; -import {Subscription} from 'rxjs/Subscription'; - -@Component({ - selector: 'p-terminal', - template: ` -
        -
        {{welcomeMessage}}
        -
        -
        - {{prompt}} - {{command.text}} -
        {{command.response}}
        -
        -
        -
        - {{prompt}} - -
        -
        - `, - providers: [DomHandler] -}) -export class Terminal implements AfterViewInit,AfterViewChecked,OnDestroy { - - @Input() welcomeMessage: string; - - @Input() prompt: string; - - @Input() style: any; - - @Input() styleClass: string; - - commands: any[] = []; - - command: string; - - container: Element; - - commandProcessed: boolean; - - subscription: Subscription; - - constructor(public el: ElementRef, public domHandler: DomHandler, public terminalService: TerminalService) { - this.subscription = terminalService.responseHandler.subscribe(response => { - this.commands[this.commands.length - 1].response = response; - this.commandProcessed = true; - }); - } - - ngAfterViewInit() { - this.container = this.domHandler.find(this.el.nativeElement, '.ui-terminal')[0]; - } - - ngAfterViewChecked() { - if(this.commandProcessed) { - this.container.scrollTop = this.container.scrollHeight; - this.commandProcessed = false; - } - } - - @Input() - set response(value: string) { - if(value) { - this.commands[this.commands.length - 1].response = value; - this.commandProcessed = true; - } - } - - handleCommand(event: KeyboardEvent) { - if(event.keyCode == 13) { - this.commands.push({text: this.command}); - this.terminalService.sendCommand(this.command); - this.command = ''; - } - } - - focus(element: HTMLElement) { - element.focus(); - } - - ngOnDestroy() { - if(this.subscription) { - this.subscription.unsubscribe(); - } - } - -} - -@NgModule({ - imports: [CommonModule,FormsModule], - exports: [Terminal], - declarations: [Terminal] -}) -export class TerminalModule { } \ No newline at end of file diff --git a/dashboard/src/app/components/terminal/terminalservice.ts b/dashboard/src/app/components/terminal/terminalservice.ts deleted file mode 100644 index 3bebf10b3..000000000 --- a/dashboard/src/app/components/terminal/terminalservice.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Subject } from 'rxjs/Subject'; -import { Observable } from 'rxjs/Observable'; - -@Injectable() -export class TerminalService { - - private commandSource = new Subject(); - private responseSource = new Subject(); - - commandHandler = this.commandSource.asObservable(); - responseHandler = this.responseSource.asObservable(); - - sendCommand(command: string) { - if(command) { - this.commandSource.next(command); - } - } - - sendResponse(response: string) { - if(response) { - this.responseSource.next(response); - } - } -} \ No newline at end of file diff --git a/dashboard/src/app/components/tieredmenu/tieredmenu.css b/dashboard/src/app/components/tieredmenu/tieredmenu.css deleted file mode 100644 index 072178ed6..000000000 --- a/dashboard/src/app/components/tieredmenu/tieredmenu.css +++ /dev/null @@ -1,49 +0,0 @@ -.ui-tieredmenu { - width: 12.5em; - padding: .25em; -} - -.ui-tieredmenu.ui-tieredmenu-dynamic { - position: absolute; - display: none; -} - -.ui-tieredmenu .ui-menu-separator { - border-width: 1px 0 0 0; -} - -.ui-tieredmenu ul { - list-style: none; - margin: 0; - padding: 0; -} - -.ui-tieredmenu .ui-submenu-list { - display: none; - position: absolute; - width: 12.5em; - padding: .25em; -} - -.ui-tieredmenu .ui-menuitem-link { - padding: .25em; - display: block; - position: relative; - text-decoration: none; -} - -.ui-tieredmenu .ui-menuitem { - position: relative; - margin: .125em 0; -} - -.ui-tieredmenu .ui-menuitem-link .ui-submenu-icon { - position: absolute; - margin-top: -.5em; - right: 0; - top: 50%; -} - -.ui-tieredmenu .ui-menuitem-active > .ui-submenu > .ui-submenu-list { - display: block; -} \ No newline at end of file diff --git a/dashboard/src/app/components/tieredmenu/tieredmenu.spec.ts b/dashboard/src/app/components/tieredmenu/tieredmenu.spec.ts deleted file mode 100644 index bfe3428b5..000000000 --- a/dashboard/src/app/components/tieredmenu/tieredmenu.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { TieredMenu } from './tieredmenu'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('TieredMenu', () => { - - let tieredmenu: TieredMenu; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - TieredMenu - ] - }); - - fixture = TestBed.createComponent(TieredMenu); - tieredmenu = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/tieredmenu/tieredmenu.ts b/dashboard/src/app/components/tieredmenu/tieredmenu.ts deleted file mode 100644 index 8c33d396a..000000000 --- a/dashboard/src/app/components/tieredmenu/tieredmenu.ts +++ /dev/null @@ -1,217 +0,0 @@ -import {NgModule,Component,ElementRef,AfterViewInit,OnDestroy,Input,Output,Renderer2} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {DomHandler} from '../dom/domhandler'; -import {MenuItem} from '../common/menuitem'; -import {RouterModule} from '@angular/router'; - -@Component({ - selector: 'p-tieredMenuSub', - template: ` - - `, - providers: [DomHandler] -}) -export class TieredMenuSub { - - @Input() item: MenuItem; - - @Input() root: boolean; - - @Input() autoZIndex: boolean = true; - - @Input() baseZIndex: number = 0; - - constructor(public domHandler: DomHandler) {} - - activeItem: HTMLLIElement; - - hideTimeout: any; - - onItemMouseEnter(event: Event, item: HTMLLIElement, menuitem: MenuItem) { - if(menuitem.disabled) { - return; - } - - if(this.hideTimeout) { - clearTimeout(this.hideTimeout); - this.hideTimeout = null; - } - - this.activeItem = item; - let nextElement: HTMLElement = item.children[0].nextElementSibling; - if(nextElement) { - let sublist: HTMLElement = nextElement.children[0]; - if(this.autoZIndex) { - sublist.style.zIndex = String(this.baseZIndex + (++DomHandler.zindex)); - } - sublist.style.zIndex = String(++DomHandler.zindex); - - sublist.style.top = '0px'; - sublist.style.left = this.domHandler.getOuterWidth(item.children[0]) + 'px'; - } - } - - onItemMouseLeave(event: Event) { - this.hideTimeout = setTimeout(() => { - this.activeItem = null; - }, 1000); - } - - itemClick(event: Event, item: MenuItem) { - if(item.disabled) { - event.preventDefault(); - return true; - } - - if(!item.url) { - event.preventDefault(); - } - - if(item.command) { - item.command({ - originalEvent: event, - item: item - }); - } - } - - listClick(event: Event) { - this.activeItem = null; - } -} - -@Component({ - selector: 'p-tieredMenu', - template: ` -
        - -
        - `, - providers: [DomHandler] -}) -export class TieredMenu implements AfterViewInit,OnDestroy { - - @Input() model: MenuItem[]; - - @Input() popup: boolean; - - @Input() style: any; - - @Input() styleClass: string; - - @Input() appendTo: any; - - @Input() autoZIndex: boolean = true; - - @Input() baseZIndex: number = 0; - - container: any; - - documentClickListener: any; - - preventDocumentDefault: any; - - constructor(public el: ElementRef, public domHandler: DomHandler, public renderer: Renderer2) {} - - ngAfterViewInit() { - this.container = this.el.nativeElement.children[0]; - - if(this.popup) { - if(this.appendTo) { - if(this.appendTo === 'body') - document.body.appendChild(this.container); - else - this.domHandler.appendChild(this.container, this.appendTo); - } - } - } - - toggle(event: Event) { - if(this.container.offsetParent) - this.hide(); - else - this.show(event); - } - - show(event: Event) { - this.preventDocumentDefault = true; - this.moveOnTop(); - this.container.style.display = 'block'; - this.domHandler.absolutePosition(this.container, event.currentTarget); - this.domHandler.fadeIn(this.container, 250); - this.bindDocumentClickListener(); - } - - hide() { - this.container.style.display = 'none'; - this.unbindDocumentClickListener(); - } - - moveOnTop() { - if(this.autoZIndex) { - this.container.style.zIndex = String(this.baseZIndex + (++DomHandler.zindex)); - } - } - - unbindDocumentClickListener() { - if(this.documentClickListener) { - this.documentClickListener(); - this.documentClickListener = null; - } - } - - bindDocumentClickListener() { - if(!this.documentClickListener) { - this.documentClickListener = this.renderer.listen('document', 'click', () => { - if(!this.preventDocumentDefault) { - this.hide(); - } - this.preventDocumentDefault = false; - }); - } - } - - ngOnDestroy() { - if(this.popup) { - if(this.documentClickListener) { - this.unbindDocumentClickListener(); - } - if(this.appendTo) { - this.el.nativeElement.appendChild(this.container); - } - } - } - -} - -@NgModule({ - imports: [CommonModule,RouterModule], - exports: [TieredMenu,RouterModule], - declarations: [TieredMenu,TieredMenuSub] -}) -export class TieredMenuModule { } diff --git a/dashboard/src/app/components/togglebutton/togglebutton.spec.ts b/dashboard/src/app/components/togglebutton/togglebutton.spec.ts deleted file mode 100644 index 2824d1407..000000000 --- a/dashboard/src/app/components/togglebutton/togglebutton.spec.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { ToggleButton } from './togglebutton'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('ToggleButton', () => { - let toggleButton: ToggleButton; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - ToggleButton - ] - }); - - fixture = TestBed.createComponent(ToggleButton); - toggleButton = fixture.componentInstance; - }); - - it('should display the OFF label when value is undefined', () => { - toggleButton.offLabel = 'NO'; - fixture.detectChanges(); - const labelEl = fixture.debugElement.query(By.css('.ui-button-text')); - expect(labelEl.nativeElement.textContent).toBe('NO'); - }); - - it('should display the ON label when clicked', () => { - toggleButton.onLabel = 'YES'; - fixture.detectChanges(); - const clickEl = fixture.nativeElement.querySelector('.ui-togglebutton') - clickEl.click(); - fixture.detectChanges(); - - const labelEl = fixture.debugElement.query(By.css('.ui-button-text')); - expect(labelEl.nativeElement.textContent).toBe('YES') - }); - - it('Should display as checked when value is true by default', () => { - toggleButton.checked = true; - fixture.detectChanges(); - expect(toggleButton.checked).toBe(true); - }); -}); diff --git a/dashboard/src/app/components/togglebutton/togglebutton.ts b/dashboard/src/app/components/togglebutton/togglebutton.ts deleted file mode 100644 index 0909cf7d1..000000000 --- a/dashboard/src/app/components/togglebutton/togglebutton.ts +++ /dev/null @@ -1,122 +0,0 @@ -import {NgModule,Component,Input,Output,EventEmitter,forwardRef,AfterViewInit,ViewChild,ElementRef} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {NG_VALUE_ACCESSOR, ControlValueAccessor} from '@angular/forms'; - -export const TOGGLEBUTTON_VALUE_ACCESSOR: any = { - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => ToggleButton), - multi: true -}; - -@Component({ - selector: 'p-toggleButton', - template: ` -
        -
        - -
        - - {{checked ? hasOnLabel ? onLabel : 'ui-btn' : hasOffLabel ? offLabel : 'ui-btn'}} -
        - `, - providers: [TOGGLEBUTTON_VALUE_ACCESSOR] -}) -export class ToggleButton implements ControlValueAccessor,AfterViewInit { - - @Input() onLabel: string = 'Yes'; - - @Input() offLabel: string = 'No'; - - @Input() onIcon: string; - - @Input() offIcon: string; - - @Input() disabled: boolean; - - @Input() style: any; - - @Input() styleClass: string; - - @Input() inputId: string; - - @Input() tabindex: number; - - @Output() onChange: EventEmitter = new EventEmitter(); - - @ViewChild('checkbox') checkboxViewChild: ElementRef; - - checkbox: HTMLInputElement; - - checked: boolean = false; - - focus: boolean = false; - - onModelChange: Function = () => {}; - - onModelTouched: Function = () => {}; - - ngAfterViewInit() { - this.checkbox = this.checkboxViewChild.nativeElement; - } - - getIconClass() { - let baseClass = 'ui-button-icon-left fa fa-fw'; - return baseClass + ' ' + (this.checked ? this.onIcon : this.offIcon); - } - - toggle(event: Event) { - if(!this.disabled) { - this.checked = !this.checked; - this.onModelChange(this.checked); - this.onModelTouched(); - this.onChange.emit({ - originalEvent: event, - checked: this.checked - }); - this.checkbox.focus(); - } - } - - onFocus() { - this.focus = true; - } - - onBlur() { - this.focus = false; - this.onModelTouched(); - } - - writeValue(value: any) : void { - this.checked = value; - } - - registerOnChange(fn: Function): void { - this.onModelChange = fn; - } - - registerOnTouched(fn: Function): void { - this.onModelTouched = fn; - } - - setDisabledState(val: boolean): void { - this.disabled = val; - } - - get hasOnLabel():boolean { - return this.onLabel && this.onLabel.length > 0; - } - - get hasOffLabel():boolean { - return this.onLabel && this.onLabel.length > 0; - } -} - -@NgModule({ - imports: [CommonModule], - exports: [ToggleButton], - declarations: [ToggleButton] -}) -export class ToggleButtonModule { } diff --git a/dashboard/src/app/components/toolbar/toolbar.css b/dashboard/src/app/components/toolbar/toolbar.css deleted file mode 100644 index 0c48db8f5..000000000 --- a/dashboard/src/app/components/toolbar/toolbar.css +++ /dev/null @@ -1,11 +0,0 @@ -.ui-toolbar { - padding: .25em .5em; -} - -.ui-toolbar-group-left { - float:left -} - -.ui-toolbar-group-right { - float:right -} \ No newline at end of file diff --git a/dashboard/src/app/components/toolbar/toolbar.spec.ts b/dashboard/src/app/components/toolbar/toolbar.spec.ts deleted file mode 100644 index b0cffecfd..000000000 --- a/dashboard/src/app/components/toolbar/toolbar.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { Toolbar } from './toolbar'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('Toolbar', () => { - - let toolbar: Toolbar; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - Toolbar - ] - }); - - fixture = TestBed.createComponent(Toolbar); - toolbar = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/toolbar/toolbar.ts b/dashboard/src/app/components/toolbar/toolbar.ts deleted file mode 100644 index 3e1c2d737..000000000 --- a/dashboard/src/app/components/toolbar/toolbar.ts +++ /dev/null @@ -1,32 +0,0 @@ -import {NgModule,Component,Input,Output,EventEmitter,ElementRef} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {BlockableUI} from '../common/blockableui'; - -@Component({ - selector: 'p-toolbar', - template: ` -
        - -
        - ` -}) -export class Toolbar implements BlockableUI { - - @Input() style: any; - - @Input() styleClass: string; - - constructor(private el: ElementRef) {} - - getBlockableElement(): HTMLElement { - return this.el.nativeElement.children[0]; - } - -} - -@NgModule({ - imports: [CommonModule], - exports: [Toolbar], - declarations: [Toolbar] -}) -export class ToolbarModule { } diff --git a/dashboard/src/app/components/tooltip/tooltip.css b/dashboard/src/app/components/tooltip/tooltip.css deleted file mode 100644 index 71329bd2d..000000000 --- a/dashboard/src/app/components/tooltip/tooltip.css +++ /dev/null @@ -1,67 +0,0 @@ -.ui-tooltip { - position:absolute; - display:none; - padding: .25em .5em; - max-width: 12.5em; -} - -.ui-tooltip.ui-tooltip-right, -.ui-tooltip.ui-tooltip-left { - padding: 0 .25em; -} - -.ui-tooltip.ui-tooltip-top, -.ui-tooltip.ui-tooltip-bottom { - padding:.25em 0; -} - -.ui-tooltip .ui-tooltip-text { - padding: .125em .5em; - background-color: rgb(76, 76, 76); - color: #ffffff; - white-space: pre-line; -} - -.ui-tooltip-arrow { - position: absolute; - width: 0; - height: 0; - border-color: transparent; - border-style: solid; -} - -.ui-tooltip-right .ui-tooltip-arrow { - top: 50%; - left: 0; - margin-top: -.25em; - border-width: .25em .25em .25em 0; - border-right-color: rgb(76, 76, 76); -} - -.ui-tooltip-left .ui-tooltip-arrow { - top: 50%; - right: 0; - margin-top: -.25em; - border-width: .25em 0 .25em .25em; - border-left-color: rgb(76, 76, 76); -} - -.ui-tooltip.ui-tooltip-top { - padding: .25em 0; -} - -.ui-tooltip-top .ui-tooltip-arrow { - bottom: 0; - left: 50%; - margin-left: -.25em; - border-width: .25em .25em 0; - border-top-color: rgb(76, 76, 76); -} - -.ui-tooltip-bottom .ui-tooltip-arrow { - top: 0; - left: 50%; - margin-left: -.25em; - border-width: 0 .25em .25em; - border-bottom-color: rgb(76, 76, 76); -} \ No newline at end of file diff --git a/dashboard/src/app/components/tooltip/tooltip.spec.ts b/dashboard/src/app/components/tooltip/tooltip.spec.ts deleted file mode 100644 index 05da7c78a..000000000 --- a/dashboard/src/app/components/tooltip/tooltip.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { Tooltip } from './tooltip'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('Tooltip', () => { - - let tooltip: Tooltip; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - Tooltip - ] - }); - - fixture = TestBed.createComponent(Tooltip); - tooltip = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/tooltip/tooltip.ts b/dashboard/src/app/components/tooltip/tooltip.ts deleted file mode 100644 index c43c4a983..000000000 --- a/dashboard/src/app/components/tooltip/tooltip.ts +++ /dev/null @@ -1,388 +0,0 @@ -import { NgModule, Directive, ElementRef, AfterViewInit, OnDestroy, HostBinding, HostListener, Input, NgZone } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { DomHandler } from '../dom/domhandler'; - -@Directive({ - selector: '[pTooltip]', - providers: [DomHandler] -}) -export class Tooltip implements AfterViewInit, OnDestroy { - - @Input() tooltipPosition: string = 'right'; - - @Input() tooltipEvent: string = 'hover'; - - @Input() appendTo: any = 'body'; - - @Input() positionStyle: string; - - @Input() tooltipStyleClass: string; - - @Input() tooltipZIndex: string = 'auto'; - - @Input("tooltipDisabled") disabled: boolean; - - @Input() escape: boolean = true; - - @Input() showDelay: number; - - @Input() hideDelay: number; - - @Input() life: number; - - container: any; - - styleClass: string; - - tooltipText: any; - - showTimeout: any; - - hideTimeout: any; - - lifeTimeout: any; - - active: boolean; - - _text: string; - - mouseEnterListener: Function; - - mouseLeaveListener: Function; - - clickListener: Function; - - focusListener: Function; - - blurListener: Function; - - resizeListener: any; - - constructor(public el: ElementRef, public domHandler: DomHandler, public zone: NgZone) { } - - ngAfterViewInit() { - this.zone.runOutsideAngular(() => { - if (this.tooltipEvent === 'hover') { - this.mouseEnterListener = this.onMouseEnter.bind(this); - this.mouseLeaveListener = this.onMouseLeave.bind(this); - this.clickListener = this.onClick.bind(this); - this.el.nativeElement.addEventListener('mouseenter', this.mouseEnterListener); - this.el.nativeElement.addEventListener('mouseleave', this.mouseLeaveListener); - this.el.nativeElement.addEventListener('click', this.clickListener); - } - else if (this.tooltipEvent === 'focus') { - this.focusListener = this.onFocus.bind(this); - this.blurListener = this.onBlur.bind(this); - this.el.nativeElement.addEventListener('focus', this.focusListener); - this.el.nativeElement.addEventListener('blur', this.blurListener); - } - }); - } - - onMouseEnter(e: Event) { - if (!this.container) { - if (this.hideTimeout) { - clearTimeout(this.hideTimeout); - this.remove(); - } - - this.activate(); - } - } - - onMouseLeave(e: Event) { - this.deactivate(true); - } - - onFocus(e: Event) { - this.activate(); - } - - onBlur(e: Event) { - this.deactivate(true); - } - - onClick(e: Event) { - this.deactivate(true); - } - - activate() { - this.active = true; - if (this.hideTimeout) { - clearTimeout(this.hideTimeout); - } - - if (this.showDelay) - this.showTimeout = setTimeout(() => { this.show() }, this.showDelay); - else - this.show(); - - if (this.life) { - this.lifeTimeout = setTimeout(() => { this.deactivate(false) }, this.life); - } - } - - deactivate(useDelay) { - this.active = false; - if (this.showTimeout) { - clearTimeout(this.showTimeout); - } - - if (this.lifeTimeout) { - clearTimeout(this.lifeTimeout); - } - - if (this.hideDelay && useDelay) - this.hideTimeout = setTimeout(() => { this.hide() }, this.hideDelay); - else - this.hide(); - } - - get text(): string { - return this._text; - } - - @Input('pTooltip') set text(text: string) { - this._text = text; - if (this.active) { - if (this._text) { - if (this.container && this.container.offsetParent) - this.updateText(); - else - this.show(); - } - else { - this.hide(); - } - } - } - - create() { - this.container = document.createElement('div'); - - let tooltipArrow = document.createElement('div'); - tooltipArrow.className = 'ui-tooltip-arrow'; - this.container.appendChild(tooltipArrow); - - this.tooltipText = document.createElement('div'); - this.tooltipText.className = 'ui-tooltip-text ui-shadow ui-corner-all'; - - this.updateText(); - - if (this.positionStyle) { - this.container.style.position = this.positionStyle; - } - - this.container.appendChild(this.tooltipText); - - if (this.appendTo === 'body') - document.body.appendChild(this.container); - else if (this.appendTo === 'target') - this.domHandler.appendChild(this.container, this.el.nativeElement); - else - this.domHandler.appendChild(this.container, this.appendTo); - - this.container.style.display = 'inline-block'; - } - - show() { - if (!this.text || this.disabled) { - return; - } - - this.create(); - this.align(); - this.domHandler.fadeIn(this.container, 250); - - if (this.tooltipZIndex === 'auto') - this.container.style.zIndex = ++DomHandler.zindex; - else - this.container.style.zIndex = this.tooltipZIndex; - - this.bindDocumentResizeListener(); - } - - hide() { - this.remove(); - } - - updateText() { - if (this.escape) { - this.tooltipText.innerHTML = ''; - this.tooltipText.appendChild(document.createTextNode(this._text)); - } - else { - this.tooltipText.innerHTML = this._text; - } - } - - align() { - let position = this.tooltipPosition; - - switch (position) { - case 'top': - this.alignTop(); - if (this.isOutOfBounds()) { - this.alignBottom(); - } - break; - - case 'bottom': - this.alignBottom(); - if (this.isOutOfBounds()) { - this.alignTop(); - } - break; - - case 'left': - this.alignLeft(); - if (this.isOutOfBounds()) { - this.alignRight(); - - if (this.isOutOfBounds()) { - this.alignTop(); - - if (this.isOutOfBounds()) { - this.alignBottom(); - } - } - } - break; - - case 'right': - this.alignRight(); - if (this.isOutOfBounds()) { - this.alignLeft(); - - if (this.isOutOfBounds()) { - this.alignTop(); - - if (this.isOutOfBounds()) { - this.alignBottom(); - } - } - } - break; - } - } - - getHostOffset() { - let offset = this.el.nativeElement.getBoundingClientRect(); - let targetLeft = offset.left + this.domHandler.getWindowScrollLeft(); - let targetTop = offset.top + this.domHandler.getWindowScrollTop(); - - return { left: targetLeft, top: targetTop }; - } - - alignRight() { - this.preAlign('right'); - let hostOffset = this.getHostOffset(); - let left = hostOffset.left + this.domHandler.getOuterWidth(this.el.nativeElement); - let top = hostOffset.top + (this.domHandler.getOuterHeight(this.el.nativeElement) - this.domHandler.getOuterHeight(this.container)) / 2; - this.container.style.left = left + 'px'; - this.container.style.top = top + 'px'; - } - - alignLeft() { - this.preAlign('left'); - let hostOffset = this.getHostOffset(); - let left = hostOffset.left - this.domHandler.getOuterWidth(this.container); - let top = hostOffset.top + (this.domHandler.getOuterHeight(this.el.nativeElement) - this.domHandler.getOuterHeight(this.container)) / 2; - this.container.style.left = left + 'px'; - this.container.style.top = top + 'px'; - } - - alignTop() { - this.preAlign('top'); - let hostOffset = this.getHostOffset(); - let left = hostOffset.left + (this.domHandler.getOuterWidth(this.el.nativeElement) - this.domHandler.getOuterWidth(this.container)) / 2; - let top = hostOffset.top - this.domHandler.getOuterHeight(this.container); - this.container.style.left = left + 'px'; - this.container.style.top = top + 'px'; - } - - alignBottom() { - this.preAlign('bottom'); - let hostOffset = this.getHostOffset(); - let left = hostOffset.left + (this.domHandler.getOuterWidth(this.el.nativeElement) - this.domHandler.getOuterWidth(this.container)) / 2; - let top = hostOffset.top + this.domHandler.getOuterHeight(this.el.nativeElement); - this.container.style.left = left + 'px'; - this.container.style.top = top + 'px'; - } - - preAlign(position: string) { - this.container.style.left = -999 + 'px'; - this.container.style.top = -999 + 'px'; - - let defaultClassName = 'ui-tooltip ui-widget ui-tooltip-' + position; - this.container.className = this.tooltipStyleClass ? defaultClassName + ' ' + this.tooltipStyleClass : defaultClassName; - } - - isOutOfBounds(): boolean { - let offset = this.container.getBoundingClientRect(); - let targetTop = offset.top; - let targetLeft = offset.left; - let width = this.domHandler.getOuterWidth(this.container); - let height = this.domHandler.getOuterHeight(this.container); - let viewport = this.domHandler.getViewport(); - - return (targetLeft + width > viewport.width) || (targetLeft < 0) || (targetTop < 0) || (targetTop + height > viewport.height); - } - - onWindowResize(e: Event) { - this.hide(); - } - - bindDocumentResizeListener() { - this.zone.runOutsideAngular(() => { - this.resizeListener = this.onWindowResize.bind(this); - window.addEventListener('resize', this.resizeListener); - }); - } - - unbindDocumentResizeListener() { - if (this.resizeListener) { - window.removeEventListener('resize', this.resizeListener); - this.resizeListener = null; - } - } - - unbindEvents() { - if (this.tooltipEvent === 'hover') { - this.el.nativeElement.removeEventListener('mouseenter', this.mouseEnterListener); - this.el.nativeElement.removeEventListener('mouseleave', this.mouseLeaveListener); - this.el.nativeElement.removeEventListener('click', this.clickListener); - } - else if (this.tooltipEvent === 'focus') { - this.el.nativeElement.removeEventListener('focus', this.focusListener); - this.el.nativeElement.removeEventListener('blur', this.blurListener); - } - - this.unbindDocumentResizeListener(); - } - - remove() { - if (this.container && this.container.parentElement) { - if (this.appendTo === 'body') - document.body.removeChild(this.container); - else if (this.appendTo === 'target') - this.el.nativeElement.removeChild(this.container); - else - this.domHandler.removeChild(this.container, this.appendTo); - } - - this.container = null; - } - - ngOnDestroy() { - this.unbindEvents(); - this.remove(); - } -} - -@NgModule({ - imports: [CommonModule], - exports: [Tooltip], - declarations: [Tooltip] -}) -export class TooltipModule { } diff --git a/dashboard/src/app/components/tree/images/line.gif b/dashboard/src/app/components/tree/images/line.gif deleted file mode 100644 index 64e2280ec..000000000 Binary files a/dashboard/src/app/components/tree/images/line.gif and /dev/null differ diff --git a/dashboard/src/app/components/tree/tree.css b/dashboard/src/app/components/tree/tree.css deleted file mode 100644 index bac5a730b..000000000 --- a/dashboard/src/app/components/tree/tree.css +++ /dev/null @@ -1,186 +0,0 @@ -.ui-tree { - width: 18em; -} - -.ui-tree .ui-treenode-selectable.ui-treenode-content { - cursor: pointer; -} - -.ui-tree .ui-tree-container { - height: 100%; - margin: 0; - overflow: auto; - padding: .25em; - white-space: nowrap; -} - -.ui-tree-empty-message { - padding: .25em; -} - -.ui-tree .ui-treenode-children { - margin: 0; - padding: 0 0 0 1em; -} - -.ui-tree .ui-treenode { - background-attachment: scroll; - background-color: transparent; - background-image: none; - background-position: 0 0; - background-repeat: repeat-y; - list-style: none outside none; - margin: 0; - padding: .125em 0 0 0; -} - -.ui-tree .ui-treenode-droppoint { - height: 4px; - list-style-type: none; -} - -.ui-tree .ui-treenode-droppoint-active { - border: 0 none; -} - -.ui-tree .ui-tree-toggler { - cursor: pointer; - display: inline-block; - vertical-align: middle; -} - -.ui-tree .ui-treenode-icon { - display: inline-block; - vertical-align: middle; -} - -.ui-tree .ui-treenode-label { - display: inline-block; - padding: 0 .25em; - vertical-align: middle; -} - -.ui-tree .ui-treenode-label.ui-state-hover, -.ui-tree .ui-treenode-label.ui-state-highlight { - font-weight: normal; - border: 0 none; -} - -.ui-tree .ui-treenode.ui-treenode-leaf > .ui-treenode-content > .ui-tree-toggler { - visibility: hidden; -} - -.ui-tree .ui-chkbox-box { - cursor: pointer; -} - -.ui-tree .ui-chkbox { - display: inline-block; - vertical-align: middle; -} - -.ui-tree .ui-chkbox .ui-chkbox-icon { - margin-left: 1px; -} - -/** Fluid **/ -.ui-fluid .ui-tree { - width: 100%; -} - -/** Horizontal Tree **/ -.ui-tree-horizontal { - width:auto; - padding: .5em 0; - overflow:auto; -} - -.ui-tree.ui-tree-horizontal table, -.ui-tree.ui-tree-horizontal tr, -.ui-tree.ui-tree-horizontal td { - border-collapse: collapse; - margin: 0; - padding: 0; - vertical-align: middle; -} - -.ui-tree.ui-tree-horizontal .ui-tree-toggler { - vertical-align: middle; - margin: 0; -} - -.ui-tree-horizontal .ui-treenode-content { - font-weight: normal; - padding: 0.4em 1em 0.4em 0.2em; -} - -.ui-tree.ui-tree-horizontal .ui-tree-node-label { - margin: 0; -} - -.ui-tree-horizontal .ui-treenode-parent .ui-treenode-content { - font-weight: normal; - white-space: nowrap; -} - -.ui-tree.ui-tree-horizontal .ui-treenode { - background: url("./images/line.gif") repeat-x scroll center center transparent; - padding: .25em 2.5em; -} - -.ui-tree.ui-tree-horizontal .ui-treenode.ui-treenode-leaf, -.ui-tree.ui-tree-horizontal .ui-treenode.ui-treenode-collapsed { - padding-right: 0; -} - -.ui-tree.ui-tree-horizontal .ui-treenode-children { - padding: 0; - margin: 0; -} - -.ui-tree.ui-tree-horizontal .ui-treenode-connector { - width: 1px; -} - -.ui-tree.ui-tree-horizontal .ui-treenode-connector-table { - height: 100%; - width: 1px; -} - -.ui-tree.ui-tree-horizontal .ui-treenode-connector-line { - background: url("./images/line.gif") repeat-y scroll 0 0 transparent; - width: 1px; -} - -.ui-tree.ui-tree-horizontal table { - height: 0; -} - -.ui-tree.ui-tree-horizontal .ui-chkbox { - vertical-align: bottom; - margin-right: .25em; -} - -/** Loading **/ -.ui-tree.ui-tree-loading { - position: relative; - min-height: 4em; -} - -.ui-tree .ui-tree-loading-mask { - position: absolute; - width: 100%; - height: 100%; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=10)"; - opacity: 0.1; - z-index: 1; -} - -.ui-tree .ui-tree-loading-content { - position: absolute; - left: 50%; - top: 50%; - z-index: 2; - margin-top: -1em; - margin-left: -1em; -} diff --git a/dashboard/src/app/components/tree/tree.spec.ts b/dashboard/src/app/components/tree/tree.spec.ts deleted file mode 100644 index 21b398771..000000000 --- a/dashboard/src/app/components/tree/tree.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { Tree } from './tree'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('Tree', () => { - - let tree: Tree; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - Tree - ] - }); - - fixture = TestBed.createComponent(Tree); - tree = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/tree/tree.ts b/dashboard/src/app/components/tree/tree.ts deleted file mode 100644 index ba3a62c79..000000000 --- a/dashboard/src/app/components/tree/tree.ts +++ /dev/null @@ -1,779 +0,0 @@ -import {NgModule,Component,Input,AfterContentInit,OnDestroy,Output,EventEmitter,OnInit,EmbeddedViewRef,ViewContainerRef, - ContentChildren,QueryList,TemplateRef,Inject,ElementRef,forwardRef,Host} from '@angular/core'; -import {Optional} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {TreeNode} from '../common/treenode'; -import {SharedModule} from '../common/shared'; -import {PrimeTemplate} from '../common/shared'; -import {TreeDragDropService} from '../common/treedragdropservice'; -import {Subscription} from 'rxjs/Subscription'; -import {BlockableUI} from '../common/blockableui'; - -@Component({ - selector: 'p-treeNode', - template: ` - -
      • -
      • -
        -
        -
        - {{node.label}} - - - - -
        - -
      • -
      • - - - - - - - - -
        - - - - - - - - - -
        -
        -
        - - {{node.label}} - - - - -
        -
        -
        - -
        -
        -
        - ` -}) -export class UITreeNode implements OnInit { - - static ICON_CLASS: string = 'ui-treenode-icon fa fa-fw'; - - @Input() node: TreeNode; - - @Input() parentNode: TreeNode; - - @Input() root: boolean; - - @Input() index: number; - - @Input() firstChild: boolean; - - @Input() lastChild: boolean; - - constructor(@Inject(forwardRef(() => Tree)) public tree:Tree) {} - - draghoverPrev: boolean; - - draghoverNext: boolean; - - draghoverNode: boolean - - ngOnInit() { - this.node.parent = this.parentNode; - } - - getIcon() { - let icon: string; - - if(this.node.icon) - icon = this.node.icon; - else - icon = this.node.expanded && this.node.children && this.node.children.length ? this.node.expandedIcon : this.node.collapsedIcon; - - return UITreeNode.ICON_CLASS + ' ' + icon; - } - - isLeaf() { - return this.node.leaf == false ? false : !(this.node.children&&this.node.children.length); - } - - toggle(event: Event) { - if(this.node.expanded) - this.tree.onNodeCollapse.emit({originalEvent: event, node: this.node}); - else - this.tree.onNodeExpand.emit({originalEvent: event, node: this.node}); - - this.node.expanded = !this.node.expanded - } - - onNodeClick(event: MouseEvent) { - this.tree.onNodeClick(event, this.node); - } - - onNodeTouchEnd() { - this.tree.onNodeTouchEnd(); - } - - onNodeRightClick(event: MouseEvent) { - this.tree.onNodeRightClick(event, this.node); - } - - isSelected() { - return this.tree.isSelected(this.node); - } - - onDropPoint(event: Event, position: number) { - event.preventDefault(); - let dragNode = this.tree.dragNode; - let dragNodeIndex = this.tree.dragNodeIndex; - let dragNodeScope = this.tree.dragNodeScope; - let isValidDropPointIndex = this.tree.dragNodeTree === this.tree ? (position === 1 || dragNodeIndex !== this.index - 1) : true; - - if(this.tree.allowDrop(dragNode, this.node, dragNodeScope) && isValidDropPointIndex) { - let newNodeList = this.node.parent ? this.node.parent.children : this.tree.value; - this.tree.dragNodeSubNodes.splice(dragNodeIndex, 1); - let dropIndex = this.index; - - if(position < 0) { - dropIndex = (this.tree.dragNodeSubNodes === newNodeList) ? ((this.tree.dragNodeIndex > this.index) ? this.index : this.index - 1) : this.index; - newNodeList.splice(dropIndex, 0, dragNode); - } - else { - dropIndex = newNodeList.length; - newNodeList.push(dragNode); - } - - this.tree.dragDropService.stopDrag({ - node: dragNode, - subNodes: this.node.parent ? this.node.parent.children : this.tree.value, - index: dragNodeIndex - }); - - this.tree.onNodeDrop.emit({ - originalEvent: event, - dragNode: dragNode, - dropNode: this.node, - dropIndex: dropIndex - }); - } - - this.draghoverPrev = false; - this.draghoverNext = false; - } - - onDropPointDragOver(event) { - event.dataTransfer.dropEffect = 'move'; - event.preventDefault(); - } - - onDropPointDragEnter(event: Event, position: number) { - if(this.tree.allowDrop(this.tree.dragNode, this.node, this.tree.dragNodeScope)) { - if(position < 0) - this.draghoverPrev = true; - else - this.draghoverNext = true; - } - } - - onDropPointDragLeave(event: Event) { - this.draghoverPrev = false; - this.draghoverNext = false; - } - - onDragStart(event) { - if(this.tree.draggableNodes && this.node.draggable !== false) { - event.dataTransfer.setData("text", "data"); - - this.tree.dragDropService.startDrag({ - tree: this, - node: this.node, - subNodes: this.node.parent ? this.node.parent.children : this.tree.value, - index: this.index, - scope: this.tree.draggableScope - }); - } - else { - event.preventDefault(); - } - } - - onDragStop(event) { - this.tree.dragDropService.stopDrag({ - node: this.node, - subNodes: this.node.parent ? this.node.parent.children : this.tree.value, - index: this.index - }); - } - - onDropNodeDragOver(event) { - event.dataTransfer.dropEffect = 'move'; - if(this.tree.droppableNodes) { - event.preventDefault(); - event.stopPropagation(); - } - } - - onDropNode(event) { - if(this.tree.droppableNodes && this.node.droppable !== false) { - event.preventDefault(); - event.stopPropagation(); - let dragNode = this.tree.dragNode; - if(this.tree.allowDrop(dragNode, this.node, this.tree.dragNodeScope)) { - let dragNodeIndex = this.tree.dragNodeIndex; - this.tree.dragNodeSubNodes.splice(dragNodeIndex, 1); - - if(this.node.children) - this.node.children.push(dragNode); - else - this.node.children = [dragNode]; - - this.tree.dragDropService.stopDrag({ - node: dragNode, - subNodes: this.node.parent ? this.node.parent.children : this.tree.value, - index: this.tree.dragNodeIndex - }); - - this.tree.onNodeDrop.emit({ - originalEvent: event, - dragNode: dragNode, - dropNode: this.node, - index: this.index - }); - } - } - - this.draghoverNode = false; - } - - onDropNodeDragEnter(event) { - if(this.tree.droppableNodes && this.node.droppable !== false && this.tree.allowDrop(this.tree.dragNode, this.node, this.tree.dragNodeScope)) { - this.draghoverNode = true; - } - } - - onDropNodeDragLeave(event) { - if(this.tree.droppableNodes) { - let rect = event.currentTarget.getBoundingClientRect(); - if(event.x > rect.left + rect.width || event.x < rect.left || event.y >= Math.floor(rect.top + rect.height) || event.y < rect.top) { - this.draghoverNode = false; - } - } - } -} - -@Component({ - selector: 'p-tree', - template: ` -
        -
        -
        - -
        -
          - -
        -
        {{emptyMessage}}
        -
        -
        -
        -
        - -
        - - -
        -
        {{emptyMessage}}
        -
        - ` -}) -export class Tree implements OnInit,AfterContentInit,OnDestroy,BlockableUI { - - @Input() value: TreeNode[]; - - @Input() selectionMode: string; - - @Input() selection: any; - - @Output() selectionChange: EventEmitter = new EventEmitter(); - - @Output() onNodeSelect: EventEmitter = new EventEmitter(); - - @Output() onNodeUnselect: EventEmitter = new EventEmitter(); - - @Output() onNodeExpand: EventEmitter = new EventEmitter(); - - @Output() onNodeCollapse: EventEmitter = new EventEmitter(); - - @Output() onNodeContextMenuSelect: EventEmitter = new EventEmitter(); - - @Output() onNodeDrop: EventEmitter = new EventEmitter(); - - @Input() style: any; - - @Input() styleClass: string; - - @Input() contextMenu: any; - - @Input() layout: string = 'vertical'; - - @Input() draggableScope: any; - - @Input() droppableScope: any; - - @Input() draggableNodes: boolean; - - @Input() droppableNodes: boolean; - - @Input() metaKeySelection: boolean = true; - - @Input() propagateSelectionUp: boolean = true; - - @Input() propagateSelectionDown: boolean = true; - - @Input() loading: boolean; - - @Input() loadingIcon: string = 'fa-circle-o-notch'; - - @Input() emptyMessage: string = 'No records found'; - - @ContentChildren(PrimeTemplate) templates: QueryList; - - public templateMap: any; - - public nodeTouched: boolean; - - public dragNodeTree: Tree; - - public dragNode: TreeNode; - - public dragNodeSubNodes: TreeNode[]; - - public dragNodeIndex: number; - - public dragNodeScope: any; - - public dragHover: boolean; - - public dragStartSubscription: Subscription; - - public dragStopSubscription: Subscription; - - constructor(public el: ElementRef, @Optional() public dragDropService: TreeDragDropService) {} - - ngOnInit() { - if(this.droppableNodes) { - this.dragStartSubscription = this.dragDropService.dragStart$.subscribe( - event => { - this.dragNodeTree = event.tree; - this.dragNode = event.node; - this.dragNodeSubNodes = event.subNodes; - this.dragNodeIndex = event.index; - this.dragNodeScope = event.scope; - }); - - this.dragStopSubscription = this.dragDropService.dragStop$.subscribe( - event => { - this.dragNodeTree = null; - this.dragNode = null; - this.dragNodeSubNodes = null; - this.dragNodeIndex = null; - this.dragNodeScope = null; - this.dragHover = false; - }); - } - } - - get horizontal(): boolean { - return this.layout == 'horizontal'; - } - - ngAfterContentInit() { - if(this.templates.length) { - this.templateMap = {}; - } - - this.templates.forEach((item) => { - this.templateMap[item.name] = item.template; - }); - } - - onNodeClick(event: MouseEvent, node: TreeNode) { - let eventTarget = ( event.target); - - if(eventTarget.className && eventTarget.className.indexOf('ui-tree-toggler') === 0) { - return; - } - else if(this.selectionMode) { - if(node.selectable === false) { - return; - } - - let index = this.findIndexInSelection(node); - let selected = (index >= 0); - - if(this.isCheckboxSelectionMode()) { - if(selected) { - if(this.propagateSelectionDown) - this.propagateDown(node, false); - else - this.selection = this.selection.filter((val,i) => i!=index); - - if(this.propagateSelectionUp && node.parent) { - this.propagateUp(node.parent, false); - } - - this.selectionChange.emit(this.selection); - this.onNodeUnselect.emit({originalEvent: event, node: node}); - } - else { - if(this.propagateSelectionDown) - this.propagateDown(node, true); - else - this.selection = [...this.selection||[],node]; - - if(this.propagateSelectionUp && node.parent) { - this.propagateUp(node.parent, true); - } - - this.selectionChange.emit(this.selection); - this.onNodeSelect.emit({originalEvent: event, node: node}); - } - } - else { - let metaSelection = this.nodeTouched ? false : this.metaKeySelection; - - if(metaSelection) { - let metaKey = (event.metaKey||event.ctrlKey); - - if(selected && metaKey) { - if(this.isSingleSelectionMode()) { - this.selectionChange.emit(null); - } - else { - this.selection = this.selection.filter((val,i) => i!=index); - this.selectionChange.emit(this.selection); - } - - this.onNodeUnselect.emit({originalEvent: event, node: node}); - } - else { - if(this.isSingleSelectionMode()) { - this.selectionChange.emit(node); - } - else if(this.isMultipleSelectionMode()) { - this.selection = (!metaKey) ? [] : this.selection||[]; - this.selection = [...this.selection,node]; - this.selectionChange.emit(this.selection); - } - - this.onNodeSelect.emit({originalEvent: event, node: node}); - } - } - else { - if(this.isSingleSelectionMode()) { - if(selected) { - this.selection = null; - this.onNodeUnselect.emit({originalEvent: event, node: node}); - } - else { - this.selection = node; - this.onNodeSelect.emit({originalEvent: event, node: node}); - } - } - else { - if(selected) { - this.selection = this.selection.filter((val,i) => i!=index); - this.onNodeUnselect.emit({originalEvent: event, node: node}); - } - else { - this.selection = [...this.selection||[],node]; - this.onNodeSelect.emit({originalEvent: event, node: node}); - } - } - - this.selectionChange.emit(this.selection); - } - } - } - - this.nodeTouched = false; - } - - onNodeTouchEnd() { - this.nodeTouched = true; - } - - onNodeRightClick(event: MouseEvent, node: TreeNode) { - if(this.contextMenu) { - let eventTarget = ( event.target); - - if(eventTarget.className && eventTarget.className.indexOf('ui-tree-toggler') === 0) { - return; - } - else { - let index = this.findIndexInSelection(node); - let selected = (index >= 0); - - if(!selected) { - if(this.isSingleSelectionMode()) - this.selectionChange.emit(node); - else - this.selectionChange.emit([node]); - } - - this.contextMenu.show(event); - this.onNodeContextMenuSelect.emit({originalEvent: event, node: node}); - } - } - } - - findIndexInSelection(node: TreeNode) { - let index: number = -1; - - if(this.selectionMode && this.selection) { - if(this.isSingleSelectionMode()) { - index = (this.selection == node) ? 0 : - 1; - } - else { - for(let i = 0; i < this.selection.length; i++) { - if(this.selection[i] == node) { - index = i; - break; - } - } - } - } - - return index; - } - - propagateUp(node: TreeNode, select: boolean) { - if(node.children && node.children.length) { - let selectedCount: number = 0; - let childPartialSelected: boolean = false; - for(let child of node.children) { - if(this.isSelected(child)) { - selectedCount++; - } - else if(child.partialSelected) { - childPartialSelected = true; - } - } - - if(select && selectedCount == node.children.length) { - this.selection = [...this.selection||[],node]; - node.partialSelected = false; - } - else { - if(!select) { - let index = this.findIndexInSelection(node); - if(index >= 0) { - this.selection = this.selection.filter((val,i) => i!=index); - } - } - - if(childPartialSelected || selectedCount > 0 && selectedCount != node.children.length) - node.partialSelected = true; - else - node.partialSelected = false; - } - } - - let parent = node.parent; - if(parent) { - this.propagateUp(parent, select); - } - } - - propagateDown(node: TreeNode, select: boolean) { - let index = this.findIndexInSelection(node); - - if(select && index == -1) { - this.selection = [...this.selection||[],node]; - } - else if(!select && index > -1) { - this.selection = this.selection.filter((val,i) => i!=index); - } - - node.partialSelected = false; - - if(node.children && node.children.length) { - for(let child of node.children) { - this.propagateDown(child, select); - } - } - } - - isSelected(node: TreeNode) { - return this.findIndexInSelection(node) != -1; - } - - isSingleSelectionMode() { - return this.selectionMode && this.selectionMode == 'single'; - } - - isMultipleSelectionMode() { - return this.selectionMode && this.selectionMode == 'multiple'; - } - - isCheckboxSelectionMode() { - return this.selectionMode && this.selectionMode == 'checkbox'; - } - - getTemplateForNode(node: TreeNode): TemplateRef { - if(this.templateMap) - return node.type ? this.templateMap[node.type] : this.templateMap['default']; - else - return null; - } - - onDragOver(event) { - if(this.droppableNodes && (!this.value || this.value.length === 0)) { - event.dataTransfer.dropEffect = 'move'; - event.preventDefault(); - } - } - - onDrop(event) { - if(this.droppableNodes && (!this.value || this.value.length === 0)) { - event.preventDefault(); - let dragNode = this.dragNode; - if(this.allowDrop(dragNode, null, this.dragNodeScope)) { - let dragNodeIndex = this.dragNodeIndex; - this.dragNodeSubNodes.splice(dragNodeIndex, 1); - this.value = this.value||[]; - this.value.push(dragNode); - - this.dragDropService.stopDrag({ - node: dragNode - }); - } - } - } - - onDragEnter(event) { - if(this.droppableNodes && this.allowDrop(this.dragNode, null, this.dragNodeScope)) { - this.dragHover = true; - } - } - - onDragLeave(event) { - if(this.droppableNodes) { - let rect = event.currentTarget.getBoundingClientRect(); - if(event.x > rect.left + rect.width || event.x < rect.left || event.y > rect.top + rect.height || event.y < rect.top) { - this.dragHover = false; - } - } - } - - allowDrop(dragNode: TreeNode, dropNode: TreeNode, dragNodeScope: any): boolean { - if(!dragNode) { - //prevent random html elements to be dragged - return false; - } - else if(this.isValidDragScope(dragNodeScope)) { - let allow: boolean = true; - if(dropNode) { - if(dragNode === dropNode) { - allow = false; - } - else { - let parent = dropNode.parent; - while(parent != null) { - if(parent === dragNode) { - allow = false; - break; - } - parent = parent.parent; - } - } - } - - return allow; - } - else { - return false; - } - } - - isValidDragScope(dragScope: any): boolean { - let dropScope = this.droppableScope; - - if(dropScope) { - if(typeof dropScope === 'string') { - if(typeof dragScope === 'string') - return dropScope === dragScope; - else if(dragScope instanceof Array) - return (>dragScope).indexOf(dropScope) != -1; - } - else if(dropScope instanceof Array) { - if(typeof dragScope === 'string') { - return (>dropScope).indexOf(dragScope) != -1; - } - else if(dragScope instanceof Array) { - for(let s of dropScope) { - for(let ds of dragScope) { - if(s === ds) { - return true; - } - } - } - } - } - return false; - } - else { - return true; - } - } - - getBlockableElement(): HTMLElement { - return this.el.nativeElement.children[0]; - } - - ngOnDestroy() { - if(this.dragStartSubscription) { - this.dragStartSubscription.unsubscribe(); - } - - if(this.dragStopSubscription) { - this.dragStopSubscription.unsubscribe(); - } - } -} -@NgModule({ - imports: [CommonModule], - exports: [Tree,SharedModule], - declarations: [Tree,UITreeNode] -}) -export class TreeModule { } diff --git a/dashboard/src/app/components/treetable/treetable.css b/dashboard/src/app/components/treetable/treetable.css deleted file mode 100644 index 1c7ae8b3a..000000000 --- a/dashboard/src/app/components/treetable/treetable.css +++ /dev/null @@ -1,134 +0,0 @@ -.ui-treetable { - position: relative; -} - -.ui-treetable table { - border-collapse:collapse; - width: 100%; - table-layout: fixed; -} - -.ui-treetable .ui-treetable-header, -.ui-treetable .ui-treetable-footer { - text-align:center; - padding: .5em .75em; -} - -.ui-treetable .ui-treetable-header { - border-bottom: 0 none; -} - -.ui-treetable .ui-treetable-footer { - border-top: 0 none; -} - -.ui-treetable th, .ui-treetable tfoot td { - text-align: center; -} - -.ui-treetable thead th, -.ui-treetable tbody td, -.ui-treetable tfoot td { - padding: .25em .5em; - overflow: hidden; - white-space: nowrap; - border-width: 1px; - border-style: solid; -} - -.ui-treetable tbody td { - border-color: inherit; -} - -.ui-treetable tbody td:first-child span { - vertical-align: middle; -} - -.ui-treetable .ui-treetable-toggler { - vertical-align: middle; - cursor: pointer; - text-decoration: none; -} - -.ui-treetable .ui-treetable-checkbox { - margin-right: .5em; -} - -.ui-treetable .ui-treetable-checkbox .ui-chkbox-icon { - margin-left: 1px; -} - -.ui-treetable .ui-treetable-row.ui-treetable-row-selectable { - cursor: pointer; -} - -.ui-treetable .ui-treetable-row.ui-state-highlight { - border: 0 none; -} - -.ui-treetable tr.ui-state-hover { - border-color: inherit; - font-weight: inherit; -} - -.ui-treetable .ui-treetable-indent { - width: 1em; - height: 1em; - float: left; -} - -/* Resizable */ -.ui-treetable .ui-column-resizer { - display: block; - position: absolute !important; - top: 0; - right: 0; - margin: 0; - width: .5em; - height: 100%; - padding: 0px; - cursor:col-resize; - border: 1px solid transparent; -} - -.ui-treetable .ui-column-resizer-helper { - width: 1px; - position: absolute; - z-index: 10; - display: none; -} - -.ui-treetable-resizable { - padding-bottom: 1px; /*fix for webkit overlow*/ - overflow:auto; -} - -.ui-treetable-resizable thead th, -.ui-treetable-resizable tbody td, -.ui-treetable-resizable tfoot td { - white-space: nowrap; -} - -.ui-treetable-resizable th.ui-resizable-column { - background-clip: padding-box; - position: relative; -} - -/* PrimeNG */ -.ui-treetable td.ui-treetable-child-table-container { - padding: 0; - border: 0 none; -} - -.ui-treetable .ui-treetable-row { - display: table-row; - border-bottom: 0 transparent -} - -.ui-treetable tbody .ui-treetable-row td { - border: 0 none; -} - -.ui-treetable tbody .ui-treetable-row td input { - outline: 0 none; -} \ No newline at end of file diff --git a/dashboard/src/app/components/treetable/treetable.spec.ts b/dashboard/src/app/components/treetable/treetable.spec.ts deleted file mode 100644 index 6c854af0e..000000000 --- a/dashboard/src/app/components/treetable/treetable.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { TreeTable } from './treetable'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('TreeTable', () => { - - let treetable: TreeTable; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - TreeTable - ] - }); - - fixture = TestBed.createComponent(TreeTable); - treetable = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/treetable/treetable.ts b/dashboard/src/app/components/treetable/treetable.ts deleted file mode 100644 index a897b0be8..000000000 --- a/dashboard/src/app/components/treetable/treetable.ts +++ /dev/null @@ -1,449 +0,0 @@ -import {NgModule,Component,Input,Output,EventEmitter,AfterContentInit,ElementRef,ContentChild,IterableDiffers,ChangeDetectorRef,ContentChildren,QueryList,Inject,forwardRef,OnInit,Renderer2,ViewChild} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {TreeNode} from '../common/treenode'; -import {Header,Footer,Column} from '../common/shared'; -import {SharedModule} from '../common/shared'; -import {Subscription} from 'rxjs/Subscription'; -import {DomHandler} from '../dom/domhandler'; - -@Component({ - selector: '[pTreeRow]', - template: ` -
        - - - -
        -
        {{resolveFieldData(node.data,col.field)}} - - -
        -
        - - - -
        - -
        - ` -}) -export class UITreeRow implements OnInit { - - @Input() node: TreeNode; - - @Input() parentNode: TreeNode; - - @Input() level: number = 0; - - @Input() labelExpand: string = "Expand"; - - @Input() labelCollapse: string = "Collapse"; - - constructor(@Inject(forwardRef(() => TreeTable)) public treeTable:TreeTable) {} - - ngOnInit() { - this.node.parent = this.parentNode; - } - - toggle(event: Event) { - if(this.node.expanded) - this.treeTable.onNodeCollapse.emit({originalEvent: event, node: this.node}); - else - this.treeTable.onNodeExpand.emit({originalEvent: event, node: this.node}); - - this.node.expanded = !this.node.expanded; - - event.preventDefault(); - } - - isLeaf() { - return this.node.leaf == false ? false : !(this.node.children&&this.node.children.length); - } - - isSelected() { - return this.treeTable.isSelected(this.node); - } - - onRowClick(event: MouseEvent) { - this.treeTable.onRowClick(event, this.node); - } - - onRowRightClick(event: MouseEvent) { - this.treeTable.onRowRightClick(event, this.node); - } - - rowDblClick(event: MouseEvent) { - this.treeTable.onRowDblclick.emit({originalEvent: event, node: this.node}); - } - - onRowTouchEnd() { - this.treeTable.onRowTouchEnd(); - } - - resolveFieldData(data: any, field: string): any { - if(data && field) { - if(field.indexOf('.') == -1) { - return data[field]; - } - else { - let fields: string[] = field.split('.'); - let value = data; - for(var i = 0, len = fields.length; i < len; ++i) { - value = value[fields[i]]; - } - return value; - } - } - else { - return null; - } - } -} - -@Component({ - selector: 'p-treeTable', - template: ` -
        -
        - -
        -
        - - - - - - - - - - - - -
        - {{col.header}} - - - -
        - {{col.footer}} - - - -
        -
        - - -
        - `, - providers: [DomHandler] -}) -export class TreeTable implements AfterContentInit { - - @Input() value: TreeNode[]; - - @Input() selectionMode: string; - - @Input() selection: any; - - @Input() style: any; - - @Input() styleClass: string; - - @Input() labelExpand: string = "Expand"; - - @Input() labelCollapse: string = "Collapse"; - - @Input() metaKeySelection: boolean = true; - - @Input() contextMenu: any; - - @Input() toggleColumnIndex: number = 0; - - @Input() tableStyle: any; - - @Input() tableStyleClass: string; - - @Input() collapsedIcon: string = "fa-caret-right"; - - @Input() expandedIcon: string = "fa-caret-down"; - - @Output() onRowDblclick: EventEmitter = new EventEmitter(); - - @Output() selectionChange: EventEmitter = new EventEmitter(); - - @Output() onNodeSelect: EventEmitter = new EventEmitter(); - - @Output() onNodeUnselect: EventEmitter = new EventEmitter(); - - @Output() onNodeExpand: EventEmitter = new EventEmitter(); - - @Output() onNodeCollapse: EventEmitter = new EventEmitter(); - - @Output() onContextMenuSelect: EventEmitter = new EventEmitter(); - - @ContentChild(Header) header: Header; - - @ContentChild(Footer) footer: Footer; - - @ContentChildren(Column) cols: QueryList; - - @ViewChild('tbl') tableViewChild: ElementRef; - - public rowTouched: boolean; - - public columns: Column[]; - - columnsSubscription: Subscription; - - constructor (public el: ElementRef, public domHandler: DomHandler,public changeDetector: ChangeDetectorRef,public renderer: Renderer2) {} - - ngAfterContentInit() { - this.initColumns(); - - this.columnsSubscription = this.cols.changes.subscribe(_ => { - this.initColumns(); - this.changeDetector.markForCheck(); - }); - } - - initColumns(): void { - this.columns = this.cols.toArray(); - } - - onRowClick(event: MouseEvent, node: TreeNode) { - let eventTarget = ( event.target); - if(eventTarget.className && eventTarget.className.indexOf('ui-treetable-toggler') === 0) { - return; - } - else if(this.selectionMode) { - if(node.selectable === false) { - return; - } - - let metaSelection = this.rowTouched ? false : this.metaKeySelection; - let index = this.findIndexInSelection(node); - let selected = (index >= 0); - - if(this.isCheckboxSelectionMode()) { - if(selected) { - this.propagateSelectionDown(node, false); - if(node.parent) { - this.propagateSelectionUp(node.parent, false); - } - this.selectionChange.emit(this.selection); - this.onNodeUnselect.emit({originalEvent: event, node: node}); - } - else { - this.propagateSelectionDown(node, true); - if(node.parent) { - this.propagateSelectionUp(node.parent, true); - } - this.selectionChange.emit(this.selection); - this.onNodeSelect.emit({originalEvent: event, node: node}); - } - } - else { - if(metaSelection) { - let metaKey = (event.metaKey||event.ctrlKey); - - if(selected && metaKey) { - if(this.isSingleSelectionMode()) { - this.selectionChange.emit(null); - } - else { - this.selection = this.selection.filter((val,i) => i!=index); - this.selectionChange.emit(this.selection); - } - - this.onNodeUnselect.emit({originalEvent: event, node: node}); - } - else { - if(this.isSingleSelectionMode()) { - this.selectionChange.emit(node); - } - else if(this.isMultipleSelectionMode()) { - this.selection = (!metaKey) ? [] : this.selection||[]; - this.selection = [...this.selection,node]; - this.selectionChange.emit(this.selection); - } - - this.onNodeSelect.emit({originalEvent: event, node: node}); - } - } - else { - if(this.isSingleSelectionMode()) { - if(selected) { - this.selection = null; - this.onNodeUnselect.emit({originalEvent: event, node: node}); - } - else { - this.selection = node; - this.onNodeSelect.emit({originalEvent: event, node: node}); - } - } - else { - if(selected) { - this.selection = this.selection.filter((val,i) => i!=index); - this.onNodeUnselect.emit({originalEvent: event, node: node}); - } - else { - this.selection = [...this.selection||[],node]; - this.onNodeSelect.emit({originalEvent: event, node: node}); - } - } - - this.selectionChange.emit(this.selection); - } - } - } - - this.rowTouched = false; - } - - onRowTouchEnd() { - this.rowTouched = true; - } - - onRowRightClick(event: MouseEvent, node: TreeNode) { - if(this.contextMenu) { - let index = this.findIndexInSelection(node); - let selected = (index >= 0); - - if(!selected) { - if(this.isSingleSelectionMode()) { - this.selection = node; - } - else if(this.isMultipleSelectionMode()) { - this.selection = [node]; - this.selectionChange.emit(this.selection); - } - - this.selectionChange.emit(this.selection); - } - - this.contextMenu.show(event); - this.onContextMenuSelect.emit({originalEvent: event, node: node}); - } - } - - findIndexInSelection(node: TreeNode) { - let index: number = -1; - - if(this.selectionMode && this.selection) { - if(this.isSingleSelectionMode()) { - index = (this.selection == node) ? 0 : - 1; - } - else { - for(let i = 0; i < this.selection.length; i++) { - if(this.selection[i] == node) { - index = i; - break; - } - } - } - } - - return index; - } - - propagateSelectionUp(node: TreeNode, select: boolean) { - if(node.children && node.children.length) { - let selectedCount: number = 0; - let childPartialSelected: boolean = false; - for(let child of node.children) { - if(this.isSelected(child)) { - selectedCount++; - } - else if(child.partialSelected) { - childPartialSelected = true; - } - } - - if(select && selectedCount == node.children.length) { - this.selection = [...this.selection||[],node]; - node.partialSelected = false; - } - else { - if(!select) { - let index = this.findIndexInSelection(node); - if(index >= 0) { - this.selection = this.selection.filter((val,i) => i!=index); - } - } - - if(childPartialSelected || selectedCount > 0 && selectedCount != node.children.length) - node.partialSelected = true; - else - node.partialSelected = false; - } - } - - let parent = node.parent; - if(parent) { - this.propagateSelectionUp(parent, select); - } - } - - propagateSelectionDown(node: TreeNode, select: boolean) { - let index = this.findIndexInSelection(node); - - if(select && index == -1) { - this.selection = [...this.selection||[],node]; - } - else if(!select && index > -1) { - this.selection = this.selection.filter((val,i) => i!=index); - } - - node.partialSelected = false; - - if(node.children && node.children.length) { - for(let child of node.children) { - this.propagateSelectionDown(child, select); - } - } - } - - isSelected(node: TreeNode) { - return this.findIndexInSelection(node) != -1; - } - - isSingleSelectionMode() { - return this.selectionMode && this.selectionMode == 'single'; - } - - isMultipleSelectionMode() { - return this.selectionMode && this.selectionMode == 'multiple'; - } - - isCheckboxSelectionMode() { - return this.selectionMode && this.selectionMode == 'checkbox'; - } - - hasFooter() { - if(this.columns) { - let columnsArr = this.cols.toArray(); - for(let i = 0; i < columnsArr.length; i++) { - if(columnsArr[i].footer) { - return true; - } - } - } - return false; - } -} - -@NgModule({ - imports: [CommonModule], - exports: [TreeTable,SharedModule], - declarations: [TreeTable,UITreeRow] -}) -export class TreeTableModule { } \ No newline at end of file diff --git a/dashboard/src/app/components/tristatecheckbox/tristatecheckbox.spec.ts b/dashboard/src/app/components/tristatecheckbox/tristatecheckbox.spec.ts deleted file mode 100644 index 48562f49c..000000000 --- a/dashboard/src/app/components/tristatecheckbox/tristatecheckbox.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { TriStateCheckbox } from './tristatecheckbox'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('TriStateCheckbox', () => { - - let tristate: TriStateCheckbox; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - NoopAnimationsModule - ], - declarations: [ - TriStateCheckbox - ] - }); - - fixture = TestBed.createComponent(TriStateCheckbox); - tristate = fixture.componentInstance; - }); -}); diff --git a/dashboard/src/app/components/tristatecheckbox/tristatecheckbox.ts b/dashboard/src/app/components/tristatecheckbox/tristatecheckbox.ts deleted file mode 100644 index a767d4fa6..000000000 --- a/dashboard/src/app/components/tristatecheckbox/tristatecheckbox.ts +++ /dev/null @@ -1,125 +0,0 @@ -import {NgModule,Component,Input,Output,EventEmitter,forwardRef,ChangeDetectorRef} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {NG_VALUE_ACCESSOR, ControlValueAccessor} from '@angular/forms'; - -export const TRISTATECHECKBOX_VALUE_ACCESSOR: any = { - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => TriStateCheckbox), - multi: true -}; - -@Component({ - selector: 'p-triStateCheckbox', - template: ` -
        -
        - -
        -
        - -
        -
        - - `, - providers: [TRISTATECHECKBOX_VALUE_ACCESSOR] -}) -export class TriStateCheckbox implements ControlValueAccessor { - - constructor(private cd: ChangeDetectorRef) {} - - @Input() disabled: boolean; - - @Input() name: string; - - @Input() tabindex: number; - - @Input() inputId: string; - - @Input() style: any; - - @Input() styleClass: string; - - @Input() label: string; - - @Output() onChange: EventEmitter = new EventEmitter(); - - focus: boolean; - - value: any; - - onModelChange: Function = () => {}; - - onModelTouched: Function = () => {}; - - onClick(event: Event, input: HTMLInputElement) { - if(!this.disabled) { - this.toggle(event); - this.focus = true; - input.focus(); - } - } - - onKeydown(event: KeyboardEvent) { - if(event.keyCode == 32) { - event.preventDefault(); - } - } - - onKeyup(event: KeyboardEvent) { - if(event.keyCode == 32) { - this.toggle(event); - event.preventDefault(); - } - } - - toggle(event: Event) { - if(this.value == null || this.value == undefined) - this.value = true; - else if(this.value == true) - this.value = false; - else if(this.value == false) - this.value = null; - - this.onModelChange(this.value); - this.onChange.emit({ - originalEvent: event, - value: this.value - }) - } - - onFocus() { - this.focus = true; - } - - onBlur() { - this.focus = false; - this.onModelTouched(); - } - - registerOnChange(fn: Function): void { - this.onModelChange = fn; - } - - registerOnTouched(fn: Function): void { - this.onModelTouched = fn; - } - - writeValue(value: any) : void { - this.value = value; - this.cd.markForCheck(); - } - - setDisabledState(disabled: boolean): void { - this.disabled = disabled; - } -} - -@NgModule({ - imports: [CommonModule], - exports: [TriStateCheckbox], - declarations: [TriStateCheckbox] -}) -export class TriStateCheckboxModule { } diff --git a/dashboard/src/app/components/utils/objectutils.spec.ts b/dashboard/src/app/components/utils/objectutils.spec.ts deleted file mode 100644 index efb2aacfa..000000000 --- a/dashboard/src/app/components/utils/objectutils.spec.ts +++ /dev/null @@ -1,114 +0,0 @@ -import { ObjectUtils } from './objectutils'; -import { inject, TestBed } from '@angular/core/testing'; - -describe('ObjectUtils Suite', () => { - - let objectUtils: ObjectUtils = null; - - beforeEach(() => TestBed.configureTestingModule({ - providers: [ ObjectUtils ] - })); - - beforeEach(inject([ObjectUtils], s => { - objectUtils = s; - })); - - let data: any = [ - {brand: "VW", year: 2012, color: {name:"Orange"}, vin: "dsad231ff"}, - {brand: "Audi", year: 2011, color: {name:"Black"}, vin: "gwregre345"}, - {brand: "Renault", year: 2005, color: {name:"Black"}, vin: "h354htr"}, - {brand: "BMW", year: 2003, color: {name:"Blue"}, vin: "j6w54qgh"}, - {brand: "Mercedes", year: 1995, color: {name:"Red"}, vin: "hrtwy34"}, - {brand: "Volvo", year: 2005, color: {name:"Orange"}, vin: "jejtyj"}, - {brand: "Honda", year: 2012, color: {name:"Blue"}, vin: "g43gr"}, - {brand: "Jaguar", year: 2013,color: {name:"Black"}, vin: "greg34"}, - {brand: "Ford", year: 2000, color: {name:"White"}, vin: "h54hw5"}, - {brand: "Fiat", year: 2013, color: {name:"Yellow"}, vin: "245t2s"} - ]; - - it('Should resolve field data', () => { - let obj = { - firstname: 'Silvio', - lastname: 'Andolini', - address: { - country: { - name: 'Italy' - }, - city: 'Corleone' - } - } - - expect(objectUtils.resolveFieldData(obj, 'firstname')).toBe('Silvio'); - expect(objectUtils.resolveFieldData(obj, 'lastname')).toBe('Andolini'); - expect(objectUtils.resolveFieldData(obj, 'address.city')).toBe('Corleone'); - expect(objectUtils.resolveFieldData(obj, 'address.country.name')).toBe('Italy'); - expect(objectUtils.resolveFieldData(obj, 'age')).toBeUndefined(); - }); - - it('Should run single field correctly', () => { - let result = objectUtils.filter(data, ['brand'], 'b'); - expect(result[0].brand).toBe('BMW'); - }); - - it('Should run multiple filter correctly', () => { - let result = objectUtils.filter(data, ['brand','color.name'], 'w'); - expect(result[0].brand).toBe('VW'); - expect(result[1].brand).toBe('BMW'); - expect(result[2].brand).toBe('Ford'); - }); - - it('Should relocate an item in array', () => { - let arr: string[] = ['New York', 'Istanbul', 'Paris', 'Barcelona', 'London']; - objectUtils.reorderArray(arr, 3, 1); - expect(arr).toEqual(['New York', 'Barcelona', 'Istanbul', 'Paris', 'London']); - }); - - it('Should inject an item as indexed', () => { - let sourceArr: string[] = ['New York', 'Istanbul', 'Paris', 'Barcelona', 'London']; - let arr: string[] = []; - - objectUtils.insertIntoOrderedArray('Istanbul', 1, arr, sourceArr); - expect(arr).toEqual(['Istanbul']); - - objectUtils.insertIntoOrderedArray('Paris', 2, arr, sourceArr); - objectUtils.insertIntoOrderedArray('New York', 0, arr, sourceArr); - objectUtils.insertIntoOrderedArray('London', 4, arr, sourceArr); - objectUtils.insertIntoOrderedArray('Barcelona', 3, arr, sourceArr); - expect(arr).toEqual(['New York', 'Istanbul', 'Paris', 'Barcelona', 'London']); - }); - - it('Should check if simple objects are equal', () => { - const [data0, data1] = data.slice(0, 2); - expect(objectUtils.equals(data0, data0)).toBe(true); - expect(objectUtils.equals(data0, Object.assign({}, data0))).toBe(true); - expect(objectUtils.equals(data0, data1)).toBe(false); - }); - - it('Should check if nested objects are equal', () => { - const arr = [1, 2, [3, 4]]; - expect(objectUtils.equals(arr, Object.assign({}, arr))).toBe(true); - const arr2 = [1, 2, [3, 4, 5]]; - expect(objectUtils.equals(arr, arr2)).toBe(false); - const obj = {a: 1, b: {c: 3, d: 4}}; - expect(objectUtils.equals(obj, Object.assign({}, obj))).toBe(true); - const obj2 = {a: 1, b: {c: 3, d: 5}}; - expect(objectUtils.equals(obj, obj2)).toBe(false); - }); - - it('Should not cause stack overflow comparing recursive objects', () => { - const obj1 = {p: null}; - const obj2 = {p: null}; - obj1['p'] = obj1; - obj2['p'] = obj2; - expect(objectUtils.equals(obj1, obj2)).toBe(false); - }); - - it('Should be able to compare frozen nested objects', () => { - const obj1 = {a: 1, b: {c: 3, d: 4}}; - const obj2 = {a: 1, b: {c: 3, d: 4}}; - Object.preventExtensions(obj1); - Object.preventExtensions(obj2); - expect(objectUtils.equals(obj1, obj2)).toBe(true); - }); - -}); diff --git a/dashboard/src/app/components/utils/objectutils.ts b/dashboard/src/app/components/utils/objectutils.ts deleted file mode 100644 index 3f08d9125..000000000 --- a/dashboard/src/app/components/utils/objectutils.ts +++ /dev/null @@ -1,164 +0,0 @@ -import {Injectable} from '@angular/core'; -import {SelectItem} from '../common/selectitem'; - -@Injectable() -export class ObjectUtils { - - public equals(obj1: any, obj2: any, field?: string): boolean { - if (field) - return (this.resolveFieldData(obj1, field) === this.resolveFieldData(obj2, field)); - else - return this.equalsByValue(obj1, obj2); - } - - public equalsByValue(obj1: any, obj2: any, visited?: any[]): boolean { - if (obj1 == null && obj2 == null) { - return true; - } - if (obj1 == null || obj2 == null) { - return false; - } - - if (obj1 == obj2) { - return true; - } - - if (typeof obj1 == 'object' && typeof obj2 == 'object') { - if (visited) { - if (visited.indexOf(obj1) !== -1) return false; - } else { - visited = []; - } - visited.push(obj1); - - for (var p in obj1) { - if (obj1.hasOwnProperty(p) !== obj2.hasOwnProperty(p)) { - return false; - } - - switch (typeof (obj1[p])) { - case 'object': - if (!this.equalsByValue(obj1[p], obj2[p], visited)) return false; - break; - - case 'function': - if (typeof (obj2[p]) == 'undefined' || (p != 'compare' && obj1[p].toString() != obj2[p].toString())) return false; - break; - - default: - if (obj1[p] != obj2[p]) return false; - break; - } - } - - for (var p in obj2) { - if (typeof (obj1[p]) == 'undefined') return false; - } - - delete obj1._$visited; - return true; - } - - return false; - } - - resolveFieldData(data: any, field: string): any { - if(data && field) { - if(field.indexOf('.') == -1) { - return data[field]; - } - else { - let fields: string[] = field.split('.'); - let value = data; - for(var i = 0, len = fields.length; i < len; ++i) { - if (value == null) { - return null; - } - value = value[fields[i]]; - } - return value; - } - } - else { - return null; - } - } - - filter(value: any[], fields: any[], filterValue: string) { - let filteredItems: any[] = []; - - if(value) { - for(let item of value) { - for(let field of fields) { - if(String(this.resolveFieldData(item, field)).toLowerCase().indexOf(filterValue.toLowerCase()) > -1) { - filteredItems.push(item); - break; - } - } - } - } - - return filteredItems; - } - - reorderArray(value: any[], from: number, to: number) { - let target: number; - if(value && (from !== to)) { - if(to >= value.length) { - target = to - value.length; - while((target--) + 1) { - value.push(undefined); - } - } - value.splice(to, 0, value.splice(from, 1)[0]); - } - } - - generateSelectItems(val: any[], field: string): SelectItem[] { - let selectItems: SelectItem[]; - if(val && val.length) { - selectItems = []; - for(let item of val) { - selectItems.push({label: this.resolveFieldData(item, field), value: item}); - } - } - - return selectItems; - } - - insertIntoOrderedArray(item: any, index: number, arr: any[], sourceArr: any[]): void { - if(arr.length > 0) { - let injected = false; - for(let i = 0; i < arr.length; i++) { - let currentItemIndex = this.findIndexInList(arr[i], sourceArr); - if(currentItemIndex > index) { - arr.splice(i, 0, item); - injected = true; - break; - } - } - - if(!injected) { - arr.push(item); - } - } - else { - arr.push(item); - } - } - - findIndexInList(item: any, list: any): number { - let index: number = -1; - - if(list) { - for(let i = 0; i < list.length; i++) { - if(list[i] == item) { - index = i; - break; - } - } - } - - return index; - } -} diff --git a/dashboard/src/app/i18n/en/exception.json b/dashboard/src/app/i18n/en/exception.json deleted file mode 100644 index 40b9cdf15..000000000 --- a/dashboard/src/app/i18n/en/exception.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "timeout":"请求超时", - "system_error":"系统内部错误" -} \ No newline at end of file diff --git a/dashboard/src/app/i18n/en/keyID.json b/dashboard/src/app/i18n/en/keyID.json deleted file mode 100644 index 6b22c18a5..000000000 --- a/dashboard/src/app/i18n/en/keyID.json +++ /dev/null @@ -1,117 +0,0 @@ -{ - "sds_required":"{0} is required.", - "sds_pattern":"Beginning with a letter with a length of 1-128, it can contain letters / numbers / underlines.", - "sds_profileNull":"profile is required", - "sds_block_volumes_descrip":"View and manage resources that have been manually created or applied for through service templates.", - "sds_block_volumesGroup_descrip":"View and manage resources that have been manually created or applied for through service templates.", - "sds_home_tenants":"Tenants", - "sds_home_users":"Users", - "sds_home_volumes":"Volumes", - "sds_home_snapshots":"Volume Snapshots", - "sds_home_replications":"Volume Replications", - "sds_home_pools":"Storage Pools", - "sds_home_storages":"Block Storages", - "sds_home_overvew":"Overview", - "sds_home_update":"Updated 5 minutes ago", - "sds_home_capacity":"Capacity", - "sds_home_block_capacity":"Block Storage Capacity", - "sds_home_top5":"Top 5 Allocated Capacity by Block Profile", - "sds_home_used_capacity":"Used Capacity", - "sds_home_free_capacity":"Free Capacity", - "sds_block_volume_name":"Name", - "sds_block_volume_status":"Status", - "sds_block_volume_profile":"Profile", - "sds_block_volume_az":"Availability Zone", - "sds_block_volume_operation":"Operation", - "sds_block_volume_title":"Volume", - "sds_block_volume_grouptitle":"Volume Group", - "sds_block_volume_createsna":"Create Snapshot", - "sds_block_volume_createrep":"Create Replication", - "sds_block_volume_more":"More", - "sds_block_volume_modify":"Modify", - "sds_block_volume_expand":"Expand", - "sds_block_volume_delete":"Delete", - "sds_block_volume_create":"Create", - "sds_block_volume_search":"search", - "sds_block_volume_createVol":"Create Volume", - "sds_block_volume_createVol_desc":"Apply for block storage resources.", - "sds_block_volume_quantity":"Quantity", - "sds_block_volume_addvolu":"Add Volumes", - "sds_block_volume_selectpro":"Select Profile", - "sds_block_volume_conf_rep":"Configuration replication now", - "sds_block_volume_detail":"Volume detail", - "sds_block_volume_id":"Volume ID", - "sds_block_volume_createat":"Created At", - "sds_block_volume_snapshot":"Snapshot", - "sds_block_volume_replication":"Replication", - "sds_block_volume_descri":"Description", - "sds_block_volume_del_sna":"Delete Snapshots", - "sds_block_volume_curr_capa":"Current Capacity", - "sds_block_volume_expandby":"Expand Capacity By", - "sds_block_volume_totalcapa":"Total Capacity After Expansion", - "sds_block_volume_deleVolu":"Delete Volume", - "sds_block_volume_source":"The volume is created by snapshot( id: {{}} ).", - "sds_resource_region_default":"default_region", - "sds_profile_create_name_require":"name is required.", - "sds_block_volume_replication_disable":"Disable", - "sds_block_volume_replication_failover":"Failover", - "sds_profile_list_descrip":"A profile is a set of configurations on service capabilities (including resource tuning, QoS) of storage resources. A profile must be specified when volume is created.", - "sds_profile_create_title":"Create Profile", - "sds_profile_create_descrip":"Create profile to suit your specific use requirements.", - "sds_profile_access_pro":"Access Protocol", - "sds_profile_pro_type":"Provisioning Type", - "sds_profile_qos_policy":"QoS Policy", - "sds_profile_replication_policy":"Replication Policy", - "sds_profile_snap_policy":"Snapshot Policy", - "sds_profile_create_customization":"Customization", - "sds_profile_avai_pool":"Available Storage Pool", - "sds_profile_extra_key":"Key", - "sds_profile_extra_value":"Value", - "sds_profile_create_maxIOPS":"MaxIOPS", - "sds_profile_create_maxBWS":"MaxBWS", - "sds_profile_rep_type":"Type", - "sds_profile_rep_rgo":"RGO", - "sds_profile_rep_mode":"Mode", - "sds_profile_rep_rto":"RTO", - "sds_profile_rep_period":"Period", - "sds_profile_rep_rpo":"RPO", - "sds_profile_rep_bandwidth":"Bandwidth", - "sds_profile_rep_consis":"Consistency", - "sds_profile_snap_sche":"Schedule", - "sds_profile_snap_exetime":"Execution Time", - "sds_profile_snap_reten":"Retention", - "sds_profile_IOPS_unit":"IOPS/TB", - "sds_profile_BWS_unit":"MBPS/TB", - "sds_profile_unit_minutes":"Minutes", - "sds_profile_enable":"Enable", - "sds_profile_nuit_days":"Days", - "sds_profile_extra_add":"Add", - "sds_profile_pool_match":"Matching", - "sds_resource_region":"Region", - "sds_resource_storage":"Storage", - "sds_resource_region_role":"Region Role", - "sds_resource_storage_ip":"IP Address", - "sds_identity_tenant":"Tenant", - "sds_identity_user":"User", - "sds_identity_tenant_descrip":"A tenant is used to group and manage resources and users.", - "sds_identity_res_usage":"Resource Usage", - "sds_identity_tenant_cap":"Storage Capacity", - "sds_identity_tenant_manage":"User Management", - "sds_identity_tenant_add":"Add User", - "sds_block_volume_group_id":"Group ID", - "sds_block_volume_group_detail":"Volume Group detail", - "sds_block_volume_group_router":"Volume Group", - "sds_validate_max_length":"The maximum length is 200.", - "sds_block_volume_group_create_group":"Create Volume Group", - "sds_block_volume_rep_pair":"Replication Pair", - "sds_block_volume_base_info":"Basic Information", - "sds_block_volume_group_remove":"Remove", - "sds_block_volume_group_modify_group":"Modify Volume Group", - "sds_identity_user_name":"Username", - "sds_login_error_msg_401":"Incorrect username or password!", - "sds_login_error_msg_503":"Service Unavailable!", - "sds_login_error_msg_default":"Internal Server Error!" - - - -} diff --git a/dashboard/src/app/i18n/en/widgetsKeyID.json b/dashboard/src/app/i18n/en/widgetsKeyID.json deleted file mode 100644 index b1a30c60e..000000000 --- a/dashboard/src/app/i18n/en/widgetsKeyID.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "ok": "OK", - "close": "Close", - "cancel": "Cancel", - "confirm": "Confirm", - "warn": "警告", - "tip": "Information", - "success": "Success", - "error": "Error", - "emptyTable": "无数据", - "emptyData": "无数据", - "totalRecords": "总条数", - "goto": "跳转" - -} diff --git a/dashboard/src/app/i18n/zh/exception.json b/dashboard/src/app/i18n/zh/exception.json deleted file mode 100644 index 40b9cdf15..000000000 --- a/dashboard/src/app/i18n/zh/exception.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "timeout":"请求超时", - "system_error":"系统内部错误" -} \ No newline at end of file diff --git a/dashboard/src/app/i18n/zh/keyID.json b/dashboard/src/app/i18n/zh/keyID.json deleted file mode 100644 index 7171a5419..000000000 --- a/dashboard/src/app/i18n/zh/keyID.json +++ /dev/null @@ -1,117 +0,0 @@ -{ - "sds_required":"{0} is required.", - "sds_pattern":"Beginning with a letter with a length of 1-128, it can contain letters / numbers / underlines.", - "sds_profileNull":"profile is required", - "sds_block_volumes_descrip":"View and manage resources that have been manually created or applied for through service templates.", - "sds_block_volumesGroup_descrip":"View and manage resources that have been manually created or applied for through service templates.", - "sds_home_tenants":"Tenants", - "sds_home_users":"Users", - "sds_home_volumes":"Volumes", - "sds_home_snapshots":"Volume Snapshots", - "sds_home_replications":"Volume Replications", - "sds_home_pools":"Storage Pools", - "sds_home_storages":"Block Storages", - "sds_home_overvew":"Overview", - "sds_home_update":"Updated 5 minutes ago", - "sds_home_capacity":"Capacity", - "sds_home_block_capacity":"Block Storage Capacity", - "sds_home_top5":"Top 5 Allocated Capacity by Block Profile", - "sds_home_used_capacity":"Used Capacity", - "sds_home_free_capacity":"Free Capacity", - "sds_block_volume_name":"Name", - "sds_block_volume_status":"Status", - "sds_block_volume_profile":"Profile", - "sds_block_volume_az":"Availability Zone", - "sds_block_volume_operation":"Operation", - "sds_block_volume_title":"Volume", - "sds_block_volume_grouptitle":"Volume Group", - "sds_block_volume_createsna":"Create Snapshot", - "sds_block_volume_createrep":"Create Replication", - "sds_block_volume_more":"More", - "sds_block_volume_modify":"Modify", - "sds_block_volume_expand":"Expand", - "sds_block_volume_delete":"Delete", - "sds_block_volume_create":"Create", - "sds_block_volume_search":"search", - "sds_block_volume_createVol":"Create Volume", - "sds_block_volume_createVol_desc":"Apply for block storage resources.", - "sds_block_volume_quantity":"Quantity", - "sds_block_volume_addvolu":"Add Volumes", - "sds_block_volume_selectpro":"Select Profile", - "sds_block_volume_conf_rep":"Configuration replication now", - "sds_block_volume_detail":"Volume detail", - "sds_block_volume_id":"Volume ID", - "sds_block_volume_createat":"Created At", - "sds_block_volume_snapshot":"Snapshot", - "sds_block_volume_replication":"Replication", - "sds_block_volume_descri":"Description", - "sds_block_volume_del_sna":"Delete Snapshots", - "sds_block_volume_curr_capa":"Current Capacity", - "sds_block_volume_expandby":"Expand Capacity By", - "sds_block_volume_totalcapa":"Total Capacity After Expansion", - "sds_block_volume_deleVolu":"Delete Volume", - "sds_block_volume_source":"The volume is created by snapshot( id: {{}} ).", - "sds_resource_region_default":"default_region", - "sds_profile_create_name_require":"name is required.", - "sds_block_volume_replication_disable":"Disable", - "sds_block_volume_replication_failover":"Failover", - "sds_profile_list_descrip":"A profile is a set of configurations on service capabilities (including resource tuning, QoS) of storage resources. A profile must be specified when volume is created.", - "sds_profile_create_title":"Create Profile", - "sds_profile_create_descrip":"Create profile to suit your specific use requirements.", - "sds_profile_access_pro":"Access Protocol", - "sds_profile_pro_type":"Provisioning Type", - "sds_profile_qos_policy":"QoS Policy", - "sds_profile_replication_policy":"Replication Policy", - "sds_profile_snap_policy":"Snapshot Policy", - "sds_profile_create_customization":"Customization", - "sds_profile_avai_pool":"Available Storage Pool", - "sds_profile_extra_key":"Key", - "sds_profile_extra_value":"Value", - "sds_profile_create_maxIOPS":"MaxIOPS", - "sds_profile_create_maxBWS":"MaxBWS", - "sds_profile_rep_type":"Type", - "sds_profile_rep_rgo":"RGO", - "sds_profile_rep_mode":"Mode", - "sds_profile_rep_rto":"RTO", - "sds_profile_rep_period":"Period", - "sds_profile_rep_rpo":"RPO", - "sds_profile_rep_bandwidth":"Bandwidth", - "sds_profile_rep_consis":"Consistency", - "sds_profile_snap_sche":"Schedule", - "sds_profile_snap_exetime":"Execution Time", - "sds_profile_snap_reten":"Retention", - "sds_profile_IOPS_unit":"IOPS/TB", - "sds_profile_BWS_unit":"MBPS/TB", - "sds_profile_unit_minutes":"Minutes", - "sds_profile_enable":"Enable", - "sds_profile_nuit_days":"Days", - "sds_profile_extra_add":"Add", - "sds_profile_pool_match":"Matching", - "sds_resource_region":"Region", - "sds_resource_storage":"Storage", - "sds_resource_region_role":"Region Role", - "sds_resource_storage_ip":"IP Address", - "sds_identity_tenant":"Tenant", - "sds_identity_user":"User", - "sds_identity_tenant_descrip":"A tenant is used to group and manage resources and users.", - "sds_identity_res_usage":"Resource Usage", - "sds_identity_tenant_cap":"Storage Capacity", - "sds_identity_tenant_manage":"User Management", - "sds_identity_tenant_add":"Add User", - "sds_block_volume_group_id":"Group ID", - "sds_block_volume_group_detail":"Volume Group detail", - "sds_block_volume_group_router":"Volume Group", - "sds_validate_max_length":"The maximum length is 200.", - "sds_block_volume_group_create_group":"Create Volume Group", - "sds_block_volume_rep_pair":"Replication Pair", - "sds_block_volume_base_info":"Basic Information", - "sds_block_volume_group_remove":"Remove", - "sds_block_volume_group_modify_group":"Modify Volume Group", - "sds_identity_user_name":"Username", - "sds_login_error_msg_401":"Incorrect username or password!", - "sds_login_error_msg_503":"Service Unavailable!", - "sds_login_error_msg_default":"Internal Server Error!" - - - -} diff --git a/dashboard/src/app/i18n/zh/widgetsKeyID.json b/dashboard/src/app/i18n/zh/widgetsKeyID.json deleted file mode 100644 index a28f02914..000000000 --- a/dashboard/src/app/i18n/zh/widgetsKeyID.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "ok": "OK", - "close": "关闭", - "cancel": "Cancel", - "confirm": "确认", - "warn": "警告", - "tip": "提示", - "success": "成功", - "error": "錯誤", - "emptyTable": "无数据", - "emptyData": "无数据", - "totalRecords": "总条数", - "goto": "跳转" - -} diff --git a/dashboard/src/app/shared/api.ts b/dashboard/src/app/shared/api.ts deleted file mode 100644 index 3589a5eb2..000000000 --- a/dashboard/src/app/shared/api.ts +++ /dev/null @@ -1,7 +0,0 @@ -export * from './utils/consts'; -export * from './utils/utils'; -export * from './service/Exception.service'; -export * from './service/Http.service'; -export * from './service/I18N.service'; -export * from './service/MsgBox.service'; -export * from './service/ParamStor.service'; diff --git a/dashboard/src/app/shared/service/Exception.service.ts b/dashboard/src/app/shared/service/Exception.service.ts deleted file mode 100644 index 15b59a784..000000000 --- a/dashboard/src/app/shared/service/Exception.service.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { Injectable } from '@angular/core'; -import { I18NService } from './I18N.service'; -import { MsgBoxService } from './MsgBox.service'; - - -@Injectable() -export class ExceptionService { - constructor(private I18N: I18NService, private msgBox: MsgBoxService) {} - - //异常判断 - isException(res){ - return false; - // let isRest = res.url.indexOf('v1') || res.url.indexOf('v3'); - // if (isRest > 0){ - // if(res.text() === "sessionout"){ - // return true; - // } - // let data = res.json(); - // if(data && data.code != 0) { - // return true; - // } - // else{ - // return false; - // } - // } - } - - doException(res){ - // if(res.text() === "sessionout" ) { - // let url = window.location.href; - // let isresource = url.indexOf('siteDistribution'); - // if(isresource > 0 ){ - // parent.postMessage({reload: "reload" }, '*'); - // } - // else{ - // window.location.reload(); - // } - // return; - // } - - // let data = res.json(); - // let code = data.code; - - // if(data && data.code) { - // code = data.code; - // } - // this.msgBox.error(this.I18N.get(code) + ""); - } -} \ No newline at end of file diff --git a/dashboard/src/app/shared/service/Http.service.ts b/dashboard/src/app/shared/service/Http.service.ts deleted file mode 100644 index d15dfd431..000000000 --- a/dashboard/src/app/shared/service/Http.service.ts +++ /dev/null @@ -1,103 +0,0 @@ -import { Http, XHRBackend, RequestOptions, Request, RequestOptionsArgs, Response, Headers, BaseRequestOptions } from '@angular/http'; -import { Injectable, Injector } from '@angular/core'; -import { Observable } from 'rxjs/Observable'; -import { Mask } from '../utils/mask'; -import { BaseRequestOptionsArgs } from './api'; -import { ExceptionService } from './Exception.service'; - -import 'rxjs/add/operator/map'; -import 'rxjs/add/operator/catch'; -import 'rxjs/add/operator/do'; -import 'rxjs/add/operator/finally'; -import 'rxjs/add/operator/timeout'; -import 'rxjs/add/observable/throw'; - -@Injectable() -export class HttpService extends Http { - TIMEOUT = 18000; - - constructor(backend: XHRBackend, defaultOptions: RequestOptions, private injector: Injector) { - super(backend, defaultOptions); - } - - get(url: string, options?: BaseRequestOptionsArgs): Observable{ - [url, options]= this.presetURL(url, options); - return this.intercept(super.get(url, options), options); - } - - post(url: string, body: any, options?: BaseRequestOptionsArgs): Observable{ - [url, options]= this.presetURL(url, options); - return this.intercept(super.post(url, body, options), options); - } - - put(url: string, body: any, options?: BaseRequestOptionsArgs): Observable{ - [url, options]= this.presetURL(url, options); - return this.intercept(super.put(url, body, options), options); - } - - delete(url: string, options?: BaseRequestOptionsArgs): Observable{ - [url, options]= this.presetURL(url, options); - return this.intercept(super.delete(url, options), options); - } - - patch(url: string, body: any, options?: BaseRequestOptionsArgs): Observable{ - [url, options]= this.presetURL(url, options); - return this.intercept(super.patch(url, body, options), options); - } - - head(url: string, options?: BaseRequestOptionsArgs): Observable{ - [url, options]= this.presetURL(url, options); - return this.intercept(super.head(url, options), options); - } - - options(url: string, options?: BaseRequestOptionsArgs): Observable{ - [url, options]= this.presetURL(url, options); - return this.intercept(super.options(url, options), options); - } - - presetURL(url, options){ - // Configure token option - if( localStorage['auth-token'] ){ - !options && (options = {}) - !options.headers && (options['headers'] = new Headers()); - options.headers.set('X-Auth-Token', localStorage['auth-token']); - - } - - // Configure "project_id" for url - if(url.includes('{project_id}')){ - let project_id = localStorage['current-tenant'].split("|")[1]; - url = url.replace('{project_id}',project_id); - - } - - return [url, options]; - } - - intercept(observable: Observable, options = {}): Observable { - let exception = this.injector.get(ExceptionService); - - if(options.mask != false) { - Mask.show(); - } - - return observable.timeout(options.timeout || this.TIMEOUT).do((res: Response) => { - //success - - //fail: Public exception handling - if(exception.isException(res)){ - options.doException !== false && exception.doException(res); - - throw Observable.throw(res); - } - }, (err:any) => { - //fail: Public exception handling - options.doException !== false && exception.doException(err); - }) - .finally(() => { - if( options.mask !==false ){ - Mask.hide(); - } - }) - } -} \ No newline at end of file diff --git a/dashboard/src/app/shared/service/I18N.service.ts b/dashboard/src/app/shared/service/I18N.service.ts deleted file mode 100644 index b083d5aae..000000000 --- a/dashboard/src/app/shared/service/I18N.service.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { Injectable } from '@angular/core'; -import { templateJitUrl } from '@angular/compiler'; - -@Injectable() - -export class I18NService { - language = 'en'; - keyID = {}; - - constructor(){ - this.language = this.getCookieLanguage(); - } - - get(key, params = []){ - let str = this.keyID[key] || key; - params.forEach((param, index) => { - str = str.replace('{' + index + '}', param); - }); - return str; - } - - //zh: Chinese en: English - getCookieLanguage() { - this.urlLanguage(); - let cookieStr = document.cookie.split("; "); - let arrLength = cookieStr.length; - for (let i = 0; i 0){ - let tempLanguage = hasUrlLan[1]; - if(tempLanguage == "zh" || tempLanguage == "en"){ - document.cookie = "language=" + tempLanguage + ";domain=.huawei.com;path=/"; - } - } - } -} \ No newline at end of file diff --git a/dashboard/src/app/shared/service/MsgBox.service.ts b/dashboard/src/app/shared/service/MsgBox.service.ts deleted file mode 100644 index 2c34eb5d1..000000000 --- a/dashboard/src/app/shared/service/MsgBox.service.ts +++ /dev/null @@ -1,91 +0,0 @@ -import { Injectable, Injector, ApplicationRef, ViewContainerRef, ComponentFactoryResolver } from '@angular/core'; -import { MsgBox } from '../../components/msgbox/msgbox'; -import { I18NService } from './I18N.service'; - -@Injectable() -export class MsgBoxService { - private defaultConfig = { - header: this.I18N.get("tip"), - visible: true, - width: 418, - height: "auto" - } - - constructor( - private componentFactoryResolver: ComponentFactoryResolver, - private applicationRef: ApplicationRef, - private I18N: I18NService, - private injector: Injector - ){} - - open(config){ - this.applicationRef = this.applicationRef || this.injector.get(ApplicationRef); - - if( !this.applicationRef || !this.applicationRef.components[0]){ - alert("System error"); - return; - } - - let viewContainerRef = this.applicationRef.components[0].instance.viewContainerRef; - let componentFactory = this.componentFactoryResolver.resolveComponentFactory(MsgBox); - viewContainerRef.clear(); - let componentRef = viewContainerRef.createComponent(componentFactory); - - if( !config.ok ){ - config.ok = () => config.visible = false; - } - - (componentRef.instance).config = config; - - return config; - } - - info(config = {}){ - if( typeof config == "string"){ - config = { - content: config - } - } - - let _config = { - type: "info", - content: "", - header: this.I18N.get("tip"), - } - - return this.open(Object.assign({}, this.defaultConfig, _config, config)); - } - - success(config = {}){ - if( typeof config == "string"){ - config = { - content: config - } - } - - let _config = { - type: "success", - content: "", - header: this.I18N.get("success") - } - - return this.open(Object.assign({}, this.defaultConfig, _config, config)); - } - - error(config = {}){ - if( typeof config == "string"){ - config = { - content: config - } - } - - let _config = { - type: "error", - content: "", - header: this.I18N.get("error") - } - - return this.open(Object.assign({}, this.defaultConfig, _config, config)); - } - -} \ No newline at end of file diff --git a/dashboard/src/app/shared/service/ParamStor.service.ts b/dashboard/src/app/shared/service/ParamStor.service.ts deleted file mode 100644 index d8c21f7b0..000000000 --- a/dashboard/src/app/shared/service/ParamStor.service.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { Injectable } from '@angular/core'; - -@Injectable() -export class ParamStorService { - // Set local storage - setParam(key, value){ - localStorage[key] = value; - } - - // Get local storage - getParam(key){ - return localStorage[key]; - } - - // Current login user - CURRENT_USER(param?){ - if(param === undefined){ - return this.getParam('current-user'); - } else { - this.setParam('current-user', param); - } - } - - // User auth token - AUTH_TOKEN(param?){ - if(param === undefined){ - return this.getParam('auth-token'); - } else { - this.setParam('auth-token', param); - } - } - - // Current login user - CURRENT_TENANT(param?){ - if(param === undefined){ - return this.getParam('current-tenant'); - } else { - this.setParam('current-tenant', param); - } - } - // user password - PASSWORD(param?){ - if(param === undefined){ - return this.getParam('password'); - } else { - this.setParam('password', param); - } - } - // token period - TOKEN_PERIOD(param?){ - if(param === undefined){ - return this.getParam('token_period'); - } else { - this.setParam('token_period', param); - } - } - - -} \ No newline at end of file diff --git a/dashboard/src/app/shared/service/api.ts b/dashboard/src/app/shared/service/api.ts deleted file mode 100644 index 1f1de7792..000000000 --- a/dashboard/src/app/shared/service/api.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { EventEmitter, Injectable } from '@angular/core'; -import { Subject } from 'rxjs/Subject'; -import { Observable } from 'rxjs/Observable'; - -// export{ DomHandler } from '../dom/domhandler'; - -import{ RequestOptionsArgs } from '@angular/http'; - -export interface SortMeta { - -} - -export interface Confirmation { - message: string; - icon?: string; - header?: string; - accept?: Function; - reject?: Function; - acceptVisible?: boolean; - rejectVisible?: boolean; - acceptEvent?: EventEmitter; - rejectEvent?: EventEmitter; -} - -export interface BaseRequestOptionsArgs extends RequestOptionsArgs { - mask?: boolean; - timeout?: number; - doException?: boolean; -} - -@Injectable() -export class ConfirmationService{ - private requireConfirmationSource = new Subject(); - private acceptConfirmationSource = new Subject(); - - requireConfirmation$ = this.requireConfirmationSource.asObservable(); - accept = this.acceptConfirmationSource.asObservable(); - - confirm(confirmation: Confirmation) { - this.requireConfirmationSource.next(confirmation); - return this; - } - - onAccept() { - this.acceptConfirmationSource.next(); - } -} \ No newline at end of file diff --git a/dashboard/src/app/shared/shared.config.ts b/dashboard/src/app/shared/shared.config.ts deleted file mode 100644 index aef9e4e37..000000000 --- a/dashboard/src/app/shared/shared.config.ts +++ /dev/null @@ -1,93 +0,0 @@ -import{ Consts } from 'app/shared/api'; -import{ Http } from '@angular/http'; -import{ I18N } from 'app/components/common/api'; - -var _ = require('underscore'); -export class SharedConfig{ - - //配置入口 - static config( I18NService, injector) { - let httpService = injector.get(Http); - return () => new Promise((resolve, reject) => { - Promise.all([ - SharedConfig.I18NConfig(I18NService, httpService), - // SharedConfig.AutoDeploy(httpService), - ]).then(() => resolve()).catch(reason => console.log(reason)); - }) - } - - //I18N服务配置 - static I18NConfig(I18NService, httpService) { - let p1 = new Promise((resolve, reject) => { - //应用I18N配置 - httpService.get("src/app/i18n/"+ I18NService.language + "/keyID.json").subscribe((r) => { - Object.assign(I18NService.keyID, r.json()); - resolve(); - }) - }) - - let p2 = new Promise((resolve, reject) => { - //异常I18N配置 - httpService.get("src/app/i18n/"+ I18NService.language + "/exception.json").subscribe((r) => { - Object.assign(I18NService.keyID, r.json()); - resolve(); - }) - }) - - let p3 = new Promise((resolve, reject) => { - //控件I18N配置 - httpService.get("src/app/i18n/"+ I18NService.language + "/widgetsKeyID.json").subscribe((r) => { - Object.assign(I18NService.keyID, r.json()); - I18N.language = I18NService.language; - I18N.keyID = I18NService.keyID; - resolve(); - }) - }) - return Promise.all([p1, p2, p3]); - } - - static AutoDeploy(httpService) { - return new Promise((resolve, reject) => { - //读取环境配置url - httpService.get("src/prodconfig/deployConfig.json").subscribe((r) => { - let responseData = r.json; - - Promise.all([ - // SharedConfig.initBaseUser(httpService), - // SharedConfig.initUserRoles(httpService) - ]).then(() => resolve()).catch(reason => console.log(reason)); - }) - }) - } - - //获取用户基本权限 - static initBaseUser(httpService){ - return new Promise((resolve, reject) => { - let request: any = { params: {}}; - request.params.type = "base"; - httpService.get("/v1/...", request).subscribe(response => { - let responseData = response.json().data; - // Consts.CURRENT_USERNAME = responseData.userName; - // Consts.BASE_TENANT = responseData.tenant; - - resolve(); - }) - }) - } - - //获取用户角色信息 - static initUserRoles(httpService){ - return new Promise((resolve, reject) => { - let request: any = { params: {}}; - httpService.get("/v1/...", request).subscribe(response => { - let roles = response.json().data; - // _.each(roles, function(item, i){ - // roles[i] = item.toLowerCase(); - // }) - // Consts.USER_ROLES = roles; - - resolve(); - }) - }) - } -} \ No newline at end of file diff --git a/dashboard/src/app/shared/shared.module.ts b/dashboard/src/app/shared/shared.module.ts deleted file mode 100644 index 1c59f1d2f..000000000 --- a/dashboard/src/app/shared/shared.module.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { NgModule, ModuleWithProviders, APP_INITIALIZER, Injector } from '@angular/core'; -import { FormsModule } from '@angular/forms'; -import { ExceptionService, MsgBoxService, I18NService, HttpService, ParamStorService } from './api'; -import { SharedConfig } from './shared.config'; -import { I18N, MsgBoxModule } from '../components/common/api'; -import { XHRBackend, RequestOptions, Http } from '@angular/http'; - -export function httpFactory(backend: XHRBackend, options: RequestOptions, injector: Injector){ - options.headers.set("contentType", "application/json; charset=UTF-8"); - options.headers.set('Cache-control', 'no-cache'); - options.headers.set('cache-control', 'no-store'); - options.headers.set('expires', '0'); - options.headers.set('Pragma', 'no-cache'); - - return new HttpService(backend, options, injector); -} - -@NgModule({ - imports:[MsgBoxModule], - exports:[FormsModule, MsgBoxModule] -}) - -export class SharedModule { - static forRoot(): ModuleWithProviders { - return { - ngModule: SharedModule, - providers: [ - MsgBoxService, - I18NService, - ParamStorService, - ExceptionService, - { - provide: Http, - useFactory: httpFactory, - deps: [XHRBackend, RequestOptions, Injector] - }, - { - provide: APP_INITIALIZER, - useFactory: SharedConfig.config, - deps: [I18NService, Injector], - multi: true - } - ] - }; - } -} \ No newline at end of file diff --git a/dashboard/src/app/shared/utils/consts.ts b/dashboard/src/app/shared/utils/consts.ts deleted file mode 100644 index 3bea6428c..000000000 --- a/dashboard/src/app/shared/utils/consts.ts +++ /dev/null @@ -1,29 +0,0 @@ -export const Consts = { - /** 不显示的语言 **/ - UNKNOW_PLACEHOLDER: "--", - - /** 百分比显示小数位数 **/ - PRECISION_PERCENT: 2, - - /** 常用日期时间格式 **/ - DATE_FORMAT: "yyyy-MM-dd", - TIME_FORMAT: "hh:mm:ss", - DATETIME_FORMAT: "yyyy-MM-dd hh:mm:ss", - - /** 窗口输入框长度,按照栅格定义控件宽度,数字x标识占x个格子 **/ - W1: 72, - W2: 152, - W3: 232, - W4: 312, - W5: 250, - WSearch: 180, - - - /** 百分比显示小数位数 **/ - - /** 百分比显示小数位数 **/ - - /** 百分比显示小数位数 **/ - - /** 百分比显示小数位数 **/ -} \ No newline at end of file diff --git a/dashboard/src/app/shared/utils/mask.ts b/dashboard/src/app/shared/utils/mask.ts deleted file mode 100644 index df03d4aca..000000000 --- a/dashboard/src/app/shared/utils/mask.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { DOCUMENT } from "@angular/common"; - -export class Mask { - static createBackground = () =>{ - let div = document.createElement('div'); - div.className = 'mask-background'; - return div; - } - - static createLoading= () => { - let div = document.createElement('div'); - div.innerHTML = '

        Loading...

        '; - div.className = "M-loading-content"; - return div; - } - - static background = Mask.createBackground(); - - static loading = Mask.createLoading(); - - static show() { - document.body.appendChild(Mask.loading); - document.body.appendChild(Mask.background); - } - - static hide() { - if( document.body.querySelector('body > .M-loading-content') ){ - document.body.removeChild(Mask.loading); - } - - if( document.body.querySelector('body > .mask-background') ){ - document.body.removeChild(Mask.background); - } - } -} \ No newline at end of file diff --git a/dashboard/src/app/shared/utils/utils.ts b/dashboard/src/app/shared/utils/utils.ts deleted file mode 100644 index 833765eb9..000000000 --- a/dashboard/src/app/shared/utils/utils.ts +++ /dev/null @@ -1,146 +0,0 @@ -export class Utils { - - static capacityUnit = { - KB: "KB", - MB: "MB", - GB: "GB", - TB: "TB", - PB: "PB", - EB: "EB", - BYTE: "BYTE", - BIT: "BIT" - } - - /** - * Formatting data, preserving three decimal (interception) - * ex. 123456.78901 -> 123,456.789 - * - * @param number (input) - * @param decimals (number) - * @param dec_point (Decimal separator) - * @param thousands_sep (Thousandth separators) - * @returns number - */ - static numberFormat(number, decimals=3, dec_point=".", thousands_sep=",", isCeil=false) { - number = (String(number)).replace(/[^0-9+-Ee.]/g, ''); - let n = !isFinite(+number) ? 0 : +number, - prec = !isFinite(+decimals) ? 0 : Math.abs(decimals), - sep = thousands_sep, - dec = dec_point, - s = [], - toFixedFix = function(n, prec, isCeil) { - var k = Math.pow(10, prec); - if (isCeil) { - return String(Math.ceil(n * k) / k); - } else { - return String(Math.floor(n * k) / k); - } - }; - - // Fix for IE parseFloat(0.55).toFixed(0) = 0; - s = (prec ? toFixedFix(n, prec, isCeil) : String(Math.floor(n))).split('.'); - if (s[0].length > 3) { - s[0] = s[0].replace(/\B(?=(?:d{3})+(?!d))/g, sep); - } - if ((s[1] || '').length > prec) { - s[1] = s[1] || ''; - s[1] += new Array(prec - s[1].length + 1).join('0'); - } - if (!(s[1])) { - s[1] = '0'; - } - while ((s[1] || '').length < prec) { - s[1] += '0'; - } - return s.join(dec); - } - - /** - * Returns the capacity value of the adaptive unit for display (with units). - * @param capacity (byte) - * @param decimals (number) - * @param minUnit (string) Minimum unit of capacity after conversion - * @return {[type]} [description] - */ - static getDisplayCapacity(capacity, decimals = 3, minUnit = "GB") { - let ret; - let unit = this.capacityUnit.BYTE; - - if (minUnit == "BYTE" && capacity / 1024 < 1) { - ret = capacity; - } else if ("KB".includes(minUnit) && capacity / (1024 * 1024) < 1) { - ret = capacity / 1024; - unit = this.capacityUnit.KB; - } else if ("KB,MB".includes(minUnit) && capacity / (1024 * 1024 * 1024) < 1) { - ret = capacity / (1024 * 1024); - unit = this.capacityUnit.MB; - } else if ("KB,MB,GB".includes(minUnit) && capacity / (1024 * 1024 * 1024 * 1024) < 1) { - ret = capacity / (1024 * 1024 * 1024); - unit = this.capacityUnit.GB; - } else if ("KB,MB,GB,TB".includes(minUnit) && capacity / (1024 * 1024 * 1024 * 1024 * 1024) < 1) { - ret = capacity / (1024 * 1024 * 1024 * 1024); - unit = this.capacityUnit.TB; - } else if ("KB,MB,GB,TB,PB".includes(minUnit) && capacity / (1024 * 1024 * 1024 * 1024 * 1024 * 1024) < 1) { - ret = capacity / (1024 * 1024 * 1024 * 1024 * 1024); - unit = this.capacityUnit.PB; - } else if ("KB,MB,GB,TB,PB,EB".includes(minUnit) && capacity / (1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024) < 1) { - ret = capacity / (1024 * 1024 * 1024 * 1024 * 1024 * 1024); - unit = this.capacityUnit.EB; - } - - ret = this.numberFormat(ret, decimals); - return ret == 0 ? ret + " " + minUnit : ret + " " + unit; - } - - /** - * Returns the capacity value of the adaptive unit for display (with units). - * @param capacity (GB) - * @param decimals (number) - * @return {[type]} [description] - */ - static getDisplayGBCapacity(capacity, decimals = 3) { - let ret; - let unit = this.capacityUnit.GB; - - if (capacity / 1024 < 1) { - ret = capacity; - } else if (capacity / (1024 * 1024) < 1) { - ret = capacity / 1024; - unit = this.capacityUnit.TB; - } else if (capacity / (1024 * 1024 * 1024) < 1) { - ret = capacity / (1024 * 1024); - unit = this.capacityUnit.PB; - } else if (capacity / (1024 * 1024 * 1024 * 1024) < 1) { - ret = capacity / (1024 * 1024 * 1024); - unit = this.capacityUnit.EB; - } - - ret = this.numberFormat(ret, decimals); - return ret + " " + unit; - } - - /** - * Help get validation information. - * @param control form information - * @param page extra validation information param - * @returns {string} - */ - static getErrorKey(control,page){ - if(control.errors){ - let key = Object.keys(control.errors)[0]; - return page ? "sds_"+ page +key:"sds_"+key; - } - } - /** - * remove one of array element - * @param prevArr origin array - * @param element remove element - * @param func remove methods - */ - static arrayRemoveOneElement(prevArr,element,func){ - let index = prevArr.findIndex(func); - if(index > -1){ - prevArr.splice(index,1); - } - } -} diff --git a/dashboard/src/assets/.gitkeep b/dashboard/src/assets/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/dashboard/src/assets/business/css/primeng.scss b/dashboard/src/assets/business/css/primeng.scss deleted file mode 100644 index 9da63e794..000000000 --- a/dashboard/src/assets/business/css/primeng.scss +++ /dev/null @@ -1,69 +0,0 @@ -@import './app/components/common/common.scss'; -@import './app/components/autocomplete/autocomplete.css'; -@import './app/components/accordion/accordion.css'; -@import './app/components/blockui/blockui.css'; -@import './app/components/breadcrumb/breadcrumb.css'; -@import './app/components/button/button.scss'; -@import './app/components/badge/badge.scss'; -@import './app/components/calendar/calendar.css'; -@import './app/components/card/card.css'; -@import './app/components/carousel/carousel.css'; -@import './app/components/checkbox/checkbox.css'; -@import './app/components/chips/chips.css'; -@import './app/components/colorpicker/colorpicker.css'; -@import './app/components/contextmenu/contextmenu.css'; -@import './app/components/datagrid/datagrid.css'; -@import './app/components/datalist/datalist.css'; -@import './app/components/datascroller/datascroller.css'; -@import './app/components/datatable/datatable.scss'; -@import './app/components/dataview/dataview.css'; -@import './app/components/dialog/dialog.scss'; -@import './app/components/dropdown/dropdown.scss'; -@import './app/components/dropmenu/dropmenu.scss'; -@import './app/components/fieldset/fieldset.css'; -@import './app/components/form/form.scss'; -@import './app/components/fileupload/fileupload.css'; -@import './app/components/galleria/galleria.css'; -@import './app/components/grid/grid.css'; -@import './app/components/growl/growl.css'; -@import './app/components/inplace/inplace.css'; -@import './app/components/inputswitch/inputswitch.css'; -@import './app/components/inputtext/inputtext.scss'; -@import './app/components/inputtextarea/inputtextarea.css'; -@import './app/components/lightbox/lightbox.css'; -@import './app/components/listbox/listbox.css'; -@import './app/components/menu/menu.css'; -@import './app/components/megamenu/megamenu.css'; -@import './app/components/menubar/menubar.css'; -@import './app/components/message/message.css'; -@import './app/components/messages/messages.css'; -@import './app/components/multiselect/multiselect.css'; -@import './app/components/orderlist/orderlist.css'; -@import './app/components/organizationchart/organizationchart.css'; -@import './app/components/overlaypanel/overlaypanel.css'; -@import './app/components/paginator/paginator.scss'; -@import './app/components/panel/panel.css'; -@import './app/components/panelmenu/panelmenu.css'; -@import './app/components/password/password.css'; -@import './app/components/picklist/picklist.css'; -@import './app/components/progressbar/progressbar.css'; -@import './app/components/progressspinner/progressspinner.css'; -@import './app/components/radiobutton/radiobutton.css'; -@import './app/components/schedule/schedule.css'; -@import './app/components/scrollpanel/scrollpanel.css'; -@import './app/components/selectbutton/selectbutton.css'; -@import './app/components/sidebar/sidebar.css'; -@import './app/components/slidemenu/slidemenu.css'; -@import './app/components/slider/slider.css'; -@import './app/components/spinner/spinner.css'; -@import './app/components/splitbutton/splitbutton.css'; -@import './app/components/steps/steps.css'; -@import './app/components/tabmenu/tabmenu.css'; -@import './app/components/tabview/tabview.scss'; -@import './app/components/table/table.css'; -@import './app/components/terminal/terminal.css'; -@import './app/components/tieredmenu/tieredmenu.css'; -@import './app/components/toolbar/toolbar.css'; -@import './app/components/tooltip/tooltip.css'; -@import './app/components/tree/tree.css'; -@import './app/components/treetable/treetable.css'; \ No newline at end of file diff --git a/dashboard/src/assets/business/css/site.scss b/dashboard/src/assets/business/css/site.scss deleted file mode 100644 index 43f6a1ce9..000000000 --- a/dashboard/src/assets/business/css/site.scss +++ /dev/null @@ -1,1563 +0,0 @@ -@charset "UTF-8"; -// @font-face { -// font-family: 'Roboto'; -// font-style: normal; -// font-weight: 400; -// src: url('../fonts/roboto-v15-latin-regular.eot'); -// /* IE9 Compat Modes */ -// src: local('Roboto'), local('Roboto-Regular'), url('../fonts/roboto-v15-latin-regular.eot?#iefix') format('embedded-opentype'), -// /* IE6-IE8 */ -// url('../fonts/roboto-v15-latin-regular.woff2') format('woff2'), -// /* Super Modern Browsers */ -// url('../fonts/roboto-v15-latin-regular.woff') format('woff'), -// /* Modern Browsers */ -// url('../fonts/roboto-v15-latin-regular.ttf') format('truetype'), -// /* Safari, Android, iOS */ -// url('../fonts/roboto-v15-latin-regular.svg#Roboto') format('svg'); -// /* Legacy iOS */ -// } - -/* ----------------------------------------------------------------------------------------------------- */ - -.layout-wrapper { - width: 100%; - height: 100%; -} - - -/* animation login */ - -@keyframes loginHide { - 0% { - width: 2000px; - } - 80% { - width: 320px; - opacity: 1; - } - 100% { - width: 320px; - opacity: 0; - } -} - -@-webkit-keyframes loginHide -/*Safari and Chrome*/ - -{ - 0% { - width: 2000px; - } - 80% { - width: 320px; - opacity: 1; - } - 100% { - width: 320px; - opacity: 0; - } -} - -.login-animation { - animation: loginHide 500ms ease; - -webkit-animation: loginHide 500ms ease; - /* Safari 和 Chrome */ -} - - -/* animation logout */ - -@keyframes loginShow { - 0% { - width: 320px; - opacity: 0; - } - 20% { - width: 320px; - opacity: 1; - } - 100% { - width: 2000px; - opacity: 1; - } -} - -@-webkit-keyframes loginShow -/*Safari and Chrome*/ - -{ - 0% { - width: 320px; - opacity: 0; - } - 20% { - width: 320px; - opacity: 1; - } - 100% { - width: 2000px; - opacity: 1; - } -} - -.logout-animation { - animation: loginShow 500ms ease; - -webkit-animation: loginShow 500ms ease; - /* Safari 和 Chrome */ -} - - -/* login */ - -.layout-wrapper .login-bg { - width: 100%; - height: 100%; - background: url('./assets/business/images/login-bg.png') #242e43 no-repeat center center; - position: absolute; - z-index: 1001; -} - -.layout-wrapper .login-form { - position: absolute; - left: calc(50% - 1.2rem); - top: 20%; - width: 2.4rem; - z-index: 1002; -} - -.login-form .form-list p { - padding-bottom: .2rem; -} - -.layout-wrapper .login-form { - .logo { - height: .75rem; - padding-bottom: .60rem; - background-image: url('./assets/business/images/logo.png'); - background-position: center top; - background-repeat: no-repeat; - } - .ui-button { - padding-left: 0; - padding-right: 0; - } - .ui-inputtext { - background: #303e58; - border: 1px solid #687284; - padding: .1rem .2rem; - color: #e8efff; - @extend .ui-corner-all-large; - } - ::-webkit-input-placeholder { - /* WebKit, Blink, Edge */ - color: #6a7ca0; - } - :-moz-placeholder { - /* Mozilla Firefox 4 to 18 */ - color: #6a7ca0; - opacity: 1; - } - ::-moz-placeholder { - /* Mozilla Firefox 19+ */ - color: #6a7ca0; - opacity: 1; - } - :-ms-input-placeholder { - /* Internet Explorer 10-11 */ - color: #6a7ca0; - } - ::-ms-input-placeholder { - /* Microsoft Edge */ - color: #6a7ca0; - } - .ui-placeholder { - color: #6a7ca0; - } -} - - -/* menu */ - -#layout-topbar { - background-color: #242e43; - background-image: url('./assets/business/images/menu-bg.png'); - background-position: 0 bottom; - background-repeat: no-repeat; - box-sizing: border-box; - display: flex; - flex-direction: column; - justify-content: flex-start; - width: 320px; - height: 100%; - position: fixed; - top: 0; - left: 0; - z-index: 1000; -} - -#layout-topbar .logo { - height: 0.7rem; - flex-shrink: 0; -} - -#layout-topbar .logo a { - display: inline-block; - background-image: url('./assets/business/images/logo-white.png'); - background-repeat: no-repeat; - background-position: center center; - width: 100%; - height: 0.40rem; -} - -#layout-topbar .user-info { - padding: 0.3rem 0.3rem 0.3rem 0.4rem; -} - -#layout-topbar .user-info>div { - display: flex; - justify-content: space-between; -} - -#layout-topbar .user-info>div h1 { - width: 100%; - height: 0.3rem; - color: #cdd3dd; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; - -o-text-overflow: ellipsis; - -ms-text-overflow: ellipsis; - -ms-text-overflow: ellipsis; -} - -#layout-topbar .user-info .ui-button { - width: 0.24rem; - color: #54617a; - .fa { - font-size: 0.24rem; - margin-top: -0.12rem; - margin-left: -0.12rem; - width: 0.24rem; - height: 0.24rem; - } - &:hover { - color: map-get($color-primary, hover); - } - &:active { - color: map-get($color-primary, active); - } -} - -#layout-topbar .user-info p { - display: flex; - justify-content: space-between; -} - -#layout-topbar .user-info p span { - display: inline-block; - width: 50%; - height: 0.22rem; - color: #54617a; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; - -o-text-overflow: ellipsis; - -ms-text-overflow: ellipsis; - -ms-text-overflow: ellipsis; -} - -#layout-topbar .user-info p span i { - margin-right: 0.05rem; -} - -.topbar-menu { - display: inline-block; - list-style-type: none; - margin: 0.1rem 0 0; - padding: 0 0.3rem 0 0.4rem; - height: 100%; - // overflow: scroll; -} - -.topbar-menu>li:first-of-type { - border-top: 1px solid #323d54; -} - -.topbar-menu>li { - border-bottom: 1px solid #323d54; -} - -.topbar-menu>li>a { - padding: 0.18rem 0; - text-decoration: none; - transition: color .3s; - display: inline-block; - width: 100%; - box-sizing: border-box; - h1 { - color: #cdd3dd; - } - p { - color: #54617a; - font-size: 0.12rem; - } - &:hover { - h1 { - color: #fff; - } - } - &.active-item { - h1 { - color: map-get($color-primary, normal); - text-shadow: 0 2px 10px #074f98; - } - &:hover { - h1 { - color: map-get($color-primary, normal); - } - } - } -} - -#layout-content { - margin-left: 3.20rem; - background-color: #ffffff; - height: 100%; -} - -#layout-content .content-work { - min-height: calc(100% - 0.6rem); - margin: 0 auto; - padding: 0.3rem 0.4rem; -} - -.content-header { - padding: 0 0; - margin-bottom: 0.3rem; -} - -.content-header h1 { - padding-bottom: 0.2rem; - color: map-get($color-title, primary); -} - -.form-con { - padding: 0 0 0.2rem; -} - -.form-con h3 { - margin-bottom: 0.2rem; -} - -.form-btn { - padding: 0 0 0.3rem; -} - -.form-btn button { - float: left; - margin-right: 0.1rem; -} - -.table-toolbar { - display: flex; - display: -webkit-flex; - justify-content: space-between; - align-items: center; - padding-bottom: 0.1rem; -} - -.table-toolbar>div { - display: flex; - align-items: center; - flex-wrap: nowrap; -} - -.table-toolbar>div.left>button { - margin-right: 0.1rem; -} - -.table-toolbar>div.right>button { - margin-left: 0.1rem; -} - -.table-detail-con { - padding: 0.2rem 0.3rem; -} - -.table-detail-con h3 { - margin-bottom: 0.15rem; -} - -.layout-mask { - z-index: 9998; - width: 100%; - height: 100%; - position: fixed; - top: 100px; - left: 0; - display: none; - background-color: #4c5254; - opacity: .7; -} - -.content-section { - display: block; - border-bottom: solid 1px #dde3e6; - padding: 30px; - overflow: hidden; - background-color: #f5f7f8; -} - -.content-section.introduction { - background-image: linear-gradient(to left, #2bc0ec, #1b81d7); - color: #ffffff; -} - -.content-section.introduction a { - color: #ffffff; - font-weight: 700; -} - -.content-section:first-of-type>div>span { - line-height: 1.5em; -} - -.content-section h2 { - margin-top: 0; -} - -.feature-title { - font-size: 30px; - margin-bottom: 20px; - display: block; -} - -#layout-footer { - color: #6d6d81; - height: 0.4rem; - background: #333; - display: flex; - justify-content: center; - align-items: center; -} - -#layout-footer .footer-text { - display: inline-block; - line-height: 0.2rem; - font-size: 0.12rem; -} - - -/* Demos */ - -.implementation { - background-color: #FFFFFF; - overflow: visible; -} - -.implementation>h3 { - margin-top: 30px; - color: #5C666A; -} - -.implementation h3.first { - margin-top: 0px !important; -} - -.implementation h4 { - color: #5C666A; -} - -.content-submenu { - background-image: linear-gradient(to left, #20272a, #20272a); - padding: 15px 30px; - border-bottom: 1px solid #1b81d7; -} - -.content-submenu ul { - margin: 0; - padding: 0; - width: 100%; -} - -.content-submenu ul li { - list-style: none; - width: 20%; - float: left; - margin-top: 5px; -} - -.content-submenu ul li a { - color: #cac6c6; - display: block; - width: 90%; - border: 1px solid transparent; - transition: border-color .1s; - padding: 6px 12px; - border-radius: 3px; -} - -.content-submenu ul li a:hover { - border: 1px solid #ffffff; - color: #ffffff; -} - - -/* Documentation Section */ - -.documentation .ui-tabview-panel { - color: #404C51 !important; -} - -.documentation h3 { - margin-top: 25px; - margin-bottom: 0px; - font-size: 24px; - font-weight: normal; -} - -.documentation h4 { - margin-top: 25px; - margin-bottom: 0px; - font-size: 20px; - font-weight: normal; -} - -.documentation p { - font-size: 16px; - line-height: 24px; - margin: 10px 0; - opacity: .90; -} - -.documentation .doc-tablewrapper { - margin: 10px 0; -} - -.documentation a { - color: #0273D4; -} - -.documentation .btn-viewsource { - background-color: #444444; - padding: .5em; - border-radius: 2px; - color: #ffffff; - font-weight: bold; - margin-bottom: 1em; - display: inline-block; - transition: background-color .3s; -} - -.documentation .btn-viewsource i { - margin-right: .25em; -} - -.documentation .btn-viewsource:hover { - background-color: #595959; -} - - -/* Tabs Source */ - -.documentation .ui-tabview { - background: none; - border: 0 none; - color: #5C666A; - font-weight: lighter; - -moz-border-radius: 4px !important; - -webkit-border-radius: 4px !important; - border-radius: 4px !important; -} - -.documentation .ui-tabview .ui-tabview-nav { - background: #1976D2 !important; - ; - margin-bottom: -1px; - padding: 3px 3px 0px 3px !important; - border-top-right-radius: 4px !important; - border-top-left-radius: 4px !important; - border-bottom-right-radius: 0px; - border-bottom-left-radius: 0px; -} - -.documentation .ui-tabview .ui-tabview-nav li, -.documentation .ui-tabview .ui-tabview-nav li.ui-state-hover { - border: 0px none !important; - background: #3F94E9 !important; - ; - border-color: #3F94E9 !important; - ; - box-shadow: none !important; - border-top-right-radius: 4px !important; - border-top-left-radius: 4px !important; -} - -.documentation .ui-tabview .ui-tabview-nav li a { - padding: .5em 1em !important; -} - -.documentation .ui-tabview .ui-tabview-nav li.tab-doc { - margin-right: 0; -} - -.documentation .ui-tabview .ui-tabview-nav li.ui-state-default a { - color: #fff !important; - font-weight: normal !important; - text-shadow: none; -} - -.documentation .ui-tabview .ui-tabview-nav li.ui-state-active a { - color: #5C666A !important; - font-weight: normal !important; -} - -.documentation .ui-tabview .ui-tabview-nav li.ui-state-hover { - box-shadow: none !important; - ; -} - -.documentation .ui-tabview .ui-tabview-nav li.ui-tabview-selected { - background: #F5F6F7 !important; -} - -.documentation .ui-tabview .ui-tabview-panels { - border-top: 1px solid #F5F6F7 !important; - ; - color: #5C666A !important; - background: #F5F6F7; -} - -.documentation .ui-tabview.ui-tabview-top>.ui-tabview-nav li { - top: 0px !important; -} - - -/* Docs Table */ - -.doc-table { - border-collapse: collapse; - width: 100%; -} - -.doc-table th { - background-color: #dae8ef; - color: #404C51; - border: solid 1px #C1D5DF; - padding: 5px; - font-size: 16px; - text-align: left; -} - -.doc-table tbody td { - color: #404C51; - padding: 4px 10px; - border: 1px solid #E5EBF0; - font-size: 15px; - opacity: .90; -} - -.doc-table tbody tr:nth-child(even) { - background-color: #FBFCFD; -} - -.doc-table tbody tr:nth-child(odd) { - background-color: #F3F6F9; -} - -@media screen and (max-width: 64em) { - .layout-mask { - display: block; - } - #layout-topbar { - text-align: center; - } - #layout-topbar .menu-button { - display: inline-block; - } - #layout-topbar .logo { - margin: 7px 0 7px 0; - } - .topbar-menu { - background-color: #363c3f; - float: none; - width: 100%; - height: 40px; - margin: 0; - text-align: center; - } - .topbar-menu>li>a { - padding-bottom: 0; - line-height: 40px; - min-width: 100px; - } - .topbar-menu>li.topbar-menu-themes>ul { - top: 40px; - } - #layout-sidebar { - top: 100px; - left: -300px; - transition: left .3s; - z-index: 9999; - } - #layout-sidebar.active { - left: 0; - } - #layout-content { - margin-left: 0; - padding-top: 100px; - } - .topbar-menu>li.topbar-menu-themes>ul { - text-align: left; - } - .home .introduction>div { - width: 100%; - } - .home .features>div { - width: 100%; - } - .home .whouses>div { - width: 100%; - } - .home .templates>div { - width: 100%; - } - .home .prosupport>div { - width: 100%; - text-align: center; - } - .home .book>div { - width: 100%; - } - .home .book .ui-g-12:last-child, - .home .book .ui-g-12:first-child { - text-align: center !important; - } - .home .testimonials>div { - width: 100%; - } - .support .support-image { - text-align: center; - } - .support .support-image .ui-md-6:last-child { - text-align: center; - padding-top: 2em; - } - .content-submenu ul li { - width: 50%; - } -} - -@media (max-width: 768px) { - .doc-table tbody td { - word-break: break-word; - } -} - - -/* Code Styles */ - -pre { - white-space: pre-wrap; - white-space: -moz-pre-wrap; - white-space: -o-pre-wrap; - word-wrap: break-word; - font-family: Courier, 'New Courier', monospace; - font-size: 14px; - border-radius: 5px; - -moz-border-radius: 5px; - -webkit-border-radius: 5px; - padding: 1em; - background-color: #CFD8DC; - color: #404C51; - margin: 10px 0px; -} - -.ui-tabview-left>.ui-tabview-nav { - height: 150px; -} - -.col-button { - width: 10%; - text-align: center; -} - -.whouses { - background: #ffffff; -} - -.whouses img { - width: 100%; -} - -.ui-growl { - top: 100px; -} - -a { - text-decoration: none; - color: #1b82d7; -} - - -/* Animation */ - -@-webkit-keyframes fadeInDown { - from { - opacity: 0; - -webkit-transform: translate3d(0, -20px, 0); - transform: translate3d(0, -20px, 0); - } - to { - opacity: 1; - -webkit-transform: none; - transform: none; - } -} - -@keyframes fadeInDown { - from { - opacity: 0; - transform: translate3d(0, -20px, 0); - } - to { - opacity: 1; - transform: none; - } -} - -@-webkit-keyframes fadeOutUp { - from { - opacity: 1; - } - to { - opacity: 0; - -webkit-transform: translate3d(0, -20px, 0); - transform: translate3d(0, -20px, 0); - } -} - -@keyframes fadeOutUp { - from { - opacity: 1; - } - to { - opacity: 0; - -webkit-transform: translate3d(0, -20px, 0); - transform: translate3d(0, -20px, 0); - } -} - - -/* Introduction */ - -.home p { - line-height: 1.5; -} - -.home h3 { - font-size: 1.5em; -} - -.home-button { - font-weight: bold; - background-color: #FBD17B; - color: #B27800; - padding: 8px 14px; - border-radius: 3px; - transition: background-color .3s; - display: inline-block; - min-width: 120px; - text-align: center; -} - -.home-button:hover { - background-color: #f9c55a; -} - -.home .introduction { - background-color: #1976d2; - background-repeat: no-repeat; - background-size: cover; - color: #ffffff; - padding: 80px 30px 80px 50px; -} - -.home .introduction>div { - padding: 100px 100px 0 100px; - height: 200px; -} - -.home .introduction img { - width: 480px; - position: absolute; - bottom: 0; - right: 0; -} - -.home .introduction h1 { - font-weight: normal; - margin-bottom: 5px; -} - -.home .introduction h2 { - font-weight: bold; - margin-bottom: 40px; - margin-top: 0; -} - - -/* Features */ - -.home .features { - background-color: #f5f7f8; - text-align: center; - padding: 30px; -} - -.home .features h3 { - margin-bottom: 10px; -} - -.home .features p { - margin-bottom: 30px; -} - -.home .features p.features-tagline { - margin-bottom: 0; - margin-top: -5px; -} - -.home .features p.features-description { - text-align: left; -} - -.home .features .feature-name { - display: block; - font-size: 18px; - margin-top: 4px; -} - -.home .features .ui-g p { - color: #535d62; - font-size: 14px; - margin-bottom: 30px; -} - -.home .features .ui-g>div { - padding: .5em 2em; -} - -.home .features img { - width: 57px; -} - - -/* block: volume css start */ - -.volume-item { - padding: 1em 0; -} - -.item-flex { - display: flex; - align-items: center; -} - -.item-flex-justify { - justify-content: center; -} - -.margin-between-img-text { - margin-left: 0.5em; -} - -.second-content-header { - font-size: 0.16rem; - color: #2e3039; - margin: 1em 0; -} - -.bottom-button-margin { - margin: 2em 0; -} - -.text-align-center { - text-align: center; -} - -.replication-item-border { - border-top: 1px dotted map-get($widget-border, hover); -} - -.replication-img-item-padding { - padding: .25em 0; -} - -.position-relative { - position: relative; -} - -.replication-img-item-height { - height: 120px; -} - -.replication-img-item-padding img { - position: absolute; - top: 50%; - left: -75px; -} - -.replication-img-item1 { - padding: 1em 0; - position: relative; -} - -.replication-img-item1-div { - height: 40px; -} - -.replication-img-item1-div img { - position: absolute; - top: 50%; -} - -.item-content-backgroud { - padding: 1em !important; - border-radius: 10px; - background-color: rgba(243, 246, 247, 1); -} - -.volume-basic-info { - background: #f3f6f7; - margin-bottom: .3rem; - padding: .2rem; - border-radius: 12px; -} - -.volume-basic-info h3 { - padding: 0 .08rem .2rem; -} -.volume-basic-info p { - padding: 0 .08rem .1rem; -} - -.volume-basic-item-class { - padding: 0.5em 0; -} - -.volume-basic-item-value-color { - color: #2E3039 !important; -} - - -/* block: volume css end */ - - -/* profile css start */ - -.relative-class { - padding-right: 0.40rem; - position: relative; -} - -.create-profile-form { - line-height: .32rem; - .profile-form-padding { - padding: .05rem 0; - & > div:first-of-type { - &::before { - content: "*"; - display: inline; - color: transparent; - padding-right: 0; - margin-left: -0.09rem; - } - &.required::before { - color: #cd0a0a; - } - } - .radio-groups > span { - padding-right: .30rem; - } - } - .form-submit-button { - padding: .30rem 0 .10rem; - } - .secondary-form { - padding: 15px 30px; - background: #f3f6f7; - border-radius: 12px; - } -} - -.profile-form-padding { - padding: .05rem 0; -} - -.create-profile-img { - cursor: pointer; -} - -.customization-item { - min-width: 46%; - margin: 0 0.5em; - overflow: hidden; -} - -.customization-container { - min-width: 30%; - max-width: 100%; - padding: 1em 2em !important; - background-color: rgba(243, 246, 247, 1); - border-radius: 10px; - display: flex; -} - -.ui-inputgroup .ui-inputtext:not(:first-child) { - border-left: 1px solid #cfd7db; -} - -.ui-inputgroup .ui-inputtext:enabled:hover { - border-color: #98a5bc; -} - -.input-text-vertical-align { - display: flex; - justify-content: flex-start; - align-items: center; -} - -.input-text-vertical-align span, -.execution-time-add { - padding: 0 0.5em; -} - -.execution-time-add { - cursor: pointer; -} - -.modify-profile-item { - margin-top: 0.5em; -} - -.margin-right-class { - margin-right: 0.5em; -} - -.suspension-frame-content h3 { - color: #fff; -} - -.font-primary { - color: #434B52; - h2 { - padding-bottom: .10rem; - } -} - -.padding-class { - min-width: 300px; - &:last-of-type { - padding-top: .10rem; - } -} - -.icon-color-class { - font-size: $fontSize; - color: map-get($color-primary, normal); - background: rgba(101, 125, 149, 0.149019607843137); - padding: 5px 10px; - border-radius: 10px; -} - -.font-color-class { - color: map-get($color-text, primary); -} - -.label-class { - color: #B9C3C8; -} - -.storage-count-capacity { - font-size: .2rem; - color: #438bd3 !important; - padding-right: 0.05rem; -} - -.suspension-frame-container { - position: absolute; - width: 200%; - top: -0.1rem; - left: -5px; - margin-left: 50%; - transform: translate(-50%, -100%); - z-index: 9999; -} - -.suspension-frame-content { - position: relative; - background-color: #242e43; - border-radius: 4px; -} - -.suspension-frame-content>div { - padding: 1em; -} - -.suspension-frame-content::after { - content: ''; - width: 0; - height: 0; - border-top: 6px solid #242e43; - border-left: 6px solid transparent; - border-bottom: 6px solid transparent; - border-right: 6px solid transparent; - position: absolute; - left: 50%; - margin-left: -6px; -} - -.mouse-cursor { - cursor: pointer; -} - - -/* profile css end */ - - -/* Who Uses */ - -.home .whouses { - background-color: #20272a; - color: #ffffff; - text-align: center; - padding: 30px; -} - -.home .whouses h3 { - margin-bottom: 10px; -} - -.home .whouses p { - margin-bottom: 30px; -} - -.home .whouses .ui-g>div { - padding: 1em 2em; -} - -.home .whouses img { - height: 42px; -} - -.home .testimonials { - border-top: 1px solid #4c5254; - padding-top: 20px; - margin-top: 30px; -} - -.home .testimonials .ui-g>div { - margin-left: -1px; - margin-top: -1px; - border: 1px solid #333D41; -} - -.home .testimonials .ui-g>div:nth-child(2n) { - background-color: #283134; -} - -.home .testimonials p { - font-size: 14px; - line-height: 1.5; - font-style: italic; -} - -.home .testimonials h3 { - margin-bottom: 26px; -} - -.home .testimonials img { - padding-top: 10px; -} - -.home .testimonials hr { - width: 40px; - color: #4c5254; -} - -.home .testimonials i { - font-style: normal; -} - - -/* Book */ - -.home .book { - background-color: #1976d2; - padding: 30px; - box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.3); - color: #ffffff; -} - -.home .book .ui-g-12:last-child { - text-align: center; -} - -.home .book .ui-g-12:first-child { - text-align: left; -} - -.home .book img { - width: 200px; - -webkit-box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5); - -moz-box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5); - box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5); -} - - -/* Templates */ - -.home .templates { - background-color: #f5f7f8; - text-align: center; - padding: 30px; -} - -.home .templates h3 { - margin-bottom: 10px; -} - -.home .templates img { - width: 100%; -} - -.home .templates .ui-g>div { - padding: 1em; -} - -.home .templates .ui-g>div img { - box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.3); - transition: all .5s; -} - -.home .templates .ui-g>div a:hover img { - -webkit-transform: scale(1.05); - -moz-transform: scale(1.05); - -o-transform: scale(1.05); - -ms-transform: scale(1.05); - transform: scale(1.05); -} - -.home .why-templates { - background-color: #20272a; - text-align: center; - color: #ffffff; - padding: 30px; -} - -.home .why-templates h3 { - margin: 10px 0; - display: block; -} - -.home .why-templates hr { - border: 1px dotted solid #262626; - margin-bottom: 20px; -} - -.home .why-templates img { - width: 100%; -} - -.home .why-templates .ui-g>div { - padding: .5em 1em; -} - -.home .why-templates ul { - padding: 0; - margin: 0; - text-align: left; - list-style-type: none; -} - -.home .why-templates ul>li { - padding-bottom: 10px; - text-align: left; - text-align: center; -} - - -/* PRO */ - -.home .prosupport, -.support-image { - background-color: #20272a; - padding: 30px; - color: #ffffff; -} - -.support-image .ui-md-6:last-child { - text-align: right; -} - -.support li { - line-height: 1.5; -} - -.home .prosupport p { - font-size: 14px; - line-height: 1.5; -} - -.home .prosupport .ui-md-6:last-child { - text-align: center; -} - -.home .prosupport .home-button { - margin-top: 10px; -} - -.support p { - line-height: 1.5; -} - - -/* NGCONF */ - -.home .ngconf, -.ngconf-image { - background-color: rgba(79, 41, 64, .8); - padding: 30px; - color: #ffffff; -} - -.ngconf-image .ui-md-6:last-child { - text-align: right; -} - -.ngconf li { - line-height: 1.5; -} - -.home .ngconf p { - font-size: 14px; - line-height: 1.5; -} - -.home .ngconf .ui-md-6:last-child { - text-align: center; -} - -.home .ngconf .home-button { - margin-top: 10px; -} - -.ngconf p { - line-height: 1.5; -} - - -/*NOTIFICATION*/ - -.notification-topbar { - width: 100%; - height: 150px; - cursor: pointer; - position: relative; - display: block; - -webkit-animation-duration: 1.5s; - -moz-animation-duration: 1.5s; - animation-duration: 1.5s; - -webkit-animation-fill-mode: both; - animation-fill-mode: both; -} - -.notification-topbar .notification-topbar-image { - background-position: center; - background-repeat: no-repeat; - background-size: cover; - height: 100%; - position: absolute; - float: left; -} - -.notification-topbar .notification-topbar-close { - position: absolute; - top: 15px; - right: 15px; - color: white; -} - -.notification-topbar .notification-topbar-image-mobile { - width: 100%; - top: 45px; - display: none; - position: absolute; - float: left; -} - -@media (max-width: 450px) { - .notification-topbar .notification-topbar-image { - display: none; - } - .notification-topbar .notification-topbar-image-mobile { - display: block; - } -} - - -/* custom breadcrumb start */ - -.custom-breadcrumb { - padding: 0 0 0.3rem; -} - -.custom-breadcrumb a { - color: map-get($color-text, primary) !important; -} - -.custom-breadcrumb .font-color-class { - color: #478CD0 !important; -} -.create-profile-snap-policy{ - margin-top: 2px; -} -.create-profile-snap-col-6{ - width:50% -} -.create-profile-snap-col-8{ - width:66.66666%; -} -.a-rep-disabled{ - pointer-events:none; - cursor:default; - opacity:0.5 -} -.line-arrow-right{ - width:200px; - height:4px; - font-size: 0; - text-align: right; - background-color:#ccc; - margin: auto; - margin-top: 10px; -} -.line-arrow-right::before{ - content: ''; - font-size:0; - position: relative; - width: 0; - height: 0; - border: 8px solid transparent; - border-left-color: #ccc; - right: -16px; top: 2px; -} -.line-arrow-right.enabled{ - background-color: #438bd3; -} -.line-arrow-right.enabled::before{ - border-left-color: #438bd3; -} - -/* custom breadcrumb end */ diff --git a/dashboard/src/assets/business/favicon/favicon.ico b/dashboard/src/assets/business/favicon/favicon.ico deleted file mode 100644 index fee6aea0d..000000000 Binary files a/dashboard/src/assets/business/favicon/favicon.ico and /dev/null differ diff --git a/dashboard/src/assets/business/fonts/roboto-v15-latin-regular.eot b/dashboard/src/assets/business/fonts/roboto-v15-latin-regular.eot deleted file mode 100644 index d26bc8f51..000000000 Binary files a/dashboard/src/assets/business/fonts/roboto-v15-latin-regular.eot and /dev/null differ diff --git a/dashboard/src/assets/business/fonts/roboto-v15-latin-regular.svg b/dashboard/src/assets/business/fonts/roboto-v15-latin-regular.svg deleted file mode 100644 index ed55c105d..000000000 --- a/dashboard/src/assets/business/fonts/roboto-v15-latin-regular.svg +++ /dev/null @@ -1,308 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dashboard/src/assets/business/fonts/roboto-v15-latin-regular.ttf b/dashboard/src/assets/business/fonts/roboto-v15-latin-regular.ttf deleted file mode 100644 index 7b25f3ce9..000000000 Binary files a/dashboard/src/assets/business/fonts/roboto-v15-latin-regular.ttf and /dev/null differ diff --git a/dashboard/src/assets/business/fonts/roboto-v15-latin-regular.woff b/dashboard/src/assets/business/fonts/roboto-v15-latin-regular.woff deleted file mode 100644 index 941dfa4ba..000000000 Binary files a/dashboard/src/assets/business/fonts/roboto-v15-latin-regular.woff and /dev/null differ diff --git a/dashboard/src/assets/business/fonts/roboto-v15-latin-regular.woff2 b/dashboard/src/assets/business/fonts/roboto-v15-latin-regular.woff2 deleted file mode 100644 index 120796bb7..000000000 Binary files a/dashboard/src/assets/business/fonts/roboto-v15-latin-regular.woff2 and /dev/null differ diff --git a/dashboard/src/assets/business/images/cloud_service/AWS S3.png b/dashboard/src/assets/business/images/cloud_service/AWS S3.png deleted file mode 100644 index a98735d08..000000000 Binary files a/dashboard/src/assets/business/images/cloud_service/AWS S3.png and /dev/null differ diff --git a/dashboard/src/assets/business/images/cloud_service/Huawei OBS.png b/dashboard/src/assets/business/images/cloud_service/Huawei OBS.png deleted file mode 100644 index f44c58a86..000000000 Binary files a/dashboard/src/assets/business/images/cloud_service/Huawei OBS.png and /dev/null differ diff --git a/dashboard/src/assets/business/images/cloud_service/Microsoft Azure Blob Storage.png b/dashboard/src/assets/business/images/cloud_service/Microsoft Azure Blob Storage.png deleted file mode 100644 index 62caac4fa..000000000 Binary files a/dashboard/src/assets/business/images/cloud_service/Microsoft Azure Blob Storage.png and /dev/null differ diff --git a/dashboard/src/assets/business/images/cloud_service/u2309.png b/dashboard/src/assets/business/images/cloud_service/u2309.png deleted file mode 100644 index 04c81c906..000000000 Binary files a/dashboard/src/assets/business/images/cloud_service/u2309.png and /dev/null differ diff --git a/dashboard/src/assets/business/images/home_admin/Block Storages.png b/dashboard/src/assets/business/images/home_admin/Block Storages.png deleted file mode 100644 index ae6b0e305..000000000 Binary files a/dashboard/src/assets/business/images/home_admin/Block Storages.png and /dev/null differ diff --git a/dashboard/src/assets/business/images/home_admin/Cross-Region Migrations.png b/dashboard/src/assets/business/images/home_admin/Cross-Region Migrations.png deleted file mode 100644 index 13403ec73..000000000 Binary files a/dashboard/src/assets/business/images/home_admin/Cross-Region Migrations.png and /dev/null differ diff --git a/dashboard/src/assets/business/images/home_admin/Cross-Region Replications.png b/dashboard/src/assets/business/images/home_admin/Cross-Region Replications.png deleted file mode 100644 index c87c216b1..000000000 Binary files a/dashboard/src/assets/business/images/home_admin/Cross-Region Replications.png and /dev/null differ diff --git a/dashboard/src/assets/business/images/home_admin/Storage Pools.png b/dashboard/src/assets/business/images/home_admin/Storage Pools.png deleted file mode 100644 index 06b1b3520..000000000 Binary files a/dashboard/src/assets/business/images/home_admin/Storage Pools.png and /dev/null differ diff --git a/dashboard/src/assets/business/images/home_admin/Tenants.png b/dashboard/src/assets/business/images/home_admin/Tenants.png deleted file mode 100644 index 091a075c0..000000000 Binary files a/dashboard/src/assets/business/images/home_admin/Tenants.png and /dev/null differ diff --git a/dashboard/src/assets/business/images/home_admin/Users.png b/dashboard/src/assets/business/images/home_admin/Users.png deleted file mode 100644 index ed6afcf9c..000000000 Binary files a/dashboard/src/assets/business/images/home_admin/Users.png and /dev/null differ diff --git a/dashboard/src/assets/business/images/home_admin/Volume Replications.png b/dashboard/src/assets/business/images/home_admin/Volume Replications.png deleted file mode 100644 index 6fd7542a9..000000000 Binary files a/dashboard/src/assets/business/images/home_admin/Volume Replications.png and /dev/null differ diff --git a/dashboard/src/assets/business/images/home_admin/Volume Snapshots.png b/dashboard/src/assets/business/images/home_admin/Volume Snapshots.png deleted file mode 100644 index 31b0ead9c..000000000 Binary files a/dashboard/src/assets/business/images/home_admin/Volume Snapshots.png and /dev/null differ diff --git a/dashboard/src/assets/business/images/home_admin/Volumes.png b/dashboard/src/assets/business/images/home_admin/Volumes.png deleted file mode 100644 index f5d363213..000000000 Binary files a/dashboard/src/assets/business/images/home_admin/Volumes.png and /dev/null differ diff --git a/dashboard/src/assets/business/images/home_admin/u199.png b/dashboard/src/assets/business/images/home_admin/u199.png deleted file mode 100644 index f2728844d..000000000 Binary files a/dashboard/src/assets/business/images/home_admin/u199.png and /dev/null differ diff --git a/dashboard/src/assets/business/images/home_admin/u236.png b/dashboard/src/assets/business/images/home_admin/u236.png deleted file mode 100644 index 0c54aa149..000000000 Binary files a/dashboard/src/assets/business/images/home_admin/u236.png and /dev/null differ diff --git a/dashboard/src/assets/business/images/icons/button-active.svg b/dashboard/src/assets/business/images/icons/button-active.svg deleted file mode 100644 index 179a25ba3..000000000 --- a/dashboard/src/assets/business/images/icons/button-active.svg +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - diff --git a/dashboard/src/assets/business/images/icons/button.svg b/dashboard/src/assets/business/images/icons/button.svg deleted file mode 100644 index 699c492e8..000000000 --- a/dashboard/src/assets/business/images/icons/button.svg +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - diff --git a/dashboard/src/assets/business/images/icons/charts-active.svg b/dashboard/src/assets/business/images/icons/charts-active.svg deleted file mode 100644 index ee34b6061..000000000 --- a/dashboard/src/assets/business/images/icons/charts-active.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/dashboard/src/assets/business/images/icons/charts.svg b/dashboard/src/assets/business/images/icons/charts.svg deleted file mode 100644 index 0e98eafd1..000000000 --- a/dashboard/src/assets/business/images/icons/charts.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/dashboard/src/assets/business/images/icons/data-active.svg b/dashboard/src/assets/business/images/icons/data-active.svg deleted file mode 100644 index ea319ce5e..000000000 --- a/dashboard/src/assets/business/images/icons/data-active.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - diff --git a/dashboard/src/assets/business/images/icons/data.svg b/dashboard/src/assets/business/images/icons/data.svg deleted file mode 100644 index 625502ca7..000000000 --- a/dashboard/src/assets/business/images/icons/data.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - diff --git a/dashboard/src/assets/business/images/icons/dragdrop-active.svg b/dashboard/src/assets/business/images/icons/dragdrop-active.svg deleted file mode 100644 index dfd016bc9..000000000 --- a/dashboard/src/assets/business/images/icons/dragdrop-active.svg +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - - - - diff --git a/dashboard/src/assets/business/images/icons/dragdrop.svg b/dashboard/src/assets/business/images/icons/dragdrop.svg deleted file mode 100644 index 45b0aa2d4..000000000 --- a/dashboard/src/assets/business/images/icons/dragdrop.svg +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - - - - diff --git a/dashboard/src/assets/business/images/icons/file-active.svg b/dashboard/src/assets/business/images/icons/file-active.svg deleted file mode 100644 index 05d3423d5..000000000 --- a/dashboard/src/assets/business/images/icons/file-active.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - diff --git a/dashboard/src/assets/business/images/icons/file.svg b/dashboard/src/assets/business/images/icons/file.svg deleted file mode 100644 index a8735eb1d..000000000 --- a/dashboard/src/assets/business/images/icons/file.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - diff --git a/dashboard/src/assets/business/images/icons/input-active.svg b/dashboard/src/assets/business/images/icons/input-active.svg deleted file mode 100644 index 7aae76f52..000000000 --- a/dashboard/src/assets/business/images/icons/input-active.svg +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - diff --git a/dashboard/src/assets/business/images/icons/input.svg b/dashboard/src/assets/business/images/icons/input.svg deleted file mode 100644 index 17193c3b0..000000000 --- a/dashboard/src/assets/business/images/icons/input.svg +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - diff --git a/dashboard/src/assets/business/images/icons/menu-active.svg b/dashboard/src/assets/business/images/icons/menu-active.svg deleted file mode 100644 index cbb4412dc..000000000 --- a/dashboard/src/assets/business/images/icons/menu-active.svg +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - diff --git a/dashboard/src/assets/business/images/icons/menu.svg b/dashboard/src/assets/business/images/icons/menu.svg deleted file mode 100644 index 0a72b4528..000000000 --- a/dashboard/src/assets/business/images/icons/menu.svg +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - diff --git a/dashboard/src/assets/business/images/icons/message-active.svg b/dashboard/src/assets/business/images/icons/message-active.svg deleted file mode 100644 index 1b1ce469f..000000000 --- a/dashboard/src/assets/business/images/icons/message-active.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - diff --git a/dashboard/src/assets/business/images/icons/message.svg b/dashboard/src/assets/business/images/icons/message.svg deleted file mode 100644 index 48c7029ec..000000000 --- a/dashboard/src/assets/business/images/icons/message.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - diff --git a/dashboard/src/assets/business/images/icons/misc-active.svg b/dashboard/src/assets/business/images/icons/misc-active.svg deleted file mode 100644 index 99f37dd2e..000000000 --- a/dashboard/src/assets/business/images/icons/misc-active.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - diff --git a/dashboard/src/assets/business/images/icons/misc.svg b/dashboard/src/assets/business/images/icons/misc.svg deleted file mode 100644 index aed6a1f1a..000000000 --- a/dashboard/src/assets/business/images/icons/misc.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - diff --git a/dashboard/src/assets/business/images/icons/multimedia-active.svg b/dashboard/src/assets/business/images/icons/multimedia-active.svg deleted file mode 100644 index ec9b166f2..000000000 --- a/dashboard/src/assets/business/images/icons/multimedia-active.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - diff --git a/dashboard/src/assets/business/images/icons/multimedia.svg b/dashboard/src/assets/business/images/icons/multimedia.svg deleted file mode 100644 index d7df87d84..000000000 --- a/dashboard/src/assets/business/images/icons/multimedia.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - diff --git a/dashboard/src/assets/business/images/icons/overlay-active.svg b/dashboard/src/assets/business/images/icons/overlay-active.svg deleted file mode 100644 index a856e158b..000000000 --- a/dashboard/src/assets/business/images/icons/overlay-active.svg +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - diff --git a/dashboard/src/assets/business/images/icons/overlay.svg b/dashboard/src/assets/business/images/icons/overlay.svg deleted file mode 100644 index 47dda994d..000000000 --- a/dashboard/src/assets/business/images/icons/overlay.svg +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - diff --git a/dashboard/src/assets/business/images/icons/panel-active.svg b/dashboard/src/assets/business/images/icons/panel-active.svg deleted file mode 100644 index 0495bc992..000000000 --- a/dashboard/src/assets/business/images/icons/panel-active.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - diff --git a/dashboard/src/assets/business/images/icons/panel.svg b/dashboard/src/assets/business/images/icons/panel.svg deleted file mode 100644 index 785cd112f..000000000 --- a/dashboard/src/assets/business/images/icons/panel.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - diff --git a/dashboard/src/assets/business/images/login-bg.png b/dashboard/src/assets/business/images/login-bg.png deleted file mode 100644 index 134c2bc8a..000000000 Binary files a/dashboard/src/assets/business/images/login-bg.png and /dev/null differ diff --git a/dashboard/src/assets/business/images/logo-white.png b/dashboard/src/assets/business/images/logo-white.png deleted file mode 100644 index 5e3c1caf9..000000000 Binary files a/dashboard/src/assets/business/images/logo-white.png and /dev/null differ diff --git a/dashboard/src/assets/business/images/logo.png b/dashboard/src/assets/business/images/logo.png deleted file mode 100644 index a97090247..000000000 Binary files a/dashboard/src/assets/business/images/logo.png and /dev/null differ diff --git a/dashboard/src/assets/business/images/menu-bg.png b/dashboard/src/assets/business/images/menu-bg.png deleted file mode 100644 index 0f5612af3..000000000 Binary files a/dashboard/src/assets/business/images/menu-bg.png and /dev/null differ diff --git a/dashboard/src/assets/business/images/profile/u1065.png b/dashboard/src/assets/business/images/profile/u1065.png deleted file mode 100644 index e589739d3..000000000 Binary files a/dashboard/src/assets/business/images/profile/u1065.png and /dev/null differ diff --git a/dashboard/src/assets/business/images/profile/u1985.png b/dashboard/src/assets/business/images/profile/u1985.png deleted file mode 100644 index 8b5e8e597..000000000 Binary files a/dashboard/src/assets/business/images/profile/u1985.png and /dev/null differ diff --git a/dashboard/src/assets/business/images/profile/u2861.png b/dashboard/src/assets/business/images/profile/u2861.png deleted file mode 100644 index 600e1565b..000000000 Binary files a/dashboard/src/assets/business/images/profile/u2861.png and /dev/null differ diff --git a/dashboard/src/assets/business/images/profile/u2987.png b/dashboard/src/assets/business/images/profile/u2987.png deleted file mode 100644 index bb832ed59..000000000 Binary files a/dashboard/src/assets/business/images/profile/u2987.png and /dev/null differ diff --git a/dashboard/src/assets/business/images/volume/u436.png b/dashboard/src/assets/business/images/volume/u436.png deleted file mode 100644 index 02dfd3ffb..000000000 Binary files a/dashboard/src/assets/business/images/volume/u436.png and /dev/null differ diff --git a/dashboard/src/assets/business/images/volume/u583.png b/dashboard/src/assets/business/images/volume/u583.png deleted file mode 100644 index 3e75fd5c3..000000000 Binary files a/dashboard/src/assets/business/images/volume/u583.png and /dev/null differ diff --git a/dashboard/src/assets/business/images/volume/u585.png b/dashboard/src/assets/business/images/volume/u585.png deleted file mode 100644 index 0e5ed3f01..000000000 Binary files a/dashboard/src/assets/business/images/volume/u585.png and /dev/null differ diff --git a/dashboard/src/assets/business/images/volume/u740p000.png b/dashboard/src/assets/business/images/volume/u740p000.png deleted file mode 100644 index 862ca636b..000000000 Binary files a/dashboard/src/assets/business/images/volume/u740p000.png and /dev/null differ diff --git a/dashboard/src/assets/business/images/volume/u740p002.png b/dashboard/src/assets/business/images/volume/u740p002.png deleted file mode 100644 index 433794bc1..000000000 Binary files a/dashboard/src/assets/business/images/volume/u740p002.png and /dev/null differ diff --git a/dashboard/src/assets/business/images/volume/u760p000.png b/dashboard/src/assets/business/images/volume/u760p000.png deleted file mode 100644 index 6d82d4d40..000000000 Binary files a/dashboard/src/assets/business/images/volume/u760p000.png and /dev/null differ diff --git a/dashboard/src/assets/business/images/volume/u937.png b/dashboard/src/assets/business/images/volume/u937.png deleted file mode 100644 index 61dee4c36..000000000 Binary files a/dashboard/src/assets/business/images/volume/u937.png and /dev/null differ diff --git a/dashboard/src/assets/components/images/line.gif b/dashboard/src/assets/components/images/line.gif deleted file mode 100644 index 64e2280ec..000000000 Binary files a/dashboard/src/assets/components/images/line.gif and /dev/null differ diff --git a/dashboard/src/assets/components/images/loading.gif b/dashboard/src/assets/components/images/loading.gif deleted file mode 100644 index 19c67bbd0..000000000 Binary files a/dashboard/src/assets/components/images/loading.gif and /dev/null differ diff --git a/dashboard/src/assets/components/images/password-meter.png b/dashboard/src/assets/components/images/password-meter.png deleted file mode 100644 index eec05cfb4..000000000 Binary files a/dashboard/src/assets/components/images/password-meter.png and /dev/null differ diff --git a/dashboard/src/assets/components/themes/_theme.scss b/dashboard/src/assets/components/themes/_theme.scss deleted file mode 100644 index cb06cdeb7..000000000 --- a/dashboard/src/assets/components/themes/_theme.scss +++ /dev/null @@ -1,712 +0,0 @@ -@mixin hover-element() { - border-color: $stateHoverBorderColor; - background: $stateHoverBgColor; - color: $stateHoverTextColor; - - a { - color: $stateHoverTextColor; - } -} - -@mixin icon-override($icon) { - background: none !important; - display: inline-block; - font: normal normal normal 14px/1 FontAwesome; - font-size: inherit; - text-rendering: auto; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - text-indent: 0px !important; - text-align: center; - - &:before { - content: $icon; - } -} - -.ui-widget { - font-family: $fontFamily; - font-size: $fontSize; - - input, select, textarea, button { - font-family: $fontFamily; - font-size: $fontSize; - } - - :active { - outline: none; - } -} - -.ui-widget-content { - border: $contentBorderWidth solid $contentBorderColor; - background: $contentBgColor; - color: $contentTextColor; - - a { - color: $contentTextColor; - } -} - -.ui-widget-header { - border: $headerBorderWidth solid $headerBorderColor; - background: $headerBgColor; - color: $headerTextColor; - font-weight: $headerFontWeight; - - a { - color: $headerTextColor; - } -} - -.ui-widget-overlay { - background: #010610; - opacity: .35; - filter:Alpha(Opacity=50); -} - -.ui-state-default { - border: $stateDefaultBorderWidth solid $stateDefaultBorderColor; - background: $stateDefaultBgColor; - color: $stateDefaultTextColor; - - a { - color: $stateDefaultTextColor ; - } -} - -.ui-state-active { - border-color: $stateActiveBorderColor; - background: $stateActiveBgColor; - color: $stateActiveTextColor; - - a { - color: $stateActiveTextColor; - } -} - -.ui-state-highlight { - border-color: $stateHighlightBorderColor; - background: $stateHighlightBgColor; - color: $stateHighlightTextColor; - - a { - color: $stateHighlightTextColor; - } -} - -.ui-state-focus { - border-color: $stateFocusBorderColor; - background: $stateFocusBgColor; - color: $stateFocusTextColor; - - a { - color: $stateFocusTextColor; - } -} - -.ui-state-error { - border-color: $stateErrorBorderColor; - background: $stateErrorBgColor; - color: $stateErrorTextColor; - - a { - color: $stateErrorTextColor; - } -} - -.ui-state-disabled, -.ui-widget:disabled { - opacity: $disabledOpacity; - filter: Alpha(Opacity= $disabledOpacity * 100); - background-image: none; - cursor: default !important; - - * { - cursor: default !important; - } -} - -/* Forms */ -.ui-inputtext { - background: $inputBgColor; - color: $inputTextColor; -} - -.ui-inputtext:enabled:hover { - border-color: $stateHoverBorderColor; -} - -.ui-inputtext.ui-state-focus, -.ui-inputtext:focus { - outline: 0 none; - border-color: $stateFocusBorderColor; - -moz-box-shadow: 0px 0px 5px $stateFocusBorderColor; - -webkit-box-shadow: 0px 0px 5px $stateFocusBorderColor; - box-shadow: 0px 0px 5px $stateFocusBorderColor; -} - -.ui-inputgroup { - .ui-inputgroup-addon { - border-color: $stateDefaultBorderColor; - background-color: lighten($stateDefaultBorderColor, 10%); - color: $inputGroupTextColor; - - &:first-child { - border-top-left-radius: $borderRadius; - border-bottom-left-radius: $borderRadius; - } - - &:last-child { - border-top-right-radius: $borderRadius; - border-bottom-right-radius: $borderRadius; - } - } - - .ui-button { - &:first-child { - border-top-left-radius: $borderRadius; - border-bottom-left-radius: $borderRadius; - } - - &:last-child { - border-top-right-radius: $borderRadius; - border-bottom-right-radius: $borderRadius; - } - } -} - -.ui-inputsearch { - display: flex; - .ui-inputtext{ - padding-left: .15rem; - padding-right: .4rem; - @extend .ui-corner-all-large; - } - .ui-button { - margin-left: -.35rem; - } -} - - -.ui-float-label input.ng-dirty.ng-invalid ~ label { - color: $stateErrorTextColor; -} - -.ui-autocomplete { - .ui-autocomplete-multiple-container:not(.ui-state-disabled) { - &:hover { - border-color: $stateHoverBorderColor; - } - - &.ui-state-focus { - border-color: $stateFocusBorderColor; - - } - } -} - -.ui-chips { - > ul:not(.ui-state-disabled) { - &:hover { - border-color: $stateHoverBorderColor; - } - - &.ui-state-focus { - border-color: $stateFocusBorderColor; - } - } -} - -.ui-button:focus, -.ui-button:enabled:hover, -.ui-fileupload-choose:not(.ui-state-disabled):hover { - outline: 0 none; - @include hover-element(); -} - -.ui-button:enabled:active, -.ui-fileupload-choose:not(.ui-state-disabled):active { - border-color: $stateActiveBorderColor; - background: $stateActiveBgColor; - color: $stateActiveTextColor; -} - -.ui-chkbox-box:not(.ui-state-disabled):not(.ui-state-active):hover { - @include hover-element(); -} - -.ui-radiobutton-box:not(.ui-state-disabled):not(.ui-state-active):hover { - @include hover-element(); -} - -.ui-dropdown .ui-dropdown-clear-icon { - color: lighten($inputTextColor, 40%); -} - -.ui-dropdown:not(.ui-state-disabled):hover { - @include hover-element(); -} - -.ui-dropdown-panel .ui-dropdown-item:not(.ui-state-highlight):hover { - @include hover-element(); -} - -.ui-listbox { - .ui-listbox-header { - .ui-listbox-filter-container { - .fa { - color: $inputTextColor; - } - } - } - - &:not(.ui-state-disabled) { - .ui-listbox-item:not(.ui-state-highlight):hover { - @include hover-element(); - } - } - - &.ui-state-disabled { - .ui-chkbox-box:not(.ui-state-active):hover { - border-color: $stateDefaultBorderColor; - background: $stateDefaultBgColor; - color: $stateDefaultTextColor; - } - } -} - -.ui-multiselect:not(.ui-state-disabled):hover { - @include hover-element(); -} - -.ui-multiselect-panel .ui-multiselect-item:not(.ui-state-highlight):hover { - @include hover-element(); -} - -.ui-multiselect-panel .ui-multiselect-close { - color: $headerIconTextColor; -} - -.ui-multiselect-panel .ui-multiselect-filter-container .fa { - color: $inputTextColor; -} - -.ui-spinner:not(.ui-state-disabled) .ui-spinner-button:enabled:hover { - @include hover-element(); -} - -.ui-spinner:not(.ui-state-disabled) .ui-spinner-button:enabled:active { - border-color: $stateActiveBorderColor; - background: $stateActiveBgColor; - color: $stateActiveTextColor; -} - -.ui-selectbutton .ui-button:not(.ui-state-disabled):not(.ui-state-active):hover { - @include hover-element(); -} - -.ui-togglebutton:not(.ui-state-disabled):not(.ui-state-active):hover { - @include hover-element(); -} - -.ui-paginator a:not(.ui-state-disabled):not(.ui-state-active):hover { - @include hover-element(); -} - -.ui-paginator a { - color: $stateDefaultTextColor; -} - -.ui-datatable { - .ui-rowgroup-header a { - color: $headerTextColor; - } - - .ui-sortable-column:not(.ui-state-active):hover { - background: $stateHoverBgColor; - color: $stateHoverTextColor; - } - - .ui-row-toggler { - color: $contentTextColor; - } - - tbody.ui-datatable-hoverable-rows { - > tr.ui-widget-content:not(.ui-state-highlight):hover { - cursor: pointer; - background: #ebf0f2; - } - } -} - -.ui-orderlist { - .ui-orderlist-item:not(.ui-state-highlight):hover { - @include hover-element(); - } -} - -.ui-picklist { - .ui-picklist-item:not(.ui-state-disabled):not(.ui-state-highlight):hover { - @include hover-element(); - } - - .ui-picklist-droppoint-highlight { - border-color: $stateHighlightBorderColor; - background: $stateHighlightBgColor; - color: darken($contentTextColor,1%); - - a { - color: darken($contentTextColor,1%); - } - } - - .ui-picklist-highlight { - border-color: $stateHighlightBorderColor; - color: darken($contentTextColor,1%); - - a { - color: darken($contentTextColor,1%); - } - } -} - -.ui-tree { - &.ui-treenode-dragover { - border-color: $stateHighlightBorderColor; - } - - .ui-treenode-content { - &.ui-treenode-selectable { - .ui-treenode-label:not(.ui-state-highlight):hover { - @include hover-element(); - } - } - - &.ui-treenode-dragover { - background: $stateActiveBgColor; - color: $stateActiveTextColor; - } - } - - &.ui-tree-horizontal { - .ui-treenode-content.ui-treenode-selectable { - .ui-treenode-label:not(.ui-state-highlight):hover { - background-color: inherit; - color: inherit; - } - - &:not(.ui-state-highlight):hover { - @include hover-element(); - } - } - } -} - -.ui-treetable { - .ui-treetable-row.ui-treetable-row-selectable:not(.ui-state-highlight):hover { - background: $stateHoverBgColor; - color: $stateHoverTextColor; - } -} - -.ui-organizationchart { - .ui-organizationchart-node-content { - &.ui-organizationchart-selectable-node:not(.ui-state-highlight):hover { - @include hover-element(); - } - } -} - -.ui-accordion { - .ui-accordion-header:not(.ui-state-active):not(.ui-state-disabled):hover { - @include hover-element(); - } -} - -.ui-fieldset { - &.ui-fieldset-toggleable { - .ui-fieldset-legend:hover { - @include hover-element(); - } - } -} - -.ui-panel { - .ui-panel-titlebar { - .ui-panel-titlebar-icon:hover { - @include hover-element(); - } - } -} - -.ui-tabview { - .ui-tabview-nav { - li { - &:not(.ui-state-active):not(.ui-state-disabled):hover { - @include hover-element(); - } - } - } -} - -.ui-dialog { - .ui-dialog-titlebar-icon { - color: $headerTextColor; - - &:hover { - @include hover-element(); - } - } -} - -.ui-sidebar { - .ui-sidebar-close { - color: $headerTextColor; - - &:hover { - @include hover-element(); - } - } -} - -.ui-overlaypanel { - .ui-overlaypanel-close:hover { - @include hover-element(); - } -} - -.ui-inplace { - .ui-inplace-display:hover { - @include hover-element(); - } -} - -.ui-breadcrumb { - a { - color: $headerTextColor; - } -} - -.ui-menuitem { - .ui-menuitem-link { - color: $contentTextColor; - - &:hover { - @include hover-element(); - border-color: transparent; - } - } - - &.ui-menuitem-active { - > .ui-menuitem-link { - @include hover-element(); - border-color: transparent; - } - } -} - -.ui-tabmenu { - .ui-tabmenu-nav { - li:not(.ui-state-active):hover { - @include hover-element(); - } - } -} - -.ui-steps { - .ui-steps-item:not(.ui-state-highlight):not(.ui-state-disabled):hover { - @include hover-element(); - } -} - -.ui-panelmenu { - .ui-panelmenu-header { - &:not(.ui-state-active):hover { - @include hover-element(); - border-color: $stateDefaultBorderColor; - - a { - color: $stateHoverTextColor; - } - } - - &.ui-state-active { - a { - color: $stateActiveTextColor; - } - } - } - - .ui-panelmenu-content { - .ui-menuitem-link { - color: $contentTextColor; - - &:hover { - @include hover-element(); - border-color: transparent; - } - } - } -} - -.ui-datepicker { - .ui-datepicker-header { - a { - color: $headerTextColor; - - &:hover { - @include hover-element(); - } - } - } - - .ui-datepicker-calendar { - td:not(.ui-state-disabled) { - a:hover { - @include hover-element(); - } - } - } -} - -.fc { - .fc-toolbar { - .fc-prev-button { - .ui-icon-circle-triangle-w { - margin-top: .3em; - @include icon_override("\f053"); - } - } - - .fc-next-button { - .ui-icon-circle-triangle-e { - margin-top: .3em; - @include icon_override("\f054"); - } - } - } -} - -.ui-rating { - a { - color: $inputTextColor; - } -} - -.ui-organizationchart { - .ui-organizationchart-line-down { - background-color: darken($contentBorderColor, 10%); - } - - .ui-organizationchart-line-left { - border-right: 1px solid darken($contentBorderColor, 10%); - } - - .ui-organizationchart-line-top { - border-top: 1px solid darken($contentBorderColor, 10%); - } - - .ui-organizationchart-node-content { - border-color: darken($contentBorderColor, 10%); - } - - .ui-organizationchart-node-content .ui-node-toggler { - color: darken($contentBorderColor, 10%); - } -} - -/* TurboTable */ -.ui-table { - .ui-table-thead > tr > th, - .ui-table-tfoot > tr > td { - background: $headerBgColor; - border: 1px solid $headerBorderColor; - color: $headerTextColor; - } - - .ui-table-tbody > tr { - background: $contentBgColor; - color: $contentTextColor; - - > td { - border: 1px solid $contentBorderColor; - background: inherit; - } - - &.ui-state-highlight { - background-color: $stateHighlightBgColor; - color: $stateHighlightTextColor; - } - - &.ui-contextmenu-selected { - background-color: lighten($stateHighlightBgColor, 20%); - color: $stateHighlightTextColor; - } - } - - .ui-sortable-column { - &.ui-state-highlight { - background-color: $stateHighlightBgColor; - color: $stateHighlightTextColor; - } - - &:not(.ui-state-highlight):hover { - background: $stateHoverBgColor; - color: $stateHoverTextColor; - } - } - - &.ui-table-hoverable-rows { - .ui-table-tbody > tr:not(.ui-state-highlight):hover { - cursor: pointer; - background: $stateHoverBgColor; - color: $stateHoverTextColor; - } - } -} - -@media ( max-width: 35em ) { - .ui-table-responsive .ui-table-tbody > tr { - border-top: 1px solid $contentBorderColor; - border-bottom: 1px solid $contentBorderColor; - } -} - -/* Row Reorder */ -.ui-table .ui-table-tbody > tr.ui-table-dragpoint-top > td { - box-shadow: inset 0 2px 0 0 $stateHighlightBgColor; -} - -.ui-table .ui-table-tbody > tr.ui-table-dragpoint-bottom > td { - box-shadow: inset 0 -2px 0 0 $stateHighlightBgColor; -} - -/* Validation */ -.ui-inputtext.ng-dirty.ng-invalid, -p-dropdown.ng-dirty.ng-invalid > .ui-dropdown, -p-autocomplete.ng-dirty.ng-invalid > .ui-autocomplete > .ui-inputtext, -p-calendar.ng-dirty.ng-invalid > .ui-calendar > .ui-inputtext, -p-chips.ng-dirty.ng-invalid > .ui-inputtext, -p-inputmask.ng-dirty.ng-invalid > .ui-inputtext, -p-checkbox.ng-dirty.ng-invalid .ui-chkbox-box, -p-radiobutton.ng-dirty.ng-invalid .ui-radiobutton-box, -p-inputswitch.ng-dirty.ng-invalid .ui-inputswitch, -p-listbox.ng-dirty.ng-invalid .ui-inputtext, -p-multiselect.ng-dirty.ng-invalid > .ui-multiselect, -p-spinner.ng-dirty.ng-invalid > .ui-inputtext, -p-selectbutton.ng-dirty.ng-invalid .ui-button, -p-togglebutton.ng-dirty.ng-invalid .ui-button { - border-bottom-color: $invalidInputBorderColor; -} - -/* Cornering */ -// .ui-corner-tl { -moz-border-radius-topleft: $borderRadius; -webkit-border-top-left-radius: $borderRadius; border-top-left-radius: $borderRadius; } -// .ui-corner-tr { -moz-border-radius-topright: $borderRadius; -webkit-border-top-right-radius: $borderRadius; border-top-right-radius: $borderRadius; } -// .ui-corner-bl { -moz-border-radius-bottomleft: $borderRadius; -webkit-border-bottom-left-radius: $borderRadius; border-bottom-left-radius: $borderRadius; } -// .ui-corner-br { -moz-border-radius-bottomright: $borderRadius; -webkit-border-bottom-right-radius: $borderRadius; border-bottom-right-radius: $borderRadius; } -// .ui-corner-top { -moz-border-radius-topleft: $borderRadius; -webkit-border-top-left-radius: $borderRadius; border-top-left-radius: $borderRadius; -moz-border-radius-topright: $borderRadius; -webkit-border-top-right-radius: $borderRadius; border-top-right-radius: $borderRadius; } -// .ui-corner-bottom { -moz-border-radius-bottomleft: $borderRadius; -webkit-border-bottom-left-radius: $borderRadius; border-bottom-left-radius: $borderRadius; -moz-border-radius-bottomright: $borderRadius; -webkit-border-bottom-right-radius: $borderRadius; border-bottom-right-radius: $borderRadius; } -// .ui-corner-right { -moz-border-radius-topright: $borderRadius; -webkit-border-top-right-radius: $borderRadius; border-top-right-radius: $borderRadius; -moz-border-radius-bottomright: $borderRadius; -webkit-border-bottom-right-radius: $borderRadius; border-bottom-right-radius: $borderRadius; } -// .ui-corner-left { -moz-border-radius-topleft: $borderRadius; -webkit-border-top-left-radius: $borderRadius; border-top-left-radius: $borderRadius; -moz-border-radius-bottomleft: $borderRadius; -webkit-border-bottom-left-radius: $borderRadius; border-bottom-left-radius: $borderRadius; } -// .ui-corner-all { -moz-border-radius: $borderRadius; -webkit-border-radius: $borderRadius; border-radius: $borderRadius; } diff --git a/dashboard/src/assets/components/themes/default/default.scss b/dashboard/src/assets/components/themes/default/default.scss deleted file mode 100644 index 7429b3be4..000000000 --- a/dashboard/src/assets/components/themes/default/default.scss +++ /dev/null @@ -1,926 +0,0 @@ -$color-primary: (normal: #438bd3, hover: #4596e8, active: #1f5fac); -$color-disabled: #c9d1d8; -$color-text: (primary: #657D95, secondary: #8893a6, tertary: #b9c3c8, auxiliary: #c9d1d8 ); -$color-title: (primary: #2e3039, secondary: #657D95); - -$color-splitline: #ecf0f2; -$color-panelbg: #f3f6f7; -$widget-border: (normal: #cfd7db, hover: #98a5bc, focus: #98a5bc, active: #98a5bc); -$widget-bg: (normal: #fdfdfd, hover: #ffffff, focus: #ffffff, active: #f1f1f1); - -//Alert Colors [type, border, backgroud, text] -$color-alert: (success, #3DCCA6, #F0FBF8, #3DCCA6 ), - (error, #FF4C4C, #FFF1F1, #FF4C4C ), - (info, #499DF2, #F1F7FE, #499DF2 ), - (warn, #FF8833, #FFF6EF, #FF8833 ), - (describe, #CACACA, #FFFFFF, #657D95); - -$border-radius: (small, 3px), (medium, 10px), (large, 20px); //@extend .ui-corner-bl-small; -@each $type, $size in $border-radius{ - $radius-pos: (tl, $size 0 0 0 ), - (tr, 0 $size 0 0 ), - (br, 0 0 $size 0 ), - (bl, 0 0 0 $size ), - (top, $size $size 0 0 ), - (right, 0 $size $size 0 ), - (left, $size 0 0 $size ), - (bottom, 0 0 $size $size ), - (all, $size); - @each $pos, $cornerStyle in $radius-pos{ - .ui-corner-#{ $pos }-#{ $type }{ - -moz-border-radius: $cornerStyle; - -webkit-border-radius: $cornerStyle;; - border-radius: $cornerStyle; - } - } -} - - -$fontFamily: "Roboto", "Trebuchet MS", Arial, Helvetica, sans-serif; -$fontSize: 0.14rem; -$borderRadius: 3px; -$disabledOpacity: 0.35; - -//Header -$headerBorderWidth: 1px; -$headerBorderColor: #d9d9d9; -$headerBgColor: #f6f7f9; -$headerTextColor: #1b1d1f; -$headerFontWeight: normal; -$headerIconTextColor: #1b1d1f; - -//Content -$contentBorderWidth: 1px; -$contentBorderColor: #D5D5D5; -$contentBgColor: #ffffff; -$contentTextColor: map-get($color-text, primary); - -//Default State -$stateDefaultBorderWidth: 1px; -$stateDefaultBorderColor: map-get($widget-border, normal); -$stateDefaultBgColor: map-get($widget-bg, normal); -$stateDefaultTextColor: map-get($color-text, primary); - -//Active State -$stateActiveBorderColor: map-get($widget-border, active); -$stateActiveBgColor: map-get($widget-bg, active); -$stateActiveTextColor: map-get($color-text, primary); - -//Highlight State -$stateHighlightBorderColor: map-get($color-primary, normal); -$stateHighlightBgColor: map-get($color-primary, normal); -$stateHighlightTextColor: #FFFFFF; - -//Focus State -$stateFocusBorderColor: map-get($widget-border, focus); -$stateFocusBgColor: map-get($widget-bg, focus); -$stateFocusTextColor: map-get($color-text, primary); - -//Error State -$stateErrorBorderColor: #f44336; -$stateErrorBgColor: #f5554a; -$stateErrorTextColor: #cd0a0a; - -//Hover State -$stateHoverBorderColor: map-get($widget-border, hover); -$stateHoverBgColor: map-get($widget-bg, hover); -$stateHoverTextColor: map-get($color-text, primary); - -//Forms -$inputBgColor: #ffffff; -$inputTextColor: map-get($color-text, primary); -$invalidInputBorderColor: #f44336; -$inputGroupTextColor: map-get($color-text, primary); - -@import '../_theme.scss'; - -//-------------------------------------------------------------// - -/* roboto-regular - latin */ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 400; - src: url('./assets/components/themes/default/fonts/roboto-v15-latin-regular.eot'); /* IE9 Compat Modes */ - src: local('Roboto'), local('Roboto-Regular'), - url('./assets/components/themes/default/fonts/roboto-v15-latin-regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ - url('./assets/components/themes/default/fonts/roboto-v15-latin-regular.woff2') format('woff2'), /* Super Modern Browsers */ - url('./assets/components/themes/default/fonts/roboto-v15-latin-regular.woff') format('woff'), /* Modern Browsers */ - url('./assets/components/themes/default/fonts/roboto-v15-latin-regular.ttf') format('truetype'), /* Safari, Android, iOS */ - url('./assets/components/themes/default/fonts/roboto-v15-latin-regular.svg#Roboto') format('svg'); /* Legacy iOS */ -} - -html, body, div, ul, li, p, input, textarea, select, h1, h2, h3, h4, h5{ - margin: 0; - padding: 0; -} -html, body { - box-sizing: border-box; -} -html { - height: 100%; - font-size: 625%; /*1em = 100px*/ -} - -body { - font-family: 'Roboto', "Trebuchet MS", Arial, Helvetica, sans-serif; - font-weight: normal; - font-size: $fontSize; - color: map-get($color-text, primary); - background-color: #fff; - height: 100%; - overflow: auto; - -webkit-font-smoothing: antialiased; -} - -h1,h2,h3,h4,h5{ - font-weight: 500; -} - -h1{ font-size: 0.24rem; line-height: 0.28rem;} - -h2{ font-size: 0.20rem; line-height: 0.24rem;} - -h3{ font-size: 0.18rem; line-height: 0.24rem;} - -h4{ font-size: 0.16rem; line-height: 0.22rem;} - -h5{ font-size: 0.14rem; line-height: 0.22rem;} - -ol,ul,li{ - list-style: none; - list-style-type: none; -} - -input, textarea, keygen, select, button{ - font-family: inherit; - font-size: inherit; - font-weight: inherit; - display: block; -} - -input::-ms-clear{ display: none; } - -input:-ms-input-placeholder, textarea:-ms-input-placeholder{ - color: #666666; -} - -fieldset{ - border: 0; - padding: 0; - margin: 0; -} - -textarea{ - resize: none; -} - -::selection{ - background: #1f89ce; - color: #fff; -} - -::-moz-selection{ - background: #1f89ce; - color: #fff; -} - -::-webkit-selection{ - background: #1f89ce; - color: #fff; -} - -a{ - color: map-get($color-primary, normal); - text-decoration: none; - cursor: pointer; - - &:hover,&:active{ - color: map-get($color-primary, active); - } - &:disabled{ - color: $color-disabled; - cursor: default; - } -} - -.ui-widget-content a{ - color: map-get($color-primary, normal); -} - - -p{ - line-height: 1.5; - color: map-get($color-text, primary); - word-wrap: normal; - word-break: break-word; -} - -/* Validation */ -.ui-inputtext.ng-touched.ng-invalid, -p-dropdown.ng-dirty.ng-invalid > .ui-dropdown, -p-autocomplete.ng-dirty.ng-invalid > .ui-autocomplete > .ui-inputtext, -p-calendar.ng-touched.ng-invalid > .ui-inputtext, -p-chips.ng-dirty.ng-invalid > .ui-inputtext, -p-inputmask.ng-dirty.ng-invalid > .ui-inputtext, -p-checkbox.ng-dirty.ng-invalid .ui-chkbox-box, -p-radiobutton.ng-dirty.ng-invalid .ui-radiobutton-box, -p-inputswitch.ng-dirty.ng-invalid .ui-inputswitch, -p-listbox.ng-dirty.ng-invalid .ui-inputtext, -p-multiselect.ng-dirty.ng-invalid > .ui-multiselect, -p-spinner.ng-dirty.ng-invalid > .ui-inputtext, -p-selectbutton.ng-dirty.ng-invalid .ui-button, -p-togglebutton.ng-dirty.ng-invalid .ui-button { - border-color: $invalidInputBorderColor; -} - -/* Mask style */ -.mask-background{ - z-index: 100000000; - background: #666; - opacity: .30; - filter: Alpha(opacity=30); - position: fixed; - top: 0; - left: 0; - width: 100%; - height: 100%; -} - -/* loading */ -.M-loading-text{ - margin: auto; - font-size: 16px; - text-align: left; - margin-top: 30px; -} -.M-loading-content{ - position:fixed; - top: 40%; - left: 49%; - margin: auto; - text-align: center; - z-index: 1000; -} -.M-loading{ - -webkit-transform: translateZ(0); - transform: rotate(-90deg); - -ms-transform: rotate(-70deg); /* IE 9 */ - -moz-transform: rotate(-90deg); /* Firefox */ - -webkit-transform: rotate(-90deg); /* Safari and Chrome */ - -o-transform: rotate(-90deg); - width: 30px; - height: 30px; - margin-left: 20px; -} -.M-load{ - opacity: 0; - font-size: 20px; - text-indent:-9999em; - overflow: hidden; - width: 21px; - height: 21px; - border-radius: 50%; - position: fixed; - transform: rotate(-90deg); - -ms-transform: rotate(-90deg); /* IE 9 */ - -moz-transform: rotate(-90deg); /* Firefox */ - -webkit-transform: rotate(-90deg); /* Safari and Chrome */ - -o-transform: rotate(-90deg); - animation: load6 1300ms cubic-bezier(0.4, 0, 0.2, 1) infinite; - transform: translateZ(0); -} -.M-loader{ - box-shadow: 0 -0.8em 0 -0.37em #3399ff; - animation-delay:100ms; -} -.M-loader1{ - box-shadow: 0 -0.8em 0 -0.37em #4da6ff; - animation-delay:200ms; -} -.M-loader3{ - box-shadow: 0 -0.8em 0 -0.37em #66b3ff; - animation-delay:300ms; -} -.M-loader3{ - box-shadow: 0 -0.8em 0 -0.37em #80bfff; - animation-delay:400ms; -} -.M-loader4{ - box-shadow: 0 -0.8em 0 -0.37em #99ccff; - animation-delay:500ms; -} - -@keyframes load6 { - 0%{ - opacity: 0; - -ms-transform: rotate(0deg); - -webkit-transform: rotate(0deg); - transform: rotate(0deg); - } - 15%{ - opacity: 1; - } - 75%{ - opacity: 1; - } - 76%{ - opacity: 0; - } - 100%{ - -ms-transform: rotate(360deg); - -webkit-transform: rotate(360deg); - transform: rotate(360deg); - opacity: 0; - } -} - -//-------------------------------------------------------------// - -.ui-widget-header { - background: #f6f7f9 0 0 repeat-x; /* Old browsers */ - background: -moz-linear-gradient(top, #f6f7f9 0%, #ebedf0 100%); /* FF3.6+ */ - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f6f7f9), color-stop(100%,#ebedf0)); /* Chrome,Safari4+ */ - background: -webkit-linear-gradient(top, #f6f7f9 0%,#ebedf0 100%); /* Chrome10+,Safari5.1+ */ - background: -o-linear-gradient(top, #f6f7f9 0%,#ebedf0 100%); /* Opera11.10+ */ - background: -ms-linear-gradient(top, #f6f7f9 0%,#ebedf0 100%); /* IE10+ */ - background: linear-gradient(to bottom, #f6f7f9 0%,#ebedf0 100%); /* W3C */ -} - -.ui-accordion { - .ui-accordion-header { - background: $headerBgColor; - border-top: 1px solid $headerBorderColor; - - a { - color: $headerTextColor; - } - - &:not(.ui-state-active):not(.ui-state-disabled):hover { - background: #ededf0; - } - - &.ui-state-active { - background: #ffffff; - border-left-color: transparent; - border-right-color: transparent; - border-bottom-color: transparent; - -webkit-border-radius: 0; - -moz-border-radius: 0; - border-radius: 0; - } - } - - .ui-accordion-content { - border: 0 none; - } -} - -/* Tabview */ -.ui-tabview { - &.ui-widget-content { - border: 0 none; - } - - &.ui-tabview-top > .ui-tabview-nav { - background: transparent; - - > li { - &.ui-state-default { - background: none; - border:none; - a { - color: map-get($color-title, secondary); - } - } - - &.ui-state-active, - &:not(.ui-state-active):not(.ui-state-disabled):hover { - background: none; - a { - color: map-get($color-title, primary); - } - } - - &.ui-tabview-selected{ - border-bottom: 0.04rem solid map-get($color-primary, normal); - } - } - } -} - -/* Spinner */ -.ui-spinner:not(.ui-state-disabled) .ui-spinner-button:enabled:hover { - border: 1px solid #1f89ce; - background: #1f89ce; - outline: 0 none; - color: #ffffff; -} - -.ui-spinner:not(.ui-state-disabled) .ui-spinner-button:enabled:active { - border: 1px solid #156090; - background: #186ba0; - color: #ffffff; -} - -.ui-slider { position: relative; text-align: left; background: #838688; border: none; -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.6) inset; -moz-box-shadow: 0 1px 3px rgba(0,0,0,0.6) inset; box-shadow: 0 1px 3px rgba(0,0,0,0.6) inset;} -.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 17px !important; height: 21px !important; cursor: default; background: url("./assets/components/themes/default/images/slider_handles.png") 0 0 no-repeat; outline: none; -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0; border: none; } -.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background: #14a4ff; -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.6) inset; -moz-box-shadow: 0 1px 3px rgba(0,0,0,0.6) inset; box-shadow: 0 1px 3px rgba(0,0,0,0.6) inset; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; } -.ui-slider .ui-slider-handle.ui-state-active { background-position: -17px 0; } - -.ui-slider-horizontal { height: 6px; } -.ui-slider-horizontal .ui-slider-handle { top: -2px !important; margin-left: -.6em; } -.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; } -.ui-slider-horizontal .ui-slider-range-min { left: 0; } -.ui-slider-horizontal .ui-slider-range-max { right: 0; } - -.ui-slider-vertical { width: .8em; height: 100px; } -.ui-slider-vertical .ui-slider-handle { left: -.1em !important; margin-left: 0; margin-bottom: -.6em; } -.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } -.ui-slider-vertical .ui-slider-range-min { bottom: 0; } -.ui-slider-vertical .ui-slider-range-max { top: 0; } - -.ui-progressbar { - &.ui-progressbar-determinate { - .ui-progressbar-value { - border: 0 none; - background: #8ec5fc; - } - - .ui-progressbar .ui-progressbar-label { - color: #222222; - } - } - - &.ui-progressbar-indeterminate { - background: #8ec5fc; - - .ui-progressbar-value { - border: 0 none; - background-color: $stateHighlightBgColor; - } - } -} - - - -.ui-widget-header .ui-button, -.ui-widget-content .ui-button, -.ui-widget.ui-button, -.ui-button { - // color: #FFFFFF; - // background: #2399e5; - // -webkit-transition: background-color .2s; - // -moz-transition: background-color .2s; - // transition: background-color .2s; - - // &:enabled:hover, - // &:focus { - // border: 1px solid #1f89ce; - // background: #1f89ce; - // outline: 0 none; - // color: #ffffff; - // } - - // &:enabled:active { - // border: 1px solid #156090; - // background: #186ba0; - // color: #ffffff; - // } - // &.ui-button-icon-only{ - // border: none; - // background: none; - // &:hover,&:active{ - // border: none; - // background: none; - // box-shadow:none; - // } - // } -} - -.ui-fileupload-choose:not(.ui-state-disabled):hover, -.ui-fileupload-choose.ui-state-focus { - border: 1px solid #1f89ce; - background: #1f89ce; - outline: 0 none; - color: #ffffff; -} - -.ui-fileupload-choose:not(.ui-state-disabled):active { - border: 1px solid #156090; - background: #186ba0; - color: #ffffff; -} - -/* Checkbox and Radio */ -.ui-chkbox-box.ui-state-active, -.ui-radiobutton-box.ui-state-active { - border: 1px solid #156090; - background: #186ba0; - color: #FFFFFF; -} - -.ui-chkbox-box.ui-state-focus, -.ui-radiobutton-box.ui-state-focus { - -moz-box-shadow: 0px 0px 5px #1f89ce; - -webkit-box-shadow: 0px 0px 5px #1f89ce; - box-shadow: 0px 0px 5px #1f89ce; -} - -.ui-chkbox-box.ui-state-focus.ui-state-active { - background: #186ba0; -} - -/* Inputs */ -.ui-inputtext { - background: #ffffff; - color: #222222; - -webkit-transition: .2s; - -moz-transition: .2s; - transition: .2s; -} - -.ui-inputtext.ui-state-focus, -.ui-inputtext:focus { - -moz-box-shadow: 0px 0px 5px #1f89ce; - -webkit-box-shadow: 0px 0px 5px #1f89ce; - box-shadow: 0px 0px 5px #1f89ce; -} - -/* InputSwitch */ -.ui-inputswitch-on { - background: #186ba0 !important; - color: #ffffff !important; -} - -.ui-paginator .ui-paginator-pages .ui-paginator-page.ui-state-active { - background: #1f5fac; - color: #ffffff; - border-color: #1f5fac; -} - -/* DataTable */ -.ui-datatable { - th { - &.ui-state-default { - background: #dfe6e9; - } - - &.ui-sortable-column:not(.ui-state-active):hover { - background: #dfe6e9; - } - - &.ui-state-active { - background: #186ba0; - color: #ffffff; - } - &.table-col-expander{ - width: .40rem; - } - &.table-col-selection{ - width: .40rem; - } - } - - tbody { - > tr.ui-widget-content { - - &.ui-datatable-odd { - background-color: #f5f8f9; - } - - &.ui-datatable-even { - background-color: #ffffff; - } - - &.ui-state-highlight { - background-color: #ebf0f2; - color: #657D95; - } - } - } - - tfoot { - td { - &.ui-state-default { - background: #ebedf0; - border-color: #d9d9d9; - } - } - } - - .ui-datatable-scrollable-header{ - background: #dfe6e9; - } - - .ui-datatable-tablewrapper, .ui-datatable-scrollable-body{ - border-bottom:1px solid #dfe6e9; - } - - .ui-paginator-bottom{ - border: none; - background: none; - text-align: left; - - &.ui-paginator{ - padding: .15rem 0; - } - } - - -} - -/* TurboTable */ -.ui-table { - .ui-table-thead > tr > th, - .ui-table-tfoot > tr > td { - background: #ebedf0; - border-color: #d9d9d9; - } - - .ui-sortable-column:not(.ui-state-highlight):hover { - background: #d3d5d8; - border-color: #d9d9d9; - } - - .ui-table-tbody > tr:nth-child(even) { - background-color: #fafafb; - - &.ui-state-highlight { - background-color: $stateHighlightBgColor; - color: $stateHighlightTextColor; - } - - &.ui-contextmenu-selected { - background-color: lighten($stateHighlightBgColor, 20%); - color: $stateHighlightTextColor; - } - } -} - -/* Panel */ -.ui-panel.ui-widget { - padding: 0; - - .ui-panel-titlebar.ui-corner-all { - -moz-border-radius-bottom-left: 0; - -webkit-border-bottom-left-radius: 0; - border-bottom-left-radius: 0; - -moz-border-radius-bottom-right: 0; - -webkit-border-bottom-right-radius: 0; - border-bottom-right-radius: 0; - } - - .ui-panel-titlebar { - border-width: 0 0 1px 0; - } - - .ui-panel-titlebar-icon span { - position: relative; - top: 1px; - } - -} - -/* TreeTable */ -.ui-treetable { - th.ui-state-default { - background: #ebedf0; - border-color: #d9d9d9; - } -} - -/* ButtonSet */ -.ui-togglebutton.ui-button.ui-state-default, -.ui-selectbutton .ui-button.ui-state-default { - border: 1px solid #d6d6d6; - background: #ffffff; - font-weight: normal; - color: #555555; -} - -.ui-togglebutton.ui-button.ui-state-hover,.ui-togglebutton.ui-button.ui-state-focus, -.ui-selectbutton .ui-button.ui-state-hover,.ui-selectbutton .ui-button.ui-state-focus, .ui-selectbutton .ui-button:focus { - border: 1px solid #c0c0c0; - background: #eeeeee; - font-weight: normal; - color: #212121; -} - -.ui-togglebutton.ui-button.ui-state-focus, -.ui-selectbutton .ui-button.ui-state-focus.ui-state-active, -.ui-selectbutton .ui-button.ui-state-active:focus { - -moz-box-shadow: 0px 0px 5px #1f89ce; - -webkit-box-shadow: 0px 0px 5px #1f89ce; - box-shadow: 0px 0px 5px #1f89ce; -} - -.ui-togglebutton.ui-button.ui-state-active, -.ui-selectbutton .ui-button.ui-state-active { - border: 1px solid #156090; - background: #186ba0; - color: #FFFFFF; -} - -.ui-multiselect { - .ui-multiselect-label { - background-color: #ffffff; - } -} - -.ui-dropdown.ui-state-focus, .ui-multiselect.ui-state-focus { - -moz-box-shadow: 0px 0px 5px #1f89ce; - -webkit-box-shadow: 0px 0px 5px #1f89ce; - box-shadow: 0px 0px 5px #1f89ce; -} - -/* Growl */ -.ui-growl-item-container.ui-state-highlight { - &.ui-growl-message-info { - background-color: #2196f3; - border-color :#2196f3; - } - - &.ui-growl-message-error { - background-color: #f44336; - border-color :#f44336; - } - - &.ui-growl-message-warn { - background-color: #FFB300; - border-color :#FFB300; - } - - &.ui-growl-message-success { - background-color: #4CAF50; - border-color :#4CAF50; - } -} - -/* TabMenu */ -.ui-tabmenu { - border: 0 none; - - .ui-tabmenu-nav { - background: none; - - > li { - &.ui-state-default { - background: #f6f7f9; - } - - &.ui-state-active { - background: #ffffff; - font-weight: normal; - color: #555555; - } - - &:not(.ui-state-active):not(.ui-state-disabled):hover { - background: #ededf0; - } - } - } -} - -/* Menus */ -.ui-menu, -.ui-menubar, .ui-menubar .ui-submenu-list, -.ui-tieredmenu, .ui-tieredmenu .ui-submenu-list, -.ui-slidemenu, .ui-slidemenu .ui-submenu-list, -.ui-contextmenu, .ui-contextmenu .ui-submenu-list, -.ui-megamenu { - color: #1b1d1f; - background: #f6f7f9 0 0 repeat-x; /* Old browsers */ - background: -moz-linear-gradient(top, #f6f7f9 0%, #ebedf0 100%); /* FF3.6+ */ - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f6f7f9), color-stop(100%,#ebedf0)); /* Chrome,Safari4+ */ - background: -webkit-linear-gradient(top, #f6f7f9 0%,#ebedf0 100%); /* Chrome10+,Safari5.1+ */ - background: -o-linear-gradient(top, #f6f7f9 0%,#ebedf0 100%); /* Opera11.10+ */ - background: -ms-linear-gradient(top, #f6f7f9 0%,#ebedf0 100%); /* IE10+ */ - background: linear-gradient(to bottom, #f6f7f9 0%,#ebedf0 100%); /* W3C */ -} - -.ui-menu .ui-menuitem > .ui-menuitem-link:hover, -.ui-menubar .ui-menuitem > .ui-menuitem-link:hover, -.ui-tieredmenu .ui-menuitem > .ui-menuitem-link:hover, -.ui-slidemenu .ui-menuitem > .ui-menuitem-link:hover, -.ui-contextmenu .ui-menuitem > .ui-menuitem-link:hover, -.ui-megamenu .ui-menuitem > .ui-menuitem-link:hover { - background-color: #a6a6a6; - color: #ffffff; -} - -.ui-menu .ui-menuitem.ui-menuitem-active > .ui-menuitem-link, -.ui-menubar .ui-menuitem.ui-menuitem-active > .ui-menuitem-link, -.ui-tieredmenu .ui-menuitem.ui-menuitem-active > .ui-menuitem-link, -.ui-slidemenu .ui-menuitem.ui-menuitem-active > .ui-menuitem-link, -.ui-contextmenu .ui-menuitem.ui-menuitem-active > .ui-menuitem-link, -.ui-megamenu .ui-menuitem.ui-menuitem-active > .ui-menuitem-link { - background-color: #a6a6a6; - color: #ffffff; -} - -/* PanelMenu */ -.ui-panelmenu .ui-panelmenu-header.ui-state-active, -.ui-panelmenu .ui-panelmenu-header.ui-state-active a { - border-color: #156090; - background: #186ba0; - color: #FFFFFF; -} - -/* DatePicker */ -.ui-datepicker.ui-widget { - padding: 0; - - .ui-datepicker-header { - -webkit-border-radius: 0px; - -moz-border-radius: 0px; - border-radius: 0px; - border-top: 0 none; - border-left: 0 none; - border-right: 0 none; - - a { - &:hover { - border-width: 1px; - } - } - } - - .ui-datepicker-calendar { - margin: 0; - - thead th { - background-color: #f6f8fa; - padding: 8px; - } - - td { - border-bottom: 1px solid rgba(213, 213, 213, 0.5); - padding: 0; - - a { - border: 0 none; - text-align: center; - padding: 8px; - - &.ui-state-highlight { - background-color: #d6d6d6; - color: #212121; - } - - &.ui-state-active { - background-color: #186ba0; - color: #ffffff; - } - } - } - - tr:last-child td { - border-bottom: 0 none; - } - } - - .ui-timepicker { - border-bottom: 0 none; - border-left: 0 none; - border-right: 0 none; - -moz-border-radius: 0; - -webkit-border-radius: 0; - border-radius: 0; - } - - &.ui-datepicker-timeonly { - .ui-timepicker { - border-top: 0 none; - } - } -} - -/* Steps */ -.ui-steps .ui-steps-item.ui-state-highlight .ui-menuitem-link { - color: #ffffff; -} - -/* Dialog */ -.ui-dialog.ui-widget .ui-dialog-titlebar { - padding: 1em 1.5em; -} - -.ui-dialog.ui-widget .ui-dialog-titlebar .ui-dialog-title { - font-size: 1.25em; -} - -.ui-dialog.ui-widget .ui-dialog-content { - padding: 1em 1.5em; -} - -/* Schedule */ -.fc { - .fc-button-group { - .ui-state-active { - border: 1px solid #156090; - background: #186ba0; - color: #ffffff; - } - } -} diff --git a/dashboard/src/assets/components/themes/default/fonts/roboto-v15-latin-regular.eot b/dashboard/src/assets/components/themes/default/fonts/roboto-v15-latin-regular.eot deleted file mode 100644 index d26bc8f51..000000000 Binary files a/dashboard/src/assets/components/themes/default/fonts/roboto-v15-latin-regular.eot and /dev/null differ diff --git a/dashboard/src/assets/components/themes/default/fonts/roboto-v15-latin-regular.svg b/dashboard/src/assets/components/themes/default/fonts/roboto-v15-latin-regular.svg deleted file mode 100644 index ed55c105d..000000000 --- a/dashboard/src/assets/components/themes/default/fonts/roboto-v15-latin-regular.svg +++ /dev/null @@ -1,308 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dashboard/src/assets/components/themes/default/fonts/roboto-v15-latin-regular.ttf b/dashboard/src/assets/components/themes/default/fonts/roboto-v15-latin-regular.ttf deleted file mode 100644 index 7b25f3ce9..000000000 Binary files a/dashboard/src/assets/components/themes/default/fonts/roboto-v15-latin-regular.ttf and /dev/null differ diff --git a/dashboard/src/assets/components/themes/default/fonts/roboto-v15-latin-regular.woff b/dashboard/src/assets/components/themes/default/fonts/roboto-v15-latin-regular.woff deleted file mode 100644 index 941dfa4ba..000000000 Binary files a/dashboard/src/assets/components/themes/default/fonts/roboto-v15-latin-regular.woff and /dev/null differ diff --git a/dashboard/src/assets/components/themes/default/fonts/roboto-v15-latin-regular.woff2 b/dashboard/src/assets/components/themes/default/fonts/roboto-v15-latin-regular.woff2 deleted file mode 100644 index 120796bb7..000000000 Binary files a/dashboard/src/assets/components/themes/default/fonts/roboto-v15-latin-regular.woff2 and /dev/null differ diff --git a/dashboard/src/assets/components/themes/default/images/icons_16.png b/dashboard/src/assets/components/themes/default/images/icons_16.png deleted file mode 100644 index 09d6ec7f8..000000000 Binary files a/dashboard/src/assets/components/themes/default/images/icons_16.png and /dev/null differ diff --git a/dashboard/src/assets/components/themes/default/images/slider_handles.png b/dashboard/src/assets/components/themes/default/images/slider_handles.png deleted file mode 100644 index 0fddde5fe..000000000 Binary files a/dashboard/src/assets/components/themes/default/images/slider_handles.png and /dev/null differ diff --git a/dashboard/src/assets/components/themes/default/images/slider_handles@2x.png b/dashboard/src/assets/components/themes/default/images/slider_handles@2x.png deleted file mode 100644 index d8c901ec8..000000000 Binary files a/dashboard/src/assets/components/themes/default/images/slider_handles@2x.png and /dev/null differ diff --git a/dashboard/src/assets/components/themes/default/images/ui-bg_flat_0_aaaaaa_40x100.png b/dashboard/src/assets/components/themes/default/images/ui-bg_flat_0_aaaaaa_40x100.png deleted file mode 100644 index 5b5dab2ab..000000000 Binary files a/dashboard/src/assets/components/themes/default/images/ui-bg_flat_0_aaaaaa_40x100.png and /dev/null differ diff --git a/dashboard/src/assets/components/themes/default/images/ui-bg_flat_75_ffffff_40x100.png b/dashboard/src/assets/components/themes/default/images/ui-bg_flat_75_ffffff_40x100.png deleted file mode 100644 index ac8b229af..000000000 Binary files a/dashboard/src/assets/components/themes/default/images/ui-bg_flat_75_ffffff_40x100.png and /dev/null differ diff --git a/dashboard/src/assets/components/themes/default/images/ui-bg_glass_55_fbf9ee_1x400.png b/dashboard/src/assets/components/themes/default/images/ui-bg_glass_55_fbf9ee_1x400.png deleted file mode 100644 index ad3d6346e..000000000 Binary files a/dashboard/src/assets/components/themes/default/images/ui-bg_glass_55_fbf9ee_1x400.png and /dev/null differ diff --git a/dashboard/src/assets/components/themes/default/images/ui-bg_glass_65_ffffff_1x400.png b/dashboard/src/assets/components/themes/default/images/ui-bg_glass_65_ffffff_1x400.png deleted file mode 100644 index 42ccba269..000000000 Binary files a/dashboard/src/assets/components/themes/default/images/ui-bg_glass_65_ffffff_1x400.png and /dev/null differ diff --git a/dashboard/src/assets/components/themes/default/images/ui-bg_glass_75_dadada_1x400.png b/dashboard/src/assets/components/themes/default/images/ui-bg_glass_75_dadada_1x400.png deleted file mode 100644 index 5a46b47cb..000000000 Binary files a/dashboard/src/assets/components/themes/default/images/ui-bg_glass_75_dadada_1x400.png and /dev/null differ diff --git a/dashboard/src/assets/components/themes/default/images/ui-bg_glass_75_e6e6e6_1x400.png b/dashboard/src/assets/components/themes/default/images/ui-bg_glass_75_e6e6e6_1x400.png deleted file mode 100644 index 86c2baa65..000000000 Binary files a/dashboard/src/assets/components/themes/default/images/ui-bg_glass_75_e6e6e6_1x400.png and /dev/null differ diff --git a/dashboard/src/assets/components/themes/default/images/ui-bg_glass_95_fef1ec_1x400.png b/dashboard/src/assets/components/themes/default/images/ui-bg_glass_95_fef1ec_1x400.png deleted file mode 100644 index 4443fdc1a..000000000 Binary files a/dashboard/src/assets/components/themes/default/images/ui-bg_glass_95_fef1ec_1x400.png and /dev/null differ diff --git a/dashboard/src/assets/components/themes/default/images/ui-bg_highlight-soft_75_cccccc_1x100.png b/dashboard/src/assets/components/themes/default/images/ui-bg_highlight-soft_75_cccccc_1x100.png deleted file mode 100644 index 7c9fa6c6e..000000000 Binary files a/dashboard/src/assets/components/themes/default/images/ui-bg_highlight-soft_75_cccccc_1x100.png and /dev/null differ diff --git a/dashboard/src/assets/components/themes/default/images/ui-icons_222222_256x240.png b/dashboard/src/assets/components/themes/default/images/ui-icons_222222_256x240.png deleted file mode 100644 index b273ff111..000000000 Binary files a/dashboard/src/assets/components/themes/default/images/ui-icons_222222_256x240.png and /dev/null differ diff --git a/dashboard/src/assets/components/themes/default/images/ui-icons_2e83ff_256x240.png b/dashboard/src/assets/components/themes/default/images/ui-icons_2e83ff_256x240.png deleted file mode 100644 index 84defe6e8..000000000 Binary files a/dashboard/src/assets/components/themes/default/images/ui-icons_2e83ff_256x240.png and /dev/null differ diff --git a/dashboard/src/assets/components/themes/default/images/ui-icons_454545_256x240.png b/dashboard/src/assets/components/themes/default/images/ui-icons_454545_256x240.png deleted file mode 100644 index 59bd45b90..000000000 Binary files a/dashboard/src/assets/components/themes/default/images/ui-icons_454545_256x240.png and /dev/null differ diff --git a/dashboard/src/assets/components/themes/default/images/ui-icons_cd0a0a_256x240.png b/dashboard/src/assets/components/themes/default/images/ui-icons_cd0a0a_256x240.png deleted file mode 100644 index 2ab019b73..000000000 Binary files a/dashboard/src/assets/components/themes/default/images/ui-icons_cd0a0a_256x240.png and /dev/null differ diff --git a/dashboard/src/assets/components/themes/default/images/ui-icons_ffffff_256x240.png b/dashboard/src/assets/components/themes/default/images/ui-icons_ffffff_256x240.png deleted file mode 100644 index 42f8f992c..000000000 Binary files a/dashboard/src/assets/components/themes/default/images/ui-icons_ffffff_256x240.png and /dev/null differ diff --git a/dashboard/src/environments/environment.prod.ts b/dashboard/src/environments/environment.prod.ts deleted file mode 100644 index 3612073bc..000000000 --- a/dashboard/src/environments/environment.prod.ts +++ /dev/null @@ -1,3 +0,0 @@ -export const environment = { - production: true -}; diff --git a/dashboard/src/environments/environment.ts b/dashboard/src/environments/environment.ts deleted file mode 100644 index b7f639aec..000000000 --- a/dashboard/src/environments/environment.ts +++ /dev/null @@ -1,8 +0,0 @@ -// The file contents for the current environment will overwrite these during build. -// The build system defaults to the dev environment which uses `environment.ts`, but if you do -// `ng build --env=prod` then `environment.prod.ts` will be used instead. -// The list of which env maps to which file can be found in `.angular-cli.json`. - -export const environment = { - production: false -}; diff --git a/dashboard/src/index.html b/dashboard/src/index.html deleted file mode 100644 index ebb96da59..000000000 --- a/dashboard/src/index.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - OpenSDS - - - - - - - - - - - diff --git a/dashboard/src/main.ts b/dashboard/src/main.ts deleted file mode 100644 index a9ca1caf8..000000000 --- a/dashboard/src/main.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { enableProdMode } from '@angular/core'; -import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; - -import { AppModule } from './app/app.module'; -import { environment } from './environments/environment'; - -if (environment.production) { - enableProdMode(); -} - -platformBrowserDynamic().bootstrapModule(AppModule); diff --git a/dashboard/src/polyfills.ts b/dashboard/src/polyfills.ts deleted file mode 100644 index 49bdde6fc..000000000 --- a/dashboard/src/polyfills.ts +++ /dev/null @@ -1,73 +0,0 @@ -/** - * This file includes polyfills needed by Angular and is loaded before the app. - * You can add your own extra polyfills to this file. - * - * This file is divided into 2 sections: - * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. - * 2. Application imports. Files imported after ZoneJS that should be loaded before your main - * file. - * - * The current setup is for so-called "evergreen" browsers; the last versions of browsers that - * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), - * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. - * - * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html - */ - -/*************************************************************************************************** - * BROWSER POLYFILLS - */ - -/** IE9, IE10 and IE11 requires all of the following polyfills. **/ -import 'core-js/es6/symbol'; -import 'core-js/es6/object'; -import 'core-js/es6/function'; -import 'core-js/es6/parse-int'; -import 'core-js/es6/parse-float'; -import 'core-js/es6/number'; -import 'core-js/es6/math'; -import 'core-js/es6/string'; -import 'core-js/es6/date'; -import 'core-js/es6/array'; -import 'core-js/es6/regexp'; -import 'core-js/es6/map'; -import 'core-js/es6/weak-map'; -import 'core-js/es6/set'; - -/** IE10 and IE11 requires the following for NgClass support on SVG elements */ -// import 'classlist.js'; // Run `npm install --save classlist.js`. - -/** IE10 and IE11 requires the following to support `@angular/animation`. */ -import 'web-animations-js'; // Run `npm install --save web-animations-js`. - - -/** Evergreen browsers require these. **/ -import 'core-js/es6/reflect'; -import 'core-js/es7/reflect'; - - -/** ALL Firefox browsers require the following to support `@angular/animation`. **/ -// import 'web-animations-js'; // Run `npm install --save web-animations-js`. - - - -/*************************************************************************************************** - * Zone JS is required by Angular itself. - */ -import 'zone.js/dist/zone'; // Included with Angular CLI. - - - -/*************************************************************************************************** - * APPLICATION IMPORTS - */ - -/** - * Date, currency, decimal and percent pipes. - * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10 - */ -import 'intl'; // Run `npm install --save intl`. -/** - * Need to import at least one locale-data with intl. - */ -import 'intl/locale-data/jsonp/en'; diff --git a/dashboard/src/styles.scss b/dashboard/src/styles.scss deleted file mode 100644 index b40462900..000000000 --- a/dashboard/src/styles.scss +++ /dev/null @@ -1,3 +0,0 @@ -@import './assets/components/themes/default/default.scss'; -@import './assets/business/css/primeng.scss'; -@import './assets/business/css/site.scss'; diff --git a/dashboard/src/test.ts b/dashboard/src/test.ts deleted file mode 100644 index cd612eeb0..000000000 --- a/dashboard/src/test.ts +++ /dev/null @@ -1,32 +0,0 @@ -// This file is required by karma.conf.js and loads recursively all the .spec and framework files - -import 'zone.js/dist/long-stack-trace-zone'; -import 'zone.js/dist/proxy.js'; -import 'zone.js/dist/sync-test'; -import 'zone.js/dist/jasmine-patch'; -import 'zone.js/dist/async-test'; -import 'zone.js/dist/fake-async-test'; -import { getTestBed } from '@angular/core/testing'; -import { - BrowserDynamicTestingModule, - platformBrowserDynamicTesting -} from '@angular/platform-browser-dynamic/testing'; - -// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any. -declare const __karma__: any; -declare const require: any; - -// Prevent Karma from running prematurely. -__karma__.loaded = function () {}; - -// First, initialize the Angular testing environment. -getTestBed().initTestEnvironment( - BrowserDynamicTestingModule, - platformBrowserDynamicTesting() -); -// Then we find all the tests. -const context = require.context('./', true, /\.spec\.ts$/); -// And load the modules. -context.keys().map(context); -// Finally, start Karma to run the tests. -__karma__.start(); diff --git a/dashboard/src/tsconfig.app.json b/dashboard/src/tsconfig.app.json deleted file mode 100644 index 5e2507db5..000000000 --- a/dashboard/src/tsconfig.app.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "outDir": "../out-tsc/app", - "module": "es2015", - "baseUrl": "", - "types": [] - }, - "exclude": [ - "test.ts", - "**/*.spec.ts" - ] -} diff --git a/dashboard/src/tsconfig.spec.json b/dashboard/src/tsconfig.spec.json deleted file mode 100644 index 510e3f1fd..000000000 --- a/dashboard/src/tsconfig.spec.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "outDir": "../out-tsc/spec", - "module": "commonjs", - "target": "es5", - "baseUrl": "", - "types": [ - "jasmine", - "node" - ] - }, - "files": [ - "test.ts" - ], - "include": [ - "**/*.spec.ts", - "**/*.d.ts" - ] -} diff --git a/dashboard/src/typings.d.ts b/dashboard/src/typings.d.ts deleted file mode 100644 index 4999a068d..000000000 --- a/dashboard/src/typings.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* SystemJS module definition */ -declare var module: NodeModule; - -declare var require: any; - -interface NodeModule { - id: string; -} diff --git a/dashboard/src/upload.php b/dashboard/src/upload.php deleted file mode 100644 index b87a10417..000000000 --- a/dashboard/src/upload.php +++ /dev/null @@ -1 +0,0 @@ - Fake Upload Process

        '; ?> \ No newline at end of file diff --git a/dashboard/tsconfig-aot.json b/dashboard/tsconfig-aot.json deleted file mode 100644 index 41466c267..000000000 --- a/dashboard/tsconfig-aot.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "outDir": "components", - "rootDir": "src/app/components", - "target": "es5", - "module": "es2015", - "baseUrl": "src", - "moduleResolution": "node", - "sourceMap": true, - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "removeComments": false, - "noImplicitAny": false, - "suppressImplicitAnyIndexErrors": true, - "lib": ["dom","es6"] - }, - "include": [ - "src/app/components/**/*" - ], - "angularCompilerOptions": { - "genDir": "aot", - "skipMetadataEmit" : false - } -} \ No newline at end of file diff --git a/dashboard/tsconfig-release.json b/dashboard/tsconfig-release.json deleted file mode 100644 index 72ddd76b1..000000000 --- a/dashboard/tsconfig-release.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compileOnSave": false, - "compilerOptions": { - "outDir": "./components", - "baseUrl": "src", - "rootDir": "src/app/components", - "sourceMap": true, - "declaration": true, - "moduleResolution": "node", - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "target": "es5", - "typeRoots": [ - "node_modules/@types" - ], - "lib": [ - "es2016", - "dom" - ] - }, - "include": [ - "src/app/components/**/*" - ] -} diff --git a/dashboard/tsconfig.json b/dashboard/tsconfig.json deleted file mode 100644 index a35a8ee3a..000000000 --- a/dashboard/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compileOnSave": false, - "compilerOptions": { - "outDir": "./dist/out-tsc", - "baseUrl": "src", - "sourceMap": true, - "declaration": false, - "moduleResolution": "node", - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "target": "es5", - "typeRoots": [ - "node_modules/@types" - ], - "lib": [ - "es2016", - "dom" - ] - } -} diff --git a/dashboard/tslint.json b/dashboard/tslint.json deleted file mode 100644 index 0db5751c7..000000000 --- a/dashboard/tslint.json +++ /dev/null @@ -1,142 +0,0 @@ -{ - "rulesDirectory": [ - "node_modules/codelyzer" - ], - "rules": { - "arrow-return-shorthand": true, - "callable-types": true, - "class-name": true, - "comment-format": [ - true, - "check-space" - ], - "curly": true, - "eofline": true, - "forin": true, - "import-blacklist": [ - true, - "rxjs" - ], - "import-spacing": true, - "indent": [ - true, - "spaces" - ], - "interface-over-type-literal": true, - "label-position": true, - "max-line-length": [ - true, - 140 - ], - "member-access": false, - "member-ordering": [ - true, - { - "order": [ - "static-field", - "instance-field", - "static-method", - "instance-method" - ] - } - ], - "no-arg": true, - "no-bitwise": true, - "no-console": [ - true, - "debug", - "info", - "time", - "timeEnd", - "trace" - ], - "no-construct": true, - "no-debugger": true, - "no-duplicate-super": true, - "no-empty": false, - "no-empty-interface": true, - "no-eval": true, - "no-inferrable-types": [ - true, - "ignore-params" - ], - "no-misused-new": true, - "no-non-null-assertion": true, - "no-shadowed-variable": true, - "no-string-literal": false, - "no-string-throw": true, - "no-switch-case-fall-through": true, - "no-trailing-whitespace": true, - "no-unnecessary-initializer": true, - "no-unused-expression": true, - "no-use-before-declare": true, - "no-var-keyword": true, - "object-literal-sort-keys": false, - "one-line": [ - true, - "check-open-brace", - "check-catch", - "check-else", - "check-whitespace" - ], - "prefer-const": true, - "quotemark": [ - true, - "single" - ], - "radix": true, - "semicolon": [ - true, - "always" - ], - "triple-equals": [ - true, - "allow-null-check" - ], - "typedef-whitespace": [ - true, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - } - ], - "typeof-compare": true, - "unified-signatures": true, - "variable-name": false, - "whitespace": [ - true, - "check-branch", - "check-decl", - "check-operator", - "check-separator", - "check-type" - ], - "directive-selector": [ - true, - "attribute", - "app", - "camelCase" - ], - "component-selector": [ - true, - "element", - "app", - "kebab-case" - ], - "use-input-property-decorator": true, - "use-output-property-decorator": true, - "use-host-property-decorator": true, - "no-input-rename": true, - "no-output-rename": true, - "use-life-cycle-interface": true, - "use-pipe-transform-interface": true, - "component-class-suffix": true, - "directive-class-suffix": true, - "no-access-missing-member": true, - "templates-use-public": true, - "invoke-injectable": true - } -} diff --git a/openapi-spec/swagger.yaml b/openapi-spec/swagger.yaml index 58bb18dd8..6381f25d9 100755 --- a/openapi-spec/swagger.yaml +++ b/openapi-spec/swagger.yaml @@ -1470,13 +1470,12 @@ definitions: type: string poolId: type: string - readOnly: true - SnapshotId: + snapshotId: type: string - readOnly: true groupId: - type: string - readOnly: true + type: string + snapshotFromCloud: + type: boolean Attachment: description: >- Attachment is a description of volume attached resource. diff --git a/osdsctl/cli/cli.go b/osdsctl/cli/cli.go index 060b59c03..da87fe305 100644 --- a/osdsctl/cli/cli.go +++ b/osdsctl/cli/cli.go @@ -54,17 +54,27 @@ func init() { flags.BoolVar(&Debug, "debug", false, "shows debugging output.") } -type Writer struct{} +type DummyWriter struct{} // do nothing -func (writer Writer) Write(data []byte) (n int, err error) { +func (writer DummyWriter) Write(data []byte) (n int, err error) { + return len(data), nil +} + +type DebugWriter struct{} + +// do nothing +func (writer DebugWriter) Write(data []byte) (n int, err error) { + Debugf("%s", string(data)) return len(data), nil } // Run method indicates how to start a cli tool through cobra. func Run() error { if !utils.Contained("--debug", os.Args) { - log.SetOutput(Writer{}) + log.SetOutput(DummyWriter{}) + } else { + log.SetOutput(DebugWriter{}) } ep, ok := os.LookupEnv(c.OpensdsEndpoint) diff --git a/osdsctl/cli/common.go b/osdsctl/cli/common.go index 87ea347e3..01ff8a333 100644 --- a/osdsctl/cli/common.go +++ b/osdsctl/cli/common.go @@ -15,7 +15,6 @@ package cli import ( - "encoding/json" "fmt" "os" @@ -97,10 +96,3 @@ func ArgsNumCheck(cmd *cobra.Command, args []string, invalidNum int) { os.Exit(1) } } - -func PrintResponse(v interface{}) { - if Debug { - b, _ := json.Marshal(v) - Debugln(string(b)) - } -} diff --git a/osdsctl/cli/dock.go b/osdsctl/cli/dock.go index 8d4575b34..fbf8ad9eb 100644 --- a/osdsctl/cli/dock.go +++ b/osdsctl/cli/dock.go @@ -83,7 +83,6 @@ func dockAction(cmd *cobra.Command, args []string) { func dockShowAction(cmd *cobra.Command, args []string) { ArgsNumCheck(cmd, args, 1) resp, err := client.GetDock(args[0]) - PrintResponse(resp) if err != nil { Fatalln(HttpErrStrip(err)) } @@ -99,7 +98,6 @@ func dockListAction(cmd *cobra.Command, args []string) { "Endpoint": dockEndpoint, "Status": dockStatus, "StorageType": dockStorageType} resp, err := client.ListDocks(opts) - PrintResponse(resp) if err != nil { Fatalln(HttpErrStrip(err)) } diff --git a/osdsctl/cli/profile.go b/osdsctl/cli/profile.go index b069af4e3..de9428260 100644 --- a/osdsctl/cli/profile.go +++ b/osdsctl/cli/profile.go @@ -100,7 +100,6 @@ func profileCreateAction(cmd *cobra.Command, args []string) { } resp, err := client.CreateProfile(prf) - PrintResponse(resp) if err != nil { Fatalln(HttpErrStrip(err)) } @@ -111,7 +110,6 @@ func profileCreateAction(cmd *cobra.Command, args []string) { func profileShowAction(cmd *cobra.Command, args []string) { ArgsNumCheck(cmd, args, 1) resp, err := client.GetProfile(args[0]) - PrintResponse(resp) if err != nil { Fatalln(HttpErrStrip(err)) } @@ -126,7 +124,6 @@ func profileListAction(cmd *cobra.Command, args []string) { "Name": profName, "Description": profDescription, "StorageType": profStorageType} resp, err := client.ListProfiles(opts) - PrintResponse(resp) if err != nil { Fatalln(HttpErrStrip(err)) } diff --git a/osdsctl/cli/replication.go b/osdsctl/cli/replication.go index 0089498cd..bb43ed6cf 100644 --- a/osdsctl/cli/replication.go +++ b/osdsctl/cli/replication.go @@ -195,7 +195,6 @@ func replicationCreateAction(cmd *cobra.Command, args []string) { } resp, err := client.CreateReplication(replica) - PrintResponse(resp) if err != nil { Fatalln(HttpErrStrip(err)) } @@ -208,7 +207,6 @@ func replicationCreateAction(cmd *cobra.Command, args []string) { func replicationShowAction(cmd *cobra.Command, args []string) { ArgsNumCheck(cmd, args, 1) resp, err := client.GetReplication(args[0]) - PrintResponse(resp) if err != nil { Fatalln(HttpErrStrip(err)) } @@ -227,7 +225,6 @@ func replicationListAction(cmd *cobra.Command, args []string) { "SecondaryVolumeId": repSecondaryVolumeId} resp, err := client.ListReplications(opts) - PrintResponse(resp) if err != nil { Fatalln(HttpErrStrip(err)) } @@ -244,7 +241,6 @@ func replicationUpdateAction(cmd *cobra.Command, args []string) { } resp, err := client.UpdateReplication(args[0], replica) - PrintResponse(resp) if err != nil { Fatalln(HttpErrStrip(err)) } diff --git a/osdsctl/cli/version.go b/osdsctl/cli/version.go index 67a114390..6e2a8c898 100644 --- a/osdsctl/cli/version.go +++ b/osdsctl/cli/version.go @@ -56,7 +56,6 @@ func versionAction(cmd *cobra.Command, args []string) { func versionShowAction(cmd *cobra.Command, args []string) { ArgsNumCheck(cmd, args, 1) resp, err := client.GetVersion(args[0]) - PrintResponse(resp) if err != nil { Fatalln(HttpErrStrip(err)) } @@ -67,7 +66,6 @@ func versionShowAction(cmd *cobra.Command, args []string) { func versionListAction(cmd *cobra.Command, args []string) { ArgsNumCheck(cmd, args, 0) resp, err := client.ListVersions() - PrintResponse(resp) if err != nil { Fatalln(HttpErrStrip(err)) } diff --git a/osdsctl/cli/volume.go b/osdsctl/cli/volume.go index 69df03670..ad8d21640 100644 --- a/osdsctl/cli/volume.go +++ b/osdsctl/cli/volume.go @@ -78,17 +78,18 @@ var ( ) var ( - volLimit string - volOffset string - volSortDir string - volSortKey string - volId string - volTenantId string - volUserId string - volStatus string - volPoolId string - volProfileId string - volGroupId string + volLimit string + volOffset string + volSortDir string + volSortKey string + volId string + volTenantId string + volUserId string + volStatus string + volPoolId string + volProfileId string + volGroupId string + snapshotFromCloud bool ) func init() { @@ -115,6 +116,7 @@ func init() { volumeCreateCommand.Flags().StringVarP(&volDesp, "description", "d", "", "the description of created volume") volumeCreateCommand.Flags().StringVarP(&volAz, "az", "a", "", "the availability zone of created volume") volumeCreateCommand.Flags().StringVarP(&volSnap, "snapshot", "s", "", "the snapshot to create volume") + volumeCreateCommand.Flags().BoolVarP(&snapshotFromCloud, "snapshotFromCloud", "c", false, "download snapshot from cloud") volumeCommand.AddCommand(volumeShowCommand) volumeCommand.AddCommand(volumeListCommand) volumeCommand.AddCommand(volumeDeleteCommand) @@ -141,16 +143,16 @@ func volumeCreateAction(cmd *cobra.Command, args []string) { } vol := &model.VolumeSpec{ - Name: volName, - Description: volDesp, - AvailabilityZone: volAz, - Size: int64(size), - ProfileId: profileId, - SnapshotId: volSnap, + Name: volName, + Description: volDesp, + AvailabilityZone: volAz, + Size: int64(size), + ProfileId: profileId, + SnapshotId: volSnap, + SnapshotFromCloud: snapshotFromCloud, } resp, err := client.CreateVolume(vol) - PrintResponse(resp) if err != nil { Fatalln(HttpErrStrip(err)) } @@ -163,7 +165,6 @@ func volumeCreateAction(cmd *cobra.Command, args []string) { func volumeShowAction(cmd *cobra.Command, args []string) { ArgsNumCheck(cmd, args, 1) resp, err := client.GetVolume(args[0]) - PrintResponse(resp) if err != nil { Fatalln(HttpErrStrip(err)) } @@ -181,7 +182,6 @@ func volumeListAction(cmd *cobra.Command, args []string) { "Status": volStatus, "PoolId": volPoolId, "ProfileId": volProfileId, "GroupId": volGroupId} resp, err := client.ListVolumes(opts) - PrintResponse(resp) if err != nil { Fatalln(HttpErrStrip(err)) } @@ -209,7 +209,6 @@ func volumeUpdateAction(cmd *cobra.Command, args []string) { } resp, err := client.UpdateVolume(args[0], vol) - PrintResponse(resp) if err != nil { Fatalln(HttpErrStrip(err)) } @@ -230,7 +229,6 @@ func volumeExtendAction(cmd *cobra.Command, args []string) { } resp, err := client.ExtendVolume(args[0], body) - PrintResponse(resp) if err != nil { Fatalln(HttpErrStrip(err)) } diff --git a/osdsctl/cli/volumeattachment.go b/osdsctl/cli/volumeattachment.go index 33d1841e7..db7b5d007 100644 --- a/osdsctl/cli/volumeattachment.go +++ b/osdsctl/cli/volumeattachment.go @@ -110,7 +110,6 @@ func volumeAttachmentCreateAction(cmd *cobra.Command, args []string) { os.Exit(1) } resp, err := client.CreateVolumeAttachment(attachment) - PrintResponse(resp) if err != nil { Fatalln(HttpErrStrip(err)) } @@ -122,7 +121,6 @@ func volumeAttachmentCreateAction(cmd *cobra.Command, args []string) { func volumeAttachmentShowAction(cmd *cobra.Command, args []string) { ArgsNumCheck(cmd, args, 1) resp, err := client.GetVolumeAttachment(args[0]) - PrintResponse(resp) if err != nil { Fatalln(HttpErrStrip(err)) } @@ -140,7 +138,6 @@ func volumeAttachmentListAction(cmd *cobra.Command, args []string) { "Status": volAtmStatus, "Mountpoint": volAtmMountpoint} resp, err := client.ListVolumeAttachments(opts) - PrintResponse(resp) if err != nil { Fatalln(HttpErrStrip(err)) } @@ -167,7 +164,6 @@ func volumeAttachmentUpdateAction(cmd *cobra.Command, args []string) { } resp, err := client.UpdateVolumeAttachment(args[0], attachment) - PrintResponse(resp) if err != nil { Fatalln(HttpErrStrip(err)) } diff --git a/osdsctl/cli/volumegroup.go b/osdsctl/cli/volumegroup.go index 0cc314876..c74f7c538 100644 --- a/osdsctl/cli/volumegroup.go +++ b/osdsctl/cli/volumegroup.go @@ -126,7 +126,6 @@ func volumeGroupCreateAction(cmd *cobra.Command, args []string) { } resp, err := client.CreateVolumeGroup(vg) - PrintResponse(resp) if err != nil { Fatalln(HttpErrStrip(err)) } @@ -137,7 +136,6 @@ func volumeGroupCreateAction(cmd *cobra.Command, args []string) { func volumeGroupShowAction(cmd *cobra.Command, args []string) { ArgsNumCheck(cmd, args, 1) resp, err := client.GetVolumeGroup(args[0]) - PrintResponse(resp) if err != nil { Fatalln(HttpErrStrip(err)) } @@ -154,7 +152,6 @@ func volumeGroupListAction(cmd *cobra.Command, args []string) { "Status": vgStatus, "PoolId": vgPoolId} resp, err := client.ListVolumeGroups(opts) - PrintResponse(resp) if err != nil { Fatalln(HttpErrStrip(err)) } @@ -181,7 +178,6 @@ func volumeGroupUpdateAction(cmd *cobra.Command, args []string) { } resp, err := client.UpdateVolumeGroup(args[0], snp) - PrintResponse(resp) if err != nil { Fatalln(HttpErrStrip(err)) } diff --git a/osdsctl/cli/volumesnapshot.go b/osdsctl/cli/volumesnapshot.go index adf78a392..463d11493 100644 --- a/osdsctl/cli/volumesnapshot.go +++ b/osdsctl/cli/volumesnapshot.go @@ -119,7 +119,6 @@ func volumeSnapshotCreateAction(cmd *cobra.Command, args []string) { } resp, err := client.CreateVolumeSnapshot(snp) - PrintResponse(resp) if err != nil { Fatalln(HttpErrStrip(err)) } @@ -130,7 +129,6 @@ func volumeSnapshotCreateAction(cmd *cobra.Command, args []string) { func volumeSnapshotShowAction(cmd *cobra.Command, args []string) { ArgsNumCheck(cmd, args, 1) resp, err := client.GetVolumeSnapshot(args[0]) - PrintResponse(resp) if err != nil { Fatalln(HttpErrStrip(err)) } @@ -147,7 +145,6 @@ func volumeSnapshotListAction(cmd *cobra.Command, args []string) { "Status": volSnapStatus, "VolumeId": volSnapVolumeId} resp, err := client.ListVolumeSnapshots(opts) - PrintResponse(resp) if err != nil { Fatalln(HttpErrStrip(err)) } @@ -172,7 +169,6 @@ func volumeSnapshotUpdateAction(cmd *cobra.Command, args []string) { } resp, err := client.UpdateVolumeSnapshot(args[0], snp) - PrintResponse(resp) if err != nil { Fatalln(HttpErrStrip(err)) } diff --git a/pkg/api/db.go b/pkg/api/db.go index 2ecc9d7da..1be2bdebc 100644 --- a/pkg/api/db.go +++ b/pkg/api/db.go @@ -72,14 +72,15 @@ func CreateVolumeDBEntry(ctx *c.Context, in *model.VolumeSpec) (*model.VolumeSpe Id: in.Id, CreatedAt: in.CreatedAt, }, - UserId: ctx.UserId, - Name: in.Name, - Description: in.Description, - ProfileId: in.ProfileId, - Size: in.Size, - AvailabilityZone: in.AvailabilityZone, - Status: model.VolumeCreating, - SnapshotId: in.SnapshotId, + UserId: ctx.UserId, + Name: in.Name, + Description: in.Description, + ProfileId: in.ProfileId, + Size: in.Size, + AvailabilityZone: in.AvailabilityZone, + Status: model.VolumeCreating, + SnapshotId: in.SnapshotId, + SnapshotFromCloud: in.SnapshotFromCloud, } result, err := db.C.CreateVolume(ctx, vol) if err != nil { diff --git a/pkg/api/filter/accesslog/accesslog.go b/pkg/api/filter/accesslog/accesslog.go new file mode 100644 index 000000000..7ed845864 --- /dev/null +++ b/pkg/api/filter/accesslog/accesslog.go @@ -0,0 +1,29 @@ +// Copyright (c) 2017 Huawei Technologies Co., Ltd. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package accesslog + +import ( + "github.com/astaxie/beego" + bctx "github.com/astaxie/beego/context" + "github.com/golang/glog" +) + +func Factory() beego.FilterFunc { + return func(httpCtx *bctx.Context) { + r := httpCtx.Request + glog.Infof("\033[32m[D] %s -- %s %s\033[0m\n", r.RemoteAddr, r.Method, + r.URL) + } +} diff --git a/pkg/api/router.go b/pkg/api/router.go index 54d171bac..40611683c 100755 --- a/pkg/api/router.go +++ b/pkg/api/router.go @@ -25,6 +25,7 @@ import ( "github.com/astaxie/beego" bctx "github.com/astaxie/beego/context" + "github.com/opensds/opensds/pkg/api/filter/accesslog" "github.com/opensds/opensds/pkg/api/filter/auth" "github.com/opensds/opensds/pkg/api/filter/context" "github.com/opensds/opensds/pkg/utils/constants" @@ -103,6 +104,7 @@ func Run(host string) { pattern := fmt.Sprintf("/%s/*", constants.APIVersion) beego.InsertFilter(pattern, beego.BeforeExec, context.Factory()) beego.InsertFilter(pattern, beego.BeforeExec, auth.Factory()) + beego.InsertFilter("*", beego.BeforeExec, accesslog.Factory()) beego.AddNamespace(ns) // add router for api version diff --git a/pkg/api/volume.go b/pkg/api/volume.go index ae27da59f..f6edc51fa 100755 --- a/pkg/api/volume.go +++ b/pkg/api/volume.go @@ -51,7 +51,6 @@ func (this *VolumePortal) CreateVolume() { log.Error(reason) return } - // NOTE:It will create a volume entry into the database and initialize its status // as "creating". It will not wait for the real volume creation to complete // and will return result immediately. diff --git a/pkg/controller/controller.go b/pkg/controller/controller.go index 64b29bfe6..d0a73cdf2 100755 --- a/pkg/controller/controller.go +++ b/pkg/controller/controller.go @@ -106,6 +106,9 @@ func (c *Controller) CreateVolume(ctx *c.Context, in *model.VolumeSpec, errchanV } snapSize = snapVol.Size in.PoolId = snapVol.PoolId + if in.SnapshotFromCloud { + in.Metadata = utils.MergeStringMaps(in.Metadata, snap.Metadata) + } } polInfo, err := c.selector.SelectSupportedPoolForVolume(in) @@ -130,18 +133,20 @@ func (c *Controller) CreateVolume(ctx *c.Context, in *model.VolumeSpec, errchanV } c.volumeController.SetDock(dockInfo) opt := &pb.CreateVolumeOpts{ - Id: in.Id, - Name: in.Name, - Description: in.Description, - Size: in.Size, - AvailabilityZone: in.AvailabilityZone, - PoolId: polInfo.Id, - ProfileId: prf.Id, - SnapshotId: in.SnapshotId, - SnapshotSize: snapSize, - PoolName: polInfo.Name, - DriverName: dockInfo.DriverName, - Context: ctx.ToJson(), + Id: in.Id, + Name: in.Name, + Description: in.Description, + Size: in.Size, + AvailabilityZone: in.AvailabilityZone, + PoolId: polInfo.Id, + ProfileId: prf.Id, + SnapshotId: in.SnapshotId, + SnapshotSize: snapSize, + PoolName: polInfo.Name, + DriverName: dockInfo.DriverName, + Context: ctx.ToJson(), + Metadata: in.Metadata, + SnapshotFromCloud: in.SnapshotFromCloud, } result, err := c.volumeController.CreateVolume(opt) diff --git a/pkg/dock/discovery/discovery.go b/pkg/dock/discovery/discovery.go index 485eaecd0..b3708db71 100755 --- a/pkg/dock/discovery/discovery.go +++ b/pkg/dock/discovery/discovery.go @@ -23,10 +23,11 @@ import ( "fmt" "os" "runtime" - "time" "strings" + "time" log "github.com/golang/glog" + "github.com/opensds/opensds/contrib/connector" "github.com/opensds/opensds/contrib/connector/fc" "github.com/opensds/opensds/contrib/connector/iscsi" "github.com/opensds/opensds/contrib/drivers" @@ -214,7 +215,7 @@ func (add *attachDockDiscoverer) Discover() error { bindIp := CONF.BindIp if bindIp == "" { - bindIp = iscsi.GetHostIp() + bindIp = connector.GetHostIp() } wwpns, _ := fc.GetWWPNs() segments := strings.Split(CONF.OsdsDock.ApiEndpoint, ":") diff --git a/pkg/dock/proto/dock.pb.go b/pkg/dock/proto/dock.pb.go index 81062def2..cec0addd6 100644 --- a/pkg/dock/proto/dock.pb.go +++ b/pkg/dock/proto/dock.pb.go @@ -86,6 +86,8 @@ type CreateVolumeOpts struct { ReplicationId string `protobuf:"bytes,14,opt,name=replicationId" json:"replicationId,omitempty"` // The size of snapshot SnapshotSize int64 `protobuf:"varint,15,opt,name=snapshotSize" json:"snapshotSize,omitempty"` + // Down load snapshot from cloud + SnapshotFromCloud bool `protobuf:"varint,16,opt,name=snapshotFromCloud" json:"snapshotFromCloud,omitempty"` } func (m *CreateVolumeOpts) Reset() { *m = CreateVolumeOpts{} } @@ -198,6 +200,13 @@ func (m *CreateVolumeOpts) GetSnapshotSize() int64 { return 0 } +func (m *CreateVolumeOpts) GetSnapshotFromCloud() bool { + if m != nil { + return m.SnapshotFromCloud + } + return false +} + // DeleteVolumeOpts is a structure which indicates all required properties // for deleting a volume. type DeleteVolumeOpts struct { @@ -2850,114 +2859,115 @@ var _AttachDock_serviceDesc = grpc.ServiceDesc{ func init() { proto1.RegisterFile("dock.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 1729 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x5a, 0xcd, 0x73, 0xdc, 0xc4, - 0x12, 0xcf, 0x4a, 0x5e, 0xef, 0x6e, 0xfb, 0x6b, 0x3d, 0xb6, 0x13, 0xd5, 0xc6, 0xf1, 0xf3, 0xdb, - 0x97, 0x97, 0xf2, 0x4b, 0xf2, 0x0c, 0x59, 0xa8, 0x0a, 0x1f, 0xc5, 0x87, 0x8d, 0x9d, 0x78, 0x8b, - 0x98, 0x38, 0x0a, 0xe4, 0xc0, 0x4d, 0x91, 0x26, 0x58, 0x65, 0xad, 0x46, 0x25, 0xc9, 0x9b, 0x98, - 0x13, 0x15, 0x38, 0x04, 0x8e, 0xdc, 0x38, 0x52, 0x1c, 0x38, 0xf1, 0x4f, 0x50, 0x14, 0x7f, 0x00, - 0x55, 0xdc, 0x72, 0xe0, 0x4a, 0x15, 0x7f, 0x42, 0x0e, 0x94, 0x66, 0x24, 0x59, 0x1f, 0xa3, 0x59, - 0x99, 0xb5, 0x1d, 0xa7, 0xe2, 0xd3, 0xae, 0x7a, 0x46, 0x3d, 0xdd, 0xbf, 0xee, 0x5f, 0x8f, 0x34, - 0x6a, 0x00, 0x83, 0xe8, 0x3b, 0xcb, 0x8e, 0x4b, 0x7c, 0x82, 0xaa, 0xf4, 0xa7, 0xfd, 0x73, 0x15, - 0x9a, 0x1f, 0xb8, 0x58, 0xf3, 0xf1, 0x3d, 0x62, 0xed, 0xf6, 0xf0, 0x6d, 0xc7, 0xf7, 0xd0, 0x24, - 0x48, 0xa6, 0xa1, 0x54, 0x16, 0x2b, 0x4b, 0x0d, 0x55, 0x32, 0x0d, 0x84, 0x60, 0xc4, 0xd6, 0x7a, - 0x58, 0x91, 0xa8, 0x84, 0xfe, 0x0f, 0x64, 0x9e, 0xf9, 0x39, 0x56, 0xe4, 0xc5, 0xca, 0x92, 0xac, - 0xd2, 0xff, 0x68, 0x11, 0xc6, 0x0c, 0xec, 0xe9, 0xae, 0xe9, 0xf8, 0x26, 0xb1, 0x95, 0x11, 0x3a, - 0x3d, 0x29, 0x42, 0x0b, 0x00, 0x9e, 0xad, 0x39, 0xde, 0x36, 0xf1, 0xbb, 0x86, 0x52, 0xa5, 0x13, - 0x12, 0x12, 0x74, 0x19, 0x9a, 0x5a, 0x5f, 0x33, 0x2d, 0xed, 0xbe, 0x69, 0x99, 0xfe, 0xde, 0xa7, - 0xc4, 0xc6, 0xca, 0x28, 0x9d, 0x95, 0x93, 0xa3, 0x79, 0x68, 0x38, 0x2e, 0x79, 0x60, 0x5a, 0xb8, - 0x6b, 0x28, 0x35, 0x3a, 0x69, 0x5f, 0x80, 0xce, 0xc2, 0xa8, 0x43, 0x88, 0xd5, 0x35, 0x94, 0x3a, - 0x1d, 0x0a, 0xaf, 0x50, 0x0b, 0xea, 0xc1, 0xbf, 0x8f, 0x02, 0x7f, 0x1a, 0x74, 0x24, 0xbe, 0x46, - 0x2b, 0x50, 0xef, 0x61, 0x5f, 0x33, 0x34, 0x5f, 0x53, 0x60, 0x51, 0x5e, 0x1a, 0xeb, 0xfc, 0x97, - 0xa1, 0xb5, 0x9c, 0x85, 0x68, 0x79, 0x33, 0x9c, 0xb7, 0x6e, 0xfb, 0xee, 0x9e, 0x1a, 0xdf, 0x16, - 0x38, 0x68, 0xb8, 0x66, 0x1f, 0xbb, 0x74, 0x81, 0x31, 0xe6, 0xe0, 0xbe, 0x04, 0x29, 0x50, 0xd3, - 0x89, 0xed, 0xe3, 0x47, 0xbe, 0x32, 0x4e, 0x07, 0xa3, 0x4b, 0xb4, 0x0d, 0x73, 0x2e, 0x76, 0x2c, - 0x53, 0xd7, 0x02, 0xa4, 0xd6, 0xe8, 0x2d, 0x6b, 0x81, 0x25, 0x13, 0xd4, 0x92, 0x4e, 0x91, 0x25, - 0x2a, 0xef, 0x26, 0x66, 0x16, 0x5f, 0x21, 0xba, 0x08, 0x13, 0x89, 0x81, 0xae, 0xa1, 0x4c, 0x52, - 0x4b, 0xd2, 0x42, 0xd4, 0x86, 0xf1, 0x28, 0x30, 0x77, 0x83, 0x40, 0x4f, 0xd1, 0x40, 0xa7, 0x64, - 0xad, 0xb7, 0x61, 0x22, 0x05, 0x04, 0x6a, 0x82, 0xbc, 0x83, 0xf7, 0xc2, 0xd4, 0x09, 0xfe, 0xa2, - 0x59, 0xa8, 0xf6, 0x35, 0x6b, 0x37, 0x4a, 0x1e, 0x76, 0xf1, 0x96, 0xf4, 0x46, 0xa5, 0xb5, 0x01, - 0xad, 0x62, 0xdb, 0x0f, 0xa2, 0xa9, 0xfd, 0xb4, 0x02, 0xcd, 0x35, 0x6c, 0x61, 0x61, 0x12, 0x27, - 0x83, 0x2b, 0xa5, 0x82, 0x9b, 0xbd, 0xb5, 0x64, 0x70, 0x65, 0x51, 0x70, 0x47, 0x52, 0xc1, 0x1d, - 0x0a, 0xa8, 0xf6, 0x2f, 0x32, 0x34, 0xd7, 0x1f, 0xf9, 0xd8, 0x36, 0x4e, 0x39, 0x2a, 0xe0, 0x68, - 0x16, 0xa2, 0xc3, 0xe7, 0xe8, 0x70, 0x61, 0xfc, 0x4d, 0x02, 0x25, 0xc9, 0xde, 0xbb, 0x21, 0xa4, - 0x47, 0x1c, 0xce, 0x16, 0xd4, 0xfb, 0x74, 0xbd, 0x38, 0x98, 0xf1, 0x35, 0xea, 0x26, 0xc0, 0x1c, - 0xa5, 0x60, 0xfe, 0x9f, 0x53, 0x66, 0x92, 0x86, 0x96, 0x04, 0xb5, 0x26, 0x02, 0xb5, 0x7e, 0x88, - 0xa0, 0x3e, 0x91, 0x40, 0x49, 0xf2, 0x57, 0x08, 0x6a, 0x12, 0x0a, 0x49, 0x00, 0x85, 0x9c, 0x82, - 0xa2, 0x48, 0x7d, 0x49, 0x28, 0x46, 0x44, 0x50, 0x54, 0x0f, 0x11, 0x8a, 0xef, 0x64, 0x98, 0x65, - 0x61, 0x5b, 0xf1, 0x7d, 0x4d, 0xdf, 0xee, 0x61, 0xfb, 0xe0, 0x30, 0x5c, 0x84, 0x09, 0x83, 0xdc, - 0x22, 0xba, 0x66, 0x31, 0x25, 0x34, 0xd9, 0xea, 0x6a, 0x5a, 0x18, 0xd0, 0xba, 0xb7, 0x6b, 0xf9, - 0xe6, 0x96, 0xe6, 0x6f, 0x53, 0x07, 0xeb, 0xea, 0xbe, 0x00, 0x5d, 0x81, 0xfa, 0x36, 0xf1, 0xfc, - 0xae, 0xfd, 0x80, 0x50, 0x07, 0xc7, 0x3a, 0x53, 0x21, 0x94, 0x1b, 0xa1, 0x58, 0x8d, 0x27, 0xa0, - 0xf5, 0x5c, 0x0a, 0xfe, 0x2f, 0x95, 0x82, 0x69, 0x5f, 0x0e, 0x3f, 0xfd, 0xd0, 0x25, 0x98, 0x5c, - 0xd1, 0x75, 0xec, 0x79, 0x5b, 0xc1, 0xaa, 0x3a, 0xb1, 0xc2, 0x92, 0x93, 0x91, 0x0e, 0x17, 0x9b, - 0xdf, 0x25, 0x98, 0x65, 0x79, 0x34, 0x44, 0x6c, 0x92, 0xb8, 0xca, 0x07, 0xc1, 0x75, 0x24, 0x85, - 0x2b, 0xcf, 0x8e, 0x92, 0xb8, 0x56, 0x45, 0xb8, 0x8e, 0x0e, 0xc2, 0xb5, 0x76, 0xf8, 0xb8, 0xfe, - 0x24, 0xc3, 0x3c, 0xcb, 0x93, 0x88, 0x99, 0x03, 0xf0, 0x4d, 0x6f, 0x6e, 0x52, 0x6e, 0x73, 0x3b, - 0xf6, 0xfc, 0xdf, 0xcc, 0xe5, 0xff, 0xb5, 0x54, 0xfe, 0xf3, 0xfd, 0x7a, 0x51, 0x79, 0xf0, 0xa7, - 0x04, 0xf3, 0x2c, 0xff, 0x0e, 0x29, 0x5e, 0x07, 0xe2, 0xc4, 0x66, 0x8e, 0x13, 0xd7, 0x52, 0x9c, - 0x18, 0x0a, 0xeb, 0x13, 0xc7, 0x8d, 0x2f, 0x2a, 0x50, 0x8f, 0x40, 0xa0, 0x8f, 0x54, 0x96, 0xe6, - 0x3f, 0x20, 0x6e, 0x2f, 0xbc, 0x3b, 0xbe, 0x0e, 0x1e, 0xc3, 0x88, 0xf7, 0xf1, 0x9e, 0x13, 0xe9, - 0x08, 0xaf, 0x82, 0xe7, 0x8d, 0x00, 0xba, 0xf0, 0x41, 0x97, 0xfe, 0xa7, 0xf1, 0x71, 0xc2, 0x3d, - 0x4d, 0x32, 0x9d, 0x80, 0x09, 0xa6, 0x6d, 0xfa, 0xa6, 0xe6, 0x13, 0x37, 0x84, 0x60, 0x5f, 0xd0, - 0xee, 0x03, 0xb0, 0x7d, 0x93, 0xbe, 0x77, 0xbc, 0x02, 0x23, 0x14, 0xfa, 0x0a, 0x85, 0xfe, 0x7c, - 0x08, 0xfd, 0xfe, 0x84, 0xe5, 0xfd, 0x37, 0x17, 0x3a, 0xb1, 0x75, 0x1d, 0x1a, 0xff, 0xec, 0x85, - 0xe0, 0x87, 0x06, 0xcc, 0x31, 0xfa, 0x24, 0xde, 0x30, 0x4a, 0x3f, 0x67, 0x65, 0x9e, 0xa9, 0xe4, - 0xfc, 0x33, 0xd5, 0x12, 0x4c, 0x39, 0xae, 0xd9, 0xd3, 0xdc, 0xbd, 0x7b, 0x51, 0xb1, 0x66, 0x90, - 0x64, 0xc5, 0xe8, 0x2a, 0x4c, 0x7b, 0x58, 0x27, 0xb6, 0x91, 0x9c, 0xcb, 0x70, 0xca, 0x0f, 0x3c, - 0xe7, 0x47, 0xeb, 0xc7, 0x15, 0x98, 0x0f, 0xed, 0xe7, 0xbe, 0x98, 0x29, 0x63, 0x34, 0x70, 0xef, - 0xa6, 0xea, 0x53, 0x06, 0xe0, 0xe5, 0x2d, 0x81, 0x02, 0x16, 0x5b, 0xe1, 0x1a, 0xe8, 0x49, 0x05, - 0x16, 0x62, 0x60, 0xf8, 0x66, 0x8c, 0x53, 0x33, 0xde, 0x17, 0x9a, 0x71, 0x57, 0xa8, 0x82, 0x19, - 0x32, 0x60, 0x9d, 0x00, 0x43, 0x83, 0xe8, 0x3b, 0x5d, 0x43, 0x99, 0x60, 0x18, 0xb2, 0xab, 0x0c, - 0xef, 0x27, 0x45, 0xbc, 0x9f, 0x4a, 0xf3, 0x3e, 0x60, 0x8b, 0x17, 0x22, 0xa4, 0x34, 0xd9, 0xbe, - 0x11, 0x0b, 0xd0, 0x8d, 0x44, 0x79, 0x9a, 0xa6, 0x3e, 0x5e, 0x16, 0xfa, 0x58, 0x54, 0x97, 0xde, - 0x84, 0xc9, 0x7e, 0x4c, 0xaa, 0x5b, 0xa6, 0xe7, 0x2b, 0x88, 0x6a, 0x9b, 0xce, 0x31, 0x4e, 0xcd, - 0x4c, 0x0c, 0x12, 0x3b, 0x71, 0x0a, 0xb0, 0x49, 0x0c, 0xac, 0xcc, 0xb0, 0xc4, 0xce, 0x88, 0x83, - 0xc4, 0x4e, 0xd8, 0xb3, 0x85, 0x5d, 0x93, 0x18, 0xca, 0x2c, 0x7d, 0x33, 0xc9, 0x0f, 0xa0, 0x0e, - 0xcc, 0x26, 0x84, 0xab, 0x9a, 0x6d, 0x3c, 0x34, 0x0d, 0x7f, 0x5b, 0x99, 0xa3, 0x37, 0x70, 0xc7, - 0x5a, 0xb7, 0xe1, 0xdf, 0x03, 0x93, 0xe9, 0x40, 0x07, 0x0e, 0x77, 0xe0, 0x3f, 0x25, 0xd2, 0xe2, - 0x40, 0x2a, 0x87, 0x2a, 0xd0, 0x4f, 0x6b, 0x30, 0xc7, 0x36, 0x9e, 0xd3, 0x2a, 0x75, 0x64, 0x55, - 0x8a, 0x0b, 0xf0, 0xf1, 0x57, 0x29, 0xbe, 0x19, 0x27, 0xb3, 0x4a, 0x25, 0xeb, 0x50, 0x33, 0x55, - 0x87, 0xf8, 0x5e, 0x14, 0xd5, 0xa1, 0x54, 0xb5, 0x9b, 0xce, 0x54, 0xbb, 0x97, 0x83, 0xde, 0xeb, - 0xb6, 0x76, 0xdf, 0x3a, 0xa5, 0xf7, 0xd1, 0xd1, 0x9b, 0x0b, 0xf0, 0xf1, 0xd3, 0x9b, 0x6f, 0xc6, - 0x8b, 0x46, 0x6f, 0xbe, 0x17, 0xa7, 0xf4, 0xe6, 0xd2, 0xfb, 0x8f, 0x1a, 0x9c, 0x5d, 0x33, 0xbd, - 0x53, 0x7e, 0x1f, 0x8c, 0xdf, 0x5f, 0x96, 0xe3, 0xf7, 0x7b, 0xd1, 0x8e, 0xc3, 0x45, 0x78, 0x68, - 0x82, 0x7f, 0x5d, 0x96, 0xe0, 0x2b, 0x62, 0x3b, 0x4e, 0x26, 0xc3, 0x6f, 0xe6, 0x18, 0x7e, 0x45, - 0xec, 0xc6, 0x29, 0xc5, 0xb9, 0x14, 0xff, 0xb5, 0x0e, 0xe7, 0x6e, 0x68, 0xa6, 0x45, 0xfa, 0xd8, - 0x3d, 0xe5, 0x78, 0x79, 0x8e, 0x7f, 0x55, 0x8e, 0xe3, 0xd1, 0xe6, 0x59, 0x00, 0xf1, 0xd0, 0x24, - 0xff, 0xa6, 0x2c, 0xc9, 0x57, 0x07, 0x18, 0x72, 0x32, 0x59, 0xfe, 0x2a, 0xcc, 0x68, 0x96, 0x45, - 0x1e, 0xb2, 0xd3, 0x4a, 0x1c, 0x7e, 0xf9, 0x0c, 0x8f, 0x15, 0x78, 0x43, 0x68, 0x19, 0x50, 0x6c, - 0xe5, 0xaa, 0xa6, 0xef, 0x60, 0xdb, 0xe8, 0x1a, 0x94, 0xd7, 0x0d, 0x95, 0x33, 0x82, 0x36, 0x12, - 0x75, 0x84, 0x1d, 0x21, 0x5c, 0x1d, 0x80, 0x54, 0xa9, 0x42, 0x32, 0xf3, 0xd2, 0x15, 0x92, 0xef, - 0xa5, 0xe8, 0x3c, 0x92, 0x45, 0xe2, 0xa6, 0x4b, 0x76, 0x9d, 0xd2, 0x65, 0x64, 0x50, 0xdb, 0xc1, - 0xe0, 0x6f, 0xc0, 0xbc, 0x72, 0x50, 0x2d, 0x28, 0x07, 0x0b, 0x00, 0x9a, 0x11, 0x66, 0x8c, 0x47, - 0x3f, 0x49, 0x34, 0xd4, 0x84, 0x84, 0x75, 0x8f, 0xf4, 0x48, 0x1f, 0x47, 0x53, 0x6a, 0x74, 0x4a, - 0x5a, 0x58, 0x58, 0x36, 0x12, 0xe9, 0xdc, 0x48, 0xa5, 0x73, 0xfb, 0xc7, 0x0a, 0xcc, 0x7d, 0xe2, - 0x18, 0x25, 0x30, 0x4a, 0xe3, 0x21, 0xe5, 0xf0, 0x48, 0x7b, 0x20, 0x0f, 0xf6, 0x60, 0x84, 0xe7, - 0x41, 0xe1, 0x57, 0xda, 0xb6, 0x16, 0x1d, 0xdb, 0x0c, 0x6b, 0x68, 0x62, 0x09, 0x39, 0xbd, 0xc4, - 0xb3, 0x0a, 0x34, 0x19, 0x79, 0x13, 0x2d, 0x1f, 0x97, 0x60, 0x52, 0x4b, 0x7f, 0x35, 0x60, 0x4b, - 0x65, 0xa4, 0xc1, 0x3c, 0x9d, 0xd8, 0x36, 0xd6, 0x69, 0xce, 0xb3, 0x7e, 0x17, 0x3a, 0x2f, 0x2d, - 0x4d, 0xb5, 0x52, 0xc8, 0xa9, 0x56, 0x8a, 0xec, 0xd2, 0x85, 0xbc, 0x3e, 0xa2, 0x8e, 0x97, 0x67, - 0xb4, 0xa1, 0xe7, 0xb9, 0xb9, 0x9f, 0x5d, 0xfa, 0xb8, 0xdd, 0xff, 0xab, 0x02, 0x53, 0x37, 0xb1, - 0x8d, 0x5d, 0x53, 0x57, 0xb1, 0xe7, 0x10, 0xdb, 0xc3, 0xe8, 0x3a, 0x8c, 0xba, 0xd8, 0xdb, 0xb5, - 0x7c, 0xaa, 0x62, 0xac, 0x73, 0x21, 0xb4, 0x35, 0x33, 0x6f, 0x59, 0xa5, 0x93, 0x36, 0xce, 0xa8, - 0xe1, 0x74, 0xf4, 0x3a, 0x54, 0xb1, 0xeb, 0x12, 0x97, 0x2e, 0x33, 0xd6, 0x99, 0x2f, 0xb8, 0x6f, - 0x3d, 0x98, 0xb3, 0x71, 0x46, 0x65, 0x93, 0x5b, 0x6d, 0x18, 0x65, 0x9a, 0x02, 0x1f, 0x7b, 0xd8, - 0xf3, 0xb4, 0xcf, 0x70, 0x68, 0x7c, 0x74, 0xd9, 0x7a, 0x07, 0xaa, 0xf4, 0xae, 0xa0, 0x68, 0xe9, - 0xc4, 0x88, 0xc6, 0xe9, 0xff, 0x6c, 0x51, 0x92, 0x72, 0x45, 0x69, 0xb5, 0x06, 0x55, 0x17, 0x3b, - 0xd6, 0x5e, 0xe7, 0x71, 0x03, 0x26, 0xb6, 0x5c, 0xd2, 0x37, 0xbd, 0x20, 0x34, 0x44, 0xdf, 0x41, - 0x2b, 0x30, 0x9e, 0x2c, 0x97, 0xe8, 0x5c, 0x41, 0xf3, 0x5b, 0xeb, 0x2c, 0xdf, 0x9b, 0xf6, 0x99, - 0x40, 0x45, 0x92, 0xa4, 0xb1, 0x8a, 0x6c, 0xb3, 0x97, 0x58, 0x45, 0xb2, 0xa7, 0x28, 0x56, 0x91, - 0x6d, 0x34, 0x12, 0xa8, 0xb8, 0x13, 0xb5, 0x64, 0xa4, 0xdb, 0x47, 0xd0, 0xbf, 0x06, 0xb4, 0xd9, - 0x88, 0x55, 0xf2, 0x3a, 0x52, 0x62, 0x95, 0x45, 0xed, 0x2a, 0x02, 0x95, 0xdd, 0xa8, 0x07, 0x74, - 0xff, 0xc3, 0x27, 0x3a, 0x2f, 0xe8, 0xc2, 0x10, 0xab, 0xca, 0xf6, 0x17, 0xc4, 0xaa, 0x78, 0x8d, - 0x07, 0x02, 0x55, 0x1f, 0xc2, 0x74, 0xee, 0xbb, 0x07, 0x9a, 0x17, 0x7d, 0x11, 0x11, 0x2b, 0xcb, - 0x1d, 0x5e, 0xc6, 0xca, 0xb8, 0xc7, 0x9a, 0x62, 0x65, 0xb9, 0xa3, 0x92, 0x58, 0x19, 0xf7, 0x10, - 0x45, 0xa0, 0x6c, 0x13, 0x50, 0xfe, 0xad, 0x0c, 0x5d, 0x10, 0xbe, 0xb0, 0x09, 0xd4, 0xdd, 0x86, - 0x19, 0xce, 0xc3, 0x19, 0x5a, 0x10, 0x3f, 0xb8, 0x95, 0x09, 0x43, 0x62, 0xb7, 0xcb, 0x84, 0x21, - 0xb3, 0x0f, 0x8a, 0x95, 0xe5, 0xf6, 0xf8, 0x58, 0x19, 0x77, 0xf7, 0x2f, 0x13, 0x53, 0x9e, 0x32, - 0xee, 0x0e, 0x5d, 0xac, 0xac, 0xf3, 0x6d, 0x05, 0x80, 0xa5, 0x66, 0x54, 0x81, 0x92, 0x9b, 0x60, - 0xcc, 0xfd, 0xec, 0xce, 0x38, 0xa8, 0x02, 0x71, 0x54, 0x64, 0x77, 0x97, 0x62, 0x15, 0xf7, 0x47, - 0xe9, 0xc0, 0x6b, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0x8a, 0x10, 0x4d, 0x50, 0xb9, 0x2d, 0x00, + // 1745 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x5a, 0xcd, 0x73, 0xdb, 0x44, + 0x14, 0xaf, 0xe5, 0x38, 0xb6, 0x5f, 0xbe, 0x9c, 0x4d, 0xd2, 0x6a, 0xdc, 0x34, 0x04, 0x53, 0x3a, + 0xa1, 0x2d, 0x81, 0x1a, 0x66, 0xca, 0xc7, 0xf0, 0x91, 0x34, 0x69, 0xe3, 0xa1, 0xa1, 0xa9, 0x0a, + 0x3d, 0x70, 0x53, 0xa5, 0x2d, 0xd1, 0x44, 0xd6, 0x6a, 0x24, 0xc5, 0x6d, 0x38, 0x31, 0x85, 0x43, + 0xe1, 0xc8, 0x8d, 0x23, 0xc3, 0x81, 0x13, 0xff, 0x05, 0xc3, 0x1f, 0xc0, 0x0c, 0xb7, 0x1e, 0xb8, + 0x32, 0xc3, 0x81, 0x3f, 0xa0, 0x07, 0x46, 0xbb, 0x92, 0xac, 0x8f, 0xd5, 0x5a, 0xc1, 0x49, 0x9a, + 0x4e, 0x73, 0xb2, 0xf5, 0x76, 0xf5, 0xf6, 0xbd, 0xdf, 0xbe, 0xdf, 0xdb, 0x0f, 0x3d, 0x00, 0x9d, + 0x68, 0x3b, 0xcb, 0xb6, 0x43, 0x3c, 0x82, 0x2a, 0xf4, 0xa7, 0xf5, 0x6f, 0x05, 0x1a, 0xd7, 0x1c, + 0xac, 0x7a, 0xf8, 0x2e, 0x31, 0x77, 0xbb, 0xf8, 0x96, 0xed, 0xb9, 0x68, 0x12, 0x24, 0x43, 0x97, + 0x4b, 0x8b, 0xa5, 0xa5, 0xba, 0x22, 0x19, 0x3a, 0x42, 0x30, 0x62, 0xa9, 0x5d, 0x2c, 0x4b, 0x54, + 0x42, 0xff, 0xfb, 0x32, 0xd7, 0xf8, 0x0a, 0xcb, 0xe5, 0xc5, 0xd2, 0x52, 0x59, 0xa1, 0xff, 0xd1, + 0x22, 0x8c, 0xe9, 0xd8, 0xd5, 0x1c, 0xc3, 0xf6, 0x0c, 0x62, 0xc9, 0x23, 0xb4, 0x7b, 0x5c, 0x84, + 0x16, 0x00, 0x5c, 0x4b, 0xb5, 0xdd, 0x6d, 0xe2, 0x75, 0x74, 0xb9, 0x42, 0x3b, 0xc4, 0x24, 0xe8, + 0x22, 0x34, 0xd4, 0x9e, 0x6a, 0x98, 0xea, 0x3d, 0xc3, 0x34, 0xbc, 0xbd, 0x2f, 0x88, 0x85, 0xe5, + 0x51, 0xda, 0x2b, 0x23, 0x47, 0xf3, 0x50, 0xb7, 0x1d, 0x72, 0xdf, 0x30, 0x71, 0x47, 0x97, 0xab, + 0xb4, 0x53, 0x5f, 0x80, 0x4e, 0xc3, 0xa8, 0x4d, 0x88, 0xd9, 0xd1, 0xe5, 0x1a, 0x6d, 0x0a, 0x9e, + 0x50, 0x13, 0x6a, 0xfe, 0xbf, 0x4f, 0x7d, 0x7f, 0xea, 0xb4, 0x25, 0x7a, 0x46, 0x2b, 0x50, 0xeb, + 0x62, 0x4f, 0xd5, 0x55, 0x4f, 0x95, 0x61, 0xb1, 0xbc, 0x34, 0xd6, 0x7e, 0x95, 0xa1, 0xb5, 0x9c, + 0x86, 0x68, 0x79, 0x33, 0xe8, 0xb7, 0x6e, 0x79, 0xce, 0x9e, 0x12, 0xbd, 0xe6, 0x3b, 0xa8, 0x3b, + 0x46, 0x0f, 0x3b, 0x74, 0x80, 0x31, 0xe6, 0x60, 0x5f, 0x82, 0x64, 0xa8, 0x6a, 0xc4, 0xf2, 0xf0, + 0x43, 0x4f, 0x1e, 0xa7, 0x8d, 0xe1, 0x23, 0xda, 0x86, 0x39, 0x07, 0xdb, 0xa6, 0xa1, 0xa9, 0x3e, + 0x52, 0x6b, 0xf4, 0x95, 0x35, 0xdf, 0x92, 0x09, 0x6a, 0x49, 0x3b, 0xcf, 0x12, 0x85, 0xf7, 0x12, + 0x33, 0x8b, 0xaf, 0x10, 0x9d, 0x87, 0x89, 0x58, 0x43, 0x47, 0x97, 0x27, 0xa9, 0x25, 0x49, 0x21, + 0x6a, 0xc1, 0x78, 0x38, 0x31, 0x77, 0xfc, 0x89, 0x9e, 0xa2, 0x13, 0x9d, 0x90, 0xa1, 0xcb, 0x30, + 0x1d, 0x3e, 0x5f, 0x77, 0x48, 0xf7, 0x9a, 0x49, 0x76, 0x75, 0xb9, 0xb1, 0x58, 0x5a, 0xaa, 0x29, + 0xd9, 0x86, 0xe6, 0xfb, 0x30, 0x91, 0x80, 0x0d, 0x35, 0xa0, 0xbc, 0x83, 0xf7, 0x82, 0x40, 0xf3, + 0xff, 0xa2, 0x59, 0xa8, 0xf4, 0x54, 0x73, 0x37, 0x0c, 0x35, 0xf6, 0xf0, 0x9e, 0xf4, 0x4e, 0xa9, + 0xb9, 0x01, 0xcd, 0x7c, 0x4f, 0xf7, 0xa3, 0xa9, 0xf5, 0xa4, 0x04, 0x8d, 0x35, 0x6c, 0x62, 0x61, + 0xc8, 0xc7, 0x43, 0x41, 0x4a, 0x84, 0x42, 0xfa, 0xd5, 0x82, 0xa1, 0x50, 0x16, 0x85, 0xc2, 0x48, + 0x22, 0x14, 0x86, 0x02, 0xaa, 0xf5, 0x5b, 0x19, 0x1a, 0xeb, 0x0f, 0x3d, 0x6c, 0xe9, 0x27, 0x8c, + 0x16, 0x30, 0x3a, 0x0d, 0xd1, 0xc1, 0x33, 0x7a, 0xb8, 0x69, 0xfc, 0x43, 0x02, 0x39, 0xce, 0xf5, + 0x3b, 0x01, 0xa4, 0x87, 0x3c, 0x9d, 0x4d, 0xa8, 0xf5, 0xe8, 0x78, 0xd1, 0x64, 0x46, 0xcf, 0xa8, + 0x13, 0x03, 0x73, 0x94, 0x82, 0xf9, 0x3a, 0x27, 0x29, 0xc5, 0x0d, 0x2d, 0x08, 0x6a, 0x55, 0x04, + 0x6a, 0xed, 0x00, 0x41, 0x7d, 0x2c, 0x81, 0x1c, 0xe7, 0xaf, 0x10, 0xd4, 0x38, 0x14, 0x92, 0x00, + 0x8a, 0x72, 0x02, 0x8a, 0x3c, 0xf5, 0x05, 0xa1, 0x18, 0x11, 0x41, 0x51, 0x39, 0x40, 0x28, 0x7e, + 0x2c, 0xc3, 0x2c, 0x9b, 0xb6, 0x15, 0xcf, 0x53, 0xb5, 0xed, 0x2e, 0xb6, 0xf6, 0x0f, 0xc3, 0x79, + 0x98, 0xd0, 0xc9, 0x4d, 0xa2, 0xa9, 0x26, 0x53, 0x42, 0x83, 0xad, 0xa6, 0x24, 0x85, 0x3e, 0xad, + 0xbb, 0xbb, 0xa6, 0x67, 0x6c, 0xa9, 0xde, 0x36, 0x75, 0xb0, 0xa6, 0xf4, 0x05, 0xe8, 0x12, 0xd4, + 0xb6, 0x89, 0xeb, 0x75, 0xac, 0xfb, 0x84, 0x3a, 0x38, 0xd6, 0x9e, 0x0a, 0xa0, 0xdc, 0x08, 0xc4, + 0x4a, 0xd4, 0x01, 0xad, 0x67, 0x42, 0xf0, 0xb5, 0x44, 0x08, 0x26, 0x7d, 0x39, 0xf8, 0xf0, 0x43, + 0x17, 0x60, 0x72, 0x45, 0xd3, 0xb0, 0xeb, 0x6e, 0xf9, 0xa3, 0x6a, 0xc4, 0x0c, 0x52, 0x4e, 0x4a, + 0x3a, 0xdc, 0xdc, 0xfc, 0x29, 0xc1, 0x2c, 0x8b, 0xa3, 0x21, 0xe6, 0x26, 0x8e, 0x6b, 0x79, 0x3f, + 0xb8, 0x8e, 0x24, 0x70, 0xe5, 0xd9, 0x51, 0x10, 0xd7, 0x8a, 0x08, 0xd7, 0xd1, 0x41, 0xb8, 0x56, + 0x0f, 0x1e, 0xd7, 0x5f, 0xcb, 0x30, 0xcf, 0xe2, 0x24, 0x64, 0xe6, 0x00, 0x7c, 0x93, 0x8b, 0x9b, + 0x94, 0x59, 0xdc, 0x8e, 0x3c, 0xfe, 0x37, 0x33, 0xf1, 0x7f, 0x25, 0x11, 0xff, 0x7c, 0xbf, 0x9e, + 0x57, 0x1e, 0xfc, 0x2d, 0xc1, 0x3c, 0x8b, 0xbf, 0x03, 0x9a, 0xaf, 0x7d, 0x71, 0x62, 0x33, 0xc3, + 0x89, 0x2b, 0x09, 0x4e, 0x0c, 0x85, 0xf5, 0xb1, 0xe3, 0xc6, 0xd7, 0x25, 0xa8, 0x85, 0x20, 0xd0, + 0x2d, 0x95, 0xa9, 0x7a, 0xf7, 0x89, 0xd3, 0x0d, 0xde, 0x8e, 0x9e, 0xfd, 0x6d, 0x18, 0x71, 0x3f, + 0xdb, 0xb3, 0x43, 0x1d, 0xc1, 0x93, 0xbf, 0xdf, 0xf0, 0xa1, 0x0b, 0x36, 0xba, 0xf4, 0x3f, 0x9d, + 0x1f, 0x3b, 0x58, 0xd3, 0x24, 0xc3, 0xf6, 0x99, 0x60, 0x58, 0x86, 0x67, 0xa8, 0x1e, 0x71, 0x02, + 0x08, 0xfa, 0x82, 0x56, 0x0f, 0x80, 0xad, 0x9b, 0xf4, 0x94, 0xf2, 0x06, 0x8c, 0x50, 0xe8, 0x4b, + 0x14, 0xfa, 0xb3, 0x01, 0xf4, 0xfd, 0x0e, 0xcb, 0xfd, 0x73, 0x0e, 0xed, 0xd8, 0xbc, 0x0a, 0xf5, + 0xff, 0x77, 0x20, 0xf8, 0xb9, 0x0e, 0x73, 0x8c, 0x3e, 0xb1, 0x13, 0x46, 0xe1, 0x7d, 0x56, 0x6a, + 0x4f, 0x55, 0xce, 0xee, 0xa9, 0x96, 0x60, 0xca, 0x76, 0x8c, 0xae, 0xea, 0xec, 0xdd, 0x0d, 0x93, + 0x35, 0x83, 0x24, 0x2d, 0xa6, 0xe7, 0x29, 0xac, 0x11, 0x4b, 0x8f, 0xf7, 0x65, 0x38, 0x65, 0x1b, + 0x9e, 0xf1, 0xd6, 0xfa, 0x51, 0x09, 0xe6, 0x03, 0xfb, 0xb9, 0x07, 0x33, 0x79, 0x8c, 0x4e, 0xdc, + 0x87, 0x89, 0xfc, 0x94, 0x02, 0x78, 0x79, 0x4b, 0xa0, 0x80, 0xcd, 0xad, 0x70, 0x0c, 0xf4, 0xb8, + 0x04, 0x0b, 0x11, 0x30, 0x7c, 0x33, 0xc6, 0xa9, 0x19, 0x1f, 0x0b, 0xcd, 0xb8, 0x23, 0x54, 0xc1, + 0x0c, 0x19, 0x30, 0x8e, 0x8f, 0xa1, 0x4e, 0xb4, 0x9d, 0x8e, 0x2e, 0x4f, 0x30, 0x0c, 0xd9, 0x53, + 0x8a, 0xf7, 0x93, 0x22, 0xde, 0x4f, 0x25, 0x79, 0xef, 0xb3, 0xc5, 0x0d, 0x10, 0x0a, 0x4e, 0xd5, + 0x7d, 0x01, 0xba, 0x1e, 0x4b, 0x4f, 0xd3, 0xd4, 0xc7, 0x8b, 0x42, 0x1f, 0xf3, 0xf2, 0xd2, 0xbb, + 0x30, 0xd9, 0x8b, 0x48, 0x75, 0xd3, 0x70, 0x3d, 0x19, 0x51, 0x6d, 0xd3, 0x19, 0xc6, 0x29, 0xa9, + 0x8e, 0x7e, 0x60, 0xc7, 0xee, 0x0c, 0x36, 0x89, 0x8e, 0xe5, 0x19, 0x16, 0xd8, 0x29, 0xb1, 0x1f, + 0xd8, 0x31, 0x7b, 0xb6, 0xb0, 0x63, 0x10, 0x5d, 0x9e, 0xa5, 0x27, 0x93, 0x6c, 0x03, 0x6a, 0xc3, + 0x6c, 0x4c, 0xb8, 0xaa, 0x5a, 0xfa, 0x03, 0x43, 0xf7, 0xb6, 0xe5, 0x39, 0xfa, 0x02, 0xb7, 0xad, + 0x79, 0x0b, 0x5e, 0x1e, 0x18, 0x4c, 0xfb, 0xba, 0x70, 0xb8, 0x0d, 0xaf, 0x14, 0x08, 0x8b, 0x7d, + 0xa9, 0x1c, 0x2a, 0x41, 0x3f, 0xa9, 0xc2, 0x1c, 0x5b, 0x78, 0x4e, 0xb2, 0xd4, 0xa1, 0x65, 0x29, + 0x2e, 0xc0, 0x47, 0x9f, 0xa5, 0xf8, 0x66, 0x1c, 0xcf, 0x2c, 0x15, 0xcf, 0x43, 0x8d, 0x44, 0x1e, + 0xe2, 0x7b, 0x91, 0x97, 0x87, 0x12, 0xd9, 0x6e, 0x3a, 0x95, 0xed, 0x5e, 0x0c, 0x7a, 0xaf, 0x5b, + 0xea, 0x3d, 0xf3, 0x84, 0xde, 0x87, 0x47, 0x6f, 0x2e, 0xc0, 0x47, 0x4f, 0x6f, 0xbe, 0x19, 0xcf, + 0x1b, 0xbd, 0xf9, 0x5e, 0x9c, 0xd0, 0x9b, 0x4b, 0xef, 0xbf, 0xaa, 0x70, 0x7a, 0xcd, 0x70, 0x4f, + 0xf8, 0xbd, 0x3f, 0x7e, 0x7f, 0x53, 0x8c, 0xdf, 0x1f, 0x85, 0x2b, 0x0e, 0x17, 0xe1, 0xa1, 0x09, + 0xfe, 0x5d, 0x51, 0x82, 0xaf, 0x88, 0xed, 0x38, 0x9e, 0x0c, 0xbf, 0x91, 0x61, 0xf8, 0x25, 0xb1, + 0x1b, 0x27, 0x14, 0xe7, 0x52, 0xfc, 0xf7, 0x1a, 0x9c, 0xb9, 0xae, 0x1a, 0x26, 0xe9, 0x61, 0xe7, + 0x84, 0xe3, 0xc5, 0x39, 0xfe, 0x6d, 0x31, 0x8e, 0x87, 0x8b, 0x67, 0x0e, 0xc4, 0x43, 0x93, 0xfc, + 0xfb, 0xa2, 0x24, 0x5f, 0x1d, 0x60, 0xc8, 0xf1, 0x64, 0xf9, 0x9b, 0x30, 0xa3, 0x9a, 0x26, 0x79, + 0xc0, 0x6e, 0x2b, 0x71, 0xf0, 0xe5, 0x33, 0xb8, 0x56, 0xe0, 0x35, 0xa1, 0x65, 0x40, 0x91, 0x95, + 0xab, 0xaa, 0xb6, 0x83, 0x2d, 0xbd, 0xa3, 0x53, 0x5e, 0xd7, 0x15, 0x4e, 0x0b, 0xda, 0x88, 0xe5, + 0x11, 0x76, 0x85, 0x70, 0x79, 0x00, 0x52, 0x85, 0x12, 0xc9, 0xcc, 0x0b, 0x97, 0x48, 0x7e, 0x92, + 0xc2, 0xfb, 0x48, 0x36, 0x13, 0x37, 0x1c, 0xb2, 0x6b, 0x17, 0x4e, 0x23, 0x83, 0xca, 0x0e, 0x06, + 0x7f, 0x03, 0xe6, 0xa5, 0x83, 0x4a, 0x4e, 0x3a, 0x58, 0x00, 0x50, 0xf5, 0x20, 0x62, 0x5c, 0xfa, + 0x49, 0xa2, 0xae, 0xc4, 0x24, 0xac, 0xd6, 0xa4, 0x4b, 0x7a, 0x38, 0xec, 0x52, 0xa5, 0x5d, 0x92, + 0xc2, 0xdc, 0xb4, 0x11, 0x0b, 0xe7, 0x7a, 0x22, 0x9c, 0x5b, 0xbf, 0x94, 0x60, 0xee, 0x73, 0x5b, + 0x2f, 0x80, 0x51, 0x12, 0x0f, 0x29, 0x83, 0x47, 0xd2, 0x83, 0xf2, 0x60, 0x0f, 0x46, 0x78, 0x1e, + 0xe4, 0x7e, 0xa5, 0x6d, 0xa9, 0xe1, 0xb5, 0xcd, 0xb0, 0x86, 0xc6, 0x86, 0x28, 0x27, 0x87, 0x78, + 0x5a, 0x82, 0x06, 0x23, 0x6f, 0xac, 0xe4, 0xe3, 0x02, 0x4c, 0xaa, 0xc9, 0xaf, 0x06, 0x6c, 0xa8, + 0x94, 0xd4, 0xef, 0xa7, 0x11, 0xcb, 0xc2, 0x1a, 0x8d, 0x79, 0x56, 0xef, 0x42, 0xfb, 0x25, 0xa5, + 0x89, 0x52, 0x8a, 0x72, 0xa2, 0x94, 0x22, 0x3d, 0x74, 0x2e, 0xaf, 0x0f, 0xa9, 0xe2, 0xe5, 0x29, + 0x2d, 0xe8, 0x79, 0x66, 0xee, 0xa7, 0x87, 0x3e, 0x6a, 0xf7, 0xff, 0x29, 0xc1, 0xd4, 0x0d, 0x6c, + 0x61, 0xc7, 0xd0, 0x14, 0xec, 0xda, 0xc4, 0x72, 0x31, 0xba, 0x0a, 0xa3, 0x0e, 0x76, 0x77, 0x4d, + 0x8f, 0xaa, 0x18, 0x6b, 0x9f, 0x0b, 0x6c, 0x4d, 0xf5, 0x5b, 0x56, 0x68, 0xa7, 0x8d, 0x53, 0x4a, + 0xd0, 0x1d, 0xbd, 0x0d, 0x15, 0xec, 0x38, 0xc4, 0xa1, 0xc3, 0x8c, 0xb5, 0xe7, 0x73, 0xde, 0x5b, + 0xf7, 0xfb, 0x6c, 0x9c, 0x52, 0x58, 0xe7, 0x66, 0x0b, 0x46, 0x99, 0x26, 0xdf, 0xc7, 0x2e, 0x76, + 0x5d, 0xf5, 0x4b, 0x1c, 0x18, 0x1f, 0x3e, 0x36, 0x3f, 0x80, 0x0a, 0x7d, 0xcb, 0x4f, 0x5a, 0x1a, + 0xd1, 0xc3, 0x76, 0xfa, 0x3f, 0x9d, 0x94, 0xa4, 0x4c, 0x52, 0x5a, 0xad, 0x42, 0xc5, 0xc1, 0xb6, + 0xb9, 0xd7, 0x7e, 0x54, 0x87, 0x89, 0x2d, 0x87, 0xf4, 0x0c, 0xd7, 0x9f, 0x1a, 0xa2, 0xed, 0xa0, + 0x15, 0x18, 0x8f, 0xa7, 0x4b, 0x74, 0x26, 0xa7, 0x54, 0xae, 0x79, 0x9a, 0xef, 0x4d, 0xeb, 0x94, + 0xaf, 0x22, 0x4e, 0xd2, 0x48, 0x45, 0xba, 0xd8, 0x4b, 0xac, 0x22, 0x5e, 0x53, 0x14, 0xa9, 0x48, + 0x17, 0x1a, 0x09, 0x54, 0xdc, 0x0e, 0x4b, 0x32, 0x92, 0xe5, 0x23, 0xe8, 0xa5, 0x01, 0x65, 0x36, + 0x62, 0x95, 0xbc, 0x8a, 0x94, 0x48, 0x65, 0x5e, 0xb9, 0x8a, 0x40, 0x65, 0x27, 0xac, 0x18, 0xed, + 0x7f, 0xf8, 0x44, 0x67, 0x05, 0x55, 0x18, 0x62, 0x55, 0xe9, 0xfa, 0x82, 0x48, 0x15, 0xaf, 0xf0, + 0x40, 0xa0, 0xea, 0x13, 0x98, 0xce, 0x7c, 0xf7, 0x40, 0xf3, 0xa2, 0x2f, 0x22, 0x62, 0x65, 0x99, + 0xcb, 0xcb, 0x48, 0x19, 0xf7, 0x5a, 0x53, 0xac, 0x2c, 0x73, 0x55, 0x12, 0x29, 0xe3, 0x5e, 0xa2, + 0x08, 0x94, 0x6d, 0x02, 0xca, 0x9e, 0xca, 0xd0, 0x39, 0xe1, 0x81, 0x4d, 0xa0, 0xee, 0x16, 0xcc, + 0x70, 0x36, 0x67, 0x68, 0x41, 0xbc, 0x71, 0x2b, 0x32, 0x0d, 0xb1, 0xd5, 0x2e, 0x35, 0x0d, 0xa9, + 0x75, 0x50, 0xac, 0x2c, 0xb3, 0xc6, 0x47, 0xca, 0xb8, 0xab, 0x7f, 0x91, 0x39, 0xe5, 0x29, 0xe3, + 0xae, 0xd0, 0xf9, 0xca, 0xda, 0x3f, 0x94, 0x00, 0x58, 0x68, 0x86, 0x19, 0x28, 0xbe, 0x08, 0x46, + 0xdc, 0x4f, 0xaf, 0x8c, 0x83, 0x32, 0x10, 0x47, 0x45, 0x7a, 0x75, 0xc9, 0x57, 0x71, 0x6f, 0x94, + 0x36, 0xbc, 0xf5, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf2, 0xc0, 0xba, 0xdf, 0xe7, 0x2d, 0x00, 0x00, } diff --git a/pkg/dock/proto/dock.proto b/pkg/dock/proto/dock.proto index 726fe837a..2d067f75a 100755 --- a/pkg/dock/proto/dock.proto +++ b/pkg/dock/proto/dock.proto @@ -114,6 +114,8 @@ message CreateVolumeOpts { string replicationId = 14; // The size of snapshot int64 snapshotSize = 15; + // Down load snapshot from cloud + bool snapshotFromCloud = 16; } // DeleteVolumeOpts is a structure which indicates all required properties diff --git a/pkg/model/volume.go b/pkg/model/volume.go index 8c7b9439f..ee9c48890 100755 --- a/pkg/model/volume.go +++ b/pkg/model/volume.go @@ -71,6 +71,9 @@ type VolumeSpec struct { // The uuid of the snapshot which the volume is created SnapshotId string `json:"snapshotId, omitempty"` + // Download Snapshot From Cloud + SnapshotFromCloud bool `json:"snapshotFromCloud, omitempty"` + // The uuid of the replication which the volume belongs to. ReplicationId string `json:"replicationId,omitempty"` diff --git a/pkg/utils/config/config.go b/pkg/utils/config/config.go index a81929a7e..79909bd92 100755 --- a/pkg/utils/config/config.go +++ b/pkg/utils/config/config.go @@ -16,12 +16,14 @@ package config import ( gflag "flag" + "fmt" + "log" "reflect" "strconv" "strings" + "time" "github.com/go-ini/ini" - log "github.com/golang/glog" ) const ( @@ -29,73 +31,112 @@ const ( ConfDefaultValue ) -func setSlice(v reflect.Value, str string) { +func setSlice(v reflect.Value, str string) error { sList := strings.Split(str, ",") s := reflect.MakeSlice(v.Type(), 0, 5) switch v.Type().Elem().Kind() { case reflect.Bool: for _, elm := range sList { - val, _ := strconv.ParseBool(elm) + val, err := strconv.ParseBool(elm) + if err != nil { + return fmt.Errorf("cann't convert slice item %s to Bool, %v", elm, err) + } s = reflect.Append(s, reflect.ValueOf(val)) } case reflect.Int: for _, elm := range sList { - val, _ := strconv.Atoi(elm) + val, err := strconv.Atoi(elm) + if err != nil { + return fmt.Errorf("cann't convert slice item %s to Int, %v", elm, err) + } s = reflect.Append(s, reflect.ValueOf(val)) } case reflect.Int8: for _, elm := range sList { - val, _ := strconv.ParseInt(elm, 10, 64) + val, err := strconv.ParseInt(elm, 10, 64) + if err != nil { + return fmt.Errorf("cann't convert slice item %s to Int8, %v", elm, err) + } s = reflect.Append(s, reflect.ValueOf(int8(val))) } case reflect.Int16: for _, elm := range sList { - val, _ := strconv.ParseInt(elm, 10, 64) + val, err := strconv.ParseInt(elm, 10, 64) + if err != nil { + return fmt.Errorf("cann't convert slice item %s to Int16, %v", elm, err) + } s = reflect.Append(s, reflect.ValueOf(int16(val))) } case reflect.Int32: for _, elm := range sList { - val, _ := strconv.ParseInt(elm, 10, 64) + val, err := strconv.ParseInt(elm, 10, 64) + if err != nil { + return fmt.Errorf("cann't convert slice item %s to Int32, %v", elm, err) + } s = reflect.Append(s, reflect.ValueOf(int32(val))) } case reflect.Int64: for _, elm := range sList { - val, _ := strconv.ParseInt(elm, 10, 64) + val, err := strconv.ParseInt(elm, 10, 64) + if err != nil { + return fmt.Errorf("cann't convert slice item %s to Int64, %v", elm, err) + } s = reflect.Append(s, reflect.ValueOf(int64(val))) } case reflect.Uint: for _, elm := range sList { - val, _ := strconv.ParseUint(elm, 10, 64) + val, err := strconv.ParseUint(elm, 10, 64) + if err != nil { + return fmt.Errorf("cann't convert slice item %s to Uint, %v", elm, err) + } s = reflect.Append(s, reflect.ValueOf(uint(val))) } case reflect.Uint8: for _, elm := range sList { - val, _ := strconv.ParseUint(elm, 10, 64) + val, err := strconv.ParseUint(elm, 10, 64) + if err != nil { + return fmt.Errorf("cann't convert slice item %s to Uint8, %v", elm, err) + } s = reflect.Append(s, reflect.ValueOf(uint8(val))) } case reflect.Uint16: for _, elm := range sList { - val, _ := strconv.ParseUint(elm, 10, 64) + val, err := strconv.ParseUint(elm, 10, 64) + if err != nil { + return fmt.Errorf("cann't convert slice item %s to Uint16, %v", elm, err) + } s = reflect.Append(s, reflect.ValueOf(uint16(val))) } case reflect.Uint32: for _, elm := range sList { - val, _ := strconv.ParseUint(elm, 10, 64) + val, err := strconv.ParseUint(elm, 10, 64) + if err != nil { + return fmt.Errorf("cann't convert slice item %s to Uint32, %v", elm, err) + } s = reflect.Append(s, reflect.ValueOf(uint32(val))) } case reflect.Uint64: for _, elm := range sList { - val, _ := strconv.ParseUint(elm, 10, 64) + val, err := strconv.ParseUint(elm, 10, 64) + if err != nil { + return fmt.Errorf("cann't convert slice item %s to Uint64, %v", elm, err) + } s = reflect.Append(s, reflect.ValueOf(uint64(val))) } case reflect.Float32: for _, elm := range sList { - val, _ := strconv.ParseFloat(elm, 64) + val, err := strconv.ParseFloat(elm, 64) + if err != nil { + return fmt.Errorf("cann't convert slice item %s to Float32, %v", elm, err) + } s = reflect.Append(s, reflect.ValueOf(float32(val))) } case reflect.Float64: for _, elm := range sList { - val, _ := strconv.ParseFloat(elm, 64) + val, err := strconv.ParseFloat(elm, 64) + if err != nil { + return fmt.Errorf("cann't convert slice item %s to Float54, %v", elm, err) + } s = reflect.Append(s, reflect.ValueOf(val)) } case reflect.String: @@ -103,12 +144,13 @@ func setSlice(v reflect.Value, str string) { s = reflect.Append(s, reflect.ValueOf(elm)) } default: - log.Error("Not support this type of slice.") + log.Printf("[ERROR] Does not support this type of slice.") } v.Set(s) + return nil } -func parseItems(section string, v reflect.Value, cfg *ini.File) { +func parseItems(section string, v reflect.Value, cfg *ini.File) error { for i := 0; i < v.Type().NumField(); i++ { field := v.Field(i) @@ -132,16 +174,38 @@ func parseItems(section string, v reflect.Value, cfg *ini.File) { } switch field.Kind() { case reflect.Bool: - val, _ := strconv.ParseBool(strVal) + val, err := strconv.ParseBool(strVal) + if err != nil { + return fmt.Errorf("cann't convert %s:%s to Bool, %v", tags[0], strVal, err) + } field.SetBool(val) + case reflect.ValueOf(time.Second).Kind(): + if field.Type().String() == "time.Duration" { + v, err := time.ParseDuration(strVal) + if err != nil { + return fmt.Errorf("cann't convert %s:%s to Duration, %v", tags[0], strVal, err) + } + field.SetInt(int64(v)) + break + } + fallthrough case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - val, _ := strconv.ParseInt(strVal, 10, 64) + val, err := strconv.ParseInt(strVal, 10, 64) + if err != nil { + return fmt.Errorf("cann't convert %s:%s to Int, %v", tags[0], strVal, err) + } field.SetInt(val) case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - val, _ := strconv.ParseUint(strVal, 10, 64) + val, err := strconv.ParseUint(strVal, 10, 64) + if err != nil { + return fmt.Errorf("cann't convert %s:%s to Uint, %v", tags[0], strVal, err) + } field.SetUint(val) case reflect.Float32, reflect.Float64: - val, _ := strconv.ParseFloat(strVal, 64) + val, err := strconv.ParseFloat(strVal, 64) + if err != nil { + return fmt.Errorf("cann't convert %s:%s to Float, %v", tags[0], strVal, err) + } field.SetFloat(val) case reflect.String: field.SetString(strVal) @@ -150,9 +214,10 @@ func parseItems(section string, v reflect.Value, cfg *ini.File) { default: } } + return nil } -func parseSections(cfg *ini.File, t reflect.Type, v reflect.Value) { +func parseSections(cfg *ini.File, t reflect.Type, v reflect.Value) error { if v.Kind() == reflect.Ptr { v = v.Elem() t = t.Elem() @@ -164,21 +229,27 @@ func parseSections(cfg *ini.File, t reflect.Type, v reflect.Value) { continue } if "" == section { - parseSections(cfg, field.Type(), field) + if err := parseSections(cfg, field.Type(), field); err != nil { + return err + } + } + if err := parseItems(section, field, cfg); err != nil { + return err } - parseItems(section, field, cfg) } + return nil } func initConf(confFile string, conf interface{}) { cfg, err := ini.Load(confFile) if err != nil && confFile != "" { - log.Info("Read configuration failed, use default value") + log.Printf("[ERROR] Read configuration failed, use default value") } t := reflect.TypeOf(conf) v := reflect.ValueOf(conf) - parseSections(cfg, t, v) - + if err := parseSections(cfg, t, v); err != nil { + log.Fatalf("[ERROR] parse configure file failed: %v", err) + } } // Global Configuration Variable diff --git a/pkg/utils/config/config_define.go b/pkg/utils/config/config_define.go index fcddbbd00..c1f44ee16 100755 --- a/pkg/utils/config/config_define.go +++ b/pkg/utils/config/config_define.go @@ -14,24 +14,28 @@ package config +import "time" + type Default struct{} type OsdsLet struct { - ApiEndpoint string `conf:"api_endpoint,localhost:50040"` - Graceful bool `conf:"graceful,true"` - SocketOrder string `conf:"socket_order"` - AuthStrategy string `conf:"auth_strategy,noauth"` - Daemon bool `conf:"daemon,false"` - PolicyPath string `conf:"policy_path,/etc/opensds/policy.json"` + ApiEndpoint string `conf:"api_endpoint,localhost:50040"` + Graceful bool `conf:"graceful,true"` + SocketOrder string `conf:"socket_order"` + AuthStrategy string `conf:"auth_strategy,noauth"` + Daemon bool `conf:"daemon,false"` + PolicyPath string `conf:"policy_path,/etc/opensds/policy.json"` + LogFlushFrequency time.Duration `conf:"log_flush_frequency,5s"` // Default value is 5s } type OsdsDock struct { - ApiEndpoint string `conf:"api_endpoint,localhost:50050"` - DockType string `conf:"dock_type,provisioner"` - EnabledBackends []string `conf:"enabled_backends,lvm"` - Daemon bool `conf:"daemon,false"` - BindIp string `conf:"bind_ip"` // Just used for attacher dock - HostBasedReplicationDriver string `conf:"host_based_replication_driver,drbd"` + ApiEndpoint string `conf:"api_endpoint,localhost:50050"` + DockType string `conf:"dock_type,provisioner"` + EnabledBackends []string `conf:"enabled_backends,lvm"` + Daemon bool `conf:"daemon,false"` + BindIp string `conf:"bind_ip"` // Just used for attacher dock + HostBasedReplicationDriver string `conf:"host_based_replication_driver,drbd"` + LogFlushFrequency time.Duration `conf:"log_flush_frequency,5s"` // Default value is 5s Backends } diff --git a/pkg/utils/config/config_test.go b/pkg/utils/config/config_test.go index 13f207444..7fe1b4318 100755 --- a/pkg/utils/config/config_test.go +++ b/pkg/utils/config/config_test.go @@ -17,23 +17,25 @@ package config import ( "reflect" "testing" + "time" ) type TestStruct struct { - Bool bool `conf:"bool,true"` - Int int `conf:"int,-456789"` - Int8 int8 `conf:"int8,-111"` - Int16 int `conf:"int16,-4567"` - Int32 int `conf:"int32,-456789"` - Int64 int64 `conf:"int64,-456789"` - Uint uint `conf:"uint,456789"` - Uint8 uint8 `conf:"uint8,111"` - Uint16 uint16 `conf:"uint16,4567"` - Uint32 uint32 `conf:"uint32,456789"` - Uint64 uint64 `conf:"uint64,456789"` - Float32 float32 `conf:"float32,0.456789"` - Float64 float64 `conf:"float64,0.456789"` - String string `conf:"string,DefaultValue"` + Bool bool `conf:"bool,true"` + Int int `conf:"int,-456789"` + Int8 int8 `conf:"int8,-111"` + Int16 int `conf:"int16,-4567"` + Int32 int `conf:"int32,-456789"` + Int64 int64 `conf:"int64,-456789"` + Uint uint `conf:"uint,456789"` + Uint8 uint8 `conf:"uint8,111"` + Uint16 uint16 `conf:"uint16,4567"` + Uint32 uint32 `conf:"uint32,456789"` + Uint64 uint64 `conf:"uint64,456789"` + Float32 float32 `conf:"float32,0.456789"` + Float64 float64 `conf:"float64,0.456789"` + String string `conf:"string,DefaultValue"` + Duration time.Duration `conf:"duration,10s"` } type TestSliceStruct struct { @@ -105,6 +107,9 @@ func TestFunctionAllType(t *testing.T) { if conf.TestStruct.Float64 != 0.123456 { t.Error("Test TestStuct Float64 error") } + if conf.TestStruct.Duration != 5*time.Second { + t.Error("Test TestStuct time Duration error") + } if conf.TestStruct.String != "HelloWorld" { t.Error("Test TestStuct String error") } @@ -207,6 +212,9 @@ func TestFunctionDefaultValue(t *testing.T) { if conf.TestStruct.String != "DefaultValue" { t.Error("Test TestStuct String error") } + if conf.TestStruct.Duration != 10*time.Second { + t.Error("Test TestStuct String error") + } if !reflect.DeepEqual(conf.TestSliceStruct.SliceString, []string{"slice", "string", "test"}) { t.Error("Test TestSliceStruct String error") @@ -263,9 +271,15 @@ func TestOpensdsConfig(t *testing.T) { if CONF.OsdsLet.SocketOrder != "inc" { t.Error("Test OsdsLet.SocketOrder error") } + if CONF.OsdsLet.LogFlushFrequency != 2*time.Second { + t.Error("Test OsdsDock.ApiEndpoint error") + } if CONF.OsdsDock.ApiEndpoint != "localhost:50050" { t.Error("Test OsdsDock.ApiEndpoint error") } + if CONF.OsdsDock.LogFlushFrequency != 4*time.Second { + t.Error("Test OsdsDock.ApiEndpoint error") + } if CONF.OsdsDock.EnabledBackends[0] != "ceph" { t.Error("OsdsDock.EnabledBackends[0] error") } diff --git a/pkg/utils/config/flag.go b/pkg/utils/config/flag.go index e3a02acae..c4ac24c5e 100755 --- a/pkg/utils/config/flag.go +++ b/pkg/utils/config/flag.go @@ -17,8 +17,7 @@ package config import ( gflag "flag" "reflect" - - log "github.com/golang/glog" + "time" ) type Flag struct { @@ -83,6 +82,13 @@ func (f *FlagSet) StringVar(p *string, name string, defValue string, usage strin f.Add(name, flag) } +func (f *FlagSet) DurationVar(p *time.Duration, name string, defValue time.Duration, usage string) { + inVal := new(time.Duration) + flag := &Flag{Value: p, InValue: inVal} + gflag.DurationVar(inVal, name, defValue, usage) + f.Add(name, flag) +} + func (f *FlagSet) Add(name string, flag *Flag) { if f.flagMap == nil { f.flagMap = make(map[string]*Flag) @@ -103,25 +109,8 @@ func (f *FlagSet) AssignValue() { if _, ok := f.flagMap[name]; !ok { continue } - typ := reflect.TypeOf(f.flagMap[name].InValue) - val := reflect.ValueOf(f.flagMap[name].InValue) - switch typ.Elem().Kind() { - case reflect.String: - *f.flagMap[name].Value.(*string) = val.Elem().String() - case reflect.Bool: - *f.flagMap[name].Value.(*bool) = val.Elem().Bool() - case reflect.Int: - *f.flagMap[name].Value.(*int) = int(val.Elem().Int()) - case reflect.Int64: - *f.flagMap[name].Value.(*int64) = val.Elem().Int() - case reflect.Uint: - *f.flagMap[name].Value.(*uint) = uint(val.Elem().Uint()) - case reflect.Uint64: - *f.flagMap[name].Value.(*uint64) = val.Elem().Uint() - case reflect.Float64: - *f.flagMap[name].Value.(*float64) = val.Elem().Float() - default: - log.Error("Flag do not support this type.") - } + iv := reflect.ValueOf(f.flagMap[name].InValue).Elem() + v := reflect.ValueOf(f.flagMap[name].Value).Elem() + v.Set(iv) } } diff --git a/pkg/utils/config/testdata/opensds.conf b/pkg/utils/config/testdata/opensds.conf index e9546749e..78f50b8dd 100755 --- a/pkg/utils/config/testdata/opensds.conf +++ b/pkg/utils/config/testdata/opensds.conf @@ -3,11 +3,13 @@ api_endpoint = localhost:50040 graceful = True log_file = /var/log/opensds/osdslet.log socket_order = inc +log_flush_frequency = 2s [osdsdock] api_endpoint = localhost:50050 log_file = /var/log/opensds/osdsdock.log enabled_backends = ceph,cinder,sample,lvm +log_flush_frequency = 4s [ceph] name = ceph @@ -53,6 +55,7 @@ uint64=123456 float32=0.123456 float64=0.123456 string=HelloWorld +duration=5s [test_slice_struct] slice_bool=False,True,False diff --git a/pkg/utils/logs/logs.go b/pkg/utils/logs/logs.go index eea1f7ba1..25e6c384b 100755 --- a/pkg/utils/logs/logs.go +++ b/pkg/utils/logs/logs.go @@ -16,8 +16,12 @@ package logs import ( "flag" + "fmt" "log" "os" + "os/signal" + "syscall" + "time" "github.com/golang/glog" "github.com/opensds/opensds/pkg/utils" @@ -25,6 +29,13 @@ import ( const DefaultLogDir = "/var/log/opensds" +// flushDaemon periodically flushes the log file buffers. +func flushDaemon(period time.Duration) { + for _ = range time.NewTicker(period).C { + glog.Flush() + } +} + func init() { //Set OpenSDS default log directory. flag.CommandLine.VisitAll(func(flag *flag.Flag) { @@ -42,13 +53,28 @@ func (writer GlogWriter) Write(data []byte) (n int, err error) { return len(data), nil } -func InitLogs() { +// flush log when be interrupted. +func handleInterrupt() { + sigs := make(chan os.Signal, 1) + signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM, syscall.SIGKILL, syscall.SIGQUIT) + go func() { + sig := <-sigs + fmt.Println(sig) + FlushLogs() + os.Exit(-1) + }() +} + +func InitLogs(LogFlushFrequency time.Duration) { log.SetOutput(GlogWriter{}) log.SetFlags(log.LstdFlags | log.Lshortfile) logDir := flag.CommandLine.Lookup("log_dir").Value.String() if exist, _ := utils.PathExists(logDir); !exist { os.MkdirAll(logDir, 0755) } + glog.Infof("[Info] LogFlushFrequency: %v", LogFlushFrequency) + go flushDaemon(LogFlushFrequency) + handleInterrupt() } func FlushLogs() { diff --git a/script/CI/coverage b/script/CI/coverage index ca1bd4141..2b62cefe0 100755 --- a/script/CI/coverage +++ b/script/CI/coverage @@ -24,7 +24,7 @@ for testpkg in $(go list ./osdsctl/... ./client/... ./pkg/... ./contrib/...); do test $testpkg == "$MODEL_PACKAGE" && continue test $testpkg == "$PROTOBUF_PACKAGE" && continue covpkg="${testpkg/"/testing"/}" - go test -covermode count -coverprofile "testing_"$n.coverprofile -coverpkg $covpkg $testpkg 2>/dev/null + go test -covermode count -coverprofile "testing_"$n.coverprofile -coverpkg $covpkg $testpkg n=$((n+1)) done diff --git a/script/devsds/bootstrap.sh b/script/devsds/bootstrap.sh old mode 100644 new mode 100755 index 406579eb0..9dff79858 --- a/script/devsds/bootstrap.sh +++ b/script/devsds/bootstrap.sh @@ -22,7 +22,7 @@ OPT_DIR=/opt/opensds mkdir -p $OPT_DIR # Golang version -GOLANG_VERSION=${GOLANG_VERSION:-1.9.2} +MINIMUM_GO_VERSION=${MINIMUM_GO_VERSION:-go1.11.1} GOENV_PROFILE=${GOENV_PROFILE:-/etc/profile.d/goenv.sh} # Log file @@ -49,16 +49,25 @@ log OpenSDS bootstrap starting ... # load profile source /etc/profile -# Install Golang environment -if ! which go &>/dev/null; then + +# if not found, install it. +if [[ -z "$(which go)" ]]; then log "Golang is not exist, downloading..." - wget https://storage.googleapis.com/golang/go${GOLANG_VERSION}.linux-amd64.tar.gz -O $OPT_DIR/go${GOLANG_VERSION}.linux-amd64.tar.gz > /dev/null - log "tar xzf $OPT_DIR/go${GOLANG_VERSION}.linux-amd64.tar.gz -C /usr/local/" - tar xzf $OPT_DIR/go${GOLANG_VERSION}.linux-amd64.tar.gz -C /usr/local/ - echo 'export GOROOT=/usr/local/go' > $GOENV_PROFILE - echo 'export GOPATH=$HOME/gopath' >> $GOENV_PROFILE - echo 'export PATH=$PATH:$GOROOT/bin:$GOPATH/bin' >> $GOENV_PROFILE - source $GOENV_PROFILE + wget https://storage.googleapis.com/golang/${MINIMUM_GO_VERSION}.linux-amd64.tar.gz -O $OPT_DIR/${MINIMUM_GO_VERSION}.linux-amd64.tar.gz > /dev/null + log "tar xzf $OPT_DIR/${MINIMUM_GO_VERSION}.linux-amd64.tar.gz -C /usr/local/" + tar xzf $OPT_DIR/${MINIMUM_GO_VERSION}.linux-amd64.tar.gz -C /usr/local/ + echo 'export GOROOT=/usr/local/go' > $GOENV_PROFILE + echo 'export GOPATH=$HOME/gopath' >> $GOENV_PROFILE + echo 'export PATH=$PATH:$GOROOT/bin:$GOPATH/bin' >> $GOENV_PROFILE + source $GOENV_PROFILE +fi + +# verify go version +IFS=" " read -ra go_version <<< "$(go version)" +if [[ "${MINIMUM_GO_VERSION}" != $(echo -e "${MINIMUM_GO_VERSION}\n${go_version[2]}" | sort -s -t. -k 1,1 -k 2,2n -k 3,3n | head -n1) && "${go_version[2]}" != "devel" ]]; then + log_error "Detected go version: ${go_version[*]}, OpenSDS requires ${MINIMUM_GO_VERSION} or greater." + log_error "Please remove golang old version ${go_version[2]}, bootstrap will install ${MINIMUM_GO_VERSION} automatically" + exit 2 fi GOPATH=${GOPATH:-$HOME/gopath} @@ -68,16 +77,16 @@ mkdir -p ${OPENSDS_ROOT} cd ${OPENSDS_ROOT} if [ ! -d ${OPENSDS_DIR} ]; then - log "Download the OpenSDS source code." - git clone https://github.com/opensds/opensds.git -b master + log "Downloading the OpenSDS source code..." + git clone https://github.com/opensds/opensds.git -b master fi cd ${OPENSDS_DIR} if [ ! -d ${OPENSDS_DIR}/build ]; then + log "Building OpenSDS ..." sudo apt-get update > /dev/null - sudo apt-get install librados-dev librbd-dev -y > /dev/null - log "Build OpenSDS ..." - make + sudo apt-get install librados-dev librbd-dev -y > /dev/null + make fi log OpenSDS bootstrapped successfully. you can execute 'source /etc/profile' to load golang ENV. diff --git a/script/devsds/lib/keystone.sh b/script/devsds/lib/keystone.sh index c722f5265..16536e997 100644 --- a/script/devsds/lib/keystone.sh +++ b/script/devsds/lib/keystone.sh @@ -127,7 +127,7 @@ osds::keystone::download_code(){ } osds::keystone::install(){ - if [ "true" != $USE_EXISTING_KEYSTONE] + if [ "true" != $USE_EXISTING_KEYSTONE ] then KEYSTONE_IP=$HOST_IP osds::keystone::create_user @@ -169,4 +169,4 @@ osds::keystone::uninstall_purge(){ } ## Restore xtrace -$_XTRACE_KEYSTONE \ No newline at end of file +$_XTRACE_KEYSTONE diff --git a/test/e2e/e2ef_test.go b/test/e2e/e2ef_test.go index 822ee9ce0..4eca86272 100644 --- a/test/e2e/e2ef_test.go +++ b/test/e2e/e2ef_test.go @@ -175,6 +175,7 @@ func TestExtendVolumeFlow(t *testing.T) { body = &model.ExtendVolumeSpec{ NewSize: int64(3), } + time.Sleep(3 * 1e9) _, err = u.ExtendVolume(vol.Id, body) if err != nil { t.Error("Extend volume fail", err)