Browse Source

Merge pull request #11276 from abpframework/auto-merge/rel-5-1/784

Merge branch dev with rel-5.1
pull/11287/head
Mehmet Erim 5 years ago
committed by GitHub
parent
commit
4e0ff27cd9
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      deploy/_run_all.ps1
  2. 40
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs
  3. 7
      npm/ng-packs/packages/core/src/lib/utils/string-utils.ts
  4. 4
      npm/ng-packs/packages/identity/src/lib/defaults/default-roles-entity-props.ts
  5. 6
      npm/ng-packs/packages/identity/src/lib/defaults/default-users-entity-props.ts
  6. 5
      npm/ng-packs/packages/theme-shared/extensions/src/lib/models/entity-props.ts

7
deploy/_run_all.ps1

@ -0,0 +1,7 @@
./1-fetch-and-build.ps1
./2-nuget-pack.ps1
./3-nuget-push.ps1
./4-npm-publish-mvc.ps1
./5-npm-publish-angular.ps1
./6-git-commit.ps1
echo "Create a new release on GitHub manually and run the step 8..."

40
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs

@ -121,7 +121,6 @@ public class NpmPackagesUpdater : ITransientDependency
{ {
var fileName = Path.Combine(directoryName, ".npmrc"); var fileName = Path.Combine(directoryName, ".npmrc");
var abpRegistry = "@abp:registry=https://www.myget.org/F/abp-nightly/npm"; var abpRegistry = "@abp:registry=https://www.myget.org/F/abp-nightly/npm";
var voloRegistry = await GetVoloRegistryAsync();
if (await NpmrcFileExistAsync(directoryName)) if (await NpmrcFileExistAsync(directoryName))
{ {
@ -132,11 +131,6 @@ public class NpmPackagesUpdater : ITransientDependency
fileContent += Environment.NewLine + abpRegistry; fileContent += Environment.NewLine + abpRegistry;
} }
if (!fileContent.Contains(voloRegistry))
{
fileContent += Environment.NewLine + voloRegistry;
}
File.WriteAllText(fileName, fileContent); File.WriteAllText(fileName, fileContent);
return; return;
@ -145,42 +139,10 @@ public class NpmPackagesUpdater : ITransientDependency
using var fs = File.Create(fileName); using var fs = File.Create(fileName);
var content = new UTF8Encoding(true) var content = new UTF8Encoding(true)
.GetBytes(abpRegistry + Environment.NewLine + voloRegistry); .GetBytes(abpRegistry);
fs.Write(content, 0, content.Length); fs.Write(content, 0, content.Length);
} }
private async Task<string> GetVoloRegistryAsync()
{
var apikey = await GetApiKeyAsync();
if (string.IsNullOrWhiteSpace(apikey))
{
return "";
}
return "@volo:registry=https://www.myget.org/F/abp-commercial/auth/" + apikey + "/npm/";
}
public async Task<string> GetApiKeyAsync()
{
try
{
var client = _cliHttpClientFactory.CreateClient();
using (var response = await client.GetHttpResponseMessageWithRetryAsync(
url: $"{CliUrls.WwwAbpIo}api/myget/apikey/",
cancellationToken: CancellationTokenProvider.Token,
logger: Logger
))
{
return Encoding.Default.GetString(await response.Content.ReadAsByteArrayAsync());
}
}
catch (Exception)
{
return string.Empty;
}
}
private static bool IsAngularProject(string fileDirectory) private static bool IsAngularProject(string fileDirectory)
{ {
return File.Exists(Path.Combine(fileDirectory, "angular.json")); return File.Exists(Path.Combine(fileDirectory, "angular.json"));

7
npm/ng-packs/packages/core/src/lib/utils/string-utils.ts

@ -21,3 +21,10 @@ export function interpolate(text: string, params: string[]) {
.replace(/(['"]?\{\s*(\d+)\s*\}['"]?)/g, (_, match, digit) => params[digit] ?? match) .replace(/(['"]?\{\s*(\d+)\s*\}['"]?)/g, (_, match, digit) => params[digit] ?? match)
.replace(/\s+/g, ' '); .replace(/\s+/g, ' ');
} }
export function escapeHtmlChars(value: string) {
return (
value &&
value.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;')
);
}

4
npm/ng-packs/packages/identity/src/lib/defaults/default-roles-entity-props.ts

@ -1,4 +1,4 @@
import { LocalizationService } from '@abp/ng.core'; import { escapeHtmlChars, LocalizationService } from '@abp/ng.core';
import { IdentityRoleDto } from '@abp/ng.identity/proxy'; import { IdentityRoleDto } from '@abp/ng.identity/proxy';
import { EntityProp, ePropType } from '@abp/ng.theme.shared/extensions'; import { EntityProp, ePropType } from '@abp/ng.theme.shared/extensions';
import { of } from 'rxjs'; import { of } from 'rxjs';
@ -15,7 +15,7 @@ export const DEFAULT_ROLES_ENTITY_PROPS = EntityProp.createMany<IdentityRoleDto>
const { isDefault, isPublic, name } = data.record; const { isDefault, isPublic, name } = data.record;
return of( return of(
name + escapeHtmlChars(name) +
(isDefault (isDefault
? `<span class="badge rounded-pill bg-success ms-1">${t( ? `<span class="badge rounded-pill bg-success ms-1">${t(
'AbpIdentity::DisplayName:IsDefault', 'AbpIdentity::DisplayName:IsDefault',

6
npm/ng-packs/packages/identity/src/lib/defaults/default-users-entity-props.ts

@ -1,4 +1,4 @@
import { LocalizationService } from '@abp/ng.core'; import { escapeHtmlChars, LocalizationService } from '@abp/ng.core';
import { IdentityUserDto } from '@abp/ng.identity/proxy'; import { IdentityUserDto } from '@abp/ng.identity/proxy';
import { EntityProp, ePropType } from '@abp/ng.theme.shared/extensions'; import { EntityProp, ePropType } from '@abp/ng.theme.shared/extensions';
import { of } from 'rxjs'; import { of } from 'rxjs';
@ -21,7 +21,9 @@ export const DEFAULT_USERS_ENTITY_PROPS = EntityProp.createMany<IdentityUserDto>
return of( return of(
` `
${!data.record.isActive ? inactiveIcon : ''} ${!data.record.isActive ? inactiveIcon : ''}
<span class="${!data.record.isActive ? 'text-muted' : ''}">${data.record.userName}</span>`, <span class="${!data.record.isActive ? 'text-muted' : ''}">${escapeHtmlChars(
data.record.userName,
)}</span>`,
); );
}, },
}, },

5
npm/ng-packs/packages/theme-shared/extensions/src/lib/models/entity-props.ts

@ -1,7 +1,7 @@
import { ABP, escapeHtmlChars } from '@abp/ng.core';
import { Type } from '@angular/core'; import { Type } from '@angular/core';
import { Observable, of } from 'rxjs'; import { Observable, of } from 'rxjs';
import { O } from 'ts-toolbelt'; import { O } from 'ts-toolbelt';
import { ABP } from '@abp/ng.core';
import { ActionCallback } from './actions'; import { ActionCallback } from './actions';
import { import {
Prop, Prop,
@ -43,7 +43,8 @@ export class EntityProp<R = any> extends Prop<R> {
this.columnWidth = options.columnWidth; this.columnWidth = options.columnWidth;
this.sortable = options.sortable || false; this.sortable = options.sortable || false;
this.valueResolver = options.valueResolver || (data => of(data.record[this.name])); this.valueResolver =
options.valueResolver || (data => of(escapeHtmlChars(data.record[this.name])));
this.action = options.action; this.action = options.action;
this.component = options.component; this.component = options.component;
this.enumList = options.enumList; this.enumList = options.enumList;

Loading…
Cancel
Save