Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
-布谷鸟-
nosqlclient
提交
6fccde5f
N
nosqlclient
项目概览
-布谷鸟-
/
nosqlclient
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
nosqlclient
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
6fccde5f
编写于
1月 09, 2016
作者:
S
Sercan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
settings implemented, autocompletion setting is not working yet
上级
e47e879f
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
254 addition
and
20 deletion
+254
-20
.meteor/packages
.meteor/packages
+1
-0
.meteor/versions
.meteor/versions
+7
-0
client/common.js
client/common.js
+1
-0
client/views/common/navigation.js
client/views/common/navigation.js
+8
-4
client/views/common/page-heading.js
client/views/common/page-heading.js
+23
-6
client/views/common/top-navbar.html
client/views/common/top-navbar.html
+10
-5
client/views/pages/browse_collection.js
client/views/pages/browse_collection.js
+7
-1
client/views/pages/settings.html
client/views/pages/settings.html
+71
-0
client/views/pages/settings.js
client/views/pages/settings.js
+52
-0
lib/collections.js
lib/collections.js
+40
-1
lib/router.js
lib/router.js
+10
-3
server/internal_methods.js
server/internal_methods.js
+20
-0
server/publisher.js
server/publisher.js
+4
-0
未找到文件。
.meteor/packages
浏览文件 @
6fccde5f
...
...
@@ -27,3 +27,4 @@ meteorhacks:npm
npm-container
momentjs:moment
arch:ace-editor
aldeed:collection2
.meteor/versions
浏览文件 @
6fccde5f
aldeed:collection2@2.8.0
aldeed:collection2-core@1.0.0
aldeed:schema-deny@1.0.1
aldeed:schema-index@1.0.1
aldeed:simple-schema@1.5.3
arch:ace-editor@1.2.1
autoupdate@1.2.4
babel-compiler@5.8.24_1
...
...
@@ -45,6 +50,7 @@ launch-screen@1.0.4
less@2.5.1
livedata@1.0.15
logging@1.0.8
mdg:validation-error@0.2.0
meteor@1.1.10
meteor-base@1.0.1
meteorhacks:async@1.0.0
...
...
@@ -62,6 +68,7 @@ observe-sequence@1.0.7
okgrow:router-autoscroll@0.1.6
ordered-dict@1.0.4
promise@0.5.1
raix:eventemitter@0.1.3
random@1.0.5
reactive-dict@1.1.3
reactive-var@1.0.6
...
...
client/common.js
浏览文件 @
6fccde5f
...
...
@@ -36,6 +36,7 @@ Template.renderAfterQueryExecution = function (err, result) {
Ladda
.
stopAll
();
};
Template
.
sortObjectByKey
=
function
(
obj
)
{
var
keys
=
[];
var
sorted_obj
=
{};
...
...
client/views/common/navigation.js
浏览文件 @
6fccde5f
...
...
@@ -17,6 +17,10 @@ Template.navigation.events({
},
function
()
{
var
connection
=
Connections
.
findOne
({
_id
:
Session
.
get
(
Template
.
strSessionConnection
)});
Meteor
.
call
(
'
dropDB
'
,
connection
,
function
(
err
,
result
)
{
if
(
err
)
{
toastr
.
error
(
"
Couldn't drop database:
"
+
err
.
message
);
return
;
}
if
(
result
.
error
)
{
toastr
.
error
(
"
Couldn't drop database:
"
+
result
.
error
.
message
);
return
;
...
...
@@ -32,11 +36,11 @@ Template.navigation.events({
},
'
click #aBrowseDB
'
:
function
()
{
$
(
'
#listCollectionNames
li
'
).
each
(
function
(
index
,
li
)
{
$
(
'
#listCollectionNames
'
).
find
(
'
li
'
).
each
(
function
(
index
,
li
)
{
$
(
li
).
removeClass
(
'
active
'
);
});
$
(
'
#listSystemCollections
li
'
).
each
(
function
(
index
,
li
)
{
$
(
'
#listSystemCollections
'
).
find
(
'
li
'
).
each
(
function
(
index
,
li
)
{
$
(
li
).
removeClass
(
'
active
'
);
});
},
...
...
@@ -44,7 +48,7 @@ Template.navigation.events({
'
click .navCollection
'
:
function
()
{
var
name
=
this
.
name
;
$
(
'
#listCollectionNames
li
'
).
each
(
function
(
index
,
li
)
{
$
(
'
#listCollectionNames
'
).
find
(
'
li
'
).
each
(
function
(
index
,
li
)
{
var
liObject
=
$
(
li
);
if
(
liObject
[
0
].
innerText
.
substr
(
1
).
trim
()
==
name
)
{
liObject
.
addClass
(
'
active
'
);
...
...
@@ -54,7 +58,7 @@ Template.navigation.events({
}
});
$
(
'
#listSystemCollections
li
'
).
each
(
function
(
index
,
li
)
{
$
(
'
#listSystemCollections
'
).
find
(
'
li
'
).
each
(
function
(
index
,
li
)
{
var
liObject
=
$
(
li
);
if
(
liObject
[
0
].
innerText
.
substr
(
1
).
trim
()
==
name
)
{
liObject
.
addClass
(
'
active
'
);
...
...
client/views/common/page-heading.js
浏览文件 @
6fccde5f
...
...
@@ -3,11 +3,11 @@ Template.pageHeading.helpers({
'
home
'
:
'
browseDB
'
,
'
getCollectionInformation
'
:
function
()
{
if
(
Template
.
getParentTemplateName
(
1
)
==
'
browseDB
'
||
Session
.
get
(
Template
.
strSessionSelectedCollection
)
==
undefined
)
{
if
(
Template
.
getParentTemplateName
(
1
)
==
'
browseDB
'
||
Template
.
getParentTemplateName
(
1
)
==
'
settings
'
||
Session
.
get
(
Template
.
strSessionSelectedCollection
)
==
undefined
)
{
$
(
'
#divCollectionInfo
'
).
html
(
""
);
return
;
}
Template
.
browseCollection
.
initExecuteQuery
();
var
connection
=
Connections
.
findOne
({
_id
:
Session
.
get
(
Template
.
strSessionConnection
)});
var
selectedCollection
=
Session
.
get
(
Template
.
strSessionSelectedCollection
);
...
...
@@ -38,19 +38,36 @@ Template.pageHeading.helpers({
});
Template
.
pageHeading
.
populateCollectionInfo
=
function
(
result
)
{
var
scale
=
1024
*
1024
;
var
scale
=
1
;
var
text
=
"
Bytes
"
;
var
settings
=
Settings
.
findOne
();
switch
(
settings
.
scale
)
{
case
"
MegaBytes
"
:
scale
=
1024
*
1024
;
text
=
"
MBs
"
;
break
;
case
"
KiloBytes
"
:
scale
=
1024
;
text
=
"
KBs
"
;
break
;
default
:
scale
=
1
;
text
=
"
Bytes
"
;
break
;
}
// we are manually doing the scale to prevent showing 0 MB for sizes 0.7, 0.8, 0.9 etc. MBs as mongodb does.
var
resultString
=
"
<div class=
\"
row
\"
><div class=
\"
col-lg-7
\"
><b>Count:</b></div><div class=
\"
col-lg-5
\"
>
"
+
result
.
count
+
"
</div></div>
"
;
resultString
+=
"
<div class=
\"
row
\"
><div class=
\"
col-lg-7
\"
><b>Index Count:</b></div><div class=
\"
col-lg-5
\"
>
"
+
result
.
nindexes
+
"
</div></div>
"
;
var
size
=
isNaN
(
Number
(
result
.
size
/
scale
).
toFixed
(
2
))
?
"
0.00
"
:
Number
(
result
.
size
/
scale
).
toFixed
(
2
);
resultString
+=
"
<div class=
\"
row
\"
><div class=
\"
col-lg-7
\"
><b>Size:</b></div><div class=
\"
col-lg-5
\"
>
"
+
size
+
"
MBs
"
+
"
</div></div>
"
;
resultString
+=
"
<div class=
\"
row
\"
><div class=
\"
col-lg-7
\"
><b>Size:</b></div><div class=
\"
col-lg-5
\"
>
"
+
size
+
"
"
+
text
+
"
</div></div>
"
;
var
totalIndexSize
=
isNaN
(
Number
(
result
.
totalIndexSize
/
scale
).
toFixed
(
2
))
?
"
0.00
"
:
Number
(
result
.
totalIndexSize
/
scale
).
toFixed
(
2
);
resultString
+=
"
<div class=
\"
row
\"
><div class=
\"
col-lg-7
\"
><b>Total Index Size:</b></div><div class=
\"
col-lg-5
\"
>
"
+
totalIndexSize
+
"
MBs
"
+
"
</div></div>
"
;
resultString
+=
"
<div class=
\"
row
\"
><div class=
\"
col-lg-7
\"
><b>Total Index Size:</b></div><div class=
\"
col-lg-5
\"
>
"
+
totalIndexSize
+
"
"
+
text
+
"
</div></div>
"
;
var
avgObjSize
=
isNaN
(
Number
(
result
.
avgObjSize
/
scale
).
toFixed
(
2
))
?
"
0.00
"
:
Number
(
result
.
avgObjSize
/
scale
).
toFixed
(
2
);
resultString
+=
"
<div class=
\"
row
\"
><div class=
\"
col-lg-7
\"
><b>Average Object Size:</b></div><div class=
\"
col-lg-5
\"
>
"
+
avgObjSize
+
"
MBs
"
+
"
</div></div>
"
;
resultString
+=
"
<div class=
\"
row
\"
><div class=
\"
col-lg-7
\"
><b>Average Object Size:</b></div><div class=
\"
col-lg-5
\"
>
"
+
avgObjSize
+
"
"
+
text
+
"
</div></div>
"
;
resultString
+=
"
<div class=
\"
row
\"
><div class=
\"
col-lg-7
\"
><b>Is Capped:</b></div><div class=
\"
col-lg-5
\"
>
"
+
result
.
capped
+
"
</div></div>
"
;
$
(
'
#divCollectionInfo
'
).
html
(
resultString
);
...
...
client/views/common/top-navbar.html
浏览文件 @
6fccde5f
...
...
@@ -4,7 +4,7 @@
<div
class=
"navbar-header"
>
<a
id=
"navbar-minimalize"
class=
"minimalize-styl-2 btn btn-primary "
href=
"#"
><i
class=
"fa fa-bars"
></i>
</a>
<form
role=
"search"
class=
"navbar-form-custom"
action=
"search_results"
>
<form
role=
"search"
class=
"navbar-form-custom"
>
<div
class=
"form-group"
>
<input
type=
"text"
placeholder=
"Search for something..."
class=
"form-control"
name=
"top-search"
id=
"top-search"
>
...
...
@@ -12,6 +12,11 @@
</form>
</div>
<ul
class=
"nav navbar-top-links navbar-right"
>
<li>
<a
href=
"{{pathFor route="
settings
"}}"
>
<i
class=
"fa fa-archive"
></i>
Settings
</a>
</li>
<li>
{{#if getCollectionNames}}
<a
id=
"btnDisconnect"
href=
"#"
>
...
...
@@ -72,24 +77,24 @@
<div
class=
"modal-body"
>
<form
id=
"formCreateConnection"
class=
"form-horizontal"
>
<div
class=
"form-group"
><label
class=
"col-lg-2 control-label"
>
Connection Name
</label>
<div
class=
"col-lg-10"
><input
id=
"inputConnectionName"
required=
"true"
type=
"text"
<div
class=
"col-lg-10"
><input
id=
"inputConnectionName"
data-
required=
"true"
type=
"text"
placeholder=
"Connection Name"
class=
"form-control"
>
</div>
</div>
<div
class=
"form-group"
><label
class=
"col-lg-2 control-label"
>
Hostname
</label>
<div
class=
"col-lg-10"
><input
id=
"inputHost"
required=
"true"
type=
"text"
<div
class=
"col-lg-10"
><input
id=
"inputHost"
data-
required=
"true"
type=
"text"
placeholder=
"Hostname"
class=
"form-control"
>
</div>
</div>
<div
class=
"form-group"
><label
class=
"col-lg-2 control-label"
>
Port
</label>
<div
class=
"col-lg-10"
><input
id=
"inputPort"
value=
"27017"
required=
"true"
type=
"number"
<div
class=
"col-lg-10"
><input
id=
"inputPort"
value=
"27017"
data-
required=
"true"
type=
"number"
placeholder=
"Port"
class=
"form-control"
>
</div>
</div>
<div
class=
"form-group"
><label
class=
"col-lg-2 control-label"
>
DB Name
</label>
<div
class=
"col-lg-10"
><input
id=
"inputDatabaseName"
required=
"true"
type=
"text"
<div
class=
"col-lg-10"
><input
id=
"inputDatabaseName"
data-
required=
"true"
type=
"text"
placeholder=
"Database Name"
class=
"form-control"
>
</div>
...
...
client/views/pages/browse_collection.js
浏览文件 @
6fccde5f
...
...
@@ -125,7 +125,13 @@ Template.browseCollection.setResult = function (result) {
editor
.
setValue
(
JSON
.
stringify
(
result
,
null
,
'
\t
'
),
-
1
);
});
$
(
'
#divJsonEditor
'
).
show
(
'
slow
'
);
var
settings
=
Settings
.
findOne
();
if
(
settings
.
defaultResultView
==
'
Jsoneditor
'
)
{
$
(
'
#divJsonEditor
'
).
show
(
'
slow
'
);
}
else
{
$
(
'
#divAceEditor
'
).
show
(
'
slow
'
);
}
};
var
jsonEditor
;
...
...
client/views/pages/settings.html
0 → 100644
浏览文件 @
6fccde5f
<template
name=
"settings"
>
{{> pageHeading title="Settings" }}
<div
class=
"wrapper wrapper-content animated fadeIn"
>
<div
class=
"row"
>
<div
class=
"col-lg-12"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-title"
>
<h5>
Application Settings
<small
class=
"m-l-sm"
>
Specify application settings
</small>
</h5>
</div>
<div
class=
"ibox-content"
>
<form
class=
"form-horizontal"
>
<div
class=
"form-group"
>
<label
class=
"col-lg-3 control-label"
>
Collection sizes in
</label>
<div
class=
"col-lg-9"
>
<select
id=
"cmbScale"
data-placeholder=
"Choose one..."
class=
"chosen-select form-control"
tabindex=
"-1"
>
<option>
MegaBytes
</option>
<option>
KiloBytes
</option>
<option>
Bytes
</option>
</select>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-lg-3 control-label"
>
Default result view
</label>
<div
class=
"col-lg-9"
>
<select
id=
"cmbResultView"
data-placeholder=
"Choose one..."
class=
"chosen-select form-control"
tabindex=
"-1"
>
<option>
Jsoneditor
</option>
<option>
Aceeditor
</option>
</select>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-lg-3 control-label"
>
Autocomplete feature for selectors
</label>
<div
class=
"col-lg-9"
>
<div
id=
"divAutoCompleteFields"
class=
"i-checks"
>
<input
id=
"inputAutoCompleteFields"
type=
"checkbox"
value=
""
class=
"form-control"
checked=
""
style=
"position: absolute; opacity: 0;"
/>
<span
class=
"help-block m-b-none"
>
Enabling this feature significantly reduces performance on huge collections
</span>
</div>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"col-lg-12"
>
<button
id=
"btnSaveSettings"
class=
"btn btn-block btn-outline btn-primary ladda-button"
type=
"button"
data-style=
"contract"
>
<strong>
Save
</strong></button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</template>
\ No newline at end of file
client/views/pages/settings.js
0 → 100644
浏览文件 @
6fccde5f
/**
* Created by RSercan on 9.1.2016.
*/
Template
.
settings
.
onRendered
(
function
()
{
$
(
'
#divAutoCompleteFields
'
).
iCheck
({
checkboxClass
:
'
icheckbox_square-green
'
});
$
(
'
#cmbScale
'
).
chosen
();
$
(
'
#cmbResultView
'
).
chosen
();
Template
.
settings
.
load
();
});
Template
.
settings
.
events
({
'
click #btnSaveSettings
'
:
function
(
e
)
{
e
.
preventDefault
();
var
laddaButton
=
$
(
'
#btnSaveSettings
'
).
ladda
();
laddaButton
.
ladda
(
'
start
'
);
Meteor
.
call
(
'
updateSettings
'
,
Template
.
settings
.
getSettingsFromForm
());
toastr
.
success
(
'
Successfuly saved !
'
);
Ladda
.
stopAll
();
}
});
Template
.
settings
.
getSettingsFromForm
=
function
()
{
var
settings
=
{};
settings
.
autoCompleteFields
=
$
(
'
#divAutoCompleteFields
'
).
iCheck
(
'
update
'
)[
0
].
checked
;
settings
.
scale
=
$
(
"
#cmbScale
"
).
chosen
().
val
();
settings
.
defaultResultView
=
$
(
"
#cmbResultView
"
).
chosen
().
val
();
return
settings
;
};
Template
.
settings
.
load
=
function
()
{
var
settings
=
Settings
.
findOne
();
var
cmbScale
=
$
(
'
#cmbScale
'
);
var
cmbResultView
=
$
(
'
#cmbResultView
'
);
cmbScale
.
val
(
settings
.
scale
);
cmbScale
.
trigger
(
"
chosen:updated
"
);
cmbResultView
.
val
(
settings
.
defaultResultView
);
cmbResultView
.
trigger
(
"
chosen:updated
"
);
if
(
settings
.
autoCompleteFields
)
{
$
(
'
#inputAutoCompleteFields
'
).
iCheck
(
'
check
'
);
}
else
{
$
(
'
#inputAutoCompleteFields
'
).
iCheck
(
'
uncheck
'
);
}
};
\ No newline at end of file
lib/collections.js
浏览文件 @
6fccde5f
/**
* Created by RSercan on 26.12.2015.
*/
Connections
=
new
Mongo
.
Collection
(
'
connections
'
);
\ No newline at end of file
Connections
=
new
Mongo
.
Collection
(
'
connections
'
);
Connections
.
attachSchema
(
new
SimpleSchema
({
name
:
{
type
:
"
String
"
},
host
:
{
type
:
"
String
"
},
port
:
{
type
:
"
Number
"
},
databaseName
:
{
type
:
"
String
"
},
user
:
{
type
:
"
String
"
,
optional
:
true
},
password
:
{
type
:
"
String
"
,
optional
:
true
}
}));
Settings
=
new
Mongo
.
Collection
(
'
settings
'
);
Settings
.
attachSchema
(
new
SimpleSchema
({
scale
:
{
type
:
"
String
"
,
allowedValues
:
[
'
MegaBytes
'
,
'
KiloBytes
'
,
'
Bytes
'
]
},
defaultResultView
:
{
type
:
"
String
"
,
allowedValues
:
[
'
Jsoneditor
'
,
'
Aceeditor
'
]
},
autoCompleteFields
:
{
type
:
"
Boolean
"
}
}));
\ No newline at end of file
lib/router.js
浏览文件 @
6fccde5f
/**
* Created by RSercan on 26.12.2015.
*/
Router
.
configure
({
layoutTemplate
:
'
mainLayout
'
,
notFoundTemplate
:
'
notFound
'
});
Router
.
route
(
'
/settings
'
,
{
waitOn
:
function
()
{
return
[
Meteor
.
subscribe
(
'
settings
'
),
Meteor
.
subscribe
(
'
connections
'
)];
}
});
Router
.
route
(
'
/browseDB
'
,
{
waitOn
:
function
()
{
return
[
Meteor
.
subscribe
(
'
connections
'
)];
return
[
Meteor
.
subscribe
(
'
settings
'
),
Meteor
.
subscribe
(
'
connections
'
)];
}
});
Router
.
route
(
'
/browseCollection
'
,
{
waitOn
:
function
()
{
return
[
Meteor
.
subscribe
(
'
connections
'
)];
return
[
Meteor
.
subscribe
(
'
settings
'
),
Meteor
.
subscribe
(
'
connections
'
)];
}
});
Router
.
route
(
'
/
'
,
{
template
:
'
browseDB
'
,
waitOn
:
function
()
{
return
[
Meteor
.
subscribe
(
'
connections
'
)];
return
[
Meteor
.
subscribe
(
'
settings
'
),
Meteor
.
subscribe
(
'
connections
'
)];
}
});
...
...
lib/
methods.js
→
server/internal_
methods.js
浏览文件 @
6fccde5f
/**
* Created by RSercan on 26.12.2015.
*/
Meteor
.
startup
(
function
()
{
if
(
!
Settings
.
findOne
())
{
Settings
.
insert
({
scale
:
"
MegaBytes
"
,
defaultResultView
:
"
Jsoneditor
"
,
autoCompleteFields
:
false
});
}
});
Meteor
.
methods
({
'
updateSettings
'
:
function
(
settings
)
{
Settings
.
update
({},
{
$set
:
{
scale
:
settings
.
scale
,
defaultResultView
:
settings
.
defaultResultView
,
autoCompleteFields
:
settings
.
autoCompleteFields
}
});
},
'
saveConnection
'
:
function
(
connection
)
{
Connections
.
insert
(
connection
);
},
...
...
server/publisher.js
浏览文件 @
6fccde5f
...
...
@@ -5,3 +5,7 @@ Meteor.publish('connections', function () {
return
Connections
.
find
();
});
Meteor
.
publish
(
'
settings
'
,
function
()
{
return
Settings
.
find
();
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录