DD-170 : Handle 503 answer from SLM and added a MARKET_MERCHANT_NOT_MIGRATED state to the UI, showing only the relevant UI to the user (i.e. Merchant Outbox or Marketplace Listings).

master
Merov Linden 2014-10-05 20:17:29 -07:00
parent 31d5383417
commit 6b8916e760
11 changed files with 118 additions and 17 deletions

View File

@ -131,6 +131,25 @@ LLCommand * LLCommandManager::getCommand(const LLCommandId& commandId)
return command_match;
}
LLCommand * LLCommandManager::getCommand(const std::string& name)
{
LLCommand * command_match = NULL;
CommandVector::const_iterator it = mCommands.begin();
while (it != mCommands.end())
{
if ((*it)->name() == name)
{
command_match = *it;
break;
}
it++;
}
return command_match;
}
void LLCommandManager::addCommand(LLCommand * command)
{
LLCommandId command_id = command->id();

View File

@ -190,6 +190,7 @@ public:
U32 commandCount() const;
LLCommand * getCommand(U32 commandIndex);
LLCommand * getCommand(const LLCommandId& commandId);
LLCommand * getCommand(const std::string& name);
static bool load();

View File

@ -123,8 +123,10 @@
icon="Command_MktListings_Icon"
label_ref="Command_MarketplaceListings_Label"
tooltip_ref="Command_MarketplaceListings_Tooltip"
execute_function="Floater.ToggleOrBringToFront"
execute_parameters="marketplace_listings"
execute_function="Marketplace.Toggle"
execute_parameters="marketplace"
is_enabled_function="Marketplace.Enabled"
is_enabled_parameters="marketplace"
is_running_function="Floater.IsOpen"
is_running_parameters="marketplace_listings"
/>

View File

@ -4621,17 +4621,6 @@
<key>Value</key>
<integer>0</integer>
</map>
<key>InventoryDisplayOutbox</key>
<map>
<key>Comment</key>
<string>Override merchant inventory outbox display</string>
<key>Persist</key>
<integer>0</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>InventoryInboxToggleState</key>
<map>
<key>Comment</key>
@ -4654,6 +4643,17 @@
<key>Value</key>
<integer>0</integer>
</map>
<key>InventoryOutboxDisplayBoth</key>
<map>
<key>Comment</key>
<string>Show the legacy Merchant Outbox UI as well as the Marketplace Listings UI</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>InventoryOutboxLogging</key>
<map>
<key>Comment</key>

View File

@ -152,6 +152,11 @@ protected:
{
log_SLM_infos("Get /merchant", getStatus(), "User is not a merchant");
LLMarketplaceData::instance().setSLMStatus(MarketplaceStatusCodes::MARKET_PLACE_NOT_MERCHANT);
}
else if (HTTP_SERVICE_UNAVAILABLE == getStatus())
{
log_SLM_infos("Get /merchant", getStatus(), "Merchant is not migrated");
LLMarketplaceData::instance().setSLMStatus(MarketplaceStatusCodes::MARKET_MERCHANT_NOT_MIGRATED);
}
else
{
@ -1133,16 +1138,25 @@ LLMarketplaceData::~LLMarketplaceData()
void LLMarketplaceData::initializeSLM(const status_updated_signal_t::slot_type& cb)
{
mMarketPlaceStatus = MarketplaceStatusCodes::MARKET_PLACE_INITIALIZING;
if (mStatusUpdatedSignal == NULL)
{
mStatusUpdatedSignal = new status_updated_signal_t();
}
mStatusUpdatedSignal->connect(cb);
std::string url = getSLMConnectURL("/merchant");
log_SLM_infos("LLHTTPClient::get", url, "");
LLHTTPClient::get(url, new LLSLMGetMerchantResponder(), LLSD());
if (mMarketPlaceStatus != MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED)
{
// If already initialized, just confirm the status so the callback gets called
setSLMStatus(mMarketPlaceStatus);
}
else
{
// Initiate SLM connection and set responder
mMarketPlaceStatus = MarketplaceStatusCodes::MARKET_PLACE_INITIALIZING;
std::string url = getSLMConnectURL("/merchant");
log_SLM_infos("LLHTTPClient::get", url, "");
LLHTTPClient::get(url, new LLSLMGetMerchantResponder(), LLSD());
}
}
// Get/Post/Put requests to the SLM Server using the SLM API

View File

@ -68,6 +68,7 @@ namespace MarketplaceStatusCodes
MARKET_PLACE_CONNECTION_FAILURE = 2,
MARKET_PLACE_MERCHANT = 3,
MARKET_PLACE_NOT_MERCHANT = 4,
MARKET_MERCHANT_NOT_MIGRATED = 5
};
}

View File

