Skip to content

Commit

Permalink
113:7 error Unexpected console statement no-console
Browse files Browse the repository at this point in the history
  • Loading branch information
olemp committed Jan 17, 2025
1 parent 9650d25 commit 0d399f8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ export default class PortfolioOverviewWebPart extends BasePortfolioWebPart<IPort
public async onInit(): Promise<void> {
try {
this._selectedPortfolioId = this.properties.selectedPortfolioId
const selectedPortfolio = this.properties.portfolios.find((portfolio) => portfolio.uniqueId === this._selectedPortfolioId)
await super.onInit(selectedPortfolio)
const portfolio = this.properties.portfolios.find(({ uniqueId }) => uniqueId === this._selectedPortfolioId)
await super.onInit(portfolio)
this._configuration = await this.dataAdapter.getPortfolioConfig()
} catch (error) {
this._error = error
Expand All @@ -69,13 +69,18 @@ export default class PortfolioOverviewWebPart extends BasePortfolioWebPart<IPort

/**
* Get dropdown options for the specified `targetProperty`. For now it only
* handles the `defaultViewId` property, but in the future it could be used
* to populate other dropdowns in the property pane.
* handles the `defaultViewId` and `portfolios` properties.
*
* @param targetProperty Target property
*/
protected _getOptions(targetProperty: string): IPropertyPaneDropdownOption[] {
protected _getOptions(targetProperty: keyof IPortfolioOverviewProps): IPropertyPaneDropdownOption[] {
switch (targetProperty) {
case 'portfolios': {
return this.properties.portfolios.map((portfolio) => ({
key: portfolio.uniqueId,
text: portfolio.title
}))
}
case 'defaultViewId':
{
if (this._configuration) {
Expand Down Expand Up @@ -104,17 +109,7 @@ export default class PortfolioOverviewWebPart extends BasePortfolioWebPart<IPort
!_.isEmpty(this.properties.portfolios) && (
PropertyPaneDropdown('selectedPortfolioId', {
label: strings.SelectedPortfolioLabel,
options: this.properties.portfolios.map((portfolio) => ({
key: portfolio.uniqueId,
text: portfolio.title
})),
})
),
!_.isEmpty(this.properties.portfolios) && (
PropertyPaneToggle('showPortfolioSelector', {
label: strings.ShowPortfolioSelectorLabel,
onText: strings.ShowPortfolioSelectorOnText,
offText: strings.ShowPortfolioSelectorOffText
options: this._getOptions('portfolios')
})
),
PropertyPaneDropdown('defaultViewId', {
Expand All @@ -139,6 +134,13 @@ export default class PortfolioOverviewWebPart extends BasePortfolioWebPart<IPort
PropertyPaneToggle('includeViewNameInExcelExportFilename', {
label: strings.IncludeViewNameInExcelExportFilenameLabel
}),
!_.isEmpty(this.properties.portfolios) && (
PropertyPaneToggle('showPortfolioSelector', {
label: strings.ShowPortfolioSelectorLabel,
onText: strings.ShowPortfolioSelectorOnText,
offText: strings.ShowPortfolioSelectorOffText
})
),
PropertyPaneToggle('showViewSelector', {
label: strings.ShowViewSelectorLabel
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,7 @@ export class PortalDataService extends DataService<IPortalDataServiceConfigurati
return
}
try {
this.hubSiteId =
this._configuration.spfxContext.pageContext.legacyPageContext.hubSiteId || ''
console.log('onInit', this.hubSiteId)
this.hubSiteId = this._configuration.spfxContext.pageContext.legacyPageContext.hubSiteId || ''
try {
const hubSite = await (
await fetch(
Expand Down

0 comments on commit 0d399f8

Please sign in to comment.