mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-21 11:49:59 +00:00
feat(editor): Add version controls settings (WIP) (#6036)
* feat(editor): Version control paywall (WIP) * fix(editor): remove version control docs link * feat(editor): Adding version control settings (WIP) * feat(editor): Adding version control settings (WIP) * fix(editor): use rest api root path in version control * fix(editor): adding preferences * fix(editor): adding preferences * fix(editor): change store action name
This commit is contained in:
36
packages/editor-ui/src/api/versionControl.ts
Normal file
36
packages/editor-ui/src/api/versionControl.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import type { IRestApiContext, VersionControlPreferences } from '@/Interface';
|
||||
import { makeRestApiRequest } from '@/utils';
|
||||
import type { IDataObject } from 'n8n-workflow';
|
||||
|
||||
const versionControlApiRoot = '/version-control';
|
||||
|
||||
export const initSsh = (context: IRestApiContext, data: IDataObject): Promise<string> => {
|
||||
return makeRestApiRequest(context, 'POST', `${versionControlApiRoot}/init-ssh`, data);
|
||||
};
|
||||
|
||||
export const initRepository = (
|
||||
context: IRestApiContext,
|
||||
): Promise<{ branches: string[]; currentBranch: string }> => {
|
||||
return makeRestApiRequest(context, 'POST', `${versionControlApiRoot}/init-repository`);
|
||||
};
|
||||
|
||||
export const sync = (context: IRestApiContext, data: IDataObject): Promise<void> => {
|
||||
return makeRestApiRequest(context, 'POST', `${versionControlApiRoot}/push`, data);
|
||||
};
|
||||
|
||||
export const getConfig = (
|
||||
context: IRestApiContext,
|
||||
): Promise<{ remoteRepository: string; name: string; email: string; currentBranch: string }> => {
|
||||
return makeRestApiRequest(context, 'GET', `${versionControlApiRoot}/config`);
|
||||
};
|
||||
|
||||
export const setPreferences = (
|
||||
context: IRestApiContext,
|
||||
preferences: Partial<VersionControlPreferences>,
|
||||
): Promise<VersionControlPreferences> => {
|
||||
return makeRestApiRequest(context, 'POST', `${versionControlApiRoot}/preferences`, preferences);
|
||||
};
|
||||
|
||||
export const getPreferences = (context: IRestApiContext): Promise<VersionControlPreferences> => {
|
||||
return makeRestApiRequest(context, 'GET', `${versionControlApiRoot}/preferences`);
|
||||
};
|
||||
Reference in New Issue
Block a user