timgeyssens / uiomatic Goto Github PK
View Code? Open in Web Editor NEWAuto generate an integrated crud UI in Umbraco for a db table based on a petapoco poco (and more)
Home Page: https://timgeyssens.gitbook.io/ui-o-matic/
License: Other
Auto generate an integrated crud UI in Umbraco for a db table based on a petapoco poco (and more)
Home Page: https://timgeyssens.gitbook.io/ui-o-matic/
License: Other
Button doesn't seem to be at correct place, and maybe add an icon for each action?
Currently you have to create a custom field editor
Hi Tim, great package !!!
I've been playing with it for a few days and everything worked fine until I tried to setup a property with a foreign key. Not even working with the Example Dog Property Editor. It just throws this error message
{"Message":"An error has occurred.",
"ExceptionMessage":"The 'ObjectContent`1' type failed to serialize the response body
for content type 'application/json; charset=utf-8'.","ExceptionType":
"System.InvalidOperationException","StackTrace":null,"InnerException":
{"Message":"An error has occurred.","ExceptionMessage":"Value cannot be null.\r\n
Parameter name: element","ExceptionType":"System.ArgumentNullException",
"StackTrace":" at System.Attribute.GetCustomAttributes(MemberInfo element,
Type type, Boolean inherit)\r\n at System.Attribute.GetCustomAttribute(MemberInfo
element,Type attributeType, Boolean inherit)\r\n at UIOMatic.Controllers
.PetaPocoObjectController.d__6.MoveNext()\r\n at Newtonsoft.Json
.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer,
IEnumerable values, JsonArrayContract contract, JsonProperty member,
JsonContainerContract collectionContract, JsonProperty containerProperty)\r\n
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter
jsonWriter, Object value, Type objectType)\r\n at Newtonsoft.Json.JsonSerializer.
SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType)\r\n
at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.WriteToStream(Type type
, Object value, Stream writeStream, Encoding effectiveEncoding)\r\n
at System.Net.Http.Formatting.JsonMediaTypeFormatter.WriteToStream(Type type,
Object value, Stream writeStream, Encoding effectiveEncoding)\r\n
at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.WriteToStreamAsync
(Type type, Object value, Stream writeStream, HttpContent content,
TransportContext transportContext, CancellationToken cancellationToken)\r\n---
End of stack trace from previous location where exception was thrown ---\r\n
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification
(Task task)\r\n at System.Web.Http.WebHost.HttpControllerHandler
.d__1b.MoveNext()"}}
Using Umb 7.3.4 and ui-o-matic 1.6.0
Any idea what the problem could be?
Best regards
Not getting any results back and when you search you get an error
INNER EXCEPTION
System.Data.SqlServerCe.SqlCeException: The column name is not valid. [ Node name (if any) = ,Column name = a ]
Hi, I have followed the solution "Foreign Keys with Label view" on umbraco.org:
https://our.umbraco.org/projects/developer-tools/ui-o-matic/computer-says-no/73973-foreign-keys-with-label-view
to enable foriegn key values. But I'm not having any luck... the only difference is, the fields are dropdown fields.
I have added a comment to the above link... but essentially all I'm trying to do is show the value in listview of a foreign key
I installed UIOmatic in a clean web application and the section is not showing up in the back office. I added a class based on the documentation you provided
An error occured
Error converting value {null} to type 'System.DateTime'. Path 'Birthday', line 1, position 23.
EXCEPTION DETAILS
Newtonsoft.Json.JsonSerializationException: Error converting value {null} to type 'System.DateTime'. Path 'Birthday', line 1, position 23.
in v2 beta Nuget doesn't seem to open a readme anymore after installation
Any plans on making this work with Entity Framework instead of PetaPoco?
The children controllers initialize before the parent controller is done loading the form's data.
You should add a broadcast event to your edit.controller.js:
uioMaticObjectResource.getById($routeParams.id.split("=")[1], $routeParams.id.split("?")[0]).then(function (response) {
$scope.object = response.data;
$scope.loaded = true;
setValues();
$scope.$broadcast('ValuesLoaded');
});
Then add listeners in the dropdown.controller.js, pickers.content.controller.js, and pickers.media.controller.js controllers:
dropdown.controller.js
angular.module("umbraco").controller("UIOMatic.Views.Dropdown",
function ($scope, uioMaticObjectResource) {
//example config
//"{'typeName':'Example.Models.Person, Example', 'valueColumn': 'Id', 'textColumn'='FirstName'}"
function init() {
uioMaticObjectResource.getAll($scope.property.Config.typeName, $scope.property.Config.textColumn, "asc").then(function (response) {
$scope.objects = response.data;
});
}
init();
$scope.$on('ValuesLoaded', function (event, data) {
init();
});
});
pickers.content.controller.js
angular.module("umbraco").controller("UIOMatic.Views.Pickers.ContentController",
function ($scope, $routeParams, $http, dialogService, entityResource, iconHelper) {
function init() {
if (!$scope.setting) {
$scope.setting = {};
}
var val = parseInt($scope.property.Value);
if (!isNaN(val) && angular.isNumber(val)) {
$scope.showQuery = false;
entityResource.getById(val, "Document").then(function (item) {
item.icon = iconHelper.convertFromLegacyIcon(item.icon);
$scope.node = item;
});
}
$scope.openContentPicker = function () {
var d = dialogService.treePicker({
section: "content",
treeAlias: "content",
multiPicker: false,
callback: populate
});
};
$scope.clear = function () {
$scope.id = undefined;
$scope.node = undefined;
$scope.property.Value = undefined;
};
function populate(item) {
$scope.clear();
item.icon = iconHelper.convertFromLegacyIcon(item.icon);
$scope.node = item;
$scope.id = item.id;
$scope.property.Value = item.id;
}
};
init();
$scope.$on('ValuesLoaded', function (event, data) {
init();
});
});
pickers.media.controller.js
angular.module("umbraco").controller("UIOMatic.Views.Pickers.MediaController",
function ($scope, $routeParams, dialogService, entityResource, iconHelper) {
function init() {
if (!$scope.setting) {
$scope.setting = {};
}
var val = parseInt($scope.property.Value);
if (!isNaN(val) && angular.isNumber(val)) {
$scope.showQuery = false;
entityResource.getById(val, "Media").then(function (item) {
item.icon = iconHelper.convertFromLegacyIcon(item.icon);
$scope.node = item;
});
}
$scope.openMediaPicker = function () {
var d = dialogService.treePicker({
section: "media",
treeAlias: "media",
multiPicker: false,
callback: populate
});
};
$scope.clear = function () {
$scope.id = undefined;
$scope.node = undefined;
$scope.property.Value = undefined;
};
function populate(item) {
$scope.clear();
item.icon = iconHelper.convertFromLegacyIcon(item.icon);
$scope.node = item;
$scope.id = item.id;
$scope.property.Value = item.id;
}
};
init();
$scope.$on('ValuesLoaded', function (event, data) {
init();
});
});
Hi Tim,
We have a specific solution structure at our company, this requires us to define the Models in a seperate Data/Models project. We'd like to use the UIOMatic inside our Umbraco project but when including the UIOMatic package the entire UmbracoCms package is installed, this is not desired.
What do you think of the introducing an UIOMatic.Core project (which only requires UmbracoCms.Core), I've already created some commits https://github.com/ThumNet/UIOMatic/commit/cc7f0531aaad23321a98329ee504a20cbba2de65 and https://github.com/ThumNet/UIOMatic/commit/286981759ef2c96cc05b724d13e2a763ee24ce5f with the suggested change :)
I'm interested in your thoughts on the matter!
Regards,
Jeffrey
If I remember correct they could use some TLC when you have a lot of pages
I have a model which looks something like:
public class Products : IUIOMaticModel
{
[UIOMaticIgnoreField]
[UIOMaticIgnoreFromListView]
[PrimaryKeyColumn(AutoIncrement = true)]
public string Id { get; set;}
[UIOMaticField("Product name", "The name of the product.")]
public string Name { get; set; }
[UIOMaticIgnoreFromListView]
[UIOMaticIgnoreField]
public int ImagesId { get; set; }
[UIOMaticIgnoreFromListView]
[UIOMaticIgnoreField]
[Ignore]
public IEnumerable<Image> Images { get; set; }
}
When I run a search for the name of the product in the backoffice of UIOMatic, the following error occurs:
{"Message":"An error has occurred.","ExceptionMessage":"Invalid column name 'Images '.","ExceptionType":"System.Data.SqlClient.SqlException","StackTrace":" at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)\r\n at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)\r\n at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)\r\n at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()\r\n at System.Data.SqlClient.SqlDataReader.get_MetaData()\r\n at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)\r\n at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds)\r\n at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)\r\n at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)\r\n at System.Data.SqlClient.SqlCommand.ExecuteScalar()\r\n at StackExchange.Profiling.Data.ProfiledDbCommand.ExecuteScalar() in c:\\Code\\github\\SamSaffron\\MiniProfiler\\StackExchange.Profiling\\Data\\ProfiledDbCommand.cs:line 299\r\n at Umbraco.Core.Persistence.PetaPocoCommandExtensions.<>c__DisplayClassa.<ExecuteScalarWithRetry>b__9()\r\n at Umbraco.Core.Persistence.FaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func)\r\n at Umbraco.Core.Persistence.Database.ExecuteScalar[T](String sql, Object[] args)\r\n at Umbraco.Core.Persistence.Database.Page[T](Int64 page, Int64 itemsPerPage, String sql, Object[] args)\r\n at Umbraco.Core.Persistence.Database.Page[T](Int64 page, Int64 itemsPerPage, Sql sql)\r\n at UIOMatic.Controllers.PetaPocoObjectController.GetPaged(String typeName, Int32 itemsPerPage, Int32 pageNumber, String sortColumn, String sortOrder, String searchTerm)\r\n at UIOMatic.Controllers.ObjectController.GetPaged(String typeName, Int32 itemsPerPage, Int32 pageNumber, String sortColumn, String sortOrder, String searchTerm)\r\n at lambda_method(Closure , Object , Object[] )\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()"}
It appears that the Images column is being searched. This property does not exist in the Products table (as the model property is decorated with [Ignore]
, and is used to assign rows from another database table which has information about images in it. I think this is why the search is erroring.
When UIOMatic creates the SQL statement, does it take into account the ignore attribute?
The ignore attribute I am using comes from the Umbraco.Core.Persistence.IgnoreAttribute
.
I am using version 1.7.0 of UIOmatic, and 7.4.1 Umbraco.
In case you just want to use it as prop editor and not have it in the backoffice
Add the necessary keys on install.
I played with the very first UIOMatic and now starting to pick where I left after the 2.0 goodness.
In a test db, i have two tables where image is stored in base64 encoded in tableA and byte[](no need for encoding) in another (tableB).
My question is how can I render the image in the ListView for base64 or byte[] for the View section?
Like when user click Tree item A, they see the listview with base64 image, Tree item B click listview shows blob/byte[] image.
I'm picking this up slowly so go easy on me;
[UIOMaticField(Name = "Picture", Description = "Select a picture", View = "file")]
[UIOMaticListViewField(Name = "Picture", View = "image")]
public string Picture { get; set; }
...
Since it seems in v2 beta default they are ordered a-z unless you specify an order.. but to avoid having to specify the order it might be nice to have them ordered as they appear on the model
Mainly to serve as an example for custom filters
How do you get an Icon in the Applications panel in Umbraco CMS?
The list editor does a broadcast when the data is loaded so child controller can listen to this but it appears to not work anymore
Since there are quite a few differences that need to be documented and of course all the new bits
Hi Tim,
I found an issue with the file (media) picker, when using a fresh Umbraco 7.4.2 site.
Steps to reproduce:
Research:
I've also forked your solution and upgraded the UmbracoCms package to 7.4.2 and then the issue doesn't occur. After some digging I found that in the Umbraco site another editor is configured, which returns a different value (an object instead of a string).
Suggested fix:
One solution would be using the image property of the item (which works both cases), but I don't know for sure if this is the best approach
Currently it's hardcoded in the controller, would be nice if it's easy to change
'preview', '|', 'undo', 'redo', '|', 'copy', 'cut', 'paste', '|', 'bold', 'italic', '|', 'link', 'unlink'
If you use the same alias on 2 models it doesn't show an error, but you get 2 items in the tree but they both seem to go to the same model
There are places we ask people to provide a template for a label which is usually in the format
Field1 + " " + Field2
We should change it to support angular syntax
{{Field1}} {{Field2}}
When clicking on the picker to select an image for a poeple object the media picker throws a 401 exception and redirect to login page.
User is still logged in to backoffice.
Enum, public static readonly fields, ... not sure what is best here?
Looks kinda like a prototype atm, could use some TLC
the columns are showing the property name and not the UIOMaticField name
Would be nice to decorate the field attribute with a ex Format="dd-MM-yyyy" to format the columns in the listview. This could of course also be used for numbers etc.
Config option would be the format
Which is the Visual Studio setup for use UIO-Matic after add Umbraco to an empty web solution?
So you don't have to manually give your admin user the correct permissions
Just an idea, but a way to have other actions then just delete available in the list view (and folks can plug and play custom ones by just working with a provider model)
Since it was already based on that but on an older version...
When editing a date it displays itself as datetime. When new date is selected it works as expected.
Great package !
Now that the broadcast is working again it seems several controllers call the init method to quickly
Seems these get a min date value but then can't save object with those values
An error occured
Could not convert string to DateTime: 0000-12-31 22:00:00. Path 'Birthday', line 1, position 40.
EXCEPTION DETAILS
Newtonsoft.Json.JsonReaderException: Could not convert string to DateTime: 0000-12-31 22:00:00. Path 'Birthday', line 1, position 40.
Hey Tim! Just an idea - when creating or editing an object, some static text is shown in the header:
I think it might be nice for editors to see the name of the object type they're working with, like so:
I'm not sure the best way to do this though. There is a name defined in the UIOMaticAttribute
, but it's plural. Not sure if it makes sense to work with that, or add another property, for the object name or header text?
I also wonder if it makes sense to think about making the header a textbox with the name of the object, like Umbraco's edit screen does. Ex:
Properties with [DataMember] gets included in list even if [UIOMaticIgnoreFromListView] is set.
Hi Tim,
I installed the nuget package but unfortunately it is not showing up in the backoffice. Not getting any console errors or tracelog errors. We are using UaaS, but this current issue happens on my local version (cloned from UaaS). The current Umbraco version is 7.4.3. Also want to note that I have the Umbraco website in one project, and all of the models/controllers/etc. in another project (using strongly typed views). That other project only had the Umbraco core binaries, but the nuget dependencies downloaded Umbraco CMS 7.4.1 (which I then upgraded to 7.4.3).
Any ideas what might be happening here, or what else I can try?
Best,
Ryan
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.