Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 14af799

Browse files
committed
Cleaned up code.
1 parent 8d94315 commit 14af799

File tree

2 files changed

+19
-27
lines changed

2 files changed

+19
-27
lines changed

‎src/CodeSnippetForm.ts

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
import { Widget } from '@lumino/widgets';
33
import { RequestHandler } from '@elyra/application';
4-
//import { requestAPI } from './CodeSnippetServer';
4+
55
import checkSVGstr from '../style/check.svg';
66
import { showMessage } from './ConfirmMessage';
77

@@ -11,7 +11,6 @@ import { Contents } from '@jupyterlab/services';
1111

1212
import { JSONObject } from '@lumino/coreutils';
1313

14-
//import { JupyterFrontEnd } from '@jupyterlab/application'
1514
import {ICodeSnippet} from './CodeSnippetService'
1615

1716
import { IDocumentManager } from '@jupyterlab/docmanager';
@@ -25,7 +24,7 @@ const FILE_DIALOG_CLASS = 'jp-FileDialog';
2524
/**
2625
* The class name added for the new name label in the rename dialog
2726
*/
28-
const RENAME_NEWNAME_TITLE_CLASS = 'jp-new-name-title';
27+
const INPUT_NEWNAME_TITLE_CLASS = 'jp-new-name-title';
2928

3029
/**
3130
* A stripped-down interface for a file container.
@@ -52,7 +51,7 @@ export function inputDialog(
5251
): Promise<Contents.IModel | null> {
5352
return showDialog({
5453
title: 'Save Code Snippet',
55-
body: new RenameHandler(),
54+
body: new InputHandler(),
5655
focusNodeSelector: 'input',
5756
buttons: [Dialog.cancelButton(), Dialog.okButton({ label: 'Save' })]
5857
}).then(result => {
@@ -150,13 +149,13 @@ export function isValidFileName(name: string): boolean {
150149
/**
151150
* A widget used to get input data.
152151
*/
153-
class RenameHandler extends Widget {
152+
class InputHandler extends Widget {
154153
/**
155154
* Construct a new "rename" dialog.
156155
* readonly inputNode: HTMLInputElement; <--- in Widget class
157156
*/
158157
constructor() {
159-
super({ node: Private.createRenameNode() });
158+
super({ node: Private.createInputNode() });
160159
this.addClass(FILE_DIALOG_CLASS);
161160
}
162161

@@ -183,30 +182,30 @@ namespace Private {
183182
/**
184183
* Create the node for a rename handler. This is what's creating all of the elements to be displayed.
185184
*/
186-
export function createRenameNode(): HTMLElement {
185+
export function createInputNode(): HTMLElement {
187186
const body = document.createElement('div');
188187

189188
const nameTitle = document.createElement('label');
190189
nameTitle.textContent = 'Snippet Name*';
191-
nameTitle.className = RENAME_NEWNAME_TITLE_CLASS;
190+
nameTitle.className = INPUT_NEWNAME_TITLE_CLASS;
192191
const name = document.createElement('input');
193192

194-
const nameTitle2 = document.createElement('label');
195-
nameTitle2.textContent = 'Description*';
196-
nameTitle2.className = RENAME_NEWNAME_TITLE_CLASS;
197-
const name2 = document.createElement('input');
193+
const descriptionTitle = document.createElement('label');
194+
descriptionTitle.textContent = 'Description*';
195+
descriptionTitle.className = INPUT_NEWNAME_TITLE_CLASS;
196+
const description = document.createElement('input');
198197

199-
const nameTitle3 = document.createElement('label');
200-
nameTitle3.textContent = 'Language*';
201-
nameTitle3.className = RENAME_NEWNAME_TITLE_CLASS;
202-
const name3 = document.createElement('input');
198+
const languageTitle = document.createElement('label');
199+
languageTitle.textContent = 'Language*';
200+
languageTitle.className = INPUT_NEWNAME_TITLE_CLASS;
201+
const language = document.createElement('input');
203202

204203
body.appendChild(nameTitle);
205204
body.appendChild(name);
206-
body.appendChild(nameTitle2);
207-
body.appendChild(name2);
208-
body.appendChild(nameTitle3);
209-
body.appendChild(name3);
205+
body.appendChild(descriptionTitle);
206+
body.appendChild(description);
207+
body.appendChild(languageTitle);
208+
body.appendChild(language);
210209
return body;
211210
}
212211

‎src/index.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import '../style/index.css';
22

33
import { codeSnippetIcon } from '@elyra/ui-components';
4-
//import checkSVGstr from '../style/check.svg';
5-
// import { LabIcon } from '@jupyterlab/ui-components';
64

75
import {
86
JupyterFrontEnd,
@@ -15,11 +13,6 @@ import { ICommandPalette } from '@jupyterlab/apputils';
1513

1614
import { CodeSnippetWidget } from './CodeSnippetWidget';
1715

18-
//import { showMessage } from './ConfirmMessage';
19-
20-
21-
// import { URLExt } from '@jupyterlab/coreutils';
22-
2316

2417
import { inputDialog } from './CodeSnippetForm'
2518

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /