Urgent fixes for inability to create policy with blank Db
also inability to save policy.
This commit is contained in:
parent
e504a09522
commit
1ab31f6d75
@ -2,7 +2,7 @@
|
|||||||
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
|
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
|
||||||
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
|
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
|
||||||
<Bundle Name="FlexiTimeSystemInstaller"
|
<Bundle Name="FlexiTimeSystemInstaller"
|
||||||
Version="0.2.1.0"
|
Version="0.2.3.0"
|
||||||
Manufacturer="Chris Watts"
|
Manufacturer="Chris Watts"
|
||||||
UpgradeCode="d38e92db-48f9-40c3-9a6f-d76fbd07326e">
|
UpgradeCode="d38e92db-48f9-40c3-9a6f-d76fbd07326e">
|
||||||
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
|
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
|
||||||
|
|||||||
@ -527,7 +527,18 @@ namespace SQLiteRepository
|
|||||||
var query = $"select * from {nameof(PolicyDb)}";
|
var query = $"select * from {nameof(PolicyDb)}";
|
||||||
var policies = _connection.Query<PolicyDb>(query);
|
var policies = _connection.Query<PolicyDb>(query);
|
||||||
|
|
||||||
|
if (!policies.Any())
|
||||||
|
{
|
||||||
|
return new Policy()
|
||||||
|
{
|
||||||
|
ChangeAuthor = string.Empty,
|
||||||
|
ChangeDate = DateTime.UtcNow,
|
||||||
|
ChangeDescription = string.Empty,
|
||||||
|
Html=string.Empty,
|
||||||
|
Markdown = string.Empty,
|
||||||
|
Version = "0"
|
||||||
|
};
|
||||||
|
}
|
||||||
return PolicyConverter.ConvertToPolicyDto(policies.OrderByDescending(x => x.Version).FirstOrDefault());
|
return PolicyConverter.ConvertToPolicyDto(policies.OrderByDescending(x => x.Version).FirstOrDefault());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("0.2.2.0")]
|
[assembly: AssemblyVersion("0.2.3.0")]
|
||||||
[assembly: AssemblyFileVersion("0.2.2.0")]
|
[assembly: AssemblyFileVersion("0.2.3.0")]
|
||||||
|
|||||||
@ -119,7 +119,7 @@
|
|||||||
<textarea id="policyEditor"></textarea>
|
<textarea id="policyEditor"></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div id="preview" class="tab-pane fade in">
|
<div id="preview" class="tab-pane fade in">
|
||||||
<div data-bind="html: policyData.html" class="well-lg"></div>
|
<div data-bind="html: policyData.Html" class="well-lg"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button class="btn btn-primary pull-right" data-toggle="modal" data-target="#saveDialog">Save</button><!--data-bind="click: $root.policySave"-->
|
<button class="btn btn-primary pull-right" data-toggle="modal" data-target="#saveDialog">Save</button><!--data-bind="click: $root.policySave"-->
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
var escaped = "unknown";
|
var escaped = "unknown";
|
||||||
|
|
||||||
if (parserHandler.dom.length > 0) {
|
if (parserHandler.dom.length > 0) {
|
||||||
escaped = parserHandler.dom[0].raw.toLowerCase().trim().replace(/ /g, "-");
|
escaped = parserHandler.dom[0].raw.toLowerCase().trim().replace(/ /g, "-").replace(/#+/g,"");
|
||||||
}
|
}
|
||||||
|
|
||||||
return "<h" + level + " id=\"" + escaped + "\">"
|
return "<h" + level + " id=\"" + escaped + "\">"
|
||||||
@ -66,7 +66,7 @@
|
|||||||
});
|
});
|
||||||
self.editor.codemirror.on("changes",
|
self.editor.codemirror.on("changes",
|
||||||
function () {
|
function () {
|
||||||
self.policyData.html(self.editor.options.previewRender(self.editor.value()));
|
self.policyData.Html(self.editor.options.previewRender(self.editor.value()));
|
||||||
});
|
});
|
||||||
self.uiPages = {
|
self.uiPages = {
|
||||||
overview: "overview",
|
overview: "overview",
|
||||||
@ -169,8 +169,9 @@
|
|||||||
self.policySave = function () {
|
self.policySave = function () {
|
||||||
var url = self.helpers.createRequestUrl(self.apiEndpoints.savePolicy, null, false);
|
var url = self.helpers.createRequestUrl(self.apiEndpoints.savePolicy, null, false);
|
||||||
self.policyData.Markdown(self.editor.value()); //make sure we update it, as it doesnt push the value back into the variable
|
self.policyData.Markdown(self.editor.value()); //make sure we update it, as it doesnt push the value back into the variable
|
||||||
//console.log(self.policyData());
|
//console.log(self.policyData();)rea#
|
||||||
$.post(url, self.policyData(), function() {
|
var data = ko.toJS(self.policyData);
|
||||||
|
$.post(url, data, function() {
|
||||||
}, "json") //todo: check this serialisation as the object is now complex.
|
}, "json") //todo: check this serialisation as the object is now complex.
|
||||||
.done(function() {
|
.done(function() {
|
||||||
self.policyReload();
|
self.policyReload();
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -3,28 +3,29 @@
|
|||||||
if (typeof data === "undefined") {
|
if (typeof data === "undefined") {
|
||||||
data = createDefaultPolicy();
|
data = createDefaultPolicy();
|
||||||
}
|
}
|
||||||
self.changeDate = ko.observable(data.changeDate);
|
self.ChangeDate = ko.observable(data.ChangeDate);
|
||||||
self.description = ko.observable(data.description);
|
self.ChangeDescription = ko.observable(data.ChangeDescription);
|
||||||
self.changeAuthor = ko.observable(data.changeAuthor);
|
self.ChangeAuthor = ko.observable(data.ChangeAuthor);
|
||||||
self.version = ko.observable(data.version);
|
self.Version = ko.observable(data.Version);
|
||||||
self.markdown = ko.observable(data.markdown);
|
self.Markdown = ko.observable(data.Markdown);
|
||||||
self.html = ko.observable(data.html);
|
self.Html = ko.observable(data.Html);
|
||||||
function createDefaultPolicy() {
|
function createDefaultPolicy() {
|
||||||
return {
|
return {
|
||||||
changeDate: moment().format(),
|
ChangeDate: moment().toISOString(),
|
||||||
description: "",
|
Description: "",
|
||||||
changeAuthor: "",
|
ChangeAuthor: "",
|
||||||
version: -1,
|
Version: -1,
|
||||||
markdown: "",
|
Markdown: "",
|
||||||
html: ""
|
Html: ""
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
self.update = function (data) {
|
self.update = function (data) {
|
||||||
self.changeDate(data.changeDate);
|
if (!data) return;
|
||||||
self.description(data.description);
|
self.ChangeDate(data.ChangeDate);
|
||||||
self.changeAuthor(data.changeAuthor);
|
self.ChangeDescription(data.ChangeDescription);
|
||||||
self.version(data.version);
|
self.ChangeAuthor(data.ChangeAuthor);
|
||||||
self.markdown(data.markdown);
|
self.Version(data.Version);
|
||||||
self.html(data.html);
|
self.Markdown(data.Markdown);
|
||||||
|
self.Html(data.Html);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user