Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "code-snippets",
"version": "0.1.0",
"description": "Save, reuse, and share code snippets using JupyterLab Code Snippets",
"description": "EXPERIMENTAL: Save, reuse, and share code snippets using JupyterLab Code Snippets",
"keywords": [
"jupyter",
"jupyterlab",
"jupyterlab-extension"
],
"homepage": "https://github.com/jupytercalpoly/project2.git",
"homepage": "https://github.com/jupytercalpoly/jupyterlab-code-snippets.git",
"bugs": {
"url": "https://github.com/jupytercalpoly/project2.git/issues"
"url": "https://github.com/jupytercalpoly/jupyterlab-code-snippets.git/issues"
},
"license": "BSD-3-Clause",
"author": "Jay Ahn, Kiran Pinnipati",
Expand All @@ -22,7 +22,7 @@
"style": "style/index.css",
"repository": {
"type": "git",
"url": "https://github.com/jupytercalpoly/project2.git.git"
"url": "https://github.com/jupytercalpoly/jupyterlab-code-snippets.git.git"
},
"scripts": {
"build": "jlpm run build:lib",
Expand Down
29 changes: 8 additions & 21 deletions src/CodeSnippetContentsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,27 +60,6 @@ export class CodeSnippetContentsService {
path: string,
options?: Partial<Contents.IModel>
): Promise<Contents.IModel> {
// TODO: throw an error if file exists
// if (options.type !== 'directory') {
// try {
// const myLog = new File()
// const http = new XMLHttpRequest();
// http.open('HEAD', 'api/contents/' + path, false);
// http.send();
// } catch {
// throw new Error('duplicate name');
// }
// console.log(path);
// if (http.status === 200) {
// throw new Error('duplicate name');
// }
// await fetch('api/contents/' + path).then(s => {
// console.log(s.status);
// if (s.status === 200) {
// throw new Error('duplicate name');
// }
// });
// }
const changedModel = await this.contentsManager.save(path, options);
return changedModel;
}
Expand Down Expand Up @@ -108,4 +87,12 @@ export class CodeSnippetContentsService {
async delete(path: string): Promise<void> {
await this.contentsManager.delete(path);
}

// async renameAndSave(
// oldPath: string,
// newPath: string
// ): Promise<Contents.IModel> {
// this.rename(oldPath, newPath);
// this.save(newPath);
// }
}
8 changes: 4 additions & 4 deletions src/CodeSnippetDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -551,10 +551,10 @@ export class CodeSnippetDisplay extends React.Component<
props: ICodeSnippetDisplayProps,
state: ICodeSnippetDisplayState
): ICodeSnippetDisplayState {
if (
props.codeSnippets.length !== state.codeSnippets.length &&
state.filterValue === ''
) {
console.log('udpating display!');
console.log(props);
console.log(state);
if (props.codeSnippets !== state.codeSnippets && state.filterValue === '') {
return {
codeSnippets: props.codeSnippets,
filterValue: ''
Expand Down
Loading