Replace ProjectName type to RepoName
Also UrlEncodedProjectName to UrlEncodedRepoName Change-Id: I5cdeec59aa3f1463f9afd3a2bd4730cb6a4e4eb9
This commit is contained in:
		@@ -27,7 +27,7 @@ import {htmlTemplate} from './gr-create-pointer-dialog_html';
 | 
			
		||||
import {encodeURL, getBaseUrl} from '../../../utils/url-util';
 | 
			
		||||
import {page} from '../../../utils/page-wrapper-utils';
 | 
			
		||||
import {customElement, property, observe} from '@polymer/decorators';
 | 
			
		||||
import {BranchName, ProjectName} from '../../../types/common';
 | 
			
		||||
import {BranchName, RepoName} from '../../../types/common';
 | 
			
		||||
import {RestApiService} from '../../../services/services/gr-rest-api/gr-rest-api';
 | 
			
		||||
 | 
			
		||||
enum DetailType {
 | 
			
		||||
@@ -53,7 +53,7 @@ export class GrCreatePointerDialog extends GestureEventListeners(
 | 
			
		||||
  detailType?: string;
 | 
			
		||||
 | 
			
		||||
  @property({type: String})
 | 
			
		||||
  repoName?: ProjectName;
 | 
			
		||||
  repoName?: RepoName;
 | 
			
		||||
 | 
			
		||||
  @property({type: Boolean, notify: true})
 | 
			
		||||
  hasNewItemName = false;
 | 
			
		||||
 
 | 
			
		||||
@@ -25,7 +25,7 @@ import {PolymerElement} from '@polymer/polymer/polymer-element';
 | 
			
		||||
import {htmlTemplate} from './gr-repo-header_html';
 | 
			
		||||
import {GerritNav} from '../../core/gr-navigation/gr-navigation';
 | 
			
		||||
import {customElement, property} from '@polymer/decorators';
 | 
			
		||||
import {ProjectName} from '../../../types/common';
 | 
			
		||||
import {RepoName} from '../../../types/common';
 | 
			
		||||
 | 
			
		||||
/** @extends PolymerElement */
 | 
			
		||||
@customElement('gr-repo-header')
 | 
			
		||||
@@ -42,7 +42,7 @@ class GrRepoHeader extends GestureEventListeners(
 | 
			
		||||
  @property({type: String})
 | 
			
		||||
  _repoUrl: string | null = null;
 | 
			
		||||
 | 
			
		||||
  _repoChanged(repoName: ProjectName) {
 | 
			
		||||
  _repoChanged(repoName: RepoName) {
 | 
			
		||||
    if (!repoName) {
 | 
			
		||||
      this._repoUrl = null;
 | 
			
		||||
      return;
 | 
			
		||||
 
 | 
			
		||||
@@ -18,7 +18,7 @@ import {
 | 
			
		||||
  BranchName,
 | 
			
		||||
  ChangeInfo,
 | 
			
		||||
  PatchSetNum,
 | 
			
		||||
  ProjectName,
 | 
			
		||||
  RepoName,
 | 
			
		||||
  TopicName,
 | 
			
		||||
  GroupId,
 | 
			
		||||
  DashboardId,
 | 
			
		||||
@@ -230,7 +230,7 @@ export interface GenerateUrlSearchViewParameters {
 | 
			
		||||
  view: GerritView.SEARCH;
 | 
			
		||||
  query?: string;
 | 
			
		||||
  offset?: number;
 | 
			
		||||
  project?: ProjectName;
 | 
			
		||||
  project?: RepoName;
 | 
			
		||||
  branch?: BranchName;
 | 
			
		||||
  topic?: TopicName;
 | 
			
		||||
  // TODO(TS): Define more precise type (enum?)
 | 
			
		||||
@@ -244,7 +244,7 @@ export interface GenerateUrlChangeViewParameters {
 | 
			
		||||
  view: GerritView.CHANGE;
 | 
			
		||||
  // TODO(TS): NumericChangeId - not sure about it, may be it can be removeds
 | 
			
		||||
  changeNum: NumericChangeId | LegacyChangeId;
 | 
			
		||||
  project: ProjectName;
 | 
			
		||||
  project: RepoName;
 | 
			
		||||
  patchNum?: PatchSetNum;
 | 
			
		||||
  basePatchNum?: PatchSetNum;
 | 
			
		||||
  edit?: boolean;
 | 
			
		||||
@@ -254,14 +254,14 @@ export interface GenerateUrlChangeViewParameters {
 | 
			
		||||
 | 
			
		||||
export interface GenerateUrlRepoViewParameters {
 | 
			
		||||
  view: GerritView.REPO;
 | 
			
		||||
  repoName: ProjectName;
 | 
			
		||||
  repoName: RepoName;
 | 
			
		||||
  detail?: RepoDetailView;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface GenerateUrlDashboardViewParameters {
 | 
			
		||||
  view: GerritView.DASHBOARD;
 | 
			
		||||
  user?: string;
 | 
			
		||||
  repo?: ProjectName;
 | 
			
		||||
  repo?: RepoName;
 | 
			
		||||
  dashboard?: DashboardId;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -274,7 +274,7 @@ export interface GenerateUrlGroupViewParameters {
 | 
			
		||||
export interface GenerateUrlEditViewParameters {
 | 
			
		||||
  view: GerritView.EDIT;
 | 
			
		||||
  changeNum: NumericChangeId | LegacyChangeId;
 | 
			
		||||
  project: ProjectName;
 | 
			
		||||
  project: RepoName;
 | 
			
		||||
  path: string;
 | 
			
		||||
  patchNum: PatchSetNum;
 | 
			
		||||
  lineNum?: number;
 | 
			
		||||
@@ -291,7 +291,7 @@ export interface GenerateUrlSettingsViewParameters {
 | 
			
		||||
export interface GenerateUrlDiffViewParameters {
 | 
			
		||||
  view: GerritView.DIFF;
 | 
			
		||||
  changeNum: NumericChangeId | LegacyChangeId;
 | 
			
		||||
  project: ProjectName;
 | 
			
		||||
  project: RepoName;
 | 
			
		||||
  path?: string;
 | 
			
		||||
  patchNum?: PatchSetNum;
 | 
			
		||||
  basePatchNum?: PatchSetNum | ParentPatchSetNum;
 | 
			
		||||
@@ -313,14 +313,14 @@ export type GenerateUrlParameters =
 | 
			
		||||
 | 
			
		||||
export interface GenerateWebLinksPatchsetParameters {
 | 
			
		||||
  type: WeblinkType.PATCHSET;
 | 
			
		||||
  repo: ProjectName;
 | 
			
		||||
  repo: RepoName;
 | 
			
		||||
  commit: CommitId;
 | 
			
		||||
  // TODO(TS): provide better typing
 | 
			
		||||
  options?: unknown;
 | 
			
		||||
}
 | 
			
		||||
export interface GenerateWebLinksFileParameters {
 | 
			
		||||
  type: WeblinkType.FILE;
 | 
			
		||||
  repo: ProjectName;
 | 
			
		||||
  repo: RepoName;
 | 
			
		||||
  commit: CommitId;
 | 
			
		||||
  file: string;
 | 
			
		||||
  // TODO(TS): provide better typing
 | 
			
		||||
@@ -328,7 +328,7 @@ export interface GenerateWebLinksFileParameters {
 | 
			
		||||
}
 | 
			
		||||
export interface GenerateWebLinksChangeParameters {
 | 
			
		||||
  type: WeblinkType.CHANGE;
 | 
			
		||||
  repo: ProjectName;
 | 
			
		||||
  repo: RepoName;
 | 
			
		||||
  commit: CommitId;
 | 
			
		||||
  // TODO(TS): provide better typing
 | 
			
		||||
  options?: unknown;
 | 
			
		||||
@@ -479,7 +479,7 @@ export const GerritNav = {
 | 
			
		||||
   * @param host The host in which to search.
 | 
			
		||||
   */
 | 
			
		||||
  getUrlForProjectChanges(
 | 
			
		||||
    project: ProjectName,
 | 
			
		||||
    project: RepoName,
 | 
			
		||||
    openOnly?: boolean,
 | 
			
		||||
    host?: string
 | 
			
		||||
  ) {
 | 
			
		||||
@@ -497,7 +497,7 @@ export const GerritNav = {
 | 
			
		||||
   */
 | 
			
		||||
  getUrlForBranch(
 | 
			
		||||
    branch: BranchName,
 | 
			
		||||
    project: ProjectName,
 | 
			
		||||
    project: RepoName,
 | 
			
		||||
    status?: string,
 | 
			
		||||
    host?: string
 | 
			
		||||
  ) {
 | 
			
		||||
@@ -589,7 +589,7 @@ export const GerritNav = {
 | 
			
		||||
 | 
			
		||||
  getUrlForChangeById(
 | 
			
		||||
    changeNum: NumericChangeId,
 | 
			
		||||
    project: ProjectName,
 | 
			
		||||
    project: RepoName,
 | 
			
		||||
    patchNum?: PatchSetNum
 | 
			
		||||
  ) {
 | 
			
		||||
    return this._getUrlFor({
 | 
			
		||||
@@ -642,7 +642,7 @@ export const GerritNav = {
 | 
			
		||||
 | 
			
		||||
  getUrlForComment(
 | 
			
		||||
    changeNum: NumericChangeId | LegacyChangeId,
 | 
			
		||||
    project: ProjectName,
 | 
			
		||||
    project: RepoName,
 | 
			
		||||
    commentId: UrlEncodedCommentId
 | 
			
		||||
  ) {
 | 
			
		||||
    return this._getUrlFor({
 | 
			
		||||
@@ -658,7 +658,7 @@ export const GerritNav = {
 | 
			
		||||
   */
 | 
			
		||||
  getUrlForDiffById(
 | 
			
		||||
    changeNum: NumericChangeId | LegacyChangeId,
 | 
			
		||||
    project: ProjectName,
 | 
			
		||||
    project: RepoName,
 | 
			
		||||
    filePath: string,
 | 
			
		||||
    patchNum?: PatchSetNum,
 | 
			
		||||
    basePatchNum?: PatchSetNum | ParentPatchSetNum,
 | 
			
		||||
@@ -704,7 +704,7 @@ export const GerritNav = {
 | 
			
		||||
   */
 | 
			
		||||
  getEditUrlForDiffById(
 | 
			
		||||
    changeNum: NumericChangeId | LegacyChangeId,
 | 
			
		||||
    project: ProjectName,
 | 
			
		||||
    project: RepoName,
 | 
			
		||||
    filePath: string,
 | 
			
		||||
    patchNum?: PatchSetNum,
 | 
			
		||||
    lineNum?: number
 | 
			
		||||
@@ -763,7 +763,7 @@ export const GerritNav = {
 | 
			
		||||
   * @param repo The name of the repo.
 | 
			
		||||
   * @param dashboard The ID of the dashboard, in the form of '<ref>:<path>'.
 | 
			
		||||
   */
 | 
			
		||||
  getUrlForRepoDashboard(repo: ProjectName, dashboard: DashboardId) {
 | 
			
		||||
  getUrlForRepoDashboard(repo: RepoName, dashboard: DashboardId) {
 | 
			
		||||
    return this._getUrlFor({
 | 
			
		||||
      view: GerritView.DASHBOARD,
 | 
			
		||||
      repo,
 | 
			
		||||
@@ -781,7 +781,7 @@ export const GerritNav = {
 | 
			
		||||
    this._navigate(relativeUrl);
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  getUrlForRepo(repoName: ProjectName) {
 | 
			
		||||
  getUrlForRepo(repoName: RepoName) {
 | 
			
		||||
    return this._getUrlFor({
 | 
			
		||||
      view: GerritView.REPO,
 | 
			
		||||
      repoName,
 | 
			
		||||
@@ -791,11 +791,11 @@ export const GerritNav = {
 | 
			
		||||
  /**
 | 
			
		||||
   * Navigate to a repo settings page.
 | 
			
		||||
   */
 | 
			
		||||
  navigateToRepo(repoName: ProjectName) {
 | 
			
		||||
  navigateToRepo(repoName: RepoName) {
 | 
			
		||||
    this._navigate(this.getUrlForRepo(repoName));
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  getUrlForRepoTags(repoName: ProjectName) {
 | 
			
		||||
  getUrlForRepoTags(repoName: RepoName) {
 | 
			
		||||
    return this._getUrlFor({
 | 
			
		||||
      view: GerritView.REPO,
 | 
			
		||||
      repoName,
 | 
			
		||||
@@ -803,7 +803,7 @@ export const GerritNav = {
 | 
			
		||||
    });
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  getUrlForRepoBranches(repoName: ProjectName) {
 | 
			
		||||
  getUrlForRepoBranches(repoName: RepoName) {
 | 
			
		||||
    return this._getUrlFor({
 | 
			
		||||
      view: GerritView.REPO,
 | 
			
		||||
      repoName,
 | 
			
		||||
@@ -811,7 +811,7 @@ export const GerritNav = {
 | 
			
		||||
    });
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  getUrlForRepoAccess(repoName: ProjectName) {
 | 
			
		||||
  getUrlForRepoAccess(repoName: RepoName) {
 | 
			
		||||
    return this._getUrlFor({
 | 
			
		||||
      view: GerritView.REPO,
 | 
			
		||||
      repoName,
 | 
			
		||||
@@ -819,7 +819,7 @@ export const GerritNav = {
 | 
			
		||||
    });
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  getUrlForRepoCommands(repoName: ProjectName) {
 | 
			
		||||
  getUrlForRepoCommands(repoName: RepoName) {
 | 
			
		||||
    return this._getUrlFor({
 | 
			
		||||
      view: GerritView.REPO,
 | 
			
		||||
      repoName,
 | 
			
		||||
@@ -827,7 +827,7 @@ export const GerritNav = {
 | 
			
		||||
    });
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  getUrlForRepoDashboards(repoName: ProjectName) {
 | 
			
		||||
  getUrlForRepoDashboards(repoName: RepoName) {
 | 
			
		||||
    return this._getUrlFor({
 | 
			
		||||
      view: GerritView.REPO,
 | 
			
		||||
      repoName,
 | 
			
		||||
@@ -863,7 +863,7 @@ export const GerritNav = {
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  getFileWebLinks(
 | 
			
		||||
    repo: ProjectName,
 | 
			
		||||
    repo: RepoName,
 | 
			
		||||
    commit: CommitId,
 | 
			
		||||
    file: string,
 | 
			
		||||
    options?: unknown
 | 
			
		||||
@@ -881,7 +881,7 @@ export const GerritNav = {
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  getPatchSetWeblink(
 | 
			
		||||
    repo: ProjectName,
 | 
			
		||||
    repo: RepoName,
 | 
			
		||||
    commit: CommitId,
 | 
			
		||||
    options?: unknown
 | 
			
		||||
  ): WebLink {
 | 
			
		||||
@@ -905,7 +905,7 @@ export const GerritNav = {
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  getChangeWeblinks(
 | 
			
		||||
    repo: ProjectName,
 | 
			
		||||
    repo: RepoName,
 | 
			
		||||
    commit: CommitId,
 | 
			
		||||
    options?: unknown
 | 
			
		||||
  ): WebLink[] {
 | 
			
		||||
 
 | 
			
		||||
@@ -100,7 +100,7 @@ import {
 | 
			
		||||
  ProjectInfo,
 | 
			
		||||
  ProjectInput,
 | 
			
		||||
  ProjectWatchInfo,
 | 
			
		||||
  ProjectName,
 | 
			
		||||
  RepoName,
 | 
			
		||||
  ReviewInput,
 | 
			
		||||
  RobotCommentInfo,
 | 
			
		||||
  ServerInfo,
 | 
			
		||||
@@ -153,7 +153,7 @@ let siteBasedCache = new SiteBasedCache(); // Shared across instances.
 | 
			
		||||
let fetchPromisesCache = new FetchPromisesCache(); // Shared across instances.
 | 
			
		||||
let pendingRequest: {[promiseName: string]: Array<Promise<unknown>>} = {}; // Shared across instances.
 | 
			
		||||
let grEtagDecorator = new GrEtagDecorator(); // Shared across instances.
 | 
			
		||||
let projectLookup: {[changeNum: string]: ProjectName} = {}; // Shared across instances.
 | 
			
		||||
let projectLookup: {[changeNum: string]: RepoName} = {}; // Shared across instances.
 | 
			
		||||
 | 
			
		||||
export type ChangeNum = number; // !!!TODO: define correct types
 | 
			
		||||
 | 
			
		||||
@@ -365,7 +365,7 @@ export class GrRestApiInterface
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  getRepo(
 | 
			
		||||
    repo: ProjectName,
 | 
			
		||||
    repo: RepoName,
 | 
			
		||||
    errFn?: ErrorCallback
 | 
			
		||||
  ): Promise<ProjectInfo | undefined> {
 | 
			
		||||
    // TODO(kaspern): Rename rest api from /projects/ to /repos/ once backend
 | 
			
		||||
@@ -378,7 +378,7 @@ export class GrRestApiInterface
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  getProjectConfig(
 | 
			
		||||
    repo: ProjectName,
 | 
			
		||||
    repo: RepoName,
 | 
			
		||||
    errFn?: ErrorCallback
 | 
			
		||||
  ): Promise<ConfigInfo | undefined> {
 | 
			
		||||
    // TODO(kaspern): Rename rest api from /projects/ to /repos/ once backend
 | 
			
		||||
@@ -390,7 +390,7 @@ export class GrRestApiInterface
 | 
			
		||||
    }) as Promise<ConfigInfo | undefined>;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  getRepoAccess(repo: ProjectName): Promise<ProjectAccessInfoMap | undefined> {
 | 
			
		||||
  getRepoAccess(repo: RepoName): Promise<ProjectAccessInfoMap | undefined> {
 | 
			
		||||
    // TODO(kaspern): Rename rest api from /projects/ to /repos/ once backend
 | 
			
		||||
    // supports it.
 | 
			
		||||
    return this._fetchSharedCacheURL({
 | 
			
		||||
@@ -400,7 +400,7 @@ export class GrRestApiInterface
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  getRepoDashboards(
 | 
			
		||||
    repo: ProjectName,
 | 
			
		||||
    repo: RepoName,
 | 
			
		||||
    errFn?: ErrorCallback
 | 
			
		||||
  ): Promise<DashboardInfo[] | undefined> {
 | 
			
		||||
    // TODO(kaspern): Rename rest api from /projects/ to /repos/ once backend
 | 
			
		||||
@@ -412,16 +412,16 @@ export class GrRestApiInterface
 | 
			
		||||
    }) as Promise<DashboardInfo[] | undefined>;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  saveRepoConfig(repo: ProjectName, config: ConfigInput): Promise<Response>;
 | 
			
		||||
  saveRepoConfig(repo: RepoName, config: ConfigInput): Promise<Response>;
 | 
			
		||||
 | 
			
		||||
  saveRepoConfig(
 | 
			
		||||
    repo: ProjectName,
 | 
			
		||||
    repo: RepoName,
 | 
			
		||||
    config: ConfigInput,
 | 
			
		||||
    errFn: ErrorCallback
 | 
			
		||||
  ): Promise<Response | undefined>;
 | 
			
		||||
 | 
			
		||||
  saveRepoConfig(
 | 
			
		||||
    repo: ProjectName,
 | 
			
		||||
    repo: RepoName,
 | 
			
		||||
    config: ConfigInput,
 | 
			
		||||
    errFn?: ErrorCallback
 | 
			
		||||
  ): Promise<Response | undefined> {
 | 
			
		||||
@@ -438,14 +438,14 @@ export class GrRestApiInterface
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  runRepoGC(repo: ProjectName): Promise<Response>;
 | 
			
		||||
  runRepoGC(repo: RepoName): Promise<Response>;
 | 
			
		||||
 | 
			
		||||
  runRepoGC(
 | 
			
		||||
    repo: ProjectName,
 | 
			
		||||
    repo: RepoName,
 | 
			
		||||
    errFn: ErrorCallback
 | 
			
		||||
  ): Promise<Response | undefined>;
 | 
			
		||||
 | 
			
		||||
  runRepoGC(repo: ProjectName, errFn?: ErrorCallback) {
 | 
			
		||||
  runRepoGC(repo: RepoName, errFn?: ErrorCallback) {
 | 
			
		||||
    if (!repo) {
 | 
			
		||||
      // TODO(TS): fix return value
 | 
			
		||||
      return '';
 | 
			
		||||
@@ -462,10 +462,10 @@ export class GrRestApiInterface
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  createRepo(config: ProjectInput & {name: ProjectName}): Promise<Response>;
 | 
			
		||||
  createRepo(config: ProjectInput & {name: RepoName}): Promise<Response>;
 | 
			
		||||
 | 
			
		||||
  createRepo(
 | 
			
		||||
    config: ProjectInput & {name: ProjectName},
 | 
			
		||||
    config: ProjectInput & {name: RepoName},
 | 
			
		||||
    errFn: ErrorCallback
 | 
			
		||||
  ): Promise<Response | undefined>;
 | 
			
		||||
 | 
			
		||||
@@ -519,15 +519,15 @@ export class GrRestApiInterface
 | 
			
		||||
    }) as Promise<GroupInfo | undefined>;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  deleteRepoBranches(repo: ProjectName, ref: GitRef): Promise<Response>;
 | 
			
		||||
  deleteRepoBranches(repo: RepoName, ref: GitRef): Promise<Response>;
 | 
			
		||||
 | 
			
		||||
  deleteRepoBranches(
 | 
			
		||||
    repo: ProjectName,
 | 
			
		||||
    repo: RepoName,
 | 
			
		||||
    ref: GitRef,
 | 
			
		||||
    errFn: ErrorCallback
 | 
			
		||||
  ): Promise<Response | undefined>;
 | 
			
		||||
 | 
			
		||||
  deleteRepoBranches(repo: ProjectName, ref: GitRef, errFn?: ErrorCallback) {
 | 
			
		||||
  deleteRepoBranches(repo: RepoName, ref: GitRef, errFn?: ErrorCallback) {
 | 
			
		||||
    if (!repo || !ref) {
 | 
			
		||||
      // TODO(TS): fix return value
 | 
			
		||||
      return '';
 | 
			
		||||
@@ -545,15 +545,15 @@ export class GrRestApiInterface
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  deleteRepoTags(repo: ProjectName, ref: GitRef): Promise<Response>;
 | 
			
		||||
  deleteRepoTags(repo: RepoName, ref: GitRef): Promise<Response>;
 | 
			
		||||
 | 
			
		||||
  deleteRepoTags(
 | 
			
		||||
    repo: ProjectName,
 | 
			
		||||
    repo: RepoName,
 | 
			
		||||
    ref: GitRef,
 | 
			
		||||
    errFn: ErrorCallback
 | 
			
		||||
  ): Promise<Response | undefined>;
 | 
			
		||||
 | 
			
		||||
  deleteRepoTags(repo: ProjectName, ref: GitRef, errFn?: ErrorCallback) {
 | 
			
		||||
  deleteRepoTags(repo: RepoName, ref: GitRef, errFn?: ErrorCallback) {
 | 
			
		||||
    if (!repo || !ref) {
 | 
			
		||||
      // TODO(TS): fix return type
 | 
			
		||||
      return '';
 | 
			
		||||
@@ -572,20 +572,20 @@ export class GrRestApiInterface
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  createRepoBranch(
 | 
			
		||||
    name: ProjectName,
 | 
			
		||||
    name: RepoName,
 | 
			
		||||
    branch: BranchName,
 | 
			
		||||
    revision: BranchInput
 | 
			
		||||
  ): Promise<Response>;
 | 
			
		||||
 | 
			
		||||
  createRepoBranch(
 | 
			
		||||
    name: ProjectName,
 | 
			
		||||
    name: RepoName,
 | 
			
		||||
    branch: BranchName,
 | 
			
		||||
    revision: BranchInput,
 | 
			
		||||
    errFn: ErrorCallback
 | 
			
		||||
  ): Promise<Response | undefined>;
 | 
			
		||||
 | 
			
		||||
  createRepoBranch(
 | 
			
		||||
    name: ProjectName,
 | 
			
		||||
    name: RepoName,
 | 
			
		||||
    branch: BranchName,
 | 
			
		||||
    revision: BranchInput,
 | 
			
		||||
    errFn?: ErrorCallback
 | 
			
		||||
@@ -608,20 +608,20 @@ export class GrRestApiInterface
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  createRepoTag(
 | 
			
		||||
    name: ProjectName,
 | 
			
		||||
    name: RepoName,
 | 
			
		||||
    tag: string,
 | 
			
		||||
    revision: TagInput
 | 
			
		||||
  ): Promise<Response>;
 | 
			
		||||
 | 
			
		||||
  createRepoTag(
 | 
			
		||||
    name: ProjectName,
 | 
			
		||||
    name: RepoName,
 | 
			
		||||
    tag: string,
 | 
			
		||||
    revision: TagInput,
 | 
			
		||||
    errFn: ErrorCallback
 | 
			
		||||
  ): Promise<Response | undefined>;
 | 
			
		||||
 | 
			
		||||
  createRepoTag(
 | 
			
		||||
    name: ProjectName,
 | 
			
		||||
    name: RepoName,
 | 
			
		||||
    tag: string,
 | 
			
		||||
    revision: TagInput,
 | 
			
		||||
    errFn?: ErrorCallback
 | 
			
		||||
@@ -1742,7 +1742,7 @@ export class GrRestApiInterface
 | 
			
		||||
    }) as Promise<ProjectInfo | undefined>;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  setRepoHead(repo: ProjectName, ref: GitRef) {
 | 
			
		||||
  setRepoHead(repo: RepoName, ref: GitRef) {
 | 
			
		||||
    // TODO(kaspern): Rename rest api from /projects/ to /repos/ once backend
 | 
			
		||||
    // supports it.
 | 
			
		||||
    return this._restApiHelper.send({
 | 
			
		||||
@@ -1755,7 +1755,7 @@ export class GrRestApiInterface
 | 
			
		||||
 | 
			
		||||
  getRepoBranches(
 | 
			
		||||
    filter: string,
 | 
			
		||||
    repo: ProjectName,
 | 
			
		||||
    repo: RepoName,
 | 
			
		||||
    reposBranchesPerPage: number,
 | 
			
		||||
    offset?: number,
 | 
			
		||||
    errFn?: ErrorCallback
 | 
			
		||||
@@ -1776,7 +1776,7 @@ export class GrRestApiInterface
 | 
			
		||||
 | 
			
		||||
  getRepoTags(
 | 
			
		||||
    filter: string,
 | 
			
		||||
    repo: ProjectName,
 | 
			
		||||
    repo: RepoName,
 | 
			
		||||
    reposTagsPerPage: number,
 | 
			
		||||
    offset?: number,
 | 
			
		||||
    errFn?: ErrorCallback
 | 
			
		||||
@@ -1813,7 +1813,7 @@ export class GrRestApiInterface
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  getRepoAccessRights(repoName: ProjectName, errFn?: ErrorCallback) {
 | 
			
		||||
  getRepoAccessRights(repoName: RepoName, errFn?: ErrorCallback) {
 | 
			
		||||
    // TODO(kaspern): Rename rest api from /projects/ to /repos/ once backend
 | 
			
		||||
    // supports it.
 | 
			
		||||
    return this._restApiHelper.fetchJSON({
 | 
			
		||||
@@ -1823,7 +1823,7 @@ export class GrRestApiInterface
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  setRepoAccessRights(repoName: ProjectName, repoInfo: ProjectAccessInput) {
 | 
			
		||||
  setRepoAccessRights(repoName: RepoName, repoInfo: ProjectAccessInput) {
 | 
			
		||||
    // TODO(kaspern): Rename rest api from /projects/ to /repos/ once backend
 | 
			
		||||
    // supports it.
 | 
			
		||||
    return this._restApiHelper.send({
 | 
			
		||||
@@ -1835,7 +1835,7 @@ export class GrRestApiInterface
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  setRepoAccessRightsForReview(
 | 
			
		||||
    projectName: ProjectName,
 | 
			
		||||
    projectName: RepoName,
 | 
			
		||||
    projectInfo: ProjectAccessInput
 | 
			
		||||
  ): Promise<ChangeInfo> {
 | 
			
		||||
    return (this._restApiHelper.send({
 | 
			
		||||
@@ -1979,7 +1979,7 @@ export class GrRestApiInterface
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  getChangeCherryPicks(
 | 
			
		||||
    project: ProjectName,
 | 
			
		||||
    project: RepoName,
 | 
			
		||||
    changeID: ChangeId,
 | 
			
		||||
    changeNum: ChangeNum
 | 
			
		||||
  ) {
 | 
			
		||||
@@ -2123,7 +2123,7 @@ export class GrRestApiInterface
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  createChange(
 | 
			
		||||
    project: ProjectName,
 | 
			
		||||
    project: RepoName,
 | 
			
		||||
    branch: BranchName,
 | 
			
		||||
    subject: string,
 | 
			
		||||
    topic?: string,
 | 
			
		||||
@@ -2368,10 +2368,8 @@ export class GrRestApiInterface
 | 
			
		||||
    // alongside the change number, so resolve the project name
 | 
			
		||||
    // first.
 | 
			
		||||
    return this.getFromProjectLookup(changeNum).then(project => {
 | 
			
		||||
      const encodedProjectName = project
 | 
			
		||||
        ? encodeURIComponent(project) + '~'
 | 
			
		||||
        : '';
 | 
			
		||||
      const url = `/accounts/self/starred.changes/${encodedProjectName}${changeNum}`;
 | 
			
		||||
      const encodedRepoName = project ? encodeURIComponent(project) + '~' : '';
 | 
			
		||||
      const url = `/accounts/self/starred.changes/${encodedRepoName}${changeNum}`;
 | 
			
		||||
      return this._restApiHelper.send({
 | 
			
		||||
        method: starred ? HttpMethod.PUT : HttpMethod.DELETE,
 | 
			
		||||
        url,
 | 
			
		||||
@@ -2787,7 +2785,7 @@ export class GrRestApiInterface
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  getCommitInfo(
 | 
			
		||||
    project: ProjectName,
 | 
			
		||||
    project: RepoName,
 | 
			
		||||
    commit: CommitId
 | 
			
		||||
  ): Promise<CommitInfo | undefined> {
 | 
			
		||||
    return this._restApiHelper.fetchJSON({
 | 
			
		||||
@@ -2890,7 +2888,7 @@ export class GrRestApiInterface
 | 
			
		||||
  _changeBaseURL(
 | 
			
		||||
    changeNum: ChangeNum,
 | 
			
		||||
    patchNum?: PatchSetNum,
 | 
			
		||||
    project?: ProjectName
 | 
			
		||||
    project?: RepoName
 | 
			
		||||
  ): Promise<string> {
 | 
			
		||||
    // TODO(kaspern): For full slicer migration, app should warn with a call
 | 
			
		||||
    // stack every time _changeBaseURL is called without a project.
 | 
			
		||||
@@ -2900,7 +2898,7 @@ export class GrRestApiInterface
 | 
			
		||||
    return projectPromise.then(project => {
 | 
			
		||||
      // TODO(TS): unclear why project can't be null here. Fix it
 | 
			
		||||
      let url = `/changes/${encodeURIComponent(
 | 
			
		||||
        project as ProjectName
 | 
			
		||||
        project as RepoName
 | 
			
		||||
      )}~${changeNum}`;
 | 
			
		||||
      if (patchNum) {
 | 
			
		||||
        url += `/revisions/${patchNum}`;
 | 
			
		||||
@@ -3207,7 +3205,7 @@ export class GrRestApiInterface
 | 
			
		||||
      });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  setInProjectLookup(changeNum: ChangeNum, project: ProjectName) {
 | 
			
		||||
  setInProjectLookup(changeNum: ChangeNum, project: RepoName) {
 | 
			
		||||
    if (
 | 
			
		||||
      this._projectLookup[changeNum] &&
 | 
			
		||||
      this._projectLookup[changeNum] !== project
 | 
			
		||||
@@ -3225,7 +3223,7 @@ export class GrRestApiInterface
 | 
			
		||||
   * project. If not, calls the restAPI to get the change, populates
 | 
			
		||||
   * _projectLookup with the project for that change, and returns the project.
 | 
			
		||||
   */
 | 
			
		||||
  getFromProjectLookup(changeNum: ChangeNum): Promise<ProjectName | undefined> {
 | 
			
		||||
  getFromProjectLookup(changeNum: ChangeNum): Promise<RepoName | undefined> {
 | 
			
		||||
    const project = this._projectLookup[`${changeNum}`];
 | 
			
		||||
    if (project) {
 | 
			
		||||
      return Promise.resolve(project);
 | 
			
		||||
@@ -3420,7 +3418,7 @@ export class GrRestApiInterface
 | 
			
		||||
   * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#get-dashboard
 | 
			
		||||
   */
 | 
			
		||||
  getDashboard(
 | 
			
		||||
    project: ProjectName,
 | 
			
		||||
    project: RepoName,
 | 
			
		||||
    dashboard: DashboardId,
 | 
			
		||||
    errFn?: ErrorCallback
 | 
			
		||||
  ): Promise<DashboardInfo | undefined> {
 | 
			
		||||
 
 | 
			
		||||
@@ -31,7 +31,7 @@ import {
 | 
			
		||||
  DiffPreferencesInfo,
 | 
			
		||||
  DiffPreferenceInput,
 | 
			
		||||
  SshKeyInfo,
 | 
			
		||||
  ProjectName,
 | 
			
		||||
  RepoName,
 | 
			
		||||
  BranchName,
 | 
			
		||||
  BranchInput,
 | 
			
		||||
  TagInput,
 | 
			
		||||
@@ -177,26 +177,26 @@ export interface RestApiService {
 | 
			
		||||
  addAccountSSHKey(key: string): Promise<SshKeyInfo>;
 | 
			
		||||
 | 
			
		||||
  createRepoBranch(
 | 
			
		||||
    name: ProjectName,
 | 
			
		||||
    name: RepoName,
 | 
			
		||||
    branch: BranchName,
 | 
			
		||||
    revision: BranchInput
 | 
			
		||||
  ): Promise<Response>;
 | 
			
		||||
 | 
			
		||||
  createRepoBranch(
 | 
			
		||||
    name: ProjectName,
 | 
			
		||||
    name: RepoName,
 | 
			
		||||
    branch: BranchName,
 | 
			
		||||
    revision: BranchInput,
 | 
			
		||||
    errFn: ErrorCallback
 | 
			
		||||
  ): Promise<Response | undefined>;
 | 
			
		||||
 | 
			
		||||
  createRepoTag(
 | 
			
		||||
    name: ProjectName,
 | 
			
		||||
    name: RepoName,
 | 
			
		||||
    tag: string,
 | 
			
		||||
    revision: TagInput
 | 
			
		||||
  ): Promise<Response>;
 | 
			
		||||
 | 
			
		||||
  createRepoTag(
 | 
			
		||||
    name: ProjectName,
 | 
			
		||||
    name: RepoName,
 | 
			
		||||
    tag: string,
 | 
			
		||||
    revision: TagInput,
 | 
			
		||||
    errFn: ErrorCallback
 | 
			
		||||
 
 | 
			
		||||
@@ -63,8 +63,8 @@ export type ChangeId = BrandType<string, '_changeId'>;
 | 
			
		||||
export type ChangeMessageId = BrandType<string, '_changeMessageId'>;
 | 
			
		||||
export type LegacyChangeId = BrandType<number, '_legacyChangeId'>;
 | 
			
		||||
export type NumericChangeId = BrandType<number, '_numericChangeId'>;
 | 
			
		||||
export type ProjectName = BrandType<string, '_projectName'>;
 | 
			
		||||
export type UrlEncodedProjectName = BrandType<string, '_urlEncodedProjectName'>;
 | 
			
		||||
export type RepoName = BrandType<string, '_repoName'>;
 | 
			
		||||
export type UrlEncodedRepoName = BrandType<string, '_urlEncodedRepoName'>;
 | 
			
		||||
export type TopicName = BrandType<string, '_topicName'>;
 | 
			
		||||
// TODO(TS): Probably, we should separate AccountId and EncodedAccountId
 | 
			
		||||
export type AccountId = BrandType<number, '_accountId'>;
 | 
			
		||||
@@ -176,7 +176,7 @@ export interface ContributorAgreementInfo {
 | 
			
		||||
 */
 | 
			
		||||
export interface ChangeInfo {
 | 
			
		||||
  id: ChangeInfoId;
 | 
			
		||||
  project: ProjectName;
 | 
			
		||||
  project: RepoName;
 | 
			
		||||
  branch: BranchName;
 | 
			
		||||
  topic?: TopicName;
 | 
			
		||||
  attention_set?: IdToAttentionSetMap;
 | 
			
		||||
@@ -1025,13 +1025,13 @@ export interface CommentRange {
 | 
			
		||||
 * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#project-info
 | 
			
		||||
 */
 | 
			
		||||
export interface ProjectInfo {
 | 
			
		||||
  id: UrlEncodedProjectName;
 | 
			
		||||
  id: UrlEncodedRepoName;
 | 
			
		||||
  // name is not set if returned in a map where the project name is used as
 | 
			
		||||
  // map key
 | 
			
		||||
  name?: ProjectName;
 | 
			
		||||
  name?: RepoName;
 | 
			
		||||
  // ?-<n> if the parent project is not visible (<n> is a number which
 | 
			
		||||
  // is increased for each non-visible project).
 | 
			
		||||
  parent?: ProjectName;
 | 
			
		||||
  parent?: RepoName;
 | 
			
		||||
  description?: string;
 | 
			
		||||
  state?: ProjectState;
 | 
			
		||||
  branches?: {[branchName: string]: CommitId};
 | 
			
		||||
@@ -1356,8 +1356,8 @@ export interface PermissionRuleInfo {
 | 
			
		||||
 */
 | 
			
		||||
export interface DashboardInfo {
 | 
			
		||||
  id: DashboardId;
 | 
			
		||||
  project: ProjectName;
 | 
			
		||||
  defining_project: ProjectName;
 | 
			
		||||
  project: RepoName;
 | 
			
		||||
  defining_project: RepoName;
 | 
			
		||||
  ref: string; // The name of the ref in which the dashboard is defined, without the refs/meta/dashboards/ prefix
 | 
			
		||||
  description?: string;
 | 
			
		||||
  foreach?: string;
 | 
			
		||||
@@ -1414,8 +1414,8 @@ export type ConfigInfoCommentLinks = {
 | 
			
		||||
 * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#project-input
 | 
			
		||||
 */
 | 
			
		||||
export interface ProjectInput {
 | 
			
		||||
  name?: ProjectName;
 | 
			
		||||
  parent?: ProjectName;
 | 
			
		||||
  name?: RepoName;
 | 
			
		||||
  parent?: RepoName;
 | 
			
		||||
  description?: string;
 | 
			
		||||
  permissions_only?: boolean;
 | 
			
		||||
  create_empty_commit?: boolean;
 | 
			
		||||
@@ -1479,7 +1479,7 @@ export interface Base64FileContent {
 | 
			
		||||
 * https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#project-watch-info
 | 
			
		||||
 */
 | 
			
		||||
export interface ProjectWatchInfo {
 | 
			
		||||
  project: ProjectName;
 | 
			
		||||
  project: RepoName;
 | 
			
		||||
  filter?: string;
 | 
			
		||||
  notify_new_changes?: boolean;
 | 
			
		||||
  notify_new_patch_sets?: boolean;
 | 
			
		||||
 
 | 
			
		||||
@@ -21,7 +21,7 @@ import {
 | 
			
		||||
  GroupDetailView,
 | 
			
		||||
} from '../elements/core/gr-navigation/gr-navigation';
 | 
			
		||||
import {
 | 
			
		||||
  ProjectName,
 | 
			
		||||
  RepoName,
 | 
			
		||||
  GroupId,
 | 
			
		||||
  AccountDetailInfo,
 | 
			
		||||
  CapabilityInfo,
 | 
			
		||||
@@ -171,7 +171,7 @@ export function getGroupSubsections(
 | 
			
		||||
  return subsection;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function getRepoSubsections(repoName: ProjectName) {
 | 
			
		||||
export function getRepoSubsections(repoName: RepoName) {
 | 
			
		||||
  return {
 | 
			
		||||
    name: repoName,
 | 
			
		||||
    view: GerritNav.View.REPO,
 | 
			
		||||
@@ -220,7 +220,7 @@ export interface SubsectionInterface {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface AdminNavLinksOption {
 | 
			
		||||
  repoName?: ProjectName;
 | 
			
		||||
  repoName?: RepoName;
 | 
			
		||||
  groupId?: GroupId;
 | 
			
		||||
  groupName?: string;
 | 
			
		||||
  groupIsInternal?: boolean;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user