Skip to content

Commit 8d9bea3

Browse files
committed
again change folder structure
1 parent d89d5b2 commit 8d9bea3

11 files changed

+56
-22
lines changed

config_monitoring.py

+2
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@
22
port = 5555
33
title = 'title Monitoring'
44
database = 'monitoring.db'
5+
svn_login = ''
6+
svn_password = ''
57

68
DEBUG = True

scripts/db.py db.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
import time
33
import configparser
44

5-
from scripts.parse import Parser
5+
from parse import Parser
66
from config_monitoring import database
77

8+
89
class Database:
910
def __init__(self, name):
1011
config = configparser.ConfigParser()

scripts/merger.py merger.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,18 @@
44
import os
55
from shutil import rmtree
66
import time
7-
from urllib.parse import urlparse
87
import subprocess as sp
98
from subprocess import PIPE
109
import tempfile
1110
import pysvn
1211

12+
from urllib.parse import urlparse
13+
from config_monitoring import svn_login, svn_password
1314

1415
class SvnClient:
1516
def __init__(self):
16-
self.login = ''
17-
self.password = ''
17+
self.login = svn_login
18+
self.password = svn_password
1819
self.timeout = 300
1920

2021
def connect(self):

scripts/parse.py parse.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from lxml import html
88
import lxml
99

10-
from scripts import ping
10+
import ping
1111

1212

1313
class Parser:

scripts/ping.py ping.py

File renamed without changes.

server.py

+19-10
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
import itertools
33
import os
44
import sys
5-
import subprocess
65

7-
from flask import Flask, render_template, redirect, jsonify, request, Response, url_for
6+
from flask import Flask, render_template, redirect, jsonify, request, Response, url_for, abort
7+
88
from config_monitoring import host, port, title, database
9+
import db
910

10-
from scripts import db
1111
# from scripts import merger
1212
# from scripts.testbranch import downloadSource
1313

@@ -71,13 +71,15 @@ def index_merge():
7171
return render_template('merge_template.html', buttons=buttons)
7272

7373

74-
@app.route('/<action>', methods=['POST'])
75-
def merge(action):
76-
buttons = dtb.read_button()
77-
for data in buttons:
78-
if action == data[0]:
79-
out = svn.mergeGo(data[1])
80-
return render_template('merge_result.html', out=out)
74+
@app.route('/buttons', methods=['POST'])
75+
def merge():
76+
buttons = [i[0] for i in dtb.read_button()]
77+
input_name = [key for key in dict(request.form).keys()]
78+
input_name = input_name[0]
79+
if input_name in buttons:
80+
# out = svn.mergeGo(input_name)
81+
out = 'svn'
82+
return render_template('merge_result.html', out=out)
8183
else:
8284
return redirect('/')
8385

@@ -134,6 +136,13 @@ def events():
134136
return Response(events(), content_type='text/event-stream')
135137
return redirect(url_for('static', filename='mergeout.html'))
136138

139+
# @app.route('/login')
140+
# def login():
141+
# abort(404)
142+
#
143+
# @app.errorhandler(404)
144+
# def page_not_found(error):
145+
# return render_template('branch.html'), 404
137146

138147
if __name__ == '__main__':
139148
app.run(host=host, port=port)

static/css/merge.css

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
div#loading {
2+
width: 35px;
3+
height: 35px;
4+
display: none;
5+
background: url(/static/img/loader.gif) no-repeat;
6+
cursor: wait;
7+
}

static/css/style.css

+8
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,11 @@ input, label {
3030
float:left;
3131
margin:5px;
3232
}
33+
34+
div#loading {
35+
width: 35px;
36+
height: 35px;
37+
display: none;
38+
background: url(/static/img/loader.gif) no-repeat;
39+
cursor: wait;
40+
}

static/img/loader.gif

3.13 KB
Loading

templates/index.html

+12-6
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,15 @@
44
<title>Страница автотестирования</title>
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
7-
<script src="templates/js/script.js"></script>
7+
<script src="static/js/script.js"></script>
88
<link rel="stylesheet" href="static/css/style.css" type="text/css">
99
<link href="static/css/bootstrap.min.css" rel="stylesheet" media="screen">
10+
<!--<script type="text/javascript">-->
11+
<!--function loading(){-->
12+
<!--$("#loading").show();-->
13+
<!--$("#content").hide();-->
14+
<!--}-->
15+
<!--</script>-->
1016
</head>
1117
<body>
1218
<div class="container-fluid">
@@ -106,14 +112,14 @@
106112
</div>
107113
<div class="merge">
108114
<p class="text-center"><strong>Кнопки мержа</strong></p>
109-
110-
<div>
115+
<div id="loading"></div>
116+
<div id="content">
111117
{% for button in buttons %}
112-
<form role="form" action="{{ ''.join([button[0]]) }}" target="_blank" method="post">
118+
<form role="form" action="buttons" target="_blank" method="post">
113119
<div class="form-group">
114-
<input class="btn btn-default" type="submit" value="{{ ''.join([button[0]]) }}"
120+
<input name="{{ ''.join([button[0]]) }}" class="btn btn-default" type="submit" value="{{ ''.join([button[0]]) }}"
115121
title="{{ ''.join([button[1]]) }}"
116-
style="width:150px;"/>
122+
style="width:150px;">
117123
</div>
118124
</form>
119125
{% endfor %}

scripts/testbranch.py testbranch.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import tempfile
22
import sqlite3
33

4-
from scripts.merger import SvnClient
4+
from merger import SvnClient
55

66

77
svn = SvnClient()

0 commit comments

Comments
 (0)