forbid publish functionality temporarity for brand and index sync reason

This commit is contained in:
2016-12-11 20:31:20 +08:00
parent 145e2597cf
commit 0f4436e30f
2 changed files with 35 additions and 41 deletions

View File

@@ -85,9 +85,11 @@
<span class="glyphicon glyphicon-download" style="vertical-align:middle; margin-bottom: 3px;"></span> <span class="glyphicon glyphicon-download" style="vertical-align:middle; margin-bottom: 3px;"></span>
</button> </button>
</div> </div>
<!--
<button id="publish_button" class="btn btn-normal btn-success" onclick="onPublishRemote();" style="font-size: 14px;"> <button id="publish_button" class="btn btn-normal btn-success" onclick="onPublishRemote();" style="font-size: 14px;">
<span class="glyphicon glyphicon-send" style="vertical-align:middle; margin-bottom: 3px;"></span> <span class="glyphicon glyphicon-cloud" style="vertical-align:middle; margin-bottom: 3px;"></span>
</button> </button>
-->
<button id="search_bin_button" class="btn btn-normal btn-default" onclick="onSearchRemote();" style="font-size: 14px;"> <button id="search_bin_button" class="btn btn-normal btn-default" onclick="onSearchRemote();" style="font-size: 14px;">
<span class="glyphicon glyphicon-search" style="vertical-align:middle; margin-bottom: 3px;"></span> <span class="glyphicon glyphicon-search" style="vertical-align:middle; margin-bottom: 3px;"></span>
</button> </button>
@@ -95,9 +97,6 @@
<div id = "remote_table_container" style="width: 100%"> <div id = "remote_table_container" style="width: 100%">
</div> </div>
</div> </div>
<footer class="footer">
<p>Strawmanbobi, 2016</p>
</footer>
</div> </div>
<!-- dialogs --> <!-- dialogs -->

View File

