Your example appears to be for a later version of asp.net zero angular/core than I have (6.9.0), but it got me pointed in the right direction.
Turns out I just needed to modify app-ui-customization-service.ts to auto expand the item I wanted (the "Process" menu):
getSideBarMenuItemClass(item, isMenuActive) {
let menuCssClass = 'm-menu__item';
if (item.items.length) {
menuCssClass += ' m-menu__item--submenu';
//expand process menu by default
if (item.name == 'Process') {
//set expanded, but not active
menuCssClass += ' m-menu__item--open m-menu__item--expanded';
}
}
if (isMenuActive) {
menuCssClass += ' m-menu__item--open m-menu__item--expanded m-menu__item--active';
}
return menuCssClass;
}
Referenced by side-bar-menu-component.html:
<ng-template #mMenuItem let-item="item" let-parentItem="parentItem">
<li *ngIf="showMenuItem(item)"
class="{{ui.getSideBarMenuItemClass(item, isMenuItemIsActive(item))}}"
aria-haspopup="true"
[attr.m-menu-submenu-toggle]="ui.getItemAttrSubmenuToggle(item, parentItem)"
>
Thanks!
Hi - thanks - do you have an example you can provide?
Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.
How can I auto-expand a left menu item by default at login time?
Thanks @ismcagdas. I read through the GH issue and am wondering about role mapping. I have several roles defined in the system with varied permissions and cannot have a generic default role that all O365 AD authenticated users map to. i.e. I need to be able to create the user in the system with classic authentication, assign classic roles to that user, then at auth time using O365 AD map the user back to that classic user and the assigned roles. How can we make this happen?
Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.
How can I iplement O365 Azure AD authentication with Zero v6.9.0 angular/core? I unfortunately don't have the option to upgrade Zero version at this point, but can manually replace modules if possible. Please advise as to best method/approach and resources here.
HTML:
<button (click)="exportToExcelTransactions()" class="btn btn-outline-success"> <i class="fa fa-file-excel"></i> {{l("ExportToExcel")}} </button>
Here is the API-side method:
public async Task<FileDto> GetJournalVoucherTransactionsToExcel(GetAllJournalVoucherTransactionsForExcelInput input)
{
var filteredJournalVoucherTransactions = _journalVoucherTransactionRepository.GetAll()
.WhereIf(!string.IsNullOrWhiteSpace(input.Filter), e => false || e.CostpointProjectCode.Contains(input.Filter) || e.CostpointAccountNumber.Contains(input.Filter) || e.AccountAbbreviation.Contains(input.Filter) || e.CostpointOrganizationCode.Contains(input.Filter) || e.TransactionDescription.Contains(input.Filter) || e.TransactionNotes.Contains(input.Filter) || e.CostpointEmployeeNumber.Contains(input.Filter) || e.ProblemCodes.Contains(input.Filter) || e.TransactionState.Contains(input.Filter))
.WhereIf(input.MinLineNumberFilter != null, e => e.LineNumber >= input.MinLineNumberFilter)
.WhereIf(input.MaxLineNumberFilter != null, e => e.LineNumber <= input.MaxLineNumberFilter)
.WhereIf(!string.IsNullOrWhiteSpace(input.CostpointProjectCodeFilter), e => e.CostpointProjectCode.ToLower() == input.CostpointProjectCodeFilter.ToLower().Trim())
.WhereIf(!string.IsNullOrWhiteSpace(input.CostpointAccountNumberFilter), e => e.CostpointAccountNumber.ToLower() == input.CostpointAccountNumberFilter.ToLower().Trim())
.WhereIf(!string.IsNullOrWhiteSpace(input.AccountAbbreviationFilter), e => e.AccountAbbreviation.ToLower() == input.AccountAbbreviationFilter.ToLower().Trim())
.WhereIf(!string.IsNullOrWhiteSpace(input.CostpointOrganizationCodeFilter), e => e.CostpointOrganizationCode.ToLower() == input.CostpointOrganizationCodeFilter.ToLower().Trim())
.WhereIf(input.MinTransactionAmountUSDFilter != null, e => e.TransactionAmountUSD >= input.MinTransactionAmountUSDFilter)
.WhereIf(input.MaxTransactionAmountUSDFilter != null, e => e.TransactionAmountUSD <= input.MaxTransactionAmountUSDFilter)
.WhereIf(!string.IsNullOrWhiteSpace(input.TransactionDescriptionFilter), e => e.TransactionDescription.ToLower() == input.TransactionDescriptionFilter.ToLower().Trim())
.WhereIf(!string.IsNullOrWhiteSpace(input.TransactionNotesFilter), e => e.TransactionNotes.ToLower() == input.TransactionNotesFilter.ToLower().Trim())
.WhereIf(!string.IsNullOrWhiteSpace(input.CostpointEmployeeNumberFilter), e => e.CostpointEmployeeNumber.ToLower() == input.CostpointEmployeeNumberFilter.ToLower().Trim())
.WhereIf(input.MinHoursFilter != null, e => e.Hours >= input.MinHoursFilter)
.WhereIf(input.MaxHoursFilter != null, e => e.Hours <= input.MaxHoursFilter)
.WhereIf(!string.IsNullOrWhiteSpace(input.ProblemCodesFilter), e => e.ProblemCodes.ToLower() == input.ProblemCodesFilter.ToLower().Trim())
.WhereIf(input.MinJournalVoucherIDFilter != null, e => e.JournalVoucherID >= input.MinJournalVoucherIDFilter)
.WhereIf(input.MaxJournalVoucherIDFilter != null, e => e.JournalVoucherID <= input.MaxJournalVoucherIDFilter)
.WhereIf(!string.IsNullOrWhiteSpace(input.TransactionStateFilter), e => e.TransactionState.ToLower() == input.TransactionStateFilter.ToLower().Trim());
var query = (from o in filteredJournalVoucherTransactions
select new GetJournalVoucherTransactionForViewDto() {
JournalVoucherTransaction = new JournalVoucherTransactionDto
{
LineNumber = o.LineNumber,
CostpointProjectCode = o.CostpointProjectCode,
CostpointAccountNumber = o.CostpointAccountNumber,
AccountAbbreviation = o.AccountAbbreviation,
CostpointOrganizationCode = o.CostpointOrganizationCode,
TransactionAmountUSD = o.TransactionAmountUSD,
TransactionDescription = o.TransactionDescription,
TransactionNotes = o.TransactionNotes,
CostpointEmployeeNumber = o.CostpointEmployeeNumber,
Hours = o.Hours,
ProblemCodes = o.ProblemCodes,
JournalVoucherID = o.JournalVoucherID,
TransactionState = o.TransactionState,
Id = o.Id
}
});
var journalVoucherTransactionListDtos = await query.ToListAsync();
return _journalVoucherTransactionsExcelExporter.ExportToFile(journalVoucherTransactionListDtos);
}
Here is the angular call:
async exportToExcelTransactions() {
//inform user
this.notify.info(this.l('Excel file generation initiated...'));
//changed this to wait for result instead of using subscribe -
//will hopefully solve problem of downloaded files sometimes being empty.
var resultFile = await this._journalVoucherTransactionsServiceProxy.getJournalVoucherTransactionsToExcel(
this.filterText,
this.maxLineNumberFilter == null ? this.maxLineNumberFilterEmpty: this.maxLineNumberFilter,
this.minLineNumberFilter == null ? this.minLineNumberFilterEmpty: this.minLineNumberFilter,
this.costpointProjectCodeFilter,
this.costpointAccountNumberFilter,
this.accountAbbreviationFilter,
this.costpointOrganizationCodeFilter,
this.maxTransactionAmountUSDFilter == null ? this.maxTransactionAmountUSDFilterEmpty: this.maxTransactionAmountUSDFilter,
this.minTransactionAmountUSDFilter == null ? this.minTransactionAmountUSDFilterEmpty: this.minTransactionAmountUSDFilter,
this.transactionDescriptionFilter,
this.transactionNotesFilter,
this.costpointEmployeeNumberFilter,
this.maxHoursFilter == null ? this.maxHoursFilterEmpty: this.maxHoursFilter,
this.minHoursFilter == null ? this.minHoursFilterEmpty: this.minHoursFilter,
this.problemCodesFilter,
this.journalVoucherIdFilter == null ? this.maxJournalVoucherIDFilterEmpty: this.journalVoucherIdFilter,
this.journalVoucherIdFilter == null ? this.minJournalVoucherIDFilterEmpty: this.journalVoucherIdFilter,
this.transactionStateFilter
).toPromise();
//wait a couple secs before downloading
await this.delay(4000); //4 seconds
//inform user
this.notify.success(this.l('Excel file download starting...'));
//download Excel file
this._fileDownloadService.downloadTempFile(resultFile);
//return promise to notify caller
return new Promise(resolve => {
resolve(resultFile);
});
}
And this is the HTML:
<button
(click)="exportToExcelTransactions()"
class="btn btn-outline-success">
<i class="fa fa-file-excel"></i> {{l("ExportToExcel")}}
</button>
If the user requests hard refresh of page in Chrome (CTRL + F5), the file downloads completely, otherwise in normal usage, many users are consistently only receiving the header row in the downloaded spreadsheet.
Thoughts?
Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.
Using the standard generated methods for exporting a grid to Excel, my users are frequently finding when they open the Excel file, it only contains the heading. What might be the cause here and how can I make the full file download consistently?
That seemed to do the trick - thanks!
For v6.9.0.0: The build date or release date that displays in the site footer - internal var releaseDate does not consistentlly update and is rarely correct. It seems to just randomly update. Most of the time I can go multiple days with multiple builds (dev AND --prod) and the releaseDate does not update. How can I get this to update consistently and correctly?
Cheers