I'm using ASP.NET CORE & Angular (v8.1.0), I want to update Users grid to show ProfilePicture as below:
I've read Show Profile Pictures in Users Grid #5243 and tried updating as following:
user.component.html:
user.comonent.ts:
remoteServiceBaseUrl: string = AppConsts.remoteServiceBaseUrl;
But the picture is not shown:
I've got this error:
If I logged in to the SwaggerUI then refresh the Angular app, I got this error:
Here is my CORS setting in appsettings.json:
"App": { "ServerRootAddress": "http://localhost:22742/", "ClientRootAddress": "http://localhost:4200/", "CorsOrigins": "http://*.mycompany.com,http://localhost:4200,http://localhost:49152", "SwaggerEndPoint": "/swagger/v1/swagger.json", "AllowAnonymousSignalRConnection": "true" },
What am I missing here? Any other way to solve my problem?
Thank you for the suggestion, I've tried to update as following:
user.component.html:
<td style="width: 150px">
<span class="ui-column-title"> {{'UserName' | localize}}</span>
<img *ngIf="!record.profilePictureId" src="./assets/common/images/default-profile-picture.png" alt="pic" />
<img *ngIf="record.profilePictureId" [src]="getProfilePicture(record.profilePictureId)" alt="pic" />
{{record.userName}}
</td>
user.component.ts:
getProfilePicture(profilePictureId: string): string {
let profilePicture = '';
this._profileServiceProxy.getProfilePictureById(profilePictureId).subscribe(result => {
if (result && result.profilePicture) {
profilePicture = 'data:image/jpeg;base64,' + result.profilePicture;
}
});
return profilePicture;
}
But, the Google Chrome was hang, and I got 100% CPU.
I've checked and found that there are many requests are made:
Can you give me any idea? What was wrong here?
No, I don't think it is expected. Actually users list has only 03 records. I think there might be a potential bug here. In meanwhile, I will try as your suggestion.
No, there's no javascript error. The request is keeping generated and my CPU is 100% then I need to close Google Chrome.
To whom it may concern, I've solved this problem by 02 options: Option 1: UserAppService.cs: users.component.html:
<td style="width: 150px">
<span class="ui-column-title"> {{'UserName' | localize}}</span>
<div class="kt-user-card-v2">
<div class="kt-user-card-v2__pic">
<img *ngIf="!record.profilePictureId" src="./assets/common/images/default-profile-picture.png" alt="pic" />
<img *ngIf="record.profilePictureId" [src]="record.profilePicture" alt="pic" />
</div>
<div class="kt-user-card-v2__details">
<span class="kt-user-card-v2__name">{{record.userName}}</span>
</div>
</div>
</td>
Option 2: ProfileController.cs:
[AllowAnonymous]
public async Task<ActionResult> GetProfilePicture(Guid profilePictureId)
{
var defaultProfilePicture = "/Common/Images/SampleProfilePics/sample-profile-01.jpg";
var file = await _binaryObjectManager.GetOrNullAsync(profilePictureId);
if (file == null)
{
return File(defaultProfilePicture, MimeTypeNames.ImageJpeg);
}
return File(file.Bytes, MimeTypeNames.ImageJpeg);
}
users.component.html:
<td style="width: 150px">
<span class="ui-column-title"> {{'UserName' | localize}}</span>
<div class="kt-user-card-v2">
<div class="kt-user-card-v2__pic">
<img *ngIf="!record.profilePictureId" src="./assets/common/images/default-profile-picture.png" alt="pic" />
<img *ngIf="record.profilePictureId" [src]="remoteServiceBaseUrl + '/Profile/GetProfilePicture?profilePictureId=' + record.profilePictureId" alt="pic" />
</div>
<div class="kt-user-card-v2__details">
<span class="kt-user-card-v2__name">{{record.userName}}</span>
</div>
</div>
</td>
<td style="width: 150px">
Hi @bobingham,
Can you share me your email, I have some information need to discuss with you in private? Here is my email: [email protected]
We are trying migrating our project (ANZ v7.2.0 - ASP.NET Core + Angular) from MS SQL Server to Oracle 11g but we got this error when running "Update-Database":
PM> update-database --verbose
Applying migration '20170406083347_Initial_Migration'.
2020-07-27 23:02:16.447396 ThreadID:1 (ERROR) OracleRelationalCommand.Execute() : Oracle.ManagedDataAccess.Client.OracleException (0x80004005): ORA-00972: identifier is too long
ORA-06512: at line 2
at OracleInternal.ServiceObjects.OracleConnectionImpl.VerifyExecution(Int32& cursorId, Boolean bThrowArrayBindRelatedErrors, SqlStatementType sqlStatementType, Int32 arrayBindCount, OracleException& exceptionForArrayBindDML, Boolean& hasMoreRowsInDB, Boolean bFirstIterationDone)
at OracleInternal.ServiceObjects.OracleCommandImpl.ExecuteNonQuery(String commandText, OracleParameterCollection paramColl, CommandType commandType, OracleConnectionImpl connectionImpl, Int32 longFetchSize, Int64 clientInitialLOBFS, OracleDependencyImpl orclDependencyImpl, Int64[]& scnFromExecution, OracleParameterCollection& bindByPositionParamColl, Boolean& bBindParamPresent, OracleException& exceptionForArrayBindDML, OracleConnection connection, OracleLogicalTransaction& oracleLogicalTransaction, Boolean isFromEF)
at Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteNonQuery()
at Oracle.EntityFrameworkCore.Storage.Internal.OracleRelationalCommandBuilderFactory.OracleRelationalCommandBuilder.OracleRelationalCommand.Execute(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary`2 parameterValues)
Failed executing DbCommand (38ms) [Parameters=[], CommandType='Text', CommandTimeout='0']
BEGIN
EXECUTE IMMEDIATE 'CREATE TABLE
"AbpNotifications" (
"Id" RAW(16) NOT NULL,
"CreationTime" TIMESTAMP(7) NOT NULL,
"CreatorUserId" NUMBER(19),
"Data" NCLOB,
"DataTypeName" NVARCHAR2(512),
"EntityId" NVARCHAR2(96),
"EntityTypeAssemblyQualifiedName" NVARCHAR2(512),
"EntityTypeName" NVARCHAR2(250),
"ExcludedUserIds" NCLOB,
"NotificationName" NVARCHAR2(96) NOT NULL,
"Severity" NUMBER(3) NOT NULL,
"TenantIds" NCLOB,
"UserIds" NCLOB,
CONSTRAINT "PK_AbpNotifications" PRIMARY KEY ("Id")
)';
END;
After investigating, we found the problem is because the column name is too long (EntityTypeAssemblyQualifiedName: 31 vs the limitation of Oracle 11g is 30).
Is there any suggestion to solve this issue? I know this limitation is solve from Oracle 12c but we must use Oracle 11g (even older versions as well).
I got a strange error related to this issue, don't know where and how to investigate. Hope DEV team can help! It works as usual at LOCALHOST (Vietnam time GMT+7) when developing but the DateTime is substract by 7 hours (-7 hours) when deploying to Azure (location: Southeast Asia). I've tried using DisableDateTimeNormalization (applied to the CreateOrEdit DTOs) but it did not work (there's no differences before and after changed).
Hi @ismcagdas,
About #1, I've tried several options when deploying to Azure:
ClockProvider
or DisableDateTimeNormalization
:
ClockProvider.Local
and DisableDateTimeNormalization
:
ClockProvider.Utc
and DisableDateTimeNormalization
(the same result as the 1st option)
About #2, here is the string I got from my laptop when using Option 3:
JSON.stringify(body)
What I want is: the value '15:30' is displayed in both views (CreateOrEdit and List), at any TimeZone.