MCDO fixes 2

implement RestoreThenUpload for charadata

cleanup, actually show success/failure

actually sort chara data list lmao

add shared character data sets display to main ui (partial)

increase size of mcdo table slightly

fix selecting last new entry
This commit is contained in:
Stanley Dimant
2025-02-08 00:14:16 +01:00
committed by Loporrit
parent 8f9528879d
commit 27bbe96618
6 changed files with 113 additions and 32 deletions

View File

@@ -38,8 +38,9 @@ internal sealed partial class CharaDataHubUi
}
var indent = ImRaii.PushIndent(10f);
if (canUpdate || (!_charaDataManager.UploadTask?.IsCompleted ?? false))
if (canUpdate || _charaDataManager.UploadTask != null)
{
ImGuiHelpers.ScaledDummy(5);
UiSharedService.DrawGrouped(() =>
{
if (canUpdate)
@@ -84,6 +85,11 @@ internal sealed partial class CharaDataHubUi
}
});
}
else if (_charaDataManager.UploadTask?.IsCompleted ?? false)
{
var color = UiSharedService.GetBoolColor(_charaDataManager.UploadTask.Result.Success);
UiSharedService.ColorTextWrapped(_charaDataManager.UploadTask.Result.Output, color);
}
});
}
indent.Dispose();
@@ -359,7 +365,7 @@ internal sealed partial class CharaDataHubUi
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Trash, "Delete Character Data"))
{
_ = _charaDataManager.DeleteCharaData(dataDto);
_selectedDtoId = string.Empty;
SelectedDtoId = string.Empty;
}
}
if (!UiSharedService.CtrlPressed())
@@ -548,7 +554,7 @@ internal sealed partial class CharaDataHubUi
}
using (var table = ImRaii.Table("Own Character Data", 12, ImGuiTableFlags.RowBg | ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.ScrollY,
new Vector2(ImGui.GetWindowContentRegionMax().X - ImGui.GetWindowContentRegionMin().X, 100)))
new Vector2(ImGui.GetWindowContentRegionMax().X - ImGui.GetWindowContentRegionMin().X, 110)))
{
if (table)
{
@@ -566,11 +572,11 @@ internal sealed partial class CharaDataHubUi
ImGui.TableSetupColumn("Expires", ImGuiTableColumnFlags.WidthFixed, 18);
ImGui.TableSetupScrollFreeze(0, 1);
ImGui.TableHeadersRow();
foreach (var entry in _charaDataManager.OwnCharaData.Values)
foreach (var entry in _charaDataManager.OwnCharaData.Values.OrderBy(b => b.CreatedDate))
{
var uDto = _charaDataManager.GetUpdateDto(entry.Id);
ImGui.TableNextColumn();
if (string.Equals(entry.Id, _selectedDtoId, StringComparison.Ordinal))
if (string.Equals(entry.Id, SelectedDtoId, StringComparison.Ordinal))
_uiSharedService.IconText(FontAwesomeIcon.CaretRight);
ImGui.TableNextColumn();
@@ -587,48 +593,48 @@ internal sealed partial class CharaDataHubUi
{
ImGui.TextUnformatted(idText);
}
if (ImGui.IsItemClicked()) _selectedDtoId = entry.Id;
if (ImGui.IsItemClicked()) SelectedDtoId = entry.Id;
ImGui.TableNextColumn();
ImGui.TextUnformatted(entry.Description);
if (ImGui.IsItemClicked()) _selectedDtoId = entry.Id;
if (ImGui.IsItemClicked()) SelectedDtoId = entry.Id;
UiSharedService.AttachToolTip(entry.Description);
ImGui.TableNextColumn();
ImGui.TextUnformatted(entry.CreatedDate.ToLocalTime().ToString());
if (ImGui.IsItemClicked()) _selectedDtoId = entry.Id;
if (ImGui.IsItemClicked()) SelectedDtoId = entry.Id;
ImGui.TableNextColumn();
ImGui.TextUnformatted(entry.UpdatedDate.ToLocalTime().ToString());
if (ImGui.IsItemClicked()) _selectedDtoId = entry.Id;
if (ImGui.IsItemClicked()) SelectedDtoId = entry.Id;
ImGui.TableNextColumn();
ImGui.TextUnformatted(entry.DownloadCount.ToString());
if (ImGui.IsItemClicked()) _selectedDtoId = entry.Id;
if (ImGui.IsItemClicked()) SelectedDtoId = entry.Id;
ImGui.TableNextColumn();
bool isDownloadable = !entry.HasMissingFiles
&& !string.IsNullOrEmpty(entry.GlamourerData);
_uiSharedService.BooleanToColoredIcon(isDownloadable, false);
if (ImGui.IsItemClicked()) _selectedDtoId = entry.Id;
if (ImGui.IsItemClicked()) SelectedDtoId = entry.Id;
UiSharedService.AttachToolTip(isDownloadable ? "Can be downloaded by others" : "Cannot be downloaded: Has missing files or data, please review this entry manually");
ImGui.TableNextColumn();
var count = entry.FileGamePaths.Concat(entry.FileSwaps).Count();
ImGui.TextUnformatted(count.ToString());
if (ImGui.IsItemClicked()) _selectedDtoId = entry.Id;
if (ImGui.IsItemClicked()) SelectedDtoId = entry.Id;
UiSharedService.AttachToolTip(count == 0 ? "No File data attached" : "Has File data attached");
ImGui.TableNextColumn();
bool hasGlamourerData = !string.IsNullOrEmpty(entry.GlamourerData);
_uiSharedService.BooleanToColoredIcon(hasGlamourerData, false);
if (ImGui.IsItemClicked()) _selectedDtoId = entry.Id;
if (ImGui.IsItemClicked()) SelectedDtoId = entry.Id;
UiSharedService.AttachToolTip(string.IsNullOrEmpty(entry.GlamourerData) ? "No Glamourer data attached" : "Has Glamourer data attached");
ImGui.TableNextColumn();
bool hasCustomizeData = !string.IsNullOrEmpty(entry.CustomizeData);
_uiSharedService.BooleanToColoredIcon(hasCustomizeData, false);
if (ImGui.IsItemClicked()) _selectedDtoId = entry.Id;
if (ImGui.IsItemClicked()) SelectedDtoId = entry.Id;
UiSharedService.AttachToolTip(string.IsNullOrEmpty(entry.CustomizeData) ? "No Customize+ data attached" : "Has Customize+ data attached");
ImGui.TableNextColumn();
@@ -636,7 +642,7 @@ internal sealed partial class CharaDataHubUi
if (!Equals(DateTime.MaxValue, entry.ExpiryDate))
eIcon = FontAwesomeIcon.Clock;
_uiSharedService.IconText(eIcon, ImGuiColors.DalamudYellow);
if (ImGui.IsItemClicked()) _selectedDtoId = entry.Id;
if (ImGui.IsItemClicked()) SelectedDtoId = entry.Id;
if (eIcon != FontAwesomeIcon.None)
{
UiSharedService.AttachToolTip($"This entry will expire on {entry.ExpiryDate.ToLocalTime()}");
@@ -690,12 +696,12 @@ internal sealed partial class CharaDataHubUi
var charaDataEntries = _charaDataManager.OwnCharaData.Count;
if (charaDataEntries != _dataEntries && _selectNewEntry && _charaDataManager.OwnCharaData.Any())
{
_selectedDtoId = _charaDataManager.OwnCharaData.Last().Value.Id;
SelectedDtoId = _charaDataManager.OwnCharaData.OrderBy(o => o.Value.CreatedDate).Last().Value.Id;
_selectNewEntry = false;
}
_dataEntries = _charaDataManager.OwnCharaData.Count;
_ = _charaDataManager.OwnCharaData.TryGetValue(_selectedDtoId, out var dto);
_ = _charaDataManager.OwnCharaData.TryGetValue(SelectedDtoId, out var dto);
DrawEditCharaData(dto);
}