ui adjustments for groups
This commit is contained in:
2
MareAPI
2
MareAPI
Submodule MareAPI updated: bab758f173...a2a4d07c04
@@ -59,7 +59,7 @@ public class CompactUi : Window, IDisposable
|
|||||||
this.WindowName = "Mare Synchronos " + dateTime + "###MareSynchronosMainUI";
|
this.WindowName = "Mare Synchronos " + dateTime + "###MareSynchronosMainUI";
|
||||||
Toggle();
|
Toggle();
|
||||||
#else
|
#else
|
||||||
this.WindowName = "Mare Synchronos " + Assembly.GetExecutingAssembly().GetName().Version;
|
this.WindowName = "Mare Synchronos " + Assembly.GetExecutingAssembly().GetName().Version + "###MareSynchronosMainUI";
|
||||||
#endif
|
#endif
|
||||||
Logger.Verbose("Creating " + nameof(CompactUi));
|
Logger.Verbose("Creating " + nameof(CompactUi));
|
||||||
|
|
||||||
@@ -72,8 +72,8 @@ public class CompactUi : Window, IDisposable
|
|||||||
|
|
||||||
SizeConstraints = new WindowSizeConstraints()
|
SizeConstraints = new WindowSizeConstraints()
|
||||||
{
|
{
|
||||||
MinimumSize = new Vector2(300, 400),
|
MinimumSize = new Vector2(350, 400),
|
||||||
MaximumSize = new Vector2(300, 2000),
|
MaximumSize = new Vector2(350, 2000),
|
||||||
};
|
};
|
||||||
|
|
||||||
windowSystem.AddWindow(this);
|
windowSystem.AddWindow(this);
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ namespace MareSynchronos.UI
|
|||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
_lastCreatedGroup = null;
|
||||||
_errorGroupCreate = true;
|
_errorGroupCreate = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -175,7 +176,7 @@ namespace MareSynchronos.UI
|
|||||||
ExpandedGroupState[group.GID] = !ExpandedGroupState[group.GID];
|
ExpandedGroupState[group.GID] = !ExpandedGroupState[group.GID];
|
||||||
}
|
}
|
||||||
ImGui.PopStyleColor(2);
|
ImGui.PopStyleColor(2);
|
||||||
ImGui.SameLine();
|
ImGui.SameLine(ImGui.GetWindowContentRegionMin().X + collapseButton.X);
|
||||||
var pauseIcon = (group.IsPaused ?? false) ? FontAwesomeIcon.Play : FontAwesomeIcon.Pause;
|
var pauseIcon = (group.IsPaused ?? false) ? FontAwesomeIcon.Play : FontAwesomeIcon.Pause;
|
||||||
if (ImGuiComponents.IconButton(pauseIcon))
|
if (ImGuiComponents.IconButton(pauseIcon))
|
||||||
{
|
{
|
||||||
@@ -186,6 +187,16 @@ namespace MareSynchronos.UI
|
|||||||
|
|
||||||
var groupName = group.Alias ?? group.GID;
|
var groupName = group.Alias ?? group.GID;
|
||||||
var textIsGid = true;
|
var textIsGid = true;
|
||||||
|
|
||||||
|
if (group.OwnedBy == _apiController.UID)
|
||||||
|
{
|
||||||
|
ImGui.PushFont(UiBuilder.IconFont);
|
||||||
|
ImGui.Text(FontAwesomeIcon.Crown.ToIconString());
|
||||||
|
ImGui.PopFont();
|
||||||
|
UiShared.AttachToolTip("You are the owner of Syncshell " + groupName);
|
||||||
|
ImGui.SameLine();
|
||||||
|
}
|
||||||
|
|
||||||
_showGidForEntry.TryGetValue(group.GID, out var showGidInsteadOfName);
|
_showGidForEntry.TryGetValue(group.GID, out var showGidInsteadOfName);
|
||||||
if (!showGidInsteadOfName && _configuration.GetCurrentServerGidComments().TryGetValue(group.GID, out var groupComment))
|
if (!showGidInsteadOfName && _configuration.GetCurrentServerGidComments().TryGetValue(group.GID, out var groupComment))
|
||||||
{
|
{
|
||||||
@@ -244,21 +255,21 @@ namespace MareSynchronos.UI
|
|||||||
|
|
||||||
UiShared.DrawWithID(group.GID + "settings", () => DrawSyncShellButtons(group, name));
|
UiShared.DrawWithID(group.GID + "settings", () => DrawSyncShellButtons(group, name));
|
||||||
|
|
||||||
ImGui.Indent(collapseButton.X + ImGui.GetStyle().ItemSpacing.X);
|
ImGui.Indent(collapseButton.X);
|
||||||
if (ExpandedGroupState[group.GID])
|
if (ExpandedGroupState[group.GID])
|
||||||
{
|
{
|
||||||
pairsInGroup = pairsInGroup.OrderBy(p => p.UserUID == group.OwnedBy ? 0 : 1).ThenBy(p => p.IsPinned ?? false).ThenBy(p => p.UserAlias ?? p.UserUID).ToList();
|
pairsInGroup = pairsInGroup.OrderBy(p => p.UserUID == group.OwnedBy ? 0 : 1).ThenBy(p => p.IsPinned ?? false).ThenBy(p => p.UserAlias ?? p.UserUID).ToList();
|
||||||
ImGui.Indent(ImGui.GetStyle().ItemSpacing.X / 2);
|
ImGui.Indent(ImGui.GetStyle().ItemSpacing.X / 2);
|
||||||
|
|
||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
|
|
||||||
foreach (var pair in pairsInGroup)
|
foreach (var pair in pairsInGroup)
|
||||||
{
|
{
|
||||||
UiShared.DrawWithID(group.GID + pair.UserUID, () => DrawSyncshellPairedClient(pair, group.OwnedBy == _apiController.UID, group?.IsPaused ?? false));
|
UiShared.DrawWithID(group.GID + pair.UserUID, () => DrawSyncshellPairedClient(pair, group.OwnedBy == _apiController.UID, group?.IsPaused ?? false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui.Separator();
|
||||||
ImGui.Unindent(ImGui.GetStyle().ItemSpacing.X / 2);
|
ImGui.Unindent(ImGui.GetStyle().ItemSpacing.X / 2);
|
||||||
}
|
}
|
||||||
ImGui.Unindent(collapseButton.X + ImGui.GetStyle().ItemSpacing.X);
|
ImGui.Unindent(collapseButton.X);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawSyncShellButtons(GroupDto entry, string name)
|
private void DrawSyncShellButtons(GroupDto entry, string name)
|
||||||
@@ -315,6 +326,27 @@ namespace MareSynchronos.UI
|
|||||||
}
|
}
|
||||||
UiShared.AttachToolTip("Change Syncshell Password");
|
UiShared.AttachToolTip("Change Syncshell Password");
|
||||||
|
|
||||||
|
if (ImGui.BeginPopupModal("Change Syncshell Password", ref _showModalChangePassword, ImGuiWindowFlags.AlwaysAutoResize))
|
||||||
|
{
|
||||||
|
UiShared.TextWrapped("Enter the new Syncshell password for Syncshell " + name + " here.");
|
||||||
|
UiShared.TextWrapped("This action is irreversible");
|
||||||
|
ImGui.InputTextWithHint("##changepw", "New password for " + name, ref _newSyncShellPassword, 255);
|
||||||
|
if (ImGui.Button("Change password"))
|
||||||
|
{
|
||||||
|
var pw = _newSyncShellPassword;
|
||||||
|
_isPasswordValid = _apiController.ChangeGroupPassword(entry.GID, pw).Result;
|
||||||
|
_newSyncShellPassword = string.Empty;
|
||||||
|
if (_isPasswordValid) _showModalChangePassword = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_isPasswordValid)
|
||||||
|
{
|
||||||
|
UiShared.ColorTextWrapped("The selected password is too short. It must be at least 10 characters.", new Vector4(1, 0, 0, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.EndPopup();
|
||||||
|
}
|
||||||
|
|
||||||
if (UiShared.IconTextButton(FontAwesomeIcon.Broom, "Clear Syncshell"))
|
if (UiShared.IconTextButton(FontAwesomeIcon.Broom, "Clear Syncshell"))
|
||||||
{
|
{
|
||||||
if (UiShared.CtrlPressed())
|
if (UiShared.CtrlPressed())
|
||||||
@@ -337,27 +369,6 @@ namespace MareSynchronos.UI
|
|||||||
|
|
||||||
ImGui.EndPopup();
|
ImGui.EndPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui.BeginPopupModal("Change Syncshell Password", ref _showModalChangePassword, ImGuiWindowFlags.AlwaysAutoResize))
|
|
||||||
{
|
|
||||||
UiShared.TextWrapped("Enter the new Syncshell password for Syncshell " + name + " here.");
|
|
||||||
UiShared.TextWrapped("This action is irreversible");
|
|
||||||
ImGui.InputTextWithHint("##changepw", "New password for " + name, ref _newSyncShellPassword, 255);
|
|
||||||
if (ImGui.Button("Change password"))
|
|
||||||
{
|
|
||||||
var pw = _newSyncShellPassword;
|
|
||||||
_isPasswordValid = _apiController.ChangeGroupPassword(entry.GID, pw).Result;
|
|
||||||
_newSyncShellPassword = string.Empty;
|
|
||||||
if (_isPasswordValid) _showModalChangePassword = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_isPasswordValid)
|
|
||||||
{
|
|
||||||
UiShared.ColorTextWrapped("The selected password is too short. It must be at least 10 characters.", new Vector4(1, 0, 0, 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui.EndPopup();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawSyncshellPairedClient(GroupPairDto entry, bool isOwner, bool isPausedByYou)
|
private void DrawSyncshellPairedClient(GroupPairDto entry, bool isOwner, bool isPausedByYou)
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ public partial class ApiController : IDisposable
|
|||||||
.ToDictionary(k => k.Key, k => k.Value);
|
.ToDictionary(k => k.Key, k => k.Value);
|
||||||
|
|
||||||
public string UID => _connectionDto?.UID ?? string.Empty;
|
public string UID => _connectionDto?.UID ?? string.Empty;
|
||||||
public string DisplayName => string.IsNullOrEmpty(_connectionDto?.Alias) ? (_connectionDto?.UID ?? string.Empty) : _connectionDto.Alias;
|
public string DisplayName => _connectionDto?.UID ?? string.Empty;
|
||||||
private string ApiUri => _pluginConfiguration.ApiUri;
|
private string ApiUri => _pluginConfiguration.ApiUri;
|
||||||
public int OnlineUsers => SystemInfoDto.OnlineUsers;
|
public int OnlineUsers => SystemInfoDto.OnlineUsers;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user