Updating for the next

This commit is contained in:
2020-07-02 09:15:33 +02:00
parent 1d173f2467
commit 720ed56432
18 changed files with 174 additions and 84 deletions

View File

@ -3,8 +3,7 @@
<FilesWithEditor CFile="ConfigFile" Filters="Filters" Files="ConfigFiles" FilterFolder="FilterFolder"
SelectedFile="SelectedFile" SelectedFileChanged="SelectedFileChanged"
TestConfiguration="TestConfiguration" TestResult="TestResult"
DeleteFileModal="DeleteFile" DeleteResult="DeleteResult"
AddFileModal="ShowAddFileModal">
DeleteFileModal="DeleteNotificationModal" AddFileModal="ShowAddFileModal">
</FilesWithEditor>
<Modal @ref="AddFileModal">
<ModalBackdrop />
@ -71,4 +70,5 @@
</ModalFooter>
</ModalContent>
</Modal>
@*<GeneralNotificationModal ModalReference="GeneralNotificationModal" NotificationSettings="GeneralNotificationSettings"></GeneralNotificationModal>*@
<GeneralNotificationModal PopupCallback="DeleteFile"></GeneralNotificationModal>
@*<GeneralNotificationModal ></GeneralNotificationModal>*@

View File

@ -25,8 +25,7 @@ namespace Seenginx.Pages
public ConfigFile SelectedFile { get; set; }
public List<string> Filters { get; set; } = new List<string>();
public List<int> FilteredOutFiles { get; set; } = new List<int>();
public Modal GeneralNotificationModal { get; set; } = new Modal();
public GeneralNotificationSettings GeneralNotificationSettings { get; set; } = null;
public NotificationSettings GeneralNotificationSettings { get; set; } = null;
public Dictionary<string, string> FilterFolder { get; set; } = new Dictionary<string, string>();
@ -101,32 +100,32 @@ namespace Seenginx.Pages
}
public Result<string> TestResult { get; set; }
public Modal TestNotificationModal { get; set; } = new Modal();
public async Task TestConfiguration()
{
TestResult = await NginxService.TestNginxConfigurations(SelectedFile);
if (TestResult.AllOk)
GeneralNotificationSettings = new GeneralNotificationSettings
GeneralNotificationSettings = new NotificationSettings
{
ButtonColor = Color.Success,
TitleClass = "mdi-success",
Title = "Success",
Text = $"Test of config file '{SelectedFile.Name}' completed with success."
Text = $"Test of config file '{SelectedFile.Name}' completed with success.",
PopupType = PopupType.Ok
};
else
GeneralNotificationSettings = new GeneralNotificationSettings
GeneralNotificationSettings = new NotificationSettings
{
ButtonColor = Color.Danger,
TitleClass = "mdi-error",
Title = "Failure",
Text = TestResult.ErrorMessage
Text = TestResult.ErrorMessage,
PopupType = PopupType.Ok
};
GeneralNotificationModal.Show();
TestNotificationModal.Show();
}
public Result<bool> DeleteResult { get; set; }
public void DeleteFile()
public GeneralNotificationModalBase DeleteNotificationModal { get; set; } = new GeneralNotificationModalBase();
public void DeleteFile(PopupAnswer popupAnswer)
{
DeleteResult = FileService.DeleteFile(SelectedFile);
if (popupAnswer == PopupAnswer.Yes)
{
var deleteResult = FileService.DeleteFile(SelectedFile);
}
}
public void CloseModal(Modal modal)

View File

@ -15,6 +15,7 @@
<base href="~/" />
<link href="_content/Blazorise/blazorise.css" rel="stylesheet" />
<link href="_content/Blazorise.Bulma/blazorise.bulma.css" rel="stylesheet" />
<link href="_content/Blazored.Modal/blazored-modal.css" rel="stylesheet"/>
<environment include="Staging,Production">
<link rel="stylesheet" href="~/css/materialdesignicons.min.css" asp-append-version="true" />
<link rel="stylesheet" href="~/css/bulma.min.css" asp-append-version="true" />