Ejemplo n.º 1
0
def presentEmailForm() -> XMLContent:
    yield xhtml.p[checkBox(
        name='mailNotification')['Send notifications via e-mail']]

    yield xhtml.h3['SMTP relay']
    yield xhtml.p[textInput(name='smtpRelay', size=60)]
    yield xhtml.p['Notification e-mails will be sent via this SMTP server.']
    yield xhtml.p[
        'Note: Currently SMTP authentication is not supported, '
        'so SMTP is only usable when access to the relay is restricted '
        'by network interface or IP address. '
        'Do not disable authentication on an SMTP relay accessible '
        'from the internet; spammers will find and abuse it.']

    yield xhtml.h3['Sender address']
    yield xhtml.p[textInput(name='mailSender', size=60)]
    yield xhtml.p['This address will be used in the "From:" field '
                  'of notification e-mails.']

    yield xhtml.p[actionButtons(Actions.SAVE, Actions.CANCEL)]

    yield xhtml.h3['Test']
    yield xhtml.p['Send a test e-mail to:']
    yield xhtml.p[textInput(name='mailRecipient', size=60)]
    yield xhtml.p[actionButtons(Actions.TEST)]
Ejemplo n.º 2
0
 def presentContent(self, **kwargs: object) -> XMLContent:
     proc = cast(FastExecute_GET.Processor, kwargs['proc'])
     configs = proc.configs
     tagged = proc.args.configId is None
     if configs:
         numJobs = sum(len(config.targets) or 1 for config in configs)
         yield xhtml.p['Create ', xhtml.b[str(numJobs), ' ',
                                          pluralize('job', numJobs)],
                       ' from the ',
                       pluralize('configuration', len(configs)),
                       ' listed below?']
         yield makeForm(args=PostArgs(
             # Args used by 'cancel':
             RefererArgs.subset(proc.args),
             # Args used by 'execute':
             confirmedId=(config.getId() for config in configs
                          )))[xhtml.p[actionButtons(Actions)]].present(
                              **kwargs)
         yield FastConfigTable.instance.present(**kwargs)
     elif tagged:
         yield (xhtml.p['No configuration matches'
                        ' tag key ', xhtml.b[proc.args.tagkey],
                        ' and value ', xhtml.b[proc.args.tagvalue],
                        '.'], self.backToReferer(proc.args))
     else:
         yield (xhtml.p['No configuration named ',
                        xhtml.b[proc.args.configId],
                        ' exists.'], self.backToReferer(proc.args))
Ejemplo n.º 3
0
    def presentContent(self, **kwargs: object) -> XMLContent:
        proc = cast(ConfigTagsBase.Processor[ArgsT], kwargs['proc'])
        for notice in proc.notices:
            yield xhtml.p(class_='notice')[notice]
        configs = proc.configs
        if configs:
            yield xhtml.h3['Selected Configurations:']
            yield TagConfigTable.instance.present(**kwargs)

            yield xhtml.h3['Common Selection Tags:']
            tagKeys = proc.project.getTagKeys()
            commonTags = getCommonTags(tagKeys,
                                       (config.tags for config in configs))
            yield makeForm(args=ParentArgs.subset(proc.args).override(
                sel={config.getId()
                     for config in configs}
            ))[ConfigTagValueEditTable.instance,
               xhtml.p[actionButtons(Actions)],
               (hiddenInput(name=f'commontags.{index:d}', value=tagName)
                for index, tagKey in enumerate(tagKeys)
                for tagName in commonTags[tagKey])].present(
                    getValues=lambda key: valuesToText(commonTags[key]),
                    **kwargs)
        else:
            yield (xhtml.h3['No configurations selected'],
                   xhtml.p[xhtml.a(href=proc.args.refererURL or parentPage)
                           ['Back to Configurations']])
Ejemplo n.º 4
0
 def presentContent(self, **kwargs: object) -> XMLContent:
     # Ask for confirmation.
     proc = cast(FabPage.Processor[TaskIdArgs], kwargs['proc'])
     taskName = proc.args.taskName
     if taskName == '/all-waiting':
         yield xhtml.p['Abort all waiting tasks?']
     elif taskName == '/all':
         yield xhtml.p['Abort all unfinished tasks?']
     else:
         yield xhtml.p['Abort task ', xhtml.b[taskName], '?']
     yield makeForm(
         args=proc.args)[xhtml.p[actionButtons(Actions)]].present(**kwargs)
Ejemplo n.º 5
0
 def __presentFormBody(self, user: User) -> XMLContent:
     yield xhtml.p[ 'Enter information about new user:'******'loginpass', value='')
     else:
         yield xhtml.p[
             'To verify your identity, '
             'please also enter your own password:'
             ]
         yield ReqPasswordTable.instance
     yield xhtml.p[ actionButtons(Actions) ]
Ejemplo n.º 6
0
def presentFormBody(**kwargs: object) -> XMLContent:
    proc = cast(PageProcessor[PasswordMsgArgs], kwargs['proc'])
    yield xhtml.p['Please enter a new password for user ',
                  xhtml.b[proc.user.name], ':']
    yield NewPasswordTable.instance
    if proc.user.name is None:
        yield hiddenInput(name='loginpass', value='')
    else:
        yield xhtml.p['To verify your identity, '
                      'please also enter your old password:']
        yield ReqPasswordTable.instance
    yield xhtml.p[actionButtons(Actions)]
Ejemplo n.º 7
0
    showOwner = False

    def getRecordsToQuery(self, proc: PageProcessor) -> Collection[Config]:
        return cast(BatchExecute_GET.Processor, proc).configs


parentPage = 'LoadExecute'


class ParentArgs(SelectArgs):
    parentQuery = RefererArg(parentPage, shared=SelectArgs)


Actions = Enum('Actions', 'EXECUTE CANCEL')

submitButtons = xhtml.p[actionButtons(Actions)]


class BatchExecute_GET(FabPage['BatchExecute_GET.Processor',
                               'BatchExecute_GET.Arguments']):
    icon = 'IconExec'
    description = 'Execute Batch'
    linkDescription = False

    class Arguments(ParentArgs):
        pass

    class Processor(SelectConfigsMixin[ParentArgs], PageProcessor[ParentArgs]):

        configDB: ClassVar[ConfigDB]
        productDefDB: ClassVar[ProductDefDB]
Ejemplo n.º 8
0
 def presentContent(self, **kwargs: object) -> XMLContent:
     proc = cast(RecordDelete_GET.Processor[DBRecord], kwargs['proc'])
     yield xhtml.p['Delete ', proc.recordName, ' ', xhtml.b[proc.args.id],
                   '?']
     yield makeForm(
         args=proc.args)[xhtml.p[actionButtons(Actions)]].present(**kwargs)
Ejemplo n.º 9
0
 def presentContent(self, **kwargs: object) -> XMLContent:
     yield xhtml.p['Delete all finished schedules?']
     yield makeForm()[xhtml.p[actionButtons(Actions)]].present(**kwargs)