@@ -138,15 +144,49 @@
deleteModel(jsonifyChannel().Id, window.history.back);
}
}
+ function createMemo()
+ {
+ console.log("creating memo for channel..");
+ createMemoFor((newMemoId) => {
+ window.location.href = "/UACs/Details/" + newMemoId;
+ });
+ }
function channelsTree() {
- var tree = @Html.Raw(ViewData["channelsTree"]);
+ //TOOD: see how accountsTree does all our HTML-ification over here in HTML land? but this doesn't? we should pick one and stick with it.
+ var tree = @Html.Raw(ViewData["subChannelsTree"]);
return tree;
}
+ function dataMemosTree(){
+ @{
+ var dmsb = new StringBuilder();
+ dmsb.Append("[{text: \"Data Memos\", \"expanded\":true, nodes: [");
+ var firstMemo = true;
+ if(ThisChannel.UACs != null) foreach(var memo in ThisChannel.UACs)
+ {
+ if(!firstMemo)
+ dmsb.Append(',');
+ var effectiveDisplayName = memo.DisplayName;
+ if(string.IsNullOrWhiteSpace(effectiveDisplayName))
+ {
+ effectiveDisplayName = $"[nameless] {memo.Id}";
+ }
+ dmsb.Append($"{{text: \"{effectiveDisplayName}\"}}");
+ firstMemo = false;
+ }
+ if(!firstMemo)
+ dmsb.Append(',');
+ dmsb.Append($"{{text: \"\"}}");
+ dmsb.Append("]}]");
+ }
+ var tree = @Html.Raw(dmsb.ToString());
+ return tree;
+}
function accountsTree() {
@{
var sb = new StringBuilder();
+
sb.Append("[{text: \"accounts\", \"expanded\":true, nodes: [");
var first = true;
foreach (var acc in ThisChannel.Users?.OrderBy(a => a?.SeenInChannel?.LineageSummary))
@@ -157,6 +197,7 @@
first=false;
}
sb.Append("]}]");
+
}
//console.log(@Html.Raw(sb.ToString()));
var tree = @Html.Raw(sb.ToString());
@@ -164,6 +205,7 @@
}
$('#channelsTree').bstreeview({ data: channelsTree() });
$('#accountsTree').bstreeview({ data: accountsTree() });
+ $('#dataMemosTree').bstreeview({ data: dataMemosTree() });
}
diff --git a/WebInterface/Views/Channels/Index.cshtml b/WebInterface/Views/Channels/Index.cshtml
deleted file mode 100644
index 282eb5f3..00000000
--- a/WebInterface/Views/Channels/Index.cshtml
+++ /dev/null
@@ -1,42 +0,0 @@
-@model IEnumerable
-@{
- ViewData["Title"] = "Channels";
-}
-
-
-
-
-
- protocol
- |
- type |
-
- display name
- |
-
- Lineage
- |
-
-
-
- @foreach (var item in Model) {
-
-
-
- |
-
-
- |
-
- @Html.DisplayFor(modelItem => item.DisplayName)
- |
-
- @item.LineageSummary
- |
-
- Details
- |
-
- }
-
-
diff --git a/wwwroot/js/site.js b/wwwroot/js/site.js
index 4ef597ba..e444da81 100644
--- a/wwwroot/js/site.js
+++ b/wwwroot/js/site.js
@@ -49,7 +49,7 @@ function deleteModel(id, callback)
var components = window.location.pathname.split('/');
var type=components[1];
let result = null;
- var id=components[3];
+ var id=components[3]; //wait... i send it the ID then overwrite it? lmao what? TODO: fix
fetch(apiUrl + 'Rememberer/' + type + '/' + id, {
method: 'DELETE',
headers: {
@@ -71,9 +71,37 @@ function deleteModel(id, callback)
console.error('Error:', error);
});
}
+function createMemoFor(callback)
+{
+ let components = window.location.pathname.split('/');
+ let type=components[1];
+ type = type.charAt(0).toUpperCase() + type.slice(1).toLowerCase();
+ let result = null;
+ let id=components[3];
+ console.log("createMemoFor" + type + "(" + id + ")");
+ fetch(apiUrl + "UAC/CreateFor" + type + "/" + id, {
+ method: 'PUT',
+ headers: {
+ 'Content-Type': 'application/json',
+ }
+ })
+ .then(response => {
+ if (!response.ok) {
+ throw new Error('Network response was not "ok". which is not ok.');
+ }
+ return response.json();
+ })
+ .then(returnedSuccessdata => {
+ console.log("success");
+ console.log('returnedSuccessdata:', returnedSuccessdata);
+ if(callback !== null) { callback(returnedSuccessdata); }
+ })
+ .catch(error => {
+ console.error('Error:', error);
+ });
+}
function linkUAC_Channel(channel_guid, callback)
{
-
var components = window.location.pathname.split('/');
var id=components[3];
let model={"uac_guid": id,
|