aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/utils/utils.ts
diff options
context:
space:
mode:
authorEylon Malin <eylon.malin@intl.att.com>2019-12-11 08:11:02 +0200
committerEylon Malin <eylon.malin@intl.att.com>2019-12-11 08:11:02 +0200
commit0b4cdc4ab5740f9a1a4e308a0dee6ab9bcf8c6c4 (patch)
treee76e912f66c5c8e08bd97dfb62a56fcdad3bb2cd /vid-webpack-master/src/app/shared/utils/utils.ts
parent4b375fb18be002051fb4a5e07f3baf23b1e92d02 (diff)
add common method for getting max allowed instances of vfModule + UT
Issue-ID: VID-726 Signed-off-by: Eylon Malin <eylon.malin@intl.att.com> Change-Id: Ib4597a027a6ac519ca2290d41b0f3208d47cc5b3
Diffstat (limited to 'vid-webpack-master/src/app/shared/utils/utils.ts')
-rw-r--r--vid-webpack-master/src/app/shared/utils/utils.ts15
1 files changed, 11 insertions, 4 deletions
diff --git a/vid-webpack-master/src/app/shared/utils/utils.ts b/vid-webpack-master/src/app/shared/utils/utils.ts
index cd7ebdff6..3db770738 100644
--- a/vid-webpack-master/src/app/shared/utils/utils.ts
+++ b/vid-webpack-master/src/app/shared/utils/utils.ts
@@ -3,11 +3,18 @@ import * as _ from 'lodash'
export class Utils {
static getMaxFirstLevel(properties, flags: { [key: string]: boolean }) : number | null{
- if (flags && !!flags['FLAG_2002_UNLIMITED_MAX']) {
- return !_.isNil(properties) && !_.isNil(properties.max_instances) ? properties.max_instances : null;
- } else {
- return properties.max_instances || 1;
+ return this.getMaxInstancesAllowed(properties, 'max_instances', flags)
+ }
+
+ static getMaxVfModule(properties, flags: { [key: string]: boolean }) : number | null{
+ return this.getMaxInstancesAllowed(properties, 'maxCountInstances', flags)
+ }
+
+ static getMaxInstancesAllowed(properties, filedName: string, flags: { [key: string]: boolean }) : number | null{
+ if (!_.isNil(properties) && !_.isNil(properties[filedName])) {
+ return properties[filedName];
}
+ return (flags && !!flags['FLAG_2002_UNLIMITED_MAX']) ? null : 1;
}
public static clampNumber = (number, min, max) => {