Skip to content

Commit

Permalink
Fix for #1332
Browse files Browse the repository at this point in the history
  • Loading branch information
Remi749 committed Dec 19, 2023
1 parent 5202093 commit 3c169f3
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,43 +30,50 @@ export function useViewFormPanel() {
GtSearchQuery: view.get('searchQuery'),
GtIconName: view.get('iconName')
}
if (isEditing) {
await context.props.dataAdapter.portalDataService.updateItemInList(
'DATA_SOURCES',
currentView.id as number,
properties
)
context.dispatch(
SET_VIEW_FORM_PANEL({
isOpen: false,
submitAction: 'edit',
view: currentView.update(properties)
})
)
} else {
properties = {
...properties,
GtProjectContentColumnsId: {
results: currentView.columnIds
},
GtProjectContentRefinersId: {
results: currentView.refinerIds
},
GtProjectContentGroupById: currentView.groupById,
GtDataSourceCategory: context.props.dataSourceCategory,
GtDataSourceLevel: {
results: [context.props.configuration?.level].filter(Boolean)
try {
if (isEditing) {
await context.props.dataAdapter.portalDataService.updateItemInList(
'DATA_SOURCES',
currentView.id as number,
properties
)
context.dispatch(
SET_VIEW_FORM_PANEL({
isOpen: false,
submitAction: 'edit',
view: currentView.update(properties)
})
)
} else {
properties = {
...properties,
GtProjectContentColumnsId: currentView.columnIds,
GtProjectContentRefinersId: currentView.refinerIds,
GtProjectContentGroupById: currentView.groupById,
GtDataSourceCategory: context.props.dataSourceCategory,
GtDataSourceLevel: [context.props.configuration?.level]
}
const newView = await context.props.dataAdapter.portalDataService.addItemToList(
'DATA_SOURCES',
properties
)

context.dispatch(
SET_VIEW_FORM_PANEL({
isOpen: false,
submitAction: 'add',
view: new DataSource(
{
...properties,
Id: newView.Id
},
currentView.columns
)
})
)
}
await context.props.dataAdapter.portalDataService.addItemToList('DATA_SOURCES', properties)
const newView = new DataSource(properties, currentView.columns)
context.dispatch(
SET_VIEW_FORM_PANEL({
isOpen: false,
submitAction: 'add',
view: newView
})
)
} catch (error) {
throw new Error(error)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,16 @@ export function useViewFormPanel() {
GtPortfolioFabricIcon: view.get('iconName')
}
if (isEditing) {
context.props.dataAdapter.portalDataService.updateItemInList(
await context.props.dataAdapter.portalDataService.updateItemInList(
'PORTFOLIO_VIEWS',
currentView.id as number,
properties
)
} else {
properties = {
...properties,
GtPortfolioColumnsId: {
results: currentView.columnIds
},
GtPortfolioRefinersId: {
results: currentView.refinerIds
},
GtPortfolioColumnsId: currentView.columnIds,
GtPortfolioRefinersId: currentView.refinerIds,
GtPortfolioGroupById: currentView.groupById,
GtPortfolioColumnOrder: JSON.stringify(currentView.columnOrder)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ export class PortfolioOverviewView {
* Configure the view from another view (copies the columns, refiners,
* groupBy, scope and searchQuery properties).
*
* @param view View to configure from
* @param view View to configure from
*/
public configureFrom(view: PortfolioOverviewView): PortfolioOverviewView {
this.columns = view.columns
Expand Down

0 comments on commit 3c169f3

Please sign in to comment.