diff --git a/devdocs/todo.txt b/devdocs/todo.txt
index f4e9715d..2bf1594a 100644
--- a/devdocs/todo.txt
+++ b/devdocs/todo.txt
@@ -16,7 +16,8 @@ REALLY MAKING MORE PROGRESS WHEN CLIENT DEV DRIVES BACKEND DEV, STICK TO THAT!!
DO CLIENT STUFF NOW COME BACK TO THIS STUFF LATER
###*** BEFORE NEXT UPDATE TO DEVOPS SERVER:::::::
-
+TODO: 2019-06-07 10:47:57.8894|WARN|Microsoft.AspNetCore.Cors.Infrastructure.CorsService|The CORS protocol does not allow specifying a wildcard (any) origin and credentials at the same time. Configure the policy by listing individual origins if credentials needs to be supported.
+2
TODO: NEEDS A THINK, SOME CHANGES REQUIRE DB ERASURE BEFORE STARTUP
- Make it fucking easier to test deploy and erase db and fetch key and all that shit
diff --git a/server/AyaNova/biz/WidgetBiz.cs b/server/AyaNova/biz/WidgetBiz.cs
index 22657e51..b2f96ec5 100644
--- a/server/AyaNova/biz/WidgetBiz.cs
+++ b/server/AyaNova/biz/WidgetBiz.cs
@@ -140,6 +140,7 @@ namespace AyaNova.Biz
Widget outObj = new Widget();
CopyObject.Copy(dbObj, outObj);
+ outObj.Name = outObj.Name;
//Test get serial id visible id number from generator
outObj.Serial = ServerBootConfig.WIDGET_SERIAL.GetNext();
diff --git a/server/AyaNova/util/DateUtil.cs b/server/AyaNova/util/DateUtil.cs
index 7a7e2514..4c041e47 100644
--- a/server/AyaNova/util/DateUtil.cs
+++ b/server/AyaNova/util/DateUtil.cs
@@ -63,6 +63,22 @@ namespace AyaNova.Util
}
+ ///
+ /// Returns current date/time in sortable format
+ ///(used for duplicate names by stringUtil and others)
+ ///
+ ///
+ public static string SortableShortCurrentDateTimeValue
+ {
+ get
+ {
+ return DateTime.Now.ToString("s");
+ //Was going to use MaxValue but apparently that varies depending on culture
+ // and Postgres has issues with year 1 as it interprets as year 2001
+ // so to be on safe side just defining one for all usage
+ }
+ }
+
diff --git a/server/AyaNova/util/StringUtil.cs b/server/AyaNova/util/StringUtil.cs
index 79ceb658..2711ffd9 100644
--- a/server/AyaNova/util/StringUtil.cs
+++ b/server/AyaNova/util/StringUtil.cs
@@ -50,14 +50,14 @@ namespace AyaNova.Util
///
///
public static string MaskIPAddress(string sIP)
- {
+ {
//My test station ip address!?
//"::ffff:127.0.0.1"
//weird dual format, new method that covers both v4 and v4 inside v6 format
- if(sIP.Contains("."))
+ if (sIP.Contains("."))
{
//new algorithm, replace anything after last period with an xxx
- var ret=sIP.Substring(0,sIP.LastIndexOf("."))+".xxx";
+ var ret = sIP.Substring(0, sIP.LastIndexOf(".")) + ".xxx";
return ret;
}
@@ -65,9 +65,9 @@ namespace AyaNova.Util
//8 groups IPV6 Address format
if (sIP.Contains(":"))
- {
-
- sIP=sIP.Replace("::",":0:");//rehydrate "compressed" addresses
+ {
+
+ sIP = sIP.Replace("::", ":0:");//rehydrate "compressed" addresses
var segs = sIP.Split(':');
if (segs.Length < 7)
return "UNRECOGNIZED V6 IP ADDRESS FORMAT";
@@ -90,6 +90,31 @@ namespace AyaNova.Util
}
+ ///
+ /// Make a unique but duplicate object name of desired length
+ /// (Used by Duplicate object function)
+ ///
+ ///
+ ///
+ ///
+ public static string NameUniquify(string s, int maxLength)
+ {
+ //Unique string
+ string unique = " - " + DateUtil.SortableShortCurrentDateTimeValue;
+ string ret = s + unique;
+ var diff = maxLength - ret.Length;
+ if (diff < 0)
+ {
+ if (unique.Length >= maxLength)
+ {
+ throw new System.ArgumentOutOfRangeException("StringUtil::nameUniquify - maxlength> unique value, source field too short for this function?");
+ }
+ ret = s.Substring(0, Math.Abs(diff)) + unique;
+ }
+
+ return ret;
+ }
+
}//eoc