Changeset - c4eda8c23b75
[Not reviewed]
0 3 0
Jan Kaluza - 9 years ago 2016-02-01 18:18:28
jkaluza@redhat.com
Web interface: Use [identity] name instead of hostname when set
3 files changed with 17 insertions and 7 deletions:
0 comments (0 inline, 0 general)
spectrum_manager/src/APIServer.cpp
Show inline comments
 
@@ -94,7 +94,15 @@ void APIServer::serve_instances(Server *server, Server::session *session, struct
 
		Value instance;
 
		instance.SetObject();
 
		instance.AddMember("id", id.c_str(), json.GetAllocator());
 
		instance.AddMember("name", id.c_str(), json.GetAllocator());
 

	
 
		std::string name = get_config(m_config, id, "identity.name");
 
		if (name.empty() || name == "Spectrum 2 Transport") {
 
			instance.AddMember("name", id.c_str(), json.GetAllocator());
 
		}
 
		else {
 
			statuses.push_back(name);
 
			instance.AddMember("name", statuses.back().c_str(), json.GetAllocator());
 
		}
 

	
 
		std::string status = server->send_command(id, "status");
 
		if (status.empty()) {
 
@@ -119,7 +127,9 @@ void APIServer::serve_instances(Server *server, Server::session *session, struct
 
		usernames.push_back(username);
 
		instance.AddMember("registered", !username.empty(), json.GetAllocator());
 
		instance.AddMember("username", usernames.back().c_str(), json.GetAllocator());
 
		instance.AddMember("frontend", is_slack(m_config, id) ? "slack" : "xmpp", json.GetAllocator());
 

	
 
		usernames.push_back(get_config(m_config, id, "service.frontend"));
 
		instance.AddMember("frontend", usernames.back().c_str(), json.GetAllocator());
 

	
 
		instances.PushBack(instance, json.GetAllocator());
 
	}
spectrum_manager/src/methods.cpp
Show inline comments
 
@@ -501,7 +501,7 @@ static void handleConnected(boost::shared_ptr<Swift::Connection> m_conn, const s
 
	}
 
}
 

	
 
bool is_slack(ManagerConfig *config, const std::string &jid) {
 
std::string get_config(ManagerConfig *config, const std::string &jid, const std::string &key) {
 
	path p(CONFIG_STRING(config, "service.config_directory"));
 

	
 
	try {
 
@@ -528,16 +528,16 @@ bool is_slack(ManagerConfig *config, const std::string &jid) {
 
					continue;
 
				}
 

	
 
				return CONFIG_STRING(&cfg, "service.frontend") == "slack";
 
				return CONFIG_STRING(&cfg, key);
 
			}
 
		}
 

	
 
	}
 
	catch (const filesystem_error& ex) {
 
		return false;
 
		return "";
 
	}
 

	
 
	return false;
 
	return "";
 
}
 

	
 
void ask_local_server(ManagerConfig *config, Swift::BoostNetworkFactories &networkFactories, const std::string &jid, const std::string &message) {
spectrum_manager/src/methods.h
Show inline comments
 
@@ -51,7 +51,7 @@ void stop_instances(ManagerConfig *config, const std::string &_jid = "");
 
int show_status(ManagerConfig *config);
 

	
 
void ask_local_server(ManagerConfig *config, Swift::BoostNetworkFactories &networkFactories, const std::string &jid, const std::string &message);
 
bool is_slack(ManagerConfig *config, const std::string &jid);
 
std::string get_config(ManagerConfig *config, const std::string &jid, const std::string &key);
 

	
 
std::vector<std::string> show_list(ManagerConfig *config, bool show = true);
 

	
0 comments (0 inline, 0 general)