This commit is contained in:
2020-03-12 23:16:19 +00:00
parent 883e10fcd7
commit b5a8179c42
5 changed files with 30 additions and 21 deletions

View File

@@ -82,9 +82,9 @@ namespace AyaNova.Api.Controllers
/// </summary>
/// <returns>List of strings</returns>
[HttpGet("TemplateList")]
public async Task<IActionResult> GetTemplateList()
public ActionResult GetTemplateList()
{
if (!serverState.IsOpen)
if (!serverState.IsOpen)
{
return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
}
@@ -92,15 +92,15 @@ namespace AyaNova.Api.Controllers
//Instantiate the business object handler
PickListBiz biz = PickListBiz.GetBiz(ct, HttpContext);
var o = await biz.GetListOfAllPickListKeyNames();
long TranslationId = UserTranslationIdFromContext.Id(HttpContext.Items);
var o = biz.GetListOfAllPickListTypes(TranslationId);
if (o == null)
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
return Ok(ApiOkResponse.Response(o, true));
}

View File

@@ -21,19 +21,27 @@ namespace AyaNova.PickList
}
//List all the PickList-able object types available
internal static List<NameIdItem> GetListOfAllPickListKeyNames()
{
internal static List<NameIdItem> GetListOfAllPickListTypes(long TranslationId)
{
List<string> TranslationKeysToFetch = new List<string>();
List<NameIdItem> ret = new List<NameIdItem>();
var values = System.Enum.GetValues(typeof(AyaType));
foreach (AyaType t in values)
{
if (t.HasAttribute(typeof(CoreBizObjectAttribute)))
{
ret.Add(new NameIdItem() { Name = t.ToString(), Id = (long)t });
var name = t.ToString();
TranslationKeysToFetch.Add(name);
ret.Add(new NameIdItem() { Name = name, Id = (long)t });
}
}
var LT = TranslationBiz.GetSubsetStaticAsync(TranslationKeysToFetch, TranslationId).Result;
foreach (NameIdItem i in ret)
{
i.Name = LT[i.Name];
}
return ret;
}

View File

@@ -180,15 +180,16 @@ namespace AyaNova.Biz
//############## Uncomment SerializeObject line, put a break on lastRoles, copy from the output in the LOG (good for javascript with quotes formatted that way) #######
// #### NEED to separately take a copy and update "lastRoles" string here by copying from the variable watch for the "json" variable shown in the debugger because need the C# format escaped quotes string
// //GENERATE JSON FROM ROLES OUTPUT TO DEBUG LOG IN JAVASCRIPT COMPATIBLE FORMAT
// // //GENERATE JSON FROM ROLES OUTPUT TO DEBUG LOG IN JAVASCRIPT COMPATIBLE FORMAT
// string json = Newtonsoft.Json.JsonConvert.SerializeObject(roles, Newtonsoft.Json.Formatting.None);
// //Output roles JSON FRAGMENT string for CLIENT to log
// // //Output roles JSON FRAGMENT string for CLIENT to log
// System.Diagnostics.Debugger.Log(1, "JSONFRAGMENTFORCLIENT", "BizRoles.cs -> biz-role-rights.js Client roles JSON fragment:");
// System.Diagnostics.Debugger.Log(1, "JSONFRAGMENTFORCLIENT", json);
//ONGOING VALIDATION TO CATCH MISMATCH WHEN NEW ROLES ADDED (wont' catch changes to existing unfortunately)
//var lastRoles = "{\"User\":{\"Change\":2,\"ReadFullRecord\":1},\"UserOptions\":{\"Change\":2,\"ReadFullRecord\":1},\"Widget\":{\"Change\":34,\"ReadFullRecord\":17},\"ServerState\":{\"Change\":16384,\"ReadFullRecord\":32767},\"License\":{\"Change\":16386,\"ReadFullRecord\":8193},\"LogFile\":{\"Change\":0,\"ReadFullRecord\":24576},\"JobOperations\":{\"Change\":16384,\"ReadFullRecord\":8195},\"AyaNova7Import\":{\"Change\":16384,\"ReadFullRecord\":0},\"Metrics\":{\"Change\":0,\"ReadFullRecord\":24576},\"Translation\":{\"Change\":16386,\"ReadFullRecord\":32767},\"DataListFilter\":{\"Change\":2,\"ReadFullRecord\":32767},\"FormCustom\":{\"Change\":2,\"ReadFullRecord\":32767}}";
var lastRoles = "{\"User\":{\"Change\":2,\"ReadFullRecord\":1},\"UserOptions\":{\"Change\":2,\"ReadFullRecord\":1},\"Widget\":{\"Change\":34,\"ReadFullRecord\":17},\"ServerState\":{\"Change\":16384,\"ReadFullRecord\":131071},\"License\":{\"Change\":16386,\"ReadFullRecord\":8193},\"LogFile\":{\"Change\":0,\"ReadFullRecord\":24576},\"JobOperations\":{\"Change\":16384,\"ReadFullRecord\":8195},\"AyaNova7Import\":{\"Change\":16384,\"ReadFullRecord\":0},\"Metrics\":{\"Change\":0,\"ReadFullRecord\":24576},\"Translation\":{\"Change\":16386,\"ReadFullRecord\":131071},\"DataListView\":{\"Change\":2,\"ReadFullRecord\":131071},\"FormCustom\":{\"Change\":2,\"ReadFullRecord\":131071}}";
//ONGOING VALIDATION TO CATCH MISMATCH WHEN NEW ROLES ADDED (wont' catch changes to existing unfortunately)
//var lastRoles = "{\"User\":{\"Change\":2,\"ReadFullRecord\":1},\"UserOptions\":{\"Change\":2,\"ReadFullRecord\":1},\"Widget\":{\"Change\":34,\"ReadFullRecord\":17},\"ServerState\":{\"Change\":16384,\"ReadFullRecord\":131071},\"License\":{\"Change\":16386,\"ReadFullRecord\":8193},\"LogFile\":{\"Change\":0,\"ReadFullRecord\":24576},\"JobOperations\":{\"Change\":16384,\"ReadFullRecord\":8195},\"AyaNova7Import\":{\"Change\":16384,\"ReadFullRecord\":0},\"Metrics\":{\"Change\":0,\"ReadFullRecord\":24576},\"Translation\":{\"Change\":16386,\"ReadFullRecord\":131071},\"DataListView\":{\"Change\":2,\"ReadFullRecord\":131071},\"FormCustom\":{\"Change\":2,\"ReadFullRecord\":131071}}";
var lastRoles = "{\"User\":{\"Change\":2,\"ReadFullRecord\":1,\"Select\":131071},\"UserOptions\":{\"Change\":2,\"ReadFullRecord\":1,\"Select\":0},\"Widget\":{\"Change\":34,\"ReadFullRecord\":17,\"Select\":131071},\"ServerState\":{\"Change\":16384,\"ReadFullRecord\":131071,\"Select\":0},\"License\":{\"Change\":16386,\"ReadFullRecord\":8193,\"Select\":0},\"LogFile\":{\"Change\":0,\"ReadFullRecord\":24576,\"Select\":0},\"JobOperations\":{\"Change\":16384,\"ReadFullRecord\":8195,\"Select\":0},\"AyaNova7Import\":{\"Change\":16384,\"ReadFullRecord\":0,\"Select\":0},\"Metrics\":{\"Change\":0,\"ReadFullRecord\":24576,\"Select\":0},\"Translation\":{\"Change\":16386,\"ReadFullRecord\":131071,\"Select\":0},\"DataListView\":{\"Change\":2,\"ReadFullRecord\":131071,\"Select\":0},\"FormCustom\":{\"Change\":2,\"ReadFullRecord\":131071,\"Select\":0},\"PickListTemplate\":{\"Change\":2,\"ReadFullRecord\":131071,\"Select\":131071}}";
Dictionary<AyaType, BizRoleSet> lastRolesDeserialized = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<AyaType, BizRoleSet>>(lastRoles);
if (lastRolesDeserialized.Count != roles.Count)
{

View File

@@ -58,16 +58,16 @@ namespace AyaNova.Biz
//get picklist
internal async Task<List<NameIdActiveItem>> GetPickListAsync(AyaType ayaType, string query, AuthorizationRoles userRoles)
{
List<NameIdActiveItem> items = await PickListFetcher.GetResponseAsync(ayaType, query, ct, userRoles);
List<NameIdActiveItem> items = await PickListFetcher.GetResponseAsync(ayaType, query, ct, userRoles);
return items;
}
//get picklist templates, basically all the object types that support picklists
internal async Task<List<NameIdItem>> GetListOfAllPickListKeyNames()
internal List<NameIdItem> GetListOfAllPickListTypes(long translationId)
{
return PickListFactory.GetListOfAllPickListKeyNames();
return PickListFactory.GetListOfAllPickListTypes(translationId);
// List<NameIdItem> items = await PickListFetcher.GetResponseAsync(ayaType, query, ct, UserId, userRoles);
// return items;
}

View File

@@ -20,10 +20,10 @@ namespace AyaNova.Util
/////////// CHANGE THIS ON NEW SCHEMA UPDATE ////////////////////
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!
private const int DESIRED_SCHEMA_LEVEL = 9;
private const int DESIRED_SCHEMA_LEVEL = 10;
internal const long EXPECTED_COLUMN_COUNT = 98;
internal const long EXPECTED_INDEX_COUNT = 26;
internal const long EXPECTED_COLUMN_COUNT = 100;
internal const long EXPECTED_INDEX_COUNT = 27;
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!