Browse Source

Merge pull request #14747 from abpframework/auto-merge/rel-6-0/1474

Merge branch rel-7.0 with rel-6.0
pull/14748/head
maliming 4 years ago
committed by GitHub
parent
commit
ce68255c00
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 24
      docs/en/UI/Angular/Extensions-Overall.md
  2. 4
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs
  3. 39
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/RemoveUnnecessaryPortsStep.cs
  4. 6
      npm/ng-packs/packages/schematics/src/utils/api.ts
  5. 10
      npm/ng-packs/packages/schematics/src/utils/workspace.ts

24
docs/en/UI/Angular/Extensions-Overall.md

@ -8,3 +8,27 @@ See the documents below for the details:
* [Data Table Column (or Entity Prop) Extensions](Data-Table-Column-Extensions.md)
* [Page Toolbar Extension](Page-Toolbar-Extensions.md)
* [Dynamic Form (or Form Prop) Extensions](Dynamic-Form-Extensions.md)
## Extensible Table Component
Using [ngx-datatable](https://github.com/swimlane/ngx-datatable) in extensinble table.
````ts
<abp-extensible-table
actionsText="Your Action"
[data]="items"
[recordsTotal]="totalCount"
[actionsColumnWidth]="38"
[actionsTemplate]="customAction"
[list]="list"
(tableActivate)="onTableSelect($event)" >
</abp-extensible-table>
````
* ` actionsText : ` ** Column name of action column. **Type** : string
* ` data : ` Items shows in your table. **Type** : Array<any>
* ` list : ` Instance of ListService. **Type** : ListService
* `actionsColumnWidth : ` Width of your action column. **Type** : number
* ` actionsTemplate : ` Template of the action when "click this button" or whatever. Generally ng-template. **Type** : TemplateRef<any>
* ` recordsTotal : ` Count of the record total. **Type** : number
* ` tableActivate : ` The Output(). A cell or row was focused via the keyboard or a mouse click. **Type** : EventEmitter()

4
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs

@ -248,7 +248,7 @@ public abstract class ProjectCreationCommandBase
{
EventBus.PublishAsync(new ProjectCreationProgressEvent
{
Message = "Extracting the solution archieve"
Message = "Unzipping the solution"
}, false);
using (var templateFileStream = new MemoryStream(project.ZipContent))
@ -818,4 +818,4 @@ public abstract class ProjectCreationCommandBase
public const string Long = "theme-style";
}
}
}
}

39
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/RemoveUnnecessaryPortsStep.cs

@ -25,35 +25,46 @@ public class RemoveUnnecessaryPortsStep : ProjectBuildPipelineStep
return;
}
var portsToRemoveFromCors = new List<string>();
var lines = httpApiHostAppSettings.GetLines();
var newlines = new List<string>();
var portsToRemove = new List<string>();
var removeAngularUrl = false;
var appSettingsJson = JObject.Parse(httpApiHostAppSettings.Content);
var appJson = (JObject)appSettingsJson["App"];
if (context.BuildArgs.UiFramework != UiFramework.Angular)
{
var clientUrl = appJson.Property("ClientUrl")?.ToString();
portsToRemoveFromCors.Add("http://localhost:4200");
if (!clientUrl.IsNullOrWhiteSpace())
{
httpApiHostAppSettings.SetContent(httpApiHostAppSettings.Content.Replace(clientUrl, string.Empty));
}
removeAngularUrl = true;
portsToRemove.Add("http://localhost:4200");
}
if (context.BuildArgs.UiFramework != UiFramework.Blazor)
{
portsToRemoveFromCors.Add("https://localhost:44307");
portsToRemove.Add("https://localhost:44307");
}
if (appJson["CorsOrigins"] != null)
foreach (var line in lines)
{
var corsOrigins = appJson["CorsOrigins"].ToString();
var newCorsOrigins = string.Join(",", corsOrigins.Split(',').Where(x => !portsToRemoveFromCors.Contains(x)));
var newLine = line;
if(removeAngularUrl && (line.Contains("AngularUrl")|| line.Contains("ClientUrl")))
{
continue;
}
httpApiHostAppSettings.SetContent(httpApiHostAppSettings.Content.Replace(corsOrigins, newCorsOrigins));
if(line.Contains("CorsOrigins") || line.Contains("RedirectAllowedUrls"))
{
var jsonValue = line.Contains("CorsOrigins") ? appJson["CorsOrigins"]?.ToString() : appJson["RedirectAllowedUrls"]?.ToString();
if(!jsonValue.IsNullOrWhiteSpace())
{
newLine = line.Replace(jsonValue, string.Join(",", jsonValue.Split(',').Where(x => !portsToRemove.Contains(x))));
}
}
newlines.Add(newLine);
}
httpApiHostAppSettings.SetLines(newlines);
}
private static void RemoveUnnecessaryDbMigratorClients(ProjectBuildContext context)

6
npm/ng-packs/packages/schematics/src/utils/api.ts

@ -2,5 +2,9 @@ import { chain, schematic } from '@angular-devkit/schematics';
import { GenerateProxySchema } from '../models';
export function createApisGenerator(schema: GenerateProxySchema, generated: string[]) {
return chain(generated.map(m => schematic('api', { ...schema, module: m })));
return chain(
generated.map(m =>
schematic('api', { ...schema, module: m, entryPoint: schema.entryPoint || '__default' }),
),
);
}

10
npm/ng-packs/packages/schematics/src/utils/workspace.ts

@ -21,6 +21,14 @@ export function readEnvironment(tree: Tree, project: workspaces.ProjectDefinitio
const source = readFileInTree(tree, envPath);
return findEnvironmentExpression(source);
}
export function getFirstApplication(tree: Tree) {
const workspace = readWorkspaceSchema(tree);
const [name, project] =
Object.entries(workspace.projects).find(
([_, project]) => project.projectType === ProjectType.Application,
) || [];
return { name, project };
}
export function readWorkspaceSchema(tree: Tree) {
if (!tree.exists('/angular.json')) throw new SchematicsException(Exception.NoWorkspace);
@ -44,7 +52,7 @@ export async function resolveProject<T = any>(
// @typescript-eslint/no-explicit-any
notFoundValue: T = NOT_FOUND_VALUE as unknown as any,
): Promise<Project | T> {
name = name || readWorkspaceSchema(tree).defaultProject!;
name = name || readWorkspaceSchema(tree).defaultProject || getFirstApplication(tree).name!;
const workspace = await getWorkspace(tree);
let definition: Project['definition'] | undefined;

Loading…
Cancel
Save