Exemplo n.º 1
0
def ms_create_rack():
    if request.method == 'POST':
        rackid = request.form['rackid']
        crm = ""
        mfg_so = ""
        lerom = ""
        mtm = ""
        customer = "Microsoft"
        racktype = "ms"
        sn = request.form['sn']
        expected_ship_date = ""
        ctb_date = ""
        estimated_ship_date = ""
        comments = request.form['comments']
        rack = Rack(rackid,
                    crm,
                    mfg_so,
                    lerom,
                    mtm,
                    customer,
                    racktype,
                    sn,
                    expected_ship_date,
                    ctb_date,
                    estimated_ship_date,
                    comments,
                    status="Readiness")
        rack.save_to_db()
        return redirect(
            url_for(".ms_racks_under_test",
                    _id=rack._id))  # Here put only the 1st stage and BSL
    return render_template('racks/ms_form.jinja2')
Exemplo n.º 2
0
def ms_racks_monitor():
    racks = Rack.get_ms_racks_under_test()
    title = "Microsoft Racks"
    message = "<small>Select a rack to see the test report</small>"
    if request.method == 'POST':
        query = request.form['query']
        if query == "all":
            racks = Rack.get_ms_racks()
            message += "<br><h3>ALL RACKS</h3>"
        elif query == "under_test":
            racks = Rack.get_ms_racks_under_test()
            message += "<br><h3>RACKS UNDER TEST</h3>"
        elif query == "passed":
            racks = Rack.get_ms_racks_passed()
            message += "<br><h3>PASSED RACK</h3>"
        elif query == "under_readiness":
            racks = Rack.get_ms_racks_under_readinnes()
            message += "<br><h3>RACKS UNDER READINESS</h3>"
        return render_template('racks/ms_racks_monitor.jinja2',
                               racks=racks,
                               title=title,
                               message=message)
    #  Es posible un POST para mandar llamar los racks por status . . .
    return render_template('racks/ms_racks_monitor.jinja2',
                           racks=racks,
                           title=title,
                           message=message)
Exemplo n.º 3
0
def edit_info(rack_id):
    if request.method == 'POST':
        rackid = request.form['rackid']
        crm = request.form['crm']
        mfg_so = request.form['mfg_so']
        lerom = request.form['lerom']
        mtm = request.form['mtm']
        customer = request.form['customer']
        sn = request.form['sn']
        expected_ship_date = request.form['expected_ship_date']
        ctb_date = request.form['ctb_date']
        estimated_ship_date = request.form['estimated_ship_date']
        comments = request.form['comments']
        rack = Rack.get_rack_by_id(rack_id)
        rack.rackid = rackid
        rack.crm = crm
        rack.mfg_so = mfg_so
        rack.lerom = lerom
        rack.mtm = mtm
        rack.customer = customer
        rack.sn = sn
        rack.expected_ship_date = expected_ship_date
        rack.ctb_date = ctb_date
        rack.estimated_ship_date = estimated_ship_date
        rack.comments = comments
        rack.update_to_mongo()
        return redirect(url_for('.edit'))
    return render_template('racks/edit_info.jinja2',
                           rack=Rack.get_rack_by_id(rack_id))
Exemplo n.º 4
0
def feedback(fix):
    if request.method == 'POST':
        if (len(request.form["textFeedback"]) < 20) or (len(
                request.form["textNewTask"]) < 20):
            return render_template('fixes/wrong_feedback.jinja2', fix=fix)
        else:
            # Update feedback and create new fix
            # --- Updating feedback for current failed fix
            old_fix = Fix.get_fix_by_id(fix)
            old_fix.failed(request.form["textFeedback"])
            # --- Creating new fix, add it to failure list
            new_fix = Fix(rack=old_fix.rack,
                          failure=old_fix.failure,
                          task=old_fix.task,
                          category=Task.get_task_by_id(old_fix.task).category,
                          description=request.form["textNewTask"],
                          started_at=Utils.get_utc_time(),
                          start_user=session['email'])
            new_fix.save_to_db()
            Failure.get_failure_by_id(old_fix.failure).add_fix(new_fix._id)
            tasks = []  # Empty list of task Object
            tasksid_list = Rack.get_rack_by_id(old_fix.rack).tasks
            for elem in tasksid_list:
                tasks.append(Task.get_task_by_id(elem))
            return redirect(url_for('tasks.continue_test', rack=old_fix.rack))
    else:
        actual_fix = Fix.get_fix_by_id(fix)
        return render_template('fixes/feedback.jinja2', fix=actual_fix)
