1
1
2
2
import { Widget } from '@lumino/widgets' ;
3
3
import { RequestHandler } from '@elyra/application' ;
4
- //import { requestAPI } from './CodeSnippetServer';
4
+
5
5
import checkSVGstr from '../style/check.svg' ;
6
6
import { showMessage } from './ConfirmMessage' ;
7
7
@@ -11,7 +11,6 @@ import { Contents } from '@jupyterlab/services';
11
11
12
12
import { JSONObject } from '@lumino/coreutils' ;
13
13
14
- //import { JupyterFrontEnd } from '@jupyterlab/application'
15
14
import { ICodeSnippet } from './CodeSnippetService'
16
15
17
16
import { IDocumentManager } from '@jupyterlab/docmanager' ;
@@ -25,7 +24,7 @@ const FILE_DIALOG_CLASS = 'jp-FileDialog';
25
24
/**
26
25
* The class name added for the new name label in the rename dialog
27
26
*/
28
- const RENAME_NEWNAME_TITLE_CLASS = 'jp-new-name-title' ;
27
+ const INPUT_NEWNAME_TITLE_CLASS = 'jp-new-name-title' ;
29
28
30
29
/**
31
30
* A stripped-down interface for a file container.
@@ -52,7 +51,7 @@ export function inputDialog(
52
51
) : Promise < Contents . IModel | null > {
53
52
return showDialog ( {
54
53
title : 'Save Code Snippet' ,
55
- body : new RenameHandler ( ) ,
54
+ body : new InputHandler ( ) ,
56
55
focusNodeSelector : 'input' ,
57
56
buttons : [ Dialog . cancelButton ( ) , Dialog . okButton ( { label : 'Save' } ) ]
58
57
} ) . then ( result => {
@@ -150,13 +149,13 @@ export function isValidFileName(name: string): boolean {
150
149
/**
151
150
* A widget used to get input data.
152
151
*/
153
- class RenameHandler extends Widget {
152
+ class InputHandler extends Widget {
154
153
/**
155
154
* Construct a new "rename" dialog.
156
155
* readonly inputNode: HTMLInputElement; <--- in Widget class
157
156
*/
158
157
constructor ( ) {
159
- super ( { node : Private . createRenameNode ( ) } ) ;
158
+ super ( { node : Private . createInputNode ( ) } ) ;
160
159
this . addClass ( FILE_DIALOG_CLASS ) ;
161
160
}
162
161
@@ -183,30 +182,30 @@ namespace Private {
183
182
/**
184
183
* Create the node for a rename handler. This is what's creating all of the elements to be displayed.
185
184
*/
186
- export function createRenameNode ( ) : HTMLElement {
185
+ export function createInputNode ( ) : HTMLElement {
187
186
const body = document . createElement ( 'div' ) ;
188
187
189
188
const nameTitle = document . createElement ( 'label' ) ;
190
189
nameTitle . textContent = 'Snippet Name*' ;
191
- nameTitle . className = RENAME_NEWNAME_TITLE_CLASS ;
190
+ nameTitle . className = INPUT_NEWNAME_TITLE_CLASS ;
192
191
const name = document . createElement ( 'input' ) ;
193
192
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' ) ;
198
197
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' ) ;
203
202
204
203
body . appendChild ( nameTitle ) ;
205
204
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 ) ;
210
209
return body ;
211
210
}
212
211
0 commit comments