88, 'nbextensions/visualpython/src/pandas/common/commonPandas'
99, 'nbextensions/visualpython/src/pandas/common/pandasGenerator'
1010] , function ( requirejs , $ , vpCommon , vpConst , sb , vpFuncJS , libPandas , pdGen ) {
11- //옵션 속성
11+ //option property
1212const funcOptProp = {
1313stepCount :1
1414, funcName :"Variables"
@@ -17,74 +17,73 @@ define([
1717}
1818
1919/**
20- * html load콜백 . 고유 id 생성하여 부과하며 js 객체 클래스 생성하여 컨테이너로 전달
21- *@param {function } callback호출자(컨테이너) 의 콜백함수
20+ * html loadcallback . 고유 id 생성하여 부과하며 js 객체 클래스 생성하여 컨테이너로 전달
21+ *@param {function } callbackcontainer's callback
2222 */
2323var optionLoadCallback = function ( callback , meta ) {
24- // document.getElementsByTagName("head")[0].appendChild(link);
25- // 컨테이너에서 전달된 callback 함수가 존재하면 실행.
24+ // execute callback function if available
2625if ( typeof ( callback ) === 'function' ) {
2726var uuid = 'u' + vpCommon . getUUID ( ) ;
28- //최대 10회 중복되지 않도록 체크
27+ //maximum 10 duplication allowed
2928for ( var idx = 0 ; idx < 10 ; idx ++ ) {
30- //이미 사용중인 uuid인 경우 다시 생성
29+ // uuidcheck and re-generate
3130if ( $ ( vpConst . VP_CONTAINER_ID ) . find ( "." + uuid ) . length > 0 ) {
3231uuid = 'u' + vpCommon . getUUID ( ) ;
3332}
3433}
3534$ ( vpCommon . wrapSelector ( vpCommon . formatString ( "#{0}" , vpConst . OPTION_GREEN_ROOM ) ) ) . find ( vpCommon . formatString ( ".{0}" , vpConst . API_OPTION_PAGE ) ) . addClass ( uuid ) ;
3635
37- //옵션 객체 생성
36+ //create object
3837var varPackage = new VariablePackage ( uuid ) ;
3938varPackage . metadata = meta ;
4039
41- //옵션 속성 할당.
40+ //set option property
4241varPackage . setOptionProp ( funcOptProp ) ;
43- // html설정.
42+ // htmlsetting
4443varPackage . initHtml ( ) ;
45- callback ( varPackage ) ; // 공통 객체를 callback 인자로 전달
44+ callback ( varPackage ) ;
4645}
4746}
4847
4948/**
50- *html 로드.
51- *@param {function } callback호출자(컨테이너) 의 콜백함수
49+ *Load html
50+ *@param {function } callbackcontainer's callback
5251 */
5352var initOption = function ( callback , meta ) {
5453vpCommon . loadHtml ( vpCommon . wrapSelector ( vpCommon . formatString ( "#{0}" , vpConst . OPTION_GREEN_ROOM ) ) , "file_io/variables.html" , optionLoadCallback , callback , meta ) ;
5554}
5655
5756/**
58- *본 옵션 처리 위한 클래스
59- *@param {String } uuid고유 id
57+ *Option package
58+ *@param {String } uuidunique id
6059 */
6160var VariablePackage = function ( uuid ) {
6261this . uuid = uuid ; // Load html 영역의 uuid.
63- // pandas함수
62+ // pandasfunction
6463this . package = libPandas . _PANDAS_FUNCTION [ funcOptProp . libID ] ;
6564}
6665
6766
6867
6968/**
70- *vpFuncJS 에서 상속
69+ *Extend vpFuncJS
7170 */
7271VariablePackage . prototype = Object . create ( vpFuncJS . VpFuncJS . prototype ) ;
7372
7473/**
75- *유효성 검사
76- *@returns 유효성 검사 결과. 적합시 true
74+ *Validation
75+ *@returns true if it's valid
7776 */
7877VariablePackage . prototype . optionValidation = function ( ) {
7978return true ;
8079
81- //부모 클래스 유효성 검사 호출.
80+ //parent's validation
8281// vpFuncJS.VpFuncJS.prototype.optionValidation.apply(this);
8382}
8483
8584
8685/**
87- * html내부 binding 처리
86+ * htmlinner binding
8887 */
8988VariablePackage . prototype . initHtml = function ( ) {
9089this . showFunctionTitle ( ) ;
@@ -98,7 +97,7 @@ define([
9897}
9998
10099/**
101- *선택한 패키지명 입력
100+ *package title
102101 */
103102VariablePackage . prototype . showFunctionTitle = function ( ) {
104103$ ( this . wrapSelector ( '.vp_functionName' ) ) . text ( funcOptProp . funcName ) ;
@@ -115,43 +114,43 @@ define([
115114}
116115
117116/**
118- *Variables 조회
117+ *Search variables
119118 */
120119VariablePackage . prototype . loadVariables = function ( ) {
121120var that = this ;
122121
123- //조회가능한 변수 data type 정의 FIXME: 조회 필요한 변수 유형 추가
122+ //Searchable variable types
124123var types = [
125- // pandas객체
124+ // pandasobject
126125'DataFrame' , 'Series' , 'Index' , 'Period' , 'GroupBy' , 'Timestamp'
127- // Index하위 유형
126+ // Indextype object
128127, 'RangeIndex' , 'CategoricalIndex' , 'MultiIndex' , 'IntervalIndex' , 'DatetimeIndex' , 'TimedeltaIndex' , 'PeriodIndex' , 'Int64Index' , 'UInt64Index' , 'Float64Index'
129- // GroupBy하위 유형
128+ // GroupBytype object
130129, 'DataFrameGroupBy' , 'SeriesGroupBy'
131- // Plot관련 유형
130+ // Plottype
132131, 'Figure' , 'AxesSubplot'
133132// Numpy
134133, 'ndarray'
135- // Python변수
134+ // Pythonvariable
136135, 'str' , 'int' , 'float' , 'bool' , 'dict' , 'list' , 'tuple'
137136] ;
138137
139138var tagTable = this . wrapSelector ( '#vp_var_variableBox table' ) ;
140139
141- //변수 정보 표시
140+ //variable list table
142141var tagDetailTable = this . wrapSelector ( "#vp_varDetailTable" ) ;
143142
144143// initialize tags
145144$ ( tagTable ) . find ( 'tr:not(:first)' ) . remove ( ) ;
146145$ ( tagDetailTable ) . html ( '' ) ;
147146
148- // HTML구성
147+ // HTMLrendering
149148pdGen . vp_searchVarList ( types , function ( result ) {
150149// var jsonVars = result.replace(/'/gi, `"`);
151150// var varList = JSON.parse(jsonVars);
152151var varList = JSON . parse ( result ) ;
153152
154- //table 에 변수목록 추가
153+ //add variable list in table
155154varList . forEach ( varObj => {
156155if ( types . includes ( varObj . varType ) && varObj . varName [ 0 ] !== '_' ) {
157156var tagTr = document . createElement ( 'tr' ) ;
@@ -167,30 +166,12 @@ define([
167166$ ( tagTr ) . append ( tagTdName ) ;
168167$ ( tagTr ) . append ( tagTdType ) ;
169168
170- $ ( tagTdName ) . attr ( {
171- 'title' :'Click to copy'
172- } ) ;
173- // 변수이름 클릭 시 클립보드에 복사
174- $ ( tagTdName ) . click ( function ( ) {
175- // // 클립보드 복사 시작
176- var tempElem = document . createElement ( 'input' ) ;
177- tempElem . value = varObj . varName ;
178- document . body . appendChild ( tempElem ) ;
179-
180- tempElem . select ( ) ;
181- document . execCommand ( "copy" ) ;
182- document . body . removeChild ( tempElem ) ;
183- // 클립보드 복사 완료
184- vpCommon . renderSuccessMessage ( 'Copied!' ) ;
185- } ) ;
186-
187- // 변수 선택 시 표시
169+ // variable click
188170$ ( tagTr ) . click ( function ( ) {
189171$ ( this ) . parent ( ) . find ( 'tr' ) . removeClass ( 'selected' ) ;
190172$ ( this ) . addClass ( 'selected' ) ;
191173
192- // TEST: 변수 선택 시 변수 정보를 하단에 표시
193- // vpFuncJS.kernelExecute 에서는 callback에 msg.content["text"]를 전달해주기 때문에 따로 구현함
174+ // show variable information on clicking variable
194175Jupyter . notebook . kernel . execute (
195176varObj . varName ,
196177{
@@ -202,14 +183,14 @@ define([
202183
203184$ ( tagDetailTable ) . html ( '' ) ;
204185if ( htmlResult != undefined ) {
205- // 1. HTML태그로 구성되어 반환되는 경우
186+ // 1. HTMLtag
206187$ ( tagDetailTable ) . append ( htmlResult ) ;
207188} else if ( imgResult != undefined ) {
208- // 2.이미지 데이터가 반환되는 경우 (base64)
189+ // 2.Image data (base64)
209190var imgTag = '<img src="data:image/png;base64, ' + imgResult + '">' ;
210191$ ( tagDetailTable ) . append ( imgTag ) ;
211192} else if ( textResult != undefined ) {
212- // 3.텍스트 데이터가 반환되는 경우
193+ // 3.Text data
213194var preTag = document . createElement ( 'pre' ) ;
214195$ ( preTag ) . text ( textResult ) ;
215196$ ( tagDetailTable ) . html ( preTag ) ;
@@ -221,7 +202,6 @@ define([
221202} ,
222203{ silent :false }
223204) ;
224- // TEST: END
225205} )
226206
227207$ ( tagTable ) . append ( tagTr ) ;
@@ -231,14 +211,14 @@ define([
231211} ;
232212
233213/**
234- *코드 생성
235- *@param {boolean } exec실행여부
214+ *Generate code
215+ *@param {boolean } execdo execute
236216 */
237217VariablePackage . prototype . generateCode = function ( addCell , exec ) {
238218
239219var sbCode = new sb . StringBuilder ( ) ;
240220
241- //TODO: 변수 내용 조회
221+ //show selected variable
242222var selectedVariable = $ ( this . wrapSelector ( '#vp_var_variableBox table tr.selected' ) ) ;
243223if ( selectedVariable ) {
244224var varName = selectedVariable . attr ( 'data-var-name' ) ;