all files / app/utils/componentProperties/ packageProperties.ts

100% Statements 4/4
100% Branches 0/0
100% Functions 0/0
100% Lines 4/4
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85  1×       1×                                                                                                     1×                                             1×          
import { OptionalFieldProperties } from '../types';
import { Validator } from '../validator';
 
type fieldPropertiesMap = {[id: string]: OptionalFieldProperties};
 
let commonProperties: fieldPropertiesMap = {
    'limits_vmem': {
        paramName: 'vmem',
        placeHolder: 'vmem',
        editing: true,
        requirements: [{'m': Validator.isMemory}],
        tooltipText: 'Use postfix if it is needed. ' +
        'For example: 1024[K|M|G]. By default used "K".'
    },
    'limits_pmem': {
        placeHolder: 'pmem',
        editing: true,
        paramName: 'pmem',
        requirements: [{'m': Validator.isMemory}],
        tooltipText: 'Use postfix if it is needed. ' +
        'For example: 1024[K|M|G]. By default used "K".'
    },
    'limits_ep': {
        placeHolder: 'ep',
        editing: true,
        paramName: 'maxEntryProcs',
        requirements: [{'m': Validator.isNotNegativeNumber}]
    },
    'limits_nproc': {
        placeHolder: 'nproc',
        editing: true,
        paramName: 'nproc',
        requirements: [{'m': Validator.isNotNegativeNumber}]
    },
    'limits_iops': {
        placeHolder: 'iops',
        editing: true,
        paramName: 'iops',
        requirements: [{'m': Validator.isNotNegativeNumber}]
    },
    'limits_inodes_soft': {
        paramName: 'inodes_soft',
        placeHolder: 'soft',
        editing: true,
        isProtected: true,
        requirements: [{'m': Validator.isNotNegativeNumber}]
    },
    'limits_inodes_hard': {
        paramName: 'inodes_hard',
        placeHolder: 'hard',
        editing: true,
        isProtected: true,
        requirements: [{'m': Validator.isNotNegativeNumber}]
    }
};
 
export let packageProperties: fieldPropertiesMap = Object.assign({
    'package_name': {},
    'provider': {},
    'limits_cpu_all': {
        paramName: 'speed',
        editing: true,
        requirements: [
            {'m': Validator.isRequired},
            {'m': Validator.isCpuValue},
        ],
        tooltipText: 'Use postfix if it is needed. ' +
        'For example: 1024[Mhz|Ghz|%]. By default used "%".'
    },
    'limits_io_all': {
        placeHolder: 'io',
        paramName: 'io',
        editing: true,
        requirements: [{'m': Validator.isSpeed}],
        tooltipText: 'Use postfix if it is needed. ' +
        'For example: 1024[KB/s|MB/s|G/s]. By default used "KB/s".'
    }
}, commonProperties);
 
export let userProperties: fieldPropertiesMap = Object.assign({
    'id': {},
    'username': {},
    'package': {}
}, commonProperties);