예제 #1
0
    def getGui(self, type_: str) -> typing.List[typing.Any]:
        localGUI = self.addDefaultFields([], ['name', 'short_name', 'comments', 'tags'])

        for field in [{
                'name': 'policy',
                'values': [gui.choiceItem(k, str(v)) for k, v in MetaPool.TYPES.items()],
                'label': ugettext('Policy'),
                'tooltip': ugettext('Service pool policy'),
                'type': gui.InputField.CHOICE_TYPE,
                'order': 100,
            }, {
                'name': 'image_id',
                'values': [gui.choiceImage(-1, '--------', DEFAULT_THUMB_BASE64)] + gui.sortedChoices([gui.choiceImage(v.uuid, v.name, v.thumb64) for v in Image.objects.all()]),
                'label': ugettext('Associated Image'),
                'tooltip': ugettext('Image assocciated with this service'),
                'type': gui.InputField.IMAGECHOICE_TYPE,
                'order': 120,
                'tab': ugettext('Display'),
            }, {
                'name': 'servicesPoolGroup_id',
                'values': [gui.choiceImage(-1, _('Default'), DEFAULT_THUMB_BASE64)] + gui.sortedChoices([gui.choiceImage(v.uuid, v.name, v.thumb64) for v in ServicePoolGroup.objects.all()]),
                'label': ugettext('Pool group'),
                'tooltip': ugettext('Pool group for this pool (for pool classify on display)'),
                'type': gui.InputField.IMAGECHOICE_TYPE,
                'order': 121,
                'tab': ugettext('Display'),
            }, {
                'name': 'visible',
                'value': True,
                'label': ugettext('Visible'),
                'tooltip': ugettext('If active, metapool will be visible for users'),
                'type': gui.InputField.CHECKBOX_TYPE,
                'order': 123,
                'tab': ugettext('Display'),
            }, {
                'name': 'calendar_message',
                'value': '',
                'label': ugettext('Calendar access denied text'),
                'tooltip': ugettext('Custom message to be shown to users if access is limited by calendar rules.'),
                'type': gui.InputField.TEXT_TYPE,
                'order': 124,
                'tab': ugettext('Display'),
            }]:
            self.addField(localGUI, field)

        return localGUI
예제 #2
0
    def getGui(self, type_: str) -> typing.List[typing.Any]:
        localGui = self.addDefaultFields([], ['name', 'comments', 'priority'])

        for field in [{
                'name':
                'image_id',
                'values':
            [gui.choiceImage(-1, '--------', DEFAULT_THUMB_BASE64)] +
                gui.sortedChoices([
                    gui.choiceImage(v.uuid, v.name, v.thumb64)
                    for v in Image.objects.all()
                ]),
                'label':
                ugettext('Associated Image'),
                'tooltip':
                ugettext('Image assocciated with this service'),
                'type':
                gui.InputField.IMAGECHOICE_TYPE,
                'order':
                102,
        }]:
            self.addField(localGui, field)

        return localGui
