Skip to content

Commit 0b60d5b

Browse files
authored
feat: sunsetting legacy editor (#4908)
1 parent a59cee9 commit 0b60d5b

93 files changed

Lines changed: 344 additions & 28764 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,6 @@
297297
# LOCAL_ADAPTORS=true
298298
# OPENFN_ADAPTORS_REPO=/path/to/repo/
299299
# OPENFN_ADAPTORS_REPO=/path/to/private,/path/to/canonical
300-
#
301-
# Control whether metrics reported by the Workflow editor or Job editor are
302-
# written to the Lightning logs.
303-
# UI_METRICS_ENABLED=false
304300

305301
# ==============================================================================
306302
# <><><> WEBHOOK RETRY SETTINGS <><><>

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ and this project adheres to
4646
implicitly introduces a limit of 100 concurrent channels per Websocket
4747
connection (transport). If worker instances are set with a concurrency higher
4848
than 100, this will result in failures.
49+
- Replaced the legacy editor with the collaborative editor for all users
50+
[#4402](https://github.com/OpenFn/lightning/issues/4402)
4951

5052
### Fixed
5153

DEPLOYMENT.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,6 @@ For SMTP, the following environment variables are required:
224224
| `ADAPTORS_REGISTRY_JSON_PATH` | Path to adaptor registry file. When provided, the app will attempt to read from it then later fallback to the internet |
225225
| `SECRET_KEY_BASE` | A secret key used as a base to generate secrets for encrypting and signing data. |
226226
| `SENTRY_DSN` | If using Sentry for error monitoring, your DSN |
227-
| `UI_METRICS_ENABLED` | Enable serverside tracking of certain metrics related to the UI. This s temporary functionality. Defaults to `false`. |
228227
| `URL_HOST` | The host used for writing URLs (e.g., `demo.openfn.org`) |
229228
| `URL_PORT` | The port, usually `443` for production |
230229
| `URL_SCHEME` | The scheme for writing URLs (e.g., `https`) |

assets/css/app.css

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -942,14 +942,6 @@
942942
min-height: 4.5rem;
943943
}
944944

945-
.job-editor-panel.collapsed .close-button {
946-
@apply pb-0;
947-
}
948-
949-
.job-editor-panel.collapsed[data-editor-disabled='true'] .close-button {
950-
min-height: 3.75rem;
951-
}
952-
953945
#output-logs.collapsed .close-button {
954946
margin-bottom: 5.5rem;
955947
}

assets/js/collaborative-editor/components/CollaborativeMonaco.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { type Monaco, MonacoEditor, setTheme } from '../../monaco';
2020
import { addKeyboardShortcutOverrides } from '../../monaco/keyboard-overrides';
2121
import { useHandleDiffDismissed } from '../contexts/MonacoRefContext';
2222

23-
import createCompletionProvider from '../../editor/magic-completion';
23+
import createCompletionProvider from '../utils/magic-completion';
2424

2525
import { LoadingIndicator } from './common/LoadingIndicator';
2626
import { Cursors } from './Cursors';

assets/js/collaborative-editor/components/Header.tsx

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,10 @@ import { useCallback, useContext, useState } from 'react';
33

44
import { useURLState } from '#/react/lib/use-url-state';
55