@ -1875,6 +1875,14 @@ bool idle_startup()
}
display_startup();
// Init SLM Marketplace connection so we know which UI should be used for the user as a merchant
// Note: Eventually, all merchant will be migrated to the new SLM system and there will be no
// reason to show the old UI at all.
// *TODO : Suppress the Merchant Outbox UI completely
check_merchant_status();
display_startup();
if (gSavedSettings.getBOOL("HelpFloaterOpen"))
{

View File

@ -37,6 +37,7 @@
#include "llfloaterinspect.h"
#include "lltool.h"
#include "llmanipscale.h"
#include "llmarketplacefunctions.h"
#include "llselectmgr.h"
#include "lltoolbrush.h"
#include "lltoolcomp.h"
@ -83,6 +84,8 @@ LLToolMgr::LLToolMgr()
LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Build.Active", boost::bind(&LLToolMgr::inEdit, this));
LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Build.Enabled", boost::bind(&LLToolMgr::canEdit, this));
LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Build.Toggle", boost::bind(&LLToolMgr::toggleBuildMode, this, _2));
LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Marketplace.Enabled", boost::bind(&LLToolMgr::canAccessMarketplace, this));
LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Marketplace.Toggle", boost::bind(&LLToolMgr::toggleMarketplace, this, _2));
gToolNull = new LLTool(LLStringUtil::null); // Does nothing
setCurrentTool(gToolNull);
@ -345,6 +348,23 @@ bool LLToolMgr::inBuildMode()
return b;
}
bool LLToolMgr::canAccessMarketplace()
{
return (LLMarketplaceData::instance().getSLMStatus() != MarketplaceStatusCodes::MARKET_MERCHANT_NOT_MIGRATED) || gSavedSettings.getBOOL("InventoryOutboxDisplayBoth");
}
void LLToolMgr::toggleMarketplace(const LLSD& sdname)
{
const std::string& param = sdname.asString();
if ((param != "marketplace") || !canAccessMarketplace())
{
return;
}
LLFloaterReg::toggleInstanceOrBringToFront("marketplace_listings");
}
void LLToolMgr::setTransientTool(LLTool* tool)
{
if (!tool)

View File

@ -54,7 +54,9 @@ public:
bool inEdit();
bool canEdit();
bool canAccessMarketplace();
void toggleBuildMode(const LLSD& sdname);
void toggleMarketplace(const LLSD& sdname);
/* Determines if we are in Build mode or not. */
bool inBuildMode();

View File

@ -88,6 +88,7 @@
#include "llinventoryfunctions.h"
#include "llpanellogin.h"
#include "llpanelblockedlist.h"
#include "llmarketplacefunctions.h"
#include "llmenuoptionpathfindingrebakenavmesh.h"
#include "llmoveview.h"
#include "llparcel.h"
@ -98,6 +99,7 @@
#include "llspellcheckmenuhandler.h"
#include "llstatusbar.h"
#include "lltextureview.h"
#include "lltoolbarview.h"
#include "lltoolcomp.h"
#include "lltoolmgr.h"
#include "lltoolpie.h"
@ -386,6 +388,37 @@ void set_underclothes_menu_options()
}
}
void set_merchant_menu()
{
if (LLMarketplaceData::instance().getSLMStatus() == MarketplaceStatusCodes::MARKET_MERCHANT_NOT_MIGRATED)
{
// Merchant not migrated: show only the old Merchant Outbox menu
gMenuHolder->getChild<LLView>("MerchantOutbox")->setVisible(TRUE);
}
else
{
// All other cases (new merchant, not merchant, migrated merchant): show the new Marketplace Listings menu and enable the tool
gMenuHolder->getChild<LLView>("MarketplaceListings")->setVisible(TRUE);
LLCommand* command = LLCommandManager::instance().getCommand("marketplacelistings");
gToolBarView->enableCommand(command->id(), true);
}
}
void check_merchant_status()
{
if (!gSavedSettings.getBOOL("InventoryOutboxDisplayBoth"))
{
// Hide both merchant related menu items
gMenuHolder->getChild<LLView>("MerchantOutbox")->setVisible(FALSE);
gMenuHolder->getChild<LLView>("MarketplaceListings")->setVisible(FALSE);
// Also disable the toolbar button for Marketplace Listings
LLCommand* command = LLCommandManager::instance().getCommand("marketplacelistings");
gToolBarView->enableCommand(command->id(), false);
// Launch an SLM test connection to get the merchant status
LLMarketplaceData::instance().initializeSLM(boost::bind(&set_merchant_menu));
}
}
void init_menus()
{
// Initialize actions

View File

@ -83,6 +83,7 @@ BOOL enable_god_full(void* user_data);
BOOL enable_god_liaison(void* user_data);
BOOL enable_god_basic(void* user_data);
void set_underclothes_menu_options();
void check_merchant_status();
void exchange_callingcard(const LLUUID& dest_id);