Remove enableGallery feature flag (#68)

* Remove enableGallery feature flag

* Fix bugs

* Add tests to increase coverage

* Move favorites functionality behind feature.enableGalleryPublish flag

* Show code cells in NotebookViewer

* Use cosmos db logo as persona image for sample notebook gallery cards

* Update gallery card snapshot to fix test
This commit is contained in:
Tanuj Mittal
2020-07-06 12:10:26 -07:00
committed by GitHub
parent 27024ef75c
commit 84ea3796ec
29 changed files with 594 additions and 445 deletions

View File

@@ -2,7 +2,6 @@ import { Octokit } from "@octokit/rest";
import { HttpStatusCodes } from "../Common/Constants";
import * as Logger from "../Common/Logger";
import UrlUtility from "../Common/UrlUtility";
import { isSamplesCall, SamplesContentsQueryResponse } from "../Explorer/Notebook/NotebookSamples";
import { NotebookUtil } from "../Explorer/Notebook/NotebookUtil";
export interface IGitHubPageInfo {
@@ -225,8 +224,8 @@ export class GitHubClient {
private static readonly SelfErrorCode = 599;
private ocktokit: Octokit;
constructor(token: string, private errorCallback: (error: any) => void) {
this.initOctokit(token);
constructor(private errorCallback: (error: any) => void) {
this.initOctokit();
}
public setToken(token: string): void {
@@ -310,18 +309,13 @@ export class GitHubClient {
path?: string
): Promise<IGitHubResponse<IGitHubFile | IGitHubFile[]>> {
try {
let response: ContentsQueryResponse;
if (isSamplesCall(owner, repo, branch) && !path) {
response = SamplesContentsQueryResponse;
} else {
response = (await this.ocktokit.graphql(contentsQuery, {
owner,
repo,
ref: `refs/heads/${branch}`,
path: path || undefined,
objectExpression: `refs/heads/${branch}:${path || ""}`
} as ContentsQueryParams)) as ContentsQueryResponse;
}
const response = (await this.ocktokit.graphql(contentsQuery, {
owner,
repo,
ref: `refs/heads/${branch}`,
path: path || undefined,
objectExpression: `refs/heads/${branch}:${path || ""}`
} as ContentsQueryParams)) as ContentsQueryResponse;
let data: IGitHubFile | IGitHubFile[];
const entries = response.repository.object.entries;
@@ -495,7 +489,7 @@ export class GitHubClient {
return { status: response.status, data: <string>(<unknown>response.data) };
}
private async initOctokit(token: string) {
private async initOctokit(token?: string) {
this.ocktokit = new Octokit({
auth: token,
log: {