def index(): """Function for handling home route. Args: None Returns: Home Page """ # Get UID of _infoset agent database = Database() session = database.session() record = session.query(Agent.id).filter(Agent.idx == 1).one() database.close() uid = record.id.decode('utf-8') # Get agent information agent = GetUID(uid) idx_agent = agent.idx() host = _infoset_hostname() agent_list = [agent.everything()] datapoints = GetDataPoint(idx_agent) data_point_dict = datapoints.everything() # Render the home page return render_template('index.html', data=data_point_dict, agent_list=agent_list, uid=uid, hostname=host)
def fetch_agent_dp(uid): """Function for handling /fetch/agent/<uid> route. Args: uid: Unique Identifier of an Infoset Agent Returns: JSON response of all datapoints """ # Fetches agent from mysql by uid agent = GetUID(uid) idx = agent.idx() # Gets all datapoints associated with agent datapoints = GetDataPoint(idx) return jsonify(datapoints.everything())
def overview(uid): """Function for showing UID related data for agent. Args: uid: UID of agent Returns: overview page """ # Get agent information agent = GetUID(uid) host = _infoset_hostname() agent_list = [agent.everything()] datapoints = GetDataPoint(agent.idx()) data_point_dict = datapoints.everything() # Render the home page return render_template('index.html', data=data_point_dict, agent_list=agent_list, uid=uid, hostname=host)