wyswietlanie hostow w /clear-servers
This commit is contained in:
		
							
								
								
									
										4
									
								
								app.py
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								app.py
									
									
									
									
									
								
							@@ -75,7 +75,6 @@ class Host(db.Model):
 | 
				
			|||||||
            return daemon_ip
 | 
					            return daemon_ip
 | 
				
			||||||
        return self.hostname
 | 
					        return self.hostname
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
class DeployLog(db.Model):
 | 
					class DeployLog(db.Model):
 | 
				
			||||||
    id = db.Column(db.Integer, primary_key=True)
 | 
					    id = db.Column(db.Integer, primary_key=True)
 | 
				
			||||||
    timestamp = db.Column(db.DateTime, default=db.func.current_timestamp())
 | 
					    timestamp = db.Column(db.DateTime, default=db.func.current_timestamp())
 | 
				
			||||||
@@ -358,7 +357,6 @@ def format_host(host):
 | 
				
			|||||||
# -------------------
 | 
					# -------------------
 | 
				
			||||||
# LOGOWANIE, REJESTRACJA, ZMIANA HASŁA
 | 
					# LOGOWANIE, REJESTRACJA, ZMIANA HASŁA
 | 
				
			||||||
# -------------------
 | 
					# -------------------
 | 
				
			||||||
 | 
					 | 
				
			||||||
@app.route('/')
 | 
					@app.route('/')
 | 
				
			||||||
def index():
 | 
					def index():
 | 
				
			||||||
    if 'user_id' in session:
 | 
					    if 'user_id' in session:
 | 
				
			||||||
@@ -621,7 +619,7 @@ def clear_server():
 | 
				
			|||||||
    if 'user_id' not in session:
 | 
					    if 'user_id' not in session:
 | 
				
			||||||
        return redirect(url_for('login'))
 | 
					        return redirect(url_for('login'))
 | 
				
			||||||
    hosts = Host.query.filter_by(user_id=session['user_id']).all()
 | 
					    hosts = Host.query.filter_by(user_id=session['user_id']).all()
 | 
				
			||||||
    return render_template('clear_servers.html', hosts=hosts)
 | 
					    return render_template('clear_servers.html', hosts=hosts, format_host=format_host)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@app.route('/clear-single-server/<int:host_id>', methods=['POST'])
 | 
					@app.route('/clear-single-server/<int:host_id>', methods=['POST'])
 | 
				
			||||||
def clear_single_server(host_id):
 | 
					def clear_single_server(host_id):
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -48,7 +48,7 @@
 | 
				
			|||||||
          <label for="host_id" class="form-label">Wybierz serwer:</label>
 | 
					          <label for="host_id" class="form-label">Wybierz serwer:</label>
 | 
				
			||||||
          <select class="form-select" id="host_id" name="host_id">
 | 
					          <select class="form-select" id="host_id" name="host_id">
 | 
				
			||||||
            {% for host in hosts %}
 | 
					            {% for host in hosts %}
 | 
				
			||||||
              <option value="{{ host.id }}">{{ host.resolved_hostname }} ({{ host.raw_ip }})</option>
 | 
					              <option value="{{ host.id }}">{{ format_host(host) }}</option>
 | 
				
			||||||
            {% endfor %}
 | 
					            {% endfor %}
 | 
				
			||||||
          </select>
 | 
					          </select>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user