rebase rework
This commit is contained in:
@@ -147,7 +147,7 @@ export const gitService = {
|
||||
* @purpose Initializes or clones a Git repository for a dashboard.
|
||||
* @pre Dashboard must exist and config_id must be valid.
|
||||
* @post Repository is initialized on the backend.
|
||||
* @param {number} dashboardId - ID of the dashboard.
|
||||
* @param {string|number} dashboardRef - Dashboard slug or id.
|
||||
* @param {string} configId - ID of the Git config.
|
||||
* @param {string} remoteUrl - URL of the remote repository.
|
||||
* @returns {Promise<Object>} Initialization result.
|
||||
@@ -178,7 +178,7 @@ export const gitService = {
|
||||
* @purpose Retrieves the list of branches for a dashboard's repository.
|
||||
* @pre Repository must be initialized.
|
||||
* @post Returns a list of branches.
|
||||
* @param {number} dashboardId - ID of the dashboard.
|
||||
* @param {string|number} dashboardRef - Dashboard slug or id.
|
||||
* @returns {Promise<Array>} List of branches.
|
||||
*/
|
||||
async getBranches(dashboardRef, envId = null) {
|
||||
@@ -272,6 +272,77 @@ export const gitService = {
|
||||
return requestApi(buildDashboardRepoEndpoint(dashboardRef, '/pull', envId), 'POST');
|
||||
},
|
||||
|
||||
/**
|
||||
* [DEF:getMergeStatus:Function]
|
||||
* @purpose Retrieves unfinished-merge status for repository.
|
||||
* @pre Repository must exist.
|
||||
* @post Returns merge status payload.
|
||||
* @param {string|number} dashboardRef - Dashboard slug or id.
|
||||
* @returns {Promise<Object>} Merge status details.
|
||||
*/
|
||||
async getMergeStatus(dashboardRef, envId = null) {
|
||||
console.log(`[getMergeStatus][Action] Fetching merge status for dashboard ${dashboardRef}`);
|
||||
return requestApi(buildDashboardRepoEndpoint(dashboardRef, '/merge/status', envId));
|
||||
},
|
||||
|
||||
/**
|
||||
* [DEF:getMergeConflicts:Function]
|
||||
* @purpose Retrieves merge conflicts list for repository.
|
||||
* @pre Unfinished merge should be in progress.
|
||||
* @post Returns conflict files with mine/theirs previews.
|
||||
* @param {string|number} dashboardRef - Dashboard slug or id.
|
||||
* @returns {Promise<Array>} List of conflict files.
|
||||
*/
|
||||
async getMergeConflicts(dashboardRef, envId = null) {
|
||||
console.log(`[getMergeConflicts][Action] Fetching merge conflicts for dashboard ${dashboardRef}`);
|
||||
return requestApi(buildDashboardRepoEndpoint(dashboardRef, '/merge/conflicts', envId));
|
||||
},
|
||||
|
||||
/**
|
||||
* [DEF:resolveMergeConflicts:Function]
|
||||
* @purpose Applies conflict resolution strategies and stages resolved files.
|
||||
* @pre resolutions contains file_path/resolution entries.
|
||||
* @post Conflicts are resolved and staged.
|
||||
* @param {string|number} dashboardRef - Dashboard slug or id.
|
||||
* @param {Array} resolutions - Resolution entries.
|
||||
* @returns {Promise<Object>} Resolve result.
|
||||
*/
|
||||
async resolveMergeConflicts(dashboardRef, resolutions, envId = null) {
|
||||
console.log(`[resolveMergeConflicts][Action] Resolving ${Array.isArray(resolutions) ? resolutions.length : 0} conflicts for dashboard ${dashboardRef}`);
|
||||
return requestApi(buildDashboardRepoEndpoint(dashboardRef, '/merge/resolve', envId), 'POST', {
|
||||
resolutions: Array.isArray(resolutions) ? resolutions : []
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* [DEF:abortMerge:Function]
|
||||
* @purpose Aborts current unfinished merge.
|
||||
* @pre Repository exists.
|
||||
* @post Merge state is aborted or reported as absent.
|
||||
* @param {string|number} dashboardRef - Dashboard slug or id.
|
||||
* @returns {Promise<Object>} Abort operation result.
|
||||
*/
|
||||
async abortMerge(dashboardRef, envId = null) {
|
||||
console.log(`[abortMerge][Action] Aborting merge for dashboard ${dashboardRef}`);
|
||||
return requestApi(buildDashboardRepoEndpoint(dashboardRef, '/merge/abort', envId), 'POST');
|
||||
},
|
||||
|
||||
/**
|
||||
* [DEF:continueMerge:Function]
|
||||
* @purpose Finalizes unfinished merge by creating merge commit.
|
||||
* @pre All conflicts are resolved.
|
||||
* @post Merge commit is created.
|
||||
* @param {string|number} dashboardRef - Dashboard slug or id.
|
||||
* @param {string} message - Optional commit message.
|
||||
* @returns {Promise<Object>} Continue result.
|
||||
*/
|
||||
async continueMerge(dashboardRef, message = '', envId = null) {
|
||||
console.log(`[continueMerge][Action] Continuing merge for dashboard ${dashboardRef}`);
|
||||
return requestApi(buildDashboardRepoEndpoint(dashboardRef, '/merge/continue', envId), 'POST', {
|
||||
message: String(message || '').trim() || null
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* [DEF:getEnvironments:Function]
|
||||
* @purpose Retrieves available deployment environments.
|
||||
|
||||
Reference in New Issue
Block a user