|
|
@ -26,11 +26,30 @@ public class VbenViewScriptGenerator : IVbenViewScriptGenerator, ISingletonDepen |
|
|
.Select(module => module.Value) |
|
|
.Select(module => module.Value) |
|
|
.FirstOrDefault(); |
|
|
.FirstOrDefault(); |
|
|
|
|
|
|
|
|
|
|
|
var updateAction = controllerModel.Actions |
|
|
|
|
|
.Where(action => action.Value.Name.Contains("UpdateAsync")) |
|
|
|
|
|
.Select(action => action.Value) |
|
|
|
|
|
.FirstOrDefault(); |
|
|
|
|
|
var createAction = controllerModel.Actions |
|
|
|
|
|
.Where(action => action.Value.Name.Contains("CreateAsync")) |
|
|
|
|
|
.Select(action => action.Value) |
|
|
|
|
|
.FirstOrDefault(); |
|
|
|
|
|
var getAction = controllerModel.Actions |
|
|
|
|
|
.Where(action => action.Value.Name.Contains("GetAsync")) |
|
|
|
|
|
.Select(action => action.Value) |
|
|
|
|
|
.FirstOrDefault(); |
|
|
|
|
|
|
|
|
var modalContent = await _templateRenderer.RenderAsync( |
|
|
var modalContent = await _templateRenderer.RenderAsync( |
|
|
"VbenModalView", |
|
|
"VbenModalView", |
|
|
new |
|
|
new |
|
|
{ |
|
|
{ |
|
|
Key = "id", |
|
|
Key = "id", |
|
|
|
|
|
HasCreate = createAction != null, |
|
|
|
|
|
GetAction = getAction?.UniqueName ?? "GetAsyncById", |
|
|
|
|
|
CreateAction = createAction?.UniqueName ?? "CreateAsyncByInput", |
|
|
|
|
|
HasUpdate = updateAction != null, |
|
|
|
|
|
UpdateAction = updateAction?.UniqueName ?? "UpdateAsyncByIdAndInput", |
|
|
|
|
|
HasSubmit = createAction != null || updateAction != null, |
|
|
Application = controllerModel.ControllerName, |
|
|
Application = controllerModel.ControllerName, |
|
|
ApiPath = $"/@/api/{moduleDefinition.RemoteServiceName.ToKebabCase()}/{controllerModel.ControllerName.ToKebabCase()}", |
|
|
ApiPath = $"/@/api/{moduleDefinition.RemoteServiceName.ToKebabCase()}/{controllerModel.ControllerName.ToKebabCase()}", |
|
|
RemoteService = moduleDefinition.RemoteServiceName, |
|
|
RemoteService = moduleDefinition.RemoteServiceName, |
|
|
@ -62,6 +81,10 @@ public class VbenViewScriptGenerator : IVbenViewScriptGenerator, ISingletonDepen |
|
|
.Where(action => action.Value.Name.Contains("UpdateAsync")) |
|
|
.Where(action => action.Value.Name.Contains("UpdateAsync")) |
|
|
.Select(action => action.Value) |
|
|
.Select(action => action.Value) |
|
|
.FirstOrDefault(); |
|
|
.FirstOrDefault(); |
|
|
|
|
|
var createAction = controllerModel.Actions |
|
|
|
|
|
.Where(action => action.Value.Name.Contains("CreateAsync")) |
|
|
|
|
|
.Select(action => action.Value) |
|
|
|
|
|
.FirstOrDefault(); |
|
|
|
|
|
|
|
|
var tableContent = await _templateRenderer.RenderAsync( |
|
|
var tableContent = await _templateRenderer.RenderAsync( |
|
|
"VbenTableView", |
|
|
"VbenTableView", |
|
|
@ -69,10 +92,17 @@ public class VbenViewScriptGenerator : IVbenViewScriptGenerator, ISingletonDepen |
|
|
{ |
|
|
{ |
|
|
Key = "id", |
|
|
Key = "id", |
|
|
PagedRequest = pagedResultAction != null, |
|
|
PagedRequest = pagedResultAction != null, |
|
|
UpdatePermission = updateAction != null && updateAction.AllowAnonymous != null && updateAction.AllowAnonymous != true, |
|
|
GetListAction = pagedResultAction?.UniqueName ?? "GetListAsyncByInput", |
|
|
UpdatePermissionName = $"{moduleDefinition.RemoteServiceName.ToKebabCase()}.{controllerModel.ControllerName.ToKebabCase()}.Update", |
|
|
HasCreate = createAction != null, |
|
|
DeletePermission = deleteAction != null && deleteAction.AllowAnonymous != null && deleteAction.AllowAnonymous != true, |
|
|
CreatePermission = true, |
|
|
DeletePermissionName = $"{moduleDefinition.RemoteServiceName.ToKebabCase()}.{controllerModel.ControllerName.ToKebabCase()}.Delete", |
|
|
CreatePermissionName = $"{moduleDefinition.RemoteServiceName.ToPascalCase()}.{controllerModel.ControllerName.ToPascalCase()}.Create", |
|
|
|
|
|
HasUpdate = updateAction != null, |
|
|
|
|
|
UpdatePermission = true, |
|
|
|
|
|
UpdatePermissionName = $"{moduleDefinition.RemoteServiceName.ToPascalCase()}.{controllerModel.ControllerName.ToPascalCase()}.Update", |
|
|
|
|
|
HasDelete = deleteAction != null, |
|
|
|
|
|
DeleteAction = deleteAction?.UniqueName ?? "DeleteAsyncById", |
|
|
|
|
|
DeletePermission = true, |
|
|
|
|
|
DeletePermissionName = $"{moduleDefinition.RemoteServiceName.ToPascalCase()}.{controllerModel.ControllerName.ToPascalCase()}.Delete", |
|
|
Application = controllerModel.ControllerName, |
|
|
Application = controllerModel.ControllerName, |
|
|
ModalName = $"{controllerModel.ControllerName.ToPascalCase()}Modal", |
|
|
ModalName = $"{controllerModel.ControllerName.ToPascalCase()}Modal", |
|
|
ApiPath = $"/@/api/{moduleDefinition.RemoteServiceName.ToKebabCase()}/{controllerModel.ControllerName.ToKebabCase()}", |
|
|
ApiPath = $"/@/api/{moduleDefinition.RemoteServiceName.ToKebabCase()}/{controllerModel.ControllerName.ToKebabCase()}", |
|
|
|