Remove errFn from saveRepoConfig and runRepoGC

Change-Id: I57715023b0eb6b3a5d6850dd105563472131b392
This commit is contained in:
Ben Rohlfs
2020-12-03 23:05:21 +01:00
parent 5ffb08ba87
commit fdbe57387e
3 changed files with 4 additions and 31 deletions

View File

@@ -128,6 +128,7 @@ export class GrRepoCommands extends GestureEventListeners(
} }
_handleRunningGC() { _handleRunningGC() {
if (!this.repo) return;
this._runningGC = true; this._runningGC = true;
return this.restApiService return this.restApiService
.runRepoGC(this.repo) .runRepoGC(this.repo)

View File

@@ -408,19 +408,7 @@ export class GrRestApiInterface
}) as Promise<DashboardInfo[] | undefined>; }) as Promise<DashboardInfo[] | undefined>;
} }
saveRepoConfig(repo: RepoName, config: ConfigInput): Promise<Response>; saveRepoConfig(repo: RepoName, config: ConfigInput): Promise<Response> {
saveRepoConfig(
repo: RepoName,
config: ConfigInput,
errFn: ErrorCallback
): Promise<Response | undefined>;
saveRepoConfig(
repo: RepoName,
config: ConfigInput,
errFn?: ErrorCallback
): Promise<Response | undefined> {
// TODO(kaspern): Rename rest api from /projects/ to /repos/ once backend // TODO(kaspern): Rename rest api from /projects/ to /repos/ once backend
// supports it. // supports it.
const url = `/projects/${encodeURIComponent(repo)}/config`; const url = `/projects/${encodeURIComponent(repo)}/config`;
@@ -429,23 +417,11 @@ export class GrRestApiInterface
method: HttpMethod.PUT, method: HttpMethod.PUT,
url, url,
body: config, body: config,
errFn,
anonymizedUrl: '/projects/*/config', anonymizedUrl: '/projects/*/config',
}); });
} }
runRepoGC(repo: RepoName): Promise<Response>; runRepoGC(repo: RepoName): Promise<Response> {
runRepoGC(
repo: RepoName,
errFn: ErrorCallback
): Promise<Response | undefined>;
runRepoGC(repo: RepoName, errFn?: ErrorCallback) {
if (!repo) {
// TODO(TS): fix return value
return '';
}
// TODO(kaspern): Rename rest api from /projects/ to /repos/ once backend // TODO(kaspern): Rename rest api from /projects/ to /repos/ once backend
// supports it. // supports it.
const encodeName = encodeURIComponent(repo); const encodeName = encodeURIComponent(repo);
@@ -453,7 +429,6 @@ export class GrRestApiInterface
method: HttpMethod.POST, method: HttpMethod.POST,
url: `/projects/${encodeName}/gc`, url: `/projects/${encodeName}/gc`,
body: '', body: '',
errFn,
anonymizedUrl: '/projects/*/gc', anonymizedUrl: '/projects/*/gc',
}); });
} }

View File

@@ -690,10 +690,7 @@ export interface RestApiService {
includedGroup: GroupId includedGroup: GroupId
): Promise<Response>; ): Promise<Response>;
runRepoGC( runRepoGC(repo: RepoName): Promise<Response>;
repo: RepoName,
errFn?: ErrorCallback
): Promise<Response | undefined>;
getFileContent( getFileContent(
changeNum: NumericChangeId, changeNum: NumericChangeId,
path: string, path: string,