Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
-布谷鸟-
nosqlclient
提交
4009be27
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 搜索 >>
提交
4009be27
编写于
5月 09, 2017
作者:
R
rsercano
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
resolves #355
上级
0ace9c77
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
85 addition
and
52 deletion
+85
-52
client/imports/views/layouts/navigation/navigation.html
client/imports/views/layouts/navigation/navigation.html
+2
-1
client/imports/views/layouts/navigation/navigation.js
client/imports/views/layouts/navigation/navigation.js
+23
-0
client/imports/views/pages/mc_shell/mc_shell.js
client/imports/views/pages/mc_shell/mc_shell.js
+2
-2
client/imports/views/pages/settings/settings.html
client/imports/views/pages/settings/settings.html
+11
-0
client/imports/views/pages/settings/settings.js
client/imports/views/pages/settings/settings.js
+21
-44
lib/imports/enums.js
lib/imports/enums.js
+4
-0
server/imports/internal/internal_methods.js
server/imports/internal/internal_methods.js
+18
-5
server/imports/mongodb/methods_common.js
server/imports/mongodb/methods_common.js
+4
-0
未找到文件。
client/imports/views/layouts/navigation/navigation.html
浏览文件 @
4009be27
...
@@ -124,7 +124,8 @@
...
@@ -124,7 +124,8 @@
</li>
</li>
<li
class=
"{{isActivePath regex='schemaAnalyzer'}}"
>
<li
class=
"{{isActivePath regex='schemaAnalyzer'}}"
>
<a
class=
"aNavigations"
href=
"{{pathFor route='schemaAnalyzer'}}"
><i
<a
id=
"anchorSchemaAnalyzer"
class=
"aNavigations"
href=
"{{pathFor route='schemaAnalyzer'}}"
><i
class=
"fa fa-braille"
></i>
<span
class=
"fa fa-braille"
></i>
<span
class=
"nav-label"
>
Schema Analyzer
</span>
class=
"nav-label"
>
Schema Analyzer
</span>
</a>
</a>
...
...
client/imports/views/layouts/navigation/navigation.js
浏览文件 @
4009be27
...
@@ -6,6 +6,7 @@ import {Session} from "meteor/session";
...
@@ -6,6 +6,7 @@ import {Session} from "meteor/session";
import
{
FlowRouter
}
from
"
meteor/kadira:flow-router
"
;
import
{
FlowRouter
}
from
"
meteor/kadira:flow-router
"
;
import
{
Connections
}
from
"
/lib/imports/collections/connections
"
;
import
{
Connections
}
from
"
/lib/imports/collections/connections
"
;
import
Helper
from
"
/client/imports/helper
"
;
import
Helper
from
"
/client/imports/helper
"
;
import
Enums
from
"
/lib/imports/enums
"
;
import
{
connect
}
from
"
/client/imports/views/layouts/top_navbar/connections/connections
"
;
import
{
connect
}
from
"
/client/imports/views/layouts/top_navbar/connections/connections
"
;
import
{
initializeForm
,
resetForm
}
from
"
./add_collection/add_collection
"
;
import
{
initializeForm
,
resetForm
}
from
"
./add_collection/add_collection
"
;
import
{
resetForm
as
resetCappedForm
}
from
"
./convert_capped_collection/convert_to_capped
"
;
import
{
resetForm
as
resetCappedForm
}
from
"
./convert_capped_collection/convert_to_capped
"
;
...
@@ -120,6 +121,23 @@ export const renderCollectionNames = function () {
...
@@ -120,6 +121,23 @@ export const renderCollectionNames = function () {
});
});
};
};
const
showMongoBinaryInfo
=
function
()
{
if
(
!
localStorage
.
getItem
(
Enums
.
LOCAL_STORAGE_KEYS
.
MONGO_BINARY_INFO
))
{
swal
({
title
:
"
Mongo Binary
"
,
text
:
"
Mongo executable to be used on shell and schema analyzer is configurable, you can change it from <b>Settings</b>
"
,
type
:
"
info
"
,
html
:
true
,
confirmButtonColor
:
"
#18A689
"
,
confirmButtonText
:
"
Cool, don't show again!
"
},
function
(
isConfirm
)
{
if
(
isConfirm
)
{
localStorage
.
setItem
(
Enums
.
LOCAL_STORAGE_KEYS
.
MONGO_BINARY_INFO
,
"
true
"
);
}
});
}
};
Template
.
navigation
.
events
({
Template
.
navigation
.
events
({
'
click #anchorShell
'
(
e
)
{
'
click #anchorShell
'
(
e
)
{
e
.
preventDefault
();
e
.
preventDefault
();
...
@@ -131,6 +149,11 @@ Template.navigation.events({
...
@@ -131,6 +149,11 @@ Template.navigation.events({
}
}
FlowRouter
.
go
(
'
/shell
'
);
FlowRouter
.
go
(
'
/shell
'
);
showMongoBinaryInfo
();
},
'
click #anchorSchemaAnalyzer
'
()
{
showMongoBinaryInfo
();
},
},
'
click #anchorDatabaseDumpRestore
'
(
e
)
{
'
click #anchorDatabaseDumpRestore
'
(
e
)
{
...
...
client/imports/views/pages/mc_shell/mc_shell.js
浏览文件 @
4009be27
...
@@ -160,8 +160,8 @@ const initializeCommandCodeMirror = function () {
...
@@ -160,8 +160,8 @@ const initializeCommandCodeMirror = function () {
let
regex
=
new
RegExp
(
'
^
'
+
curWord
,
'
i
'
);
let
regex
=
new
RegExp
(
'
^
'
+
curWord
,
'
i
'
);
return
{
return
{
list
:
(
!
curWord
?
list
:
list
.
filter
(
function
(
item
)
{
list
:
(
!
curWord
?
list
:
list
.
filter
(
function
(
item
)
{
return
item
.
match
(
regex
);
return
item
.
match
(
regex
);
})),
})),
from
:
CodeMirror
.
Pos
(
cursor
.
line
,
start
),
from
:
CodeMirror
.
Pos
(
cursor
.
line
,
start
),
to
:
CodeMirror
.
Pos
(
cursor
.
line
,
end
)
to
:
CodeMirror
.
Pos
(
cursor
.
line
,
end
)
};
};
...
...
client/imports/views/pages/settings/settings.html
浏览文件 @
4009be27
...
@@ -167,6 +167,17 @@
...
@@ -167,6 +167,17 @@
</div>
</div>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-lg-3 control-label"
>
Mongo executable path
</label>
<div
class=
"col-lg-9"
>
<input
id=
"inputMongoExecutable"
required=
"true"
type=
"file"
class=
"form-control filestyle"
>
<span
class=
"help-block m-b-none"
>
<b>
By default
</b>
Mongoclient uses an internal
<b>
Mongo
</b>
binary regarding to your OS, you can assign another binary with this setting
</span>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<div
class=
"col-lg-12"
>
<div
class=
"col-lg-12"
>
<button
id=
"btnSaveSettings"
<button
id=
"btnSaveSettings"
...
...
client/imports/views/pages/settings/settings.js
浏览文件 @
4009be27
import
{
Template
}
from
"
meteor/templating
"
;
import
{
Template
}
from
"
meteor/templating
"
;
import
{
Meteor
}
from
"
meteor/meteor
"
;
import
{
Settings
}
from
"
/lib/imports/collections/settings
"
;
import
{
Settings
}
from
"
/lib/imports/collections/settings
"
;
import
{
loadFile
}
from
"
/client/imports/views/layouts/top_navbar/top_navbar
"
;
import
"
./settings.html
"
;
import
"
./settings.html
"
;
const
toastr
=
require
(
'
toastr
'
);
const
toastr
=
require
(
'
toastr
'
);
...
@@ -9,7 +9,7 @@ const Ladda = require('ladda');
...
@@ -9,7 +9,7 @@ const Ladda = require('ladda');
* Created by RSercan on 9.1.2016.
* Created by RSercan on 9.1.2016.
*/
*/
const
getSettingsFromForm
=
function
(
)
{
const
proceedSavingSettings
=
function
(
mongoBinary
)
{
const
settings
=
{};
const
settings
=
{};
settings
.
autoCompleteFields
=
$
(
'
#divAutoCompleteFields
'
).
iCheck
(
'
update
'
)[
0
].
checked
;
settings
.
autoCompleteFields
=
$
(
'
#divAutoCompleteFields
'
).
iCheck
(
'
update
'
)[
0
].
checked
;
settings
.
scale
=
$
(
"
#cmbScale
"
).
chosen
().
val
();
settings
.
scale
=
$
(
"
#cmbScale
"
).
chosen
().
val
();
...
@@ -21,15 +21,21 @@ const getSettingsFromForm = function () {
...
@@ -21,15 +21,21 @@ const getSettingsFromForm = function () {
settings
.
showDBStats
=
$
(
'
#divShowDBStats
'
).
iCheck
(
'
update
'
)[
0
].
checked
;
settings
.
showDBStats
=
$
(
'
#divShowDBStats
'
).
iCheck
(
'
update
'
)[
0
].
checked
;
settings
.
showLiveChat
=
$
(
'
#divShowLiveChat
'
).
iCheck
(
'
update
'
)[
0
].
checked
;
settings
.
showLiveChat
=
$
(
'
#divShowLiveChat
'
).
iCheck
(
'
update
'
)[
0
].
checked
;
settings
.
dumpPath
=
$
(
'
#inputDumpPath
'
).
val
();
settings
.
dumpPath
=
$
(
'
#inputDumpPath
'
).
val
();
settings
.
mongoBinaryName
=
$
(
'
#inputMongoExecutable
'
).
siblings
(
'
.bootstrap-filestyle
'
).
children
(
'
input
'
).
val
()
||
'
mongo
'
;
settings
.
singleTabResultSets
=
$
(
'
#divUseSingleTab
'
).
iCheck
(
'
update
'
)[
0
].
checked
;
settings
.
singleTabResultSets
=
$
(
'
#divUseSingleTab
'
).
iCheck
(
'
update
'
)[
0
].
checked
;
return
settings
;
Meteor
.
call
(
'
updateSettings
'
,
settings
,
mongoBinary
,
function
(
err
)
{
if
(
err
)
this
.
showMeteorFuncError
(
err
,
null
,
"
Couldn't save
"
);
else
toastr
.
success
(
'
Successfuly saved !
'
);
Ladda
.
stopAll
();
});
};
};
Template
.
settings
.
onRendered
(
function
()
{
Template
.
settings
.
onRendered
(
function
()
{
$
(
'
#divAutoCompleteFields, #divShowDBStats, #divShowLiveChat, #divUseSingleTab
'
).
iCheck
({
$
(
'
#divAutoCompleteFields, #divShowDBStats, #divShowLiveChat, #divUseSingleTab
'
).
iCheck
({
checkboxClass
:
'
icheckbox_square-green
'
checkboxClass
:
'
icheckbox_square-green
'
});
});
$
(
'
.filestyle
'
).
filestyle
({});
$
(
'
#cmbScale, #cmbResultView
'
).
chosen
();
$
(
'
#cmbScale, #cmbResultView
'
).
chosen
();
let
settings
=
this
.
subscribe
(
'
settings
'
);
let
settings
=
this
.
subscribe
(
'
settings
'
);
...
@@ -47,12 +53,7 @@ Template.settings.events({
...
@@ -47,12 +53,7 @@ Template.settings.events({
e
.
preventDefault
();
e
.
preventDefault
();
Ladda
.
create
(
document
.
querySelector
(
'
#btnSaveSettings
'
)).
start
();
Ladda
.
create
(
document
.
querySelector
(
'
#btnSaveSettings
'
)).
start
();
loadFile
(
Settings
.
findOne
().
mongoBinary
,
$
(
'
#inputMongoExecutable
'
),
proceedSavingSettings
);
Meteor
.
call
(
'
updateSettings
'
,
getSettingsFromForm
());
toastr
.
success
(
'
Successfuly saved !
'
);
Ladda
.
stopAll
();
}
}
});
});
...
@@ -61,15 +62,6 @@ const load = function () {
...
@@ -61,15 +62,6 @@ const load = function () {
const
settings
=
Settings
.
findOne
();
const
settings
=
Settings
.
findOne
();
const
cmbScale
=
$
(
'
#cmbScale
'
);
const
cmbScale
=
$
(
'
#cmbScale
'
);
const
cmbResultView
=
$
(
'
#cmbResultView
'
);
const
cmbResultView
=
$
(
'
#cmbResultView
'
);
const
inputMaxAllowedFetchSize
=
$
(
'
#inputMaxAllowedFetchSize
'
);
const
inputSocketTimeout
=
$
(
'
#inputSocketTimeout
'
);
const
inputConnectionTimeout
=
$
(
'
#inputConnectionTimeout
'
);
const
inputDBStatsScheduler
=
$
(
'
#inputDBStatsScheduler
'
);
const
inputAutoCompleteFields
=
$
(
'
#inputAutoCompleteFields
'
);
const
inputShowLiveChat
=
$
(
'
#inputShowLiveChat
'
);
const
inputShowDBStats
=
$
(
'
#inputShowDBStats
'
);
const
inputDumpPath
=
$
(
'
#inputDumpPath
'
);
const
inputUseSingleTab
=
$
(
'
#inputUseSingleTab
'
);
cmbScale
.
val
(
settings
.
scale
);
cmbScale
.
val
(
settings
.
scale
);
cmbScale
.
trigger
(
"
chosen:updated
"
);
cmbScale
.
trigger
(
"
chosen:updated
"
);
...
@@ -77,30 +69,15 @@ const load = function () {
...
@@ -77,30 +69,15 @@ const load = function () {
cmbResultView
.
val
(
settings
.
defaultResultView
);
cmbResultView
.
val
(
settings
.
defaultResultView
);
cmbResultView
.
trigger
(
"
chosen:updated
"
);
cmbResultView
.
trigger
(
"
chosen:updated
"
);
if
(
settings
.
dumpPath
)
inputDumpPath
.
val
(
settings
.
dumpPath
);
$
(
'
#inputDumpPath
'
).
val
(
settings
.
dumpPath
||
''
);
$
(
'
#inputMaxAllowedFetchSize
'
).
val
(
settings
.
maxAllowedFetchSize
||
0
);
if
(
settings
.
maxAllowedFetchSize
)
inputMaxAllowedFetchSize
.
val
(
settings
.
maxAllowedFetchSize
);
$
(
'
#inputSocketTimeout
'
).
val
(
settings
.
socketTimeoutInSeconds
||
0
);
else
inputMaxAllowedFetchSize
.
val
(
0
);
$
(
'
#inputConnectionTimeout
'
).
val
(
settings
.
connectionTimeoutInSeconds
||
0
);
$
(
'
#inputDBStatsScheduler
'
).
val
(
settings
.
dbStatsScheduler
||
3000
);
if
(
settings
.
socketTimeoutInSeconds
)
inputSocketTimeout
.
val
(
settings
.
socketTimeoutInSeconds
);
$
(
'
#inputAutoCompleteFields
'
).
iCheck
(
settings
.
autoCompleteFields
?
'
check
'
:
'
uncheck
'
);
else
inputSocketTimeout
.
val
(
0
);
$
(
'
#inputShowLiveChat
'
).
iCheck
(
settings
.
showLiveChat
?
'
check
'
:
'
uncheck
'
);
$
(
'
#inputUseSingleTab
'
).
iCheck
(
settings
.
singleTabResultSets
?
'
check
'
:
'
uncheck
'
);
if
(
settings
.
connectionTimeoutInSeconds
)
inputConnectionTimeout
.
val
(
settings
.
connectionTimeoutInSeconds
);
$
(
'
#inputShowDBStats
'
).
iCheck
(
settings
.
showDBStats
?
'
check
'
:
'
uncheck
'
);
else
inputConnectionTimeout
.
val
(
0
);
$
(
'
#inputMongoExecutable
'
).
siblings
(
'
.bootstrap-filestyle
'
).
children
(
'
input
'
).
val
(
settings
.
mongoBinaryName
||
'
mongo
'
);
if
(
settings
.
dbStatsScheduler
)
inputDBStatsScheduler
.
val
(
settings
.
dbStatsScheduler
);
else
inputDBStatsScheduler
.
val
(
3000
);
if
(
settings
.
autoCompleteFields
)
inputAutoCompleteFields
.
iCheck
(
'
check
'
);
else
inputAutoCompleteFields
.
iCheck
(
'
uncheck
'
);
if
(
settings
.
showLiveChat
)
inputShowLiveChat
.
iCheck
(
'
check
'
);
else
inputShowLiveChat
.
iCheck
(
'
uncheck
'
);
if
(
settings
.
singleTabResultSets
)
inputUseSingleTab
.
iCheck
(
'
check
'
);
else
inputUseSingleTab
.
iCheck
(
'
uncheck
'
);
if
(
settings
.
showDBStats
)
inputShowDBStats
.
iCheck
(
'
check
'
);
else
inputShowDBStats
.
iCheck
(
'
uncheck
'
);
};
};
\ No newline at end of file
lib/imports/enums.js
浏览文件 @
4009be27
...
@@ -2,6 +2,10 @@
...
@@ -2,6 +2,10 @@
* Created by RSercan on 29.12.2015.
* Created by RSercan on 29.12.2015.
*/
*/
let
Enums
=
function
()
{
let
Enums
=
function
()
{
this
.
LOCAL_STORAGE_KEYS
=
{
MONGO_BINARY_INFO
:
'
mongoclient-mongo-binary-warn
'
};
this
.
QUERY_TYPES
=
{
this
.
QUERY_TYPES
=
{
BULK_WRITE
:
"
bulkWrite
"
,
BULK_WRITE
:
"
bulkWrite
"
,
FIND
:
"
find
"
,
FIND
:
"
find
"
,
...
...
server/imports/internal/internal_methods.js
浏览文件 @
4009be27
...
@@ -12,7 +12,7 @@ import SchemaAnalyzeResult from "/lib/imports/collections/schema_analyze_result"
...
@@ -12,7 +12,7 @@ import SchemaAnalyzeResult from "/lib/imports/collections/schema_analyze_result"
import
{
HTTP
}
from
"
meteor/http
"
;
import
{
HTTP
}
from
"
meteor/http
"
;
import
LOGGER
from
"
../internal/logger
"
;
import
LOGGER
from
"
../internal/logger
"
;
const
fs
=
require
(
'
fs
'
);
const
packageJson
=
require
(
'
/package.json
'
);
const
packageJson
=
require
(
'
/package.json
'
);
const
mongodbUrlParser
=
require
(
'
parse-mongo-url
'
);
const
mongodbUrlParser
=
require
(
'
parse-mongo-url
'
);
...
@@ -186,10 +186,23 @@ Meteor.methods({
...
@@ -186,10 +186,23 @@ Meteor.methods({
Dumps
.
insert
(
dump
);
Dumps
.
insert
(
dump
);
},
},
updateSettings
(
settings
)
{
updateSettings
(
settings
,
mongoBinary
)
{
LOGGER
.
info
(
'
[updateSettings]
'
,
JSON
.
stringify
(
settings
));
try
{
Settings
.
remove
({});
LOGGER
.
info
(
'
[updateSettings]
'
,
JSON
.
stringify
(
settings
));
Settings
.
insert
(
settings
);
if
(
mongoBinary
)
{
let
currentDir
=
process
.
cwd
().
replace
(
/
\\
/g
,
'
/
'
);
currentDir
=
currentDir
.
substring
(
0
,
currentDir
.
lastIndexOf
(
"
/
"
))
+
'
/web.browser/app/mongo/
'
;
fs
.
chmodSync
(
currentDir
,
'
777
'
);
fs
.
writeFileSync
(
currentDir
+
"
user_mongo
"
,
new
Buffer
(
mongoBinary
),
{
mode
:
'
777
'
});
}
Settings
.
remove
({});
Settings
.
insert
(
settings
);
}
catch
(
ex
)
{
LOGGER
.
error
(
'
[updateSettings]
'
,
ex
);
throw
new
Meteor
.
Error
(
ex
.
message
);
}
},
},
saveConnection
(
connection
)
{
saveConnection
(
connection
)
{
...
...
server/imports/mongodb/methods_common.js
浏览文件 @
4009be27
...
@@ -82,6 +82,10 @@ const getMongoExternalsPath = function () {
...
@@ -82,6 +82,10 @@ const getMongoExternalsPath = function () {
const
getProperMongo
=
function
()
{
const
getProperMongo
=
function
()
{
let
currentDir
=
getMongoExternalsPath
();
let
currentDir
=
getMongoExternalsPath
();
if
(
fs
.
existsSync
(
currentDir
+
"
user_mongo
"
))
{
LOGGER
.
info
(
'
[userMongo]
'
,
'
found a mongo binary set by user, choosing it
'
);
return
currentDir
+
"
user_mongo
"
;
}
switch
(
os
.
platform
())
{
switch
(
os
.
platform
())
{
case
'
darwin
'
:
case
'
darwin
'
:
return
currentDir
+
'
darwin/mongo
'
;
return
currentDir
+
'
darwin/mongo
'
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录