Support async notebook publishing (#275)

Handle cases for async notebook publishing. Now `Your published work` tab shows 3 sections - published, under review, and removed notebooks.

Note: The text labels are design placeholders

![image](https://user-images.githubusercontent.com/693092/95799994-3b5fb100-0cab-11eb-86fc-4ded0aeeddb1.png)
This commit is contained in:
Tanuj Mittal
2020-10-14 20:49:18 -07:00
committed by GitHub
parent 821f665e78
commit bd00e5eb9b
12 changed files with 149 additions and 39 deletions

View File

@@ -17,7 +17,9 @@ const galleryItem: IGalleryItem = {
downloads: 0,
favorites: 0,
views: 0,
newCellId: undefined
newCellId: undefined,
policyViolations: undefined,
pendingScanJobIds: undefined
};
describe("GalleryUtils", () => {

View File

@@ -323,3 +323,27 @@ export function getTabTitle(tab: GalleryTab): string {
throw new Error(`Unknown tab ${tab}`);
}
}
export function filterPublishedNotebooks(
items: IGalleryItem[]
): {
published: IGalleryItem[];
underReview: IGalleryItem[];
removed: IGalleryItem[];
} {
const underReview: IGalleryItem[] = [];
const removed: IGalleryItem[] = [];
const published: IGalleryItem[] = [];
items?.forEach(item => {
if (item.policyViolations?.length > 0) {
removed.push(item);
} else if (item.pendingScanJobIds?.length > 0) {
underReview.push(item);
} else {
published.push(item);
}
});
return { published, underReview, removed };
}