optional indentation guides in the compose/YAML editor
This commit is contained in:
10 files changed
+109
-15
No files matched your search
@@ -47,7 +47,7 @@ export const PUT: RequestHandler = async ({ request, cookies }) => {
|
||||
|
||||
const validActionIconSizes = ['small', 'normal', 'large', 'xlarge'];
|
||||
|
||||
const updates: { lightTheme?: string; darkTheme?: string; font?: string; fontSize?: string; gridFontSize?: string; terminalFont?: string; editorFont?: string; animateIcons?: boolean; coloredActionButtons?: boolean; actionIconSize?: string } = {};
|
||||
const updates: { lightTheme?: string; darkTheme?: string; font?: string; fontSize?: string; gridFontSize?: string; terminalFont?: string; editorFont?: string; animateIcons?: boolean; coloredActionButtons?: boolean; actionIconSize?: string; editorIndentGuides?: boolean } = {};
|
||||
|
||||
if (data.lightTheme !== undefined) {
|
||||
if (!validLightThemeIds.includes(data.lightTheme)) {
|
||||
@@ -105,6 +105,13 @@ export const PUT: RequestHandler = async ({ request, cookies }) => {
|
||||
updates.animateIcons = data.animateIcons;
|
||||
}
|
||||
|
||||
if (data.editorIndentGuides !== undefined) {
|
||||
if (typeof data.editorIndentGuides !== 'boolean') {
|
||||
return json({ error: 'Invalid editorIndentGuides' }, { status: 400 });
|
||||
}
|
||||
updates.editorIndentGuides = data.editorIndentGuides;
|
||||
}
|
||||
|
||||
if (data.coloredActionButtons !== undefined) {
|
||||
if (typeof data.coloredActionButtons !== 'boolean') {
|
||||
return json({ error: 'Invalid coloredActionButtons' }, { status: 400 });
|
||||
|
||||
@@ -117,6 +117,8 @@ export interface GeneralSettings {
|
||||
showWhatsNew: boolean;
|
||||
// Whether spinning icons (animate-spin etc.) are animated (#1169)
|
||||
animateIcons: boolean;
|
||||
// Vertical indentation guides in the code editor (#1410)
|
||||
editorIndentGuides: boolean;
|
||||
// Skip Dockhand's scanner images (grype, trivy) during 'prune all unused' (#625)
|
||||
protectScannerImages: boolean;
|
||||
// Scanner Advanced settings (#1219). Empty = use auto-detection.
|
||||
@@ -161,6 +163,7 @@ const DEFAULT_SETTINGS: Omit<GeneralSettings, 'scheduleRetentionDays' | 'eventRe
|
||||
showImageChangelogLinks: true,
|
||||
showWhatsNew: true,
|
||||
animateIcons: true,
|
||||
editorIndentGuides: false,
|
||||
protectScannerImages: true,
|
||||
defaultScannerNetworkMode: '',
|
||||
defaultScannerDns: [],
|
||||
@@ -269,6 +272,7 @@ export const GET: RequestHandler = async ({ cookies }) => {
|
||||
showImageChangelogLinks,
|
||||
showWhatsNew,
|
||||
animateIcons,
|
||||
editorIndentGuides,
|
||||
protectScannerImages,
|
||||
defaultScannerNetworkMode,
|
||||
defaultScannerDnsRaw
|
||||
@@ -319,6 +323,7 @@ export const GET: RequestHandler = async ({ cookies }) => {
|
||||
getSetting('show_image_changelog_links'),
|
||||
getSetting('show_whats_new'),
|
||||
getSetting('animate_icons'),
|
||||
getSetting('editor_indent_guides'),
|
||||
getSetting('protect_scanner_images'),
|
||||
getSetting('default_scanner_network_mode'),
|
||||
getSetting('default_scanner_dns')
|
||||
@@ -373,6 +378,7 @@ export const GET: RequestHandler = async ({ cookies }) => {
|
||||
showImageChangelogLinks: showImageChangelogLinks ?? DEFAULT_SETTINGS.showImageChangelogLinks,
|
||||
showWhatsNew: showWhatsNew ?? DEFAULT_SETTINGS.showWhatsNew,
|
||||
animateIcons: animateIcons ?? DEFAULT_SETTINGS.animateIcons,
|
||||
editorIndentGuides: editorIndentGuides ?? DEFAULT_SETTINGS.editorIndentGuides,
|
||||
protectScannerImages: protectScannerImages ?? DEFAULT_SETTINGS.protectScannerImages,
|
||||
defaultScannerNetworkMode: defaultScannerNetworkMode ?? DEFAULT_SETTINGS.defaultScannerNetworkMode,
|
||||
defaultScannerDns: parseScannerDnsStorage(defaultScannerDnsRaw)
|
||||
@@ -393,7 +399,7 @@ export const POST: RequestHandler = async ({ request, cookies }) => {
|
||||
|
||||
try {
|
||||
const body = await request.json();
|
||||
const { confirmDestructive, showStoppedContainers, highlightUpdates, coloredActionButtons, actionIconSize, timeFormat, dateFormat, downloadFormat, defaultGrypeArgs, defaultTrivyArgs, scheduleRetentionDays, eventRetentionDays, scheduleCleanupCron, eventCleanupCron, scheduleCleanupEnabled, eventCleanupEnabled, scannerCleanupCron, scannerCleanupEnabled, logBufferSizeKb, logMaxLines, defaultTimezone, eventCollectionMode, eventPollInterval, metricsCollectionInterval, lightTheme, darkTheme, font, fontSize, gridFontSize, terminalFont, editorFont, compactPorts, showExposedPorts, showGitCommitHash, formatLogTimestamps, externalStackPaths, primaryStackLocation, defaultGrypeImage, defaultTrivyImage, defaultComposeTemplate, labelFilterMode, defaultBackupImage, honorProxyLabels, showImageChangelogLinks, animateIcons, protectScannerImages, showWhatsNew, defaultScannerNetworkMode, defaultScannerDns } = body;
|
||||
const { confirmDestructive, showStoppedContainers, highlightUpdates, coloredActionButtons, actionIconSize, timeFormat, dateFormat, downloadFormat, defaultGrypeArgs, defaultTrivyArgs, scheduleRetentionDays, eventRetentionDays, scheduleCleanupCron, eventCleanupCron, scheduleCleanupEnabled, eventCleanupEnabled, scannerCleanupCron, scannerCleanupEnabled, logBufferSizeKb, logMaxLines, defaultTimezone, eventCollectionMode, eventPollInterval, metricsCollectionInterval, lightTheme, darkTheme, font, fontSize, gridFontSize, terminalFont, editorFont, compactPorts, showExposedPorts, showGitCommitHash, formatLogTimestamps, externalStackPaths, primaryStackLocation, defaultGrypeImage, defaultTrivyImage, defaultComposeTemplate, labelFilterMode, defaultBackupImage, honorProxyLabels, showImageChangelogLinks, animateIcons, editorIndentGuides, protectScannerImages, showWhatsNew, defaultScannerNetworkMode, defaultScannerDns } = body;
|
||||
|
||||
if (confirmDestructive !== undefined) {
|
||||
await setSetting('confirm_destructive', confirmDestructive);
|
||||
@@ -557,6 +563,9 @@ export const POST: RequestHandler = async ({ request, cookies }) => {
|
||||
if (animateIcons !== undefined && typeof animateIcons === 'boolean') {
|
||||
await setSetting('animate_icons', animateIcons);
|
||||
}
|
||||
if (editorIndentGuides !== undefined && typeof editorIndentGuides === 'boolean') {
|
||||
await setSetting('editor_indent_guides', editorIndentGuides);
|
||||
}
|
||||
if (protectScannerImages !== undefined && typeof protectScannerImages === 'boolean') {
|
||||
await setSetting('protect_scanner_images', protectScannerImages);
|
||||
}
|
||||
@@ -623,6 +632,7 @@ export const POST: RequestHandler = async ({ request, cookies }) => {
|
||||
showImageChangelogLinksVal,
|
||||
showWhatsNewVal,
|
||||
animateIconsVal,
|
||||
editorIndentGuidesVal,
|
||||
protectScannerImagesVal,
|
||||
defaultScannerNetworkModeVal,
|
||||
defaultScannerDnsRawVal
|
||||
@@ -673,6 +683,7 @@ export const POST: RequestHandler = async ({ request, cookies }) => {
|
||||
getSetting('show_image_changelog_links'),
|
||||
getSetting('show_whats_new'),
|
||||
getSetting('animate_icons'),
|
||||
getSetting('editor_indent_guides'),
|
||||
getSetting('protect_scanner_images'),
|
||||
getSetting('default_scanner_network_mode'),
|
||||
getSetting('default_scanner_dns')
|
||||
@@ -728,6 +739,7 @@ export const POST: RequestHandler = async ({ request, cookies }) => {
|
||||
showImageChangelogLinks: showImageChangelogLinksVal ?? DEFAULT_SETTINGS.showImageChangelogLinks,
|
||||
showWhatsNew: showWhatsNewVal ?? DEFAULT_SETTINGS.showWhatsNew,
|
||||
animateIcons: animateIconsVal ?? DEFAULT_SETTINGS.animateIcons,
|
||||
editorIndentGuides: editorIndentGuidesVal ?? DEFAULT_SETTINGS.editorIndentGuides,
|
||||
defaultScannerNetworkMode: defaultScannerNetworkModeVal ?? DEFAULT_SETTINGS.defaultScannerNetworkMode,
|
||||
defaultScannerDns: parseScannerDnsStorage(defaultScannerDnsRawVal)
|
||||
};
|
||||
|
||||
@@ -16,7 +16,8 @@ const DEFAULT_THEME_SETTINGS = {
|
||||
editorFont: 'system-mono',
|
||||
animateIcons: true,
|
||||
coloredActionButtons: false,
|
||||
actionIconSize: 'normal'
|
||||
actionIconSize: 'normal',
|
||||
editorIndentGuides: false
|
||||
};
|
||||
|
||||
export const GET: RequestHandler = async () => {
|
||||
@@ -31,7 +32,8 @@ export const GET: RequestHandler = async () => {
|
||||
editorFont,
|
||||
animateIcons,
|
||||
coloredActionButtons,
|
||||
actionIconSize
|
||||
actionIconSize,
|
||||
editorIndentGuides
|
||||
] = await Promise.all([
|
||||
getSetting('theme_light'),
|
||||
getSetting('theme_dark'),
|
||||
@@ -42,7 +44,8 @@ export const GET: RequestHandler = async () => {
|
||||
getSetting('theme_editor_font'),
|
||||
getSetting('animate_icons'),
|
||||
getSetting('colored_action_buttons'),
|
||||
getSetting('action_icon_size')
|
||||
getSetting('action_icon_size'),
|
||||
getSetting('editor_indent_guides')
|
||||
]);
|
||||
|
||||
return json({
|
||||
@@ -55,7 +58,8 @@ export const GET: RequestHandler = async () => {
|
||||
editorFont: editorFont ?? DEFAULT_THEME_SETTINGS.editorFont,
|
||||
animateIcons: animateIcons ?? DEFAULT_THEME_SETTINGS.animateIcons,
|
||||
coloredActionButtons: coloredActionButtons ?? DEFAULT_THEME_SETTINGS.coloredActionButtons,
|
||||
actionIconSize: actionIconSize ?? DEFAULT_THEME_SETTINGS.actionIconSize
|
||||
actionIconSize: actionIconSize ?? DEFAULT_THEME_SETTINGS.actionIconSize,
|
||||
editorIndentGuides: editorIndentGuides ?? DEFAULT_THEME_SETTINGS.editorIndentGuides
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Failed to get theme settings:', error);
|
||||
|
||||
Reference in new issue
Block a user