Esempio n. 1
0
    def ajaxUpdate(self):
        # Make sure this is requested via ajax
        request_type = cherrypy.request.headers.get('X-Requested-With')
        if str(request_type).lower() == 'xmlhttprequest':
            pass
        else:
            status_msg = "This page exists, but is not accessible via web browser"
            return serve_template(templatename="index.html", title="404 - Page Not Found", msg=status_msg)

        return serve_template(templatename="ajaxUpdate.html")
Esempio n. 2
0
    def ajaxUpdate(self):
        # Make sure this is requested via ajax
        request_type = cherrypy.request.headers.get('X-Requested-With')
        if str(request_type).lower() == 'xmlhttprequest':
            pass
        else:
            status_msg = "This page exists, but is not accessible via web browser"
            return serve_template(templatename="index.html",
                                  title="404 - Page Not Found",
                                  msg=status_msg)

        return serve_template(templatename="ajaxUpdate.html")
Esempio n. 3
0
 def update(self):
     cherrystrap.SIGNAL = 'update'
     message = 'updating ...'
     return serve_template(templatename="shutdown.html",
                           title="Update",
                           message=message,
                           timer=30)
Esempio n. 4
0
 def restart(self):
     cherrystrap.SIGNAL = 'restart'
     message = 'restarting ...'
     return serve_template(templatename="shutdown.html",
                           title="Restart",
                           message=message,
                           timer=15)
Esempio n. 5
0
    def operations(self, script=None, issue_list_input=None):
        status, msg = '', ''
        if jiraappy.JIRA_LOGIN_STATUS:
            consumer, client = backend.stored_oauth()

            if request.method == 'POST':
                script = request.params['script']
                issue_list_input = request.params['issue_list_input']
                issue_list = [x.strip() for x in issue_list_input.split(',')]

                if script == 'bulk-delete-worklogs' and issue_list_input:
                    status, msg = jiraInt.bulkDeleteWorklogs(issue_list)
                else:
                    status, msg = backend.ajaxMSG(
                        'failure', 'No issues entered for processing')
            else:
                pass
        else:
            status, msg = backend.ajaxMSG(
                'failure', 'Can not operate on JIRA without being logged in')

        return serve_template(templatename="operations.html",
                              title="Bulk Operations",
                              status=status,
                              msg=msg)
Esempio n. 6
0
 def caller(self, call=None, action=None):
     status, msg = '', ''
     if call == 'reindex':
         status, msg = jiraInt.reindex(action)
     return serve_template(templatename="caller.html",
                           title="Call JIRA",
                           status=status,
                           msg=msg)
Esempio n. 7
0
 def oauth_request(self):
     authorize_token_url, status, msg = backend.redirect_oauth()
     if not authorize_token_url:
         return serve_template(templatename="index.html",
                               title="Home",
                               status=status,
                               msg=msg)
     else:
         raise cherrypy.HTTPRedirect(authorize_token_url)
Esempio n. 8
0
 def shutdown(self):
     cherrystrap.config_write()
     cherrystrap.SIGNAL = 'shutdown'
     message = 'shutting down ...'
     return serve_template(templatename="shutdown.html",
                           title="Exit",
                           message=message,
                           timer=15)
     return page
Esempio n. 9
0
    def index(self):
        subroutine = subroutines()
        staticData = subroutine.static_subroutine()
        numCPUs = len(subroutine.cpuload_subroutine())
        numDisks = len(subroutine.diskio_subroutine())
        numPartitions = len(subroutine.partitions_subroutine())
        fansTemps = subroutine.sysfiles_subroutine()

        return serve_template(templatename="index.html", title="Home", staticData=staticData, numCPUs=numCPUs, numDisks=numDisks, numPartitions=numPartitions, fansTemps=fansTemps)
Esempio n. 10
0
    def config(self):
        http_look_dir = os.path.join(cherrystrap.PROG_DIR, 'static/interfaces/')
        http_look_list = [ name for name in os.listdir(http_look_dir) if os.path.isdir(os.path.join(http_look_dir, name)) ]

        config = {
            "http_look_list":   http_look_list
        }

        return serve_template(templatename="config.html", title="Settings", config=config)
Esempio n. 11
0
 def downloadLog(self, logFile=None):
     message = {}
     if logFile:
         try:
             return serve_file(logFile, "application/x-download", "attachment")
         except Exception, e:
             message['status'] = 'danger'
             message['message'] = 'There was a problem downloading log file %s' % logFile
             logger.error('There was a problem downloading log file %s: %s' % (logFile, e))
             return serve_template(templatename="logs.html", title="Logs", message=message)
Esempio n. 12
0
    def index(self, oauth_token=None):
        if oauth_token:
            status, msg = backend.validate_oauth(oauth_token)
        else:
            status, msg = '', ''

        return serve_template(templatename="index.html",
                              title="Home",
                              status=status,
                              msg=msg)
Esempio n. 13
0
 def oauth_logout(self):
     jiraappy.JIRA_OAUTH_TOKEN = None
     jiraappy.JIRA_OAUTH_SECRET = None
     cherrystrap.config_write()
     jiraappy.JIRA_LOGIN_STATUS = None
     jiraappy.JIRA_LOGIN_USER = None
     status, msg = backend.ajaxMSG('success',
                                   'Successfully logged out of JIRA OAuth')
     return serve_template(templatename="index.html",
                           title="Home",
                           status=status,
                           msg=msg)