@@ -37,13 +37,10 @@ var adminAuth = new AdminAuth(REDIS_HOST, REDIS_PORT, REDIS_PASSWORD, null);
// relative XML file path // relative XML file path
var PROTOCOL_PATH = "protocol"; var PROTOCOL_PATH = "protocol";
var REQUEST_APP_KEY = "d6119900556c4c1e629fd92d"; var publishBrandService = "/irext/int/publish_brands";
var REQUEST_APP_TOKEN = "fcac5496cba7a12b3bae34abf061f526"; var uploadBinaryService = "/irext/int/upload_binary";
var publishRemoteIndexService = "/int/remote/publish_remote_indexes";
var PUBLISH_BRAND_SERVICE = "/irext/remote/publish_brands"; var deleteRemoteIndexService = "/irext/int/delete_remote_index";
var UPLOAD_BINARY_SERVICE = "/irext/remote/upload_binary";
var PUBLISH_REMOTE_INDEX_SERVICE = "/irext/remote/publish_remote_indexes";
var DELETE_REMOTE_INDEX_SERVICE = "/irext/remote/delete_remote_index";
exports.listCategoriesWorkUnit = function (from, count, callback) { exports.listCategoriesWorkUnit = function (from, count, callback) {
var conditions = { var conditions = {
@@ -535,9 +532,6 @@ exports.createRemoteIndexWorkUnit = function(remoteIndex, filePath, contentType,
}; };
exports.deleteRemoteIndexWorkUnit = function (remoteIndex, adminID, callback) { exports.deleteRemoteIndexWorkUnit = function (remoteIndex, adminID, callback) {
// delete remote information from release server first
var queryParams = new Map();
var key = "admin_name_" + adminID; var key = "admin_name_" + adminID;
adminAuth.getAuthInfo(key, function(getAdminAuthErr, result) { adminAuth.getAuthInfo(key, function(getAdminAuthErr, result) {
if (errorCode.SUCCESS.code == getAdminAuthErr.code && null != result) { if (errorCode.SUCCESS.code == getAdminAuthErr.code && null != result) {
@@ -546,31 +540,32 @@ exports.deleteRemoteIndexWorkUnit = function (remoteIndex, adminID, callback) {
callback(errorCode.FAILED); callback(errorCode.FAILED);
return; return;
} }
key = "admin_" + adminID;
adminAuth.getAuthInfo(key, function(getAdminAuthErr, result) {
if (errorCode.SUCCESS.code == getAdminAuthErr.code && null != result) {
remoteIndex.admin_id = adminID;
remoteIndex.token = result;
var queryParams = new Map();
var requestSender =
new RequestSender(EXTERNAL_SERVER_ADDRESS,
EXTERNAL_SERVER_PORT,
deleteRemoteIndexService,
queryParams);
remoteIndex.admin_id = adminID; requestSender.sendPostRequest(remoteIndex,
var requestSender = function(deleteRemoteIndexesRequestErr, deleteRemoteIndexesResponse) {
new RequestSender(EXTERNAL_SERVER_ADDRESS, // perform delete action accordingly despite the result of remote deletion
EXTERNAL_SERVER_PORT, logger.info(deleteRemoteIndexesRequestErr);
DELETE_REMOTE_INDEX_SERVICE, /*
queryParams); RemoteIndex.deleteRemoteIndex(remoteIndex.id, function(deleteRemoteIndexErr) {
callback(deleteRemoteIndexErr);
requestSender.sendPostRequest(remoteIndex, });
function(deleteRemoteIndexesRequestErr, deleteRemoteIndexesResponse) { */
/* callback(errorCode.SUCCESS);
if(errorCode.SUCCESS.code == deleteRemoteIndexesRequestErr && });
JSON.parse(deleteRemoteIndexesResponse).status.code == errorCode.SUCCESS.code) { } else {
RemoteIndex.deleteRemoteIndex(remoteIndex.id, function(deleteRemoteIndexErr) { callback(errorCode.FAILED);
callback(deleteRemoteIndexErr); }
});
} else {
logger.error("failed to delete remote index from main server");
callback(errorCode.FAILED);
}
*/
// perform delete action accordingly despite the result of remote deletion
RemoteIndex.deleteRemoteIndex(remoteIndex.id, function(deleteRemoteIndexErr) {
callback(deleteRemoteIndexErr);
});
}); });
} else { } else {
callback(errorCode.FAILED); callback(errorCode.FAILED);
@@ -668,7 +663,7 @@ exports.publishRemoteIndexWorkUnit = function (callback) {
var requestSender = var requestSender =
new RequestSender(PRIMARY_SERVER_ADDRESS, new RequestSender(PRIMARY_SERVER_ADDRESS,
PRIMARY_SERVER_PORT, PRIMARY_SERVER_PORT,
UPLOAD_BINARY_SERVICE, uploadBinaryService,
queryParams); queryParams);
var options = { var options = {
https: false https: false
@@ -711,7 +706,7 @@ exports.publishRemoteIndexWorkUnit = function (callback) {
var requestSender = var requestSender =
new RequestSender(PRIMARY_SERVER_ADDRESS, new RequestSender(PRIMARY_SERVER_ADDRESS,
PRIMARY_SERVER_PORT, PRIMARY_SERVER_PORT,
PUBLISH_REMOTE_INDEX_SERVICE, publishRemoteIndexService,
queryParams); queryParams);
requestSender.sendPostRequest(remoteIndexes, requestSender.sendPostRequest(remoteIndexes,
@@ -787,7 +782,7 @@ exports.publishBrandsWorkUnit = function (callback) {
queryParams.put("app_token", REQUEST_APP_TOKEN); queryParams.put("app_token", REQUEST_APP_TOKEN);
var requestSender = var requestSender =
new RequestSender(PRIMARY_SERVER_ADDRESS, PRIMARY_SERVER_PORT, PUBLISH_BRAND_SERVICE, queryParams); new RequestSender(PRIMARY_SERVER_ADDRESS, PRIMARY_SERVER_PORT, publishBrandService, queryParams);
requestSender.sendPostRequest(brands, function(publishBrandRequestErr, publishBrandsResponse) { requestSender.sendPostRequest(brands, function(publishBrandRequestErr, publishBrandsResponse) {
if(errorCode.SUCCESS.code == publishBrandRequestErr && if(errorCode.SUCCESS.code == publishBrandRequestErr &&