Exemplo n.º 5
0
def add_new_fix(rack, task, failure):
    #
    #  If the input is less than 20 characters, create the FIX and render the rack_tasks again
    #
    if request.method == 'POST':
        if len(request.form["text"]) < 20:
            return render_template('fixes/wrong_fix_description.jinja2',
                                   task=task,
                                   rack=rack,
                                   failure=failure)
        fix = Fix(rack=rack,
                  failure=failure,
                  task=task,
                  category=Task.get_task_by_id(task).category,
                  description=request.form["text"],
                  started_at=Utils.get_utc_time(),
                  start_user=session['email'])
        fix.save_to_db()
        failure_to_update = Failure.get_failure_by_id(failure)
        failure_to_update.add_fix(fix._id)
        #  If the fix was added successfuly, render again the rack_tasks
        rack_look_up = Rack.get_rack_by_id(rack)
        taskid_list = rack_look_up.tasks
        tasks = []
        for elem in taskid_list:
            tasks.append(Task.get_task_by_id(elem))
        return redirect(url_for('tasks.continue_test', rack=rack))
    #  This is for GET requests...to create create an aditional fix
    return render_template('fixes/add_fix.jinja2',
                           failure=failure,
                           rack=rack,
                           task=task)
Exemplo n.º 6
0
def ms_rack_monitor_details(rack):
    rack_to_test = Rack.get_rack_by_id(rack)
    tasks_idlist = rack_to_test.tasks
    tasks = []
    for taskid in tasks_idlist:
        tasks.append(Task.get_task_by_id(taskid))
    return render_template('tasks/ms_rack_details.jinja2', tasks=tasks)
Exemplo n.º 7
0
def continue_test(rack):
    rack_to_test = Rack.get_rack_by_id(rack)
    tasks_idlist = rack_to_test.tasks
    tasks = []
    for taskid in tasks_idlist:
        tasks.append(Task.get_task_by_id(taskid))
    return render_template('tasks/rack_tasks.jinja2', tasks=tasks)
Exemplo n.º 8
0
def monitor():
    racks = Rack.get_all()
    title = "Rack Orders Monitor"
    message = "Click on 'Details' for more information"
    return render_template('racks/monitor.jinja2',
                           racks=racks,
                           title=title,
                           message=message)
Exemplo n.º 9
0
def racks_under_readiness():
    racks = Rack.get_racks_under_readiness()
    title = "Racks in Readiness"
    message = "Click on <strong>START</strong> button to begin"
    return render_template('racks/monitor.jinja2',
                           racks=racks,
                           title=title,
                           message=message)
Exemplo n.º 10
0
def show_test_report(rack):
    rack_report = Rack.get_rack_by_id(rack)
    tasks = []
    for elem in rack_report.tasks:
        tasks.append(Task.get_task_by_id(elem))
    return render_template('racks/test_report.jinja2',
                           rack=rack_report,
                           tasks=tasks)
Exemplo n.º 11
0
def adding_tasks(_id):
    rack = Rack.get_rack_by_id(_id)
    tasks_list = []
    for elem in rack.tasks:
        tasks_list.append(Task.get_task_by_id(elem))
    return render_template('racks/edit_tasks.jinja2',
                           rack=rack,
                           tasks=tasks_list)
Exemplo n.º 12
0
def ms_racks_under_readiness():
    racks = Rack.get_ms_racks_under_readinnes()
    title = "Microsoft Racks"
    message = "Select a rack to continue a test report "

    return render_template('racks/ms_monitor_readiness.jinja2',
                           racks=racks,
                           title=title,
                           message=message)
Exemplo n.º 13
0
def ms_passed_racks():
    racks = Rack.get_ms_racks_passed()
    title = "Microsoft Racks"
    message = "Select a rack to see the test report"

    return render_template('racks/ms_monitor.jinja2',
                           racks=racks,
                           title=title,
                           message=message)
Exemplo n.º 14
0
def racks_under_test():
    racks = Rack.get_racks_under_test()
    title = "Racks Under Test"
    message = "Select a rack to continue testing"

    return render_template('racks/monitor.jinja2',
                           racks=racks,
                           title=title,
                           message=message)
Exemplo n.º 15
0
def start_test(rack):
    rack_to_test = Rack.get_rack_by_id(rack)
    rack_to_test.start_rack(session['email'])
    tasks_idlist = rack_to_test.tasks
    first_task = Task.get_task_by_id(tasks_idlist[0])
    first_task.start(session['email'])
    tasks = []
    for taskid in tasks_idlist:
        tasks.append(Task.get_task_by_id(taskid))
    return render_template('tasks/rack_tasks.jinja2', tasks=tasks)
Exemplo n.º 16
0
def create_rack():
    if request.method == 'POST':
        rackid = request.form['rackid']
        crm = request.form['crm']
        mfg_so = request.form['mfg_so']
        lerom = request.form['lerom']
        mtm = request.form['mtm']
        customer = request.form['customer']
        racktype = request.form['racktype']
        sn = request.form['sn']
        expected_ship_date = request.form['expected_ship_date']
        ctb_date = request.form['ctb_date']
        estimated_ship_date = request.form['estimated_ship_date']
        comments = request.form['comments']
        rack = Rack(rackid, crm, mfg_so, lerom, mtm, customer, racktype, sn,
                    expected_ship_date, ctb_date, estimated_ship_date,
                    comments)
        rack.save_to_db()
        return redirect(url_for(".adding_tasks", _id=rack._id))
    return render_template('racks/form.jinja2')
