diff --git a/apps/desktop/src/components/editor/EditorSettingsDialog.vue b/apps/desktop/src/components/editor/EditorSettingsDialog.vue index a1d826559f..51d4d9ddc6 100644 --- a/apps/desktop/src/components/editor/EditorSettingsDialog.vue +++ b/apps/desktop/src/components/editor/EditorSettingsDialog.vue @@ -779,6 +779,7 @@ const editRegexMaxMatchCount = ref(settingsStore.editorSettings.regexMaxMatchCou const editAutoCalculateTotalRows = ref(settingsStore.editorSettings.autoCalculateTotalRows); const editFlatteningMultiLineText = ref(settingsStore.editorSettings.flatteningMultiLineText); const editDataGridShowWhitespace = ref(settingsStore.editorSettings.dataGridShowWhitespace); +const editModelGenerationTemplates = ref(settingsStore.editorSettings.modelGenerationTemplates.map((template) => ({ ...template }))); const editTableColumnTemplateRows = ref(tableColumnTemplateRowsFromSettings(settingsStore.editorSettings.tableColumnTemplateFields)); const editTableColumnTemplateDatabaseType = ref(TABLE_COLUMN_TEMPLATE_DATABASE_TYPES[0] ?? "mysql"); const editSqlVariableSubstitutionEnabled = ref(settingsStore.editorSettings.sqlVariableSubstitutionEnabled); @@ -1134,6 +1135,7 @@ function currentEditorSettingsDraft(): EditorSettingsDraft { dataGridZebraRowBg: editDataGridZebraRowBg.value, flatteningMultiLineText: editFlatteningMultiLineText.value, dataGridShowWhitespace: editDataGridShowWhitespace.value, + modelGenerationTemplates: editModelGenerationTemplates.value, pageSize: editPageSize.value, tableOpenPageSize: editTableOpenPageSize.value, tableOpenSortMode: editTableOpenSortMode.value, @@ -1815,6 +1817,7 @@ function syncEditorSettingsDraftFromStore() { editDataGridZebraRowBg.value = settingsStore.editorSettings.dataGridZebraRowBg; editFlatteningMultiLineText.value = settingsStore.editorSettings.flatteningMultiLineText; editDataGridShowWhitespace.value = settingsStore.editorSettings.dataGridShowWhitespace; + editModelGenerationTemplates.value = settingsStore.editorSettings.modelGenerationTemplates.map((template) => ({ ...template })); editPageSize.value = settingsStore.editorSettings.pageSize; editTableOpenPageSize.value = settingsStore.editorSettings.tableOpenPageSize; editTableOpenSortMode.value = settingsStore.editorSettings.tableOpenSortMode; @@ -2046,6 +2049,7 @@ const editorSettingsDraftRefs: EditorSettingsDraftRefMap = { defaultTransactionMode: editDefaultTransactionMode, keepExplicitTransactionInAutoCommit: editKeepExplicitTransactionInAutoCommit, tableColumnTemplateFields: editTableColumnTemplateRows, + modelGenerationTemplates: editModelGenerationTemplates, }; function applyEditorSettingsKeysToRefs(draft: EditorSettingsDraft, keys: readonly EditorSettingsDraftKey[]) { @@ -2053,6 +2057,7 @@ function applyEditorSettingsKeysToRefs(draft: EditorSettingsDraft, keys: readonl customThemes: (value) => [...(value as CustomTheme[])], dataGridTypeColorSchemes: (value) => cloneDataGridTypeColorSchemes(value as DataGridTypeColorScheme[]), tableColumnTemplateFields: (value) => tableColumnTemplateRowsFromSettings(value as string[]), + modelGenerationTemplates: (value) => (value as EditorSettings["modelGenerationTemplates"]).map((template) => ({ ...template })), shortcuts: (value) => normalizeShortcutSettings(value as Parameters[0]), sqlFormatter: (value) => normalizeSqlFormatterSettings(value as SqlFormatterSettings), sidebarHiddenTablePrefixes: (value) => (value as string[]).join("\n"), @@ -2564,6 +2569,7 @@ function resetDefaultsForTab(tab: SettingsCategory) { editDataGridZebraRowBg.value = DEFAULT_EDITOR_SETTINGS.dataGridZebraRowBg; editFlatteningMultiLineText.value = DEFAULT_EDITOR_SETTINGS.flatteningMultiLineText; editDataGridShowWhitespace.value = DEFAULT_EDITOR_SETTINGS.dataGridShowWhitespace; + editModelGenerationTemplates.value = DEFAULT_EDITOR_SETTINGS.modelGenerationTemplates.map((template) => ({ ...template })); editPageSize.value = DEFAULT_EDITOR_SETTINGS.pageSize; editTableOpenPageSize.value = DEFAULT_EDITOR_SETTINGS.tableOpenPageSize; editTableOpenSortMode.value = DEFAULT_EDITOR_SETTINGS.tableOpenSortMode; @@ -2687,6 +2693,7 @@ function resetAllDefaults() { editDataGridZebraRowBg.value = DEFAULT_EDITOR_SETTINGS.dataGridZebraRowBg; editFlatteningMultiLineText.value = DEFAULT_EDITOR_SETTINGS.flatteningMultiLineText; editDataGridShowWhitespace.value = DEFAULT_EDITOR_SETTINGS.dataGridShowWhitespace; + editModelGenerationTemplates.value = DEFAULT_EDITOR_SETTINGS.modelGenerationTemplates.map((template) => ({ ...template })); editPageSize.value = DEFAULT_EDITOR_SETTINGS.pageSize; editTableOpenPageSize.value = DEFAULT_EDITOR_SETTINGS.tableOpenPageSize; editTableOpenSortMode.value = DEFAULT_EDITOR_SETTINGS.tableOpenSortMode; diff --git a/apps/desktop/src/components/generate/ModelGenerateDialog.vue b/apps/desktop/src/components/generate/ModelGenerateDialog.vue new file mode 100644 index 0000000000..e1f0d233d3 --- /dev/null +++ b/apps/desktop/src/components/generate/ModelGenerateDialog.vue @@ -0,0 +1,277 @@ + + +