@@ -156,13 +156,32 @@ export class SchemaEditor {
156156 // FUTURE: Extend above types with menu of user-defined types.
157157 break ;
158158
159- case 'SchemaClassMenu' :
160- // Get the classes from the Classes tab, filtered for schema_name
161- // selected in Schema tab.
162-
163- this . getDynamicMenu ( schema , schema . classes , 'Class' , user_schema_name , permissible_values ) ;
164- console . log ( "REGENERATING CLASS MENU" , )
159+ case 'SchemaClassMenu' : {
160+ // Read directly from the live Class DH so edits on the Table tab
161+ // are reflected immediately — same pattern as SchemaMenu.
162+ // "All records" display → include all uniquely-named classes across schemas.
163+ // "Records by selected key" display → restrict to the user-selected schema (if any).
164+ const class_dh = this . context . dhs [ 'Class' ] ;
165+ if ( class_dh ) {
166+ const show_all = ( $ ( 'input[name="display-main-type"]:checked' ) . val ( ) ?? '' ) === 'all' ;
167+ const name_col = class_dh . slot_name_to_column [ 'name' ] ;
168+ const desc_col = class_dh . slot_name_to_column [ 'description' ] ;
169+ const schema_col = class_dh . slot_name_to_column [ 'schema_id' ] ;
170+ for ( let row = 0 ; row < class_dh . hot . countSourceRows ( ) ; row ++ ) {
171+ const row_schema = class_dh . hot . getSourceDataAtCell ( row , schema_col ) ;
172+ if ( ! show_all && row_schema !== user_schema_name ) continue ;
173+ const class_name = class_dh . hot . getSourceDataAtCell ( row , name_col ) ;
174+ if ( class_name && ! ( class_name in permissible_values ) ) {
175+ permissible_values [ class_name ] = {
176+ text : class_name ,
177+ title : row_schema ? `${ row_schema } - ${ class_name } ` : class_name ,
178+ description : class_dh . hot . getSourceDataAtCell ( row , desc_col ) || ''
179+ } ;
180+ }
181+ }
182+ }
165183 break ;
184+ }
166185
167186 case 'SchemaEnumMenu' :
168187 // Get the enums from the Enums tab, filtered for schema
@@ -1931,6 +1950,14 @@ export class SchemaEditor {
19311950 * a summary of what will be copied before the user confirms.
19321951 */
19331952 openCopyToSchemaModal ( sourceDh ) {
1953+ if ( sourceDh . template_name === 'Schema' ) {
1954+ dhAlert (
1955+ 'Copying whole schemas is not supported here. Only parts of a schema (tables, fields, enumerations, etc.) can be copied to another schema.\n\n' +
1956+ 'To make a visible copy of an entire schema, load it a second time from its source file — it will appear as a separate row.'
1957+ ) ;
1958+ return ;
1959+ }
1960+
19341961 // Collect unique non-empty physical rows from all selection ranges.
19351962 const selection = sourceDh . hot . getSelected ( ) || [ ] ;
19361963 const physRowSet = new Set ( ) ;
0 commit comments