Exemplo n.º 17
0
def passed(task):
    if request.method == 'POST':
        task_to_finish = Task.get_task_by_id(task)
        rack_look_up = Rack.get_rack_by_id(task_to_finish.rack)
        taskid_list = rack_look_up.tasks
        task_to_finish = Task.get_task_by_id(taskid_list[taskid_list.index(task)])
        task_to_finish.finish(session['email'])
        tasks = []
        for elem in taskid_list:
            if elem == task:
                if elem != taskid_list[-1]:
                    next_task = Task.get_task_by_id(taskid_list[taskid_list.index(elem)+1])
                    next_task.start(session['email'])
                else:
                    rack_look_up.finish_rack(session['email'])
            tasks.append(Task.get_task_by_id(elem))
        return redirect(url_for('.continue_test', rack=task_to_finish.rack))
    return render_template('tasks/confirm_pass.jinja2', task=task)
Exemplo n.º 18
0
def passed(fix):
    fix_pass = Fix.get_fix_by_id(fix)
    fix_pass.passed(session['email'])
    Task.get_task_by_id(fix_pass.task).finish(session['email'])
    Failure.get_failure_by_id(fix_pass.failure).finish(session['email'])
    rack_in_test = Rack.get_rack_by_id(fix_pass.rack)
    rack_in_test.fix_rack()
    taskid_list = rack_in_test.tasks
    tasks = []  # Empty list of task Object
    # iterating the tasks list of the rack to put the next task running
    for elem in taskid_list:
        if elem == Task.get_task_by_id(fix_pass.task)._id:
            if elem != taskid_list[-1]:
                next_task = Task.get_task_by_id(
                    taskid_list[taskid_list.index(elem) + 1])
                next_task.start(
                    session['email'])  # Setting the next task in "running"
            else:
                rack_in_test.finish_rack(
                    session['email'])  # If it's last task, rack pass
        tasks.append(Task.get_task_by_id(elem))
    return redirect(url_for('tasks.continue_test', rack=fix_pass.rack))
Exemplo n.º 19
0
def report(rack, task):
    if request.method == 'POST':
        if len(request.form["text"]) < 20:
            return render_template('failures/wrong_failure_description.jinja2',
                                   task=task,
                                   rack=rack)
        failure = Failure(rack=rack,
                          category=Task.get_task_by_id(task).category,
                          description=request.form["text"],
                          task=task,
                          started_at=Utils.get_utc_time(),
                          start_user=session['email'])
        failure.save_to_db()
        rackobject = Rack.get_rack_by_id(rack)
        rackobject.failed_rack()
        taskobject = Task.get_task_by_id(task)
        taskobject.failed(failure._id)
        return redirect(
            url_for('fixes.add_new_fix',
                    rack=rack,
                    task=task,
                    failure=failure._id))

    return render_template('failures/report.jinja2', task=task, rack=rack)
Exemplo n.º 20
0
def create_report(rack, task):
    if request.method == 'POST':
        rack_to_test = Rack.get_rack_by_id(rack)
        node_number = request.form['node_number']
        node_sn = request.form['node_sn']

        chassis_number = request.form['chassis_number']
        chassis_sn = request.form['chassis_sn']

        failed_step = request.form['failed_step']
        description = request.form['description']

        badcomponent_sn = request.form['badcomponent_sn']
        badcomponent_device = request.form['badcomponent_device']
        badcomponent_replacement = request.form['badcomponent_replacement']

        frecord = FRecord(rack=rack,
                          task=task,
                          start_user=session['email'],
                          started_at=Utils.get_utc_time(),
                          description=description,
                          badcomponent_device=badcomponent_device,
                          badcomponent_sn=badcomponent_sn,
                          badcomponent_replacement=badcomponent_replacement,
                          node_number=node_number,
                          node_sn=node_sn,
                          chassis_number=chassis_number,
                          chassis_sn=chassis_sn,
                          failed_step=failed_step)
        frecord.save_to_db()
        Task.get_task_by_id(task).failed(True)
        rack_to_test.failed_rack()
        return redirect(url_for('tasks.continue_test', rack=rack))
    return render_template('frecords/create_report.jinja2',
                           rack=rack,
                           task=task)
Exemplo n.º 21
0
def edit():
    return render_template('racks/editor.jinja2', racks=Rack.get_all())
Exemplo n.º 22
0
 def get_rack(rack):
     return Rack.get_rack_by_id(rack)
Exemplo n.º 23
0
def monitor_rack(rack):
    rack = Rack.get_rack_by_id(rack)
    return render_template('racks/monitor_rack.jinja2', rack=rack)
Exemplo n.º 24
0
def removing_task(_id, task):
    rack = Rack.get_rack_by_id(_id)
    rack.tasks.remove(task)
    rack.update_tasks(rack.tasks)
    Task.get_task_by_id(task).delete_task()
    return redirect(url_for('racks.adding_tasks', _id=_id))
Exemplo n.º 25
0
def delete_rack(rack):
    Rack.get_rack_by_id(rack).delete()
    return render_template('racks/delete.jinja2', rack=rack)