6-
import { buildClassicalEditorUrl } from '../../utils/editorUrlConversion';
76
import * as dataclipApi from '../api/dataclips';
87
import { StoreContext } from '../contexts/StoreProvider';
9-
import { channelRequest } from '../hooks/useChannel';
108
import { getCsrfToken } from '../lib/csrf';
119
import { useActiveRun } from '../hooks/useHistory';
12-
import { useSession } from '../hooks/useSession';
1310
import {
1411
useIsNewWorkflow,
1512
useLimits,
@@ -228,7 +225,6 @@ export function Header({
228225
const isCreateWorkflowPanelCollapsed = useIsCreateWorkflowPanelCollapsed();
229226
const importPanelState = useImportPanelState();
230227
const { selectedTemplate } = useTemplatePanel();
231-
const { provider } = useSession();
232228
const limits = useLimits();
233229
const { isReadOnly } = useWorkflowReadOnly();
234230
const { hasChanges } = useUnsavedChanges();
@@ -365,25 +361,6 @@ export function Header({
365361
}
366362
}, [firstTriggerId, openRunPanel, selectNode, updateSearchParams]);
367363

368-
const handleSwitchToLegacyEditor = useCallback(async () => {
369-
if (!provider?.channel || !projectId || !workflowId) return;
370-
371-
try {
372-
await channelRequest(provider.channel, 'switch_to_legacy_editor', {});
373-
374-
// Build legacy editor URL and navigate
375-
const legacyUrl = buildClassicalEditorUrl({
376-
projectId,
377-
workflowId,
378-
searchParams: new URLSearchParams(window.location.search),
379-
isNewWorkflow,
380-
});
381-
window.location.href = legacyUrl;
382-
} catch (error) {
383-
console.error('Failed to switch to legacy editor:', error);
384-
}
385-
}, [provider, projectId, workflowId, isNewWorkflow]);
386-
387364
useKeyboardShortcut(
388365
'Control+Enter, Meta+Enter',
389366
() => {
@@ -452,26 +429,6 @@ export function Header({
452429
<div className="mx-auto sm:px-4 lg:px-4 py-6 flex items-center h-20 text-sm gap-2">
453430
<Breadcrumbs>{children}</Breadcrumbs>
454431
<ReadOnlyWarning className="ml-3" />
455-
{projectId && workflowId && (
456-
<Tooltip
457-
content={
458-
<span>
459-
Looking for the old version of the workflow builder? You can
460-
switch back for a few more days by clicking this icon. (But it
461-
will soon be retired!)
462-
</span>
463-
}
464-
side="bottom"
465-
>
466-
<button
467-
type="button"
468-
onClick={() => void handleSwitchToLegacyEditor()}
469-
className="w-6 h-6 place-self-center text-slate-500 hover:text-slate-400 cursor-pointer"
470-
>
471-
<span className="hero-question-mark-circle"></span>
472-
</button>
473-
</Tooltip>
474-
)}
475432
<ActiveCollaborators className="ml-2" />
476433
<div className="grow ml-2"></div>
477434

assets/js/collaborative-editor/hooks/useWorkflow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ export const useWorkflowActions = () => {
561561
const searchParams = new URLSearchParams(url.search);
562562
searchParams.delete('method'); // Close left panel
563563
const queryString = searchParams.toString();
564-
const newUrl = `/projects/${projectId}/w/${workflowId}/legacy${queryString ? `?${queryString}` : ''}`;
564+
const newUrl = `/projects/${projectId}/w/${workflowId}${queryString ? `?${queryString}` : ''}`;
565565
window.history.pushState({}, '', newUrl);
566566
// Mark workflow as no longer new after first save
567567
sessionContextStore.clearIsNewWorkflow();

assets/js/collaborative-editor/stores/createWorkflowStore.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,10 @@ import { produce } from 'immer';
132132
import type { Channel } from 'phoenix';
133133
import type { PhoenixChannelProvider } from 'y-phoenix-channel';
134134
import * as Y from 'yjs';
135-
import { z } from 'zod';
136135

137136
import _logger from '#/utils/logger';
138137

138+
import { DEFAULT_TEXT } from '../../workflow-store/constants';
139139
import type { WorkflowState as YAMLWorkflowState } from '../../yaml/types';
140140
import { reconcileDanglingReferences } from '../adapters/reconcileDanglingReferences';
141141
import { YAMLStateToYDoc } from '../adapters/YAMLStateToYDoc';
@@ -908,16 +908,11 @@ export const createWorkflowStore = () => {
908908
const jobsArray = ydoc.getArray('jobs');
909909
const jobMap = new Y.Map();
910910

911-
// Default body text shown in the Monaco editor for new jobs
912-
const defaultBody = `// Check out the Job Writing Guide for help getting started:
913-
// https://docs.openfn.org/documentation/jobs/job-writing-guide
914-
`;
915-
916911
ydoc.transact(() => {
917912
jobMap.set('id', job.id);
918913
jobMap.set('name', job.name);
919914
// Always initialize body as Y.Text with default if empty
920-
jobMap.set('body', new Y.Text(job.body || defaultBody));
915+
jobMap.set('body', new Y.Text(job.body || DEFAULT_TEXT));
921916
// Set adaptor field (defaults to common if not provided)
922917
jobMap.set('adaptor', job.adaptor);
923918
// Initialize credential fields to null

assets/js/editor/lib/es5.min.dts.js renamed to assets/js/collaborative-editor/utils/es5.min.dts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ export default `
77
88
// hack to remove undefined from code suggest
99
// https://github.com/microsoft/monaco-editor/issues/2018
10-
declare module undefined
10+
declare module undefined
1111
`;

assets/js/collaborative-editor/utils/loadDTS.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { fetchDTSListing, fetchFile } from '@openfn/describe-package';
22

3-
import dts_es5 from '../../editor/lib/es5.min.dts';
3+
import dts_es5 from './es5.min.dts';
44

55
export type Lib = {
66
content: string;

0 commit comments

Comments
 (0)