File tree Expand file tree Collapse file tree 4 files changed +14
-1
lines changed Expand file tree Collapse file tree 4 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -471,6 +471,15 @@ export default class ConfigValidator implements IConfigValidator {
471471 errors . push ( `Resource "${ res . resourceId } " column "${ col . name } " has foreignResource resourceId which is not in resources: "${ col . foreignResource . resourceId } ".
472472 ${ similar ? `Did you mean "${ similar } " instead of "${ col . foreignResource . resourceId } "?` : '' } ` ) ;
473473 }
474+
475+ if ( col . foreignResource . unsetLabel ) {
476+ if ( typeof col . foreignResource . unsetLabel !== 'string' ) {
477+ errors . push ( `Resource "${ res . resourceId } " column "${ col . name } " has foreignResource unsetLabel which is not a string` ) ;
478+ }
479+ } else {
480+ // set default unset label
481+ col . foreignResource . unsetLabel = 'Unset' ;
482+ }
474483 const befHook = col . foreignResource . hooks ?. dropdownList ?. beforeDatasourceRequest ;
475484 if ( befHook ) {
476485 if ( ! Array . isArray ( befHook ) ) {
Original file line number Diff line number Diff line change @@ -515,6 +515,9 @@ export default class AdminForthRestAPI implements IAdminForthRestAPI {
515515 if ( col . editingNote ?. edit ) {
516516 col . editingNote . edit = await tr ( col . editingNote . edit , `resource.${ resource . resourceId } .editingNote.edit` ) ;
517517 }
518+ if ( col . foreignResource ?. unsetLabel ) {
519+ col . foreignResource . unsetLabel = await tr ( col . foreignResource . unsetLabel , `resource.${ resource . resourceId } .foreignResource.unsetLabel` ) ;
520+ }
518521
519522 return {
520523 ...col ,
Original file line number Diff line number Diff line change @@ -263,7 +263,7 @@ const columnOptions = computedAsync(async () => {
263263 },
264264 });
265265
266- if (! column .required [props .source ]) list .items .push ({ value: null , label: t ( ' Unset ' ) });
266+ if (! column .required [props .source ]) list .items .push ({ value: null , label: column . foreignResource . unsetLabel });
267267
268268 return { [column .name ]: list .items };
269269 }
Original file line number Diff line number Diff line change @@ -543,6 +543,7 @@ export type ShowInResolved = {
543543
544544export interface AdminForthForeignResourceCommon {
545545 resourceId : string ,
546+ unsetLabel ?: string ,
546547}
547548
548549/**
You can’t perform that action at this time.
0 commit comments