Browse Source

Merge pull request #14748 from abpframework/auto-merge/rel-7-0/1475

Merge branch dev with rel-7.0
pull/14749/head
maliming 4 years ago
committed by GitHub
parent
commit
40d3442d31
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) * [Data Table Column (or Entity Prop) Extensions](Data-Table-Column-Extensions.md)
* [Page Toolbar Extension](Page-Toolbar-Extensions.md) * [Page Toolbar Extension](Page-Toolbar-Extensions.md)
* [Dynamic Form (or Form Prop) Extensions](Dynamic-Form-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 EventBus.PublishAsync(new ProjectCreationProgressEvent
{ {
Message = "Extracting the solution archieve" Message = "Unzipping the solution"
}, false); }, false);
using (var templateFileStream = new MemoryStream(project.ZipContent)) using (var templateFileStream = new MemoryStream(project.ZipContent))
@ -818,4 +818,4 @@ public abstract class ProjectCreationCommandBase
public const string Long = "theme-style"; 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; 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 appSettingsJson = JObject.Parse(httpApiHostAppSettings.Content);
var appJson = (JObject)appSettingsJson["App"]; var appJson = (JObject)appSettingsJson["App"];
if (context.BuildArgs.UiFramework != UiFramework.Angular) if (context.BuildArgs.UiFramework != UiFramework.Angular)
{ {
var clientUrl = appJson.Property("ClientUrl")?.ToString(); removeAngularUrl = true;
portsToRemoveFromCors.Add("http://localhost:4200"); portsToRemove.Add("http://localhost:4200");
if (!clientUrl.IsNullOrWhiteSpace())
{
httpApiHostAppSettings.SetContent(httpApiHostAppSettings.Content.Replace(clientUrl, string.Empty));
}
} }
if (context.BuildArgs.UiFramework != UiFramework.Blazor) if (context.BuildArgs.UiFramework != UiFramework.Blazor)
{ {
portsToRemoveFromCors.Add("https://localhost:44307"); portsToRemove.Add("https://localhost:44307");
} }
foreach (var line in lines)
if (appJson["CorsOrigins"] != null)
{ {
var corsOrigins = appJson["CorsOrigins"].ToString(); var newLine = line;
var newCorsOrigins = string.Join(",", corsOrigins.Split(',').Where(x => !portsToRemoveFromCors.Contains(x))); 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) 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'; import { GenerateProxySchema } from '../models';
export function createApisGenerator(schema: GenerateProxySchema, generated: string[]) { 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); const source = readFileInTree(tree, envPath);
return findEnvironmentExpression(source); 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) { export function readWorkspaceSchema(tree: Tree) {
if (!tree.exists('/angular.json')) throw new SchematicsException(Exception.NoWorkspace); 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 // @typescript-eslint/no-explicit-any
notFoundValue: T = NOT_FOUND_VALUE as unknown as any, notFoundValue: T = NOT_FOUND_VALUE as unknown as any,
): Promise<Project | T> { ): Promise<Project | T> {
name = name || readWorkspaceSchema(tree).defaultProject!; name = name || readWorkspaceSchema(tree).defaultProject || getFirstApplication(tree).name!;
const workspace = await getWorkspace(tree); const workspace = await getWorkspace(tree);
let definition: Project['definition'] | undefined; let definition: Project['definition'] | undefined;

Loading…
Cancel
Save