You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Any changes I make in the editor before I hit save are ignored and it just saves what was in the page originally. The file metadata shows that it has been overwritten but the changes I make aren't persisted.
This is the case no matter if I use the Workflow[] passed into my save method or the one I bound to the RulesEngineEditorPage with @bind-Workflows. No matter if I use WorkflowsChanged="Save" or WorkflowsSaved="Save" it doesn't work right.
The only way to get your changes to workflows back out of the editor is the download button.
@usingNewtonsoft.Json@usingRulesEngine.Models@usingSystem.Runtime.Serialization@usingSystem.Security.Cryptography@usingSystem.Text@usingAzure.Storage.Blobs.Models@inject AppConfigAppConfig
<p>Last Saved: @lastSaved</p>
<RulesEngineEditorPage@bind-Workflows=WorkflowsMenuButtons=@menuButtonsWorkflowsSaved="Save" />
@code{DateTime?lastSaved;
privateBlobStorageServiceblobStorageService;
privatebyte[] startingHash;
privateWorkflow[] Workflows{get; set; }privateList<MenuButton> menuButtons=newList<MenuButton>()
{
newMenuButton("NewWorkflows"),
newMenuButton("DownloadWorkflows"),
newMenuButton("ImportWorkflows"),
newMenuButton("AddWorkflow"),
newMenuButton("SaveWorkflow")
};
protectedoverrideasyncTaskOnInitializedAsync() {stringfileContents;
blobStorageService=newBlobStorageService(Environment.GetEnvironmentVariable("CONNECTION_STRING"));
awaitusingStreamblobStream=awaitblobStorageService.GetBlobAsync("json", AppConfig.RulesJsonFilename);
using (varstreamReader=newStreamReader(blobStream)) {fileContents=awaitstreamReader.ReadToEndAsync();
}varworkflowList=JsonConvert.DeserializeObject<List<Workflow>>(fileContents);
BlobPropertiesproperties=awaitblobStorageService.GetBlobPropertiesAsync("json", AppConfig.RulesJsonFilename);
lastSaved=properties.LastModified.LocalDateTime;
startingHash=properties.ContentHash;
Workflows=workflowList.ToArray();
}protectedasyncTaskSave(Workflow[] workflows) {Workflows=workflows; // I've tried it with this line commented out for no differencestringserializedWorkflows=JsonConvert.SerializeObject(Workflows, Formatting.Indented);
StreammemoryStream=newMemoryStream(Encoding.Default.GetBytes(serializedWorkflows));
byte[] newChecksum=MD5.HashData(memoryStream);
if (newChecksum.SequenceEqual(startingHash)) {
Console.WriteLine("Content is unchanged!!!!");
byte[] paramChecksum=MD5.HashData(newMemoryStream(Encoding.Default.GetBytes(JsonConvert.SerializeObject(workflows, Formatting.Indented))));
Console.WriteLine("is the param also the same? "+paramChecksum.SequenceEqual(startingHash));
thrownewTaskCanceledException();
}
Task<BlobContentInfo> saveTask=blobStorageService.UploadBlobAsync("json", AppConfig.RulesJsonFilename, memoryStream);
BlobContentInfoinfo=awaitsaveTask;
if (saveTask.IsFaulted) {
awaitConsole.Error.WriteLineAsync($"Failed to Save! {saveTask.Exception}");
}
else {
Console.WriteLine($"Save attempt {saveTask.Status}");
lastSaved=info.LastModified.LocalDateTime;
awaitInvokeAsync(StateHasChanged);
}
}
After saving a few changes, and Console output is :
Content is unchanged!!!!
is the param also the same? True
If you comment out the if block with the checksum code and attempt to save changes, the lastSaved date updates, but the workflows are unchanged.
The text was updated successfully, but these errors were encountered:
Any changes I make in the editor before I hit save are ignored and it just saves what was in the page originally. The file metadata shows that it has been overwritten but the changes I make aren't persisted.
This is the case no matter if I use the
Workflow[]
passed into my save method or the one I bound to theRulesEngineEditorPage
with@bind-Workflows
. No matter if I useWorkflowsChanged="Save"
orWorkflowsSaved="Save"
it doesn't work right.The only way to get your changes to workflows back out of the editor is the download button.
After saving a few changes, and Console output is :
If you comment out the if block with the checksum code and attempt to save changes, the
lastSaved
date updates, but the workflows are unchanged.The text was updated successfully, but these errors were encountered: