mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-26 04:05:40 +01:00
Merge branch 'master' into replication_ng
Signed-off-by: Meina Zhou <meinaz@vmware.com>
This commit is contained in:
commit
130e132f86
@ -65,7 +65,7 @@ These Basic Configuration must be set. Otherwise you can't deploy Harbor on Kube
|
|||||||
path: /data/registry
|
path: /data/registry
|
||||||
```
|
```
|
||||||
|
|
||||||
For more infomation about storage solution, Please check [Kubernetes Document](http://kubernetes.io/docs/user-guide/persistent-volumes/)
|
For more information about storage solution, Please check [Kubernetes Document](http://kubernetes.io/docs/user-guide/persistent-volumes/)
|
||||||
|
|
||||||
Then you can generate ConfigMap files by :
|
Then you can generate ConfigMap files by :
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ paths:
|
|||||||
description: Unexpected internal errors.
|
description: Unexpected internal errors.
|
||||||
'/projects/{project_id}':
|
'/projects/{project_id}':
|
||||||
get:
|
get:
|
||||||
summary: Return specific project detail infomation
|
summary: Return specific project detail information
|
||||||
description: |
|
description: |
|
||||||
This endpoint returns specific project information by project ID.
|
This endpoint returns specific project information by project ID.
|
||||||
parameters:
|
parameters:
|
||||||
@ -707,7 +707,7 @@ paths:
|
|||||||
get:
|
get:
|
||||||
summary: Get current user info.
|
summary: Get current user info.
|
||||||
description: |
|
description: |
|
||||||
This endpoint is to get the current user infomation.
|
This endpoint is to get the current user information.
|
||||||
tags:
|
tags:
|
||||||
- Products
|
- Products
|
||||||
responses:
|
responses:
|
||||||
@ -1409,7 +1409,7 @@ paths:
|
|||||||
post:
|
post:
|
||||||
summary: Scan all images of the registry.
|
summary: Scan all images of the registry.
|
||||||
description: |
|
description: |
|
||||||
The server will launch different jobs to scan each image on the regsitry, so this is equivalent to calling the API to scan the image one by one in background, so there's no way to track the overall status of the "scan all" action. Only system adim has permission to call this API.
|
The server will launch different jobs to scan each image on the regisitry, so this is equivalent to calling the API to scan the image one by one in background, so there's no way to track the overall status of the "scan all" action. Only system adim has permission to call this API.
|
||||||
parameters:
|
parameters:
|
||||||
- name: project_id
|
- name: project_id
|
||||||
in: query
|
in: query
|
||||||
@ -5180,7 +5180,7 @@ definitions:
|
|||||||
description:
|
description:
|
||||||
type: string
|
type: string
|
||||||
description: The description of robot account
|
description: The description of robot account
|
||||||
expiresat:
|
expires_at:
|
||||||
type: integer
|
type: integer
|
||||||
description: The expiration of robot account (in seconds)
|
description: The expiration of robot account (in seconds)
|
||||||
project_id:
|
project_id:
|
||||||
|
@ -14,7 +14,7 @@ RUN tdnf install -y shadow gzip postgresql >> /dev/null\
|
|||||||
&& sed -i "s|#unix_socket_directories = '/tmp'.*|unix_socket_directories = '/run/postgresql'|g" /usr/share/postgresql/postgresql.conf.sample \
|
&& sed -i "s|#unix_socket_directories = '/tmp'.*|unix_socket_directories = '/run/postgresql'|g" /usr/share/postgresql/postgresql.conf.sample \
|
||||||
&& tdnf clean all
|
&& tdnf clean all
|
||||||
|
|
||||||
RUN tdnf erase -y toybox && tdnf install -y util-linux
|
RUN tdnf erase -y toybox && tdnf install -y util-linux net-tools
|
||||||
|
|
||||||
VOLUME /var/lib/postgresql/data
|
VOLUME /var/lib/postgresql/data
|
||||||
|
|
||||||
|
193
src/Gopkg.lock
generated
193
src/Gopkg.lock
generated
@ -2,44 +2,57 @@
|
|||||||
|
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:b16fbfbcc20645cb419f78325bb2e85ec729b338e996a228124d68931a6f2a37"
|
||||||
name = "github.com/BurntSushi/toml"
|
name = "github.com/BurntSushi/toml"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "b26d9c308763d68093482582cea63d69be07a0f0"
|
revision = "b26d9c308763d68093482582cea63d69be07a0f0"
|
||||||
version = "v0.3.0"
|
version = "v0.3.0"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:5d3e23515e7916c152cc665eda0f7eaf6fdf8fdfe7c3dbac97049bcbd649b33f"
|
||||||
name = "github.com/Knetic/govaluate"
|
name = "github.com/Knetic/govaluate"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "d216395917cc49052c7c7094cf57f09657ca08a8"
|
revision = "d216395917cc49052c7c7094cf57f09657ca08a8"
|
||||||
version = "v3.0.0"
|
version = "v3.0.0"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:55388fd080150b9a072912f97b1f5891eb0b50df43401f8b75fb4273d3fec9fc"
|
||||||
name = "github.com/Masterminds/semver"
|
name = "github.com/Masterminds/semver"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "c7af12943936e8c39859482e61f0574c2fd7fc75"
|
revision = "c7af12943936e8c39859482e61f0574c2fd7fc75"
|
||||||
version = "v1.4.2"
|
version = "v1.4.2"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:9e9193aa51197513b3abcb108970d831fbcf40ef96aa845c4f03276e1fa316d2"
|
||||||
name = "github.com/Sirupsen/logrus"
|
name = "github.com/Sirupsen/logrus"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "c155da19408a8799da419ed3eeb0cb5db0ad5dbc"
|
revision = "c155da19408a8799da419ed3eeb0cb5db0ad5dbc"
|
||||||
version = "v1.0.5"
|
version = "v1.0.5"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:e8078e5f9d84e87745efb3c0961e78045500cda10d7102fdf839fbac4b49a423"
|
||||||
name = "github.com/Unknwon/goconfig"
|
name = "github.com/Unknwon/goconfig"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "5f601ca6ef4d5cea8d52be2f8b3a420ee4b574a5"
|
revision = "5f601ca6ef4d5cea8d52be2f8b3a420ee4b574a5"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
|
digest = "1:47ea4fbe2ab4aeb9808502c51e657041c2e49b36b83fc1c1a349135cdf16342f"
|
||||||
name = "github.com/agl/ed25519"
|
name = "github.com/agl/ed25519"
|
||||||
packages = [
|
packages = [
|
||||||
".",
|
".",
|
||||||
"edwards25519"
|
"edwards25519",
|
||||||
]
|
]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "5312a61534124124185d41f09206b9fef1d88403"
|
revision = "5312a61534124124185d41f09206b9fef1d88403"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:d2dbd0b0ec5373e89b27d0dd9f59793aa47020a05805b4b75c63aa1b2406781b"
|
||||||
name = "github.com/astaxie/beego"
|
name = "github.com/astaxie/beego"
|
||||||
packages = [
|
packages = [
|
||||||
".",
|
".",
|
||||||
@ -55,17 +68,21 @@
|
|||||||
"session/redis",
|
"session/redis",
|
||||||
"toolbox",
|
"toolbox",
|
||||||
"utils",
|
"utils",
|
||||||
"validation"
|
"validation",
|
||||||
]
|
]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "d96289a81bf67728cff7a19b067aaecc65a62ec6"
|
revision = "d96289a81bf67728cff7a19b067aaecc65a62ec6"
|
||||||
version = "v1.9.0"
|
version = "v1.9.0"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:4522bd966f53adb3da34201b39df1153534e441c8067d5e674964f05ecca3a71"
|
||||||
name = "github.com/beego/i18n"
|
name = "github.com/beego/i18n"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "e87155e8f0c05bf323d0b13470e1b97af0cb5652"
|
revision = "e87155e8f0c05bf323d0b13470e1b97af0cb5652"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:76ca0dfcbf951d1868c7449453981dba9e1f79034706d1500a5a785000f5f222"
|
||||||
name = "github.com/casbin/casbin"
|
name = "github.com/casbin/casbin"
|
||||||
packages = [
|
packages = [
|
||||||
".",
|
".",
|
||||||
@ -77,60 +94,76 @@
|
|||||||
"persist/file-adapter",
|
"persist/file-adapter",
|
||||||
"rbac",
|
"rbac",
|
||||||
"rbac/default-role-manager",
|
"rbac/default-role-manager",
|
||||||
"util"
|
"util",
|
||||||
]
|
]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "542e16cac74562eefac970a7d0d1467640d1f1cb"
|
revision = "542e16cac74562eefac970a7d0d1467640d1f1cb"
|
||||||
version = "v1.7.0"
|
version = "v1.7.0"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:a2c1d0e43bd3baaa071d1b9ed72c27d78169b2b269f71c105ac4ba34b1be4a39"
|
||||||
name = "github.com/davecgh/go-spew"
|
name = "github.com/davecgh/go-spew"
|
||||||
packages = ["spew"]
|
packages = ["spew"]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "346938d642f2ec3594ed81d874461961cd0faa76"
|
revision = "346938d642f2ec3594ed81d874461961cd0faa76"
|
||||||
version = "v1.1.0"
|
version = "v1.1.0"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:ace1aef6acdf2c4647365dc87c14fb8b71ed8bb0b3ae114ffb216614a24da219"
|
||||||
name = "github.com/dghubble/sling"
|
name = "github.com/dghubble/sling"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "eb56e89ac5088bebb12eef3cb4b293300f43608b"
|
revision = "eb56e89ac5088bebb12eef3cb4b293300f43608b"
|
||||||
version = "v1.1.0"
|
version = "v1.1.0"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:d912bf9afc98bbb6539ea99c9ac3e83119853310dd1a3aec1583d76f340ece27"
|
||||||
name = "github.com/dgrijalva/jwt-go"
|
name = "github.com/dgrijalva/jwt-go"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "d2709f9f1f31ebcda9651b03077758c1f3a0018c"
|
revision = "d2709f9f1f31ebcda9651b03077758c1f3a0018c"
|
||||||
version = "v3.0.0"
|
version = "v3.0.0"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:5a39bab16f84dd753a3af60076a915b55584cc6df3b3dfba53bfd48bf4420e77"
|
||||||
name = "github.com/docker/distribution"
|
name = "github.com/docker/distribution"
|
||||||
packages = [
|
packages = [
|
||||||
".",
|
".",
|
||||||
"context",
|
"context",
|
||||||
"digest",
|
"digest",
|
||||||
|
"health",
|
||||||
"manifest",
|
"manifest",
|
||||||
"manifest/schema1",
|
"manifest/schema1",
|
||||||
"manifest/schema2",
|
"manifest/schema2",
|
||||||
"reference",
|
"reference",
|
||||||
|
"registry/api/errcode",
|
||||||
"registry/auth",
|
"registry/auth",
|
||||||
"registry/auth/token",
|
"registry/auth/token",
|
||||||
"registry/client/auth/challenge",
|
"registry/client/auth/challenge",
|
||||||
"uuid"
|
"uuid",
|
||||||
]
|
]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "48294d928ced5dd9b378f7fd7c6f5da3ff3f2c89"
|
revision = "48294d928ced5dd9b378f7fd7c6f5da3ff3f2c89"
|
||||||
version = "v2.6.2"
|
version = "v2.6.2"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
|
digest = "1:72ba344e60095ac4fe0eac56f56fe95644421670b808238a1c849ea92721037e"
|
||||||
name = "github.com/docker/go"
|
name = "github.com/docker/go"
|
||||||
packages = ["canonical/json"]
|
packages = ["canonical/json"]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "d30aec9fd63c35133f8f79c3412ad91a3b08be06"
|
revision = "d30aec9fd63c35133f8f79c3412ad91a3b08be06"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
|
digest = "1:4841e14252a2cecf11840bd05230412ad469709bbacfc12467e2ce5ad07f339b"
|
||||||
name = "github.com/docker/libtrust"
|
name = "github.com/docker/libtrust"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "aabc10ec26b754e797f9028f4589c5b7bd90dc20"
|
revision = "aabc10ec26b754e797f9028f4589c5b7bd90dc20"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:fea1a444386b05e00dfcf2cb9a95fb09e11f1689056161471229baa4a7a65459"
|
||||||
name = "github.com/docker/notary"
|
name = "github.com/docker/notary"
|
||||||
packages = [
|
packages = [
|
||||||
".",
|
".",
|
||||||
@ -145,32 +178,40 @@
|
|||||||
"tuf/data",
|
"tuf/data",
|
||||||
"tuf/signed",
|
"tuf/signed",
|
||||||
"tuf/utils",
|
"tuf/utils",
|
||||||
"tuf/validation"
|
"tuf/validation",
|
||||||
]
|
]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "c04e3e6d05881045def11167c51d4a8baa34899a"
|
revision = "c04e3e6d05881045def11167c51d4a8baa34899a"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:0594af97b2f4cec6554086eeace6597e20a4b69466eb4ada25adf9f4300dddd2"
|
||||||
name = "github.com/garyburd/redigo"
|
name = "github.com/garyburd/redigo"
|
||||||
packages = [
|
packages = [
|
||||||
"internal",
|
"internal",
|
||||||
"redis"
|
"redis",
|
||||||
]
|
]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "a69d19351219b6dd56f274f96d85a7014a2ec34e"
|
revision = "a69d19351219b6dd56f274f96d85a7014a2ec34e"
|
||||||
version = "v1.6.0"
|
version = "v1.6.0"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:2cd7915ab26ede7d95b8749e6b1f933f1c6d5398030684e6505940a10f31cfda"
|
||||||
name = "github.com/ghodss/yaml"
|
name = "github.com/ghodss/yaml"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "0ca9ea5df5451ffdf184b4428c902747c2c11cd7"
|
revision = "0ca9ea5df5451ffdf184b4428c902747c2c11cd7"
|
||||||
version = "v1.0.0"
|
version = "v1.0.0"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:850c49ca338a10fec2cb9e78f793043ed23965489d09e30bcc19fe29719da313"
|
||||||
name = "github.com/go-sql-driver/mysql"
|
name = "github.com/go-sql-driver/mysql"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "a0583e0143b1624142adab07e0e97fe106d99561"
|
revision = "a0583e0143b1624142adab07e0e97fe106d99561"
|
||||||
version = "v1.3"
|
version = "v1.3"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:9ae31ce33b4bab257668963e844d98765b44160be4ee98cafc44637a213e530d"
|
||||||
name = "github.com/gobwas/glob"
|
name = "github.com/gobwas/glob"
|
||||||
packages = [
|
packages = [
|
||||||
".",
|
".",
|
||||||
@ -180,131 +221,168 @@
|
|||||||
"syntax/ast",
|
"syntax/ast",
|
||||||
"syntax/lexer",
|
"syntax/lexer",
|
||||||
"util/runes",
|
"util/runes",
|
||||||
"util/strings"
|
"util/strings",
|
||||||
]
|
]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "5ccd90ef52e1e632236f7326478d4faa74f99438"
|
revision = "5ccd90ef52e1e632236f7326478d4faa74f99438"
|
||||||
version = "v0.2.3"
|
version = "v0.2.3"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:615643b442214e7a9bade98fa7d50ec072fd17bdc5c955daa194b32e73a532a8"
|
||||||
name = "github.com/gocraft/work"
|
name = "github.com/gocraft/work"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "1d4117a214abff263b472043871c8666aedb716b"
|
revision = "1d4117a214abff263b472043871c8666aedb716b"
|
||||||
version = "v0.5.1"
|
version = "v0.5.1"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:39d9284259004077d3b89109d592fce5f311788745ce94a7ccd4545e536ad3ac"
|
||||||
name = "github.com/golang-migrate/migrate"
|
name = "github.com/golang-migrate/migrate"
|
||||||
packages = [
|
packages = [
|
||||||
".",
|
".",
|
||||||
"database",
|
"database",
|
||||||
"database/postgres",
|
"database/postgres",
|
||||||
"source",
|
"source",
|
||||||
"source/file"
|
"source/file",
|
||||||
]
|
]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "bcd996f3df28363f43e2d0935484c4559537a3eb"
|
revision = "bcd996f3df28363f43e2d0935484c4559537a3eb"
|
||||||
version = "v3.3.0"
|
version = "v3.3.0"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:41e5cefde26c58f1560df2d1c32c2fa85e332d7cb4460d2077ae8fd8e0f3d789"
|
||||||
name = "github.com/golang/protobuf"
|
name = "github.com/golang/protobuf"
|
||||||
packages = [
|
packages = [
|
||||||
"proto",
|
"proto",
|
||||||
"ptypes/any",
|
"ptypes/any",
|
||||||
"ptypes/timestamp"
|
"ptypes/timestamp",
|
||||||
]
|
]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "130e6b02ab059e7b717a096f397c5b60111cae74"
|
revision = "130e6b02ab059e7b717a096f397c5b60111cae74"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:38ec74012390146c45af1f92d46e5382b50531247929ff3a685d2b2be65155ac"
|
||||||
name = "github.com/gomodule/redigo"
|
name = "github.com/gomodule/redigo"
|
||||||
packages = [
|
packages = [
|
||||||
"internal",
|
"internal",
|
||||||
"redis"
|
"redis",
|
||||||
]
|
]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "9c11da706d9b7902c6da69c592f75637793fe121"
|
revision = "9c11da706d9b7902c6da69c592f75637793fe121"
|
||||||
version = "v2.0.0"
|
version = "v2.0.0"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
|
digest = "1:a63cff6b5d8b95638bfe300385d93b2a6d9d687734b863da8e09dc834510a690"
|
||||||
name = "github.com/google/go-querystring"
|
name = "github.com/google/go-querystring"
|
||||||
packages = ["query"]
|
packages = ["query"]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "53e6ce116135b80d037921a7fdd5138cf32d7a8a"
|
revision = "53e6ce116135b80d037921a7fdd5138cf32d7a8a"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:160eabf7a69910fd74f29c692718bc2437c1c1c7d4c9dea9712357752a70e5df"
|
||||||
name = "github.com/gorilla/context"
|
name = "github.com/gorilla/context"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "1ea25387ff6f684839d82767c1733ff4d4d15d0a"
|
revision = "1ea25387ff6f684839d82767c1733ff4d4d15d0a"
|
||||||
version = "v1.1"
|
version = "v1.1"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:185a43b59a1f4e7ad4e7ccafb8a1538193d897a2a75be16dda093ec42ad231cf"
|
||||||
name = "github.com/gorilla/handlers"
|
name = "github.com/gorilla/handlers"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "90663712d74cb411cbef281bc1e08c19d1a76145"
|
revision = "90663712d74cb411cbef281bc1e08c19d1a76145"
|
||||||
version = "v1.3.0"
|
version = "v1.3.0"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:3c44722a6360b8d8abf6f70f122c69007189be992a150e39571224c54a9bc380"
|
||||||
name = "github.com/gorilla/mux"
|
name = "github.com/gorilla/mux"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "7f08801859139f86dfafd1c296e2cba9a80d292e"
|
revision = "7f08801859139f86dfafd1c296e2cba9a80d292e"
|
||||||
version = "v1.6.0"
|
version = "v1.6.0"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
|
digest = "1:bd26bbaf1e9f9dfe829a88f87a0849b56f717c31785443a67668f2c752fa8412"
|
||||||
name = "github.com/lib/pq"
|
name = "github.com/lib/pq"
|
||||||
packages = [
|
packages = [
|
||||||
".",
|
".",
|
||||||
"oid"
|
"oid",
|
||||||
]
|
]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "b2004221932bd6b13167ef654c81cffac36f7537"
|
revision = "b2004221932bd6b13167ef654c81cffac36f7537"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:ee0845ea64262e3d1a6e2eab768fcb2008a0c8e571b7a3bebea554a1c031aeeb"
|
||||||
name = "github.com/mattn/go-sqlite3"
|
name = "github.com/mattn/go-sqlite3"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "6c771bb9887719704b210e87e934f08be014bdb1"
|
revision = "6c771bb9887719704b210e87e934f08be014bdb1"
|
||||||
version = "v1.6.0"
|
version = "v1.6.0"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:5113b1edf6e2f370f9ce6101e7b5a86c3e8decd108067e34b762ae91e42964ee"
|
||||||
name = "github.com/miekg/pkcs11"
|
name = "github.com/miekg/pkcs11"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "7283ca79f35edb89bc1b4ecae7f86a3680ce737f"
|
revision = "7283ca79f35edb89bc1b4ecae7f86a3680ce737f"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:159d8a990f45d4891f1f04cb6ad7eb18b307cd02d783f7d37fa7a3b93912b172"
|
||||||
name = "github.com/opencontainers/go-digest"
|
name = "github.com/opencontainers/go-digest"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "aa2ec055abd10d26d539eb630a92241b781ce4bc"
|
revision = "aa2ec055abd10d26d539eb630a92241b781ce4bc"
|
||||||
version = "v1.0.0-rc0"
|
version = "v1.0.0-rc0"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:40e195917a951a8bf867cd05de2a46aaf1806c50cf92eebf4c16f78cd196f747"
|
||||||
name = "github.com/pkg/errors"
|
name = "github.com/pkg/errors"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "645ef00459ed84a119197bfb8d8205042c6df63d"
|
revision = "645ef00459ed84a119197bfb8d8205042c6df63d"
|
||||||
version = "v0.8.0"
|
version = "v0.8.0"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:0028cb19b2e4c3112225cd871870f2d9cf49b9b4276531f03438a88e94be86fe"
|
||||||
name = "github.com/pmezard/go-difflib"
|
name = "github.com/pmezard/go-difflib"
|
||||||
packages = ["difflib"]
|
packages = ["difflib"]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "792786c7400a136282c1664665ae0a8db921c6c2"
|
revision = "792786c7400a136282c1664665ae0a8db921c6c2"
|
||||||
version = "v1.0.0"
|
version = "v1.0.0"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:3f68283c56d93b885f33c679708079e834815138649e9f59ffbc572c2993e0f8"
|
||||||
name = "github.com/robfig/cron"
|
name = "github.com/robfig/cron"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "b024fc5ea0e34bc3f83d9941c8d60b0622bfaca4"
|
revision = "b024fc5ea0e34bc3f83d9941c8d60b0622bfaca4"
|
||||||
version = "v1"
|
version = "v1"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:9424f440bba8f7508b69414634aef3b2b3a877e522d8a4624692412805407bb7"
|
||||||
name = "github.com/spf13/pflag"
|
name = "github.com/spf13/pflag"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "583c0c0531f06d5278b7d917446061adc344b5cd"
|
revision = "583c0c0531f06d5278b7d917446061adc344b5cd"
|
||||||
version = "v1.0.1"
|
version = "v1.0.1"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:994df93785d966f82180e17a0857fa53f7155cddca3898ad00b27e8d4481e4ae"
|
||||||
name = "github.com/stretchr/testify"
|
name = "github.com/stretchr/testify"
|
||||||
packages = [
|
packages = [
|
||||||
"assert",
|
"assert",
|
||||||
"require"
|
"require",
|
||||||
|
"suite",
|
||||||
]
|
]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "b91bfb9ebec76498946beb6af7c0230c7cc7ba6c"
|
revision = "b91bfb9ebec76498946beb6af7c0230c7cc7ba6c"
|
||||||
version = "v1.2.0"
|
version = "v1.2.0"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:9c94d918a2ac65f60d6b7895b2e9612e4554b40ee2446f2f807cadb3e57da7e2"
|
||||||
name = "golang.org/x/crypto"
|
name = "golang.org/x/crypto"
|
||||||
packages = [
|
packages = [
|
||||||
"cast5",
|
"cast5",
|
||||||
@ -316,34 +394,42 @@
|
|||||||
"openpgp/packet",
|
"openpgp/packet",
|
||||||
"openpgp/s2k",
|
"openpgp/s2k",
|
||||||
"pbkdf2",
|
"pbkdf2",
|
||||||
"ssh/terminal"
|
"ssh/terminal",
|
||||||
]
|
]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "5f961cd492ac9d43fc33a8ef646bae79d113fd97"
|
revision = "5f961cd492ac9d43fc33a8ef646bae79d113fd97"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:3373df9a79dbfdec0111498a2358444eee9f70c3748ee0e0c2a1ad993978f676"
|
||||||
name = "golang.org/x/net"
|
name = "golang.org/x/net"
|
||||||
packages = [
|
packages = [
|
||||||
"context",
|
"context",
|
||||||
"context/ctxhttp"
|
"context/ctxhttp",
|
||||||
]
|
]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "075e191f18186a8ff2becaf64478e30f4545cdad"
|
revision = "075e191f18186a8ff2becaf64478e30f4545cdad"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:3d57c230f6800023b6fec274f38a139337b5fc0d00169a100a538eb3ef5e3da8"
|
||||||
name = "golang.org/x/oauth2"
|
name = "golang.org/x/oauth2"
|
||||||
packages = [
|
packages = [
|
||||||
".",
|
".",
|
||||||
"clientcredentials",
|
"clientcredentials",
|
||||||
"internal"
|
"internal",
|
||||||
]
|
]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "bb50c06baba3d0c76f9d125c0719093e315b5b44"
|
revision = "bb50c06baba3d0c76f9d125c0719093e315b5b44"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
|
digest = "1:f21f21efdd315b95a015ffd7ddca70ca60ff021848618b5a4efd88bb1603335f"
|
||||||
name = "golang.org/x/sys"
|
name = "golang.org/x/sys"
|
||||||
packages = ["unix"]
|
packages = ["unix"]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "571f7bbbe08da2a8955aed9d4db316e78630e9a3"
|
revision = "571f7bbbe08da2a8955aed9d4db316e78630e9a3"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:52133d6859535332391e6193c8878d06347f28881111efa900392802485e9a18"
|
||||||
name = "google.golang.org/appengine"
|
name = "google.golang.org/appengine"
|
||||||
packages = [
|
packages = [
|
||||||
"internal",
|
"internal",
|
||||||
@ -352,41 +438,53 @@
|
|||||||
"internal/log",
|
"internal/log",
|
||||||
"internal/remote_api",
|
"internal/remote_api",
|
||||||
"internal/urlfetch",
|
"internal/urlfetch",
|
||||||
"urlfetch"
|
"urlfetch",
|
||||||
]
|
]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "24e4144ec923c2374f6b06610c0df16a9222c3d9"
|
revision = "24e4144ec923c2374f6b06610c0df16a9222c3d9"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:79decf236a2000df456fe7478fd23da8af950563c922747b299e1fab7fa7d78f"
|
||||||
name = "gopkg.in/asn1-ber.v1"
|
name = "gopkg.in/asn1-ber.v1"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "4e86f4367175e39f69d9358a5f17b4dda270378d"
|
revision = "4e86f4367175e39f69d9358a5f17b4dda270378d"
|
||||||
version = "v1.1"
|
version = "v1.1"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:79691acfc86fc3204928daf67e44955e8021ec5e10091599d344b0e16de32236"
|
||||||
name = "gopkg.in/ldap.v2"
|
name = "gopkg.in/ldap.v2"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "8168ee085ee43257585e50c6441aadf54ecb2c9f"
|
revision = "8168ee085ee43257585e50c6441aadf54ecb2c9f"
|
||||||
version = "v2.5.0"
|
version = "v2.5.0"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:2a81c6e126d36ad027328cffaa4888fc3be40f09dc48028d1f93705b718130b9"
|
||||||
name = "gopkg.in/yaml.v2"
|
name = "gopkg.in/yaml.v2"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "7f97868eec74b32b0982dd158a51a446d1da7eb5"
|
revision = "7f97868eec74b32b0982dd158a51a446d1da7eb5"
|
||||||
version = "v2.1.1"
|
version = "v2.1.1"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
|
digest = "1:8dce42a5fac31cbfdc756bd244389280a905a5364b21dd44cdcb044ee622bf8b"
|
||||||
name = "k8s.io/apimachinery"
|
name = "k8s.io/apimachinery"
|
||||||
packages = ["pkg/version"]
|
packages = ["pkg/version"]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "f534d624797b270e5e46104dc7e2c2d61edbb85d"
|
revision = "f534d624797b270e5e46104dc7e2c2d61edbb85d"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:bf83d8940d59a175dad5ba323b47c6e62b3ba2dc9b2d449f629288deeeeb6582"
|
||||||
name = "k8s.io/client-go"
|
name = "k8s.io/client-go"
|
||||||
packages = ["util/homedir"]
|
packages = ["util/homedir"]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "7d04d0e2a0a1a4d4a1cd6baa432a2301492e4e65"
|
revision = "7d04d0e2a0a1a4d4a1cd6baa432a2301492e4e65"
|
||||||
version = "v8.0.0"
|
version = "v8.0.0"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
|
digest = "1:1076dbb6a69b965ccfda2a06a04e5038db78eff586f74b5daf4a41444e6f6077"
|
||||||
name = "k8s.io/helm"
|
name = "k8s.io/helm"
|
||||||
packages = [
|
packages = [
|
||||||
"cmd/helm/search",
|
"cmd/helm/search",
|
||||||
@ -403,14 +501,73 @@
|
|||||||
"pkg/sympath",
|
"pkg/sympath",
|
||||||
"pkg/tlsutil",
|
"pkg/tlsutil",
|
||||||
"pkg/urlutil",
|
"pkg/urlutil",
|
||||||
"pkg/version"
|
"pkg/version",
|
||||||
]
|
]
|
||||||
|
pruneopts = "UT"
|
||||||
revision = "20adb27c7c5868466912eebdf6664e7390ebe710"
|
revision = "20adb27c7c5868466912eebdf6664e7390ebe710"
|
||||||
version = "v2.9.1"
|
version = "v2.9.1"
|
||||||
|
|
||||||
[solve-meta]
|
[solve-meta]
|
||||||
analyzer-name = "dep"
|
analyzer-name = "dep"
|
||||||
analyzer-version = 1
|
analyzer-version = 1
|
||||||
inputs-digest = "862941e7de65d953c0133ea4b290a079990f38c7cd6e2f1139ac78706d0912b3"
|
input-imports = [
|
||||||
|
"github.com/Masterminds/semver",
|
||||||
|
"github.com/astaxie/beego",
|
||||||
|
"github.com/astaxie/beego/cache",
|
||||||
|
"github.com/astaxie/beego/cache/redis",
|
||||||
|
"github.com/astaxie/beego/context",
|
||||||
|
"github.com/astaxie/beego/orm",
|
||||||
|
"github.com/astaxie/beego/session",
|
||||||
|
"github.com/astaxie/beego/session/redis",
|
||||||
|
"github.com/astaxie/beego/validation",
|
||||||
|
"github.com/beego/i18n",
|
||||||
|
"github.com/casbin/casbin",
|
||||||
|
"github.com/casbin/casbin/model",
|
||||||
|
"github.com/casbin/casbin/persist",
|
||||||
|
"github.com/casbin/casbin/util",
|
||||||
|
"github.com/dghubble/sling",
|
||||||
|
"github.com/dgrijalva/jwt-go",
|
||||||
|
"github.com/docker/distribution",
|
||||||
|
"github.com/docker/distribution/digest",
|
||||||
|
"github.com/docker/distribution/health",
|
||||||
|
"github.com/docker/distribution/manifest/schema1",
|
||||||
|
"github.com/docker/distribution/manifest/schema2",
|
||||||
|
"github.com/docker/distribution/reference",
|
||||||
|
"github.com/docker/distribution/registry/auth/token",
|
||||||
|
"github.com/docker/distribution/registry/client/auth/challenge",
|
||||||
|
"github.com/docker/distribution/uuid",
|
||||||
|
"github.com/docker/libtrust",
|
||||||
|
"github.com/docker/notary",
|
||||||
|
"github.com/docker/notary/client",
|
||||||
|
"github.com/docker/notary/trustpinning",
|
||||||
|
"github.com/docker/notary/tuf/data",
|
||||||
|
"github.com/garyburd/redigo/redis",
|
||||||
|
"github.com/ghodss/yaml",
|
||||||
|
"github.com/go-sql-driver/mysql",
|
||||||
|
"github.com/gocraft/work",
|
||||||
|
"github.com/golang-migrate/migrate",
|
||||||
|
"github.com/golang-migrate/migrate/database/postgres",
|
||||||
|
"github.com/golang-migrate/migrate/source/file",
|
||||||
|
"github.com/gomodule/redigo/redis",
|
||||||
|
"github.com/gorilla/handlers",
|
||||||
|
"github.com/gorilla/mux",
|
||||||
|
"github.com/lib/pq",
|
||||||
|
"github.com/mattn/go-sqlite3",
|
||||||
|
"github.com/opencontainers/go-digest",
|
||||||
|
"github.com/pkg/errors",
|
||||||
|
"github.com/robfig/cron",
|
||||||
|
"github.com/stretchr/testify/assert",
|
||||||
|
"github.com/stretchr/testify/require",
|
||||||
|
"github.com/stretchr/testify/suite",
|
||||||
|
"golang.org/x/crypto/pbkdf2",
|
||||||
|
"golang.org/x/oauth2",
|
||||||
|
"golang.org/x/oauth2/clientcredentials",
|
||||||
|
"gopkg.in/ldap.v2",
|
||||||
|
"gopkg.in/yaml.v2",
|
||||||
|
"k8s.io/helm/cmd/helm/search",
|
||||||
|
"k8s.io/helm/pkg/chartutil",
|
||||||
|
"k8s.io/helm/pkg/proto/hapi/chart",
|
||||||
|
"k8s.io/helm/pkg/repo",
|
||||||
|
]
|
||||||
solver-name = "gps-cdcl"
|
solver-name = "gps-cdcl"
|
||||||
solver-version = 1
|
solver-version = 1
|
||||||
|
@ -85,8 +85,7 @@ func (c *CfgManager) loadDefault() {
|
|||||||
// Init Default Value
|
// Init Default Value
|
||||||
itemArray := metadata.Instance().GetAll()
|
itemArray := metadata.Instance().GetAll()
|
||||||
for _, item := range itemArray {
|
for _, item := range itemArray {
|
||||||
// Every string type have default value, other types should have a default value
|
if len(item.DefaultValue) > 0 {
|
||||||
if _, ok := item.ItemType.(*metadata.StringType); ok || len(item.DefaultValue) > 0 {
|
|
||||||
cfgValue, err := metadata.NewCfgValue(item.Name, item.DefaultValue)
|
cfgValue, err := metadata.NewCfgValue(item.Name, item.DefaultValue)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("loadDefault failed, config item, key: %v, err: %v", item.Name, err)
|
log.Errorf("loadDefault failed, config item, key: %v, err: %v", item.Name, err)
|
||||||
@ -148,10 +147,17 @@ func (c *CfgManager) GetUserCfgs() map[string]interface{} {
|
|||||||
if item.Scope == metadata.UserScope {
|
if item.Scope == metadata.UserScope {
|
||||||
cfgValue, err := c.store.GetAnyType(item.Name)
|
cfgValue, err := c.store.GetAnyType(item.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err != metadata.ErrValueNotSet {
|
if err == metadata.ErrValueNotSet {
|
||||||
|
if _, ok := item.ItemType.(*metadata.StringType); ok {
|
||||||
|
cfgValue = ""
|
||||||
|
}
|
||||||
|
if _, ok := item.ItemType.(*metadata.NonEmptyStringType); ok {
|
||||||
|
cfgValue = ""
|
||||||
|
}
|
||||||
|
} else {
|
||||||
log.Errorf("Failed to get value of key %v, error %v", item.Name, err)
|
log.Errorf("Failed to get value of key %v, error %v", item.Name, err)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
resultMap[item.Name] = cfgValue
|
resultMap[item.Name] = cfgValue
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,11 @@ package config
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/goharbor/harbor/src/common/utils/test"
|
|
||||||
"github.com/stretchr/testify/assert"
|
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/goharbor/harbor/src/common/utils/test"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
var TestDBConfig = map[string]interface{}{
|
var TestDBConfig = map[string]interface{}{
|
||||||
@ -36,6 +37,12 @@ func TestLoadFromDatabase(t *testing.T) {
|
|||||||
assert.Equal(t, `{"parameter":{"daily_time":0},"type":"daily"}`, configManager.Get("scan_all_policy").GetString())
|
assert.Equal(t, `{"parameter":{"daily_time":0},"type":"daily"}`, configManager.Get("scan_all_policy").GetString())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestLoadUserCfg(t *testing.T) {
|
||||||
|
configMap := configManager.GetUserCfgs()
|
||||||
|
assert.NotNil(t, configMap["ldap_url"])
|
||||||
|
assert.NotNil(t, configMap["ldap_base_dn"])
|
||||||
|
}
|
||||||
|
|
||||||
func TestSaveToDatabase(t *testing.T) {
|
func TestSaveToDatabase(t *testing.T) {
|
||||||
fmt.Printf("database config %#v\n", configManager.GetDatabaseCfg())
|
fmt.Printf("database config %#v\n", configManager.GetDatabaseCfg())
|
||||||
configManager.Load()
|
configManager.Load()
|
||||||
|
@ -29,7 +29,7 @@ type Robot struct {
|
|||||||
Name string `orm:"column(name)" json:"name"`
|
Name string `orm:"column(name)" json:"name"`
|
||||||
Description string `orm:"column(description)" json:"description"`
|
Description string `orm:"column(description)" json:"description"`
|
||||||
ProjectID int64 `orm:"column(project_id)" json:"project_id"`
|
ProjectID int64 `orm:"column(project_id)" json:"project_id"`
|
||||||
ExpiresAt int64 `orm:"column(expiresat)" json:"expiresat"`
|
ExpiresAt int64 `orm:"column(expiresat)" json:"expires_at"`
|
||||||
Disabled bool `orm:"column(disabled)" json:"disabled"`
|
Disabled bool `orm:"column(disabled)" json:"disabled"`
|
||||||
CreationTime time.Time `orm:"column(creation_time);auto_now_add" json:"creation_time"`
|
CreationTime time.Time `orm:"column(creation_time);auto_now_add" json:"creation_time"`
|
||||||
UpdateTime time.Time `orm:"column(update_time);auto_now" json:"update_time"`
|
UpdateTime time.Time `orm:"column(update_time);auto_now" json:"update_time"`
|
||||||
|
@ -93,6 +93,7 @@ type GeneralInfo struct {
|
|||||||
WithAdmiral bool `json:"with_admiral"`
|
WithAdmiral bool `json:"with_admiral"`
|
||||||
AdmiralEndpoint string `json:"admiral_endpoint"`
|
AdmiralEndpoint string `json:"admiral_endpoint"`
|
||||||
AuthMode string `json:"auth_mode"`
|
AuthMode string `json:"auth_mode"`
|
||||||
|
AuthProxySettings *models.HTTPAuthProxy `json:"authproxy_settings,omitempty"`
|
||||||
RegistryURL string `json:"registry_url"`
|
RegistryURL string `json:"registry_url"`
|
||||||
ProjectCreationRestrict string `json:"project_creation_restriction"`
|
ProjectCreationRestrict string `json:"project_creation_restriction"`
|
||||||
SelfRegistration bool `json:"self_registration"`
|
SelfRegistration bool `json:"self_registration"`
|
||||||
@ -186,6 +187,13 @@ func (sia *SystemInfoAPI) GetGeneralInfo() {
|
|||||||
if info.WithClair {
|
if info.WithClair {
|
||||||
info.ClairVulnStatus = getClairVulnStatus()
|
info.ClairVulnStatus = getClairVulnStatus()
|
||||||
}
|
}
|
||||||
|
if info.AuthMode == common.HTTPAuth {
|
||||||
|
if s, err := config.HTTPAuthProxySetting(); err == nil {
|
||||||
|
info.AuthProxySettings = s
|
||||||
|
} else {
|
||||||
|
log.Warningf("Failed to get auth proxy setting, error: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
sia.Data["json"] = info
|
sia.Data["json"] = info
|
||||||
sia.ServeJSON()
|
sia.ServeJSON()
|
||||||
}
|
}
|
||||||
|
@ -394,11 +394,11 @@ export class MyAccessLogService extends AccessLogService {
|
|||||||
*
|
*
|
||||||
* @param {(number | string)} projectId
|
* @param {(number | string)} projectId
|
||||||
* @param {RequestQueryParams} [queryParams]
|
* @param {RequestQueryParams} [queryParams]
|
||||||
* @returns {(Observable<AccessLog[]> | Promise<AccessLog[]> | AccessLog[])}
|
* @returns {(Observable<AccessLog[]>)}
|
||||||
*
|
*
|
||||||
* @memberOf AccessLogService
|
* @memberOf AccessLogService
|
||||||
*/
|
*/
|
||||||
getAuditLogs(projectId: number | string, queryParams?: RequestQueryParams): Observable<AccessLog[]> | Promise<AccessLog[]> | AccessLog[]{
|
getAuditLogs(projectId: number | string, queryParams?: RequestQueryParams): Observable<AccessLog[]> {
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -406,11 +406,11 @@ export class MyAccessLogService extends AccessLogService {
|
|||||||
* Get the recent logs.
|
* Get the recent logs.
|
||||||
*
|
*
|
||||||
* @param {number} lines : Specify how many lines should be returned.
|
* @param {number} lines : Specify how many lines should be returned.
|
||||||
* @returns {(Observable<AccessLog[]> | Promise<AccessLog[]> | AccessLog[])}
|
* @returns {(Observable<AccessLog[]>)}
|
||||||
*
|
*
|
||||||
* @memberOf AccessLogService
|
* @memberOf AccessLogService
|
||||||
*/
|
*/
|
||||||
getRecentLogs(lines: number): Observable<AccessLog[]> | Promise<AccessLog[]> | AccessLog[]{
|
getRecentLogs(lines: number): Observable<AccessLog[]>{
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -437,7 +437,7 @@ export class MyEndpointService extends EndpointService {
|
|||||||
*
|
*
|
||||||
* @memberOf EndpointService
|
* @memberOf EndpointService
|
||||||
*/
|
*/
|
||||||
getEndpoints(endpointName?: string, queryParams?: RequestQueryParams): Observable<Endpoint[]> | Promise<Endpoint[]> | Endpoint[] {
|
getEndpoints(endpointName?: string, queryParams?: RequestQueryParams): Observable<Endpoint[]> {
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -449,7 +449,7 @@ export class MyEndpointService extends EndpointService {
|
|||||||
*
|
*
|
||||||
* @memberOf EndpointService
|
* @memberOf EndpointService
|
||||||
*/
|
*/
|
||||||
getEndpoint(endpointId: number | string): Observable<Endpoint> | Promise<Endpoint> | Endpoint {
|
getEndpoint(endpointId: number | string): Observable<Endpoint>{
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -461,7 +461,7 @@ export class MyEndpointService extends EndpointService {
|
|||||||
*
|
*
|
||||||
* @memberOf EndpointService
|
* @memberOf EndpointService
|
||||||
*/
|
*/
|
||||||
createEndpoint(endpoint: Endpoint): Observable<any> | Promise<any> | any {
|
createEndpoint(endpoint: Endpoint): Observable<any> {
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -474,7 +474,7 @@ export class MyEndpointService extends EndpointService {
|
|||||||
*
|
*
|
||||||
* @memberOf EndpointService
|
* @memberOf EndpointService
|
||||||
*/
|
*/
|
||||||
updateEndpoint(endpointId: number | string, endpoint: Endpoint): Observable<any> | Promise<any> | any {
|
updateEndpoint(endpointId: number | string, endpoint: Endpoint): Observable<any> {
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -486,7 +486,7 @@ export class MyEndpointService extends EndpointService {
|
|||||||
*
|
*
|
||||||
* @memberOf EndpointService
|
* @memberOf EndpointService
|
||||||
*/
|
*/
|
||||||
deleteEndpoint(endpointId: number | string): Observable<any> | Promise<any> | any {
|
deleteEndpoint(endpointId: number | string): Observable<any> {
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -498,7 +498,7 @@ export class MyEndpointService extends EndpointService {
|
|||||||
*
|
*
|
||||||
* @memberOf EndpointService
|
* @memberOf EndpointService
|
||||||
*/
|
*/
|
||||||
pingEndpoint(endpoint: Endpoint): Observable<any> | Promise<any> | any {
|
pingEndpoint(endpoint: Endpoint): Observable<any> {
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -508,7 +508,7 @@ export class MyEndpointService extends EndpointService {
|
|||||||
* @param {{number | string}} endpointId
|
* @param {{number | string}} endpointId
|
||||||
* @returns {{Observable<any> | any}}
|
* @returns {{Observable<any> | any}}
|
||||||
*/
|
*/
|
||||||
getEndpointWithReplicationRules(endpointId: number | string): Observable<any> | Promise<any> | any {
|
getEndpointWithReplicationRules(endpointId: number | string): Observable<any> {
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -534,11 +534,11 @@ export class MyReplicationService extends ReplicationService {
|
|||||||
* @param {(number | string)} [projectId]
|
* @param {(number | string)} [projectId]
|
||||||
* @param {string} [ruleName]
|
* @param {string} [ruleName]
|
||||||
* @param {RequestQueryParams} [queryParams]
|
* @param {RequestQueryParams} [queryParams]
|
||||||
* @returns {(Observable<ReplicationRule[]> | Promise<ReplicationRule[]> | ReplicationRule[])}
|
* @returns {(Observable<ReplicationRule[]>)}
|
||||||
*
|
*
|
||||||
* @memberOf ReplicationService
|
* @memberOf ReplicationService
|
||||||
*/
|
*/
|
||||||
getReplicationRules(projectId?: number | string, ruleName?: string, queryParams?: RequestQueryParams): Observable<ReplicationRule[]> | Promise<ReplicationRule[]> | ReplicationRule[] {
|
getReplicationRules(projectId?: number | string, ruleName?: string, queryParams?: RequestQueryParams): Observable<ReplicationRule[]> {
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -546,11 +546,11 @@ export class MyReplicationService extends ReplicationService {
|
|||||||
* Get the specified replication rule.
|
* Get the specified replication rule.
|
||||||
*
|
*
|
||||||
* @param {(number | string)} ruleId
|
* @param {(number | string)} ruleId
|
||||||
* @returns {(Observable<ReplicationRule> | Promise<ReplicationRule> | ReplicationRule)}
|
* @returns {(Observable<ReplicationRule>)}
|
||||||
*
|
*
|
||||||
* @memberOf ReplicationService
|
* @memberOf ReplicationService
|
||||||
*/
|
*/
|
||||||
getReplicationRule(ruleId: number | string): Observable<ReplicationRule> | Promise<ReplicationRule> | ReplicationRule {
|
getReplicationRule(ruleId: number | string): Observable<ReplicationRule> {
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -558,11 +558,11 @@ export class MyReplicationService extends ReplicationService {
|
|||||||
* Create new replication rule.
|
* Create new replication rule.
|
||||||
*
|
*
|
||||||
* @param {ReplicationRule} replicationRule
|
* @param {ReplicationRule} replicationRule
|
||||||
* @returns {(Observable<any> | Promise<any> | any)}
|
* @returns {(Observable<any>)}
|
||||||
*
|
*
|
||||||
* @memberOf ReplicationService
|
* @memberOf ReplicationService
|
||||||
*/
|
*/
|
||||||
createReplicationRule(replicationRule: ReplicationRule): Observable<any> | Promise<any> | any {
|
createReplicationRule(replicationRule: ReplicationRule): Observable<any> {
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -570,11 +570,11 @@ export class MyReplicationService extends ReplicationService {
|
|||||||
* Update the specified replication rule.
|
* Update the specified replication rule.
|
||||||
*
|
*
|
||||||
* @param {ReplicationRule} replicationRule
|
* @param {ReplicationRule} replicationRule
|
||||||
* @returns {(Observable<any> | Promise<any> | any)}
|
* @returns {(Observable<any>)}
|
||||||
*
|
*
|
||||||
* @memberOf ReplicationService
|
* @memberOf ReplicationService
|
||||||
*/
|
*/
|
||||||
updateReplicationRule(replicationRule: ReplicationRule): Observable<any> | Promise<any> | any {
|
updateReplicationRule(replicationRule: ReplicationRule): Observable<any> {
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -582,11 +582,11 @@ export class MyReplicationService extends ReplicationService {
|
|||||||
* Delete the specified replication rule.
|
* Delete the specified replication rule.
|
||||||
*
|
*
|
||||||
* @param {(number | string)} ruleId
|
* @param {(number | string)} ruleId
|
||||||
* @returns {(Observable<any> | Promise<any> | any)}
|
* @returns {(Observable<any>)}
|
||||||
*
|
*
|
||||||
* @memberOf ReplicationService
|
* @memberOf ReplicationService
|
||||||
*/
|
*/
|
||||||
deleteReplicationRule(ruleId: number | string): Observable<any> | Promise<any> | any {
|
deleteReplicationRule(ruleId: number | string): Observable<any> {
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -594,11 +594,11 @@ export class MyReplicationService extends ReplicationService {
|
|||||||
* Enable the specified replication rule.
|
* Enable the specified replication rule.
|
||||||
*
|
*
|
||||||
* @param {(number | string)} ruleId
|
* @param {(number | string)} ruleId
|
||||||
* @returns {(Observable<any> | Promise<any> | any)}
|
* @returns {(Observable<any>)}
|
||||||
*
|
*
|
||||||
* @memberOf ReplicationService
|
* @memberOf ReplicationService
|
||||||
*/
|
*/
|
||||||
enableReplicationRule(ruleId: number | string, enablement: number): Observable<any> | Promise<any> | any {
|
enableReplicationRule(ruleId: number | string, enablement: number): Observable<any> {
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -606,11 +606,11 @@ export class MyReplicationService extends ReplicationService {
|
|||||||
* Disable the specified replication rule.
|
* Disable the specified replication rule.
|
||||||
*
|
*
|
||||||
* @param {(number | string)} ruleId
|
* @param {(number | string)} ruleId
|
||||||
* @returns {(Observable<any> | Promise<any> | any)}
|
* @returns {(Observable<any>)}
|
||||||
*
|
*
|
||||||
* @memberOf ReplicationService
|
* @memberOf ReplicationService
|
||||||
*/
|
*/
|
||||||
disableReplicationRule(ruleId: number | string): Observable<any> | Promise<any> | any {
|
disableReplicationRule(ruleId: number | string): Observable<any> {
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -625,11 +625,11 @@ export class MyReplicationService extends ReplicationService {
|
|||||||
*
|
*
|
||||||
* @param {(number | string)} ruleId
|
* @param {(number | string)} ruleId
|
||||||
* @param {RequestQueryParams} [queryParams]
|
* @param {RequestQueryParams} [queryParams]
|
||||||
* @returns {(Observable<ReplicationJob> | Promise<ReplicationJob[]> | ReplicationJob)}
|
* @returns {(Observable<ReplicationJob>)}
|
||||||
*
|
*
|
||||||
* @memberOf ReplicationService
|
* @memberOf ReplicationService
|
||||||
*/
|
*/
|
||||||
getJobs(ruleId: number | string, queryParams?: RequestQueryParams): Observable<ReplicationJob[]> | Promise<ReplicationJob[]> | ReplicationJob[] {
|
getJobs(ruleId: number | string, queryParams?: RequestQueryParams): Observable<ReplicationJob[]> {
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -656,11 +656,11 @@ export class MyRepositoryService extends RepositoryService {
|
|||||||
* @param {(number | string)} projectId
|
* @param {(number | string)} projectId
|
||||||
* @param {string} repositoryName
|
* @param {string} repositoryName
|
||||||
* @param {RequestQueryParams} [queryParams]
|
* @param {RequestQueryParams} [queryParams]
|
||||||
* @returns {(Observable<Repository[]> | Promise<Repository[]> | Repository[])}
|
* @returns {(Observable<Repository[]>)}
|
||||||
*
|
*
|
||||||
* @memberOf RepositoryService
|
* @memberOf RepositoryService
|
||||||
*/
|
*/
|
||||||
getRepositories(projectId: number | string, repositoryName?: string, queryParams?: RequestQueryParams): Observable<Repository[]> | Promise<Repository[]> | Repository[] {
|
getRepositories(projectId: number | string, repositoryName?: string, queryParams?: RequestQueryParams): Observable<Repository[]> {
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -668,11 +668,11 @@ export class MyRepositoryService extends RepositoryService {
|
|||||||
* DELETE the specified repository.
|
* DELETE the specified repository.
|
||||||
*
|
*
|
||||||
* @param {string} repositoryName
|
* @param {string} repositoryName
|
||||||
* @returns {(Observable<any> | Promise<any> | any)}
|
* @returns {(Observable<any>)}
|
||||||
*
|
*
|
||||||
* @memberOf RepositoryService
|
* @memberOf RepositoryService
|
||||||
*/
|
*/
|
||||||
deleteRepository(repositoryName: string): Observable<any> | Promise<any> | any {
|
deleteRepository(repositoryName: string): Observable<any> {
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -694,11 +694,11 @@ export class MyTagService extends TagService {
|
|||||||
*
|
*
|
||||||
* @param {string} repositoryName
|
* @param {string} repositoryName
|
||||||
* @param {RequestQueryParams} [queryParams]
|
* @param {RequestQueryParams} [queryParams]
|
||||||
* @returns {(Observable<Tag[]> | Promise<Tag[]> | Tag[])}
|
* @returns {(Observable<Tag[]>)}
|
||||||
*
|
*
|
||||||
* @memberOf TagService
|
* @memberOf TagService
|
||||||
*/
|
*/
|
||||||
getTags(repositoryName: string, queryParams?: RequestQueryParams): Observable<Tag[]> | Promise<Tag[]> | Tag[] {
|
getTags(repositoryName: string, queryParams?: RequestQueryParams): Observable<Tag[]> {
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -711,7 +711,7 @@ export class MyTagService extends TagService {
|
|||||||
*
|
*
|
||||||
* @memberOf TagService
|
* @memberOf TagService
|
||||||
*/
|
*/
|
||||||
deleteTag(repositoryName: string, tag: string): Observable<any> | Promise<Tag> | any {
|
deleteTag(repositoryName: string, tag: string): Observable<any> {
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -738,11 +738,11 @@ export class MyScanningResultService extends ScanningResultService {
|
|||||||
* Get the summary of vulnerability scanning result.
|
* Get the summary of vulnerability scanning result.
|
||||||
*
|
*
|
||||||
* @param {string} tagId
|
* @param {string} tagId
|
||||||
* @returns {(Observable<VulnerabilitySummary> | Promise<VulnerabilitySummary> | VulnerabilitySummary)}
|
* @returns {(Observable<VulnerabilitySummary>)}
|
||||||
*
|
*
|
||||||
* @memberOf ScanningResultService
|
* @memberOf ScanningResultService
|
||||||
*/
|
*/
|
||||||
getVulnerabilityScanningSummary(repoName: string, tagId: string, queryParams?: RequestQueryParams): Observable<VulnerabilitySummary> | Promise<VulnerabilitySummary> | VulnerabilitySummary{
|
getVulnerabilityScanningSummary(repoName: string, tagId: string, queryParams?: RequestQueryParams): Observable<VulnerabilitySummary> {
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -750,11 +750,11 @@ export class MyScanningResultService extends ScanningResultService {
|
|||||||
* Get the detailed vulnerabilities scanning results.
|
* Get the detailed vulnerabilities scanning results.
|
||||||
*
|
*
|
||||||
* @param {string} tagId
|
* @param {string} tagId
|
||||||
* @returns {(Observable<VulnerabilityItem[]> | Promise<VulnerabilityItem[]> | VulnerabilityItem[])}
|
* @returns {(Observable<VulnerabilityItem[]>)}
|
||||||
*
|
*
|
||||||
* @memberOf ScanningResultService
|
* @memberOf ScanningResultService
|
||||||
*/
|
*/
|
||||||
getVulnerabilityScanningResults(repoName: string, tagId: string, queryParams?: RequestQueryParams): Observable<VulnerabilityItem[]> | Promise<VulnerabilityItem[]> | VulnerabilityItem[]{
|
getVulnerabilityScanningResults(repoName: string, tagId: string, queryParams?: RequestQueryParams): Observable<VulnerabilityItem[]> {
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -764,11 +764,11 @@ export class MyScanningResultService extends ScanningResultService {
|
|||||||
*
|
*
|
||||||
* @param {string} repoName
|
* @param {string} repoName
|
||||||
* @param {string} tagId
|
* @param {string} tagId
|
||||||
* @returns {(Observable<any> | Promise<any> | any)}
|
* @returns {(Observable<any>)}
|
||||||
*
|
*
|
||||||
* @memberOf ScanningResultService
|
* @memberOf ScanningResultService
|
||||||
*/
|
*/
|
||||||
startVulnerabilityScanning(repoName: string, tagId: string): Observable<any> | Promise<any> | any {
|
startVulnerabilityScanning(repoName: string, tagId: string): Observable<any> {
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -792,7 +792,7 @@ export class MySystemInfoService extends SystemInfoService {
|
|||||||
* Get global system information.
|
* Get global system information.
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
getSystemInfo(): Observable<SystemInfo> | Promise<SystemInfo> | SystemInfo {
|
getSystemInfo(): Observable<SystemInfo> {
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -820,11 +820,11 @@ export class MyConfigurationService extends ConfigurationService{
|
|||||||
* Get configurations.
|
* Get configurations.
|
||||||
*
|
*
|
||||||
|
|
||||||
* @returns {(Observable<Configuration> | Promise<Configuration> | Configuration)}
|
* @returns {(Observable<Configuration>)}
|
||||||
*
|
*
|
||||||
* @memberOf ConfigurationService
|
* @memberOf ConfigurationService
|
||||||
*/
|
*/
|
||||||
getConfigurations(): Observable<Configuration> | Promise<Configuration> | Configuration{
|
getConfigurations(): Observable<Configuration> {
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -832,11 +832,11 @@ export class MyConfigurationService extends ConfigurationService{
|
|||||||
* Save configurations.
|
* Save configurations.
|
||||||
*
|
*
|
||||||
|
|
||||||
* @returns {(Observable<Configuration> | Promise<Configuration> | Configuration)}
|
* @returns {(Observable<Configuration>)}
|
||||||
*
|
*
|
||||||
* @memberOf ConfigurationService
|
* @memberOf ConfigurationService
|
||||||
*/
|
*/
|
||||||
saveConfigurations(changedConfigs: any | { [key: string]: any | any[] }): Observable<any> | Promise<any> | any{
|
saveConfigurations(changedConfigs: any | { [key: string]: any | any[] }): Observable<any> {
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,6 +69,7 @@ export class Configuration {
|
|||||||
ldap_group_search_filter: StringValueItem;
|
ldap_group_search_filter: StringValueItem;
|
||||||
ldap_group_attribute_name: StringValueItem;
|
ldap_group_attribute_name: StringValueItem;
|
||||||
ldap_group_search_scope: NumberValueItem;
|
ldap_group_search_scope: NumberValueItem;
|
||||||
|
ldap_group_membership_attribute: StringValueItem;
|
||||||
uaa_client_id: StringValueItem;
|
uaa_client_id: StringValueItem;
|
||||||
uaa_client_secret?: StringValueItem;
|
uaa_client_secret?: StringValueItem;
|
||||||
uaa_endpoint: StringValueItem;
|
uaa_endpoint: StringValueItem;
|
||||||
@ -108,6 +109,7 @@ export class Configuration {
|
|||||||
this.ldap_group_search_filter = new StringValueItem("", true);
|
this.ldap_group_search_filter = new StringValueItem("", true);
|
||||||
this.ldap_group_attribute_name = new StringValueItem("", true);
|
this.ldap_group_attribute_name = new StringValueItem("", true);
|
||||||
this.ldap_group_search_scope = new NumberValueItem(0, true);
|
this.ldap_group_search_scope = new NumberValueItem(0, true);
|
||||||
|
this.ldap_group_membership_attribute = new StringValueItem("", true);
|
||||||
this.uaa_client_id = new StringValueItem("", true);
|
this.uaa_client_id = new StringValueItem("", true);
|
||||||
this.uaa_client_secret = new StringValueItem("", true);
|
this.uaa_client_secret = new StringValueItem("", true);
|
||||||
this.uaa_endpoint = new StringValueItem("", true);
|
this.uaa_endpoint = new StringValueItem("", true);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<div class="cron-selection">
|
<div class="cron-selection">
|
||||||
<cron-selection [labelCurrent]="getLabelCurrent" [labelEdit]='getText' [originCron]='originCron' (inputvalue)="getcron($event)"></cron-selection>
|
<cron-selection [labelCurrent]="getLabelCurrent" [labelEdit]='getText' [originCron]='originCron' (inputvalue)="scheduleGc($event)"></cron-selection>
|
||||||
</div>
|
</div>
|
||||||
<button class="btn btn-primary btn-sm gc-start-btn" (click)="gcNow()" [disabled]="disableGC">{{'GC.GC_NOW' | translate}}</button>
|
<button class="btn btn-primary btn-sm gc-start-btn" (click)="gcNow()" [disabled]="disableGC">{{'GC.GC_NOW' | translate}}</button>
|
||||||
<div class="job-header font-style">{{'GC.JOB_HISTORY' | translate}}</div>
|
<div class="job-header font-style">{{'GC.JOB_HISTORY' | translate}}</div>
|
||||||
|
@ -97,7 +97,17 @@ export class GcComponent implements OnInit {
|
|||||||
this.disableGC = false;
|
this.disableGC = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
getcron(cron: string) {
|
private resetSchedule(cron) {
|
||||||
|
this.schedule = {
|
||||||
|
schedule: {
|
||||||
|
type: this.CronScheduleComponent.scheduleType,
|
||||||
|
cron: cron
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.getJobs();
|
||||||
|
}
|
||||||
|
|
||||||
|
scheduleGc(cron: string) {
|
||||||
let schedule = this.schedule;
|
let schedule = this.schedule;
|
||||||
if (schedule && schedule.schedule && schedule.schedule.type !== SCHEDULE_TYPE_NONE) {
|
if (schedule && schedule.schedule && schedule.schedule.type !== SCHEDULE_TYPE_NONE) {
|
||||||
this.gcRepoService.putScheduleGc(this.CronScheduleComponent.scheduleType, cron).subscribe(
|
this.gcRepoService.putScheduleGc(this.CronScheduleComponent.scheduleType, cron).subscribe(
|
||||||
@ -107,7 +117,7 @@ export class GcComponent implements OnInit {
|
|||||||
.subscribe((res) => {
|
.subscribe((res) => {
|
||||||
this.errorHandler.info(res);
|
this.errorHandler.info(res);
|
||||||
});
|
});
|
||||||
this.getJobs();
|
this.resetSchedule(cron);
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
this.errorHandler.error(error);
|
this.errorHandler.error(error);
|
||||||
@ -119,7 +129,7 @@ export class GcComponent implements OnInit {
|
|||||||
this.translate.get("GC.MSG_SCHEDULE_SET").subscribe((res) => {
|
this.translate.get("GC.MSG_SCHEDULE_SET").subscribe((res) => {
|
||||||
this.errorHandler.info(res);
|
this.errorHandler.info(res);
|
||||||
});
|
});
|
||||||
this.getJobs();
|
this.resetSchedule(cron);
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
this.errorHandler.error(error);
|
this.errorHandler.error(error);
|
||||||
|
@ -21,6 +21,7 @@ import {
|
|||||||
SystemInfo
|
SystemInfo
|
||||||
} from '../service/index';
|
} from '../service/index';
|
||||||
import { Configuration } from './config';
|
import { Configuration } from './config';
|
||||||
|
import { of } from 'rxjs';
|
||||||
|
|
||||||
describe('RegistryConfigComponent (inline template)', () => {
|
describe('RegistryConfigComponent (inline template)', () => {
|
||||||
|
|
||||||
@ -84,8 +85,8 @@ describe('RegistryConfigComponent (inline template)', () => {
|
|||||||
|
|
||||||
cfgService = fixture.debugElement.injector.get(ConfigurationService);
|
cfgService = fixture.debugElement.injector.get(ConfigurationService);
|
||||||
systemInfoService = fixture.debugElement.injector.get(SystemInfoService);
|
systemInfoService = fixture.debugElement.injector.get(SystemInfoService);
|
||||||
spy = spyOn(cfgService, 'getConfigurations').and.returnValue(Promise.resolve(mockConfig));
|
spy = spyOn(cfgService, 'getConfigurations').and.returnValue(of(mockConfig));
|
||||||
spySystemInfo = spyOn(systemInfoService, 'getSystemInfo').and.returnValue(Promise.resolve(mockSystemInfo));
|
spySystemInfo = spyOn(systemInfoService, 'getSystemInfo').and.returnValue(of(mockSystemInfo));
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
@ -100,7 +101,7 @@ describe('RegistryConfigComponent (inline template)', () => {
|
|||||||
|
|
||||||
let el: HTMLInputElement = fixture.nativeElement.querySelector('input[type="text"]');
|
let el: HTMLInputElement = fixture.nativeElement.querySelector('input[type="text"]');
|
||||||
expect(el).not.toBeFalsy();
|
expect(el).not.toBeFalsy();
|
||||||
expect(el.value).toEqual('30');
|
expect(el.value).toEqual('90');
|
||||||
|
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
@ -7,7 +7,6 @@ import { ConfirmationMessage } from '../confirmation-dialog/confirmation-message
|
|||||||
import { ConfirmationAcknowledgement } from '../confirmation-dialog/confirmation-state-message';
|
import { ConfirmationAcknowledgement } from '../confirmation-dialog/confirmation-state-message';
|
||||||
import { ConfigurationService, SystemInfoService, SystemInfo } from '../service/index';
|
import { ConfigurationService, SystemInfoService, SystemInfo } from '../service/index';
|
||||||
import {
|
import {
|
||||||
toPromise,
|
|
||||||
compareValue,
|
compareValue,
|
||||||
isEmptyObject,
|
isEmptyObject,
|
||||||
clone
|
clone
|
||||||
@ -15,6 +14,7 @@ import {
|
|||||||
import { ErrorHandler } from '../error-handler/index';
|
import { ErrorHandler } from '../error-handler/index';
|
||||||
import { SystemSettingsComponent, VulnerabilityConfigComponent, GcComponent} from './index';
|
import { SystemSettingsComponent, VulnerabilityConfigComponent, GcComponent} from './index';
|
||||||
import { Configuration } from './config';
|
import { Configuration } from './config';
|
||||||
|
import { map, catchError } from "rxjs/operators";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'hbr-registry-config',
|
selector: 'hbr-registry-config',
|
||||||
@ -75,21 +75,21 @@ export class RegistryConfigComponent implements OnInit {
|
|||||||
|
|
||||||
// Get system info
|
// Get system info
|
||||||
loadSystemInfo(): void {
|
loadSystemInfo(): void {
|
||||||
toPromise<SystemInfo>(this.systemInfoService.getSystemInfo())
|
this.systemInfoService.getSystemInfo()
|
||||||
.then((info: SystemInfo) => this.systemInfo = info)
|
.subscribe((info: SystemInfo) => {
|
||||||
.catch(error => this.errorHandler.error(error));
|
this.systemInfo = info;
|
||||||
|
}, error => this.errorHandler.error(error));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load configurations
|
// Load configurations
|
||||||
load(): void {
|
load(): void {
|
||||||
this.onGoing = true;
|
this.onGoing = true;
|
||||||
toPromise<Configuration>(this.configService.getConfigurations())
|
this.configService.getConfigurations()
|
||||||
.then((config: Configuration) => {
|
.subscribe((config: Configuration) => {
|
||||||
this.configCopy = clone(config);
|
this.configCopy = clone(config);
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.onGoing = false;
|
this.onGoing = false;
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.errorHandler.error(error);
|
this.errorHandler.error(error);
|
||||||
this.onGoing = false;
|
this.onGoing = false;
|
||||||
});
|
});
|
||||||
@ -105,8 +105,8 @@ export class RegistryConfigComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.onGoing = true;
|
this.onGoing = true;
|
||||||
toPromise<any>(this.configService.saveConfigurations(changes))
|
this.configService.saveConfigurations(changes)
|
||||||
.then(() => {
|
.subscribe(() => {
|
||||||
this.onGoing = false;
|
this.onGoing = false;
|
||||||
|
|
||||||
this.translate.get("CONFIG.SAVE_SUCCESS").subscribe((res: string) => {
|
this.translate.get("CONFIG.SAVE_SUCCESS").subscribe((res: string) => {
|
||||||
@ -116,8 +116,8 @@ export class RegistryConfigComponent implements OnInit {
|
|||||||
this.load();
|
this.load();
|
||||||
// Reload all system info
|
// Reload all system info
|
||||||
// this.loadSystemInfo();
|
// this.loadSystemInfo();
|
||||||
})
|
}
|
||||||
.catch(error => {
|
, error => {
|
||||||
this.onGoing = false;
|
this.onGoing = false;
|
||||||
this.errorHandler.error(error);
|
this.errorHandler.error(error);
|
||||||
});
|
});
|
||||||
|
@ -2,7 +2,7 @@ import { Component, Input, OnInit, Output, EventEmitter, ViewChild, Inject, OnCh
|
|||||||
import { NgForm } from '@angular/forms';
|
import { NgForm } from '@angular/forms';
|
||||||
import { Configuration, StringValueItem } from '../config';
|
import { Configuration, StringValueItem } from '../config';
|
||||||
import { SERVICE_CONFIG, IServiceConfig } from '../../service.config';
|
import { SERVICE_CONFIG, IServiceConfig } from '../../service.config';
|
||||||
import { clone, isEmpty, getChanges, toPromise } from '../../utils';
|
import { clone, isEmpty, getChanges } from '../../utils';
|
||||||
import { ErrorHandler } from '../../error-handler/index';
|
import { ErrorHandler } from '../../error-handler/index';
|
||||||
import { ConfirmationMessage } from '../../confirmation-dialog/confirmation-message';
|
import { ConfirmationMessage } from '../../confirmation-dialog/confirmation-message';
|
||||||
import { ConfirmationDialogComponent } from '../../confirmation-dialog/confirmation-dialog.component';
|
import { ConfirmationDialogComponent } from '../../confirmation-dialog/confirmation-dialog.component';
|
||||||
@ -115,7 +115,7 @@ export class SystemSettingsComponent implements OnChanges, OnInit {
|
|||||||
if (!isEmpty(changes)) {
|
if (!isEmpty(changes)) {
|
||||||
this.onGoing = true;
|
this.onGoing = true;
|
||||||
this.configService.saveConfigurations(changes)
|
this.configService.saveConfigurations(changes)
|
||||||
.then(response => {
|
.subscribe(response => {
|
||||||
this.onGoing = false;
|
this.onGoing = false;
|
||||||
// API should return the updated configurations here
|
// API should return the updated configurations here
|
||||||
// Unfortunately API does not do that
|
// Unfortunately API does not do that
|
||||||
@ -129,8 +129,8 @@ export class SystemSettingsComponent implements OnChanges, OnInit {
|
|||||||
|
|
||||||
this.reloadSystemConfig.emit();
|
this.reloadSystemConfig.emit();
|
||||||
this.errorHandler.info('CONFIG.SAVE_SUCCESS');
|
this.errorHandler.info('CONFIG.SAVE_SUCCESS');
|
||||||
})
|
}
|
||||||
.catch(error => {
|
, error => {
|
||||||
this.onGoing = false;
|
this.onGoing = false;
|
||||||
this.errorHandler.error(error);
|
this.errorHandler.error(error);
|
||||||
});
|
});
|
||||||
@ -142,7 +142,7 @@ export class SystemSettingsComponent implements OnChanges, OnInit {
|
|||||||
|
|
||||||
retrieveConfig(): void {
|
retrieveConfig(): void {
|
||||||
this.onGoing = true;
|
this.onGoing = true;
|
||||||
from(toPromise(this.configService.getConfigurations()))
|
this.configService.getConfigurations()
|
||||||
.subscribe((configurations: Configuration) => {
|
.subscribe((configurations: Configuration) => {
|
||||||
this.onGoing = false;
|
this.onGoing = false;
|
||||||
// Add two password fields
|
// Add two password fields
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { Component, Input, Output, EventEmitter, ViewChild, OnInit } from '@angular/core';
|
import { Component, Input, Output, EventEmitter, ViewChild, OnInit } from '@angular/core';
|
||||||
import { NgForm } from '@angular/forms';
|
import { NgForm } from '@angular/forms';
|
||||||
|
import { map, catchError } from "rxjs/operators";
|
||||||
|
import { Observable, throwError as observableThrowError, of } from "rxjs";
|
||||||
import { Configuration } from '../config';
|
import { Configuration } from '../config';
|
||||||
import {
|
import {
|
||||||
ScanningResultService,
|
ScanningResultService,
|
||||||
@ -9,7 +10,7 @@ import {
|
|||||||
ConfigurationService
|
ConfigurationService
|
||||||
} from '../../service/index';
|
} from '../../service/index';
|
||||||
import { ErrorHandler } from '../../error-handler/index';
|
import { ErrorHandler } from '../../error-handler/index';
|
||||||
import { toPromise, isEmptyObject, clone} from '../../utils';
|
import { isEmptyObject, clone} from '../../utils';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { ClairDetail } from '../../service/interface';
|
import { ClairDetail } from '../../service/interface';
|
||||||
const ONE_HOUR_SECONDS: number = 3600;
|
const ONE_HOUR_SECONDS: number = 3600;
|
||||||
@ -241,12 +242,11 @@ export class VulnerabilityConfigComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getConfigurations(): void {
|
getConfigurations(): void {
|
||||||
toPromise<Configuration>(this.configService.getConfigurations())
|
this.configService.getConfigurations()
|
||||||
.then((config: Configuration) => {
|
.subscribe((config: Configuration) => {
|
||||||
this.configCopy = clone(config);
|
this.configCopy = clone(config);
|
||||||
this.config = config;
|
this.config = config;
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.errorHandler.error(error);
|
this.errorHandler.error(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -272,20 +272,20 @@ export class VulnerabilityConfigComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.onSubmitting = true;
|
this.onSubmitting = true;
|
||||||
toPromise<any>(this.scanningService.startScanningAll())
|
this.scanningService.startScanningAll()
|
||||||
.then(() => {
|
.subscribe(() => {
|
||||||
this.translate.get("CONFIG.SCANNING.TRIGGER_SCAN_ALL_SUCCESS").subscribe((res: string) => {
|
this.translate.get("CONFIG.SCANNING.TRIGGER_SCAN_ALL_SUCCESS").subscribe((res: string) => {
|
||||||
this.errorHandler.info(res);
|
this.errorHandler.info(res);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Update system info
|
// Update system info
|
||||||
this.getSystemInfo().then(() => {
|
this.getSystemInfo().subscribe(() => {
|
||||||
this.onSubmitting = false;
|
this.onSubmitting = false;
|
||||||
}).catch(() => {
|
}, error => {
|
||||||
this.onSubmitting = false;
|
this.onSubmitting = false;
|
||||||
});
|
});
|
||||||
})
|
}
|
||||||
.catch(error => {
|
, error => {
|
||||||
if (error && error.status && error.status === 412) {
|
if (error && error.status && error.status === 412) {
|
||||||
this.translate.get("CONFIG.SCANNING.TRIGGER_SCAN_ALL_FAIL", { error: '' + error }).subscribe((res: string) => {
|
this.translate.get("CONFIG.SCANNING.TRIGGER_SCAN_ALL_FAIL", { error: '' + error }).subscribe((res: string) => {
|
||||||
this.errorHandler.error(res);
|
this.errorHandler.error(res);
|
||||||
@ -297,10 +297,13 @@ export class VulnerabilityConfigComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getSystemInfo(): Promise<void | SystemInfo> {
|
getSystemInfo(): Observable<void | SystemInfo> {
|
||||||
return toPromise<SystemInfo>(this.systemInfoService.getSystemInfo())
|
return this.systemInfoService.getSystemInfo()
|
||||||
.then((info: SystemInfo) => this.systemInfo = info)
|
.pipe(map((info: SystemInfo) => this.systemInfo = info)
|
||||||
.catch(error => this.errorHandler.error(error));
|
, catchError(error => {
|
||||||
|
this.errorHandler.error(error);
|
||||||
|
return of();
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
save(): void {
|
save(): void {
|
||||||
@ -311,17 +314,14 @@ export class VulnerabilityConfigComponent implements OnInit {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
toPromise<any>(this.configService.saveConfigurations(changes))
|
this.configService.saveConfigurations(changes)
|
||||||
.then(() => {
|
.subscribe(() => {
|
||||||
this.translate.get("CONFIG.SAVE_SUCCESS").subscribe((res: string) => {
|
this.translate.get("CONFIG.SAVE_SUCCESS").subscribe((res: string) => {
|
||||||
this.errorHandler.info(res);
|
this.errorHandler.info(res);
|
||||||
});
|
});
|
||||||
this.getConfigurations();
|
this.getConfigurations();
|
||||||
this.isEditMode = false;
|
this.isEditMode = false;
|
||||||
}, () => {
|
}, error => {
|
||||||
this.reset();
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
this.errorHandler.error(error);
|
this.errorHandler.error(error);
|
||||||
this.reset();
|
this.reset();
|
||||||
});
|
});
|
||||||
|
@ -18,6 +18,7 @@ import {
|
|||||||
EndpointDefaultService
|
EndpointDefaultService
|
||||||
} from "../service/endpoint.service";
|
} from "../service/endpoint.service";
|
||||||
import { IServiceConfig, SERVICE_CONFIG } from "../service.config";
|
import { IServiceConfig, SERVICE_CONFIG } from "../service.config";
|
||||||
|
import { of } from "rxjs";
|
||||||
describe("CreateEditEndpointComponent (inline template)", () => {
|
describe("CreateEditEndpointComponent (inline template)", () => {
|
||||||
let mockData: Endpoint = {
|
let mockData: Endpoint = {
|
||||||
id: 1,
|
id: 1,
|
||||||
@ -80,7 +81,7 @@ describe("CreateEditEndpointComponent (inline template)", () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
spy = spyOn(endpointService, "getEndpoint").and.returnValue(
|
spy = spyOn(endpointService, "getEndpoint").and.returnValue(
|
||||||
Promise.resolve(mockData)
|
of(mockData)
|
||||||
);
|
);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
|
@ -29,7 +29,8 @@ import { EndpointService } from "../service/endpoint.service";
|
|||||||
import { ErrorHandler } from "../error-handler/index";
|
import { ErrorHandler } from "../error-handler/index";
|
||||||
import { InlineAlertComponent } from "../inline-alert/inline-alert.component";
|
import { InlineAlertComponent } from "../inline-alert/inline-alert.component";
|
||||||
import { Endpoint, Adapter } from "../service/interface";
|
import { Endpoint, Adapter } from "../service/interface";
|
||||||
import { toPromise, clone, compareValue, isEmptyObject } from "../utils";
|
import { clone, compareValue, isEmptyObject } from "../utils";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const FAKE_PASSWORD = "rjGcfuRu";
|
const FAKE_PASSWORD = "rjGcfuRu";
|
||||||
@ -71,14 +72,14 @@ export class CreateEditEndpointComponent
|
|||||||
private errorHandler: ErrorHandler,
|
private errorHandler: ErrorHandler,
|
||||||
private translateService: TranslateService,
|
private translateService: TranslateService,
|
||||||
private ref: ChangeDetectorRef
|
private ref: ChangeDetectorRef
|
||||||
) {}
|
) { }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
toPromise<Adapter[]>(this.endpointService.getAdapters())
|
this.endpointService.getAdapters().subscribe(adapters => {
|
||||||
.then(adapters => {
|
this.adapterList = adapters || [];
|
||||||
this.adapterList = adapters || [];
|
}, error => {
|
||||||
})
|
this.errorHandler.error(error);
|
||||||
.catch((error: any) => this.errorHandler.error(error));
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public get isValid(): boolean {
|
public get isValid(): boolean {
|
||||||
@ -118,7 +119,7 @@ export class CreateEditEndpointComponent
|
|||||||
name: "",
|
name: "",
|
||||||
type: "Harbor",
|
type: "Harbor",
|
||||||
url: "",
|
url: "",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
open(): void {
|
open(): void {
|
||||||
@ -166,8 +167,8 @@ export class CreateEditEndpointComponent
|
|||||||
this.translateService
|
this.translateService
|
||||||
.get("DESTINATION.TITLE_EDIT")
|
.get("DESTINATION.TITLE_EDIT")
|
||||||
.subscribe(res => (this.modalTitle = res));
|
.subscribe(res => (this.modalTitle = res));
|
||||||
toPromise<Endpoint>(this.endpointService.getEndpoint(targetId))
|
this.endpointService.getEndpoint(targetId)
|
||||||
.then(target => {
|
.subscribe(target => {
|
||||||
this.target = target;
|
this.target = target;
|
||||||
// Keep data cache
|
// Keep data cache
|
||||||
this.initVal = clone(target);
|
this.initVal = clone(target);
|
||||||
@ -178,8 +179,7 @@ export class CreateEditEndpointComponent
|
|||||||
this.open();
|
this.open();
|
||||||
this.controlEnabled = true;
|
this.controlEnabled = true;
|
||||||
this.forceRefreshView(2000);
|
this.forceRefreshView(2000);
|
||||||
})
|
}, error => this.errorHandler.error(error));
|
||||||
.catch(error => this.errorHandler.error(error));
|
|
||||||
} else {
|
} else {
|
||||||
this.endpointId = "";
|
this.endpointId = "";
|
||||||
this.translateService
|
this.translateService
|
||||||
@ -213,15 +213,14 @@ export class CreateEditEndpointComponent
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.testOngoing = true;
|
this.testOngoing = true;
|
||||||
toPromise<Endpoint>(this.endpointService.pingEndpoint(payload))
|
this.endpointService.pingEndpoint(payload)
|
||||||
.then(response => {
|
.subscribe(response => {
|
||||||
this.inlineAlert.showInlineSuccess({
|
this.inlineAlert.showInlineSuccess({
|
||||||
message: "DESTINATION.TEST_CONNECTION_SUCCESS"
|
message: "DESTINATION.TEST_CONNECTION_SUCCESS"
|
||||||
});
|
});
|
||||||
this.forceRefreshView(2000);
|
this.forceRefreshView(2000);
|
||||||
this.testOngoing = false;
|
this.testOngoing = false;
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.inlineAlert.showInlineError("DESTINATION.TEST_CONNECTION_FAILURE");
|
this.inlineAlert.showInlineError("DESTINATION.TEST_CONNECTION_FAILURE");
|
||||||
this.forceRefreshView(2000);
|
this.forceRefreshView(2000);
|
||||||
this.testOngoing = false;
|
this.testOngoing = false;
|
||||||
@ -241,8 +240,8 @@ export class CreateEditEndpointComponent
|
|||||||
return; // Avoid duplicated submitting
|
return; // Avoid duplicated submitting
|
||||||
}
|
}
|
||||||
this.onGoing = true;
|
this.onGoing = true;
|
||||||
toPromise<number>(this.endpointService.createEndpoint(this.target))
|
this.endpointService.createEndpoint(this.target)
|
||||||
.then(response => {
|
.subscribe(response => {
|
||||||
this.translateService
|
this.translateService
|
||||||
.get("DESTINATION.CREATED_SUCCESS")
|
.get("DESTINATION.CREATED_SUCCESS")
|
||||||
.subscribe(res => this.errorHandler.info(res));
|
.subscribe(res => this.errorHandler.info(res));
|
||||||
@ -250,8 +249,7 @@ export class CreateEditEndpointComponent
|
|||||||
this.onGoing = false;
|
this.onGoing = false;
|
||||||
this.close();
|
this.close();
|
||||||
this.forceRefreshView(2000);
|
this.forceRefreshView(2000);
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.onGoing = false;
|
this.onGoing = false;
|
||||||
let errorMessageKey = this.handleErrorMessageKey(error.status);
|
let errorMessageKey = this.handleErrorMessageKey(error.status);
|
||||||
this.translateService.get(errorMessageKey).subscribe(res => {
|
this.translateService.get(errorMessageKey).subscribe(res => {
|
||||||
@ -285,10 +283,8 @@ export class CreateEditEndpointComponent
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.onGoing = true;
|
this.onGoing = true;
|
||||||
toPromise<number>(
|
this.endpointService.updateEndpoint(this.target.id, payload)
|
||||||
this.endpointService.updateEndpoint(this.target.id, payload)
|
.subscribe(response => {
|
||||||
)
|
|
||||||
.then(response => {
|
|
||||||
this.translateService
|
this.translateService
|
||||||
.get("DESTINATION.UPDATED_SUCCESS")
|
.get("DESTINATION.UPDATED_SUCCESS")
|
||||||
.subscribe(res => this.errorHandler.info(res));
|
.subscribe(res => this.errorHandler.info(res));
|
||||||
@ -296,8 +292,7 @@ export class CreateEditEndpointComponent
|
|||||||
this.close();
|
this.close();
|
||||||
this.onGoing = false;
|
this.onGoing = false;
|
||||||
this.forceRefreshView(2000);
|
this.forceRefreshView(2000);
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
let errorMessageKey = this.handleErrorMessageKey(error.status);
|
let errorMessageKey = this.handleErrorMessageKey(error.status);
|
||||||
this.translateService.get(errorMessageKey).subscribe(res => {
|
this.translateService.get(errorMessageKey).subscribe(res => {
|
||||||
this.inlineAlert.showInlineError(res);
|
this.inlineAlert.showInlineError(res);
|
||||||
|
@ -9,6 +9,7 @@ import { Label } from "../service/interface";
|
|||||||
import { IServiceConfig, SERVICE_CONFIG } from "../service.config";
|
import { IServiceConfig, SERVICE_CONFIG } from "../service.config";
|
||||||
import { CreateEditLabelComponent } from "./create-edit-label.component";
|
import { CreateEditLabelComponent } from "./create-edit-label.component";
|
||||||
import { LabelDefaultService, LabelService } from "../service/label.service";
|
import { LabelDefaultService, LabelService } from "../service/label.service";
|
||||||
|
import { of } from "rxjs";
|
||||||
|
|
||||||
describe("CreateEditLabelComponent (inline template)", () => {
|
describe("CreateEditLabelComponent (inline template)", () => {
|
||||||
let mockOneData: Label = {
|
let mockOneData: Label = {
|
||||||
@ -57,10 +58,10 @@ describe("CreateEditLabelComponent (inline template)", () => {
|
|||||||
labelService = fixture.debugElement.injector.get(LabelService);
|
labelService = fixture.debugElement.injector.get(LabelService);
|
||||||
|
|
||||||
spy = spyOn(labelService, "getLabels").and.returnValue(
|
spy = spyOn(labelService, "getLabels").and.returnValue(
|
||||||
Promise.resolve(mockOneData)
|
of(mockOneData)
|
||||||
);
|
);
|
||||||
spyOne = spyOn(labelService, "createLabel").and.returnValue(
|
spyOne = spyOn(labelService, "createLabel").and.returnValue(
|
||||||
Promise.resolve(mockOneData)
|
of(mockOneData)
|
||||||
);
|
);
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
@ -25,7 +25,7 @@ import {
|
|||||||
|
|
||||||
import { Label } from "../service/interface";
|
import { Label } from "../service/interface";
|
||||||
|
|
||||||
import { toPromise, clone, compareValue } from "../utils";
|
import { clone, compareValue } from "../utils";
|
||||||
|
|
||||||
import { LabelService } from "../service/label.service";
|
import { LabelService } from "../service/label.service";
|
||||||
import { ErrorHandler } from "../error-handler/error-handler";
|
import { ErrorHandler } from "../error-handler/error-handler";
|
||||||
@ -66,10 +66,8 @@ export class CreateEditLabelComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.nameChecker.pipe(debounceTime(500)).subscribe((name: string) => {
|
this.nameChecker.pipe(debounceTime(500)).subscribe((name: string) => {
|
||||||
toPromise<Label[]>(
|
|
||||||
this.labelService.getLabels(this.scope, this.projectId, name)
|
this.labelService.getLabels(this.scope, this.projectId, name)
|
||||||
)
|
.subscribe(targets => {
|
||||||
.then(targets => {
|
|
||||||
this.isLabelNameExist = false;
|
this.isLabelNameExist = false;
|
||||||
if (targets && targets.length) {
|
if (targets && targets.length) {
|
||||||
if (targets.find((target) => {
|
if (targets.find((target) => {
|
||||||
@ -78,8 +76,7 @@ export class CreateEditLabelComponent implements OnInit, OnDestroy {
|
|||||||
this.isLabelNameExist = true;
|
this.isLabelNameExist = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.errorHandler.error(error);
|
this.errorHandler.error(error);
|
||||||
});
|
});
|
||||||
let hnd = setInterval(() => this.ref.markForCheck(), 100);
|
let hnd = setInterval(() => this.ref.markForCheck(), 100);
|
||||||
@ -145,28 +142,24 @@ export class CreateEditLabelComponent implements OnInit, OnDestroy {
|
|||||||
if (this.labelId <= 0) {
|
if (this.labelId <= 0) {
|
||||||
this.labelModel.scope = this.scope;
|
this.labelModel.scope = this.scope;
|
||||||
this.labelModel.project_id = this.projectId;
|
this.labelModel.project_id = this.projectId;
|
||||||
toPromise<Label>(this.labelService.createLabel(this.labelModel))
|
this.labelService.createLabel(this.labelModel)
|
||||||
.then(res => {
|
.subscribe(res => {
|
||||||
this.inProgress = false;
|
this.inProgress = false;
|
||||||
this.reload.emit();
|
this.reload.emit();
|
||||||
this.labelModel = this.initLabel();
|
this.labelModel = this.initLabel();
|
||||||
this.formShow = false;
|
this.formShow = false;
|
||||||
})
|
}, err => {
|
||||||
.catch(err => {
|
|
||||||
this.inProgress = false;
|
this.inProgress = false;
|
||||||
this.errorHandler.error(err);
|
this.errorHandler.error(err);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
toPromise<Label>(
|
|
||||||
this.labelService.updateLabel(this.labelId, this.labelModel)
|
this.labelService.updateLabel(this.labelId, this.labelModel)
|
||||||
)
|
.subscribe(res => {
|
||||||
.then(res => {
|
|
||||||
this.inProgress = false;
|
this.inProgress = false;
|
||||||
this.reload.emit();
|
this.reload.emit();
|
||||||
this.labelModel = this.initLabel();
|
this.labelModel = this.initLabel();
|
||||||
this.formShow = false;
|
this.formShow = false;
|
||||||
})
|
}, err => {
|
||||||
.catch(err => {
|
|
||||||
this.inProgress = false;
|
this.inProgress = false;
|
||||||
this.errorHandler.error(err);
|
this.errorHandler.error(err);
|
||||||
});
|
});
|
||||||
|
@ -41,6 +41,7 @@ import {FilterLabelComponent} from "./filter-label.component";
|
|||||||
import {LabelService} from "../service/label.service";
|
import {LabelService} from "../service/label.service";
|
||||||
import {LabelPieceComponent} from "../label-piece/label-piece.component";
|
import {LabelPieceComponent} from "../label-piece/label-piece.component";
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
|
import { of } from "rxjs";
|
||||||
|
|
||||||
describe("CreateEditRuleComponent (inline template)", () => {
|
describe("CreateEditRuleComponent (inline template)", () => {
|
||||||
let mockRules: ReplicationRule[] = [
|
let mockRules: ReplicationRule[] = [
|
||||||
@ -221,17 +222,16 @@ describe("CreateEditRuleComponent (inline template)", () => {
|
|||||||
spyRules = spyOn(
|
spyRules = spyOn(
|
||||||
replicationService,
|
replicationService,
|
||||||
"getReplicationRules"
|
"getReplicationRules"
|
||||||
).and.returnValues(Promise.resolve(mockRules));
|
).and.returnValues(of(mockRules));
|
||||||
spyOneRule = spyOn(
|
spyOneRule = spyOn(
|
||||||
replicationService,
|
replicationService,
|
||||||
"getReplicationRule"
|
"getReplicationRule"
|
||||||
).and.returnValue(Promise.resolve(mockRule));
|
).and.returnValue(of(mockRule));
|
||||||
spyJobs = spyOn(replicationService, "getExecutions").and.returnValues(
|
spyJobs = spyOn(replicationService, "getExecutions").and.returnValues(
|
||||||
Promise.resolve(mockJob)
|
of(mockJob));
|
||||||
);
|
|
||||||
|
|
||||||
spyEndpoint = spyOn(endpointService, "getEndpoints").and.returnValues(
|
spyEndpoint = spyOn(endpointService, "getEndpoints").and.returnValues(
|
||||||
Promise.resolve(mockEndpoints)
|
of(mockEndpoints)
|
||||||
);
|
);
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
@ -22,10 +22,10 @@ import {
|
|||||||
Output
|
Output
|
||||||
} from "@angular/core";
|
} from "@angular/core";
|
||||||
import { Filter, ReplicationRule, Endpoint, Label } from "../service/interface";
|
import { Filter, ReplicationRule, Endpoint, Label } from "../service/interface";
|
||||||
import { Subject , Subscription } from "rxjs";
|
import { Subject, Subscription } from "rxjs";
|
||||||
import {debounceTime, distinctUntilChanged} from "rxjs/operators";
|
import { debounceTime, distinctUntilChanged } from "rxjs/operators";
|
||||||
import { FormArray, FormBuilder, FormGroup, Validators, FormControl } from "@angular/forms";
|
import { FormArray, FormBuilder, FormGroup, Validators, FormControl } from "@angular/forms";
|
||||||
import { clone, compareValue, isEmptyObject, toPromise } from "../utils";
|
import { clone, compareValue, isEmptyObject } from "../utils";
|
||||||
import { InlineAlertComponent } from "../inline-alert/inline-alert.component";
|
import { InlineAlertComponent } from "../inline-alert/inline-alert.component";
|
||||||
import { ReplicationService } from "../service/replication.service";
|
import { ReplicationService } from "../service/replication.service";
|
||||||
import { ErrorHandler } from "../error-handler/error-handler";
|
import { ErrorHandler } from "../error-handler/error-handler";
|
||||||
@ -143,12 +143,14 @@ export class CreateEditRuleComponent implements OnInit, OnDestroy {
|
|||||||
this.filterSelect = ["type", "repository", "tag"];
|
this.filterSelect = ["type", "repository", "tag"];
|
||||||
}
|
}
|
||||||
|
|
||||||
toPromise<Endpoint[]>(this.endpointService.getEndpoints())
|
|
||||||
.then(endPoints => {
|
this.endpointService.getEndpoints().subscribe(endPoints => {
|
||||||
this.targetList = endPoints || [];
|
this.targetList = endPoints || [];
|
||||||
this.sourceList = endPoints || [];
|
this.sourceList = endPoints || [];
|
||||||
})
|
}, error => {
|
||||||
.catch((error: any) => this.errorHandler.error(error));
|
this.errorHandler.error(error);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
this.nameChecker
|
this.nameChecker
|
||||||
.pipe(debounceTime(300))
|
.pipe(debounceTime(300))
|
||||||
@ -159,17 +161,14 @@ export class CreateEditRuleComponent implements OnInit, OnDestroy {
|
|||||||
this.isRuleNameValid = cont.valid;
|
this.isRuleNameValid = cont.valid;
|
||||||
if (this.isRuleNameValid) {
|
if (this.isRuleNameValid) {
|
||||||
this.inNameChecking = true;
|
this.inNameChecking = true;
|
||||||
toPromise<ReplicationRule[]>(
|
this.repService.getReplicationRules(0, ruleName)
|
||||||
this.repService.getReplicationRules(0, ruleName)
|
.subscribe(response => {
|
||||||
)
|
|
||||||
.then(response => {
|
|
||||||
if (response.some(rule => rule.name === ruleName)) {
|
if (response.some(rule => rule.name === ruleName)) {
|
||||||
this.ruleNameTooltip = "TOOLTIP.RULE_USER_EXISTING";
|
this.ruleNameTooltip = "TOOLTIP.RULE_USER_EXISTING";
|
||||||
this.isRuleNameValid = false;
|
this.isRuleNameValid = false;
|
||||||
}
|
}
|
||||||
this.inNameChecking = false;
|
this.inNameChecking = false;
|
||||||
})
|
}, () => {
|
||||||
.catch(() => {
|
|
||||||
this.inNameChecking = false;
|
this.inNameChecking = false;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@ -179,7 +178,8 @@ export class CreateEditRuleComponent implements OnInit, OnDestroy {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceChange($event): void {
|
|
||||||
|
sourceChange($event): void {
|
||||||
if ($event && $event.target) {
|
if ($event && $event.target) {
|
||||||
if ($event.target["value"] === "-1") {
|
if ($event.target["value"] === "-1") {
|
||||||
this.noSelectedEndpoint = true;
|
this.noSelectedEndpoint = true;
|
||||||
@ -190,6 +190,38 @@ export class CreateEditRuleComponent implements OnInit, OnDestroy {
|
|||||||
);
|
);
|
||||||
this.noSelectedEndpoint = false;
|
this.noSelectedEndpoint = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.proNameChecker
|
||||||
|
.pipe(debounceTime(500))
|
||||||
|
.pipe(distinctUntilChanged())
|
||||||
|
.subscribe((resp: string) => {
|
||||||
|
let name = this.ruleForm.controls["projects"].value[0].name;
|
||||||
|
this.noProjectInfo = "";
|
||||||
|
this.selectedProjectList = [];
|
||||||
|
this.proService.listProjects(name, undefined)
|
||||||
|
.subscribe((res: any) => {
|
||||||
|
if (res) {
|
||||||
|
this.selectedProjectList = res.slice(0, 10);
|
||||||
|
// if input value exit in project list
|
||||||
|
let pro = res.find((data: any) => data.name === name);
|
||||||
|
if (!pro) {
|
||||||
|
this.noProjectInfo = "REPLICATION.NO_PROJECT_INFO";
|
||||||
|
this.noSelectedProject = true;
|
||||||
|
} else {
|
||||||
|
this.noProjectInfo = "";
|
||||||
|
this.noSelectedProject = false;
|
||||||
|
this.setProject([pro]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.noProjectInfo = "REPLICATION.NO_PROJECT_INFO";
|
||||||
|
this.noSelectedProject = true;
|
||||||
|
}
|
||||||
|
}, (error: any) => {
|
||||||
|
this.errorHandler.error(error);
|
||||||
|
this.noProjectInfo = "REPLICATION.NO_PROJECT_INFO";
|
||||||
|
this.noSelectedProject = true;
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
@ -240,7 +272,7 @@ export class CreateEditRuleComponent implements OnInit, OnDestroy {
|
|||||||
trigger: {
|
trigger: {
|
||||||
kind: this.triggerNames[0],
|
kind: this.triggerNames[0],
|
||||||
schedule_param: {
|
schedule_param: {
|
||||||
cron: ""
|
cron: ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
deletion: false
|
deletion: false
|
||||||
@ -614,30 +646,28 @@ export class CreateEditRuleComponent implements OnInit, OnDestroy {
|
|||||||
if (this.policyId < 0) {
|
if (this.policyId < 0) {
|
||||||
this.repService
|
this.repService
|
||||||
.createReplicationRule(copyRuleForm)
|
.createReplicationRule(copyRuleForm)
|
||||||
.then(() => {
|
.subscribe(() => {
|
||||||
this.translateService
|
this.translateService
|
||||||
.get("REPLICATION.CREATED_SUCCESS")
|
.get("REPLICATION.CREATED_SUCCESS")
|
||||||
.subscribe(res => this.errorHandler.info(res));
|
.subscribe(res => this.errorHandler.info(res));
|
||||||
this.inProgress = false;
|
this.inProgress = false;
|
||||||
this.reload.emit(true);
|
this.reload.emit(true);
|
||||||
this.close();
|
this.close();
|
||||||
})
|
}, (error: any) => {
|
||||||
.catch((error: any) => {
|
|
||||||
this.inProgress = false;
|
this.inProgress = false;
|
||||||
this.inlineAlert.showInlineError(error);
|
this.inlineAlert.showInlineError(error);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.repService
|
this.repService
|
||||||
.updateReplicationRule(this.policyId, this.ruleForm.value)
|
.updateReplicationRule(this.policyId, this.ruleForm.value)
|
||||||
.then(() => {
|
.subscribe(() => {
|
||||||
this.translateService
|
this.translateService
|
||||||
.get("REPLICATION.UPDATED_SUCCESS")
|
.get("REPLICATION.UPDATED_SUCCESS")
|
||||||
.subscribe(res => this.errorHandler.info(res));
|
.subscribe(res => this.errorHandler.info(res));
|
||||||
this.inProgress = false;
|
this.inProgress = false;
|
||||||
this.reload.emit(true);
|
this.reload.emit(true);
|
||||||
this.close();
|
this.close();
|
||||||
})
|
}, (error: any) => {
|
||||||
.catch((error: any) => {
|
|
||||||
this.inProgress = false;
|
this.inProgress = false;
|
||||||
this.inlineAlert.showInlineError(error);
|
this.inlineAlert.showInlineError(error);
|
||||||
});
|
});
|
||||||
@ -677,16 +707,15 @@ export class CreateEditRuleComponent implements OnInit, OnDestroy {
|
|||||||
if (ruleId) {
|
if (ruleId) {
|
||||||
this.policyId = +ruleId;
|
this.policyId = +ruleId;
|
||||||
this.headerTitle = "REPLICATION.EDIT_POLICY_TITLE";
|
this.headerTitle = "REPLICATION.EDIT_POLICY_TITLE";
|
||||||
toPromise(this.repService.getReplicationRule(ruleId))
|
this.repService.getReplicationRule(ruleId)
|
||||||
.then(response => {
|
.subscribe(response => {
|
||||||
this.copyUpdateForm = clone(response);
|
this.copyUpdateForm = clone(response);
|
||||||
// set filter value is [] if callback filter value is null.
|
// set filter value is [] if callback filter value is null.
|
||||||
this.updateForm(response);
|
this.updateForm(response);
|
||||||
// keep trigger same value
|
// keep trigger same value
|
||||||
this.copyUpdateForm.trigger = clone(response.trigger);
|
this.copyUpdateForm.trigger = clone(response.trigger);
|
||||||
this.copyUpdateForm.filters = this.copyUpdateForm.filters === null ? [] : this.copyUpdateForm.filters;
|
this.copyUpdateForm.filters = this.copyUpdateForm.filters === null ? [] : this.copyUpdateForm.filters;
|
||||||
})
|
}, (error: any) => {
|
||||||
.catch((error: any) => {
|
|
||||||
this.inlineAlert.showInlineError(error);
|
this.inlineAlert.showInlineError(error);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import {Component, Input, OnInit, OnChanges, Output, EventEmitter, ChangeDetectorRef, SimpleChanges} from "@angular/core";
|
import { Component, Input, OnInit, OnChanges, Output, EventEmitter, ChangeDetectorRef, SimpleChanges } from "@angular/core";
|
||||||
import {LabelService} from "../service/label.service";
|
import { LabelService } from "../service/label.service";
|
||||||
import {toPromise} from "../utils";
|
import { Label } from "../service/interface";
|
||||||
import {Label} from "../service/interface";
|
import { ErrorHandler } from "../error-handler/error-handler";
|
||||||
import {ErrorHandler} from "../error-handler/error-handler";
|
import { Subject, forkJoin, Observable, throwError as observableThrowError } from "rxjs";
|
||||||
import {Subject} from "rxjs";
|
import { debounceTime, distinctUntilChanged } from "rxjs/operators";
|
||||||
import {debounceTime, distinctUntilChanged} from "rxjs/operators";
|
import { map, catchError } from "rxjs/operators";
|
||||||
|
|
||||||
export interface LabelState {
|
export interface LabelState {
|
||||||
iconsShow: boolean;
|
iconsShow: boolean;
|
||||||
@ -22,7 +22,7 @@ export class FilterLabelComponent implements OnInit, OnChanges {
|
|||||||
openFilterLabelPanel: boolean;
|
openFilterLabelPanel: boolean;
|
||||||
labelLists: LabelState[] = [];
|
labelLists: LabelState[] = [];
|
||||||
filterLabelName = '';
|
filterLabelName = '';
|
||||||
labelNameFilter: Subject<string> = new Subject<string> ();
|
labelNameFilter: Subject<string> = new Subject<string>();
|
||||||
@Input() isOpen: boolean;
|
@Input() isOpen: boolean;
|
||||||
@Input() projectId: number;
|
@Input() projectId: number;
|
||||||
@Input() selectedLabelInfo: Label[];
|
@Input() selectedLabelInfo: Label[];
|
||||||
@ -30,17 +30,19 @@ export class FilterLabelComponent implements OnInit, OnChanges {
|
|||||||
@Output() closePanelEvent = new EventEmitter();
|
@Output() closePanelEvent = new EventEmitter();
|
||||||
|
|
||||||
constructor(private labelService: LabelService,
|
constructor(private labelService: LabelService,
|
||||||
private ref: ChangeDetectorRef,
|
private ref: ChangeDetectorRef,
|
||||||
private errorHandler: ErrorHandler) {}
|
private errorHandler: ErrorHandler) { }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
Promise.all([this.getGLabels(), this.getPLabels()]).then(() => {
|
forkJoin(this.getGLabels(), this.getPLabels()).subscribe(() => {
|
||||||
this.selectedLabelInfo.forEach(info => {
|
this.selectedLabelInfo.forEach(info => {
|
||||||
if (this.labelLists.length) {
|
if (this.labelLists.length) {
|
||||||
let lab = this.labelLists.find(data => data.label.id === info.id);
|
let lab = this.labelLists.find(data => data.label.id === info.id);
|
||||||
if (lab) {this.selectOper(lab); }
|
if (lab) { this.selectOper(lab); }
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}, error => {
|
||||||
|
this.errorHandler.error(error);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.labelNameFilter
|
this.labelNameFilter
|
||||||
@ -64,32 +66,30 @@ export class FilterLabelComponent implements OnInit, OnChanges {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges) {
|
ngOnChanges(changes: SimpleChanges) {
|
||||||
if (changes['isOpen']) {this.openFilterLabelPanel = changes['isOpen'].currentValue; }
|
if (changes['isOpen']) { this.openFilterLabelPanel = changes['isOpen'].currentValue; }
|
||||||
}
|
}
|
||||||
|
|
||||||
getGLabels() {
|
getGLabels() {
|
||||||
return toPromise<Label[]>(this.labelService.getGLabels()).then((res: Label[]) => {
|
return this.labelService.getGLabels().pipe(map((res: Label[]) => {
|
||||||
if (res.length) {
|
if (res.length) {
|
||||||
res.forEach(data => {
|
res.forEach(data => {
|
||||||
this.labelLists.push({'iconsShow': false, 'label': data, 'show': true});
|
this.labelLists.push({ 'iconsShow': false, 'label': data, 'show': true });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
})
|
||||||
this.errorHandler.error(error);
|
, catchError(error => observableThrowError(error)));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getPLabels() {
|
getPLabels() {
|
||||||
if (this.projectId && this.projectId > 0) {
|
if (this.projectId && this.projectId > 0) {
|
||||||
return toPromise<Label[]>(this.labelService.getPLabels(this.projectId)).then((res1: Label[]) => {
|
return this.labelService.getPLabels(this.projectId).pipe(map((res1: Label[]) => {
|
||||||
if (res1.length) {
|
if (res1.length) {
|
||||||
res1.forEach(data => {
|
res1.forEach(data => {
|
||||||
this.labelLists.push({'iconsShow': false, 'label': data, 'show': true});
|
this.labelLists.push({ 'iconsShow': false, 'label': data, 'show': true });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
})
|
||||||
this.errorHandler.error(error);
|
, catchError(error => observableThrowError(error)));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ import { IServiceConfig, SERVICE_CONFIG } from "../service.config";
|
|||||||
import { OperationService } from "../operation/operation.service";
|
import { OperationService } from "../operation/operation.service";
|
||||||
|
|
||||||
import { click } from "../utils";
|
import { click } from "../utils";
|
||||||
|
import { of } from "rxjs";
|
||||||
|
|
||||||
describe("EndpointComponent (inline template)", () => {
|
describe("EndpointComponent (inline template)", () => {
|
||||||
let mockData: Endpoint[] = [
|
let mockData: Endpoint[] = [
|
||||||
@ -138,7 +139,7 @@ describe("EndpointComponent (inline template)", () => {
|
|||||||
endpointService = fixture.debugElement.injector.get(EndpointService);
|
endpointService = fixture.debugElement.injector.get(EndpointService);
|
||||||
|
|
||||||
spy = spyOn(endpointService, "getEndpoints").and.returnValues(
|
spy = spyOn(endpointService, "getEndpoints").and.returnValues(
|
||||||
Promise.resolve(mockData)
|
of(mockData)
|
||||||
);
|
);
|
||||||
|
|
||||||
spyAdapter = spyOn(endpointService, "getAdapters").and.returnValue(
|
spyAdapter = spyOn(endpointService, "getAdapters").and.returnValue(
|
||||||
@ -150,7 +151,7 @@ describe("EndpointComponent (inline template)", () => {
|
|||||||
"getEndpointWithReplicationRules"
|
"getEndpointWithReplicationRules"
|
||||||
).and.returnValue([]);
|
).and.returnValue([]);
|
||||||
spyOne = spyOn(endpointService, "getEndpoint").and.returnValue(
|
spyOne = spyOn(endpointService, "getEndpoint").and.returnValue(
|
||||||
Promise.resolve(mockOne[0])
|
of(mockOne[0])
|
||||||
);
|
);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
|
@ -19,8 +19,7 @@ import {
|
|||||||
ChangeDetectionStrategy,
|
ChangeDetectionStrategy,
|
||||||
ChangeDetectorRef
|
ChangeDetectorRef
|
||||||
} from "@angular/core";
|
} from "@angular/core";
|
||||||
import { Subscription } from "rxjs";
|
import { Subscription, Observable, forkJoin } from "rxjs";
|
||||||
import { forkJoin } from "rxjs";
|
|
||||||
import { TranslateService } from "@ngx-translate/core";
|
import { TranslateService } from "@ngx-translate/core";
|
||||||
import { Comparator } from "../service/interface";
|
import { Comparator } from "../service/interface";
|
||||||
|
|
||||||
@ -28,7 +27,7 @@ import { Endpoint } from "../service/interface";
|
|||||||
import { EndpointService } from "../service/endpoint.service";
|
import { EndpointService } from "../service/endpoint.service";
|
||||||
|
|
||||||
import { ErrorHandler } from "../error-handler/index";
|
import { ErrorHandler } from "../error-handler/index";
|
||||||
|
import { map, catchError } from "rxjs/operators";
|
||||||
import { ConfirmationMessage } from "../confirmation-dialog/confirmation-message";
|
import { ConfirmationMessage } from "../confirmation-dialog/confirmation-message";
|
||||||
import { ConfirmationAcknowledgement } from "../confirmation-dialog/confirmation-state-message";
|
import { ConfirmationAcknowledgement } from "../confirmation-dialog/confirmation-state-message";
|
||||||
import { ConfirmationDialogComponent } from "../confirmation-dialog/confirmation-dialog.component";
|
import { ConfirmationDialogComponent } from "../confirmation-dialog/confirmation-dialog.component";
|
||||||
@ -40,7 +39,7 @@ import {
|
|||||||
} from "../shared/shared.const";
|
} from "../shared/shared.const";
|
||||||
|
|
||||||
import { CreateEditEndpointComponent } from "../create-edit-endpoint/create-edit-endpoint.component";
|
import { CreateEditEndpointComponent } from "../create-edit-endpoint/create-edit-endpoint.component";
|
||||||
import { toPromise, CustomComparator } from "../utils";
|
import { CustomComparator } from "../utils";
|
||||||
|
|
||||||
import { operateChanges, OperateInfo, OperationState } from "../operation/operate";
|
import { operateChanges, OperateInfo, OperationState } from "../operation/operate";
|
||||||
import { OperationService } from "../operation/operation.service";
|
import { OperationService } from "../operation/operation.service";
|
||||||
@ -116,13 +115,12 @@ export class EndpointComponent implements OnInit, OnDestroy {
|
|||||||
retrieve(): void {
|
retrieve(): void {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.selectedRow = [];
|
this.selectedRow = [];
|
||||||
toPromise<Endpoint[]>(this.endpointService.getEndpoints(this.targetName))
|
this.endpointService.getEndpoints(this.targetName)
|
||||||
.then(targets => {
|
.subscribe(targets => {
|
||||||
this.targets = targets || [];
|
this.targets = targets || [];
|
||||||
this.forceRefreshView(1000);
|
this.forceRefreshView(1000);
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.errorHandler.error(error);
|
this.errorHandler.error(error);
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
@ -182,11 +180,11 @@ export class EndpointComponent implements OnInit, OnDestroy {
|
|||||||
message.state === ConfirmationState.CONFIRMED) {
|
message.state === ConfirmationState.CONFIRMED) {
|
||||||
let targetLists: Endpoint[] = message.data;
|
let targetLists: Endpoint[] = message.data;
|
||||||
if (targetLists && targetLists.length) {
|
if (targetLists && targetLists.length) {
|
||||||
let promiseLists: any[] = [];
|
let observableLists: any[] = [];
|
||||||
targetLists.forEach(target => {
|
targetLists.forEach(target => {
|
||||||
promiseLists.push(this.delOperate(target));
|
observableLists.push(this.delOperate(target));
|
||||||
});
|
});
|
||||||
Promise.all(promiseLists).then((item) => {
|
forkJoin(...observableLists).subscribe((item) => {
|
||||||
this.selectedRow = [];
|
this.selectedRow = [];
|
||||||
this.reload(true);
|
this.reload(true);
|
||||||
this.forceRefreshView(2000);
|
this.forceRefreshView(2000);
|
||||||
@ -194,8 +192,7 @@ export class EndpointComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
delOperate(target: Endpoint): Observable<any> {
|
||||||
delOperate(target: Endpoint) {
|
|
||||||
// init operation info
|
// init operation info
|
||||||
let operMessage = new OperateInfo();
|
let operMessage = new OperateInfo();
|
||||||
operMessage.name = 'OPERATION.DELETE_REGISTRY';
|
operMessage.name = 'OPERATION.DELETE_REGISTRY';
|
||||||
@ -204,27 +201,29 @@ export class EndpointComponent implements OnInit, OnDestroy {
|
|||||||
operMessage.data.name = target.name;
|
operMessage.data.name = target.name;
|
||||||
this.operationService.publishInfo(operMessage);
|
this.operationService.publishInfo(operMessage);
|
||||||
|
|
||||||
return toPromise<number>(this.endpointService
|
return this.endpointService
|
||||||
.deleteEndpoint(target.id))
|
.deleteEndpoint(target.id)
|
||||||
.then(
|
.pipe(map(
|
||||||
response => {
|
response => {
|
||||||
this.translateService.get('BATCH.DELETED_SUCCESS')
|
this.translateService.get('BATCH.DELETED_SUCCESS')
|
||||||
.subscribe(res => {
|
.subscribe(res => {
|
||||||
operateChanges(operMessage, OperationState.success);
|
operateChanges(operMessage, OperationState.success);
|
||||||
});
|
});
|
||||||
}).catch(
|
})
|
||||||
error => {
|
, catchError(error => {
|
||||||
if (error && error.status === 412) {
|
if (error && error.status === 412) {
|
||||||
forkJoin(this.translateService.get('BATCH.DELETED_FAILURE'),
|
return forkJoin(this.translateService.get('BATCH.DELETED_FAILURE'),
|
||||||
this.translateService.get('DESTINATION.FAILED_TO_DELETE_TARGET_IN_USED')).subscribe(res => {
|
this.translateService.get('DESTINATION.FAILED_TO_DELETE_TARGET_IN_USED')).pipe(map(res => {
|
||||||
operateChanges(operMessage, OperationState.failure, res[1]);
|
operateChanges(operMessage, OperationState.failure, res[1]);
|
||||||
});
|
}));
|
||||||
} else {
|
} else {
|
||||||
this.translateService.get('BATCH.DELETED_FAILURE').subscribe(res => {
|
return this.translateService.get('BATCH.DELETED_FAILURE').pipe(map(res => {
|
||||||
operateChanges(operMessage, OperationState.failure, res);
|
operateChanges(operMessage, OperationState.failure, res);
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
}
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Forcely refresh the view
|
// Forcely refresh the view
|
||||||
|
@ -7,7 +7,7 @@ import {
|
|||||||
ChangeDetectorRef
|
ChangeDetectorRef
|
||||||
} from "@angular/core";
|
} from "@angular/core";
|
||||||
|
|
||||||
import { downloadFile, toPromise } from "../../utils";
|
import { downloadFile } from "../../utils";
|
||||||
import { SystemInfoService, HelmChartService } from "../../service/index";
|
import { SystemInfoService, HelmChartService } from "../../service/index";
|
||||||
import { HelmChartDetail, SystemInfo } from "./../../service/interface";
|
import { HelmChartDetail, SystemInfo } from "./../../service/interface";
|
||||||
import { ErrorHandler } from "./../../error-handler/error-handler";
|
import { ErrorHandler } from "./../../error-handler/error-handler";
|
||||||
@ -43,16 +43,15 @@ export class ChartDetailComponent implements OnInit {
|
|||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
toPromise<SystemInfo>(this.systemInfoService.getSystemInfo())
|
this.systemInfoService.getSystemInfo()
|
||||||
.then(systemInfo => {
|
.subscribe(systemInfo => {
|
||||||
let scheme = 'http://';
|
let scheme = 'http://';
|
||||||
this.systemInfo = systemInfo;
|
this.systemInfo = systemInfo;
|
||||||
if (this.systemInfo.has_ca_root) {
|
if (this.systemInfo.has_ca_root) {
|
||||||
scheme = 'https://';
|
scheme = 'https://';
|
||||||
}
|
}
|
||||||
this.repoURL = `${scheme}${this.systemInfo.registry_url}`;
|
this.repoURL = `${scheme}${this.systemInfo.registry_url}`;
|
||||||
})
|
}, error => this.errorHandler.error(error));
|
||||||
.catch(error => this.errorHandler.error(error));
|
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
public get chartNameWithVersion() {
|
public get chartNameWithVersion() {
|
||||||
|
@ -15,7 +15,7 @@ import { forkJoin, throwError, Observable } from "rxjs";
|
|||||||
import { finalize, map, catchError } from "rxjs/operators";
|
import { finalize, map, catchError } from "rxjs/operators";
|
||||||
import { SystemInfo, SystemInfoService, HelmChartItem } from "../service/index";
|
import { SystemInfo, SystemInfoService, HelmChartItem } from "../service/index";
|
||||||
import { ErrorHandler } from "../error-handler/error-handler";
|
import { ErrorHandler } from "../error-handler/error-handler";
|
||||||
import { toPromise, DEFAULT_PAGE_SIZE, downloadFile } from "../utils";
|
import { DEFAULT_PAGE_SIZE, downloadFile } from "../utils";
|
||||||
import { HelmChartService } from "../service/helm-chart.service";
|
import { HelmChartService } from "../service/helm-chart.service";
|
||||||
import { DefaultHelmIcon } from "../shared/shared.const";
|
import { DefaultHelmIcon } from "../shared/shared.const";
|
||||||
import { Roles } from './../shared/shared.const';
|
import { Roles } from './../shared/shared.const';
|
||||||
@ -96,9 +96,9 @@ export class HelmChartComponent implements OnInit {
|
|||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
// Get system info for tag views
|
// Get system info for tag views
|
||||||
toPromise<SystemInfo>(this.systemInfoService.getSystemInfo())
|
this.systemInfoService.getSystemInfo()
|
||||||
.then(systemInfo => (this.systemInfo = systemInfo))
|
.subscribe(systemInfo => (this.systemInfo = systemInfo)
|
||||||
.catch(error => this.errorHandler.error(error));
|
, error => this.errorHandler.error(error));
|
||||||
this.lastFilteredChartName = "";
|
this.lastFilteredChartName = "";
|
||||||
this.refresh();
|
this.refresh();
|
||||||
this.getHelmPermissionRule(this.projectId);
|
this.getHelmPermissionRule(this.projectId);
|
||||||
|
@ -23,7 +23,7 @@ import {
|
|||||||
} from "./../../service/index";
|
} from "./../../service/index";
|
||||||
import { Label } from './../../service/interface';
|
import { Label } from './../../service/interface';
|
||||||
import { ErrorHandler } from "./../../error-handler/error-handler";
|
import { ErrorHandler } from "./../../error-handler/error-handler";
|
||||||
import { toPromise, DEFAULT_PAGE_SIZE, downloadFile } from "../../utils";
|
import { DEFAULT_PAGE_SIZE, downloadFile } from "../../utils";
|
||||||
import { OperationService } from "./../../operation/operation.service";
|
import { OperationService } from "./../../operation/operation.service";
|
||||||
import { HelmChartService } from "./../../service/helm-chart.service";
|
import { HelmChartService } from "./../../service/helm-chart.service";
|
||||||
import { UserPermissionService } from "../../service/permission.service";
|
import { UserPermissionService } from "../../service/permission.service";
|
||||||
@ -104,9 +104,9 @@ export class ChartVersionComponent implements OnInit {
|
|||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
// Get system info for tag views
|
// Get system info for tag views
|
||||||
toPromise<SystemInfo>(this.systemInfoService.getSystemInfo())
|
this.systemInfoService.getSystemInfo()
|
||||||
.then(systemInfo => (this.systemInfo = systemInfo))
|
.subscribe(systemInfo => (this.systemInfo = systemInfo)
|
||||||
.catch(error => this.errorHandler.error(error));
|
, error => this.errorHandler.error(error));
|
||||||
this.refresh();
|
this.refresh();
|
||||||
this.getLabels();
|
this.getLabels();
|
||||||
this.lastFilteredVersionName = "";
|
this.lastFilteredVersionName = "";
|
||||||
|
@ -8,6 +8,7 @@ import { ProjectDefaultService, ProjectService } from "../service/index";
|
|||||||
import { ChannelService } from "../channel/index";
|
import { ChannelService } from "../channel/index";
|
||||||
import { Project } from "../project-policy-config/project";
|
import { Project } from "../project-policy-config/project";
|
||||||
import { IServiceConfig, SERVICE_CONFIG } from "../service.config";
|
import { IServiceConfig, SERVICE_CONFIG } from "../service.config";
|
||||||
|
import { of } from "rxjs";
|
||||||
|
|
||||||
describe("ImageNameInputComponent (inline template)", () => {
|
describe("ImageNameInputComponent (inline template)", () => {
|
||||||
let comp: ImageNameInputComponent;
|
let comp: ImageNameInputComponent;
|
||||||
@ -54,7 +55,7 @@ describe("ImageNameInputComponent (inline template)", () => {
|
|||||||
|
|
||||||
let projectService: ProjectService;
|
let projectService: ProjectService;
|
||||||
projectService = fixture.debugElement.injector.get(ProjectService);
|
projectService = fixture.debugElement.injector.get(ProjectService);
|
||||||
spy = spyOn(projectService, "listProjects").and.returnValues(Promise.resolve(mockProjects));
|
spy = spyOn(projectService, "listProjects").and.returnValues(of(mockProjects));
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should load data", async(() => {
|
it("should load data", async(() => {
|
||||||
|
@ -13,6 +13,7 @@ import {ErrorHandler} from "../error-handler/error-handler";
|
|||||||
|
|
||||||
import {IServiceConfig, SERVICE_CONFIG} from "../service.config";
|
import {IServiceConfig, SERVICE_CONFIG} from "../service.config";
|
||||||
import { OperationService } from "../operation/operation.service";
|
import { OperationService } from "../operation/operation.service";
|
||||||
|
import { of } from "rxjs";
|
||||||
|
|
||||||
describe('LabelComponent (inline template)', () => {
|
describe('LabelComponent (inline template)', () => {
|
||||||
|
|
||||||
@ -91,8 +92,8 @@ describe('LabelComponent (inline template)', () => {
|
|||||||
|
|
||||||
labelService = fixture.debugElement.injector.get(LabelService);
|
labelService = fixture.debugElement.injector.get(LabelService);
|
||||||
|
|
||||||
spy = spyOn(labelService, 'getLabels').and.returnValues(Promise.resolve(mockData));
|
spy = spyOn(labelService, 'getLabels').and.returnValues(of(mockData));
|
||||||
spyOneLabel = spyOn(labelService, 'getLabel').and.returnValues(Promise.resolve(mockOneData));
|
spyOneLabel = spyOn(labelService, 'getLabel').and.returnValues(of(mockOneData));
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@ import {
|
|||||||
} from "@angular/core";
|
} from "@angular/core";
|
||||||
import { Label } from "../service/interface";
|
import { Label } from "../service/interface";
|
||||||
import { LabelService } from "../service/label.service";
|
import { LabelService } from "../service/label.service";
|
||||||
import { toPromise } from "../utils";
|
|
||||||
import { ErrorHandler } from "../error-handler/error-handler";
|
import { ErrorHandler } from "../error-handler/error-handler";
|
||||||
import { CreateEditLabelComponent } from "../create-edit-label/create-edit-label.component";
|
import { CreateEditLabelComponent } from "../create-edit-label/create-edit-label.component";
|
||||||
import { ConfirmationMessage } from "../confirmation-dialog/confirmation-message";
|
import { ConfirmationMessage } from "../confirmation-dialog/confirmation-message";
|
||||||
@ -35,7 +34,8 @@ import { TranslateService } from "@ngx-translate/core";
|
|||||||
import { ConfirmationDialogComponent } from "../confirmation-dialog/confirmation-dialog.component";
|
import { ConfirmationDialogComponent } from "../confirmation-dialog/confirmation-dialog.component";
|
||||||
import { operateChanges, OperateInfo, OperationState } from "../operation/operate";
|
import { operateChanges, OperateInfo, OperationState } from "../operation/operate";
|
||||||
import { OperationService } from "../operation/operation.service";
|
import { OperationService } from "../operation/operation.service";
|
||||||
|
import { map, catchError } from "rxjs/operators";
|
||||||
|
import { Observable, throwError as observableThrowError, forkJoin } from "rxjs";
|
||||||
@Component({
|
@Component({
|
||||||
selector: "hbr-label",
|
selector: "hbr-label",
|
||||||
templateUrl: "./label.component.html",
|
templateUrl: "./label.component.html",
|
||||||
@ -75,13 +75,12 @@ export class LabelComponent implements OnInit {
|
|||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.selectedRow = [];
|
this.selectedRow = [];
|
||||||
this.targetName = "";
|
this.targetName = "";
|
||||||
toPromise<Label[]>(this.labelService.getLabels(scope, this.projectId, name))
|
this.labelService.getLabels(scope, this.projectId, name)
|
||||||
.then(targets => {
|
.subscribe(targets => {
|
||||||
this.targets = targets || [];
|
this.targets = targets || [];
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.forceRefreshView(2000);
|
this.forceRefreshView(2000);
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.errorHandler.error(error);
|
this.errorHandler.error(error);
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
@ -134,11 +133,11 @@ export class LabelComponent implements OnInit {
|
|||||||
message.state === ConfirmationState.CONFIRMED) {
|
message.state === ConfirmationState.CONFIRMED) {
|
||||||
let targetLists: Label[] = message.data;
|
let targetLists: Label[] = message.data;
|
||||||
if (targetLists && targetLists.length) {
|
if (targetLists && targetLists.length) {
|
||||||
let promiseLists: any[] = [];
|
let observableLists: any[] = [];
|
||||||
targetLists.forEach(target => {
|
targetLists.forEach(target => {
|
||||||
promiseLists.push(this.delOperate(target));
|
observableLists.push(this.delOperate(target));
|
||||||
});
|
});
|
||||||
Promise.all(promiseLists).then((item) => {
|
forkJoin(...observableLists).subscribe((item) => {
|
||||||
this.selectedRow = [];
|
this.selectedRow = [];
|
||||||
this.retrieve(this.scope);
|
this.retrieve(this.scope);
|
||||||
});
|
});
|
||||||
@ -146,7 +145,7 @@ export class LabelComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delOperate(target: Label) {
|
delOperate(target: Label): Observable<any> {
|
||||||
// init operation info
|
// init operation info
|
||||||
let operMessage = new OperateInfo();
|
let operMessage = new OperateInfo();
|
||||||
operMessage.name = 'OPERATION.DELETE_LABEL';
|
operMessage.name = 'OPERATION.DELETE_LABEL';
|
||||||
@ -155,20 +154,19 @@ export class LabelComponent implements OnInit {
|
|||||||
operMessage.data.name = target.name;
|
operMessage.data.name = target.name;
|
||||||
this.operationService.publishInfo(operMessage);
|
this.operationService.publishInfo(operMessage);
|
||||||
|
|
||||||
return toPromise<number>(this.labelService
|
return this.labelService
|
||||||
.deleteLabel(target.id))
|
.deleteLabel(target.id)
|
||||||
.then(
|
.pipe(map(
|
||||||
response => {
|
response => {
|
||||||
this.translateService.get('BATCH.DELETED_SUCCESS')
|
this.translateService.get('BATCH.DELETED_SUCCESS')
|
||||||
.subscribe(res => {
|
.subscribe(res => {
|
||||||
operateChanges(operMessage, OperationState.success);
|
operateChanges(operMessage, OperationState.success);
|
||||||
});
|
});
|
||||||
}).catch(
|
}), catchError( error => {
|
||||||
error => {
|
return this.translateService.get('BATCH.DELETED_FAILURE').pipe(map(res => {
|
||||||
this.translateService.get('BATCH.DELETED_FAILURE').subscribe(res => {
|
|
||||||
operateChanges(operMessage, OperationState.failure, res);
|
operateChanges(operMessage, OperationState.failure, res);
|
||||||
});
|
}));
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Forcely refresh the view
|
// Forcely refresh the view
|
||||||
|
@ -14,6 +14,7 @@ import { ErrorHandler } from '../error-handler/error-handler';
|
|||||||
import { SERVICE_CONFIG, IServiceConfig } from '../service.config';
|
import { SERVICE_CONFIG, IServiceConfig } from '../service.config';
|
||||||
import { ReplicationService, ReplicationDefaultService } from '../service/replication.service';
|
import { ReplicationService, ReplicationDefaultService } from '../service/replication.service';
|
||||||
import { OperationService } from "../operation/operation.service";
|
import { OperationService } from "../operation/operation.service";
|
||||||
|
import { of } from 'rxjs';
|
||||||
|
|
||||||
describe('ListReplicationRuleComponent (inline template)', () => {
|
describe('ListReplicationRuleComponent (inline template)', () => {
|
||||||
|
|
||||||
@ -77,7 +78,7 @@ describe('ListReplicationRuleComponent (inline template)', () => {
|
|||||||
fixture = TestBed.createComponent(ListReplicationRuleComponent);
|
fixture = TestBed.createComponent(ListReplicationRuleComponent);
|
||||||
comp = fixture.componentInstance;
|
comp = fixture.componentInstance;
|
||||||
replicationService = fixture.debugElement.injector.get(ReplicationService);
|
replicationService = fixture.debugElement.injector.get(ReplicationService);
|
||||||
spyRules = spyOn(replicationService, 'getReplicationRules').and.returnValues(Promise.resolve(mockRules));
|
spyRules = spyOn(replicationService, 'getReplicationRules').and.returnValues(of(mockRules));
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -24,10 +24,10 @@ import {
|
|||||||
SimpleChange,
|
SimpleChange,
|
||||||
SimpleChanges
|
SimpleChanges
|
||||||
} from "@angular/core";
|
} from "@angular/core";
|
||||||
import { forkJoin } from "rxjs";
|
|
||||||
import { Comparator } from "../service/interface";
|
import { Comparator } from "../service/interface";
|
||||||
import { TranslateService } from "@ngx-translate/core";
|
import { TranslateService } from "@ngx-translate/core";
|
||||||
|
import { map, catchError } from "rxjs/operators";
|
||||||
|
import { Observable, forkJoin, throwError as observableThrowError } from "rxjs";
|
||||||
import { ReplicationService } from "../service/replication.service";
|
import { ReplicationService } from "../service/replication.service";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -44,7 +44,7 @@ import {
|
|||||||
ConfirmationButtons
|
ConfirmationButtons
|
||||||
} from "../shared/shared.const";
|
} from "../shared/shared.const";
|
||||||
import { ErrorHandler } from "../error-handler/error-handler";
|
import { ErrorHandler } from "../error-handler/error-handler";
|
||||||
import { toPromise, CustomComparator } from "../utils";
|
import { CustomComparator } from "../utils";
|
||||||
import { operateChanges, OperateInfo, OperationState } from "../operation/operate";
|
import { operateChanges, OperateInfo, OperationState } from "../operation/operate";
|
||||||
import { OperationService } from "../operation/operation.service";
|
import { OperationService } from "../operation/operation.service";
|
||||||
|
|
||||||
@ -134,17 +134,14 @@ export class ListReplicationRuleComponent implements OnInit, OnChanges {
|
|||||||
retrieveRules(ruleName = ""): void {
|
retrieveRules(ruleName = ""): void {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
/*this.selectedRow = null;*/
|
/*this.selectedRow = null;*/
|
||||||
toPromise<ReplicationRule[]>(
|
|
||||||
this.replicationService.getReplicationRules(this.projectId, ruleName)
|
this.replicationService.getReplicationRules(this.projectId, ruleName)
|
||||||
)
|
.subscribe(rules => {
|
||||||
.then(rules => {
|
|
||||||
this.rules = rules || [];
|
this.rules = rules || [];
|
||||||
// job list hidden
|
// job list hidden
|
||||||
this.hideJobs.emit();
|
this.hideJobs.emit();
|
||||||
this.changedRules = this.rules;
|
this.changedRules = this.rules;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.errorHandler.error(error);
|
this.errorHandler.error(error);
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
@ -198,12 +195,13 @@ export class ListReplicationRuleComponent implements OnInit, OnChanges {
|
|||||||
this.editOne.emit(rule);
|
this.editOne.emit(rule);
|
||||||
}
|
}
|
||||||
|
|
||||||
jobList(id: string | number): Promise<void> {
|
jobList(id: string | number): Observable<void> {
|
||||||
let ruleData: ReplicationJobItem[];
|
let ruleData: ReplicationJobItem[];
|
||||||
this.canDeleteRule = true;
|
this.canDeleteRule = true;
|
||||||
let count = 0;
|
let count = 0;
|
||||||
return toPromise<ReplicationJob>(this.replicationService.getExecutions(id))
|
|
||||||
.then(response => {
|
return this.replicationService.getExecutions(id)
|
||||||
|
.pipe(map(response => {
|
||||||
ruleData = response.data;
|
ruleData = response.data;
|
||||||
if (ruleData.length) {
|
if (ruleData.length) {
|
||||||
ruleData.forEach(job => {
|
ruleData.forEach(job => {
|
||||||
@ -217,8 +215,7 @@ export class ListReplicationRuleComponent implements OnInit, OnChanges {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.canDeleteRule = count > 0 ? false : true;
|
this.canDeleteRule = count > 0 ? false : true;
|
||||||
})
|
}), catchError(error => observableThrowError(error)));
|
||||||
.catch(error => this.errorHandler.error(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteRule(rule: ReplicationRule) {
|
deleteRule(rule: ReplicationRule) {
|
||||||
@ -237,11 +234,11 @@ export class ListReplicationRuleComponent implements OnInit, OnChanges {
|
|||||||
|
|
||||||
deleteOpe(rule: ReplicationRule) {
|
deleteOpe(rule: ReplicationRule) {
|
||||||
if (rule) {
|
if (rule) {
|
||||||
let promiseLists: any[] = [];
|
let observableLists: any[] = [];
|
||||||
Promise.all([this.jobList(rule.id)]).then(items => {
|
this.jobList(rule.id).subscribe(items => {
|
||||||
promiseLists.push(this.delOperate(rule));
|
observableLists.push(this.delOperate(rule));
|
||||||
|
|
||||||
Promise.all(promiseLists).then(item => {
|
forkJoin(...observableLists).subscribe(item => {
|
||||||
this.selectedRow = null;
|
this.selectedRow = null;
|
||||||
this.reload.emit(true);
|
this.reload.emit(true);
|
||||||
let hnd = setInterval(() => this.ref.markForCheck(), 200);
|
let hnd = setInterval(() => this.ref.markForCheck(), 200);
|
||||||
@ -251,7 +248,7 @@ export class ListReplicationRuleComponent implements OnInit, OnChanges {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delOperate(rule: ReplicationRule) {
|
delOperate(rule: ReplicationRule): Observable<any> {
|
||||||
// init operation info
|
// init operation info
|
||||||
let operMessage = new OperateInfo();
|
let operMessage = new OperateInfo();
|
||||||
operMessage.name = 'OPERATION.DELETE_REPLICATION';
|
operMessage.name = 'OPERATION.DELETE_REPLICATION';
|
||||||
@ -261,30 +258,29 @@ export class ListReplicationRuleComponent implements OnInit, OnChanges {
|
|||||||
this.operationService.publishInfo(operMessage);
|
this.operationService.publishInfo(operMessage);
|
||||||
|
|
||||||
if (!this.canDeleteRule) {
|
if (!this.canDeleteRule) {
|
||||||
forkJoin(this.translateService.get('BATCH.DELETED_FAILURE'),
|
return forkJoin(this.translateService.get('BATCH.DELETED_FAILURE'),
|
||||||
this.translateService.get('REPLICATION.DELETION_SUMMARY_FAILURE')).subscribe(res => {
|
this.translateService.get('REPLICATION.DELETION_SUMMARY_FAILURE')).pipe(map(res => {
|
||||||
operateChanges(operMessage, OperationState.failure, res[1]);
|
operateChanges(operMessage, OperationState.failure, res[1]);
|
||||||
});
|
}));
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return toPromise<any>(this.replicationService
|
return this.replicationService
|
||||||
.deleteReplicationRule(+rule.id))
|
.deleteReplicationRule(+rule.id)
|
||||||
.then(() => {
|
.pipe(map(() => {
|
||||||
this.translateService.get('BATCH.DELETED_SUCCESS')
|
this.translateService.get('BATCH.DELETED_SUCCESS')
|
||||||
.subscribe(res => operateChanges(operMessage, OperationState.success));
|
.subscribe(res => operateChanges(operMessage, OperationState.success));
|
||||||
})
|
})
|
||||||
.catch(error => {
|
, catchError(error => {
|
||||||
if (error && error.status === 412) {
|
if (error && error.status === 412) {
|
||||||
forkJoin(this.translateService.get('BATCH.DELETED_FAILURE'),
|
return forkJoin(this.translateService.get('BATCH.DELETED_FAILURE'),
|
||||||
this.translateService.get('REPLICATION.FAILED_TO_DELETE_POLICY_ENABLED')).subscribe(res => {
|
this.translateService.get('REPLICATION.FAILED_TO_DELETE_POLICY_ENABLED')).pipe(map(res => {
|
||||||
operateChanges(operMessage, OperationState.failure, res[1]);
|
operateChanges(operMessage, OperationState.failure, res[1]);
|
||||||
});
|
}));
|
||||||
} else {
|
} else {
|
||||||
this.translateService.get('BATCH.DELETED_FAILURE').subscribe(res => {
|
return this.translateService.get('BATCH.DELETED_FAILURE').pipe(map(res => {
|
||||||
operateChanges(operMessage, OperationState.failure, res);
|
operateChanges(operMessage, OperationState.failure, res);
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,8 @@ import { SharedModule } from '../shared/shared.module';
|
|||||||
import { FilterComponent } from '../filter/filter.component';
|
import { FilterComponent } from '../filter/filter.component';
|
||||||
|
|
||||||
import { click } from '../utils';
|
import { click } from '../utils';
|
||||||
|
import { of } from 'rxjs';
|
||||||
|
import { startWith, delay } from 'rxjs/operators';
|
||||||
|
|
||||||
describe('RecentLogComponent (inline template)', () => {
|
describe('RecentLogComponent (inline template)', () => {
|
||||||
let component: RecentLogComponent;
|
let component: RecentLogComponent;
|
||||||
@ -74,23 +76,19 @@ describe('RecentLogComponent (inline template)', () => {
|
|||||||
spy = spyOn(logService, 'getRecentLogs')
|
spy = spyOn(logService, 'getRecentLogs')
|
||||||
.and.callFake(function (params: RequestQueryParams) {
|
.and.callFake(function (params: RequestQueryParams) {
|
||||||
if (params && params.get('username')) {
|
if (params && params.get('username')) {
|
||||||
return Promise.resolve(mockData2);
|
return of(mockData2).pipe(delay(0));
|
||||||
} else {
|
} else {
|
||||||
if (params.get('page') === '1') {
|
if (params.get('page') === '1') {
|
||||||
mockData.data = mockItems.slice(0, 15);
|
mockData.data = mockItems.slice(0, 15);
|
||||||
} else {
|
} else {
|
||||||
mockData.data = mockItems.slice(15, 18);
|
mockData.data = mockItems.slice(15, 18);
|
||||||
}
|
}
|
||||||
return Promise.resolve(mockData);
|
return of(mockData).pipe(delay(0));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
afterEach(() => {
|
|
||||||
mockItems = [];
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should be created', () => {
|
it('should be created', () => {
|
||||||
expect(component).toBeTruthy();
|
expect(component).toBeTruthy();
|
||||||
|
@ -21,7 +21,7 @@ import {
|
|||||||
RequestQueryParams
|
RequestQueryParams
|
||||||
} from '../service/index';
|
} from '../service/index';
|
||||||
import { ErrorHandler } from '../error-handler/index';
|
import { ErrorHandler } from '../error-handler/index';
|
||||||
import { toPromise, CustomComparator } from '../utils';
|
import { CustomComparator } from '../utils';
|
||||||
import {
|
import {
|
||||||
DEFAULT_PAGE_SIZE,
|
DEFAULT_PAGE_SIZE,
|
||||||
calculatePage,
|
calculatePage,
|
||||||
@ -127,8 +127,8 @@ export class RecentLogComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
toPromise<AccessLog>(this.logService.getRecentLogs(params))
|
this.logService.getRecentLogs(params)
|
||||||
.then(response => {
|
.subscribe(response => {
|
||||||
this.logsCache = response; // Keep the data
|
this.logsCache = response; // Keep the data
|
||||||
this.recentLogs = this.logsCache.data.filter(log => log.username !== ""); // To display
|
this.recentLogs = this.logsCache.data.filter(log => log.username !== ""); // To display
|
||||||
|
|
||||||
@ -141,8 +141,7 @@ export class RecentLogComponent implements OnInit {
|
|||||||
this.currentPagePvt = pageNumber;
|
this.currentPagePvt = pageNumber;
|
||||||
|
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.errorHandler.error(error);
|
this.errorHandler.error(error);
|
||||||
});
|
});
|
||||||
|
@ -121,8 +121,8 @@ describe('ProjectPolicyConfigComponent', () => {
|
|||||||
systemInfoService = fixture.debugElement.injector.get(SystemInfoService);
|
systemInfoService = fixture.debugElement.injector.get(SystemInfoService);
|
||||||
projectPolicyService = fixture.debugElement.injector.get(ProjectService);
|
projectPolicyService = fixture.debugElement.injector.get(ProjectService);
|
||||||
|
|
||||||
spySystemInfo = spyOn(systemInfoService, 'getSystemInfo').and.returnValues(Promise.resolve(mockSystemInfo[0]));
|
spySystemInfo = spyOn(systemInfoService, 'getSystemInfo').and.returnValues(of(mockSystemInfo[0]));
|
||||||
spyProjectPolicies = spyOn(projectPolicyService, 'getProject').and.returnValues(Promise.resolve(mockProjectPolicies[0]));
|
spyProjectPolicies = spyOn(projectPolicyService, 'getProject').and.returnValues(of(mockProjectPolicies[0]));
|
||||||
|
|
||||||
userPermissionService = fixture.debugElement.injector.get(UserPermissionService);
|
userPermissionService = fixture.debugElement.injector.get(UserPermissionService);
|
||||||
spyOn(userPermissionService, "getPermission")
|
spyOn(userPermissionService, "getPermission")
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { Component, Input, OnInit, ViewChild } from '@angular/core';
|
import { Component, Input, OnInit, ViewChild } from '@angular/core';
|
||||||
|
|
||||||
import { toPromise, compareValue, clone } from '../utils';
|
import { compareValue, clone } from '../utils';
|
||||||
import { ProjectService } from '../service/project.service';
|
import { ProjectService } from '../service/project.service';
|
||||||
import { ErrorHandler } from '../error-handler/error-handler';
|
import { ErrorHandler } from '../error-handler/error-handler';
|
||||||
import { State } from '../service/interface';
|
import { State } from '../service/interface';
|
||||||
@ -82,9 +82,9 @@ export class ProjectPolicyConfigComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get system info
|
// get system info
|
||||||
toPromise<SystemInfo>(this.systemInfoService.getSystemInfo())
|
this.systemInfoService.getSystemInfo()
|
||||||
.then(systemInfo => this.systemInfo = systemInfo)
|
.subscribe(systemInfo => this.systemInfo = systemInfo
|
||||||
.catch(error => this.errorHandler.error(error));
|
, error => this.errorHandler.error(error));
|
||||||
|
|
||||||
// retrive project level policy data
|
// retrive project level policy data
|
||||||
this.retrieve();
|
this.retrieve();
|
||||||
@ -105,13 +105,12 @@ export class ProjectPolicyConfigComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
retrieve(state?: State): any {
|
retrieve(state?: State): any {
|
||||||
toPromise<Project>(this.projectService.getProject(this.projectId))
|
this.projectService.getProject(this.projectId)
|
||||||
.then(
|
.subscribe(
|
||||||
response => {
|
response => {
|
||||||
this.orgProjectPolicy.initByProject(response);
|
this.orgProjectPolicy.initByProject(response);
|
||||||
this.projectPolicy.initByProject(response);
|
this.projectPolicy.initByProject(response);
|
||||||
})
|
}, error => this.errorHandler.error(error));
|
||||||
.catch(error => this.errorHandler.error(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateProjectPolicy(projectId: string|number, pp: ProjectPolicy) {
|
updateProjectPolicy(projectId: string|number, pp: ProjectPolicy) {
|
||||||
@ -139,16 +138,15 @@ export class ProjectPolicyConfigComponent implements OnInit {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.onGoing = true;
|
this.onGoing = true;
|
||||||
toPromise<any>(this.projectService.updateProjectPolicy(this.projectId, this.projectPolicy))
|
this.projectService.updateProjectPolicy(this.projectId, this.projectPolicy)
|
||||||
.then(() => {
|
.subscribe(() => {
|
||||||
this.onGoing = false;
|
this.onGoing = false;
|
||||||
|
|
||||||
this.translate.get('CONFIG.SAVE_SUCCESS').subscribe((res: string) => {
|
this.translate.get('CONFIG.SAVE_SUCCESS').subscribe((res: string) => {
|
||||||
this.errorHandler.info(res);
|
this.errorHandler.info(res);
|
||||||
});
|
});
|
||||||
this.refresh();
|
this.refresh();
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.onGoing = false;
|
this.onGoing = false;
|
||||||
this.errorHandler.error(error);
|
this.errorHandler.error(error);
|
||||||
});
|
});
|
||||||
|
@ -23,6 +23,8 @@ import {OperationService} from "../operation/operation.service";
|
|||||||
import {FilterLabelComponent} from "../create-edit-rule/filter-label.component";
|
import {FilterLabelComponent} from "../create-edit-rule/filter-label.component";
|
||||||
import {LabelPieceComponent} from "../label-piece/label-piece.component";
|
import {LabelPieceComponent} from "../label-piece/label-piece.component";
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
|
import { of } from 'rxjs';
|
||||||
|
|
||||||
|
|
||||||
describe('Replication Component (inline template)', () => {
|
describe('Replication Component (inline template)', () => {
|
||||||
|
|
||||||
@ -181,10 +183,11 @@ describe('Replication Component (inline template)', () => {
|
|||||||
|
|
||||||
endpointService = fixtureCreate.debugElement.injector.get(EndpointService);
|
endpointService = fixtureCreate.debugElement.injector.get(EndpointService);
|
||||||
|
|
||||||
spyRules = spyOn(replicationService, 'getReplicationRules').and.returnValues(Promise.resolve(mockRules));
|
spyRules = spyOn(replicationService, 'getReplicationRules').and.returnValues(of(mockRules));
|
||||||
spyJobs = spyOn(replicationService, 'getExecutions').and.returnValues(Promise.resolve(mockJob));
|
spyJobs = spyOn(replicationService, 'getExecutions').and.returnValues(of(mockJob));
|
||||||
|
|
||||||
spyEndpoint = spyOn(endpointService, 'getEndpoints').and.returnValues(Promise.resolve(mockEndpoints));
|
|
||||||
|
spyEndpoint = spyOn(endpointService, 'getEndpoints').and.returnValues(of(mockEndpoints));
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
fixture.whenStable().then(() => {
|
fixture.whenStable().then(() => {
|
||||||
|
@ -21,9 +21,8 @@ import {
|
|||||||
EventEmitter
|
EventEmitter
|
||||||
} from "@angular/core";
|
} from "@angular/core";
|
||||||
import { Comparator, State } from "../service/interface";
|
import { Comparator, State } from "../service/interface";
|
||||||
import { Subscription, forkJoin, timer, throwError} from "rxjs";
|
|
||||||
import { finalize, catchError, map } from "rxjs/operators";
|
import { finalize, catchError, map } from "rxjs/operators";
|
||||||
|
import { Subscription, forkJoin, timer, Observable, throwError } from "rxjs";
|
||||||
import { TranslateService } from "@ngx-translate/core";
|
import { TranslateService } from "@ngx-translate/core";
|
||||||
|
|
||||||
import { ListReplicationRuleComponent } from "../list-replication-rule/list-replication-rule.component";
|
import { ListReplicationRuleComponent } from "../list-replication-rule/list-replication-rule.component";
|
||||||
@ -39,7 +38,6 @@ import {
|
|||||||
} from "../service/interface";
|
} from "../service/interface";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
toPromise,
|
|
||||||
CustomComparator,
|
CustomComparator,
|
||||||
DEFAULT_PAGE_SIZE,
|
DEFAULT_PAGE_SIZE,
|
||||||
doFiltering,
|
doFiltering,
|
||||||
@ -55,9 +53,8 @@ import {
|
|||||||
import { ConfirmationMessage } from "../confirmation-dialog/confirmation-message";
|
import { ConfirmationMessage } from "../confirmation-dialog/confirmation-message";
|
||||||
import { ConfirmationDialogComponent } from "../confirmation-dialog/confirmation-dialog.component";
|
import { ConfirmationDialogComponent } from "../confirmation-dialog/confirmation-dialog.component";
|
||||||
import { ConfirmationAcknowledgement } from "../confirmation-dialog/confirmation-state-message";
|
import { ConfirmationAcknowledgement } from "../confirmation-dialog/confirmation-state-message";
|
||||||
import {operateChanges, OperationState, OperateInfo} from "../operation/operate";
|
import { operateChanges, OperationState, OperateInfo } from "../operation/operate";
|
||||||
import {OperationService} from "../operation/operation.service";
|
import { OperationService } from "../operation/operation.service";
|
||||||
|
|
||||||
import { Router } from "@angular/router";
|
import { Router } from "@angular/router";
|
||||||
|
|
||||||
const ruleStatus: { [key: string]: any } = [
|
const ruleStatus: { [key: string]: any } = [
|
||||||
@ -152,10 +149,10 @@ export class ReplicationComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
creationTimeComparator: Comparator<ReplicationJob> = new CustomComparator<
|
creationTimeComparator: Comparator<ReplicationJob> = new CustomComparator<
|
||||||
ReplicationJob
|
ReplicationJob
|
||||||
>("start_time", "date");
|
>("start_time", "date");
|
||||||
updateTimeComparator: Comparator<ReplicationJob> = new CustomComparator<
|
updateTimeComparator: Comparator<ReplicationJob> = new CustomComparator<
|
||||||
ReplicationJob
|
ReplicationJob
|
||||||
>("end_time", "date");
|
>("end_time", "date");
|
||||||
|
|
||||||
// Server driven pagination
|
// Server driven pagination
|
||||||
currentPage: number = 1;
|
currentPage: number = 1;
|
||||||
@ -170,7 +167,7 @@ export class ReplicationComponent implements OnInit, OnDestroy {
|
|||||||
private errorHandler: ErrorHandler,
|
private errorHandler: ErrorHandler,
|
||||||
private replicationService: ReplicationService,
|
private replicationService: ReplicationService,
|
||||||
private operationService: OperationService,
|
private operationService: OperationService,
|
||||||
private translateService: TranslateService) {}
|
private translateService: TranslateService) { }
|
||||||
|
|
||||||
public get showPaginationIndex(): boolean {
|
public get showPaginationIndex(): boolean {
|
||||||
return this.totalCount > 0;
|
return this.totalCount > 0;
|
||||||
@ -248,10 +245,9 @@ export class ReplicationComponent implements OnInit, OnDestroy {
|
|||||||
this.jobs = doSorting<ReplicationJobItem>(this.jobs, state);
|
this.jobs = doSorting<ReplicationJobItem>(this.jobs, state);
|
||||||
|
|
||||||
this.jobsLoading = false;
|
this.jobsLoading = false;
|
||||||
toPromise<ReplicationJob>(
|
|
||||||
this.replicationService.getExecutions(this.search.ruleId, params)
|
this.replicationService.getExecutions(this.search.ruleId, params)
|
||||||
)
|
.subscribe(response => {
|
||||||
.then(response => {
|
|
||||||
this.totalCount = response.metadata.xTotalCount;
|
this.totalCount = response.metadata.xTotalCount;
|
||||||
this.jobs = response.data;
|
this.jobs = response.data;
|
||||||
|
|
||||||
@ -281,8 +277,7 @@ export class ReplicationComponent implements OnInit, OnDestroy {
|
|||||||
this.jobs = doSorting<ReplicationJobItem>(this.jobs, state);
|
this.jobs = doSorting<ReplicationJobItem>(this.jobs, state);
|
||||||
|
|
||||||
this.jobsLoading = false;
|
this.jobsLoading = false;
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.jobsLoading = false;
|
this.jobsLoading = false;
|
||||||
this.errorHandler.error(error);
|
this.errorHandler.error(error);
|
||||||
});
|
});
|
||||||
@ -337,14 +332,14 @@ export class ReplicationComponent implements OnInit, OnDestroy {
|
|||||||
let rule: ReplicationRule = message.data;
|
let rule: ReplicationRule = message.data;
|
||||||
|
|
||||||
if (rule) {
|
if (rule) {
|
||||||
Promise.all([this.replicationOperate(rule)]).then((item) => {
|
forkJoin(this.replicationOperate(rule)).subscribe((item) => {
|
||||||
this.selectOneRule(rule);
|
this.selectOneRule(rule);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
replicationOperate(rule: ReplicationRule) {
|
replicationOperate(rule: ReplicationRule): Observable<any> {
|
||||||
// init operation info
|
// init operation info
|
||||||
let operMessage = new OperateInfo();
|
let operMessage = new OperateInfo();
|
||||||
operMessage.name = 'OPERATION.REPLICATION';
|
operMessage.name = 'OPERATION.REPLICATION';
|
||||||
@ -353,24 +348,24 @@ export class ReplicationComponent implements OnInit, OnDestroy {
|
|||||||
operMessage.data.name = rule.name;
|
operMessage.data.name = rule.name;
|
||||||
this.operationService.publishInfo(operMessage);
|
this.operationService.publishInfo(operMessage);
|
||||||
|
|
||||||
return toPromise<any>(this.replicationService.replicateRule(+rule.id))
|
return this.replicationService.replicateRule(+rule.id)
|
||||||
.then(response => {
|
.pipe(map(response => {
|
||||||
this.translateService.get('BATCH.REPLICATE_SUCCESS')
|
this.translateService.get('BATCH.REPLICATE_SUCCESS')
|
||||||
.subscribe(res => operateChanges(operMessage, OperationState.success));
|
.subscribe(res => operateChanges(operMessage, OperationState.success));
|
||||||
})
|
})
|
||||||
.catch(error => {
|
, catchError(error => {
|
||||||
if (error && error.status === 412) {
|
if (error && error.status === 412) {
|
||||||
forkJoin(this.translateService.get('BATCH.REPLICATE_FAILURE'),
|
return forkJoin(this.translateService.get('BATCH.REPLICATE_FAILURE'),
|
||||||
this.translateService.get('REPLICATION.REPLICATE_SUMMARY_FAILURE'))
|
this.translateService.get('REPLICATION.REPLICATE_SUMMARY_FAILURE'))
|
||||||
.subscribe(function (res) {
|
.pipe(map(function (res) {
|
||||||
operateChanges(operMessage, OperationState.failure, res[1]);
|
operateChanges(operMessage, OperationState.failure, res[1]);
|
||||||
});
|
}));
|
||||||
} else {
|
} else {
|
||||||
this.translateService.get('BATCH.REPLICATE_FAILURE').subscribe(res => {
|
return this.translateService.get('BATCH.REPLICATE_FAILURE').pipe(map(res => {
|
||||||
operateChanges(operMessage, OperationState.failure, res);
|
operateChanges(operMessage, OperationState.failure, res);
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
customRedirect(rule: ReplicationRule) {
|
customRedirect(rule: ReplicationRule) {
|
||||||
@ -435,7 +430,7 @@ export class ReplicationComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.isStopOnGoing = true;
|
this.isStopOnGoing = true;
|
||||||
if (this.jobs && this.jobs.length) {
|
if (this.jobs && this.jobs.length) {
|
||||||
let ExecutionsStop$ = targets.map(target => this.StopOperate(target));
|
let ExecutionsStop$ = targets.map(target => this.StopOperate(target));
|
||||||
forkJoin(ExecutionsStop$)
|
forkJoin(ExecutionsStop$)
|
||||||
.pipe(
|
.pipe(
|
||||||
|
@ -155,13 +155,13 @@ describe('RepositoryComponentGridview (inline template)', () => {
|
|||||||
repositoryService = fixtureRepo.debugElement.injector.get(RepositoryService);
|
repositoryService = fixtureRepo.debugElement.injector.get(RepositoryService);
|
||||||
systemInfoService = fixtureRepo.debugElement.injector.get(SystemInfoService);
|
systemInfoService = fixtureRepo.debugElement.injector.get(SystemInfoService);
|
||||||
|
|
||||||
spySystemInfo = spyOn(systemInfoService, 'getSystemInfo').and.returnValues(Promise.resolve(mockSystemInfo));
|
spySystemInfo = spyOn(systemInfoService, 'getSystemInfo').and.returnValues(of(mockSystemInfo));
|
||||||
spyRepos = spyOn(repositoryService, 'getRepositories')
|
spyRepos = spyOn(repositoryService, 'getRepositories')
|
||||||
.and.callFake(function (projectId: number, name: string) {
|
.and.callFake(function (projectId: number, name: string) {
|
||||||
if (name === 'nginx') {
|
if (name === 'nginx') {
|
||||||
return Promise.resolve(mockNginxRepo);
|
return of(mockNginxRepo);
|
||||||
}
|
}
|
||||||
return Promise.resolve(mockRepo);
|
return of(mockRepo);
|
||||||
});
|
});
|
||||||
userPermissionService = fixtureRepo.debugElement.injector.get(UserPermissionService);
|
userPermissionService = fixtureRepo.debugElement.injector.get(UserPermissionService);
|
||||||
spyOn(userPermissionService, "getPermission")
|
spyOn(userPermissionService, "getPermission")
|
||||||
|
@ -27,7 +27,7 @@ import {
|
|||||||
TagService
|
TagService
|
||||||
} from '../service/index';
|
} from '../service/index';
|
||||||
import { ErrorHandler } from '../error-handler/error-handler';
|
import { ErrorHandler } from '../error-handler/error-handler';
|
||||||
import { toPromise, CustomComparator, DEFAULT_PAGE_SIZE, calculatePage, doFiltering, doSorting, clone } from '../utils';
|
import { CustomComparator, DEFAULT_PAGE_SIZE, calculatePage, doFiltering, doSorting, clone } from '../utils';
|
||||||
import { ConfirmationState, ConfirmationTargets, ConfirmationButtons } from '../shared/shared.const';
|
import { ConfirmationState, ConfirmationTargets, ConfirmationButtons } from '../shared/shared.const';
|
||||||
import { ConfirmationDialogComponent } from '../confirmation-dialog/confirmation-dialog.component';
|
import { ConfirmationDialogComponent } from '../confirmation-dialog/confirmation-dialog.component';
|
||||||
import { ConfirmationMessage } from '../confirmation-dialog/confirmation-message';
|
import { ConfirmationMessage } from '../confirmation-dialog/confirmation-message';
|
||||||
@ -39,6 +39,8 @@ import { UserPermissionService } from "../service/permission.service";
|
|||||||
import { USERSTATICPERMISSION } from "../service/permission-static";
|
import { USERSTATICPERMISSION } from "../service/permission-static";
|
||||||
import { OperateInfo, OperationState, operateChanges } from "../operation/operate";
|
import { OperateInfo, OperationState, operateChanges } from "../operation/operate";
|
||||||
import { SERVICE_CONFIG, IServiceConfig } from '../service.config';
|
import { SERVICE_CONFIG, IServiceConfig } from '../service.config';
|
||||||
|
import { map, catchError } from "rxjs/operators";
|
||||||
|
import { Observable, throwError as observableThrowError } from "rxjs";
|
||||||
@Component({
|
@Component({
|
||||||
selector: "hbr-repository-gridview",
|
selector: "hbr-repository-gridview",
|
||||||
templateUrl: "./repository-gridview.component.html",
|
templateUrl: "./repository-gridview.component.html",
|
||||||
@ -134,9 +136,9 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit {
|
|||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
// Get system info for tag views
|
// Get system info for tag views
|
||||||
toPromise<SystemInfo>(this.systemInfoService.getSystemInfo())
|
this.systemInfoService.getSystemInfo()
|
||||||
.then(systemInfo => (this.systemInfo = systemInfo))
|
.subscribe(systemInfo => (this.systemInfo = systemInfo)
|
||||||
.catch(error => this.errorHandler.error(error));
|
, error => this.errorHandler.error(error));
|
||||||
|
|
||||||
if (this.mode === "admiral") {
|
if (this.mode === "admiral") {
|
||||||
this.isCardView = true;
|
this.isCardView = true;
|
||||||
@ -155,12 +157,12 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit {
|
|||||||
|
|
||||||
let repoLists = message.data;
|
let repoLists = message.data;
|
||||||
if (repoLists && repoLists.length) {
|
if (repoLists && repoLists.length) {
|
||||||
let promiseLists: any[] = [];
|
let observableLists: any[] = [];
|
||||||
repoLists.forEach(repo => {
|
repoLists.forEach(repo => {
|
||||||
promiseLists.push(this.delOperate(repo));
|
observableLists.push(this.delOperate(repo));
|
||||||
});
|
});
|
||||||
|
|
||||||
Promise.all(promiseLists).then((item) => {
|
forkJoin(observableLists).subscribe((item) => {
|
||||||
this.selectedRow = [];
|
this.selectedRow = [];
|
||||||
this.refresh();
|
this.refresh();
|
||||||
let st: State = this.getStateAfterDeletion();
|
let st: State = this.getStateAfterDeletion();
|
||||||
@ -174,7 +176,7 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delOperate(repo: RepositoryItem) {
|
delOperate(repo: RepositoryItem): Observable<any> {
|
||||||
// init operation info
|
// init operation info
|
||||||
let operMessage = new OperateInfo();
|
let operMessage = new OperateInfo();
|
||||||
operMessage.name = 'OPERATION.DELETE_REPO';
|
operMessage.name = 'OPERATION.DELETE_REPO';
|
||||||
@ -184,37 +186,35 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit {
|
|||||||
this.operationService.publishInfo(operMessage);
|
this.operationService.publishInfo(operMessage);
|
||||||
|
|
||||||
if (this.signedCon[repo.name].length !== 0) {
|
if (this.signedCon[repo.name].length !== 0) {
|
||||||
forkJoin(this.translateService.get('BATCH.DELETED_FAILURE'),
|
return forkJoin(this.translateService.get('BATCH.DELETED_FAILURE'),
|
||||||
this.translateService.get('REPOSITORY.DELETION_TITLE_REPO_SIGNED')).subscribe(res => {
|
this.translateService.get('REPOSITORY.DELETION_TITLE_REPO_SIGNED')).pipe(map(res => {
|
||||||
operateChanges(operMessage, OperationState.failure, res[1]);
|
operateChanges(operMessage, OperationState.failure, res[1]);
|
||||||
});
|
}));
|
||||||
} else {
|
} else {
|
||||||
return toPromise<number>(this.repositoryService
|
return this.repositoryService
|
||||||
.deleteRepository(repo.name))
|
.deleteRepository(repo.name)
|
||||||
.then(
|
.pipe(map(
|
||||||
response => {
|
response => {
|
||||||
this.translateService.get('BATCH.DELETED_SUCCESS').subscribe(res => {
|
this.translateService.get('BATCH.DELETED_SUCCESS').subscribe(res => {
|
||||||
operateChanges(operMessage, OperationState.success);
|
operateChanges(operMessage, OperationState.success);
|
||||||
});
|
});
|
||||||
}).catch(error => {
|
}), catchError(error => {
|
||||||
if (error.status === "412") {
|
if (error.status === "412") {
|
||||||
forkJoin(this.translateService.get('BATCH.DELETED_FAILURE'),
|
return forkJoin(this.translateService.get('BATCH.DELETED_FAILURE'),
|
||||||
this.translateService.get('REPOSITORY.TAGS_SIGNED')).subscribe(res => {
|
this.translateService.get('REPOSITORY.TAGS_SIGNED')).pipe(map(res => {
|
||||||
operateChanges(operMessage, OperationState.failure, res[1]);
|
operateChanges(operMessage, OperationState.failure, res[1]);
|
||||||
});
|
}));
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
if (error.status === 503) {
|
if (error.status === 503) {
|
||||||
forkJoin(this.translateService.get('BATCH.DELETED_FAILURE'),
|
return forkJoin(this.translateService.get('BATCH.DELETED_FAILURE'),
|
||||||
this.translateService.get('REPOSITORY.TAGS_NO_DELETE')).subscribe(res => {
|
this.translateService.get('REPOSITORY.TAGS_NO_DELETE')).pipe(map(res => {
|
||||||
operateChanges(operMessage, OperationState.failure, res[1]);
|
operateChanges(operMessage, OperationState.failure, res[1]);
|
||||||
});
|
}));
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
this.translateService.get('BATCH.DELETED_FAILURE').subscribe(res => {
|
return this.translateService.get('BATCH.DELETED_FAILURE').pipe(map(res => {
|
||||||
operateChanges(operMessage, OperationState.failure, res);
|
operateChanges(operMessage, OperationState.failure, res);
|
||||||
});
|
}));
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,7 +248,7 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Promise.all(repArr).then(() => {
|
forkJoin(...repArr).subscribe(() => {
|
||||||
this.confirmationDialogSet(
|
this.confirmationDialogSet(
|
||||||
'REPOSITORY.DELETION_TITLE_REPO',
|
'REPOSITORY.DELETION_TITLE_REPO',
|
||||||
'',
|
'',
|
||||||
@ -256,21 +256,21 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit {
|
|||||||
repoLists,
|
repoLists,
|
||||||
'REPOSITORY.DELETION_SUMMARY_REPO',
|
'REPOSITORY.DELETION_SUMMARY_REPO',
|
||||||
ConfirmationButtons.DELETE_CANCEL);
|
ConfirmationButtons.DELETE_CANCEL);
|
||||||
});
|
}, error => this.errorHandler.error(error));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getTagInfo(repoName: string): Promise<void> {
|
getTagInfo(repoName: string): Observable<void> {
|
||||||
this.signedCon[repoName] = [];
|
this.signedCon[repoName] = [];
|
||||||
return toPromise<Tag[]>(this.tagService.getTags(repoName))
|
return this.tagService.getTags(repoName)
|
||||||
.then(items => {
|
.pipe(map(items => {
|
||||||
items.forEach((t: Tag) => {
|
items.forEach((t: Tag) => {
|
||||||
if (t.signature !== null) {
|
if (t.signature !== null) {
|
||||||
this.signedCon[repoName].push(t.name);
|
this.signedCon[repoName].push(t.name);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(error => this.errorHandler.error(error));
|
, catchError(error => observableThrowError(error)));
|
||||||
}
|
}
|
||||||
|
|
||||||
confirmationDialogSet(summaryTitle: string, signature: string,
|
confirmationDialogSet(summaryTitle: string, signature: string,
|
||||||
@ -299,9 +299,9 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
containsLatestTag(repo: RepositoryItem): Promise<boolean> {
|
containsLatestTag(repo: RepositoryItem): Observable<boolean> {
|
||||||
return toPromise<Tag[]>(this.tagService.getTags(repo.name))
|
return this.tagService.getTags(repo.name)
|
||||||
.then(items => {
|
.pipe(map(items => {
|
||||||
if (items.some((t: Tag) => {
|
if (items.some((t: Tag) => {
|
||||||
return t.name === 'latest';
|
return t.name === 'latest';
|
||||||
})) {
|
})) {
|
||||||
@ -311,7 +311,7 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
.catch(error => Promise.reject(false));
|
, catchError(error => observableThrowError(false)));
|
||||||
}
|
}
|
||||||
|
|
||||||
provisionItemEvent(evt: any, repo: RepositoryItem): void {
|
provisionItemEvent(evt: any, repo: RepositoryItem): void {
|
||||||
@ -319,14 +319,13 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit {
|
|||||||
let repoCopy = clone(repo);
|
let repoCopy = clone(repo);
|
||||||
repoCopy.name = this.registryUrl + ":443/" + repoCopy.name;
|
repoCopy.name = this.registryUrl + ":443/" + repoCopy.name;
|
||||||
this.containsLatestTag(repo)
|
this.containsLatestTag(repo)
|
||||||
.then(containsLatest => {
|
.subscribe(containsLatest => {
|
||||||
if (containsLatest) {
|
if (containsLatest) {
|
||||||
this.repoProvisionEvent.emit(repoCopy);
|
this.repoProvisionEvent.emit(repoCopy);
|
||||||
} else {
|
} else {
|
||||||
this.addInfoEvent.emit(repoCopy);
|
this.addInfoEvent.emit(repoCopy);
|
||||||
}
|
}
|
||||||
})
|
}, error => this.errorHandler.error(error));
|
||||||
.catch(error => this.errorHandler.error(error));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -359,14 +358,12 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit {
|
|||||||
params.set("page_size", "" + this.pageSize);
|
params.set("page_size", "" + this.pageSize);
|
||||||
|
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
toPromise<Repository>(
|
|
||||||
this.repositoryService.getRepositories(
|
this.repositoryService.getRepositories(
|
||||||
this.projectId,
|
this.projectId,
|
||||||
this.lastFilteredRepoName,
|
this.lastFilteredRepoName,
|
||||||
params
|
params
|
||||||
)
|
)
|
||||||
)
|
.subscribe((repo: Repository) => {
|
||||||
.then((repo: Repository) => {
|
|
||||||
this.totalCount = repo.metadata.xTotalCount;
|
this.totalCount = repo.metadata.xTotalCount;
|
||||||
this.repositoriesCopy = repo.data;
|
this.repositoriesCopy = repo.data;
|
||||||
this.signedCon = {};
|
this.signedCon = {};
|
||||||
@ -381,8 +378,7 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit {
|
|||||||
);
|
);
|
||||||
this.repositories = this.repositories.concat(this.repositoriesCopy);
|
this.repositories = this.repositories.concat(this.repositoriesCopy);
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.errorHandler.error(error);
|
this.errorHandler.error(error);
|
||||||
});
|
});
|
||||||
@ -410,14 +406,12 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit {
|
|||||||
|
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
|
||||||
toPromise<Repository>(
|
|
||||||
this.repositoryService.getRepositories(
|
this.repositoryService.getRepositories(
|
||||||
this.projectId,
|
this.projectId,
|
||||||
this.lastFilteredRepoName,
|
this.lastFilteredRepoName,
|
||||||
params
|
params
|
||||||
)
|
)
|
||||||
)
|
.subscribe((repo: Repository) => {
|
||||||
.then((repo: Repository) => {
|
|
||||||
|
|
||||||
this.totalCount = repo.metadata.xTotalCount;
|
this.totalCount = repo.metadata.xTotalCount;
|
||||||
this.repositories = repo.data;
|
this.repositories = repo.data;
|
||||||
@ -430,8 +424,7 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit {
|
|||||||
);
|
);
|
||||||
this.repositories = doSorting<RepositoryItem>(this.repositories, state);
|
this.repositories = doSorting<RepositoryItem>(this.repositories, state);
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.errorHandler.error(error);
|
this.errorHandler.error(error);
|
||||||
});
|
});
|
||||||
|
@ -29,6 +29,7 @@ import { ProjectDefaultService, ProjectService, RetagDefaultService, RetagServic
|
|||||||
import { UserPermissionDefaultService, UserPermissionService } from "../service/permission.service";
|
import { UserPermissionDefaultService, UserPermissionService } from "../service/permission.service";
|
||||||
import { USERSTATICPERMISSION } from "../service/permission-static";
|
import { USERSTATICPERMISSION } from "../service/permission-static";
|
||||||
import { of } from "rxjs";
|
import { of } from "rxjs";
|
||||||
|
import { delay } from 'rxjs/operators';
|
||||||
|
|
||||||
|
|
||||||
class RouterStub {
|
class RouterStub {
|
||||||
@ -204,12 +205,12 @@ describe('RepositoryComponent (inline template)', () => {
|
|||||||
userPermissionService = fixture.debugElement.injector.get(UserPermissionService);
|
userPermissionService = fixture.debugElement.injector.get(UserPermissionService);
|
||||||
labelService = fixture.debugElement.injector.get(LabelService);
|
labelService = fixture.debugElement.injector.get(LabelService);
|
||||||
|
|
||||||
spyRepos = spyOn(repositoryService, 'getRepositories').and.returnValues(Promise.resolve(mockRepo));
|
spyRepos = spyOn(repositoryService, 'getRepositories').and.returnValues(of(mockRepo).pipe(delay(0)));
|
||||||
spySystemInfo = spyOn(systemInfoService, 'getSystemInfo').and.returnValues(Promise.resolve(mockSystemInfo));
|
spySystemInfo = spyOn(systemInfoService, 'getSystemInfo').and.returnValues(of(mockSystemInfo).pipe(delay(0)));
|
||||||
spyTags = spyOn(tagService, 'getTags').and.returnValues(Promise.resolve(mockTagData));
|
spyTags = spyOn(tagService, 'getTags').and.returnValues(of(mockTagData).pipe(delay(0)));
|
||||||
|
|
||||||
spyLabels = spyOn(labelService, 'getGLabels').and.returnValues(Promise.resolve(mockLabels));
|
spyLabels = spyOn(labelService, 'getGLabels').and.returnValues(of(mockLabels).pipe(delay(0)));
|
||||||
spyLabels1 = spyOn(labelService, 'getPLabels').and.returnValues(Promise.resolve(mockLabels1));
|
spyLabels1 = spyOn(labelService, 'getPLabels').and.returnValues(of(mockLabels1).pipe(delay(0)));
|
||||||
spyOn(userPermissionService, "getPermission")
|
spyOn(userPermissionService, "getPermission")
|
||||||
.withArgs(compRepo.projectId, USERSTATICPERMISSION.REPOSITORY_TAG_LABEL.KEY, USERSTATICPERMISSION.REPOSITORY_TAG_LABEL.VALUE.CREATE )
|
.withArgs(compRepo.projectId, USERSTATICPERMISSION.REPOSITORY_TAG_LABEL.KEY, USERSTATICPERMISSION.REPOSITORY_TAG_LABEL.VALUE.CREATE )
|
||||||
.and.returnValue(of(mockHasAddLabelImagePermission))
|
.and.returnValue(of(mockHasAddLabelImagePermission))
|
||||||
|
@ -21,8 +21,8 @@ import { Repository, RepositoryItem, Tag, TagClickEvent,
|
|||||||
import { ErrorHandler } from '../error-handler/index';
|
import { ErrorHandler } from '../error-handler/index';
|
||||||
import { ConfirmationState, ConfirmationTargets } from '../shared/shared.const';
|
import { ConfirmationState, ConfirmationTargets } from '../shared/shared.const';
|
||||||
import { ConfirmationDialogComponent, ConfirmationMessage, ConfirmationAcknowledgement } from '../confirmation-dialog/index';
|
import { ConfirmationDialogComponent, ConfirmationMessage, ConfirmationAcknowledgement } from '../confirmation-dialog/index';
|
||||||
import { toPromise } from '../utils';
|
import { map, catchError } from "rxjs/operators";
|
||||||
|
import { Observable, throwError as observableThrowError } from "rxjs";
|
||||||
const TabLinkContentMap: {[index: string]: string} = {
|
const TabLinkContentMap: {[index: string]: string} = {
|
||||||
'repo-info': 'info',
|
'repo-info': 'info',
|
||||||
'repo-image': 'image'
|
'repo-image': 'image'
|
||||||
@ -93,17 +93,15 @@ export class RepositoryComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
retrieve(state?: State) {
|
retrieve(state?: State) {
|
||||||
toPromise<Repository>(this.repositoryService.getRepositories(this.projectId, this.repoName))
|
this.repositoryService.getRepositories(this.projectId, this.repoName)
|
||||||
.then( response => {
|
.subscribe( response => {
|
||||||
if (response.metadata.xTotalCount > 0) {
|
if (response.metadata.xTotalCount > 0) {
|
||||||
this.orgImageInfo = response.data[0].description;
|
this.orgImageInfo = response.data[0].description;
|
||||||
this.imageInfo = response.data[0].description;
|
this.imageInfo = response.data[0].description;
|
||||||
}
|
}
|
||||||
})
|
}, error => this.errorHandler.error(error));
|
||||||
.catch(error => this.errorHandler.error(error));
|
this.systemInfoService.getSystemInfo()
|
||||||
toPromise<SystemInfo>(this.systemInfoService.getSystemInfo())
|
.subscribe(systemInfo => this.systemInfo = systemInfo, error => this.errorHandler.error(error));
|
||||||
.then(systemInfo => this.systemInfo = systemInfo)
|
|
||||||
.catch(error => this.errorHandler.error(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
saveSignatures(event: {[key: string]: string[]}): void {
|
saveSignatures(event: {[key: string]: string[]}): void {
|
||||||
@ -130,19 +128,19 @@ export class RepositoryComponent implements OnInit {
|
|||||||
this.currentTabID = tabID;
|
this.currentTabID = tabID;
|
||||||
}
|
}
|
||||||
|
|
||||||
getTagInfo(repoName: string): Promise<void> {
|
getTagInfo(repoName: string): Observable<void> {
|
||||||
// this.signedNameArr = [];
|
// this.signedNameArr = [];
|
||||||
this.signedCon[repoName] = [];
|
this.signedCon[repoName] = [];
|
||||||
return toPromise<Tag[]>(this.tagService
|
return this.tagService
|
||||||
.getTags(repoName))
|
.getTags(repoName)
|
||||||
.then(items => {
|
.pipe(map(items => {
|
||||||
items.forEach((t: Tag) => {
|
items.forEach((t: Tag) => {
|
||||||
if (t.signature !== null) {
|
if (t.signature !== null) {
|
||||||
this.signedCon[repoName].push(t.name);
|
this.signedCon[repoName].push(t.name);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(error => this.errorHandler.error(error));
|
, catchError(error => observableThrowError(error)));
|
||||||
}
|
}
|
||||||
|
|
||||||
goBack(): void {
|
goBack(): void {
|
||||||
@ -170,16 +168,15 @@ export class RepositoryComponent implements OnInit {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.onGoing = true;
|
this.onGoing = true;
|
||||||
toPromise<any>(this.repositoryService.updateRepositoryDescription(this.repoName, this.imageInfo))
|
this.repositoryService.updateRepositoryDescription(this.repoName, this.imageInfo)
|
||||||
.then(() => {
|
.subscribe(() => {
|
||||||
this.onGoing = false;
|
this.onGoing = false;
|
||||||
this.translate.get('CONFIG.SAVE_SUCCESS').subscribe((res: string) => {
|
this.translate.get('CONFIG.SAVE_SUCCESS').subscribe((res: string) => {
|
||||||
this.errorHandler.info(res);
|
this.errorHandler.info(res);
|
||||||
});
|
});
|
||||||
this.editing = false;
|
this.editing = false;
|
||||||
this.refresh();
|
this.refresh();
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.onGoing = false;
|
this.onGoing = false;
|
||||||
this.errorHandler.error(error);
|
this.errorHandler.error(error);
|
||||||
});
|
});
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import { Observable, of } from "rxjs";
|
import { Observable, of, throwError as observableThrowError } from "rxjs";
|
||||||
import { RequestQueryParams } from "./RequestQueryParams";
|
import { RequestQueryParams } from "./RequestQueryParams";
|
||||||
import { AccessLog, AccessLogItem } from "./interface";
|
import { AccessLog, AccessLogItem } from "./interface";
|
||||||
import { Injectable, Inject } from "@angular/core";
|
import { Injectable, Inject } from "@angular/core";
|
||||||
import { SERVICE_CONFIG, IServiceConfig } from "../service.config";
|
import { SERVICE_CONFIG, IServiceConfig } from "../service.config";
|
||||||
import { Http } from "@angular/http";
|
import { Http } from "@angular/http";
|
||||||
import { buildHttpRequestOptions, HTTP_GET_OPTIONS } from "../utils";
|
import { buildHttpRequestOptions, HTTP_GET_OPTIONS } from "../utils";
|
||||||
|
import { map, catchError } from "rxjs/operators";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define service methods to handle the access log related things.
|
* Define service methods to handle the access log related things.
|
||||||
@ -23,27 +24,27 @@ export abstract class AccessLogService {
|
|||||||
* @abstract
|
* @abstract
|
||||||
* ** deprecated param {(number | string)} projectId
|
* ** deprecated param {(number | string)} projectId
|
||||||
* ** deprecated param {RequestQueryParams} [queryParams]
|
* ** deprecated param {RequestQueryParams} [queryParams]
|
||||||
* returns {(Observable<AccessLog> | Promise<AccessLog> | AccessLog)}
|
* returns {(Observable<AccessLog> | AccessLog)}
|
||||||
*
|
*
|
||||||
* @memberOf AccessLogService
|
* @memberOf AccessLogService
|
||||||
*/
|
*/
|
||||||
abstract getAuditLogs(
|
abstract getAuditLogs(
|
||||||
projectId: number | string,
|
projectId: number | string,
|
||||||
queryParams?: RequestQueryParams
|
queryParams?: RequestQueryParams
|
||||||
): Observable<AccessLog> | Promise<AccessLog> | AccessLog;
|
): Observable<AccessLog>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the recent logs.
|
* Get the recent logs.
|
||||||
*
|
*
|
||||||
* @abstract
|
* @abstract
|
||||||
* ** deprecated param {RequestQueryParams} [queryParams]
|
* ** deprecated param {RequestQueryParams} [queryParams]
|
||||||
* returns {(Observable<AccessLog> | Promise<AccessLog> | AccessLog)}
|
* returns {(Observable<AccessLog> | AccessLog)}
|
||||||
*
|
*
|
||||||
* @memberOf AccessLogService
|
* @memberOf AccessLogService
|
||||||
*/
|
*/
|
||||||
abstract getRecentLogs(
|
abstract getRecentLogs(
|
||||||
queryParams?: RequestQueryParams
|
queryParams?: RequestQueryParams
|
||||||
): Observable<AccessLog> | Promise<AccessLog> | AccessLog;
|
): Observable<AccessLog>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -65,13 +66,13 @@ export class AccessLogDefaultService extends AccessLogService {
|
|||||||
public getAuditLogs(
|
public getAuditLogs(
|
||||||
projectId: number | string,
|
projectId: number | string,
|
||||||
queryParams?: RequestQueryParams
|
queryParams?: RequestQueryParams
|
||||||
): Observable<AccessLog> | Promise<AccessLog> | AccessLog {
|
): Observable<AccessLog> {
|
||||||
return of({} as AccessLog);
|
return of({} as AccessLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getRecentLogs(
|
public getRecentLogs(
|
||||||
queryParams?: RequestQueryParams
|
queryParams?: RequestQueryParams
|
||||||
): Observable<AccessLog> | Promise<AccessLog> | AccessLog {
|
): Observable<AccessLog> {
|
||||||
let url: string = this.config.logBaseEndpoint
|
let url: string = this.config.logBaseEndpoint
|
||||||
? this.config.logBaseEndpoint
|
? this.config.logBaseEndpoint
|
||||||
: "";
|
: "";
|
||||||
@ -84,8 +85,7 @@ export class AccessLogDefaultService extends AccessLogService {
|
|||||||
url,
|
url,
|
||||||
queryParams ? buildHttpRequestOptions(queryParams) : HTTP_GET_OPTIONS
|
queryParams ? buildHttpRequestOptions(queryParams) : HTTP_GET_OPTIONS
|
||||||
)
|
)
|
||||||
.toPromise()
|
.pipe(map(response => {
|
||||||
.then(response => {
|
|
||||||
let result: AccessLog = {
|
let result: AccessLog = {
|
||||||
metadata: {
|
metadata: {
|
||||||
xTotalCount: 0
|
xTotalCount: 0
|
||||||
@ -106,6 +106,6 @@ export class AccessLogDefaultService extends AccessLogService {
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
})
|
})
|
||||||
.catch(error => Promise.reject(error));
|
, catchError(error => observableThrowError(error)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { Injectable, Inject } from "@angular/core";
|
import { Injectable, Inject } from "@angular/core";
|
||||||
import { Http } from "@angular/http";
|
import { Http } from "@angular/http";
|
||||||
import { Observable } from "rxjs";
|
import { map, catchError } from "rxjs/operators";
|
||||||
|
import { Observable, throwError as observableThrowError } from "rxjs";
|
||||||
|
|
||||||
import { SERVICE_CONFIG, IServiceConfig } from "../service.config";
|
import { SERVICE_CONFIG, IServiceConfig } from "../service.config";
|
||||||
import { HTTP_JSON_OPTIONS, HTTP_GET_OPTIONS } from "../utils";
|
import { HTTP_JSON_OPTIONS, HTTP_GET_OPTIONS } from "../utils";
|
||||||
@ -18,26 +19,24 @@ export abstract class ConfigurationService {
|
|||||||
* Get configurations.
|
* Get configurations.
|
||||||
*
|
*
|
||||||
* @abstract
|
* @abstract
|
||||||
* returns {(Observable<Configuration> | Promise<Configuration> | Configuration)}
|
* returns {(Observable<Configuration>)}
|
||||||
*
|
*
|
||||||
* @memberOf ConfigurationService
|
* @memberOf ConfigurationService
|
||||||
*/
|
*/
|
||||||
abstract getConfigurations():
|
abstract getConfigurations():
|
||||||
| Observable<Configuration>
|
| Observable<Configuration>;
|
||||||
| Promise<Configuration>
|
|
||||||
| Configuration;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save configurations.
|
* Save configurations.
|
||||||
*
|
*
|
||||||
* @abstract
|
* @abstract
|
||||||
* returns {(Observable<Configuration> | Promise<Configuration> | Configuration)}
|
* returns {(Observable<Configuration>)}
|
||||||
*
|
*
|
||||||
* @memberOf ConfigurationService
|
* @memberOf ConfigurationService
|
||||||
*/
|
*/
|
||||||
abstract saveConfigurations(
|
abstract saveConfigurations(
|
||||||
changedConfigs: any | { [key: string]: any | any[] }
|
changedConfigs: any | { [key: string]: any | any[] }
|
||||||
): Observable<any> | Promise<any> | any;
|
): Observable<any>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@ -57,27 +56,23 @@ export class ConfigurationDefaultService extends ConfigurationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getConfigurations():
|
getConfigurations():
|
||||||
| Observable<Configuration>
|
| Observable<Configuration> {
|
||||||
| Promise<Configuration>
|
|
||||||
| Configuration {
|
|
||||||
return this.http
|
return this.http
|
||||||
.get(this._baseUrl, HTTP_GET_OPTIONS)
|
.get(this._baseUrl, HTTP_GET_OPTIONS)
|
||||||
.toPromise()
|
.pipe(map(response => response.json() as Configuration)
|
||||||
.then(response => response.json() as Configuration)
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
saveConfigurations(
|
saveConfigurations(
|
||||||
changedConfigs: any | { [key: string]: any | any[] }
|
changedConfigs: any | { [key: string]: any | any[] }
|
||||||
): Observable<any> | Promise<any> | any {
|
): Observable<any> {
|
||||||
if (!changedConfigs) {
|
if (!changedConfigs) {
|
||||||
return Promise.reject("Bad argument!");
|
return observableThrowError("Bad argument!");
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.http
|
return this.http
|
||||||
.put(this._baseUrl, JSON.stringify(changedConfigs), HTTP_JSON_OPTIONS)
|
.put(this._baseUrl, JSON.stringify(changedConfigs), HTTP_JSON_OPTIONS)
|
||||||
.toPromise()
|
.pipe(map(() => { })
|
||||||
.then(() => {})
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { Injectable, Inject } from "@angular/core";
|
import { Injectable, Inject } from "@angular/core";
|
||||||
import { Http } from "@angular/http";
|
import { Http } from "@angular/http";
|
||||||
import { Observable } from "rxjs";
|
import { Observable, throwError as observableThrowError } from "rxjs";
|
||||||
|
|
||||||
import { IServiceConfig, SERVICE_CONFIG } from "../service.config";
|
import { IServiceConfig, SERVICE_CONFIG } from "../service.config";
|
||||||
import {
|
import {
|
||||||
@ -10,6 +10,8 @@ import {
|
|||||||
} from "../utils";
|
} from "../utils";
|
||||||
import { RequestQueryParams } from "./RequestQueryParams";
|
import { RequestQueryParams } from "./RequestQueryParams";
|
||||||
import { Endpoint, ReplicationRule, Adapter } from "./interface";
|
import { Endpoint, ReplicationRule, Adapter } from "./interface";
|
||||||
|
import { catchError, map } from "rxjs/operators";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define the service methods to handle the endpoint related things.
|
* Define the service methods to handle the endpoint related things.
|
||||||
@ -33,7 +35,7 @@ export abstract class EndpointService {
|
|||||||
abstract getEndpoints(
|
abstract getEndpoints(
|
||||||
endpointName?: string,
|
endpointName?: string,
|
||||||
queryParams?: RequestQueryParams
|
queryParams?: RequestQueryParams
|
||||||
): Observable<Endpoint[]> | Promise<Endpoint[]> | Endpoint[];
|
): Observable<Endpoint[]>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the specified endpoint.
|
* Get the specified endpoint.
|
||||||
@ -46,14 +48,14 @@ export abstract class EndpointService {
|
|||||||
*/
|
*/
|
||||||
abstract getEndpoint(
|
abstract getEndpoint(
|
||||||
endpointId: number | string
|
endpointId: number | string
|
||||||
): Observable<Endpoint> | Promise<Endpoint> | Endpoint;
|
): Observable<Endpoint>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create new endpoint.
|
* Create new endpoint.
|
||||||
*
|
*
|
||||||
* @abstract
|
* @abstract
|
||||||
* ** deprecated param {Endpoint} endpoint
|
* ** deprecated param {Endpoint} endpoint
|
||||||
* returns {(Observable<any> | any)}
|
* returns {(Observable<any>)}
|
||||||
*
|
*
|
||||||
* @memberOf EndpointService
|
* @memberOf EndpointService
|
||||||
*/
|
*/
|
||||||
@ -70,7 +72,7 @@ export abstract class EndpointService {
|
|||||||
*/
|
*/
|
||||||
abstract createEndpoint(
|
abstract createEndpoint(
|
||||||
endpoint: Endpoint
|
endpoint: Endpoint
|
||||||
): Observable<any> | Promise<any> | any;
|
): Observable<any>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the specified endpoint.
|
* Update the specified endpoint.
|
||||||
@ -78,51 +80,51 @@ export abstract class EndpointService {
|
|||||||
* @abstract
|
* @abstract
|
||||||
* ** deprecated param {(number | string)} endpointId
|
* ** deprecated param {(number | string)} endpointId
|
||||||
* ** deprecated param {Endpoint} endpoint
|
* ** deprecated param {Endpoint} endpoint
|
||||||
* returns {(Observable<any> | any)}
|
* returns {(Observable<any>)}
|
||||||
*
|
*
|
||||||
* @memberOf EndpointService
|
* @memberOf EndpointService
|
||||||
*/
|
*/
|
||||||
abstract updateEndpoint(
|
abstract updateEndpoint(
|
||||||
endpointId: number | string,
|
endpointId: number | string,
|
||||||
endpoint: Endpoint
|
endpoint: Endpoint
|
||||||
): Observable<any> | Promise<any> | any;
|
): Observable<any>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete the specified endpoint.
|
* Delete the specified endpoint.
|
||||||
*
|
*
|
||||||
* @abstract
|
* @abstract
|
||||||
* ** deprecated param {(number | string)} endpointId
|
* ** deprecated param {(number | string)} endpointId
|
||||||
* returns {(Observable<any> | any)}
|
* returns {(Observable<any>)}
|
||||||
*
|
*
|
||||||
* @memberOf EndpointService
|
* @memberOf EndpointService
|
||||||
*/
|
*/
|
||||||
abstract deleteEndpoint(
|
abstract deleteEndpoint(
|
||||||
endpointId: number | string
|
endpointId: number | string
|
||||||
): Observable<any> | Promise<any> | any;
|
): Observable<any>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ping the specified endpoint.
|
* Ping the specified endpoint.
|
||||||
*
|
*
|
||||||
* @abstract
|
* @abstract
|
||||||
* ** deprecated param {Endpoint} endpoint
|
* ** deprecated param {Endpoint} endpoint
|
||||||
* returns {(Observable<any> | any)}
|
* returns {(Observable<any>)}
|
||||||
*
|
*
|
||||||
* @memberOf EndpointService
|
* @memberOf EndpointService
|
||||||
*/
|
*/
|
||||||
abstract pingEndpoint(
|
abstract pingEndpoint(
|
||||||
endpoint: Endpoint
|
endpoint: Endpoint
|
||||||
): Observable<any> | Promise<any> | any;
|
): Observable<any>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check endpoint whether in used with specific replication rule.
|
* Check endpoint whether in used with specific replication rule.
|
||||||
*
|
*
|
||||||
* @abstract
|
* @abstract
|
||||||
* ** deprecated param {{number | string}} endpointId
|
* ** deprecated param {{number | string}} endpointId
|
||||||
* returns {{Observable<any> | any}}
|
* returns {{Observable<any>}}
|
||||||
*/
|
*/
|
||||||
abstract getEndpointWithReplicationRules(
|
abstract getEndpointWithReplicationRules(
|
||||||
endpointId: number | string
|
endpointId: number | string
|
||||||
): Observable<any> | Promise<any> | any;
|
): Observable<any>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -149,7 +151,7 @@ export class EndpointDefaultService extends EndpointService {
|
|||||||
public getEndpoints(
|
public getEndpoints(
|
||||||
endpointName?: string,
|
endpointName?: string,
|
||||||
queryParams?: RequestQueryParams
|
queryParams?: RequestQueryParams
|
||||||
): Observable<Endpoint[]> | Promise<Endpoint[]> | Endpoint[] {
|
): Observable<Endpoint[]> {
|
||||||
if (!queryParams) {
|
if (!queryParams) {
|
||||||
queryParams = new RequestQueryParams();
|
queryParams = new RequestQueryParams();
|
||||||
}
|
}
|
||||||
@ -159,23 +161,21 @@ export class EndpointDefaultService extends EndpointService {
|
|||||||
let requestUrl: string = `${this._endpointUrl}`;
|
let requestUrl: string = `${this._endpointUrl}`;
|
||||||
return this.http
|
return this.http
|
||||||
.get(requestUrl, buildHttpRequestOptions(queryParams))
|
.get(requestUrl, buildHttpRequestOptions(queryParams))
|
||||||
.toPromise()
|
.pipe(map(response => response.json())
|
||||||
.then(response => response.json())
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public getEndpoint(
|
public getEndpoint(
|
||||||
endpointId: number | string
|
endpointId: number | string
|
||||||
): Observable<Endpoint> | Promise<Endpoint> | Endpoint {
|
): Observable<Endpoint> {
|
||||||
if (!endpointId || endpointId <= 0) {
|
if (!endpointId || endpointId <= 0) {
|
||||||
return Promise.reject("Bad request argument.");
|
return observableThrowError("Bad request argument.");
|
||||||
}
|
}
|
||||||
let requestUrl: string = `${this._endpointUrl}/${endpointId}`;
|
let requestUrl: string = `${this._endpointUrl}/${endpointId}`;
|
||||||
return this.http
|
return this.http
|
||||||
.get(requestUrl, HTTP_GET_OPTIONS)
|
.get(requestUrl, HTTP_GET_OPTIONS)
|
||||||
.toPromise()
|
.pipe(map(response => response.json() as Endpoint)
|
||||||
.then(response => response.json() as Endpoint)
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public getAdapters(): Observable<any> | Promise<any> | any {
|
public getAdapters(): Observable<any> | Promise<any> | any {
|
||||||
@ -188,75 +188,70 @@ export class EndpointDefaultService extends EndpointService {
|
|||||||
|
|
||||||
public createEndpoint(
|
public createEndpoint(
|
||||||
endpoint: Endpoint
|
endpoint: Endpoint
|
||||||
): Observable<any> | Promise<any> | any {
|
): Observable<any> {
|
||||||
if (!endpoint) {
|
if (!endpoint) {
|
||||||
return Promise.reject("Invalid endpoint.");
|
return observableThrowError("Invalid endpoint.");
|
||||||
}
|
}
|
||||||
let requestUrl: string = `${this._endpointUrl}`;
|
let requestUrl: string = `${this._endpointUrl}`;
|
||||||
return this.http
|
return this.http
|
||||||
.post(requestUrl, JSON.stringify(endpoint), HTTP_JSON_OPTIONS)
|
.post(requestUrl, JSON.stringify(endpoint), HTTP_JSON_OPTIONS)
|
||||||
.toPromise()
|
.pipe(map(response => response.status)
|
||||||
.then(response => response.status)
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public updateEndpoint(
|
public updateEndpoint(
|
||||||
endpointId: number | string,
|
endpointId: number | string,
|
||||||
endpoint: Endpoint
|
endpoint: Endpoint
|
||||||
): Observable<any> | Promise<any> | any {
|
): Observable<any> {
|
||||||
if (!endpointId || endpointId <= 0) {
|
if (!endpointId || endpointId <= 0) {
|
||||||
return Promise.reject("Bad request argument.");
|
return observableThrowError("Bad request argument.");
|
||||||
}
|
}
|
||||||
if (!endpoint) {
|
if (!endpoint) {
|
||||||
return Promise.reject("Invalid endpoint.");
|
return observableThrowError("Invalid endpoint.");
|
||||||
}
|
}
|
||||||
let requestUrl: string = `${this._endpointUrl}/${endpointId}`;
|
let requestUrl: string = `${this._endpointUrl}/${endpointId}`;
|
||||||
return this.http
|
return this.http
|
||||||
.put(requestUrl, JSON.stringify(endpoint), HTTP_JSON_OPTIONS)
|
.put(requestUrl, JSON.stringify(endpoint), HTTP_JSON_OPTIONS)
|
||||||
.toPromise()
|
.pipe(map(response => response.status)
|
||||||
.then(response => response.status)
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public deleteEndpoint(
|
public deleteEndpoint(
|
||||||
endpointId: number | string
|
endpointId: number | string
|
||||||
): Observable<any> | Promise<any> | any {
|
): Observable<any> {
|
||||||
if (!endpointId || endpointId <= 0) {
|
if (!endpointId || endpointId <= 0) {
|
||||||
return Promise.reject("Bad request argument.");
|
return observableThrowError("Bad request argument.");
|
||||||
}
|
}
|
||||||
let requestUrl: string = `${this._endpointUrl}/${endpointId}`;
|
let requestUrl: string = `${this._endpointUrl}/${endpointId}`;
|
||||||
return this.http
|
return this.http
|
||||||
.delete(requestUrl)
|
.delete(requestUrl)
|
||||||
.toPromise()
|
.pipe(map(response => response.status)
|
||||||
.then(response => response.status)
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public pingEndpoint(
|
public pingEndpoint(
|
||||||
endpoint: Endpoint
|
endpoint: Endpoint
|
||||||
): Observable<any> | Promise<any> | any {
|
): Observable<any> {
|
||||||
if (!endpoint) {
|
if (!endpoint) {
|
||||||
return Promise.reject("Invalid endpoint.");
|
return observableThrowError("Invalid endpoint.");
|
||||||
}
|
}
|
||||||
let requestUrl: string = `${this._endpointUrl}/ping`;
|
let requestUrl: string = `${this._endpointUrl}/ping`;
|
||||||
return this.http
|
return this.http
|
||||||
.post(requestUrl, endpoint, HTTP_JSON_OPTIONS)
|
.post(requestUrl, endpoint, HTTP_JSON_OPTIONS)
|
||||||
.toPromise()
|
.pipe(map(response => response.status)
|
||||||
.then(response => response.status)
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public getEndpointWithReplicationRules(
|
public getEndpointWithReplicationRules(
|
||||||
endpointId: number | string
|
endpointId: number | string
|
||||||
): Observable<any> | Promise<any> | any {
|
): Observable<any> {
|
||||||
if (!endpointId || endpointId <= 0) {
|
if (!endpointId || endpointId <= 0) {
|
||||||
return Promise.reject("Bad request argument.");
|
return observableThrowError("Bad request argument.");
|
||||||
}
|
}
|
||||||
let requestUrl: string = `${this._endpointUrl}/${endpointId}/policies`;
|
let requestUrl: string = `${this._endpointUrl}/${endpointId}/policies`;
|
||||||
return this.http
|
return this.http
|
||||||
.get(requestUrl, HTTP_GET_OPTIONS)
|
.get(requestUrl, HTTP_GET_OPTIONS)
|
||||||
.toPromise()
|
.pipe(map(response => response.json() as ReplicationRule[])
|
||||||
.then(response => response.json() as ReplicationRule[])
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { Observable } from "rxjs";
|
|
||||||
import { Injectable, Inject } from "@angular/core";
|
import { Injectable, Inject } from "@angular/core";
|
||||||
import { Http } from "@angular/http";
|
import { Http } from "@angular/http";
|
||||||
import { SERVICE_CONFIG, IServiceConfig } from "../service.config";
|
import { SERVICE_CONFIG, IServiceConfig } from "../service.config";
|
||||||
import { HTTP_GET_OPTIONS } from "../utils";
|
import { HTTP_GET_OPTIONS } from "../utils";
|
||||||
|
import { map, catchError } from "rxjs/operators";
|
||||||
|
import { Observable, throwError as observableThrowError } from "rxjs";
|
||||||
/**
|
/**
|
||||||
* Define the service methods to handle the job log related things.
|
* Define the service methods to handle the job log related things.
|
||||||
*
|
*
|
||||||
@ -18,7 +18,7 @@ export abstract class JobLogService {
|
|||||||
* @abstract
|
* @abstract
|
||||||
* ** deprecated param {string} jobType
|
* ** deprecated param {string} jobType
|
||||||
* ** deprecated param {(number | string)} jobId
|
* ** deprecated param {(number | string)} jobId
|
||||||
* returns {(Observable<string> | Promise<string> | string)}
|
* returns {(Observable<string>)}
|
||||||
* @memberof JobLogService
|
* @memberof JobLogService
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ export abstract class JobLogService {
|
|||||||
abstract getJobLog(
|
abstract getJobLog(
|
||||||
jobType: string,
|
jobType: string,
|
||||||
jobId: number | string
|
jobId: number | string
|
||||||
): Observable<string> | Promise<string> | string;
|
): Observable<string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -56,12 +56,11 @@ export class JobLogDefaultService extends JobLogService {
|
|||||||
this._supportedJobTypes = ["replication", "scan"];
|
this._supportedJobTypes = ["replication", "scan"];
|
||||||
}
|
}
|
||||||
|
|
||||||
_getJobLog(logUrl: string): Observable<string> | Promise<string> | string {
|
_getJobLog(logUrl: string): Observable<string> {
|
||||||
return this.http
|
return this.http
|
||||||
.get(logUrl, HTTP_GET_OPTIONS)
|
.get(logUrl, HTTP_GET_OPTIONS)
|
||||||
.toPromise()
|
.pipe(map(response => response.text())
|
||||||
.then(response => response.text())
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_isSupportedJobType(jobType: string): boolean {
|
_isSupportedJobType(jobType: string): boolean {
|
||||||
@ -79,12 +78,12 @@ export class JobLogDefaultService extends JobLogService {
|
|||||||
public getJobLog(
|
public getJobLog(
|
||||||
jobType: string,
|
jobType: string,
|
||||||
jobId: number | string
|
jobId: number | string
|
||||||
): Observable<string> | Promise<string> | string {
|
): Observable<string> {
|
||||||
if (!this._isSupportedJobType(jobType)) {
|
if (!this._isSupportedJobType(jobType)) {
|
||||||
return Promise.reject("Unsupport job type: " + jobType);
|
return observableThrowError("Unsupport job type: " + jobType);
|
||||||
}
|
}
|
||||||
if (!jobId || jobId <= 0) {
|
if (!jobId || jobId <= 0) {
|
||||||
return Promise.reject("Bad argument");
|
return observableThrowError("Bad argument");
|
||||||
}
|
}
|
||||||
|
|
||||||
let logUrl: string = `${this._replicationJobBaseUrl}/${jobId}/log`;
|
let logUrl: string = `${this._replicationJobBaseUrl}/${jobId}/log`;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import { Inject, Injectable } from "@angular/core";
|
import { Inject, Injectable } from "@angular/core";
|
||||||
import { Http } from "@angular/http";
|
import { Http } from "@angular/http";
|
||||||
import { Observable} from "rxjs";
|
|
||||||
import { map, catchError} from "rxjs/operators";
|
import { map, catchError} from "rxjs/operators";
|
||||||
|
|
||||||
import { RequestQueryParams } from "./RequestQueryParams";
|
import { RequestQueryParams } from "./RequestQueryParams";
|
||||||
@ -9,18 +8,19 @@ import { Label } from "./interface";
|
|||||||
import { IServiceConfig, SERVICE_CONFIG } from "../service.config";
|
import { IServiceConfig, SERVICE_CONFIG } from "../service.config";
|
||||||
import { buildHttpRequestOptions, HTTP_JSON_OPTIONS } from "../utils";
|
import { buildHttpRequestOptions, HTTP_JSON_OPTIONS } from "../utils";
|
||||||
import { extractJson } from "../shared/shared.utils";
|
import { extractJson } from "../shared/shared.utils";
|
||||||
|
import { Observable, throwError as observableThrowError } from "rxjs";
|
||||||
|
|
||||||
export abstract class LabelService {
|
export abstract class LabelService {
|
||||||
abstract getGLabels(
|
abstract getGLabels(
|
||||||
name?: string,
|
name?: string,
|
||||||
queryParams?: RequestQueryParams
|
queryParams?: RequestQueryParams
|
||||||
): Observable<Label[]> | Promise<Label[]>;
|
): Observable<Label[]>;
|
||||||
|
|
||||||
abstract getPLabels(
|
abstract getPLabels(
|
||||||
projectId: number,
|
projectId: number,
|
||||||
name?: string,
|
name?: string,
|
||||||
queryParams?: RequestQueryParams
|
queryParams?: RequestQueryParams
|
||||||
): Observable<Label[]> | Promise<Label[]>;
|
): Observable<Label[]>;
|
||||||
|
|
||||||
abstract getProjectLabels(
|
abstract getProjectLabels(
|
||||||
projectId: number,
|
projectId: number,
|
||||||
@ -37,16 +37,16 @@ export abstract class LabelService {
|
|||||||
|
|
||||||
abstract createLabel(
|
abstract createLabel(
|
||||||
label: Label
|
label: Label
|
||||||
): Observable<Label> | Promise<Label> | Label;
|
): Observable<Label>;
|
||||||
|
|
||||||
abstract getLabel(id: number): Observable<Label> | Promise<Label> | Label;
|
abstract getLabel(id: number): Observable<Label>;
|
||||||
|
|
||||||
abstract updateLabel(
|
abstract updateLabel(
|
||||||
id: number,
|
id: number,
|
||||||
param: Label
|
param: Label
|
||||||
): Observable<any> | Promise<any> | any;
|
): Observable<any>;
|
||||||
|
|
||||||
abstract deleteLabel(id: number): Observable<any> | Promise<any> | any;
|
abstract deleteLabel(id: number): Observable<any>;
|
||||||
|
|
||||||
abstract getChartVersionLabels(
|
abstract getChartVersionLabels(
|
||||||
projectName: string,
|
projectName: string,
|
||||||
@ -87,7 +87,7 @@ export class LabelDefaultService extends LabelService {
|
|||||||
getGLabels(
|
getGLabels(
|
||||||
name?: string,
|
name?: string,
|
||||||
queryParams?: RequestQueryParams
|
queryParams?: RequestQueryParams
|
||||||
): Observable<Label[]> | Promise<Label[]> {
|
): Observable<Label[]> {
|
||||||
if (!queryParams) {
|
if (!queryParams) {
|
||||||
queryParams = new RequestQueryParams();
|
queryParams = new RequestQueryParams();
|
||||||
}
|
}
|
||||||
@ -98,16 +98,15 @@ export class LabelDefaultService extends LabelService {
|
|||||||
}
|
}
|
||||||
return this.http
|
return this.http
|
||||||
.get(this.labelUrl, buildHttpRequestOptions(queryParams))
|
.get(this.labelUrl, buildHttpRequestOptions(queryParams))
|
||||||
.toPromise()
|
.pipe(map(response => response.json())
|
||||||
.then(response => response.json())
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getPLabels(
|
getPLabels(
|
||||||
projectId: number,
|
projectId: number,
|
||||||
name?: string,
|
name?: string,
|
||||||
queryParams?: RequestQueryParams
|
queryParams?: RequestQueryParams
|
||||||
): Observable<Label[]> | Promise<Label[]> {
|
): Observable<Label[]> {
|
||||||
if (!queryParams) {
|
if (!queryParams) {
|
||||||
queryParams = new RequestQueryParams();
|
queryParams = new RequestQueryParams();
|
||||||
}
|
}
|
||||||
@ -120,9 +119,8 @@ export class LabelDefaultService extends LabelService {
|
|||||||
}
|
}
|
||||||
return this.http
|
return this.http
|
||||||
.get(this.labelUrl, buildHttpRequestOptions(queryParams))
|
.get(this.labelUrl, buildHttpRequestOptions(queryParams))
|
||||||
.toPromise()
|
.pipe(map(response => response.json())
|
||||||
.then(response => response.json())
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getProjectLabels(
|
getProjectLabels(
|
||||||
@ -165,57 +163,53 @@ export class LabelDefaultService extends LabelService {
|
|||||||
return this.http
|
return this.http
|
||||||
.get(this.labelUrl, buildHttpRequestOptions(queryParams))
|
.get(this.labelUrl, buildHttpRequestOptions(queryParams))
|
||||||
.pipe(map(response => response.json()))
|
.pipe(map(response => response.json()))
|
||||||
.pipe(catchError(error => Promise.reject(error)));
|
.pipe(catchError(error => observableThrowError(error)));
|
||||||
}
|
}
|
||||||
|
|
||||||
createLabel(label: Label): Observable<any> | Promise<any> | any {
|
createLabel(label: Label): Observable<any> {
|
||||||
if (!label) {
|
if (!label) {
|
||||||
return Promise.reject("Invalid label.");
|
return observableThrowError("Invalid label.");
|
||||||
}
|
}
|
||||||
return this.http
|
return this.http
|
||||||
.post(this.labelUrl, JSON.stringify(label), HTTP_JSON_OPTIONS)
|
.post(this.labelUrl, JSON.stringify(label), HTTP_JSON_OPTIONS)
|
||||||
.toPromise()
|
.pipe(map(response => response.status)
|
||||||
.then(response => response.status)
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getLabel(id: number): Observable<Label> | Promise<Label> | Label {
|
getLabel(id: number): Observable<Label> {
|
||||||
if (!id || id <= 0) {
|
if (!id || id <= 0) {
|
||||||
return Promise.reject("Bad request argument.");
|
return observableThrowError("Bad request argument.");
|
||||||
}
|
}
|
||||||
let reqUrl = `${this.labelUrl}/${id}`;
|
let reqUrl = `${this.labelUrl}/${id}`;
|
||||||
return this.http
|
return this.http
|
||||||
.get(reqUrl, HTTP_JSON_OPTIONS)
|
.get(reqUrl, HTTP_JSON_OPTIONS)
|
||||||
.toPromise()
|
.pipe(map(response => response.json())
|
||||||
.then(response => response.json())
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateLabel(id: number, label: Label): Observable<any> | Promise<any> | any {
|
updateLabel(id: number, label: Label): Observable<any> {
|
||||||
if (!id || id <= 0) {
|
if (!id || id <= 0) {
|
||||||
return Promise.reject("Bad request argument.");
|
return observableThrowError("Bad request argument.");
|
||||||
}
|
}
|
||||||
if (!label) {
|
if (!label) {
|
||||||
return Promise.reject("Invalid endpoint.");
|
return observableThrowError("Invalid endpoint.");
|
||||||
}
|
}
|
||||||
let reqUrl = `${this.labelUrl}/${id}`;
|
let reqUrl = `${this.labelUrl}/${id}`;
|
||||||
return this.http
|
return this.http
|
||||||
.put(reqUrl, JSON.stringify(label), HTTP_JSON_OPTIONS)
|
.put(reqUrl, JSON.stringify(label), HTTP_JSON_OPTIONS)
|
||||||
.toPromise()
|
.pipe(map(response => response.status)
|
||||||
.then(response => response.status)
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteLabel(id: number): Observable<any> | Promise<any> | any {
|
deleteLabel(id: number): Observable<any> {
|
||||||
if (!id || id <= 0) {
|
if (!id || id <= 0) {
|
||||||
return Promise.reject("Bad request argument.");
|
return observableThrowError("Bad request argument.");
|
||||||
}
|
}
|
||||||
let reqUrl = `${this.labelUrl}/${id}`;
|
let reqUrl = `${this.labelUrl}/${id}`;
|
||||||
return this.http
|
return this.http
|
||||||
.delete(reqUrl)
|
.delete(reqUrl)
|
||||||
.toPromise()
|
.pipe(map(response => response.status)
|
||||||
.then(response => response.status)
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getChartVersionLabels(
|
getChartVersionLabels(
|
||||||
|
@ -27,13 +27,13 @@ export abstract class ProjectService {
|
|||||||
*
|
*
|
||||||
* @abstract
|
* @abstract
|
||||||
* ** deprecated param {string|number} [projectId]
|
* ** deprecated param {string|number} [projectId]
|
||||||
* returns {(Observable<Project> | Promise<Project> | Project)}
|
* returns {(Observable<Project> )}
|
||||||
*
|
*
|
||||||
* @memberOf ProjectService
|
* @memberOf ProjectService
|
||||||
*/
|
*/
|
||||||
abstract getProject(
|
abstract getProject(
|
||||||
projectId: number | string
|
projectId: number | string
|
||||||
): Observable<Project> | Promise<Project> | Project;
|
): Observable<Project> ;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the specified project.
|
* Update the specified project.
|
||||||
@ -41,14 +41,14 @@ export abstract class ProjectService {
|
|||||||
* @abstract
|
* @abstract
|
||||||
* ** deprecated param {(number | string)} projectId
|
* ** deprecated param {(number | string)} projectId
|
||||||
* ** deprecated param {ProjectPolicy} projectPolicy
|
* ** deprecated param {ProjectPolicy} projectPolicy
|
||||||
* returns {(Observable<any> | Promise<any> | any)}
|
* returns {(Observable<any>)}
|
||||||
*
|
*
|
||||||
* @memberOf EndpointService
|
* @memberOf EndpointService
|
||||||
*/
|
*/
|
||||||
abstract updateProjectPolicy(
|
abstract updateProjectPolicy(
|
||||||
projectId: number | string,
|
projectId: number | string,
|
||||||
projectPolicy: ProjectPolicy
|
projectPolicy: ProjectPolicy
|
||||||
): Observable<any> | Promise<any> | any;
|
): Observable<any>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all projects
|
* Get all projects
|
||||||
@ -58,7 +58,7 @@ export abstract class ProjectService {
|
|||||||
* ** deprecated param {number} isPublic
|
* ** deprecated param {number} isPublic
|
||||||
* ** deprecated param {number} page
|
* ** deprecated param {number} page
|
||||||
* ** deprecated param {number} pageSize
|
* ** deprecated param {number} pageSize
|
||||||
* returns {(Observable<any> | Promise<any> | any)}
|
* returns {(Observable<any>)}
|
||||||
*
|
*
|
||||||
* @memberOf EndpointService
|
* @memberOf EndpointService
|
||||||
*/
|
*/
|
||||||
@ -67,7 +67,7 @@ export abstract class ProjectService {
|
|||||||
isPublic: number,
|
isPublic: number,
|
||||||
page?: number,
|
page?: number,
|
||||||
pageSize?: number
|
pageSize?: number
|
||||||
): Observable<Project[]> | Promise<Project[]> | Project[];
|
): Observable<Project[]>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -88,9 +88,9 @@ export class ProjectDefaultService extends ProjectService {
|
|||||||
|
|
||||||
public getProject(
|
public getProject(
|
||||||
projectId: number | string
|
projectId: number | string
|
||||||
): Observable<Project> | Promise<Project> | Project {
|
): Observable<Project> {
|
||||||
if (!projectId) {
|
if (!projectId) {
|
||||||
return Promise.reject("Bad argument");
|
return observableThrowError("Bad argument");
|
||||||
}
|
}
|
||||||
let baseUrl: string = this.config.projectBaseEndpoint
|
let baseUrl: string = this.config.projectBaseEndpoint
|
||||||
? this.config.projectBaseEndpoint
|
? this.config.projectBaseEndpoint
|
||||||
@ -106,7 +106,7 @@ export class ProjectDefaultService extends ProjectService {
|
|||||||
isPublic: number,
|
isPublic: number,
|
||||||
page?: number,
|
page?: number,
|
||||||
pageSize?: number
|
pageSize?: number
|
||||||
): Observable<Project[]> | Promise<Project[]> | Project[] {
|
): Observable<Project[]> {
|
||||||
let baseUrl: string = this.config.projectBaseEndpoint
|
let baseUrl: string = this.config.projectBaseEndpoint
|
||||||
? this.config.projectBaseEndpoint
|
? this.config.projectBaseEndpoint
|
||||||
: "/api/projects";
|
: "/api/projects";
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import { Http } from "@angular/http";
|
import { Http } from "@angular/http";
|
||||||
import { Injectable, Inject } from "@angular/core";
|
import { Injectable, Inject } from "@angular/core";
|
||||||
|
|
||||||
import { SERVICE_CONFIG, IServiceConfig } from "../service.config";
|
import { SERVICE_CONFIG, IServiceConfig } from "../service.config";
|
||||||
import {
|
import {
|
||||||
buildHttpRequestOptions,
|
buildHttpRequestOptions,
|
||||||
@ -34,7 +33,7 @@ export abstract class ReplicationService {
|
|||||||
* ** deprecated param {(number | string)} [projectId]
|
* ** deprecated param {(number | string)} [projectId]
|
||||||
* ** deprecated param {string} [ruleName]
|
* ** deprecated param {string} [ruleName]
|
||||||
* ** deprecated param {RequestQueryParams} [queryParams]
|
* ** deprecated param {RequestQueryParams} [queryParams]
|
||||||
* returns {(Observable<ReplicationRule[]> | Promise<ReplicationRule[]> | ReplicationRule[])}
|
* returns {(Observable<ReplicationRule[]>)}
|
||||||
*
|
*
|
||||||
* @memberOf ReplicationService
|
* @memberOf ReplicationService
|
||||||
*/
|
*/
|
||||||
@ -43,22 +42,20 @@ export abstract class ReplicationService {
|
|||||||
ruleName?: string,
|
ruleName?: string,
|
||||||
queryParams?: RequestQueryParams
|
queryParams?: RequestQueryParams
|
||||||
):
|
):
|
||||||
| Observable<ReplicationRule[]>
|
| Observable<ReplicationRule[]>;
|
||||||
| Promise<ReplicationRule[]>
|
|
||||||
| ReplicationRule[];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the specified replication rule.
|
* Get the specified replication rule.
|
||||||
*
|
*
|
||||||
* @abstract
|
* @abstract
|
||||||
* ** deprecated param {(number | string)} ruleId
|
* ** deprecated param {(number | string)} ruleId
|
||||||
* returns {(Observable<ReplicationRule> | Promise<ReplicationRule> | ReplicationRule)}
|
* returns {(Observable<ReplicationRule>)}
|
||||||
*
|
*
|
||||||
* @memberOf ReplicationService
|
* @memberOf ReplicationService
|
||||||
*/
|
*/
|
||||||
abstract getReplicationRule(
|
abstract getReplicationRule(
|
||||||
ruleId: number | string
|
ruleId: number | string
|
||||||
): Observable<ReplicationRule> | Promise<ReplicationRule> | ReplicationRule;
|
): Observable<ReplicationRule>;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -77,71 +74,71 @@ export abstract class ReplicationService {
|
|||||||
*
|
*
|
||||||
* @abstract
|
* @abstract
|
||||||
* ** deprecated param {ReplicationRule} replicationRule
|
* ** deprecated param {ReplicationRule} replicationRule
|
||||||
* returns {(Observable<any> | Promise<any> | any)}
|
* returns {(Observable<any>)}
|
||||||
*
|
*
|
||||||
* @memberOf ReplicationService
|
* @memberOf ReplicationService
|
||||||
*/
|
*/
|
||||||
abstract createReplicationRule(
|
abstract createReplicationRule(
|
||||||
replicationRule: ReplicationRule
|
replicationRule: ReplicationRule
|
||||||
): Observable<any> | Promise<any> | any;
|
): Observable<any>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the specified replication rule.
|
* Update the specified replication rule.
|
||||||
*
|
*
|
||||||
* @abstract
|
* @abstract
|
||||||
* ** deprecated param {ReplicationRule} replicationRule
|
* ** deprecated param {ReplicationRule} replicationRule
|
||||||
* returns {(Observable<any> | Promise<any> | any)}
|
* returns {(Observable<any>)}
|
||||||
*
|
*
|
||||||
* @memberOf ReplicationService
|
* @memberOf ReplicationService
|
||||||
*/
|
*/
|
||||||
abstract updateReplicationRule(
|
abstract updateReplicationRule(
|
||||||
id: number,
|
id: number,
|
||||||
rep: ReplicationRule
|
rep: ReplicationRule
|
||||||
): Observable<any> | Promise<any> | any;
|
): Observable<any>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete the specified replication rule.
|
* Delete the specified replication rule.
|
||||||
*
|
*
|
||||||
* @abstract
|
* @abstract
|
||||||
* ** deprecated param {(number | string)} ruleId
|
* ** deprecated param {(number | string)} ruleId
|
||||||
* returns {(Observable<any> | Promise<any> | any)}
|
* returns {(Observable<any>)}
|
||||||
*
|
*
|
||||||
* @memberOf ReplicationService
|
* @memberOf ReplicationService
|
||||||
*/
|
*/
|
||||||
abstract deleteReplicationRule(
|
abstract deleteReplicationRule(
|
||||||
ruleId: number | string
|
ruleId: number | string
|
||||||
): Observable<any> | Promise<any> | any;
|
): Observable<any>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable the specified replication rule.
|
* Enable the specified replication rule.
|
||||||
*
|
*
|
||||||
* @abstract
|
* @abstract
|
||||||
* ** deprecated param {(number | string)} ruleId
|
* ** deprecated param {(number | string)} ruleId
|
||||||
* returns {(Observable<any> | Promise<any> | any)}
|
* returns {(Observable<any>)}
|
||||||
*
|
*
|
||||||
* @memberOf ReplicationService
|
* @memberOf ReplicationService
|
||||||
*/
|
*/
|
||||||
abstract enableReplicationRule(
|
abstract enableReplicationRule(
|
||||||
ruleId: number | string,
|
ruleId: number | string,
|
||||||
enablement: number
|
enablement: number
|
||||||
): Observable<any> | Promise<any> | any;
|
): Observable<any>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disable the specified replication rule.
|
* Disable the specified replication rule.
|
||||||
*
|
*
|
||||||
* @abstract
|
* @abstract
|
||||||
* ** deprecated param {(number | string)} ruleId
|
* ** deprecated param {(number | string)} ruleId
|
||||||
* returns {(Observable<any> | Promise<any> | any)}
|
* returns {(Observable<any>)}
|
||||||
*
|
*
|
||||||
* @memberOf ReplicationService
|
* @memberOf ReplicationService
|
||||||
*/
|
*/
|
||||||
abstract disableReplicationRule(
|
abstract disableReplicationRule(
|
||||||
ruleId: number | string
|
ruleId: number | string
|
||||||
): Observable<any> | Promise<any> | any;
|
): Observable<any>;
|
||||||
|
|
||||||
abstract replicateRule(
|
abstract replicateRule(
|
||||||
ruleId: number | string
|
ruleId: number | string
|
||||||
): Observable<any> | Promise<any> | any;
|
): Observable<any>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the jobs for the specified replication rule.
|
* Get the jobs for the specified replication rule.
|
||||||
@ -155,26 +152,26 @@ export abstract class ReplicationService {
|
|||||||
* @abstract
|
* @abstract
|
||||||
* ** deprecated param {(number | string)} ruleId
|
* ** deprecated param {(number | string)} ruleId
|
||||||
* ** deprecated param {RequestQueryParams} [queryParams]
|
* ** deprecated param {RequestQueryParams} [queryParams]
|
||||||
* returns {(Observable<ReplicationJob> | Promise<ReplicationJob> | ReplicationJob)}
|
* returns {(Observable<ReplicationJob>)}
|
||||||
*
|
*
|
||||||
* @memberOf ReplicationService
|
* @memberOf ReplicationService
|
||||||
*/
|
*/
|
||||||
abstract getExecutions(
|
abstract getExecutions(
|
||||||
ruleId: number | string,
|
ruleId: number | string,
|
||||||
queryParams?: RequestQueryParams
|
queryParams?: RequestQueryParams
|
||||||
): Observable<ReplicationJob> | Promise<ReplicationJob> | ReplicationJob;
|
): Observable<ReplicationJob>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the log of the specified job.
|
* Get the log of the specified job.
|
||||||
*
|
*
|
||||||
* @abstract
|
* @abstract
|
||||||
* ** deprecated param {(number | string)} jobId
|
* ** deprecated param {(number | string)} jobId
|
||||||
* returns {(Observable<string> | Promise<string> | string)}
|
* returns {(Observable<string>)}
|
||||||
* @memberof ReplicationService
|
* @memberof ReplicationService
|
||||||
*/
|
*/
|
||||||
abstract getJobLog(
|
abstract getJobLog(
|
||||||
jobId: number | string
|
jobId: number | string
|
||||||
): Observable<string> | Promise<string> | string;
|
): Observable<string>;
|
||||||
|
|
||||||
abstract stopJobs(
|
abstract stopJobs(
|
||||||
jobId: number | string
|
jobId: number | string
|
||||||
@ -217,7 +214,7 @@ export class ReplicationDefaultService extends ReplicationService {
|
|||||||
rule.name !== undefined &&
|
rule.name !== undefined &&
|
||||||
rule.name.trim() !== "" &&
|
rule.name.trim() !== "" &&
|
||||||
rule.src_namespaces && rule.src_namespaces.length > 0 &&
|
rule.src_namespaces && rule.src_namespaces.length > 0 &&
|
||||||
(!!rule.dest_registry_id || !! rule.src_registry_id)
|
(!!rule.dest_registry_id || !!rule.src_registry_id)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,9 +227,7 @@ export class ReplicationDefaultService extends ReplicationService {
|
|||||||
ruleName?: string,
|
ruleName?: string,
|
||||||
queryParams?: RequestQueryParams
|
queryParams?: RequestQueryParams
|
||||||
):
|
):
|
||||||
| Observable<ReplicationRule[]>
|
| Observable<ReplicationRule[]> {
|
||||||
| Promise<ReplicationRule[]>
|
|
||||||
| ReplicationRule[] {
|
|
||||||
if (!queryParams) {
|
if (!queryParams) {
|
||||||
queryParams = new RequestQueryParams();
|
queryParams = new RequestQueryParams();
|
||||||
}
|
}
|
||||||
@ -247,24 +242,22 @@ export class ReplicationDefaultService extends ReplicationService {
|
|||||||
|
|
||||||
return this.http
|
return this.http
|
||||||
.get(this._ruleBaseUrl, buildHttpRequestOptions(queryParams))
|
.get(this._ruleBaseUrl, buildHttpRequestOptions(queryParams))
|
||||||
.toPromise()
|
.pipe(map(response => response.json() as ReplicationRule[])
|
||||||
.then(response => response.json() as ReplicationRule[])
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public getReplicationRule(
|
public getReplicationRule(
|
||||||
ruleId: number | string
|
ruleId: number | string
|
||||||
): Observable<ReplicationRule> | Promise<ReplicationRule> | ReplicationRule {
|
): Observable<ReplicationRule> {
|
||||||
if (!ruleId) {
|
if (!ruleId) {
|
||||||
return Promise.reject("Bad argument");
|
return observableThrowError("Bad argument");
|
||||||
}
|
}
|
||||||
|
|
||||||
let url: string = `${this._ruleBaseUrl}/${ruleId}`;
|
let url: string = `${this._ruleBaseUrl}/${ruleId}`;
|
||||||
return this.http
|
return this.http
|
||||||
.get(url, HTTP_GET_OPTIONS)
|
.get(url, HTTP_GET_OPTIONS)
|
||||||
.toPromise()
|
.pipe(map(response => response.json() as ReplicationRule)
|
||||||
.then(response => response.json() as ReplicationRule)
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public getReplicationTasks(
|
public getReplicationTasks(
|
||||||
@ -275,16 +268,16 @@ export class ReplicationDefaultService extends ReplicationService {
|
|||||||
}
|
}
|
||||||
let url: string = `${this._replicateUrl}/${executionId}/tasks`;
|
let url: string = `${this._replicateUrl}/${executionId}/tasks`;
|
||||||
return this.http
|
return this.http
|
||||||
.get(url, HTTP_GET_OPTIONS)
|
.get(url, HTTP_GET_OPTIONS)
|
||||||
.pipe(map (response => response.json() as ReplicationTasks)
|
.pipe(map(response => response.json() as ReplicationTasks)
|
||||||
, catchError(error => observableThrowError(error)));
|
, catchError(error => observableThrowError(error)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public createReplicationRule(
|
public createReplicationRule(
|
||||||
replicationRule: ReplicationRule
|
replicationRule: ReplicationRule
|
||||||
): Observable<any> | Promise<any> | any {
|
): Observable<any> {
|
||||||
if (!this._isValidRule(replicationRule)) {
|
if (!this._isValidRule(replicationRule)) {
|
||||||
return Promise.reject("Bad argument");
|
return observableThrowError("Bad argument");
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.http
|
return this.http
|
||||||
@ -293,94 +286,88 @@ export class ReplicationDefaultService extends ReplicationService {
|
|||||||
JSON.stringify(replicationRule),
|
JSON.stringify(replicationRule),
|
||||||
HTTP_JSON_OPTIONS
|
HTTP_JSON_OPTIONS
|
||||||
)
|
)
|
||||||
.toPromise()
|
.pipe(map(response => response)
|
||||||
.then(response => response)
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public updateReplicationRule(
|
public updateReplicationRule(
|
||||||
id: number,
|
id: number,
|
||||||
rep: ReplicationRule
|
rep: ReplicationRule
|
||||||
): Observable<any> | Promise<any> | any {
|
): Observable<any> {
|
||||||
if (!this._isValidRule(rep)) {
|
if (!this._isValidRule(rep)) {
|
||||||
return Promise.reject("Bad argument");
|
return observableThrowError("Bad argument");
|
||||||
}
|
}
|
||||||
|
|
||||||
let url = `${this._ruleBaseUrl}/${id}`;
|
let url = `${this._ruleBaseUrl}/${id}`;
|
||||||
return this.http
|
return this.http
|
||||||
.put(url, JSON.stringify(rep), HTTP_JSON_OPTIONS)
|
.put(url, JSON.stringify(rep), HTTP_JSON_OPTIONS)
|
||||||
.toPromise()
|
.pipe(map(response => response)
|
||||||
.then(response => response)
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public deleteReplicationRule(
|
public deleteReplicationRule(
|
||||||
ruleId: number | string
|
ruleId: number | string
|
||||||
): Observable<any> | Promise<any> | any {
|
): Observable<any> {
|
||||||
if (!ruleId || ruleId <= 0) {
|
if (!ruleId || ruleId <= 0) {
|
||||||
return Promise.reject("Bad argument");
|
return observableThrowError("Bad argument");
|
||||||
}
|
}
|
||||||
|
|
||||||
let url: string = `${this._ruleBaseUrl}/${ruleId}`;
|
let url: string = `${this._ruleBaseUrl}/${ruleId}`;
|
||||||
return this.http
|
return this.http
|
||||||
.delete(url, HTTP_JSON_OPTIONS)
|
.delete(url, HTTP_JSON_OPTIONS)
|
||||||
.toPromise()
|
.pipe(map(response => response)
|
||||||
.then(response => response)
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public replicateRule(
|
public replicateRule(
|
||||||
ruleId: number | string
|
ruleId: number | string
|
||||||
): Observable<any> | Promise<any> | any {
|
): Observable<any> {
|
||||||
if (!ruleId) {
|
if (!ruleId) {
|
||||||
return Promise.reject("Bad argument");
|
return observableThrowError("Bad argument");
|
||||||
}
|
}
|
||||||
|
|
||||||
let url: string = `${this._replicateUrl}`;
|
let url: string = `${this._replicateUrl}`;
|
||||||
return this.http
|
return this.http
|
||||||
.post(url, { policy_id: ruleId }, HTTP_JSON_OPTIONS)
|
.post(url, { policy_id: ruleId }, HTTP_JSON_OPTIONS)
|
||||||
.toPromise()
|
.pipe(map(response => response)
|
||||||
.then(response => response)
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enableReplicationRule(
|
public enableReplicationRule(
|
||||||
ruleId: number | string,
|
ruleId: number | string,
|
||||||
enablement: number
|
enablement: number
|
||||||
): Observable<any> | Promise<any> | any {
|
): Observable<any> {
|
||||||
if (!ruleId || ruleId <= 0) {
|
if (!ruleId || ruleId <= 0) {
|
||||||
return Promise.reject("Bad argument");
|
return observableThrowError("Bad argument");
|
||||||
}
|
}
|
||||||
|
|
||||||
let url: string = `${this._ruleBaseUrl}/${ruleId}/enablement`;
|
let url: string = `${this._ruleBaseUrl}/${ruleId}/enablement`;
|
||||||
return this.http
|
return this.http
|
||||||
.put(url, { enabled: enablement }, HTTP_JSON_OPTIONS)
|
.put(url, { enabled: enablement }, HTTP_JSON_OPTIONS)
|
||||||
.toPromise()
|
.pipe(map(response => response)
|
||||||
.then(response => response)
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public disableReplicationRule(
|
public disableReplicationRule(
|
||||||
ruleId: number | string
|
ruleId: number | string
|
||||||
): Observable<any> | Promise<any> | any {
|
): Observable<any> {
|
||||||
if (!ruleId || ruleId <= 0) {
|
if (!ruleId || ruleId <= 0) {
|
||||||
return Promise.reject("Bad argument");
|
return observableThrowError("Bad argument");
|
||||||
}
|
}
|
||||||
|
|
||||||
let url: string = `${this._ruleBaseUrl}/${ruleId}/enablement`;
|
let url: string = `${this._ruleBaseUrl}/${ruleId}/enablement`;
|
||||||
return this.http
|
return this.http
|
||||||
.put(url, { enabled: 0 }, HTTP_JSON_OPTIONS)
|
.put(url, { enabled: 0 }, HTTP_JSON_OPTIONS)
|
||||||
.toPromise()
|
.pipe(map(response => response)
|
||||||
.then(response => response)
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public getExecutions(
|
public getExecutions(
|
||||||
ruleId: number | string,
|
ruleId: number | string,
|
||||||
queryParams?: RequestQueryParams
|
queryParams?: RequestQueryParams
|
||||||
): Observable<ReplicationJob> | Promise<ReplicationJob> | ReplicationJob {
|
): Observable<ReplicationJob> {
|
||||||
if (!ruleId || ruleId <= 0) {
|
if (!ruleId || ruleId <= 0) {
|
||||||
return Promise.reject("Bad argument");
|
return observableThrowError("Bad argument");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!queryParams) {
|
if (!queryParams) {
|
||||||
@ -390,8 +377,7 @@ export class ReplicationDefaultService extends ReplicationService {
|
|||||||
queryParams.set("policy_id", "" + ruleId);
|
queryParams.set("policy_id", "" + ruleId);
|
||||||
return this.http
|
return this.http
|
||||||
.get(this._replicateUrl, buildHttpRequestOptions(queryParams))
|
.get(this._replicateUrl, buildHttpRequestOptions(queryParams))
|
||||||
.toPromise()
|
.pipe(map(response => {
|
||||||
.then(response => {
|
|
||||||
let result: ReplicationJob = {
|
let result: ReplicationJob = {
|
||||||
metadata: {
|
metadata: {
|
||||||
xTotalCount: 0
|
xTotalCount: 0
|
||||||
@ -414,37 +400,37 @@ export class ReplicationDefaultService extends ReplicationService {
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
})
|
})
|
||||||
.catch(error => Promise.reject(error));
|
, catchError(error => observableThrowError(error)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public getJobLog(
|
public getJobLog(
|
||||||
jobId: number | string
|
jobId: number | string
|
||||||
): Observable<string> | Promise<string> | string {
|
): Observable<string> {
|
||||||
if (!jobId || jobId <= 0) {
|
if (!jobId || jobId <= 0) {
|
||||||
return Promise.reject("Bad argument");
|
return observableThrowError("Bad argument");
|
||||||
}
|
}
|
||||||
|
|
||||||
let logUrl = `${this._replicateUrl}/${jobId}/log`;
|
let logUrl = `${this._replicateUrl}/${jobId}/log`;
|
||||||
return this.http
|
return this.http
|
||||||
.get(logUrl, HTTP_GET_OPTIONS)
|
.get(logUrl, HTTP_GET_OPTIONS)
|
||||||
.toPromise()
|
.pipe(map(response => response.text())
|
||||||
.then(response => response.text())
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public stopJobs(
|
public stopJobs(
|
||||||
jobId: number | string
|
jobId: number | string
|
||||||
): Observable<any> | Promise<any> | any {
|
): Observable<any> {
|
||||||
if (!jobId || jobId <= 0) {
|
if (!jobId || jobId <= 0) {
|
||||||
return observableThrowError("Bad request argument.");
|
return observableThrowError("Bad request argument.");
|
||||||
}
|
}
|
||||||
let requestUrl: string = `${this._replicateUrl}/${jobId}`;
|
let requestUrl: string = `${this._replicateUrl}/${jobId}`;
|
||||||
|
|
||||||
return this.http
|
return this.http
|
||||||
.put(
|
.put(
|
||||||
requestUrl,
|
requestUrl,
|
||||||
HTTP_JSON_OPTIONS
|
HTTP_JSON_OPTIONS
|
||||||
)
|
)
|
||||||
.pipe(map(response => response)
|
.pipe(map(response => response)
|
||||||
, catchError(error => observableThrowError(error)));
|
, catchError(error => observableThrowError(error)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import { Observable } from "rxjs";
|
|
||||||
import { RequestQueryParams } from './RequestQueryParams';
|
import { RequestQueryParams } from './RequestQueryParams';
|
||||||
import { Repository, RepositoryItem } from './interface';
|
import { Repository, RepositoryItem } from './interface';
|
||||||
import { Injectable, Inject } from '@angular/core';
|
import { Injectable, Inject } from '@angular/core';
|
||||||
@ -6,6 +5,8 @@ import { Injectable, Inject } from '@angular/core';
|
|||||||
import { Http } from '@angular/http';
|
import { Http } from '@angular/http';
|
||||||
import { SERVICE_CONFIG, IServiceConfig } from '../service.config';
|
import { SERVICE_CONFIG, IServiceConfig } from '../service.config';
|
||||||
import { buildHttpRequestOptions, HTTP_JSON_OPTIONS } from '../utils';
|
import { buildHttpRequestOptions, HTTP_JSON_OPTIONS } from '../utils';
|
||||||
|
import { map, catchError } from "rxjs/operators";
|
||||||
|
import { Observable, throwError as observableThrowError } from "rxjs";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define service methods for handling the repository related things.
|
* Define service methods for handling the repository related things.
|
||||||
@ -27,12 +28,12 @@ export abstract class RepositoryService {
|
|||||||
* ** deprecated param {(number | string)} projectId
|
* ** deprecated param {(number | string)} projectId
|
||||||
* ** deprecated param {string} repositoryName
|
* ** deprecated param {string} repositoryName
|
||||||
* ** deprecated param {RequestQueryParams} [queryParams]
|
* ** deprecated param {RequestQueryParams} [queryParams]
|
||||||
* returns {(Observable<Repository> | Promise<Repository> | Repository)}
|
* returns {(Observable<Repository>)}
|
||||||
*
|
*
|
||||||
* @memberOf RepositoryService
|
* @memberOf RepositoryService
|
||||||
*/
|
*/
|
||||||
abstract getRepositories(projectId: number | string, repositoryName?: string, queryParams?: RequestQueryParams):
|
abstract getRepositories(projectId: number | string, repositoryName?: string, queryParams?: RequestQueryParams):
|
||||||
Observable<Repository> | Promise<Repository> | Repository;
|
Observable<Repository>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update description of specified repository.
|
* Update description of specified repository.
|
||||||
@ -40,22 +41,22 @@ export abstract class RepositoryService {
|
|||||||
* @abstract
|
* @abstract
|
||||||
* ** deprecated param {number | string} projectId
|
* ** deprecated param {number | string} projectId
|
||||||
* ** deprecated param {string} repoName
|
* ** deprecated param {string} repoName
|
||||||
* returns {(Observable<Repository> | Promise<Repository> | Repository)}
|
* returns {(Observable<Repository>)}
|
||||||
*
|
*
|
||||||
* @memberOf RepositoryService
|
* @memberOf RepositoryService
|
||||||
*/
|
*/
|
||||||
abstract updateRepositoryDescription(repoName: string, description: string): Observable<any> | Promise<any> | any;
|
abstract updateRepositoryDescription(repoName: string, description: string): Observable<any>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DELETE the specified repository.
|
* DELETE the specified repository.
|
||||||
*
|
*
|
||||||
* @abstract
|
* @abstract
|
||||||
* ** deprecated param {string} repositoryName
|
* ** deprecated param {string} repositoryName
|
||||||
* returns {(Observable<any> | Promise<any> | any)}
|
* returns {(Observable<any>)}
|
||||||
*
|
*
|
||||||
* @memberOf RepositoryService
|
* @memberOf RepositoryService
|
||||||
*/
|
*/
|
||||||
abstract deleteRepository(repositoryName: string): Observable<any> | Promise<any> | any;
|
abstract deleteRepository(repositoryName: string): Observable<any>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -75,9 +76,9 @@ export class RepositoryDefaultService extends RepositoryService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public getRepositories(projectId: number | string, repositoryName?: string, queryParams?: RequestQueryParams):
|
public getRepositories(projectId: number | string, repositoryName?: string, queryParams?: RequestQueryParams):
|
||||||
Observable<Repository> | Promise<Repository> | Repository {
|
Observable<Repository> {
|
||||||
if (!projectId) {
|
if (!projectId) {
|
||||||
return Promise.reject('Bad argument');
|
return observableThrowError('Bad argument');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!queryParams) {
|
if (!queryParams) {
|
||||||
@ -90,8 +91,8 @@ export class RepositoryDefaultService extends RepositoryService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let url: string = this.config.repositoryBaseEndpoint ? this.config.repositoryBaseEndpoint : '/api/repositories';
|
let url: string = this.config.repositoryBaseEndpoint ? this.config.repositoryBaseEndpoint : '/api/repositories';
|
||||||
return this.http.get(url, buildHttpRequestOptions(queryParams)).toPromise()
|
return this.http.get(url, buildHttpRequestOptions(queryParams))
|
||||||
.then(response => {
|
.pipe(map(response => {
|
||||||
let result: Repository = {
|
let result: Repository = {
|
||||||
metadata: { xTotalCount: 0 },
|
metadata: { xTotalCount: 0 },
|
||||||
data: []
|
data: []
|
||||||
@ -114,11 +115,11 @@ export class RepositoryDefaultService extends RepositoryService {
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
})
|
})
|
||||||
.catch(error => Promise.reject(error));
|
, catchError(error => observableThrowError(error)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public updateRepositoryDescription(repositoryName: string, description: string,
|
public updateRepositoryDescription(repositoryName: string, description: string,
|
||||||
queryParams?: RequestQueryParams): Observable<any> | Promise<any> | any {
|
queryParams?: RequestQueryParams): Observable<any> {
|
||||||
|
|
||||||
if (!queryParams) {
|
if (!queryParams) {
|
||||||
queryParams = new RequestQueryParams();
|
queryParams = new RequestQueryParams();
|
||||||
@ -126,20 +127,20 @@ export class RepositoryDefaultService extends RepositoryService {
|
|||||||
|
|
||||||
let baseUrl: string = this.config.repositoryBaseEndpoint ? this.config.repositoryBaseEndpoint : '/api/repositories';
|
let baseUrl: string = this.config.repositoryBaseEndpoint ? this.config.repositoryBaseEndpoint : '/api/repositories';
|
||||||
let url = `${baseUrl}/${repositoryName}`;
|
let url = `${baseUrl}/${repositoryName}`;
|
||||||
return this.http.put(url, {'description': description }, HTTP_JSON_OPTIONS).toPromise()
|
return this.http.put(url, {'description': description }, HTTP_JSON_OPTIONS)
|
||||||
.then(response => response)
|
.pipe(map(response => response)
|
||||||
.catch(error => Promise.reject(error));
|
, catchError(error => observableThrowError(error)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public deleteRepository(repositoryName: string): Observable<any> | Promise<any> | any {
|
public deleteRepository(repositoryName: string): Observable<any> {
|
||||||
if (!repositoryName) {
|
if (!repositoryName) {
|
||||||
return Promise.reject('Bad argument');
|
return observableThrowError('Bad argument');
|
||||||
}
|
}
|
||||||
let url: string = this.config.repositoryBaseEndpoint ? this.config.repositoryBaseEndpoint : '/api/repositories';
|
let url: string = this.config.repositoryBaseEndpoint ? this.config.repositoryBaseEndpoint : '/api/repositories';
|
||||||
url = `${url}/${repositoryName}`;
|
url = `${url}/${repositoryName}`;
|
||||||
|
|
||||||
return this.http.delete(url, HTTP_JSON_OPTIONS).toPromise()
|
return this.http.delete(url, HTTP_JSON_OPTIONS)
|
||||||
.then(response => response)
|
.pipe(map(response => response)
|
||||||
.catch(error => {return Promise.reject(error); });
|
, catchError(error => observableThrowError(error)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import { Observable} from "rxjs";
|
|
||||||
import { Label } from "./interface";
|
import { Label } from "./interface";
|
||||||
import { Inject, Injectable } from "@angular/core";
|
import { Inject, Injectable } from "@angular/core";
|
||||||
import { Http } from "@angular/http";
|
import { Http } from "@angular/http";
|
||||||
import { IServiceConfig, SERVICE_CONFIG } from "../service.config";
|
import { IServiceConfig, SERVICE_CONFIG } from "../service.config";
|
||||||
import { buildHttpRequestOptions, HTTP_JSON_OPTIONS } from "../utils";
|
import { buildHttpRequestOptions, HTTP_JSON_OPTIONS } from "../utils";
|
||||||
import { RequestQueryParams } from "./RequestQueryParams";
|
import { RequestQueryParams } from "./RequestQueryParams";
|
||||||
|
import { map, catchError } from "rxjs/operators";
|
||||||
|
import { Observable, throwError as observableThrowError } from "rxjs";
|
||||||
|
|
||||||
export abstract class LabelService {
|
export abstract class LabelService {
|
||||||
abstract getLabels(
|
abstract getLabels(
|
||||||
@ -16,16 +17,16 @@ export abstract class LabelService {
|
|||||||
|
|
||||||
abstract createLabel(
|
abstract createLabel(
|
||||||
label: Label
|
label: Label
|
||||||
): Observable<Label> | Promise<Label> | Label;
|
): Observable<Label>;
|
||||||
|
|
||||||
abstract getLabel(id: number): Observable<Label> | Promise<Label> | Label;
|
abstract getLabel(id: number): Observable<Label>;
|
||||||
|
|
||||||
abstract updateLabel(
|
abstract updateLabel(
|
||||||
id: number,
|
id: number,
|
||||||
param: Label
|
param: Label
|
||||||
): Observable<any> | Promise<any> | any;
|
): Observable<any>;
|
||||||
|
|
||||||
abstract deleteLabel(id: number): Observable<any> | Promise<any> | any;
|
abstract deleteLabel(id: number): Observable<any>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@ -47,7 +48,7 @@ export class LabelDefaultService extends LabelService {
|
|||||||
projectId?: number,
|
projectId?: number,
|
||||||
name?: string,
|
name?: string,
|
||||||
queryParams?: RequestQueryParams
|
queryParams?: RequestQueryParams
|
||||||
): Observable<Label[]> | Promise<Label[]> {
|
): Observable<Label[]> {
|
||||||
if (!queryParams) {
|
if (!queryParams) {
|
||||||
queryParams = new RequestQueryParams();
|
queryParams = new RequestQueryParams();
|
||||||
}
|
}
|
||||||
@ -62,15 +63,14 @@ export class LabelDefaultService extends LabelService {
|
|||||||
}
|
}
|
||||||
return this.http
|
return this.http
|
||||||
.get(this._labelUrl, buildHttpRequestOptions(queryParams))
|
.get(this._labelUrl, buildHttpRequestOptions(queryParams))
|
||||||
.toPromise()
|
.pipe(map(response => response.json())
|
||||||
.then(response => response.json())
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getGLabels(
|
getGLabels(
|
||||||
name?: string,
|
name?: string,
|
||||||
queryParams?: RequestQueryParams
|
queryParams?: RequestQueryParams
|
||||||
): Observable<Label[]> | Promise<Label[]> {
|
): Observable<Label[]> {
|
||||||
if (!queryParams) {
|
if (!queryParams) {
|
||||||
queryParams = new RequestQueryParams();
|
queryParams = new RequestQueryParams();
|
||||||
}
|
}
|
||||||
@ -81,16 +81,15 @@ export class LabelDefaultService extends LabelService {
|
|||||||
}
|
}
|
||||||
return this.http
|
return this.http
|
||||||
.get(this._labelUrl, buildHttpRequestOptions(queryParams))
|
.get(this._labelUrl, buildHttpRequestOptions(queryParams))
|
||||||
.toPromise()
|
.pipe(map(response => response.json())
|
||||||
.then(response => response.json())
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getPLabels(
|
getPLabels(
|
||||||
projectId: number,
|
projectId: number,
|
||||||
name?: string,
|
name?: string,
|
||||||
queryParams?: RequestQueryParams
|
queryParams?: RequestQueryParams
|
||||||
): Observable<Label[]> | Promise<Label[]> {
|
): Observable<Label[]> {
|
||||||
if (!queryParams) {
|
if (!queryParams) {
|
||||||
queryParams = new RequestQueryParams();
|
queryParams = new RequestQueryParams();
|
||||||
}
|
}
|
||||||
@ -103,57 +102,52 @@ export class LabelDefaultService extends LabelService {
|
|||||||
}
|
}
|
||||||
return this.http
|
return this.http
|
||||||
.get(this._labelUrl, buildHttpRequestOptions(queryParams))
|
.get(this._labelUrl, buildHttpRequestOptions(queryParams))
|
||||||
.toPromise()
|
.pipe(map(response => response.json())
|
||||||
.then(response => response.json())
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
createLabel(label: Label): Observable<any> | Promise<any> | any {
|
createLabel(label: Label): Observable<any> {
|
||||||
if (!label) {
|
if (!label) {
|
||||||
return Promise.reject("Invalid label.");
|
return observableThrowError("Invalid label.");
|
||||||
}
|
}
|
||||||
return this.http
|
return this.http
|
||||||
.post(this._labelUrl, JSON.stringify(label), HTTP_JSON_OPTIONS)
|
.post(this._labelUrl, JSON.stringify(label), HTTP_JSON_OPTIONS)
|
||||||
.toPromise()
|
.pipe(map(response => response.status)
|
||||||
.then(response => response.status)
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getLabel(id: number): Observable<Label> | Promise<Label> | Label {
|
getLabel(id: number): Observable<Label> {
|
||||||
if (!id || id <= 0) {
|
if (!id || id <= 0) {
|
||||||
return Promise.reject("Bad request argument.");
|
return observableThrowError("Bad request argument.");
|
||||||
}
|
}
|
||||||
let reqUrl = `${this._labelUrl}/${id}`;
|
let reqUrl = `${this._labelUrl}/${id}`;
|
||||||
return this.http
|
return this.http
|
||||||
.get(reqUrl)
|
.get(reqUrl)
|
||||||
.toPromise()
|
.pipe(map(response => response.json())
|
||||||
.then(response => response.json())
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateLabel(id: number, label: Label): Observable<any> | Promise<any> | any {
|
updateLabel(id: number, label: Label): Observable<any> {
|
||||||
if (!id || id <= 0) {
|
if (!id || id <= 0) {
|
||||||
return Promise.reject("Bad request argument.");
|
return observableThrowError("Bad request argument.");
|
||||||
}
|
}
|
||||||
if (!label) {
|
if (!label) {
|
||||||
return Promise.reject("Invalid endpoint.");
|
return observableThrowError("Invalid endpoint.");
|
||||||
}
|
}
|
||||||
let reqUrl = `${this._labelUrl}/${id}`;
|
let reqUrl = `${this._labelUrl}/${id}`;
|
||||||
return this.http
|
return this.http
|
||||||
.put(reqUrl, JSON.stringify(label), HTTP_JSON_OPTIONS)
|
.put(reqUrl, JSON.stringify(label), HTTP_JSON_OPTIONS)
|
||||||
.toPromise()
|
.pipe(map(response => response.status)
|
||||||
.then(response => response.status)
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
deleteLabel(id: number): Observable<any> | Promise<any> | any {
|
deleteLabel(id: number): Observable<any> {
|
||||||
if (!id || id <= 0) {
|
if (!id || id <= 0) {
|
||||||
return Promise.reject("Bad request argument.");
|
return observableThrowError("Bad request argument.");
|
||||||
}
|
}
|
||||||
let reqUrl = `${this._labelUrl}/${id}`;
|
let reqUrl = `${this._labelUrl}/${id}`;
|
||||||
return this.http
|
return this.http
|
||||||
.delete(reqUrl)
|
.delete(reqUrl)
|
||||||
.toPromise()
|
.pipe(map(response => response.status)
|
||||||
.then(response => response.status)
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
import { Http } from "@angular/http";
|
import { Http } from "@angular/http";
|
||||||
import { Injectable, Inject } from "@angular/core";
|
import { Injectable, Inject } from "@angular/core";
|
||||||
import { Observable, of } from "rxjs";
|
|
||||||
|
|
||||||
import { SERVICE_CONFIG, IServiceConfig } from "../service.config";
|
import { SERVICE_CONFIG, IServiceConfig } from "../service.config";
|
||||||
import { buildHttpRequestOptions, HTTP_JSON_OPTIONS } from "../utils";
|
import { buildHttpRequestOptions, HTTP_JSON_OPTIONS } from "../utils";
|
||||||
import { RequestQueryParams } from "./RequestQueryParams";
|
import { RequestQueryParams } from "./RequestQueryParams";
|
||||||
import { VulnerabilityItem, VulnerabilitySummary } from "./interface";
|
import { VulnerabilityItem, VulnerabilitySummary } from "./interface";
|
||||||
|
import { map, catchError } from "rxjs/operators";
|
||||||
|
import { Observable, of, throwError as observableThrowError } from "rxjs";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the vulnerabilities scanning results for the specified tag.
|
* Get the vulnerabilities scanning results for the specified tag.
|
||||||
@ -20,7 +21,7 @@ export abstract class ScanningResultService {
|
|||||||
*
|
*
|
||||||
* @abstract
|
* @abstract
|
||||||
* ** deprecated param {string} tagId
|
* ** deprecated param {string} tagId
|
||||||
* returns {(Observable<VulnerabilitySummary> | Promise<VulnerabilitySummary> | VulnerabilitySummary)}
|
* returns {(Observable<VulnerabilitySummary>)}
|
||||||
*
|
*
|
||||||
* @memberOf ScanningResultService
|
* @memberOf ScanningResultService
|
||||||
*/
|
*/
|
||||||
@ -29,16 +30,14 @@ export abstract class ScanningResultService {
|
|||||||
tagId: string,
|
tagId: string,
|
||||||
queryParams?: RequestQueryParams
|
queryParams?: RequestQueryParams
|
||||||
):
|
):
|
||||||
| Observable<VulnerabilitySummary>
|
| Observable<VulnerabilitySummary>;
|
||||||
| Promise<VulnerabilitySummary>
|
|
||||||
| VulnerabilitySummary;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the detailed vulnerabilities scanning results.
|
* Get the detailed vulnerabilities scanning results.
|
||||||
*
|
*
|
||||||
* @abstract
|
* @abstract
|
||||||
* ** deprecated param {string} tagId
|
* ** deprecated param {string} tagId
|
||||||
* returns {(Observable<VulnerabilityItem[]> | Promise<VulnerabilityItem[]> | VulnerabilityItem[])}
|
* returns {(Observable<VulnerabilityItem[]>)}
|
||||||
*
|
*
|
||||||
* @memberOf ScanningResultService
|
* @memberOf ScanningResultService
|
||||||
*/
|
*/
|
||||||
@ -47,9 +46,7 @@ export abstract class ScanningResultService {
|
|||||||
tagId: string,
|
tagId: string,
|
||||||
queryParams?: RequestQueryParams
|
queryParams?: RequestQueryParams
|
||||||
):
|
):
|
||||||
| Observable<VulnerabilityItem[]>
|
| Observable<VulnerabilityItem[]>;
|
||||||
| Promise<VulnerabilityItem[]>
|
|
||||||
| VulnerabilityItem[];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start a new vulnerability scanning
|
* Start a new vulnerability scanning
|
||||||
@ -57,24 +54,24 @@ export abstract class ScanningResultService {
|
|||||||
* @abstract
|
* @abstract
|
||||||
* ** deprecated param {string} repoName
|
* ** deprecated param {string} repoName
|
||||||
* ** deprecated param {string} tagId
|
* ** deprecated param {string} tagId
|
||||||
* returns {(Observable<any> | Promise<any> | any)}
|
* returns {(Observable<any>)}
|
||||||
*
|
*
|
||||||
* @memberOf ScanningResultService
|
* @memberOf ScanningResultService
|
||||||
*/
|
*/
|
||||||
abstract startVulnerabilityScanning(
|
abstract startVulnerabilityScanning(
|
||||||
repoName: string,
|
repoName: string,
|
||||||
tagId: string
|
tagId: string
|
||||||
): Observable<any> | Promise<any> | any;
|
): Observable<any>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trigger the scanning all action.
|
* Trigger the scanning all action.
|
||||||
*
|
*
|
||||||
* @abstract
|
* @abstract
|
||||||
* returns {(Observable<any> | Promise<any> | any)}
|
* returns {(Observable<any>)}
|
||||||
*
|
*
|
||||||
* @memberOf ScanningResultService
|
* @memberOf ScanningResultService
|
||||||
*/
|
*/
|
||||||
abstract startScanningAll(): Observable<any> | Promise<any> | any;
|
abstract startScanningAll(): Observable<any>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@ -96,11 +93,9 @@ export class ScanningResultDefaultService extends ScanningResultService {
|
|||||||
tagId: string,
|
tagId: string,
|
||||||
queryParams?: RequestQueryParams
|
queryParams?: RequestQueryParams
|
||||||
):
|
):
|
||||||
| Observable<VulnerabilitySummary>
|
| Observable<VulnerabilitySummary> {
|
||||||
| Promise<VulnerabilitySummary>
|
|
||||||
| VulnerabilitySummary {
|
|
||||||
if (!repoName || repoName.trim() === "" || !tagId || tagId.trim() === "") {
|
if (!repoName || repoName.trim() === "" || !tagId || tagId.trim() === "") {
|
||||||
return Promise.reject("Bad argument");
|
return observableThrowError("Bad argument");
|
||||||
}
|
}
|
||||||
|
|
||||||
return of({} as VulnerabilitySummary);
|
return of({} as VulnerabilitySummary);
|
||||||
@ -111,11 +106,9 @@ export class ScanningResultDefaultService extends ScanningResultService {
|
|||||||
tagId: string,
|
tagId: string,
|
||||||
queryParams?: RequestQueryParams
|
queryParams?: RequestQueryParams
|
||||||
):
|
):
|
||||||
| Observable<VulnerabilityItem[]>
|
| Observable<VulnerabilityItem[]> {
|
||||||
| Promise<VulnerabilityItem[]>
|
|
||||||
| VulnerabilityItem[] {
|
|
||||||
if (!repoName || repoName.trim() === "" || !tagId || tagId.trim() === "") {
|
if (!repoName || repoName.trim() === "" || !tagId || tagId.trim() === "") {
|
||||||
return Promise.reject("Bad argument");
|
return observableThrowError("Bad argument");
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.http
|
return this.http
|
||||||
@ -123,17 +116,16 @@ export class ScanningResultDefaultService extends ScanningResultService {
|
|||||||
`${this._baseUrl}/${repoName}/tags/${tagId}/vulnerability/details`,
|
`${this._baseUrl}/${repoName}/tags/${tagId}/vulnerability/details`,
|
||||||
buildHttpRequestOptions(queryParams)
|
buildHttpRequestOptions(queryParams)
|
||||||
)
|
)
|
||||||
.toPromise()
|
.pipe(map(response => response.json() as VulnerabilityItem[])
|
||||||
.then(response => response.json() as VulnerabilityItem[])
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
startVulnerabilityScanning(
|
startVulnerabilityScanning(
|
||||||
repoName: string,
|
repoName: string,
|
||||||
tagId: string
|
tagId: string
|
||||||
): Observable<any> | Promise<any> | any {
|
): Observable<any> {
|
||||||
if (!repoName || repoName.trim() === "" || !tagId || tagId.trim() === "") {
|
if (!repoName || repoName.trim() === "" || !tagId || tagId.trim() === "") {
|
||||||
return Promise.reject("Bad argument");
|
return observableThrowError("Bad argument");
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.http
|
return this.http
|
||||||
@ -141,20 +133,18 @@ export class ScanningResultDefaultService extends ScanningResultService {
|
|||||||
`${this._baseUrl}/${repoName}/tags/${tagId}/scan`,
|
`${this._baseUrl}/${repoName}/tags/${tagId}/scan`,
|
||||||
HTTP_JSON_OPTIONS
|
HTTP_JSON_OPTIONS
|
||||||
)
|
)
|
||||||
.toPromise()
|
.pipe(map(() => {
|
||||||
.then(() => {
|
|
||||||
return true;
|
return true;
|
||||||
})
|
})
|
||||||
.catch(error => Promise.reject(error));
|
, catchError(error => observableThrowError(error)));
|
||||||
}
|
}
|
||||||
|
|
||||||
startScanningAll(): Observable<any> | Promise<any> | any {
|
startScanningAll(): Observable<any> {
|
||||||
return this.http
|
return this.http
|
||||||
.post(`${this._baseUrl}/scanAll`, HTTP_JSON_OPTIONS)
|
.post(`${this._baseUrl}/scanAll`, HTTP_JSON_OPTIONS)
|
||||||
.toPromise()
|
.pipe(map(() => {
|
||||||
.then(() => {
|
|
||||||
return true;
|
return true;
|
||||||
})
|
})
|
||||||
.catch(error => Promise.reject(error));
|
, catchError(error => observableThrowError(error)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
import { Inject, Injectable } from '@angular/core';
|
import { Inject, Injectable } from '@angular/core';
|
||||||
import { Http } from '@angular/http';
|
import { Http } from '@angular/http';
|
||||||
import { Observable } from "rxjs";
|
import { map, catchError } from "rxjs/operators";
|
||||||
|
import { Observable, throwError as observableThrowError } from "rxjs";
|
||||||
import { SystemInfo } from './interface';
|
import { SystemInfo } from './interface';
|
||||||
import { SERVICE_CONFIG, IServiceConfig } from '../service.config';
|
import { SERVICE_CONFIG, IServiceConfig } from '../service.config';
|
||||||
import {HTTP_GET_OPTIONS} from "../utils";
|
import {HTTP_GET_OPTIONS} from "../utils";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get System information about current backend server.
|
* Get System information about current backend server.
|
||||||
* @abstract
|
* @abstract
|
||||||
@ -15,7 +17,7 @@ export abstract class SystemInfoService {
|
|||||||
* @abstract
|
* @abstract
|
||||||
* returns
|
* returns
|
||||||
*/
|
*/
|
||||||
abstract getSystemInfo(): Observable<SystemInfo> | Promise<SystemInfo> | SystemInfo;
|
abstract getSystemInfo(): Observable<SystemInfo>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@ -25,12 +27,11 @@ export class SystemInfoDefaultService extends SystemInfoService {
|
|||||||
private http: Http) {
|
private http: Http) {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
getSystemInfo(): Observable<SystemInfo> | Promise<SystemInfo> | SystemInfo {
|
getSystemInfo(): Observable<SystemInfo> {
|
||||||
let url = this.config.systemInfoEndpoint ? this.config.systemInfoEndpoint : '/api/systeminfo';
|
let url = this.config.systemInfoEndpoint ? this.config.systemInfoEndpoint : '/api/systeminfo';
|
||||||
return this.http.get(url, HTTP_GET_OPTIONS)
|
return this.http.get(url, HTTP_GET_OPTIONS)
|
||||||
.toPromise()
|
.pipe(map(systemInfo => systemInfo.json() as SystemInfo)
|
||||||
.then(systemInfo => systemInfo.json() as SystemInfo)
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import { Injectable, Inject } from "@angular/core";
|
import { Injectable, Inject } from "@angular/core";
|
||||||
import { Http } from "@angular/http";
|
import { Http } from "@angular/http";
|
||||||
import { Observable } from "rxjs";
|
|
||||||
|
|
||||||
import { SERVICE_CONFIG, IServiceConfig } from "../service.config";
|
import { SERVICE_CONFIG, IServiceConfig } from "../service.config";
|
||||||
import {
|
import {
|
||||||
@ -10,6 +9,8 @@ import {
|
|||||||
} from "../utils";
|
} from "../utils";
|
||||||
import { RequestQueryParams } from "./RequestQueryParams";
|
import { RequestQueryParams } from "./RequestQueryParams";
|
||||||
import { Tag, Manifest } from "./interface";
|
import { Tag, Manifest } from "./interface";
|
||||||
|
import { map, catchError } from "rxjs/operators";
|
||||||
|
import { Observable, throwError as observableThrowError } from "rxjs";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For getting tag signatures.
|
* For getting tag signatures.
|
||||||
@ -40,14 +41,14 @@ export abstract class TagService {
|
|||||||
* @abstract
|
* @abstract
|
||||||
* ** deprecated param {string} repositoryName
|
* ** deprecated param {string} repositoryName
|
||||||
* ** deprecated param {RequestQueryParams} [queryParams]
|
* ** deprecated param {RequestQueryParams} [queryParams]
|
||||||
* returns {(Observable<Tag[]> | Promise<Tag[]> | Tag[])}
|
* returns {(Observable<Tag[]>)}
|
||||||
*
|
*
|
||||||
* @memberOf TagService
|
* @memberOf TagService
|
||||||
*/
|
*/
|
||||||
abstract getTags(
|
abstract getTags(
|
||||||
repositoryName: string,
|
repositoryName: string,
|
||||||
queryParams?: RequestQueryParams
|
queryParams?: RequestQueryParams
|
||||||
): Observable<Tag[]> | Promise<Tag[]> | Tag[];
|
): Observable<Tag[]>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete the specified tag.
|
* Delete the specified tag.
|
||||||
@ -62,7 +63,7 @@ export abstract class TagService {
|
|||||||
abstract deleteTag(
|
abstract deleteTag(
|
||||||
repositoryName: string,
|
repositoryName: string,
|
||||||
tag: string
|
tag: string
|
||||||
): Observable<any> | Promise<any> | any;
|
): Observable<any>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the specified tag.
|
* Get the specified tag.
|
||||||
@ -70,7 +71,7 @@ export abstract class TagService {
|
|||||||
* @abstract
|
* @abstract
|
||||||
* ** deprecated param {string} repositoryName
|
* ** deprecated param {string} repositoryName
|
||||||
* ** deprecated param {string} tag
|
* ** deprecated param {string} tag
|
||||||
* returns {(Observable<Tag> | Promise<Tag> | Tag)}
|
* returns {(Observable<Tag>)}
|
||||||
*
|
*
|
||||||
* @memberOf TagService
|
* @memberOf TagService
|
||||||
*/
|
*/
|
||||||
@ -78,31 +79,31 @@ export abstract class TagService {
|
|||||||
repositoryName: string,
|
repositoryName: string,
|
||||||
tag: string,
|
tag: string,
|
||||||
queryParams?: RequestQueryParams
|
queryParams?: RequestQueryParams
|
||||||
): Observable<Tag> | Promise<Tag> | Tag;
|
): Observable<Tag>;
|
||||||
|
|
||||||
abstract addLabelToImages(
|
abstract addLabelToImages(
|
||||||
repoName: string,
|
repoName: string,
|
||||||
tagName: string,
|
tagName: string,
|
||||||
labelId: number
|
labelId: number
|
||||||
): Observable<any> | Promise<any> | any;
|
): Observable<any>;
|
||||||
abstract deleteLabelToImages(
|
abstract deleteLabelToImages(
|
||||||
repoName: string,
|
repoName: string,
|
||||||
tagName: string,
|
tagName: string,
|
||||||
labelId: number
|
labelId: number
|
||||||
): Observable<any> | Promise<any> | any;
|
): Observable<any>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get manifest of tag under the specified repository.
|
* Get manifest of tag under the specified repository.
|
||||||
*
|
*
|
||||||
* @abstract
|
* @abstract
|
||||||
* returns {(Observable<Manifest> | Promise<Manifest> | Manifest)}
|
* returns {(Observable<Manifest>)}
|
||||||
*
|
*
|
||||||
* @memberOf TagService
|
* @memberOf TagService
|
||||||
*/
|
*/
|
||||||
abstract getManifest(
|
abstract getManifest(
|
||||||
repositoryName: string,
|
repositoryName: string,
|
||||||
tag: string
|
tag: string
|
||||||
): Observable<Manifest> | Promise<Manifest> | Manifest;
|
): Observable<Manifest>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -134,7 +135,7 @@ export class TagDefaultService extends TagService {
|
|||||||
_getTags(
|
_getTags(
|
||||||
repositoryName: string,
|
repositoryName: string,
|
||||||
queryParams?: RequestQueryParams
|
queryParams?: RequestQueryParams
|
||||||
): Promise<Tag[]> {
|
): Observable<Tag[]> {
|
||||||
if (!queryParams) {
|
if (!queryParams) {
|
||||||
queryParams = new RequestQueryParams();
|
queryParams = new RequestQueryParams();
|
||||||
}
|
}
|
||||||
@ -144,26 +145,24 @@ export class TagDefaultService extends TagService {
|
|||||||
|
|
||||||
return this.http
|
return this.http
|
||||||
.get(url, buildHttpRequestOptions(queryParams))
|
.get(url, buildHttpRequestOptions(queryParams))
|
||||||
.toPromise()
|
.pipe(map(response => response.json() as Tag[])
|
||||||
.then(response => response.json() as Tag[])
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_getSignatures(repositoryName: string): Promise<VerifiedSignature[]> {
|
_getSignatures(repositoryName: string): Observable<VerifiedSignature[]> {
|
||||||
let url: string = `${this._baseUrl}/${repositoryName}/signatures`;
|
let url: string = `${this._baseUrl}/${repositoryName}/signatures`;
|
||||||
return this.http
|
return this.http
|
||||||
.get(url, HTTP_GET_OPTIONS)
|
.get(url, HTTP_GET_OPTIONS)
|
||||||
.toPromise()
|
.pipe(map(response => response.json() as VerifiedSignature[])
|
||||||
.then(response => response.json() as VerifiedSignature[])
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public getTags(
|
public getTags(
|
||||||
repositoryName: string,
|
repositoryName: string,
|
||||||
queryParams?: RequestQueryParams
|
queryParams?: RequestQueryParams
|
||||||
): Observable<Tag[]> | Promise<Tag[]> | Tag[] {
|
): Observable<Tag[]> {
|
||||||
if (!repositoryName) {
|
if (!repositoryName) {
|
||||||
return Promise.reject("Bad argument");
|
return observableThrowError("Bad argument");
|
||||||
}
|
}
|
||||||
return this._getTags(repositoryName, queryParams);
|
return this._getTags(repositoryName, queryParams);
|
||||||
}
|
}
|
||||||
@ -171,43 +170,41 @@ export class TagDefaultService extends TagService {
|
|||||||
public deleteTag(
|
public deleteTag(
|
||||||
repositoryName: string,
|
repositoryName: string,
|
||||||
tag: string
|
tag: string
|
||||||
): Observable<any> | Promise<Tag> | any {
|
): Observable<any> {
|
||||||
if (!repositoryName || !tag) {
|
if (!repositoryName || !tag) {
|
||||||
return Promise.reject("Bad argument");
|
return observableThrowError("Bad argument");
|
||||||
}
|
}
|
||||||
|
|
||||||
let url: string = `${this._baseUrl}/${repositoryName}/tags/${tag}`;
|
let url: string = `${this._baseUrl}/${repositoryName}/tags/${tag}`;
|
||||||
return this.http
|
return this.http
|
||||||
.delete(url, HTTP_JSON_OPTIONS)
|
.delete(url, HTTP_JSON_OPTIONS)
|
||||||
.toPromise()
|
.pipe(map(response => response)
|
||||||
.then(response => response)
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public getTag(
|
public getTag(
|
||||||
repositoryName: string,
|
repositoryName: string,
|
||||||
tag: string,
|
tag: string,
|
||||||
queryParams?: RequestQueryParams
|
queryParams?: RequestQueryParams
|
||||||
): Observable<Tag> | Promise<Tag> | Tag {
|
): Observable<Tag> {
|
||||||
if (!repositoryName || !tag) {
|
if (!repositoryName || !tag) {
|
||||||
return Promise.reject("Bad argument");
|
return observableThrowError("Bad argument");
|
||||||
}
|
}
|
||||||
|
|
||||||
let url: string = `${this._baseUrl}/${repositoryName}/tags/${tag}`;
|
let url: string = `${this._baseUrl}/${repositoryName}/tags/${tag}`;
|
||||||
return this.http
|
return this.http
|
||||||
.get(url, HTTP_GET_OPTIONS)
|
.get(url, HTTP_GET_OPTIONS)
|
||||||
.toPromise()
|
.pipe(map(response => response.json() as Tag)
|
||||||
.then(response => response.json() as Tag)
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public addLabelToImages(
|
public addLabelToImages(
|
||||||
repoName: string,
|
repoName: string,
|
||||||
tagName: string,
|
tagName: string,
|
||||||
labelId: number
|
labelId: number
|
||||||
): Observable<any> | Promise<any> | any {
|
): Observable<any> {
|
||||||
if (!labelId || !tagName || !repoName) {
|
if (!labelId || !tagName || !repoName) {
|
||||||
return Promise.reject("Invalid parameters.");
|
return observableThrowError("Invalid parameters.");
|
||||||
}
|
}
|
||||||
|
|
||||||
let _addLabelToImageUrl = `${
|
let _addLabelToImageUrl = `${
|
||||||
@ -215,18 +212,17 @@ export class TagDefaultService extends TagService {
|
|||||||
}/${repoName}/tags/${tagName}/labels`;
|
}/${repoName}/tags/${tagName}/labels`;
|
||||||
return this.http
|
return this.http
|
||||||
.post(_addLabelToImageUrl, { id: labelId }, HTTP_JSON_OPTIONS)
|
.post(_addLabelToImageUrl, { id: labelId }, HTTP_JSON_OPTIONS)
|
||||||
.toPromise()
|
.pipe(map(response => response.status)
|
||||||
.then(response => response.status)
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public deleteLabelToImages(
|
public deleteLabelToImages(
|
||||||
repoName: string,
|
repoName: string,
|
||||||
tagName: string,
|
tagName: string,
|
||||||
labelId: number
|
labelId: number
|
||||||
): Observable<any> | Promise<any> | any {
|
): Observable<any> {
|
||||||
if (!labelId || !tagName || !repoName) {
|
if (!labelId || !tagName || !repoName) {
|
||||||
return Promise.reject("Invalid parameters.");
|
return observableThrowError("Invalid parameters.");
|
||||||
}
|
}
|
||||||
|
|
||||||
let _addLabelToImageUrl = `${
|
let _addLabelToImageUrl = `${
|
||||||
@ -234,23 +230,21 @@ export class TagDefaultService extends TagService {
|
|||||||
}/${repoName}/tags/${tagName}/labels/${labelId}`;
|
}/${repoName}/tags/${tagName}/labels/${labelId}`;
|
||||||
return this.http
|
return this.http
|
||||||
.delete(_addLabelToImageUrl)
|
.delete(_addLabelToImageUrl)
|
||||||
.toPromise()
|
.pipe(map(response => response.status)
|
||||||
.then(response => response.status)
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public getManifest(
|
public getManifest(
|
||||||
repositoryName: string,
|
repositoryName: string,
|
||||||
tag: string
|
tag: string
|
||||||
): Observable<Manifest> | Promise<Manifest> | Manifest {
|
): Observable<Manifest> {
|
||||||
if (!repositoryName || !tag) {
|
if (!repositoryName || !tag) {
|
||||||
return Promise.reject("Bad argument");
|
return observableThrowError("Bad argument");
|
||||||
}
|
}
|
||||||
let url: string = `${this._baseUrl}/${repositoryName}/tags/${tag}/manifest`;
|
let url: string = `${this._baseUrl}/${repositoryName}/tags/${tag}/manifest`;
|
||||||
return this.http
|
return this.http
|
||||||
.get(url, HTTP_GET_OPTIONS)
|
.get(url, HTTP_GET_OPTIONS)
|
||||||
.toPromise()
|
.pipe(map(response => response.json() as Manifest)
|
||||||
.then(response => response.json() as Manifest)
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,7 @@ describe("TagDetailComponent (inline template)", () => {
|
|||||||
|
|
||||||
tagService = fixture.debugElement.injector.get(TagService);
|
tagService = fixture.debugElement.injector.get(TagService);
|
||||||
spy = spyOn(tagService, "getTag").and.returnValues(
|
spy = spyOn(tagService, "getTag").and.returnValues(
|
||||||
Promise.resolve(mockTag)
|
of(mockTag)
|
||||||
);
|
);
|
||||||
|
|
||||||
let mockData: VulnerabilityItem[] = [];
|
let mockData: VulnerabilityItem[] = [];
|
||||||
@ -156,9 +156,9 @@ describe("TagDetailComponent (inline template)", () => {
|
|||||||
vulSpy = spyOn(
|
vulSpy = spyOn(
|
||||||
scanningService,
|
scanningService,
|
||||||
"getVulnerabilityScanningResults"
|
"getVulnerabilityScanningResults"
|
||||||
).and.returnValue(Promise.resolve(mockData));
|
).and.returnValue(of(mockData));
|
||||||
manifestSpy = spyOn(tagService, "getManifest").and.returnValues(
|
manifestSpy = spyOn(tagService, "getManifest").and.returnValues(
|
||||||
Promise.resolve(mockManifest)
|
of(mockManifest)
|
||||||
);
|
);
|
||||||
userPermissionService = fixture.debugElement.injector.get(UserPermissionService);
|
userPermissionService = fixture.debugElement.injector.get(UserPermissionService);
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import { Component, Input, Output, EventEmitter, OnInit } from "@angular/core";
|
import { Component, Input, Output, EventEmitter, OnInit } from "@angular/core";
|
||||||
|
|
||||||
import { TagService, Tag, VulnerabilitySeverity } from "../service/index";
|
import { TagService, Tag, VulnerabilitySeverity } from "../service/index";
|
||||||
import { toPromise } from "../utils";
|
|
||||||
import { ErrorHandler } from "../error-handler/index";
|
import { ErrorHandler } from "../error-handler/index";
|
||||||
import { Label } from "../service/interface";
|
import { Label } from "../service/interface";
|
||||||
import { forkJoin } from "rxjs";
|
import { forkJoin } from "rxjs";
|
||||||
@ -63,8 +62,8 @@ export class TagDetailComponent implements OnInit {
|
|||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
if (this.repositoryId && this.tagId) {
|
if (this.repositoryId && this.tagId) {
|
||||||
toPromise<Tag>(this.tagService.getTag(this.repositoryId, this.tagId))
|
this.tagService.getTag(this.repositoryId, this.tagId)
|
||||||
.then(response => {
|
.subscribe(response => {
|
||||||
this.tagDetails = response;
|
this.tagDetails = response;
|
||||||
if (
|
if (
|
||||||
this.tagDetails &&
|
this.tagDetails &&
|
||||||
@ -91,8 +90,7 @@ export class TagDetailComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
}, error => this.errorHandler.error(error));
|
||||||
.catch(error => this.errorHandler.error(error));
|
|
||||||
}
|
}
|
||||||
this.getTagPermissions(this.projectId);
|
this.getTagPermissions(this.projectId);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import { Component, Input, Output, EventEmitter, OnInit } from "@angular/core";
|
import { Component, Input, Output, EventEmitter, OnInit } from "@angular/core";
|
||||||
import { TagService, Manifest } from "../service/index";
|
import { TagService, Manifest } from "../service/index";
|
||||||
import { toPromise } from "../utils";
|
|
||||||
import { ErrorHandler } from "../error-handler/index";
|
import { ErrorHandler } from "../error-handler/index";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -36,10 +35,8 @@ export class TagHistoryComponent implements OnInit {
|
|||||||
|
|
||||||
retrieve(repositoryId: string, tagId: string) {
|
retrieve(repositoryId: string, tagId: string) {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
toPromise<Manifest>(
|
|
||||||
this.tagService.getManifest(this.repositoryId, this.tagId)
|
this.tagService.getManifest(this.repositoryId, this.tagId)
|
||||||
)
|
.subscribe(data => {
|
||||||
.then(data => {
|
|
||||||
this.config = JSON.parse(data.config);
|
this.config = JSON.parse(data.config);
|
||||||
this.config.history.forEach((ele: any) => {
|
this.config.history.forEach((ele: any) => {
|
||||||
if (ele.created_by !== undefined) {
|
if (ele.created_by !== undefined) {
|
||||||
@ -53,8 +50,7 @@ export class TagHistoryComponent implements OnInit {
|
|||||||
this.history.push(ele);
|
this.history.push(ele);
|
||||||
});
|
});
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.errorHandler.error(error);
|
this.errorHandler.error(error);
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
|
@ -24,6 +24,7 @@ import { UserPermissionService, UserPermissionDefaultService } from "../service/
|
|||||||
import { USERSTATICPERMISSION } from "../service/permission-static";
|
import { USERSTATICPERMISSION } from "../service/permission-static";
|
||||||
import { OperationService } from "../operation/operation.service";
|
import { OperationService } from "../operation/operation.service";
|
||||||
import { Observable, of } from "rxjs";
|
import { Observable, of } from "rxjs";
|
||||||
|
import { delay } from "rxjs/operators";
|
||||||
|
|
||||||
describe("TagComponent (inline template)", () => {
|
describe("TagComponent (inline template)", () => {
|
||||||
|
|
||||||
@ -151,7 +152,7 @@ describe("TagComponent (inline template)", () => {
|
|||||||
|
|
||||||
|
|
||||||
tagService = fixture.debugElement.injector.get(TagService);
|
tagService = fixture.debugElement.injector.get(TagService);
|
||||||
spy = spyOn(tagService, "getTags").and.returnValues(Promise.resolve(mockTags));
|
spy = spyOn(tagService, "getTags").and.returnValues(of(mockTags).pipe(delay(0)));
|
||||||
userPermissionService = fixture.debugElement.injector.get(UserPermissionService);
|
userPermissionService = fixture.debugElement.injector.get(UserPermissionService);
|
||||||
|
|
||||||
spyOn(userPermissionService, "getPermission")
|
spyOn(userPermissionService, "getPermission")
|
||||||
@ -166,8 +167,8 @@ describe("TagComponent (inline template)", () => {
|
|||||||
|
|
||||||
labelService = fixture.debugElement.injector.get(LabelService);
|
labelService = fixture.debugElement.injector.get(LabelService);
|
||||||
|
|
||||||
spyLabels = spyOn(labelService, "getGLabels").and.returnValues(Promise.resolve(mockLabels));
|
spyLabels = spyOn(labelService, "getGLabels").and.returnValues(of(mockLabels).pipe(delay(0)));
|
||||||
spyLabels1 = spyOn(labelService, "getPLabels").withArgs(comp.projectId).and.returnValues(Promise.resolve(mockLabels1));
|
spyLabels1 = spyOn(labelService, "getPLabels").withArgs(comp.projectId).and.returnValues(of(mockLabels1).pipe(delay(0)));
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
|
@ -42,7 +42,6 @@ import { ConfirmationAcknowledgement } from "../confirmation-dialog/confirmation
|
|||||||
import { Label, Tag, TagClickEvent, RetagRequest } from "../service/interface";
|
import { Label, Tag, TagClickEvent, RetagRequest } from "../service/interface";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
toPromise,
|
|
||||||
CustomComparator,
|
CustomComparator,
|
||||||
calculatePage,
|
calculatePage,
|
||||||
doFiltering,
|
doFiltering,
|
||||||
@ -59,7 +58,8 @@ import { USERSTATICPERMISSION } from "../service/permission-static";
|
|||||||
import { operateChanges, OperateInfo, OperationState } from "../operation/operate";
|
import { operateChanges, OperateInfo, OperationState } from "../operation/operate";
|
||||||
import { OperationService } from "../operation/operation.service";
|
import { OperationService } from "../operation/operation.service";
|
||||||
import { ImageNameInputComponent } from "../image-name-input/image-name-input.component";
|
import { ImageNameInputComponent } from "../image-name-input/image-name-input.component";
|
||||||
|
import { map, catchError } from "rxjs/operators";
|
||||||
|
import { Observable, throwError as observableThrowError } from "rxjs";
|
||||||
export interface LabelState {
|
export interface LabelState {
|
||||||
iconsShow: boolean;
|
iconsShow: boolean;
|
||||||
label: Label;
|
label: Label;
|
||||||
@ -263,18 +263,17 @@ export class TagComponent implements OnInit, AfterViewInit {
|
|||||||
|
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
|
||||||
toPromise<Tag[]>(this.tagService.getTags(
|
this.tagService.getTags(
|
||||||
this.repoName,
|
this.repoName,
|
||||||
params))
|
params)
|
||||||
.then((tags: Tag[]) => {
|
.subscribe((tags: Tag[]) => {
|
||||||
this.signedCon = {};
|
this.signedCon = {};
|
||||||
// Do filtering and sorting
|
// Do filtering and sorting
|
||||||
this.tags = doFiltering<Tag>(tags, state);
|
this.tags = doFiltering<Tag>(tags, state);
|
||||||
this.tags = doSorting<Tag>(this.tags, state);
|
this.tags = doSorting<Tag>(this.tags, state);
|
||||||
|
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.errorHandler.error(error);
|
this.errorHandler.error(error);
|
||||||
});
|
});
|
||||||
@ -339,7 +338,7 @@ export class TagComponent implements OnInit, AfterViewInit {
|
|||||||
this.inprogress = true;
|
this.inprogress = true;
|
||||||
let labelId = labelInfo.label.id;
|
let labelId = labelInfo.label.id;
|
||||||
this.selectedRow = this.selectedTag;
|
this.selectedRow = this.selectedTag;
|
||||||
toPromise<any>(this.tagService.addLabelToImages(this.repoName, this.selectedRow[0].name, labelId)).then(res => {
|
this.tagService.addLabelToImages(this.repoName, this.selectedRow[0].name, labelId).subscribe(res => {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
|
|
||||||
// set the selected label in front
|
// set the selected label in front
|
||||||
@ -358,7 +357,7 @@ export class TagComponent implements OnInit, AfterViewInit {
|
|||||||
|
|
||||||
labelInfo.iconsShow = true;
|
labelInfo.iconsShow = true;
|
||||||
this.inprogress = false;
|
this.inprogress = false;
|
||||||
}).catch(err => {
|
}, err => {
|
||||||
this.inprogress = false;
|
this.inprogress = false;
|
||||||
this.errorHandler.error(err);
|
this.errorHandler.error(err);
|
||||||
});
|
});
|
||||||
@ -370,14 +369,14 @@ export class TagComponent implements OnInit, AfterViewInit {
|
|||||||
this.inprogress = true;
|
this.inprogress = true;
|
||||||
let labelId = labelInfo.label.id;
|
let labelId = labelInfo.label.id;
|
||||||
this.selectedRow = this.selectedTag;
|
this.selectedRow = this.selectedTag;
|
||||||
toPromise<any>(this.tagService.deleteLabelToImages(this.repoName, this.selectedRow[0].name, labelId)).then(res => {
|
this.tagService.deleteLabelToImages(this.repoName, this.selectedRow[0].name, labelId).subscribe(res => {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
|
|
||||||
// insert the unselected label to groups with the same icons
|
// insert the unselected label to groups with the same icons
|
||||||
this.sortOperation(this.imageStickLabels, labelInfo);
|
this.sortOperation(this.imageStickLabels, labelInfo);
|
||||||
labelInfo.iconsShow = false;
|
labelInfo.iconsShow = false;
|
||||||
this.inprogress = false;
|
this.inprogress = false;
|
||||||
}).catch(err => {
|
}, err => {
|
||||||
this.inprogress = false;
|
this.inprogress = false;
|
||||||
this.errorHandler.error(err);
|
this.errorHandler.error(err);
|
||||||
});
|
});
|
||||||
@ -520,9 +519,9 @@ export class TagComponent implements OnInit, AfterViewInit {
|
|||||||
let signatures: string[] = [];
|
let signatures: string[] = [];
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
|
||||||
toPromise<Tag[]>(this.tagService
|
this.tagService
|
||||||
.getTags(this.repoName))
|
.getTags(this.repoName)
|
||||||
.then(items => {
|
.subscribe(items => {
|
||||||
// To keep easy use for vulnerability bar
|
// To keep easy use for vulnerability bar
|
||||||
items.forEach((t: Tag) => {
|
items.forEach((t: Tag) => {
|
||||||
if (!t.scan_overview) {
|
if (!t.scan_overview) {
|
||||||
@ -548,8 +547,7 @@ export class TagComponent implements OnInit, AfterViewInit {
|
|||||||
if (this.tags && this.tags.length === 0) {
|
if (this.tags && this.tags.length === 0) {
|
||||||
this.refreshRepo.emit(true);
|
this.refreshRepo.emit(true);
|
||||||
}
|
}
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.errorHandler.error(error);
|
this.errorHandler.error(error);
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
@ -629,12 +627,12 @@ export class TagComponent implements OnInit, AfterViewInit {
|
|||||||
&& message.state === ConfirmationState.CONFIRMED) {
|
&& message.state === ConfirmationState.CONFIRMED) {
|
||||||
let tags: Tag[] = message.data;
|
let tags: Tag[] = message.data;
|
||||||
if (tags && tags.length) {
|
if (tags && tags.length) {
|
||||||
let promiseLists: any[] = [];
|
let observableLists: any[] = [];
|
||||||
tags.forEach(tag => {
|
tags.forEach(tag => {
|
||||||
promiseLists.push(this.delOperate(tag));
|
observableLists.push(this.delOperate(tag));
|
||||||
});
|
});
|
||||||
|
|
||||||
Promise.all(promiseLists).then((item) => {
|
forkJoin(...observableLists).subscribe((item) => {
|
||||||
this.selectedRow = [];
|
this.selectedRow = [];
|
||||||
this.retrieve();
|
this.retrieve();
|
||||||
});
|
});
|
||||||
@ -642,7 +640,7 @@ export class TagComponent implements OnInit, AfterViewInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delOperate(tag: Tag) {
|
delOperate(tag: Tag): Observable<any> | null {
|
||||||
// init operation info
|
// init operation info
|
||||||
let operMessage = new OperateInfo();
|
let operMessage = new OperateInfo();
|
||||||
operMessage.name = 'OPERATION.DELETE_TAG';
|
operMessage.name = 'OPERATION.DELETE_TAG';
|
||||||
@ -661,26 +659,25 @@ export class TagComponent implements OnInit, AfterViewInit {
|
|||||||
operateChanges(operMessage, OperationState.failure, wrongInfo);
|
operateChanges(operMessage, OperationState.failure, wrongInfo);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
return toPromise<number>(this.tagService
|
return this.tagService
|
||||||
.deleteTag(this.repoName, tag.name))
|
.deleteTag(this.repoName, tag.name)
|
||||||
.then(
|
.pipe(map(
|
||||||
response => {
|
response => {
|
||||||
this.translateService.get("BATCH.DELETED_SUCCESS")
|
this.translateService.get("BATCH.DELETED_SUCCESS")
|
||||||
.subscribe(res => {
|
.subscribe(res => {
|
||||||
operateChanges(operMessage, OperationState.success);
|
operateChanges(operMessage, OperationState.success);
|
||||||
});
|
});
|
||||||
}).catch(error => {
|
}), catchError(error => {
|
||||||
if (error.status === 503) {
|
if (error.status === 503) {
|
||||||
forkJoin(this.translateService.get('BATCH.DELETED_FAILURE'),
|
return forkJoin(this.translateService.get('BATCH.DELETED_FAILURE'),
|
||||||
this.translateService.get('REPOSITORY.TAGS_NO_DELETE')).subscribe(res => {
|
this.translateService.get('REPOSITORY.TAGS_NO_DELETE')).pipe(map(res => {
|
||||||
operateChanges(operMessage, OperationState.failure, res[1]);
|
operateChanges(operMessage, OperationState.failure, res[1]);
|
||||||
});
|
}));
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
this.translateService.get("BATCH.DELETED_FAILURE").subscribe(res => {
|
return this.translateService.get("BATCH.DELETED_FAILURE").pipe(map(res => {
|
||||||
operateChanges(operMessage, OperationState.failure, res);
|
operateChanges(operMessage, OperationState.failure, res);
|
||||||
});
|
}));
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@ import {
|
|||||||
Tag
|
Tag
|
||||||
} from '../service/index';
|
} from '../service/index';
|
||||||
import { ErrorHandler } from '../error-handler/index';
|
import { ErrorHandler } from '../error-handler/index';
|
||||||
import { toPromise } from '../utils';
|
|
||||||
import { ChannelService } from '../channel/index';
|
import { ChannelService } from '../channel/index';
|
||||||
import { JobLogService } from "../service/index";
|
import { JobLogService } from "../service/index";
|
||||||
|
|
||||||
@ -111,8 +110,8 @@ export class ResultBarChartComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
this.onSubmitting = true;
|
this.onSubmitting = true;
|
||||||
|
|
||||||
toPromise<any>(this.scanningService.startVulnerabilityScanning(this.repoName, this.tagId))
|
this.scanningService.startVulnerabilityScanning(this.repoName, this.tagId)
|
||||||
.then(() => {
|
.subscribe(() => {
|
||||||
this.onSubmitting = false;
|
this.onSubmitting = false;
|
||||||
|
|
||||||
// Forcely change status to queued after successful submitting
|
// Forcely change status to queued after successful submitting
|
||||||
@ -133,8 +132,7 @@ export class ResultBarChartComponent implements OnInit, OnDestroy {
|
|||||||
this.getSummary();
|
this.getSummary();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.onSubmitting = false;
|
this.onSubmitting = false;
|
||||||
this.errorHandler.error(error);
|
this.errorHandler.error(error);
|
||||||
});
|
});
|
||||||
@ -145,8 +143,8 @@ export class ResultBarChartComponent implements OnInit, OnDestroy {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
toPromise<Tag>(this.tagService.getTag(this.repoName, this.tagId))
|
this.tagService.getTag(this.repoName, this.tagId)
|
||||||
.then((t: Tag) => {
|
.subscribe((t: Tag) => {
|
||||||
// To keep the same summary reference, use value copy.
|
// To keep the same summary reference, use value copy.
|
||||||
this.copyValue(t.scan_overview);
|
this.copyValue(t.scan_overview);
|
||||||
|
|
||||||
@ -160,8 +158,7 @@ export class ResultBarChartComponent implements OnInit, OnDestroy {
|
|||||||
this.stateCheckTimer = null;
|
this.stateCheckTimer = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.errorHandler.error(error);
|
this.errorHandler.error(error);
|
||||||
this.retryCounter++;
|
this.retryCounter++;
|
||||||
if (this.retryCounter >= RETRY_TIMES) {
|
if (this.retryCounter >= RETRY_TIMES) {
|
||||||
|
@ -64,7 +64,7 @@ describe('ResultGridComponent (inline template)', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
spy = spyOn(scanningService, 'getVulnerabilityScanningResults')
|
spy = spyOn(scanningService, 'getVulnerabilityScanningResults')
|
||||||
.and.returnValue(Promise.resolve(mockData));
|
.and.returnValue(of(mockData));
|
||||||
|
|
||||||
|
|
||||||
userPermissionService = fixture.debugElement.injector.get(UserPermissionService);
|
userPermissionService = fixture.debugElement.injector.get(UserPermissionService);
|
||||||
|
@ -7,7 +7,6 @@ import {
|
|||||||
import { ErrorHandler } from '../error-handler/index';
|
import { ErrorHandler } from '../error-handler/index';
|
||||||
import { forkJoin } from "rxjs";
|
import { forkJoin } from "rxjs";
|
||||||
|
|
||||||
import { toPromise } from '../utils';
|
|
||||||
import { ChannelService } from "../channel/channel.service";
|
import { ChannelService } from "../channel/channel.service";
|
||||||
import { UserPermissionService } from "../service/permission.service";
|
import { UserPermissionService } from "../service/permission.service";
|
||||||
import { USERSTATICPERMISSION } from "../service/permission-static";
|
import { USERSTATICPERMISSION } from "../service/permission-static";
|
||||||
@ -37,12 +36,11 @@ export class ResultGridComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
loadResults(repositoryId: string, tagId: string): void {
|
loadResults(repositoryId: string, tagId: string): void {
|
||||||
toPromise<VulnerabilityItem[]>(this.scanningService.getVulnerabilityScanningResults(repositoryId, tagId))
|
this.scanningService.getVulnerabilityScanningResults(repositoryId, tagId)
|
||||||
.then((results: VulnerabilityItem[]) => {
|
.subscribe((results: VulnerabilityItem[]) => {
|
||||||
this.dataCache = results;
|
this.dataCache = results;
|
||||||
this.scanningResults = this.dataCache.filter((item: VulnerabilityItem) => item.id !== '');
|
this.scanningResults = this.dataCache.filter((item: VulnerabilityItem) => item.id !== '');
|
||||||
})
|
}, error => { this.errorHandler.error(error); });
|
||||||
.catch(error => { this.errorHandler.error(error); });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Should query from back-end service
|
// TODO: Should query from back-end service
|
||||||
|
45
src/portal/package-lock.json
generated
45
src/portal/package-lock.json
generated
@ -134,15 +134,13 @@
|
|||||||
"version": "1.37.0",
|
"version": "1.37.0",
|
||||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.37.0.tgz",
|
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.37.0.tgz",
|
||||||
"integrity": "sha512-R3C4db6bgQhlIhPU48fUtdVmKnflq+hRdad7IyKhtFj06VPNVdk2RhiYL3UjQIlso8L+YxAtFkobT0VK+S/ybg==",
|
"integrity": "sha512-R3C4db6bgQhlIhPU48fUtdVmKnflq+hRdad7IyKhtFj06VPNVdk2RhiYL3UjQIlso8L+YxAtFkobT0VK+S/ybg==",
|
||||||
"dev": true,
|
"dev": true
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"mime-types": {
|
"mime-types": {
|
||||||
"version": "2.1.21",
|
"version": "2.1.21",
|
||||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.21.tgz",
|
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.21.tgz",
|
||||||
"integrity": "sha512-3iL6DbwpyLzjR3xHSFNFeb9Nz/M8WDkX33t1GFQnFOllWk8pOrh/LSrB5OXlnlW5P9LH73X6loW/eogc+F5lJg==",
|
"integrity": "sha512-3iL6DbwpyLzjR3xHSFNFeb9Nz/M8WDkX33t1GFQnFOllWk8pOrh/LSrB5OXlnlW5P9LH73X6loW/eogc+F5lJg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"mime-db": "~1.37.0"
|
"mime-db": "~1.37.0"
|
||||||
}
|
}
|
||||||
@ -6286,8 +6284,7 @@
|
|||||||
"ansi-regex": {
|
"ansi-regex": {
|
||||||
"version": "2.1.1",
|
"version": "2.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
|
||||||
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
|
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8="
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"aproba": {
|
"aproba": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
@ -6308,14 +6305,12 @@
|
|||||||
"balanced-match": {
|
"balanced-match": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||||
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
|
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"brace-expansion": {
|
"brace-expansion": {
|
||||||
"version": "1.1.11",
|
"version": "1.1.11",
|
||||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"balanced-match": "^1.0.0",
|
"balanced-match": "^1.0.0",
|
||||||
"concat-map": "0.0.1"
|
"concat-map": "0.0.1"
|
||||||
@ -6330,20 +6325,17 @@
|
|||||||
"code-point-at": {
|
"code-point-at": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
|
||||||
"integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=",
|
"integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c="
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"concat-map": {
|
"concat-map": {
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||||
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
|
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"console-control-strings": {
|
"console-control-strings": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",
|
||||||
"integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=",
|
"integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4="
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"core-util-is": {
|
"core-util-is": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
@ -6460,8 +6452,7 @@
|
|||||||
"inherits": {
|
"inherits": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
|
||||||
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=",
|
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"ini": {
|
"ini": {
|
||||||
"version": "1.3.5",
|
"version": "1.3.5",
|
||||||
@ -6473,7 +6464,6 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
|
||||||
"integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
|
"integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"number-is-nan": "^1.0.0"
|
"number-is-nan": "^1.0.0"
|
||||||
}
|
}
|
||||||
@ -6488,7 +6478,6 @@
|
|||||||
"version": "3.0.4",
|
"version": "3.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||||
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"brace-expansion": "^1.1.7"
|
"brace-expansion": "^1.1.7"
|
||||||
}
|
}
|
||||||
@ -6496,14 +6485,12 @@
|
|||||||
"minimist": {
|
"minimist": {
|
||||||
"version": "0.0.8",
|
"version": "0.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
|
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
|
||||||
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
|
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"minipass": {
|
"minipass": {
|
||||||
"version": "2.2.4",
|
"version": "2.2.4",
|
||||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-2.2.4.tgz",
|
"resolved": "https://registry.npmjs.org/minipass/-/minipass-2.2.4.tgz",
|
||||||
"integrity": "sha512-hzXIWWet/BzWhYs2b+u7dRHlruXhwdgvlTMDKC6Cb1U7ps6Ac6yQlR39xsbjWJE377YTCtKwIXIpJ5oP+j5y8g==",
|
"integrity": "sha512-hzXIWWet/BzWhYs2b+u7dRHlruXhwdgvlTMDKC6Cb1U7ps6Ac6yQlR39xsbjWJE377YTCtKwIXIpJ5oP+j5y8g==",
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"safe-buffer": "^5.1.1",
|
"safe-buffer": "^5.1.1",
|
||||||
"yallist": "^3.0.0"
|
"yallist": "^3.0.0"
|
||||||
@ -6522,7 +6509,6 @@
|
|||||||
"version": "0.5.1",
|
"version": "0.5.1",
|
||||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
|
||||||
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
|
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"minimist": "0.0.8"
|
"minimist": "0.0.8"
|
||||||
}
|
}
|
||||||
@ -6603,8 +6589,7 @@
|
|||||||
"number-is-nan": {
|
"number-is-nan": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz",
|
||||||
"integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=",
|
"integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0="
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"object-assign": {
|
"object-assign": {
|
||||||
"version": "4.1.1",
|
"version": "4.1.1",
|
||||||
@ -6616,7 +6601,6 @@
|
|||||||
"version": "1.4.0",
|
"version": "1.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||||
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"wrappy": "1"
|
"wrappy": "1"
|
||||||
}
|
}
|
||||||
@ -6702,8 +6686,7 @@
|
|||||||
"safe-buffer": {
|
"safe-buffer": {
|
||||||
"version": "5.1.1",
|
"version": "5.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",
|
||||||
"integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==",
|
"integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg=="
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"safer-buffer": {
|
"safer-buffer": {
|
||||||
"version": "2.1.2",
|
"version": "2.1.2",
|
||||||
@ -6739,7 +6722,6 @@
|
|||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
|
||||||
"integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
|
"integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"code-point-at": "^1.0.0",
|
"code-point-at": "^1.0.0",
|
||||||
"is-fullwidth-code-point": "^1.0.0",
|
"is-fullwidth-code-point": "^1.0.0",
|
||||||
@ -6759,7 +6741,6 @@
|
|||||||
"version": "3.0.1",
|
"version": "3.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
|
||||||
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
|
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
|
||||||
"optional": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"ansi-regex": "^2.0.0"
|
"ansi-regex": "^2.0.0"
|
||||||
}
|
}
|
||||||
@ -6803,14 +6784,12 @@
|
|||||||
"wrappy": {
|
"wrappy": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
|
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"yallist": {
|
"yallist": {
|
||||||
"version": "3.0.2",
|
"version": "3.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.2.tgz",
|
||||||
"integrity": "sha1-hFK0u36Dx8GI2AQcGoN8dz1ti7k=",
|
"integrity": "sha1-hFK0u36Dx8GI2AQcGoN8dz1ti7k="
|
||||||
"optional": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -114,7 +114,7 @@ export class AccountSettingsModalComponent implements OnInit, AfterViewChecked {
|
|||||||
this.checkOnGoing = true;
|
this.checkOnGoing = true;
|
||||||
this.session
|
this.session
|
||||||
.checkUserExisting("email", this.account.email)
|
.checkUserExisting("email", this.account.email)
|
||||||
.then((res: boolean) => {
|
.subscribe((res: boolean) => {
|
||||||
this.checkOnGoing = false;
|
this.checkOnGoing = false;
|
||||||
this.validationStateMap[key] = !res;
|
this.validationStateMap[key] = !res;
|
||||||
if (res) {
|
if (res) {
|
||||||
@ -123,8 +123,7 @@ export class AccountSettingsModalComponent implements OnInit, AfterViewChecked {
|
|||||||
this.mailAlreadyChecked[this.account.email] = {
|
this.mailAlreadyChecked[this.account.email] = {
|
||||||
result: res
|
result: res
|
||||||
}; // Tag it checked
|
}; // Tag it checked
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.checkOnGoing = false;
|
this.checkOnGoing = false;
|
||||||
this.validationStateMap[key] = false; // Not valid @ backend
|
this.validationStateMap[key] = false; // Not valid @ backend
|
||||||
});
|
});
|
||||||
@ -185,18 +184,16 @@ export class AccountSettingsModalComponent implements OnInit, AfterViewChecked {
|
|||||||
if (this.canRename) {
|
if (this.canRename) {
|
||||||
this.session
|
this.session
|
||||||
.updateAccountSettings(this.account)
|
.updateAccountSettings(this.account)
|
||||||
.then(() => {
|
.subscribe(() => {
|
||||||
this.session.renameAdmin(this.account)
|
this.session.renameAdmin(this.account)
|
||||||
.then(() => {
|
.subscribe(() => {
|
||||||
this.msgHandler.showSuccess("PROFILE.RENAME_SUCCESS");
|
this.msgHandler.showSuccess("PROFILE.RENAME_SUCCESS");
|
||||||
this.opened = false;
|
this.opened = false;
|
||||||
this.logOut();
|
this.logOut();
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.msgHandler.handleError(error);
|
this.msgHandler.handleError(error);
|
||||||
});
|
});
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.isOnCalling = false;
|
this.isOnCalling = false;
|
||||||
this.error = error;
|
this.error = error;
|
||||||
if (this.msgHandler.isAppLevel(error)) {
|
if (this.msgHandler.isAppLevel(error)) {
|
||||||
@ -288,12 +285,11 @@ export class AccountSettingsModalComponent implements OnInit, AfterViewChecked {
|
|||||||
} else {
|
} else {
|
||||||
this.session
|
this.session
|
||||||
.updateAccountSettings(this.account)
|
.updateAccountSettings(this.account)
|
||||||
.then(() => {
|
.subscribe(() => {
|
||||||
this.isOnCalling = false;
|
this.isOnCalling = false;
|
||||||
this.opened = false;
|
this.opened = false;
|
||||||
this.msgHandler.showSuccess("PROFILE.SAVE_SUCCESS");
|
this.msgHandler.showSuccess("PROFILE.SAVE_SUCCESS");
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.isOnCalling = false;
|
this.isOnCalling = false;
|
||||||
this.error = error;
|
this.error = error;
|
||||||
if (this.msgHandler.isAppLevel(error)) {
|
if (this.msgHandler.isAppLevel(error)) {
|
||||||
|
@ -79,14 +79,13 @@ export class ForgotPasswordComponent {
|
|||||||
|
|
||||||
this.onGoing = true;
|
this.onGoing = true;
|
||||||
this.pwdService.sendResetPasswordMail(this.email)
|
this.pwdService.sendResetPasswordMail(this.email)
|
||||||
.then(response => {
|
.subscribe(response => {
|
||||||
this.onGoing = false;
|
this.onGoing = false;
|
||||||
this.isSuccess = true;
|
this.isSuccess = true;
|
||||||
this.inlineAlert.showInlineSuccess({
|
this.inlineAlert.showInlineSuccess({
|
||||||
message: "RESET_PWD.SUCCESS"
|
message: "RESET_PWD.SUCCESS"
|
||||||
});
|
});
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.onGoing = false;
|
this.onGoing = false;
|
||||||
this.inlineAlert.showInlineError(error);
|
this.inlineAlert.showInlineError(error);
|
||||||
});
|
});
|
||||||
|
@ -166,12 +166,11 @@ export class PasswordSettingComponent implements AfterViewChecked {
|
|||||||
new_password: this.pwdForm.value.newPassword,
|
new_password: this.pwdForm.value.newPassword,
|
||||||
old_password: this.pwdForm.value.oldPassword
|
old_password: this.pwdForm.value.oldPassword
|
||||||
})
|
})
|
||||||
.then(() => {
|
.subscribe(() => {
|
||||||
this.onCalling = false;
|
this.onCalling = false;
|
||||||
this.opened = false;
|
this.opened = false;
|
||||||
this.msgHandler.showSuccess("CHANGE_PWD.SAVE_SUCCESS");
|
this.msgHandler.showSuccess("CHANGE_PWD.SAVE_SUCCESS");
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.onCalling = false;
|
this.onCalling = false;
|
||||||
this.error = error;
|
this.error = error;
|
||||||
if (this.msgHandler.isAppLevel(error)) {
|
if (this.msgHandler.isAppLevel(error)) {
|
||||||
|
@ -13,6 +13,8 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Http, URLSearchParams } from '@angular/http';
|
import { Http, URLSearchParams } from '@angular/http';
|
||||||
|
import { map, catchError } from "rxjs/operators";
|
||||||
|
import { Observable, throwError as observableThrowError } from "rxjs";
|
||||||
|
|
||||||
|
|
||||||
import { PasswordSetting } from './password-setting';
|
import { PasswordSetting } from './password-setting';
|
||||||
@ -27,36 +29,31 @@ export class PasswordSettingService {
|
|||||||
|
|
||||||
constructor(private http: Http) { }
|
constructor(private http: Http) { }
|
||||||
|
|
||||||
changePassword(userId: number, setting: PasswordSetting): Promise<any> {
|
changePassword(userId: number, setting: PasswordSetting): Observable<any> {
|
||||||
if (!setting || setting.new_password.trim() === "" || setting.old_password.trim() === "") {
|
if (!setting || setting.new_password.trim() === "" || setting.old_password.trim() === "") {
|
||||||
return Promise.reject("Invalid data");
|
return observableThrowError("Invalid data");
|
||||||
}
|
}
|
||||||
|
|
||||||
let putUrl = passwordChangeEndpoint.replace(":user_id", userId + "");
|
let putUrl = passwordChangeEndpoint.replace(":user_id", userId + "");
|
||||||
return this.http.put(putUrl, JSON.stringify(setting), HTTP_JSON_OPTIONS)
|
return this.http.put(putUrl, JSON.stringify(setting), HTTP_JSON_OPTIONS)
|
||||||
.toPromise()
|
.pipe(map(() => null)
|
||||||
.then(() => null)
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => {
|
|
||||||
return Promise.reject(error);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sendResetPasswordMail(email: string): Promise<any> {
|
sendResetPasswordMail(email: string): Observable<any> {
|
||||||
if (!email) {
|
if (!email) {
|
||||||
return Promise.reject("Invalid email");
|
return observableThrowError("Invalid email");
|
||||||
}
|
}
|
||||||
|
|
||||||
let getUrl = sendEmailEndpoint + "?email=" + email;
|
let getUrl = sendEmailEndpoint + "?email=" + email;
|
||||||
return this.http.get(getUrl, HTTP_GET_OPTIONS).toPromise()
|
return this.http.get(getUrl, HTTP_GET_OPTIONS)
|
||||||
.then(response => response)
|
.pipe(map(response => response)
|
||||||
.catch(error => {
|
, catchError(error => observableThrowError(error)));
|
||||||
return Promise.reject(error);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resetPassword(uuid: string, newPassword: string): Promise<any> {
|
resetPassword(uuid: string, newPassword: string): Observable<any> {
|
||||||
if (!uuid || !newPassword) {
|
if (!uuid || !newPassword) {
|
||||||
return Promise.reject("Invalid reset uuid or password");
|
return observableThrowError("Invalid reset uuid or password");
|
||||||
}
|
}
|
||||||
|
|
||||||
let body: URLSearchParams = new URLSearchParams();
|
let body: URLSearchParams = new URLSearchParams();
|
||||||
@ -64,11 +61,8 @@ export class PasswordSettingService {
|
|||||||
body.set("password", newPassword);
|
body.set("password", newPassword);
|
||||||
|
|
||||||
return this.http.post(resetPasswordEndpoint, body.toString(), HTTP_FORM_OPTIONS)
|
return this.http.post(resetPasswordEndpoint, body.toString(), HTTP_FORM_OPTIONS)
|
||||||
.toPromise()
|
.pipe(map(response => response)
|
||||||
.then(response => response)
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => {
|
|
||||||
return Promise.reject(error);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -105,12 +105,11 @@ export class ResetPasswordComponent implements OnInit {
|
|||||||
|
|
||||||
this.onGoing = true;
|
this.onGoing = true;
|
||||||
this.pwdService.resetPassword(this.resetUuid, this.password)
|
this.pwdService.resetPassword(this.resetUuid, this.password)
|
||||||
.then(() => {
|
.subscribe(() => {
|
||||||
this.onGoing = false;
|
this.onGoing = false;
|
||||||
this.resetOk = true;
|
this.resetOk = true;
|
||||||
this.inlineAlert.showInlineSuccess({ message: 'RESET_PWD.RESET_OK' });
|
this.inlineAlert.showInlineSuccess({ message: 'RESET_PWD.RESET_OK' });
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.onGoing = false;
|
this.onGoing = false;
|
||||||
if (this.msgHandler.isAppLevel(error)) {
|
if (this.msgHandler.isAppLevel(error)) {
|
||||||
this.close();
|
this.close();
|
||||||
|
@ -89,8 +89,8 @@ export class SignInComponent implements AfterViewChecked, OnInit {
|
|||||||
|
|
||||||
// Make sure the updated configuration can be loaded
|
// Make sure the updated configuration can be loaded
|
||||||
this.appConfigService.load()
|
this.appConfigService.load()
|
||||||
.then(updatedConfig => this.appConfig = updatedConfig)
|
.subscribe(updatedConfig => this.appConfig = updatedConfig
|
||||||
.catch(error => {
|
, error => {
|
||||||
// Catch the error
|
// Catch the error
|
||||||
console.error("Failed to load bootstrap options with error: ", error);
|
console.error("Failed to load bootstrap options with error: ", error);
|
||||||
});
|
});
|
||||||
@ -241,7 +241,7 @@ export class SignInComponent implements AfterViewChecked, OnInit {
|
|||||||
|
|
||||||
// Call the service to send out the http request
|
// Call the service to send out the http request
|
||||||
this.session.signIn(this.signInCredential)
|
this.session.signIn(this.signInCredential)
|
||||||
.then(() => {
|
.subscribe(() => {
|
||||||
// Set status
|
// Set status
|
||||||
// Keep it ongoing to keep the button 'disabled'
|
// Keep it ongoing to keep the button 'disabled'
|
||||||
// this.signInStatus = signInStatusNormal;
|
// this.signInStatus = signInStatusNormal;
|
||||||
@ -256,8 +256,7 @@ export class SignInComponent implements AfterViewChecked, OnInit {
|
|||||||
} else {
|
} else {
|
||||||
this.router.navigateByUrl(this.redirectUrl);
|
this.router.navigateByUrl(this.redirectUrl);
|
||||||
}
|
}
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.handleError(error);
|
this.handleError(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -13,11 +13,12 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Http, URLSearchParams } from '@angular/http';
|
import { Http, URLSearchParams } from '@angular/http';
|
||||||
import 'rxjs/add/operator/toPromise';
|
// import 'rxjs/add/operator/toPromise';
|
||||||
|
|
||||||
import { SignInCredential } from '../../shared/sign-in-credential';
|
import { SignInCredential } from '../../shared/sign-in-credential';
|
||||||
import {HTTP_FORM_OPTIONS} from "../../shared/shared.utils";
|
import {HTTP_FORM_OPTIONS} from "../../shared/shared.utils";
|
||||||
|
import { map, catchError } from "rxjs/operators";
|
||||||
|
import { Observable, throwError as observableThrowError } from "rxjs";
|
||||||
const signInUrl = '/c/login';
|
const signInUrl = '/c/login';
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -32,12 +33,12 @@ export class SignInService {
|
|||||||
constructor(private http: Http) {}
|
constructor(private http: Http) {}
|
||||||
|
|
||||||
// Handle the related exceptions
|
// Handle the related exceptions
|
||||||
handleError(error: any): Promise<any> {
|
handleError(error: any): Observable<any> {
|
||||||
return Promise.reject(error.message || error);
|
return observableThrowError(error.message || error);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Submit signin form to backend (NOT restful service)
|
// Submit signin form to backend (NOT restful service)
|
||||||
signIn(signInCredential: SignInCredential): Promise<any> {
|
signIn(signInCredential: SignInCredential): Observable<any> {
|
||||||
// Build the form package
|
// Build the form package
|
||||||
const body = new URLSearchParams();
|
const body = new URLSearchParams();
|
||||||
body.set('principal', signInCredential.principal);
|
body.set('principal', signInCredential.principal);
|
||||||
@ -45,8 +46,8 @@ export class SignInService {
|
|||||||
|
|
||||||
// Trigger Http
|
// Trigger Http
|
||||||
return this.http.post(signInUrl, body.toString(), HTTP_FORM_OPTIONS)
|
return this.http.post(signInUrl, body.toString(), HTTP_FORM_OPTIONS)
|
||||||
.toPromise()
|
.pipe(map(() => null)
|
||||||
.then(() => null)
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(this.handleError);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,13 +92,12 @@ export class SignUpPageComponent implements OnInit {
|
|||||||
this.onGoing = true;
|
this.onGoing = true;
|
||||||
|
|
||||||
this.userService.addUser(u)
|
this.userService.addUser(u)
|
||||||
.then(() => {
|
.subscribe(() => {
|
||||||
this.onGoing = false;
|
this.onGoing = false;
|
||||||
this.msgService.announceMessage(200, "", AlertType.SUCCESS);
|
this.msgService.announceMessage(200, "", AlertType.SUCCESS);
|
||||||
// Navigate to embeded sign-in
|
// Navigate to embeded sign-in
|
||||||
this.router.navigate(['harbor', 'sign-in']);
|
this.router.navigate(['harbor', 'sign-in']);
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.onGoing = false;
|
this.onGoing = false;
|
||||||
this.error = error;
|
this.error = error;
|
||||||
this.msgService.announceMessage(error.status || 500, "", AlertType.WARNING);
|
this.msgService.announceMessage(error.status || 500, "", AlertType.WARNING);
|
||||||
|
@ -119,13 +119,12 @@ export class SignUpComponent {
|
|||||||
this.onGoing = true;
|
this.onGoing = true;
|
||||||
|
|
||||||
this.userService.addUser(u)
|
this.userService.addUser(u)
|
||||||
.then(() => {
|
.subscribe(() => {
|
||||||
this.onGoing = false;
|
this.onGoing = false;
|
||||||
this.opened = false;
|
this.opened = false;
|
||||||
this.modal.close();
|
this.modal.close();
|
||||||
this.userCreation.emit(u);
|
this.userCreation.emit(u);
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.onGoing = false;
|
this.onGoing = false;
|
||||||
this.error = error;
|
this.error = error;
|
||||||
this.inlienAlert.showInlineError(error);
|
this.inlienAlert.showInlineError(error);
|
||||||
|
@ -19,7 +19,8 @@ import { CookieService } from 'ngx-cookie';
|
|||||||
import { AppConfig } from './app-config';
|
import { AppConfig } from './app-config';
|
||||||
import { CookieKeyOfAdmiral, HarborQueryParamKey } from './shared/shared.const';
|
import { CookieKeyOfAdmiral, HarborQueryParamKey } from './shared/shared.const';
|
||||||
import { maintainUrlQueryParmas, HTTP_GET_OPTIONS} from './shared/shared.utils';
|
import { maintainUrlQueryParmas, HTTP_GET_OPTIONS} from './shared/shared.utils';
|
||||||
|
import { map, catchError } from "rxjs/operators";
|
||||||
|
import { Observable, throwError as observableThrowError } from "rxjs";
|
||||||
export const systemInfoEndpoint = "/api/systeminfo";
|
export const systemInfoEndpoint = "/api/systeminfo";
|
||||||
/**
|
/**
|
||||||
* Declare service to handle the bootstrap options
|
* Declare service to handle the bootstrap options
|
||||||
@ -38,9 +39,9 @@ export class AppConfigService {
|
|||||||
private http: Http,
|
private http: Http,
|
||||||
private cookie: CookieService) { }
|
private cookie: CookieService) { }
|
||||||
|
|
||||||
public load(): Promise<AppConfig> {
|
public load(): Observable<AppConfig> {
|
||||||
return this.http.get(systemInfoEndpoint, HTTP_GET_OPTIONS).toPromise()
|
return this.http.get(systemInfoEndpoint, HTTP_GET_OPTIONS)
|
||||||
.then(response => {
|
.pipe(map(response => {
|
||||||
this.configurations = response.json() as AppConfig;
|
this.configurations = response.json() as AppConfig;
|
||||||
|
|
||||||
// Read admiral endpoint from cookie if existing
|
// Read admiral endpoint from cookie if existing
|
||||||
@ -51,7 +52,7 @@ export class AppConfigService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return this.configurations;
|
return this.configurations;
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
public getConfig(): AppConfig {
|
public getConfig(): AppConfig {
|
||||||
|
@ -13,7 +13,8 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Http } from '@angular/http';
|
import { Http } from '@angular/http';
|
||||||
|
import { map, catchError } from "rxjs/operators";
|
||||||
|
import { Observable, throwError as observableThrowError } from "rxjs";
|
||||||
|
|
||||||
import { SearchResults } from './search-results';
|
import { SearchResults } from './search-results';
|
||||||
import { HTTP_GET_OPTIONS } from "../../shared/shared.utils";
|
import { HTTP_GET_OPTIONS } from "../../shared/shared.utils";
|
||||||
@ -35,15 +36,15 @@ export class GlobalSearchService {
|
|||||||
* Search related artifacts with the provided keyword
|
* Search related artifacts with the provided keyword
|
||||||
*
|
*
|
||||||
* ** deprecated param {string} keyword
|
* ** deprecated param {string} keyword
|
||||||
* returns {Promise<SearchResults>}
|
* returns {Observable<SearchResults>}
|
||||||
*
|
*
|
||||||
* @memberOf GlobalSearchService
|
* @memberOf GlobalSearchService
|
||||||
*/
|
*/
|
||||||
doSearch(term: string): Promise<SearchResults> {
|
doSearch(term: string): Observable<SearchResults> {
|
||||||
let searchUrl = searchEndpoint + "?q=" + term;
|
let searchUrl = searchEndpoint + "?q=" + term;
|
||||||
|
|
||||||
return this.http.get(searchUrl, HTTP_GET_OPTIONS).toPromise()
|
return this.http.get(searchUrl, HTTP_GET_OPTIONS)
|
||||||
.then(response => response.json() as SearchResults)
|
.pipe(map(response => response.json() as SearchResults)
|
||||||
.catch(error => Promise.reject(error));
|
, catchError(error => observableThrowError(error)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -140,12 +140,11 @@ export class SearchResultComponent implements OnInit, OnDestroy {
|
|||||||
this.onGoing = true;
|
this.onGoing = true;
|
||||||
|
|
||||||
this.search.doSearch(term)
|
this.search.doSearch(term)
|
||||||
.then(searchResults => {
|
.subscribe(searchResults => {
|
||||||
this.onGoing = false;
|
this.onGoing = false;
|
||||||
this.originalCopy = searchResults; // Keep the original data
|
this.originalCopy = searchResults; // Keep the original data
|
||||||
this.searchResults = this.clone(searchResults);
|
this.searchResults = this.clone(searchResults);
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.onGoing = false;
|
this.onGoing = false;
|
||||||
this.msgHandler.handleError(error);
|
this.msgHandler.handleError(error);
|
||||||
});
|
});
|
||||||
|
@ -198,6 +198,17 @@
|
|||||||
</clr-tooltip>
|
</clr-tooltip>
|
||||||
</div>
|
</div>
|
||||||
<!-- End of ldap group admin dn -->
|
<!-- End of ldap group admin dn -->
|
||||||
|
<div class="form-group">
|
||||||
|
<label>{{'CONFIG.LDAP.LDAP_GROUP_MEMBERSHIP' | translate}}</label>
|
||||||
|
<input name="ldapGroupMembership" class="padding-right-28" type="text" #ldapGroupFilterInput="ngModel"
|
||||||
|
[(ngModel)]="currentConfig.ldap_group_membership_attribute.value" id="ldapGroupMembership" size="40" [disabled]="disabled(currentConfig.ldap_group_membership_attribute)">
|
||||||
|
<clr-tooltip>
|
||||||
|
<clr-icon clrTooltipTrigger shape="info-circle" size="24"></clr-icon>
|
||||||
|
<clr-tooltip-content clrPosition="top-right" clrSize="lg" *clrIfOpen>
|
||||||
|
<span>{{'CONFIG.LDAP.LDAP_GROUP_MEMBERSHIP_INFO' | translate}}</span>
|
||||||
|
</clr-tooltip-content>
|
||||||
|
</clr-tooltip>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="ldapGroupScope">{{'CONFIG.LDAP.GROUP_SCOPE' | translate}}</label>
|
<label for="ldapGroupScope">{{'CONFIG.LDAP.GROUP_SCOPE' | translate}}</label>
|
||||||
<div class="select">
|
<div class="select">
|
||||||
@ -216,6 +227,7 @@
|
|||||||
</clr-tooltip-content>
|
</clr-tooltip-content>
|
||||||
</clr-tooltip>
|
</clr-tooltip>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
<section class="form-block">
|
<section class="form-block">
|
||||||
<div class="form-group" *ngIf="showSelfReg">
|
<div class="form-group" *ngIf="showSelfReg">
|
||||||
|
@ -20,6 +20,7 @@ import { MessageHandlerService } from '../../shared/message-handler/message-hand
|
|||||||
import { ConfirmMessageHandler } from '../config.msg.utils';
|
import { ConfirmMessageHandler } from '../config.msg.utils';
|
||||||
import { AppConfigService } from '../../app-config.service';
|
import { AppConfigService } from '../../app-config.service';
|
||||||
import { ConfigurationService } from '../config.service';
|
import { ConfigurationService } from '../config.service';
|
||||||
|
import { catchError } from 'rxjs/operators';
|
||||||
const fakePass = 'aWpLOSYkIzJTTU4wMDkx';
|
const fakePass = 'aWpLOSYkIzJTTU4wMDkx';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -114,11 +115,10 @@ export class ConfigurationAuthComponent implements OnChanges {
|
|||||||
|
|
||||||
this.testingLDAPOnGoing = true;
|
this.testingLDAPOnGoing = true;
|
||||||
this.configService.testLDAPServer(ldapSettings)
|
this.configService.testLDAPServer(ldapSettings)
|
||||||
.then(respone => {
|
.subscribe(respone => {
|
||||||
this.testingLDAPOnGoing = false;
|
this.testingLDAPOnGoing = false;
|
||||||
this.msgHandler.showSuccess('CONFIG.TEST_LDAP_SUCCESS');
|
this.msgHandler.showSuccess('CONFIG.TEST_LDAP_SUCCESS');
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.testingLDAPOnGoing = false;
|
this.testingLDAPOnGoing = false;
|
||||||
let err = error._body;
|
let err = error._body;
|
||||||
if (!err || !err.trim()) {
|
if (!err || !err.trim()) {
|
||||||
@ -187,14 +187,14 @@ export class ConfigurationAuthComponent implements OnChanges {
|
|||||||
if (!isEmpty(changes)) {
|
if (!isEmpty(changes)) {
|
||||||
this.onGoing = true;
|
this.onGoing = true;
|
||||||
this.configService.saveConfiguration(changes)
|
this.configService.saveConfiguration(changes)
|
||||||
.then(response => {
|
.subscribe(response => {
|
||||||
this.onGoing = false;
|
this.onGoing = false;
|
||||||
this.retrieveConfig();
|
this.retrieveConfig();
|
||||||
// Reload bootstrap option
|
// Reload bootstrap option
|
||||||
this.appConfigService.load().catch(error => console.error('Failed to reload bootstrap option with error: ', error));
|
this.appConfigService.load().subscribe(() => {}
|
||||||
|
, error => console.error('Failed to reload bootstrap option with error: ', error));
|
||||||
this.msgHandler.showSuccess('CONFIG.SAVE_SUCCESS');
|
this.msgHandler.showSuccess('CONFIG.SAVE_SUCCESS');
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.onGoing = false;
|
this.onGoing = false;
|
||||||
this.msgHandler.handleError(error);
|
this.msgHandler.handleError(error);
|
||||||
});
|
});
|
||||||
@ -207,7 +207,7 @@ export class ConfigurationAuthComponent implements OnChanges {
|
|||||||
retrieveConfig(): void {
|
retrieveConfig(): void {
|
||||||
this.onGoing = true;
|
this.onGoing = true;
|
||||||
this.configService.getConfiguration()
|
this.configService.getConfiguration()
|
||||||
.then((configurations: Configuration) => {
|
.subscribe((configurations: Configuration) => {
|
||||||
this.onGoing = false;
|
this.onGoing = false;
|
||||||
|
|
||||||
// Add two password fields
|
// Add two password fields
|
||||||
@ -216,8 +216,7 @@ export class ConfigurationAuthComponent implements OnChanges {
|
|||||||
this.currentConfig = configurations;
|
this.currentConfig = configurations;
|
||||||
// Keep the original copy of the data
|
// Keep the original copy of the data
|
||||||
this.originalConfig = clone(configurations);
|
this.originalConfig = clone(configurations);
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.onGoing = false;
|
this.onGoing = false;
|
||||||
this.msgHandler.handleError(error);
|
this.msgHandler.handleError(error);
|
||||||
});
|
});
|
||||||
|
@ -129,7 +129,8 @@ export class ConfigurationComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
handleAppConfig(event) {
|
handleAppConfig(event) {
|
||||||
// Reload bootstrap option
|
// Reload bootstrap option
|
||||||
this.appConfigService.load().catch(error => console.error('Failed to reload bootstrap option with error: ', error));
|
this.appConfigService.load().subscribe(() => {}
|
||||||
|
, error => console.error('Failed to reload bootstrap option with error: ', error));
|
||||||
}
|
}
|
||||||
|
|
||||||
public tabLinkClick(tabLink: string) {
|
public tabLinkClick(tabLink: string) {
|
||||||
@ -139,7 +140,7 @@ export class ConfigurationComponent implements OnInit, OnDestroy {
|
|||||||
retrieveConfig(): void {
|
retrieveConfig(): void {
|
||||||
this.onGoing = true;
|
this.onGoing = true;
|
||||||
this.configService.getConfiguration()
|
this.configService.getConfiguration()
|
||||||
.then((configurations: Configuration) => {
|
.subscribe((configurations: Configuration) => {
|
||||||
this.onGoing = false;
|
this.onGoing = false;
|
||||||
|
|
||||||
// Add two password fields
|
// Add two password fields
|
||||||
@ -149,8 +150,7 @@ export class ConfigurationComponent implements OnInit, OnDestroy {
|
|||||||
this.allConfig = configurations;
|
this.allConfig = configurations;
|
||||||
// Keep the original copy of the data
|
// Keep the original copy of the data
|
||||||
this.originalCopy = clone(configurations);
|
this.originalCopy = clone(configurations);
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.onGoing = false;
|
this.onGoing = false;
|
||||||
this.msgHandler.handleError(error);
|
this.msgHandler.handleError(error);
|
||||||
});
|
});
|
||||||
|
@ -13,7 +13,8 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Http } from '@angular/http';
|
import { Http } from '@angular/http';
|
||||||
|
import { map, catchError } from "rxjs/operators";
|
||||||
|
import { Observable, throwError as observableThrowError } from "rxjs";
|
||||||
|
|
||||||
import { Configuration } from '@harbor/ui';
|
import { Configuration } from '@harbor/ui';
|
||||||
|
|
||||||
@ -28,30 +29,27 @@ export class ConfigurationService {
|
|||||||
|
|
||||||
constructor(private http: Http) { }
|
constructor(private http: Http) { }
|
||||||
|
|
||||||
public getConfiguration(): Promise<Configuration> {
|
public getConfiguration(): Observable<Configuration> {
|
||||||
return this.http.get(configEndpoint, HTTP_GET_OPTIONS).toPromise()
|
return this.http.get(configEndpoint, HTTP_GET_OPTIONS)
|
||||||
.then(response => response.json() as Configuration)
|
.pipe(map(response => response.json() as Configuration)
|
||||||
.catch(error => Promise.reject(error));
|
, catchError(error => observableThrowError(error)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public saveConfiguration(values: any): Promise<any> {
|
public saveConfiguration(values: any): Observable<any> {
|
||||||
return this.http.put(configEndpoint, JSON.stringify(values), HTTP_JSON_OPTIONS)
|
return this.http.put(configEndpoint, JSON.stringify(values), HTTP_JSON_OPTIONS)
|
||||||
.toPromise()
|
.pipe(map(response => response)
|
||||||
.then(response => response)
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public testMailServer(mailSettings: any): Promise<any> {
|
public testMailServer(mailSettings: any): Observable<any> {
|
||||||
return this.http.post(emailEndpoint, JSON.stringify(mailSettings), HTTP_JSON_OPTIONS)
|
return this.http.post(emailEndpoint, JSON.stringify(mailSettings), HTTP_JSON_OPTIONS)
|
||||||
.toPromise()
|
.pipe(map(response => response)
|
||||||
.then(response => response)
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public testLDAPServer(ldapSettings: any): Promise<any> {
|
public testLDAPServer(ldapSettings: any): Observable<any> {
|
||||||
return this.http.post(ldapEndpoint, JSON.stringify(ldapSettings), HTTP_JSON_OPTIONS)
|
return this.http.post(ldapEndpoint, JSON.stringify(ldapSettings), HTTP_JSON_OPTIONS)
|
||||||
.toPromise()
|
.pipe(map(response => response)
|
||||||
.then(response => response)
|
, catchError(error => observableThrowError(error)));
|
||||||
.catch(error => Promise.reject(error));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,11 +100,10 @@ export class ConfigurationEmailComponent implements OnChanges {
|
|||||||
|
|
||||||
this.testingMailOnGoing = true;
|
this.testingMailOnGoing = true;
|
||||||
this.configService.testMailServer(mailSettings)
|
this.configService.testMailServer(mailSettings)
|
||||||
.then(response => {
|
.subscribe(response => {
|
||||||
this.testingMailOnGoing = false;
|
this.testingMailOnGoing = false;
|
||||||
this.msgHandler.showSuccess('CONFIG.TEST_MAIL_SUCCESS');
|
this.msgHandler.showSuccess('CONFIG.TEST_MAIL_SUCCESS');
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.testingMailOnGoing = false;
|
this.testingMailOnGoing = false;
|
||||||
let err = error._body;
|
let err = error._body;
|
||||||
if (!err) {
|
if (!err) {
|
||||||
@ -134,12 +133,11 @@ export class ConfigurationEmailComponent implements OnChanges {
|
|||||||
if (!isEmpty(changes)) {
|
if (!isEmpty(changes)) {
|
||||||
this.onGoing = true;
|
this.onGoing = true;
|
||||||
this.configService.saveConfiguration(changes)
|
this.configService.saveConfiguration(changes)
|
||||||
.then(response => {
|
.subscribe(response => {
|
||||||
this.onGoing = false;
|
this.onGoing = false;
|
||||||
this.retrieveConfig();
|
this.retrieveConfig();
|
||||||
this.msgHandler.showSuccess('CONFIG.SAVE_SUCCESS');
|
this.msgHandler.showSuccess('CONFIG.SAVE_SUCCESS');
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.onGoing = false;
|
this.onGoing = false;
|
||||||
this.msgHandler.handleError(error);
|
this.msgHandler.handleError(error);
|
||||||
});
|
});
|
||||||
@ -152,7 +150,7 @@ export class ConfigurationEmailComponent implements OnChanges {
|
|||||||
retrieveConfig(): void {
|
retrieveConfig(): void {
|
||||||
this.onGoing = true;
|
this.onGoing = true;
|
||||||
this.configService.getConfiguration()
|
this.configService.getConfiguration()
|
||||||
.then((configurations: Configuration) => {
|
.subscribe((configurations: Configuration) => {
|
||||||
this.onGoing = false;
|
this.onGoing = false;
|
||||||
|
|
||||||
// Add two password fields
|
// Add two password fields
|
||||||
@ -160,8 +158,7 @@ export class ConfigurationEmailComponent implements OnChanges {
|
|||||||
this.currentConfig = configurations;
|
this.currentConfig = configurations;
|
||||||
// Keep the original copy of the data
|
// Keep the original copy of the data
|
||||||
this.originalConfig = clone(configurations);
|
this.originalConfig = clone(configurations);
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.onGoing = false;
|
this.onGoing = false;
|
||||||
this.msgHandler.handleError(error);
|
this.msgHandler.handleError(error);
|
||||||
});
|
});
|
||||||
|
@ -81,14 +81,13 @@ export class CreateProjectComponent implements OnInit, OnDestroy {
|
|||||||
if (this.isNameValid) {
|
if (this.isNameValid) {
|
||||||
// Check exiting from backend
|
// Check exiting from backend
|
||||||
this.projectService
|
this.projectService
|
||||||
.checkProjectExists(cont.value).toPromise()
|
.checkProjectExists(cont.value)
|
||||||
.then(() => {
|
.subscribe(() => {
|
||||||
// Project existing
|
// Project existing
|
||||||
this.isNameValid = false;
|
this.isNameValid = false;
|
||||||
this.nameTooltipText = "PROJECT.NAME_ALREADY_EXISTS";
|
this.nameTooltipText = "PROJECT.NAME_ALREADY_EXISTS";
|
||||||
this.checkOnGoing = false;
|
this.checkOnGoing = false;
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.checkOnGoing = false;
|
this.checkOnGoing = false;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
import {forkJoin as observableForkJoin, Subscription } from "rxjs";
|
import {forkJoin as observableForkJoin, Subscription, forkJoin } from "rxjs";
|
||||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -39,7 +39,8 @@ import {operateChanges, OperateInfo, OperationService, OperationState} from "@ha
|
|||||||
|
|
||||||
import { Project } from "../project";
|
import { Project } from "../project";
|
||||||
import { ProjectService } from "../project.service";
|
import { ProjectService } from "../project.service";
|
||||||
|
import { map, catchError } from "rxjs/operators";
|
||||||
|
import { throwError as observableThrowError } from "rxjs";
|
||||||
@Component({
|
@Component({
|
||||||
selector: "list-project",
|
selector: "list-project",
|
||||||
templateUrl: "list-project.component.html",
|
templateUrl: "list-project.component.html",
|
||||||
@ -165,8 +166,8 @@ export class ListProjectComponent implements OnDestroy {
|
|||||||
if (this.filteredType > 0) {
|
if (this.filteredType > 0) {
|
||||||
passInFilteredType = this.filteredType - 1;
|
passInFilteredType = this.filteredType - 1;
|
||||||
}
|
}
|
||||||
this.proService.listProjects(this.searchKeyword, passInFilteredType, pageNumber, this.pageSize).toPromise()
|
this.proService.listProjects(this.searchKeyword, passInFilteredType, pageNumber, this.pageSize)
|
||||||
.then(response => {
|
.subscribe(response => {
|
||||||
// Get total count
|
// Get total count
|
||||||
if (response.headers) {
|
if (response.headers) {
|
||||||
let xHeader: string = response.headers.get("X-Total-Count");
|
let xHeader: string = response.headers.get("X-Total-Count");
|
||||||
@ -181,8 +182,7 @@ export class ListProjectComponent implements OnDestroy {
|
|||||||
this.projects = doSorting<Project>(this.projects, state);
|
this.projects = doSorting<Project>(this.projects, state);
|
||||||
|
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.msgHandler.handleError(error);
|
this.msgHandler.handleError(error);
|
||||||
});
|
});
|
||||||
@ -244,7 +244,7 @@ export class ListProjectComponent implements OnDestroy {
|
|||||||
projects.forEach(data => {
|
projects.forEach(data => {
|
||||||
observableLists.push(this.delOperate(data));
|
observableLists.push(this.delOperate(data));
|
||||||
});
|
});
|
||||||
Promise.all(observableLists).then(item => {
|
forkJoin(...observableLists).subscribe(item => {
|
||||||
let st: State = this.getStateAfterDeletion();
|
let st: State = this.getStateAfterDeletion();
|
||||||
this.selectedRow = [];
|
this.selectedRow = [];
|
||||||
if (!st) {
|
if (!st) {
|
||||||
@ -267,24 +267,24 @@ export class ListProjectComponent implements OnDestroy {
|
|||||||
this.operationService.publishInfo(operMessage);
|
this.operationService.publishInfo(operMessage);
|
||||||
|
|
||||||
return this.proService.deleteProject(project.project_id)
|
return this.proService.deleteProject(project.project_id)
|
||||||
.then(
|
.pipe(map(
|
||||||
() => {
|
() => {
|
||||||
this.translate.get("BATCH.DELETED_SUCCESS").subscribe(res => {
|
this.translate.get("BATCH.DELETED_SUCCESS").subscribe(res => {
|
||||||
operateChanges(operMessage, OperationState.success);
|
operateChanges(operMessage, OperationState.success);
|
||||||
});
|
});
|
||||||
},
|
}), catchError(
|
||||||
error => {
|
error => {
|
||||||
if (error && error.status === 412) {
|
if (error && error.status === 412) {
|
||||||
observableForkJoin(this.translate.get("BATCH.DELETED_FAILURE"),
|
return observableForkJoin(this.translate.get("BATCH.DELETED_FAILURE"),
|
||||||
this.translate.get("PROJECT.FAILED_TO_DELETE_PROJECT")).subscribe(res => {
|
this.translate.get("PROJECT.FAILED_TO_DELETE_PROJECT")).pipe(map(res => {
|
||||||
operateChanges(operMessage, OperationState.failure, res[1]);
|
operateChanges(operMessage, OperationState.failure, res[1]);
|
||||||
});
|
}));
|
||||||
} else {
|
} else {
|
||||||
this.translate.get("BATCH.DELETED_FAILURE").subscribe(res => {
|
return this.translate.get("BATCH.DELETED_FAILURE").pipe(map(res => {
|
||||||
operateChanges(operMessage, OperationState.failure, res);
|
operateChanges(operMessage, OperationState.failure, res);
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh(): void {
|
refresh(): void {
|
||||||
|
@ -24,3 +24,8 @@
|
|||||||
background-image: linear-gradient(180deg,#f5f5f5 0,#e8e8e8);
|
background-image: linear-gradient(180deg,#f5f5f5 0,#e8e8e8);
|
||||||
background-repeat: repeat-x;
|
background-repeat: repeat-x;
|
||||||
}
|
}
|
||||||
|
.modal-body{
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ import {
|
|||||||
import { Response } from '@angular/http';
|
import { Response } from '@angular/http';
|
||||||
import { NgForm } from '@angular/forms';
|
import { NgForm } from '@angular/forms';
|
||||||
import {ActivatedRoute} from "@angular/router";
|
import {ActivatedRoute} from "@angular/router";
|
||||||
import { Subject } from "rxjs";
|
import { Subject, forkJoin } from "rxjs";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -94,11 +94,6 @@ export class AddMemberComponent implements AfterViewChecked, OnInit, OnDestroy {
|
|||||||
hasProjectAdminRole = (<Project>resolverData['projectResolver']).has_project_admin_role;
|
hasProjectAdminRole = (<Project>resolverData['projectResolver']).has_project_admin_role;
|
||||||
}
|
}
|
||||||
if (hasProjectAdminRole) {
|
if (hasProjectAdminRole) {
|
||||||
this.userService.getUsersNameList()
|
|
||||||
.then(users => {
|
|
||||||
this.userLists = users;
|
|
||||||
});
|
|
||||||
|
|
||||||
this.nameChecker.pipe(
|
this.nameChecker.pipe(
|
||||||
debounceTime(500),
|
debounceTime(500),
|
||||||
distinctUntilChanged(), )
|
distinctUntilChanged(), )
|
||||||
@ -108,33 +103,31 @@ export class AddMemberComponent implements AfterViewChecked, OnInit, OnDestroy {
|
|||||||
this.isMemberNameValid = cont.valid;
|
this.isMemberNameValid = cont.valid;
|
||||||
if (cont.valid) {
|
if (cont.valid) {
|
||||||
this.checkOnGoing = true;
|
this.checkOnGoing = true;
|
||||||
this.memberService
|
forkJoin(this.userService.getUsersNameList(cont.value, 20), this.memberService
|
||||||
.listMembers(this.projectId, cont.value).toPromise()
|
.listMembers(this.projectId, cont.value)).subscribe((res: Array<any>) => {
|
||||||
.then((members: Member[]) => {
|
this.userLists = res[0];
|
||||||
if (members.filter(m => { return m.entity_name === cont.value; }).length > 0) {
|
if (res[1].filter(m => { return m.entity_name === cont.value; }).length > 0) {
|
||||||
this.isMemberNameValid = false;
|
this.isMemberNameValid = false;
|
||||||
this.memberTooltip = 'MEMBER.USERNAME_ALREADY_EXISTS';
|
this.memberTooltip = 'MEMBER.USERNAME_ALREADY_EXISTS';
|
||||||
}
|
}
|
||||||
this.checkOnGoing = false;
|
this.checkOnGoing = false;
|
||||||
})
|
if (this.userLists && this.userLists.length) {
|
||||||
.catch(error => {
|
this.selectUserName = [];
|
||||||
this.checkOnGoing = false;
|
this.userLists.forEach(data => {
|
||||||
});
|
if (data.username.startsWith(cont.value) && !this.memberList.find(mem => mem.entity_name === data.username)) {
|
||||||
// username autocomplete
|
if (this.selectUserName.length < 10) {
|
||||||
if (this.userLists && this.userLists.length) {
|
this.selectUserName.push(data.username);
|
||||||
this.selectUserName = [];
|
}
|
||||||
this.userLists.forEach(data => {
|
|
||||||
if (data.username.startsWith(cont.value) && !this.memberList.find(mem => mem.entity_name === data.username)) {
|
|
||||||
if (this.selectUserName.length < 10) {
|
|
||||||
this.selectUserName.push(data.username);
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
let changeTimer = setInterval(() => this.ref.detectChanges(), 200);
|
||||||
let changeTimer = setInterval(() => this.ref.detectChanges(), 200);
|
setTimeout(() => {
|
||||||
setTimeout(() => {
|
clearInterval(changeTimer);
|
||||||
clearInterval(changeTimer);
|
}, 2000);
|
||||||
}, 2000);
|
}
|
||||||
}
|
}, error => {
|
||||||
|
this.checkOnGoing = false;
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
this.memberTooltip = 'MEMBER.USERNAME_IS_REQUIRED';
|
this.memberTooltip = 'MEMBER.USERNAME_IS_REQUIRED';
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ import { finalize } from 'rxjs/operators';
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
import { Component, OnInit, ViewChild, OnDestroy, ChangeDetectionStrategy, ChangeDetectorRef } from "@angular/core";
|
import { Component, OnInit, ViewChild, OnDestroy, ChangeDetectionStrategy, ChangeDetectorRef } from "@angular/core";
|
||||||
import { ActivatedRoute, Router } from "@angular/router";
|
import { ActivatedRoute, Router } from "@angular/router";
|
||||||
import { Subscription, forkJoin } from "rxjs";
|
import { Subscription, forkJoin, Observable } from "rxjs";
|
||||||
import { TranslateService } from "@ngx-translate/core";
|
import { TranslateService } from "@ngx-translate/core";
|
||||||
import { operateChanges, OperateInfo, OperationService, OperationState } from "@harbor/ui";
|
import { operateChanges, OperateInfo, OperationService, OperationState } from "@harbor/ui";
|
||||||
|
|
||||||
@ -33,7 +33,8 @@ import { MemberService } from "./member.service";
|
|||||||
import { AddMemberComponent } from "./add-member/add-member.component";
|
import { AddMemberComponent } from "./add-member/add-member.component";
|
||||||
import { AppConfigService } from "../../app-config.service";
|
import { AppConfigService } from "../../app-config.service";
|
||||||
import { UserPermissionService, USERSTATICPERMISSION, ErrorHandler } from "@harbor/ui";
|
import { UserPermissionService, USERSTATICPERMISSION, ErrorHandler } from "@harbor/ui";
|
||||||
|
import { map, catchError } from "rxjs/operators";
|
||||||
|
import { throwError as observableThrowError } from "rxjs";
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: "member.component.html",
|
templateUrl: "member.component.html",
|
||||||
styleUrls: ["./member.component.scss"],
|
styleUrls: ["./member.component.scss"],
|
||||||
@ -185,22 +186,25 @@ export class MemberComponent implements OnInit, OnDestroy {
|
|||||||
let changeOperate = (projectId: number, member: Member, ) => {
|
let changeOperate = (projectId: number, member: Member, ) => {
|
||||||
return this.memberService
|
return this.memberService
|
||||||
.changeMemberRole(projectId, member.id, roleId)
|
.changeMemberRole(projectId, member.id, roleId)
|
||||||
.then(() => this.batchChangeRoleInfos[member.id] = 'done')
|
.pipe(map(() => this.batchChangeRoleInfos[member.id] = 'done')
|
||||||
.catch(error => this.messageHandlerService.handleError(error + ": " + member.entity_name));
|
, catchError(error => {
|
||||||
|
this.messageHandlerService.handleError(error + ": " + member.entity_name);
|
||||||
|
return observableThrowError(error);
|
||||||
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
// Preparation for members role change
|
// Preparation for members role change
|
||||||
this.batchChangeRoleInfos = {};
|
this.batchChangeRoleInfos = {};
|
||||||
let RoleChangePromises: Promise<any>[] = [];
|
let RoleChangeObservables: Observable<any>[] = [];
|
||||||
members.forEach(member => {
|
members.forEach(member => {
|
||||||
if (member.entity_type === 'u' && member.entity_id === this.currentUser.user_id) {
|
if (member.entity_type === 'u' && member.entity_id === this.currentUser.user_id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.batchChangeRoleInfos[member.id] = 'pending';
|
this.batchChangeRoleInfos[member.id] = 'pending';
|
||||||
RoleChangePromises.push(changeOperate(this.projectId, member));
|
RoleChangeObservables.push(changeOperate(this.projectId, member));
|
||||||
});
|
});
|
||||||
|
|
||||||
Promise.all(RoleChangePromises).then(() => {
|
forkJoin(...RoleChangeObservables).subscribe(() => {
|
||||||
this.retrieve(this.projectId, "");
|
this.retrieve(this.projectId, "");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -231,7 +235,7 @@ export class MemberComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
deleteMembers(members: Member[]) {
|
deleteMembers(members: Member[]) {
|
||||||
if (!members) { return; }
|
if (!members) { return; }
|
||||||
let memberDeletingPromises: Promise<any>[] = [];
|
let memberDeletingObservables: Observable<any>[] = [];
|
||||||
|
|
||||||
// Function to delete specific member
|
// Function to delete specific member
|
||||||
let deleteMember = (projectId: number, member: Member) => {
|
let deleteMember = (projectId: number, member: Member) => {
|
||||||
@ -251,22 +255,21 @@ export class MemberComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
return this.memberService
|
return this.memberService
|
||||||
.deleteMember(projectId, member.id)
|
.deleteMember(projectId, member.id)
|
||||||
.then(response => {
|
.pipe(map(response => {
|
||||||
this.translate.get("BATCH.DELETED_SUCCESS").subscribe(res => {
|
this.translate.get("BATCH.DELETED_SUCCESS").subscribe(res => {
|
||||||
operateChanges(operMessage, OperationState.success);
|
operateChanges(operMessage, OperationState.success);
|
||||||
});
|
});
|
||||||
})
|
}), catchError(error => {
|
||||||
.catch(error => {
|
return this.translate.get("BATCH.DELETED_FAILURE").pipe(map(res => {
|
||||||
this.translate.get("BATCH.DELETED_FAILURE").subscribe(res => {
|
|
||||||
operateChanges(operMessage, OperationState.failure, res);
|
operateChanges(operMessage, OperationState.failure, res);
|
||||||
});
|
}));
|
||||||
});
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
// Deleting member then wating for results
|
// Deleting member then wating for results
|
||||||
members.forEach(member => memberDeletingPromises.push(deleteMember(this.projectId, member)));
|
members.forEach(member => memberDeletingObservables.push(deleteMember(this.projectId, member)));
|
||||||
|
|
||||||
Promise.all(memberDeletingPromises).then(() => {
|
forkJoin(...memberDeletingObservables).subscribe(() => {
|
||||||
this.selectedRow = [];
|
this.selectedRow = [];
|
||||||
this.batchOps = 'idle';
|
this.batchOps = 'idle';
|
||||||
this.retrieve(this.projectId, "");
|
this.retrieve(this.projectId, "");
|
||||||
|
@ -67,17 +67,17 @@ export class MemberService {
|
|||||||
catchError(error => observableThrowError(error)), );
|
catchError(error => observableThrowError(error)), );
|
||||||
}
|
}
|
||||||
|
|
||||||
changeMemberRole(projectId: number, userId: number, roleId: number): Promise<any> {
|
changeMemberRole(projectId: number, userId: number, roleId: number): Observable<any> {
|
||||||
return this.http
|
return this.http
|
||||||
.put(`/api/projects/${projectId}/members/${userId}`, { role_id: roleId }, HTTP_JSON_OPTIONS).toPromise()
|
.put(`/api/projects/${projectId}/members/${userId}`, { role_id: roleId }, HTTP_JSON_OPTIONS)
|
||||||
.then(response => response.status)
|
.pipe(map(response => response.status)
|
||||||
.catch(error => Promise.reject(error));
|
, catchError(error => observableThrowError(error)));
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteMember(projectId: number, memberId: number): Promise<any> {
|
deleteMember(projectId: number, memberId: number): Observable<any> {
|
||||||
return this.http
|
return this.http
|
||||||
.delete(`/api/projects/${projectId}/members/${memberId}`).toPromise()
|
.delete(`/api/projects/${projectId}/members/${memberId}`)
|
||||||
.then(response => response.status)
|
.pipe(map(response => response.status)
|
||||||
.catch(error => Promise.reject(error));
|
, catchError(error => observableThrowError(error)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,8 @@ import { Router, Resolve, RouterStateSnapshot, ActivatedRouteSnapshot } from '@a
|
|||||||
import { Project } from './project';
|
import { Project } from './project';
|
||||||
import { ProjectService } from './project.service';
|
import { ProjectService } from './project.service';
|
||||||
import { SessionService } from '../shared/session.service';
|
import { SessionService } from '../shared/session.service';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
import { map, catchError } from "rxjs/operators";
|
||||||
|
|
||||||
|
|
||||||
import { Roles } from '../shared/shared.const';
|
import { Roles } from '../shared/shared.const';
|
||||||
@ -30,7 +32,7 @@ export class ProjectRoutingResolver implements Resolve<Project> {
|
|||||||
private projectService: ProjectService,
|
private projectService: ProjectService,
|
||||||
private router: Router) { }
|
private router: Router) { }
|
||||||
|
|
||||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<Project> {
|
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<Project> {
|
||||||
// Support both parameters and query parameters
|
// Support both parameters and query parameters
|
||||||
let projectId = route.params['id'];
|
let projectId = route.params['id'];
|
||||||
if (!projectId) {
|
if (!projectId) {
|
||||||
@ -38,8 +40,7 @@ export class ProjectRoutingResolver implements Resolve<Project> {
|
|||||||
}
|
}
|
||||||
return this.projectService
|
return this.projectService
|
||||||
.getProject(projectId)
|
.getProject(projectId)
|
||||||
.toPromise()
|
.pipe(map((project: Project) => {
|
||||||
.then((project: Project) => {
|
|
||||||
if (project) {
|
if (project) {
|
||||||
let currentUser = this.sessionService.getCurrentUser();
|
let currentUser = this.sessionService.getCurrentUser();
|
||||||
if (currentUser) {
|
if (currentUser) {
|
||||||
@ -58,10 +59,10 @@ export class ProjectRoutingResolver implements Resolve<Project> {
|
|||||||
this.router.navigate(['/harbor', 'projects']);
|
this.router.navigate(['/harbor', 'projects']);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
}, catchError (error => {
|
||||||
this.router.navigate(['/harbor', 'projects']);
|
this.router.navigate(['/harbor', 'projects']);
|
||||||
return null;
|
return null;
|
||||||
});
|
})));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,11 +71,11 @@ export class ProjectService {
|
|||||||
catchError(error => observableThrowError(error)), );
|
catchError(error => observableThrowError(error)), );
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteProject(projectId: number): Promise<any> {
|
deleteProject(projectId: number): Observable<any> {
|
||||||
return this.http
|
return this.http
|
||||||
.delete(`/api/projects/${projectId}`).toPromise()
|
.delete(`/api/projects/${projectId}`)
|
||||||
.then(response => response.status)
|
.pipe(map(response => response.status)
|
||||||
.catch(error => Promise.reject(error));
|
, catchError(error => observableThrowError(error)));
|
||||||
}
|
}
|
||||||
|
|
||||||
checkProjectExists(projectName: string): Observable<any> {
|
checkProjectExists(projectName: string): Observable<any> {
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
<clr-icon shape="check-circle" *ngSwitchCase="false" size="20" class="color-green"></clr-icon>
|
<clr-icon shape="check-circle" *ngSwitchCase="false" size="20" class="color-green"></clr-icon>
|
||||||
<clr-icon shape="times-circle" *ngSwitchCase="true" size="16" class="color-red red-position"></clr-icon>
|
<clr-icon shape="times-circle" *ngSwitchCase="true" size="16" class="color-red red-position"></clr-icon>
|
||||||
</clr-dg-cell>
|
</clr-dg-cell>
|
||||||
<clr-dg-cell>{{r.expiresat * 1000 | date: 'short'}}</clr-dg-cell>
|
<clr-dg-cell>{{r.expires_at * 1000 | date: 'short'}}</clr-dg-cell>
|
||||||
<clr-dg-cell>{{r.description}}</clr-dg-cell>
|
<clr-dg-cell>{{r.description}}</clr-dg-cell>
|
||||||
</clr-dg-row>
|
</clr-dg-row>
|
||||||
<clr-dg-footer>
|
<clr-dg-footer>
|
||||||
|
@ -3,7 +3,7 @@ export class Robot {
|
|||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
description: string;
|
description: string;
|
||||||
expiresat: number;
|
expires_at: number;
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
access: {
|
access: {
|
||||||
isPull: boolean;
|
isPull: boolean;
|
||||||
|
@ -42,8 +42,8 @@ export class ReplicationPageComponent implements OnInit, AfterViewInit {
|
|||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.projectIdentify = +this.route.snapshot.parent.params['id'];
|
this.projectIdentify = +this.route.snapshot.parent.params['id'];
|
||||||
this.getReplicationPermissions(this.projectIdentify);
|
this.getReplicationPermissions(this.projectIdentify);
|
||||||
this.proService.listProjects("", undefined).toPromise()
|
this.proService.listProjects("", undefined)
|
||||||
.then(response => {
|
.subscribe(response => {
|
||||||
let projects = response.json() as Project[];
|
let projects = response.json() as Project[];
|
||||||
if (projects.length) {
|
if (projects.length) {
|
||||||
let project = projects.find(data => data.project_id === this.projectIdentify);
|
let project = projects.find(data => data.project_id === this.projectIdentify);
|
||||||
|
@ -46,8 +46,8 @@ export class TopRepoComponent implements OnInit {
|
|||||||
// Get top popular repositories
|
// Get top popular repositories
|
||||||
getTopRepos() {
|
getTopRepos() {
|
||||||
this.topRepoService.getTopRepos()
|
this.topRepoService.getTopRepos()
|
||||||
.then(repos => this.topRepos = repos )
|
.subscribe(repos => this.topRepos = repos
|
||||||
.catch(error => {
|
, error => {
|
||||||
this.messageHandlerService.handleError(error);
|
this.messageHandlerService.handleError(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,8 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Http } from '@angular/http';
|
import { Http } from '@angular/http';
|
||||||
|
import { map, catchError } from "rxjs/operators";
|
||||||
|
import { Observable, throwError as observableThrowError } from "rxjs";
|
||||||
import { Repository } from '@harbor/ui';
|
import { Repository } from '@harbor/ui';
|
||||||
|
|
||||||
import {HTTP_GET_OPTIONS} from "../../shared/shared.utils";
|
import {HTTP_GET_OPTIONS} from "../../shared/shared.utils";
|
||||||
@ -35,13 +36,13 @@ export class TopRepoService {
|
|||||||
* Get top popular repositories
|
* Get top popular repositories
|
||||||
*
|
*
|
||||||
* ** deprecated param {string} keyword
|
* ** deprecated param {string} keyword
|
||||||
* returns {Promise<TopRepo>}
|
* returns {Observable<TopRepo>}
|
||||||
*
|
*
|
||||||
* @memberOf GlobalSearchService
|
* @memberOf GlobalSearchService
|
||||||
*/
|
*/
|
||||||
getTopRepos(): Promise<Repository[]> {
|
getTopRepos(): Observable<Repository[]> {
|
||||||
return this.http.get(topRepoEndpoint, HTTP_GET_OPTIONS).toPromise()
|
return this.http.get(topRepoEndpoint, HTTP_GET_OPTIONS)
|
||||||
.then(response => response.json() as Repository[])
|
.pipe(map(response => response.json() as Repository[])
|
||||||
.catch(error => Promise.reject(error));
|
, catchError(error => observableThrowError(error)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ export class NewUserFormComponent implements AfterViewChecked, OnInit {
|
|||||||
|
|
||||||
this.checkOnGoing[key] = true;
|
this.checkOnGoing[key] = true;
|
||||||
this.session.checkUserExisting("username", this.newUser.username)
|
this.session.checkUserExisting("username", this.newUser.username)
|
||||||
.then((res: boolean) => {
|
.subscribe((res: boolean) => {
|
||||||
this.checkOnGoing[key] = false;
|
this.checkOnGoing[key] = false;
|
||||||
this.validationStateMap[key] = !res;
|
this.validationStateMap[key] = !res;
|
||||||
if (res) {
|
if (res) {
|
||||||
@ -129,8 +129,7 @@ export class NewUserFormComponent implements AfterViewChecked, OnInit {
|
|||||||
result: res
|
result: res
|
||||||
}; // Tag it checked
|
}; // Tag it checked
|
||||||
this.forceRefreshView(2000);
|
this.forceRefreshView(2000);
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.checkOnGoing[key] = false;
|
this.checkOnGoing[key] = false;
|
||||||
this.validationStateMap[key] = false; // Not valid @ backend
|
this.validationStateMap[key] = false; // Not valid @ backend
|
||||||
this.forceRefreshView(2000);
|
this.forceRefreshView(2000);
|
||||||
@ -152,7 +151,7 @@ export class NewUserFormComponent implements AfterViewChecked, OnInit {
|
|||||||
// Mail changed
|
// Mail changed
|
||||||
this.checkOnGoing[key] = true;
|
this.checkOnGoing[key] = true;
|
||||||
this.session.checkUserExisting("email", this.newUser.email)
|
this.session.checkUserExisting("email", this.newUser.email)
|
||||||
.then((res: boolean) => {
|
.subscribe((res: boolean) => {
|
||||||
this.checkOnGoing[key] = false;
|
this.checkOnGoing[key] = false;
|
||||||
this.validationStateMap[key] = !res;
|
this.validationStateMap[key] = !res;
|
||||||
if (res) {
|
if (res) {
|
||||||
@ -162,8 +161,7 @@ export class NewUserFormComponent implements AfterViewChecked, OnInit {
|
|||||||
result: res
|
result: res
|
||||||
}; // Tag it checked
|
}; // Tag it checked
|
||||||
this.forceRefreshView(2000);
|
this.forceRefreshView(2000);
|
||||||
})
|
}, error => {
|
||||||
.catch(error => {
|
|
||||||
this.checkOnGoing[key] = false;
|
this.checkOnGoing[key] = false;
|
||||||
this.validationStateMap[key] = false; // Not valid @ backend
|
this.validationStateMap[key] = false; // Not valid @ backend
|
||||||
this.forceRefreshView(2000);
|
this.forceRefreshView(2000);
|
||||||
|
@ -25,7 +25,8 @@ import { AppConfigService } from '../../app-config.service';
|
|||||||
import { maintainUrlQueryParmas } from '../../shared/shared.utils';
|
import { maintainUrlQueryParmas } from '../../shared/shared.utils';
|
||||||
import { MessageHandlerService } from '../message-handler/message-handler.service';
|
import { MessageHandlerService } from '../message-handler/message-handler.service';
|
||||||
import { SearchTriggerService } from '../../base/global-search/search-trigger.service';
|
import { SearchTriggerService } from '../../base/global-search/search-trigger.service';
|
||||||
|
import { map, catchError } from "rxjs/operators";
|
||||||
|
import { Observable, throwError as observableThrowError, observable } from "rxjs";
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AuthCheckGuard implements CanActivate, CanActivateChild {
|
export class AuthCheckGuard implements CanActivate, CanActivateChild {
|
||||||
constructor(
|
constructor(
|
||||||
@ -45,7 +46,7 @@ export class AuthCheckGuard implements CanActivate, CanActivateChild {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean> | boolean {
|
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {
|
||||||
// When routing change, clear
|
// When routing change, clear
|
||||||
this.msgHandler.clear();
|
this.msgHandler.clear();
|
||||||
if (this.appConfigService.getConfig().read_only.toString() === 'true') {
|
if (this.appConfigService.getConfig().read_only.toString() === 'true') {
|
||||||
@ -53,8 +54,7 @@ export class AuthCheckGuard implements CanActivate, CanActivateChild {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.searchTrigger.closeSearch(true);
|
this.searchTrigger.closeSearch(true);
|
||||||
return new Promise((resolve, reject) => {
|
return new Observable( observer => {
|
||||||
// Before activating, we firstly need to confirm whether the route is coming from peer part - admiral
|
|
||||||
let queryParams = route.queryParams;
|
let queryParams = route.queryParams;
|
||||||
if (queryParams) {
|
if (queryParams) {
|
||||||
if (queryParams[AdmiralQueryParamKey]) {
|
if (queryParams[AdmiralQueryParamKey]) {
|
||||||
@ -66,20 +66,19 @@ export class AuthCheckGuard implements CanActivate, CanActivateChild {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.router.navigateByUrl(keyRemovedUrl);
|
this.router.navigateByUrl(keyRemovedUrl);
|
||||||
return resolve(false);
|
return observer.next(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let user = this.authService.getCurrentUser();
|
let user = this.authService.getCurrentUser();
|
||||||
if (!user) {
|
if (!user) {
|
||||||
this.authService.retrieveUser()
|
this.authService.retrieveUser()
|
||||||
.then(() => resolve(true))
|
.subscribe(() => observer.next(true)
|
||||||
.catch(error => {
|
, error => {
|
||||||
// If is guest, skip it
|
// If is guest, skip it
|
||||||
if (this.isGuest(route, state)) {
|
if (this.isGuest(route, state)) {
|
||||||
return resolve(true);
|
return observer.next(true);
|
||||||
}
|
}
|
||||||
// Session retrieving failed then redirect to sign-in
|
// Session retrieving failed.pipe(map redirect to sign-in
|
||||||
// no matter what status code is.
|
// no matter what status code is.
|
||||||
// Please pay attention that route 'HARBOR_ROOT' and 'EMBEDDED_SIGN_IN' support anonymous user
|
// Please pay attention that route 'HARBOR_ROOT' and 'EMBEDDED_SIGN_IN' support anonymous user
|
||||||
if (state.url !== CommonRoutes.HARBOR_ROOT && !state.url.startsWith(CommonRoutes.EMBEDDED_SIGN_IN)) {
|
if (state.url !== CommonRoutes.HARBOR_ROOT && !state.url.startsWith(CommonRoutes.EMBEDDED_SIGN_IN)) {
|
||||||
@ -87,18 +86,18 @@ export class AuthCheckGuard implements CanActivate, CanActivateChild {
|
|||||||
queryParams: { "redirect_url": state.url }
|
queryParams: { "redirect_url": state.url }
|
||||||
};
|
};
|
||||||
this.router.navigate([CommonRoutes.EMBEDDED_SIGN_IN], navigatorExtra);
|
this.router.navigate([CommonRoutes.EMBEDDED_SIGN_IN], navigatorExtra);
|
||||||
return resolve(false);
|
return observer.next(false);
|
||||||
} else {
|
} else {
|
||||||
return resolve(true);
|
return observer.next(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
return resolve(true);
|
return observer.next(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
canActivateChild(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean> | boolean {
|
canActivateChild(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {
|
||||||
return this.canActivate(route, state);
|
return this.canActivate(route, state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ import { ConfirmationDialogService } from '../confirmation-dialog/confirmation-d
|
|||||||
import { ConfirmationMessage } from '../confirmation-dialog/confirmation-message';
|
import { ConfirmationMessage } from '../confirmation-dialog/confirmation-message';
|
||||||
import { ConfirmationState, ConfirmationTargets } from '../shared.const';
|
import { ConfirmationState, ConfirmationTargets } from '../shared.const';
|
||||||
import { TagRepositoryComponent } from '../../repository/tag-repository/tag-repository.component';
|
import { TagRepositoryComponent } from '../../repository/tag-repository/tag-repository.component';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class LeavingRepositoryRouteDeactivate implements CanDeactivate<TagRepositoryComponent> {
|
export class LeavingRepositoryRouteDeactivate implements CanDeactivate<TagRepositoryComponent> {
|
||||||
@ -33,9 +34,9 @@ export class LeavingRepositoryRouteDeactivate implements CanDeactivate<TagReposi
|
|||||||
canDeactivate(
|
canDeactivate(
|
||||||
tagRepo: TagRepositoryComponent,
|
tagRepo: TagRepositoryComponent,
|
||||||
route: ActivatedRouteSnapshot,
|
route: ActivatedRouteSnapshot,
|
||||||
state: RouterStateSnapshot): Promise<boolean> | boolean {
|
state: RouterStateSnapshot): Observable<boolean> | boolean {
|
||||||
// Confirmation before leaving config route
|
// Confirmation before leaving config route
|
||||||
return new Promise((resolve, reject) => {
|
return new Observable((observer) => {
|
||||||
if (tagRepo && tagRepo.hasChanges()) {
|
if (tagRepo && tagRepo.hasChanges()) {
|
||||||
let msg: ConfirmationMessage = new ConfirmationMessage(
|
let msg: ConfirmationMessage = new ConfirmationMessage(
|
||||||
"CONFIG.LEAVING_CONFIRMATION_TITLE",
|
"CONFIG.LEAVING_CONFIRMATION_TITLE",
|
||||||
@ -48,16 +49,16 @@ export class LeavingRepositoryRouteDeactivate implements CanDeactivate<TagReposi
|
|||||||
return this.confirmation.confirmationConfirm$.subscribe(confirmMsg => {
|
return this.confirmation.confirmationConfirm$.subscribe(confirmMsg => {
|
||||||
if (confirmMsg && confirmMsg.source === ConfirmationTargets.REPOSITORY) {
|
if (confirmMsg && confirmMsg.source === ConfirmationTargets.REPOSITORY) {
|
||||||
if (confirmMsg.state === ConfirmationState.CONFIRMED) {
|
if (confirmMsg.state === ConfirmationState.CONFIRMED) {
|
||||||
return resolve(true);
|
return observer.next(true);
|
||||||
} else {
|
} else {
|
||||||
return resolve(false); // Prevent leading route
|
return observer.next(false); // Prevent leading route
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return resolve(true); // Should go on
|
return observer.next(true); // Should go on
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
return resolve(true);
|
return observer.next(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ import {
|
|||||||
import { SessionService } from '../../shared/session.service';
|
import { SessionService } from '../../shared/session.service';
|
||||||
import { ProjectService } from '../../project/project.service';
|
import { ProjectService } from '../../project/project.service';
|
||||||
import { CommonRoutes } from '../../shared/shared.const';
|
import { CommonRoutes } from '../../shared/shared.const';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class MemberGuard implements CanActivate, CanActivateChild {
|
export class MemberGuard implements CanActivate, CanActivateChild {
|
||||||
@ -29,49 +30,51 @@ export class MemberGuard implements CanActivate, CanActivateChild {
|
|||||||
private projectService: ProjectService,
|
private projectService: ProjectService,
|
||||||
private router: Router) {}
|
private router: Router) {}
|
||||||
|
|
||||||
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean> | boolean {
|
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {
|
||||||
let projectId = route.params['id'];
|
let projectId = route.params['id'];
|
||||||
this.sessionService.setProjectMembers([]);
|
this.sessionService.setProjectMembers([]);
|
||||||
return new Promise((resolve, reject) => {
|
return new Observable((observer) => {
|
||||||
let user = this.sessionService.getCurrentUser();
|
let user = this.sessionService.getCurrentUser();
|
||||||
if (user === null) {
|
if (user === null) {
|
||||||
this.sessionService.retrieveUser()
|
this.sessionService.retrieveUser()
|
||||||
.then(() => resolve(this.checkMemberStatus(state.url, projectId)))
|
.subscribe(() => {
|
||||||
.catch(() => {
|
this.checkMemberStatus(state.url, projectId).subscribe((res) => observer.next(res));
|
||||||
|
}
|
||||||
|
, error => {
|
||||||
this.router.navigate([CommonRoutes.HARBOR_DEFAULT]);
|
this.router.navigate([CommonRoutes.HARBOR_DEFAULT]);
|
||||||
resolve(false);
|
observer.next(false);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
return resolve(this.checkMemberStatus(state.url, projectId));
|
this.checkMemberStatus(state.url, projectId).subscribe((res) => observer.next(res));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
checkMemberStatus(url: string, projectId: number): Promise<boolean> {
|
checkMemberStatus(url: string, projectId: number): Observable<boolean> {
|
||||||
return new Promise<boolean>((resolve, reject) => {
|
return new Observable<boolean>((observer) => {
|
||||||
this.projectService.checkProjectMember(projectId)
|
this.projectService.checkProjectMember(projectId)
|
||||||
.subscribe(res => {
|
.subscribe(res => {
|
||||||
this.sessionService.setProjectMembers(res);
|
this.sessionService.setProjectMembers(res);
|
||||||
return resolve(true);
|
return observer.next(true);
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
// Add exception for repository in project detail router activation.
|
// Add exception for repository in project detail router activation.
|
||||||
this.projectService.getProject(projectId).subscribe(project => {
|
this.projectService.getProject(projectId).subscribe(project => {
|
||||||
if (project.metadata && project.metadata.public === 'true') {
|
if (project.metadata && project.metadata.public === 'true') {
|
||||||
return resolve(true);
|
return observer.next(true);
|
||||||
}
|
}
|
||||||
this.router.navigate([CommonRoutes.HARBOR_DEFAULT]);
|
this.router.navigate([CommonRoutes.HARBOR_DEFAULT]);
|
||||||
return resolve(false);
|
return observer.next(false);
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
this.router.navigate([CommonRoutes.HARBOR_DEFAULT]);
|
this.router.navigate([CommonRoutes.HARBOR_DEFAULT]);
|
||||||
return resolve(false);
|
return observer.next(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
canActivateChild(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean> | boolean {
|
canActivateChild(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {
|
||||||
return this.canActivate(route, state);
|
return this.canActivate(route, state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ import {
|
|||||||
} from '@angular/router';
|
} from '@angular/router';
|
||||||
import { CommonRoutes } from '../../shared/shared.const';
|
import { CommonRoutes } from '../../shared/shared.const';
|
||||||
import { AppConfigService } from '../../app-config.service';
|
import { AppConfigService } from '../../app-config.service';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ModeGuard implements CanActivate, CanActivateChild {
|
export class ModeGuard implements CanActivate, CanActivateChild {
|
||||||
@ -27,28 +28,28 @@ export class ModeGuard implements CanActivate, CanActivateChild {
|
|||||||
private router: Router,
|
private router: Router,
|
||||||
private appConfigService: AppConfigService) { }
|
private appConfigService: AppConfigService) { }
|
||||||
|
|
||||||
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean> | boolean {
|
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {
|
||||||
// Show the right sign-in page for different modes
|
// Show the right sign-in page for different modes
|
||||||
return new Promise((resolve, reject) => {
|
return new Observable((observer) => {
|
||||||
if (this.appConfigService.isIntegrationMode()) {
|
if (this.appConfigService.isIntegrationMode()) {
|
||||||
if (state.url.startsWith(CommonRoutes.SIGN_IN)) {
|
if (state.url.startsWith(CommonRoutes.SIGN_IN)) {
|
||||||
this.router.navigate([CommonRoutes.EMBEDDED_SIGN_IN], route.queryParams);
|
this.router.navigate([CommonRoutes.EMBEDDED_SIGN_IN], route.queryParams);
|
||||||
resolve(false);
|
observer.next(false);
|
||||||
} else {
|
} else {
|
||||||
resolve(true);
|
observer.next(true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (state.url.startsWith(CommonRoutes.EMBEDDED_SIGN_IN)) {
|
if (state.url.startsWith(CommonRoutes.EMBEDDED_SIGN_IN)) {
|
||||||
this.router.navigate([CommonRoutes.SIGN_IN], route.queryParams);
|
this.router.navigate([CommonRoutes.SIGN_IN], route.queryParams);
|
||||||
resolve(false);
|
observer.next(false);
|
||||||
} else {
|
} else {
|
||||||
resolve(true);
|
observer.next(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
canActivateChild(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean> | boolean {
|
canActivateChild(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {
|
||||||
return this.canActivate(route, state);
|
return this.canActivate(route, state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user