Esempio n. 14
0
    def checkGithub(self):
        # Make sure this is requested via ajax
        request_type = cherrypy.request.headers.get('X-Requested-With')
        if str(request_type).lower() == 'xmlhttprequest':
            pass
        else:
            status_msg = "This page exists, but is not accessible via web browser"
            return serve_template(templatename="index.html", title="404 - Page Not Found", msg=status_msg)

        from cherrystrap import versioncheck
        versioncheck.checkGithub()
        cherrystrap.IGNORE_UPDATES = False
Esempio n. 15
0
    def config(self):
        http_look_dir = os.path.join(cherrystrap.PROG_DIR,
                                     'static/interfaces/')
        http_look_list = [
            name for name in os.listdir(http_look_dir)
            if os.path.isdir(os.path.join(http_look_dir, name))
        ]

        config = {"http_look_list": http_look_list}

        return serve_template(templatename="config.html",
                              title="Settings",
                              config=config)
Esempio n. 16
0
    def checkGithub(self):
        # Make sure this is requested via ajax
        request_type = cherrypy.request.headers.get('X-Requested-With')
        if str(request_type).lower() == 'xmlhttprequest':
            pass
        else:
            status_msg = "This page exists, but is not accessible via web browser"
            return serve_template(templatename="index.html",
                                  title="404 - Page Not Found",
                                  msg=status_msg)

        from cherrystrap import versioncheck
        versioncheck.checkGithub()
        cherrystrap.IGNORE_UPDATES = False
Esempio n. 17
0
 def processes(self):
     return serve_template(templatename="processes.html", title="Processes")
Esempio n. 18
0
 def configlogs(self):
     return serve_template(templatename="configlogs.html", title="Configure Logs")
Esempio n. 19
0
 def log(self):
     return serve_template(templatename="log.html", title="Log", lineList=cherrystrap.LOGLIST)
Esempio n. 20
0
 def logs(self):
     return serve_template(templatename="logs.html", title="Logs")
Esempio n. 21
0
 def logs(self):
     return serve_template(templatename="logs.html",
                           title="Log",
                           lineList=cherrystrap.LOGLIST)
Esempio n. 22
0
 def template(self):
     return serve_template(templatename="template.html",
                           title="Template Reference")
Esempio n. 23
0
 def error_page_404(status, message, traceback, version):
     status_msg = "%s - %s" % (status, message)
     return serve_template(templatename="index.html",
                           title="404 - Page Not Found",
                           msg=status_msg)
Esempio n. 24
0
    def downloadLog(self, logFile=None):
        message = {}
        if logFile:
            try:
                return serve_file(logFile, "application/x-download", "attachment")
            except Exception, e:
                message['status'] = 'danger'
                message['message'] = 'There was a problem downloading log file %s' % logFile
                logger.error('There was a problem downloading log file %s: %s' % (logFile, e))
                return serve_template(templatename="logs.html", title="Logs", message=message)

        else:
            message['status'] = 'warning'
            message['message'] = 'You must define a logFile to download'
            return serve_template(templatename="logs.html", title="Logs", message=message)

    downloadLog.exposed = True

    @require()
    def shutdown(self):
        cherrystrap.config_write()
        cherrystrap.SIGNAL = 'shutdown'
        message = 'shutting down ...'
        return serve_template(templatename="shutdown.html", title="Exit", message=message, timer=10)
        return page
    shutdown.exposed = True

    @require()
    def restart(self):
        cherrystrap.SIGNAL = 'restart'
Esempio n. 25
0
 def template(self):
     return serve_template(templatename="template.html", title="Template Reference")
Esempio n. 26
0
 def listener(self):
     return serve_template(templatename="listener.html", title="Webhooks")
Esempio n. 27
0
 def update(self):
     cherrystrap.SIGNAL = 'update'
     message = 'updating ...'
     return serve_template(templatename="shutdown.html", title="Update", message=message, timer=30)
Esempio n. 28
0
 def shutdown(self):
     cherrystrap.config_write()
     cherrystrap.SIGNAL = 'shutdown'
     message = 'shutting down ...'
     return serve_template(templatename="shutdown.html", title="Exit", message=message, timer=15)
     return page
Esempio n. 29
0
 def restart(self):
     cherrystrap.SIGNAL = 'restart'
     message = 'restarting ...'
     return serve_template(templatename="shutdown.html", title="Restart", message=message, timer=15)
Esempio n. 30
0
 def configrules(self):
     return serve_template(templatename="configrules.html", title="Configure Rules")
Esempio n. 31
0
 def error_page_404(status, message, traceback, version):
     status_msg = "%s - %s" % (status, message)
     return serve_template(templatename="index.html", title="404 - Page Not Found", msg=status_msg)
Esempio n. 32
0
 def index(self):
     return serve_template(templatename="index.html", title="Home")
Esempio n. 33
0
 def get_loginform(self, username, msg="Login Required", source="/"):
     return serve_template(templatename="login.html",
                           title="Login",
                           username=username,
                           msg=msg,
                           source=source)