Skip to content

Commit

Permalink
Partial fix for #1399 [skip-ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
Remi749 committed Jan 25, 2024
1 parent 340c034 commit 9822793
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 148 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,58 +63,58 @@ export function useToolbarItems(context: IPortfolioAggregationContext) {
() =>
[
context.props.showExcelExportButton &&
new ListMenuItem(null, strings.ExcelExportButtonLabel)
.setIcon('ExcelLogoInverse')
.setOnClick(exportToExcel)
.setDisabled(context.state.isChangingView)
.setStyle({ color: '#10793F' }),
new ListMenuItem(null, strings.ExcelExportButtonLabel)
.setIcon('ExcelLogoInverse')
.setOnClick(exportToExcel)
.setDisabled(context.state.isChangingView)
.setStyle({ color: '#10793F' }),
context.props.showViewSelector &&
new ListMenuItem(context.state.currentView?.title, strings.PortfolioViewsListName)
.setIcon(Icons.ContentView)
.setWidth('fit-content')
.setStyle({ minWidth: '145px' })
.setDisabled(context.state.isChangingView)
.setItems(
[
new ListMenuItem(strings.ListViewText)
.setIcon(AppsListRegular)
.makeCheckable({
name: 'renderMode',
value: 'list'
})
.setOnClick(() => {
context.dispatch(TOGGLE_COMPACT())
new ListMenuItem(context.state.currentView?.title, strings.PortfolioViewsListName)
.setIcon(Icons.ContentView)
.setWidth('fit-content')
.setStyle({ minWidth: '145px' })
.setDisabled(context.state.isChangingView)
.setItems(
[
new ListMenuItem(strings.ListViewText)
.setIcon(AppsListRegular)
.makeCheckable({
name: 'renderMode',
value: 'list'
})
.setOnClick(() => {
context.dispatch(TOGGLE_COMPACT())
}),
new ListMenuItem(strings.CompactViewText)
.setIcon(TextBulletListLtrRegular)
.makeCheckable({
name: 'renderMode',
value: 'compactList'
})
.setOnClick(() => {
context.dispatch(TOGGLE_COMPACT())
}),
ListMenuItemDivider,
...views,
ListMenuItemDivider,
new ListMenuItem(strings.NewViewText).setIcon(Icons.FormNew).setOnClick(() => {
context.dispatch(SET_VIEW_FORM_PANEL({ isOpen: true }))
}),
new ListMenuItem(strings.CompactViewText)
.setIcon(TextBulletListLtrRegular)
.makeCheckable({
name: 'renderMode',
value: 'compactList'
new ListMenuItem(strings.EditViewText).setIcon(Icons.Edit).setOnClick(() => {
context.dispatch(
SET_VIEW_FORM_PANEL({ isOpen: true, view: context.state.currentView })
)
})
.setOnClick(() => {
context.dispatch(TOGGLE_COMPACT())
}),
ListMenuItemDivider,
...views,
ListMenuItemDivider,
new ListMenuItem(strings.NewViewText).setIcon(Icons.FormNew).setOnClick(() => {
context.dispatch(SET_VIEW_FORM_PANEL({ isOpen: true }))
}),
new ListMenuItem(strings.EditViewText).setIcon(Icons.Edit).setOnClick(() => {
context.dispatch(
SET_VIEW_FORM_PANEL({ isOpen: true, view: context.state.currentView })
)
})
],
checkedValues
),
],
checkedValues
),
context.props.showFilters &&
new ListMenuItem(null, strings.FilterText)
.setIcon('Filter')
.setOnClick(() => {
context.dispatch(TOGGLE_FILTER_PANEL())
})
.setDisabled(context.state.isChangingView)
new ListMenuItem(null, strings.FilterText)
.setIcon('Filter')
.setOnClick(() => {
context.dispatch(TOGGLE_FILTER_PANEL())
})
.setDisabled(context.state.isChangingView)
].filter(Boolean),
[context.state, context.props]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,69 +60,72 @@ export function useToolbarItems(context: IPortfolioOverviewContext) {
const menuItems = useMemo<ListMenuItem[]>(
() =>
[
new ListMenuItem(null, strings.ExcelExportButtonLabel)
.setIcon('ExcelLogoInverse')
.setOnClick(exportToExcel)
.setStyle({
color: '#10793F'
}),
new ListMenuItem(context.state.currentView?.title, strings.PortfolioViewsListName)
.setIcon(Icons.ContentView)
.setWidth('fit-content')
.setStyle({ minWidth: '145px' })
.setDisabled(context.state.isChangingView)
.setItems(
[
new ListMenuItem(strings.ListViewText)
.setIcon(Icons.AppsList)
.makeCheckable({
name: 'renderMode',
value: 'list'
})
.setOnClick(() => {
context.dispatch(TOGGLE_COMPACT())
}),
new ListMenuItem(strings.CompactViewText)
.setIcon(Icons.TextBulletList)
.makeCheckable({
name: 'renderMode',
value: 'compactList'
})
.setOnClick(() => {
context.dispatch(TOGGLE_COMPACT())
}),
ListMenuItemDivider,
...sharedViews,
ListMenuItemDivider,
ListMenuItemHeader(strings.PersonalViewsHeaderText).makeConditional(
!_.isEmpty(personalViews)
),
...personalViews,
ListMenuItemDivider,
ListMenuItemHeader(strings.ProgramsHeaderText).makeConditional(
!_.isEmpty(programViews)
),
new ListMenuItem(strings.SelectProgramText)
.setItems(programViews)
.setIcon(Icons.ChevronLeft)
.makeConditional(!_.isEmpty(programViews)),
ListMenuItemDivider.makeConditional(!_.isEmpty(programViews)),
userCanManageViews &&
new ListMenuItem(strings.NewViewText).setIcon(Icons.FormNew).setOnClick(() => {
context.dispatch(SET_VIEW_FORM_PANEL({ isOpen: true }))
}),
userCanManageViews &&
new ListMenuItem(strings.EditViewText).setIcon(Icons.Edit).setOnClick(() => {
context.dispatch(
SET_VIEW_FORM_PANEL({ isOpen: true, view: context.state.currentView })
)
})
],
checkedValues
),
new ListMenuItem(null, strings.FilterText).setIcon('Filter').setOnClick(() => {
context.dispatch(TOGGLE_FILTER_PANEL())
})
context.props.showExcelExportButton &&
new ListMenuItem(null, strings.ExcelExportButtonLabel)
.setIcon('ExcelLogoInverse')
.setOnClick(exportToExcel)
.setStyle({
color: '#10793F'
}),
new ListMenuItem(context.state.currentView?.title, strings.PortfolioViewsListName)
.setIcon(Icons.ContentView)
.setWidth('fit-content')
.setStyle({ minWidth: '145px' })
.setDisabled(context.state.isChangingView)
.setItems(
[
new ListMenuItem(strings.ListViewText)
.setIcon(Icons.AppsList)
.makeCheckable({
name: 'renderMode',
value: 'list'
})
.setOnClick(() => {
context.dispatch(TOGGLE_COMPACT())
}),
new ListMenuItem(strings.CompactViewText)
.setIcon(Icons.TextBulletList)
.makeCheckable({
name: 'renderMode',
value: 'compactList'
})
.setOnClick(() => {
context.dispatch(TOGGLE_COMPACT())
}),
ListMenuItemDivider,
...sharedViews,
ListMenuItemDivider,
ListMenuItemHeader(strings.PersonalViewsHeaderText).makeConditional(
!_.isEmpty(personalViews)
),
...personalViews,
ListMenuItemDivider,
ListMenuItemHeader(strings.ProgramsHeaderText).makeConditional(
!_.isEmpty(programViews)
),
context.props.showProgramViews &&
new ListMenuItem(strings.SelectProgramText)
.setItems(programViews)
.setIcon(Icons.ChevronLeft)
.makeConditional(!_.isEmpty(programViews)),
ListMenuItemDivider.makeConditional(!_.isEmpty(programViews)),
userCanManageViews &&
new ListMenuItem(strings.NewViewText).setIcon(Icons.FormNew).setOnClick(() => {
context.dispatch(SET_VIEW_FORM_PANEL({ isOpen: true }))
}),
userCanManageViews &&
new ListMenuItem(strings.EditViewText).setIcon(Icons.Edit).setOnClick(() => {
context.dispatch(
SET_VIEW_FORM_PANEL({ isOpen: true, view: context.state.currentView })
)
})
],
checkedValues
),
context.props.showFilters &&
new ListMenuItem(null, strings.FilterText).setIcon('Filter').setOnClick(() => {
context.dispatch(TOGGLE_FILTER_PANEL())
})
].filter(Boolean),
[context.state, context.props]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,13 @@ export default class PortfolioAggregationWebPart extends BasePortfolioWebPart<IP
groupName: strings.CommandBarGroupName,
groupFields: [
PropertyPaneToggle('showFilters', {
label: strings.ShowFiltersLabel,
label: strings.ShowFiltersLabel
}),
PropertyPaneToggle('showExcelExportButton', {
label: strings.ShowExcelExportButtonLabel,
label: strings.ShowExcelExportButtonLabel
}),
PropertyPaneToggle('showViewSelector', {
label: strings.ShowViewSelectorLabel,
label: strings.ShowViewSelectorLabel
})
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {
IPropertyPaneConfiguration,
IPropertyPaneDropdownOption,
PropertyPaneDropdown,
PropertyPaneSlider,
PropertyPaneToggle
} from '@microsoft/sp-property-pane'
import * as strings from 'PortfolioWebPartsStrings'
Expand Down Expand Up @@ -70,32 +69,23 @@ export default class PortfolioOverviewWebPart extends BasePortfolioWebPart<IPort
{
groupName: strings.CommandBarGroupName,
groupFields: [
PropertyPaneToggle('showCommandBar', {
label: strings.ShowCommandBarLabel
PropertyPaneToggle('showGroupBy', {
label: strings.ShowGroupByLabel
}),
this.properties.showCommandBar &&
PropertyPaneToggle('showGroupBy', {
label: strings.ShowGroupByLabel
}),
this.properties.showCommandBar &&
PropertyPaneToggle('showFilters', {
label: strings.ShowFiltersLabel
}),
this.properties.showCommandBar &&
PropertyPaneToggle('showExcelExportButton', {
label: strings.ShowExcelExportButtonLabel
}),
this.properties.showCommandBar &&
this.properties.showExcelExportButton &&
PropertyPaneToggle('showFilters', {
label: strings.ShowFiltersLabel
}),
PropertyPaneToggle('showExcelExportButton', {
label: strings.ShowExcelExportButtonLabel
}),
this.properties.showExcelExportButton &&
PropertyPaneToggle('includeViewNameInExcelExportFilename', {
label: strings.IncludeViewNameInExcelExportFilenameLabel
}),
this.properties.showCommandBar &&
PropertyPaneToggle('showViewSelector', {
label: strings.ShowViewSelectorLabel
}),
this.properties.showCommandBar &&
this.properties.showViewSelector &&
PropertyPaneToggle('showViewSelector', {
label: strings.ShowViewSelectorLabel
}),
this.properties.showViewSelector &&
PropertyPaneToggle('showProgramViews', {
label: strings.ShowProgramViewsLabel
})
Expand All @@ -108,17 +98,6 @@ export default class PortfolioOverviewWebPart extends BasePortfolioWebPart<IPort
label: strings.ListLayoutModeJustifiedLabel
})
]
},
{
groupName: strings.ProjectInformationGroupName,
groupFields: [
PropertyPaneSlider('statusReportsCount', {
label: strings.StatusReportsCountLabel,
min: 0,
max: 10,
step: 1
})
]
}
]
}
Expand Down

0 comments on commit 9822793

Please sign in to comment.