예제 #3
0
    def getGui(self, type_: str) -> typing.List[typing.Any]:
        # if OSManager.objects.count() < 1:  # No os managers, can't create db
        #    raise ResponseError(ugettext('Create at least one OS Manager before creating a new service pool'))
        if Service.objects.count() < 1:
            raise ResponseError(
                ugettext(
                    'Create at least a service before creating a new service pool'
                ))

        g = self.addDefaultFields([],
                                  ['name', 'short_name', 'comments', 'tags'])

        for f in [
            {
                'name':
                'service_id',
                'values': [gui.choiceItem('', '')] + gui.sortedChoices([
                    gui.choiceItem(v.uuid, v.provider.name + '\\' + v.name)
                    for v in Service.objects.all()
                ]),
                'label':
                ugettext('Base service'),
                'tooltip':
                ugettext('Service used as base of this service pool'),
                'type':
                gui.InputField.CHOICE_TYPE,
                'rdonly':
                True,
                'order':
                100,  # Ensueres is At end
            },
            {
                'name':
                'osmanager_id',
                'values': [gui.choiceItem(-1, '')] + gui.sortedChoices([
                    gui.choiceItem(v.uuid, v.name)
                    for v in OSManager.objects.all()
                ]),
                'label':
                ugettext('OS Manager'),
                'tooltip':
                ugettext('OS Manager used as base of this service pool'),
                'type':
                gui.InputField.CHOICE_TYPE,
                'rdonly':
                True,
                'order':
                101,
            },
            {
                'name':
                'allow_users_remove',
                'value':
                False,
                'label':
                ugettext('Allow removal by users'),
                'tooltip':
                ugettext(
                    'If active, the user will be allowed to remove the service "manually". Be careful with this, because the user will have the "power" to delete it\'s own service'
                ),
                'type':
                gui.InputField.CHECKBOX_TYPE,
                'order':
                111,
                'tab':
                ugettext('Advanced'),
            },
            {
                'name':
                'allow_users_reset',
                'value':
                False,
                'label':
                ugettext('Allow reset by users'),
                'tooltip':
                ugettext(
                    'If active, the user will be allowed to reset the service'
                ),
                'type':
                gui.InputField.CHECKBOX_TYPE,
                'order':
                112,
                'tab':
                ugettext('Advanced'),
            },
            {
                'name':
                'ignores_unused',
                'value':
                False,
                'label':
                ugettext('Ignores unused'),
                'tooltip':
                ugettext(
                    'If the option is enabled, UDS will not attempt to detect and remove the user services assigned but not in use.'
                ),
                'type':
                gui.InputField.CHECKBOX_TYPE,
                'order':
                113,
                'tab':
                ugettext('Advanced'),
            },
            {
                'name':
                'image_id',
                'values':
                [gui.choiceImage(-1, '--------', DEFAULT_THUMB_BASE64)] +
                gui.sortedChoices([
                    gui.choiceImage(v.uuid, v.name, v.thumb64)
                    for v in Image.objects.all()
                ]),
                'label':
                ugettext('Associated Image'),
                'tooltip':
                ugettext('Image assocciated with this service'),
                'type':
                gui.InputField.IMAGECHOICE_TYPE,
                'order':
                120,
                'tab':
                ugettext('Display'),
            },
            {
                'name':
                'pool_group_id',
                'values':
                [gui.choiceImage(-1, _('Default'), DEFAULT_THUMB_BASE64)] +
                gui.sortedChoices([
                    gui.choiceImage(v.uuid, v.name, v.thumb64)
                    for v in ServicePoolGroup.objects.all()
                ]),
                'label':
                ugettext('Pool group'),
                'tooltip':
                ugettext(
                    'Pool group for this pool (for pool classify on display)'),
                'type':
                gui.InputField.IMAGECHOICE_TYPE,
                'order':
                121,
                'tab':
                ugettext('Display'),
            },
            {
                'name':
                'visible',
                'value':
                True,
                'label':
                ugettext('Visible'),
                'tooltip':
                ugettext('If active, transport will be visible for users'),
                'type':
                gui.InputField.CHECKBOX_TYPE,
                'order':
                107,
                'tab':
                ugettext('Display'),
            },
            {
                'name':
                'initial_srvs',
                'value':
                '0',
                'minValue':
                '0',
                'label':
                ugettext('Initial available services'),
                'tooltip':
                ugettext('Services created initially for this service pool'),
                'type':
                gui.InputField.NUMERIC_TYPE,
                'order':
                130,
                'tab':
                ugettext('Availability'),
            },
            {
                'name':
                'cache_l1_srvs',
                'value':
                '0',
                'minValue':
                '0',
                'label':
                ugettext('Services to keep in cache'),
                'tooltip':
                ugettext(
                    'Services kept in cache for improved user service assignation'
                ),
                'type':
                gui.InputField.NUMERIC_TYPE,
                'order':
                131,
                'tab':
                ugettext('Availability'),
            },
            {
                'name':
                'cache_l2_srvs',
                'value':
                '0',
                'minValue':
                '0',
                'label':
                ugettext('Services to keep in L2 cache'),
                'tooltip':
                ugettext(
                    'Services kept in cache of level2 for improved service generation'
                ),
                'type':
                gui.InputField.NUMERIC_TYPE,
                'order':
                132,
                'tab':
                ugettext('Availability'),
            },
            {
                'name':
                'max_srvs',
                'value':
                '0',
                'minValue':
                '1',
                'label':
                ugettext('Maximum number of services to provide'),
                'tooltip':
                ugettext(
                    'Maximum number of service (assigned and L1 cache) that can be created for this service'
                ),
                'type':
                gui.InputField.NUMERIC_TYPE,
                'order':
                133,
                'tab':
                ugettext('Availability'),
            },
            {
                'name':
                'show_transports',
                'value':
                True,
                'label':
                ugettext('Show transports'),
                'tooltip':
                ugettext(
                    'If active, alternative transports for user will be shown'
                ),
                'type':
                gui.InputField.CHECKBOX_TYPE,
                'tab':
                ugettext('Advanced'),
                'order':
                130,
            },
            {
                'name':
                'account_id',
                'values': [gui.choiceItem(-1, '')] + gui.sortedChoices([
                    gui.choiceItem(v.uuid, v.name)
                    for v in Account.objects.all()
                ]),
                'label':
                ugettext('Accounting'),
                'tooltip':
                ugettext('Account associated to this service pool'),
                'type':
                gui.InputField.CHOICE_TYPE,
                'tab':
                ugettext('Advanced'),
                'order':
                131,
            }
        ]:
            self.addField(g, f)

        return g