Disable reset to default when custom tab or widget (#19814)
## Context "Reset to default" action is rejected by the backend for custom entities because there is no "default" concept for them ## Implementation Grey out the Reset to default action on record page-layout tabs and widgets when the entity either has no applicationId yet (unsaved draft — previously slipped through the existing check), or belongs to the workspace custom application. <img width="926" height="370" alt="Screenshot 2026-04-17 at 18 50 31" src="https://github.com/user-attachments/assets/c7c163f4-17a6-4b69-a66d-90f9085d27a2" />
This commit is contained in:
@@ -11,6 +11,7 @@ describe('addWidgetToTab', () => {
|
||||
const mockWidget: PageLayoutWidget = {
|
||||
__typename: 'PageLayoutWidget',
|
||||
id: 'widget-1',
|
||||
applicationId: '',
|
||||
isActive: true,
|
||||
pageLayoutTabId: 'tab-1',
|
||||
title: 'Test Widget',
|
||||
|
||||
+2
@@ -12,6 +12,7 @@ describe('convertLayoutsToWidgets', () => {
|
||||
const mockWidgets: PageLayoutWidget[] = [
|
||||
{
|
||||
id: 'widget-1',
|
||||
applicationId: '',
|
||||
isActive: true,
|
||||
pageLayoutTabId: 'tab-1',
|
||||
title: 'Widget 1',
|
||||
@@ -35,6 +36,7 @@ describe('convertLayoutsToWidgets', () => {
|
||||
},
|
||||
{
|
||||
id: 'widget-2',
|
||||
applicationId: '',
|
||||
isActive: true,
|
||||
pageLayoutTabId: 'tab-1',
|
||||
title: 'Widget 2',
|
||||
|
||||
+3
@@ -28,6 +28,7 @@ describe('convertPageLayoutToTabLayouts', () => {
|
||||
{
|
||||
__typename: 'PageLayoutWidget',
|
||||
id: 'widget-1',
|
||||
applicationId: '',
|
||||
isActive: true,
|
||||
pageLayoutTabId: 'tab-1',
|
||||
title: 'Widget 1',
|
||||
@@ -47,6 +48,7 @@ describe('convertPageLayoutToTabLayouts', () => {
|
||||
{
|
||||
__typename: 'PageLayoutWidget',
|
||||
id: 'widget-2',
|
||||
applicationId: '',
|
||||
isActive: true,
|
||||
pageLayoutTabId: 'tab-1',
|
||||
title: 'Widget 2',
|
||||
@@ -110,6 +112,7 @@ describe('convertPageLayoutToTabLayouts', () => {
|
||||
{
|
||||
__typename: 'PageLayoutWidget',
|
||||
id: 'rich-text-widget',
|
||||
applicationId: '',
|
||||
isActive: true,
|
||||
pageLayoutTabId: 'tab-1',
|
||||
title: 'Rich Text',
|
||||
|
||||
+1
@@ -23,6 +23,7 @@ const createMockWidget = (
|
||||
},
|
||||
): PageLayoutWidget => ({
|
||||
id: 'widget-1',
|
||||
applicationId: '',
|
||||
isActive: true,
|
||||
type: WidgetType.GRAPH,
|
||||
title: 'Test',
|
||||
|
||||
+1
@@ -12,6 +12,7 @@ describe('filterVisibleWidgets', () => {
|
||||
): PageLayoutTab['widgets'][0] => ({
|
||||
__typename: 'PageLayoutWidget',
|
||||
id,
|
||||
applicationId: '',
|
||||
isActive: true,
|
||||
pageLayoutTabId: 'tab-1',
|
||||
title: `Widget ${id}`,
|
||||
|
||||
+1
@@ -12,6 +12,7 @@ describe('getTabsWithVisibleWidgets', () => {
|
||||
): PageLayoutTab['widgets'][0] => ({
|
||||
__typename: 'PageLayoutWidget',
|
||||
id,
|
||||
applicationId: '',
|
||||
isActive: true,
|
||||
pageLayoutTabId: 'tab-1',
|
||||
title: `Widget ${id}`,
|
||||
|
||||
+1
@@ -10,6 +10,7 @@ import {
|
||||
describe('prepareGridLayoutItemsWithPlaceholders', () => {
|
||||
const createMockWidget = (id: string): PageLayoutWidget => ({
|
||||
id,
|
||||
applicationId: '',
|
||||
isActive: true,
|
||||
pageLayoutTabId: 'tab-1',
|
||||
title: `Test Widget ${id}`,
|
||||
|
||||
+3
@@ -20,6 +20,7 @@ describe('removeWidgetFromTab', () => {
|
||||
{
|
||||
__typename: 'PageLayoutWidget' as const,
|
||||
id: 'widget-1',
|
||||
applicationId: '',
|
||||
isActive: true,
|
||||
pageLayoutTabId: 'tab-1',
|
||||
title: 'Widget 1',
|
||||
@@ -39,6 +40,7 @@ describe('removeWidgetFromTab', () => {
|
||||
{
|
||||
__typename: 'PageLayoutWidget' as const,
|
||||
id: 'widget-2',
|
||||
applicationId: '',
|
||||
isActive: true,
|
||||
pageLayoutTabId: 'tab-1',
|
||||
title: 'Widget 2',
|
||||
@@ -73,6 +75,7 @@ describe('removeWidgetFromTab', () => {
|
||||
{
|
||||
__typename: 'PageLayoutWidget' as const,
|
||||
id: 'widget-3',
|
||||
applicationId: '',
|
||||
isActive: true,
|
||||
pageLayoutTabId: 'tab-2',
|
||||
title: 'Widget 3',
|
||||
|
||||
@@ -26,6 +26,7 @@ export const createDefaultFieldWidget = ({
|
||||
return {
|
||||
__typename: 'PageLayoutWidget',
|
||||
id,
|
||||
applicationId: '',
|
||||
pageLayoutTabId,
|
||||
title,
|
||||
isActive: true,
|
||||
|
||||
@@ -21,6 +21,7 @@ export const createDefaultFieldsWidget = ({
|
||||
return {
|
||||
__typename: 'PageLayoutWidget',
|
||||
id,
|
||||
applicationId: '',
|
||||
pageLayoutTabId,
|
||||
title: 'Fields',
|
||||
isActive: true,
|
||||
|
||||
+1
@@ -16,6 +16,7 @@ export const createDefaultFrontComponentWidget = (
|
||||
return {
|
||||
__typename: 'PageLayoutWidget',
|
||||
id,
|
||||
applicationId: '',
|
||||
pageLayoutTabId,
|
||||
title,
|
||||
isActive: true,
|
||||
|
||||
@@ -70,6 +70,7 @@ export const createDefaultGraphWidget = ({
|
||||
return {
|
||||
__typename: 'PageLayoutWidget',
|
||||
id,
|
||||
applicationId: '',
|
||||
pageLayoutTabId,
|
||||
title,
|
||||
isActive: true,
|
||||
|
||||
@@ -17,6 +17,7 @@ export const createDefaultIframeWidget = (
|
||||
return {
|
||||
__typename: 'PageLayoutWidget',
|
||||
id,
|
||||
applicationId: '',
|
||||
pageLayoutTabId,
|
||||
title,
|
||||
isActive: true,
|
||||
|
||||
@@ -22,6 +22,7 @@ export const createDefaultRecordTableWidget = ({
|
||||
return {
|
||||
__typename: 'PageLayoutWidget',
|
||||
id,
|
||||
applicationId: '',
|
||||
pageLayoutTabId,
|
||||
title,
|
||||
isActive: true,
|
||||
|
||||
+1
@@ -17,6 +17,7 @@ export const createDefaultStandaloneRichTextWidget = (
|
||||
return {
|
||||
__typename: 'PageLayoutWidget',
|
||||
id,
|
||||
applicationId: '',
|
||||
pageLayoutTabId,
|
||||
title: 'Untitled Rich Text',
|
||||
isActive: true,
|
||||
|
||||
@@ -16,6 +16,7 @@ const getRelationFieldWidgetToInsert = (
|
||||
): PageLayoutWidget => ({
|
||||
__typename: 'PageLayoutWidget' as const,
|
||||
id: `${DYNAMIC_RELATION_WIDGET_ID_PREFIX}${field.id}-${field.label}`,
|
||||
applicationId: '',
|
||||
pageLayoutTabId: tabId,
|
||||
title: field.label,
|
||||
isActive: true,
|
||||
|
||||
Reference in New Issue
Block a user