Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
zzx_123123
zui
提交
c26f2228
Z
zui
项目概览
zzx_123123
/
zui
与 Fork 源项目一致
Fork自
易企天创 / zui
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Z
zui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c26f2228
编写于
4月 19, 2016
作者:
C
Catouse
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
* refactor code for dashboard.
上级
a5d188ed
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
36 addition
and
22 deletion
+36
-22
src/js/dashboard.js
src/js/dashboard.js
+36
-22
未找到文件。
src/js/dashboard.js
浏览文件 @
c26f2228
...
...
@@ -50,10 +50,11 @@
};
Dashboard
.
prototype
.
handleRefreshEvent
=
function
()
{
var
that
=
this
;
var
onlyRefreshBody
=
this
.
options
.
onlyRefreshBody
;
this
.
$
.
on
(
'
click
'
,
'
.refresh-panel
'
,
function
()
{
var
panel
=
$
(
this
).
closest
(
'
.panel
'
);
refreshPanel
(
panel
,
onlyRefreshBody
);
that
.
refresh
(
panel
,
onlyRefreshBody
);
});
};
...
...
@@ -307,31 +308,44 @@
e
.
preventDefault
();
e
.
stopPropagation
();
}).
children
(
'
.row
'
).
children
(
'
:not(.dragging-col-holder)
'
).
append
(
'
<div class="resize-handle"><i class="icon icon-resize-h"></i></div>
'
);
}
}
;
function
refreshPanel
(
panel
,
onlyRefreshBody
)
{
var
url
=
panel
.
data
(
'
url
'
);
Dashboard
.
prototype
.
refresh
=
function
(
$panel
,
onlyRefreshBody
)
{
var
afterRefresh
=
this
.
options
.
afterRefresh
;
$panel
=
$
(
$panel
);
var
url
=
$panel
.
data
(
'
url
'
);
if
(
!
url
)
return
;
panel
.
addClass
(
'
panel-loading
'
).
find
(
'
.panel-heading .icon-refresh,.panel-heading .icon-repeat
'
).
addClass
(
'
icon-spin
'
);
$
panel
.
addClass
(
'
panel-loading
'
).
find
(
'
.panel-heading .icon-refresh,.panel-heading .icon-repeat
'
).
addClass
(
'
icon-spin
'
);
$
.
ajax
({
url
:
url
,
dataType
:
'
html
'
}).
done
(
function
(
data
)
{
var
$data
=
$
(
data
);
if
(
$data
.
hasClass
(
'
panel
'
))
{
panel
.
empty
().
append
(
$data
.
children
());
$
panel
.
empty
().
append
(
$data
.
children
());
}
else
if
(
onlyRefreshBody
)
{
panel
.
find
(
'
.panel-body
'
).
empty
().
html
(
data
);
$
panel
.
find
(
'
.panel-body
'
).
empty
().
html
(
data
);
}
else
{
panel
.
html
(
data
);
$panel
.
html
(
data
);
}
if
(
$
.
isFunction
(
afterRefresh
))
{
afterRefresh
.
call
(
this
,
{
result
:
true
,
data
:
data
});
}
}).
fail
(
function
()
{
panel
.
addClass
(
'
panel-error
'
);
}).
always
(
function
(
)
{
panel
.
removeClass
(
'
panel-loading
'
);
panel
.
find
(
'
.panel-heading .icon-refresh,.panel-heading .icon-repeat
'
).
removeClass
(
'
icon-spin
'
);
$
panel
.
addClass
(
'
panel-error
'
);
if
(
$
.
isFunction
(
afterRefresh
)
)
{
afterRefresh
.
call
(
this
,
{
result
:
false
});
}
}).
always
(
function
()
{
$panel
.
removeClass
(
'
panel-loading
'
);
$panel
.
find
(
'
.panel-heading .icon-refresh,.panel-heading .icon-repeat
'
).
removeClass
(
'
icon-spin
'
);
});
};
function
getRectArea
(
x1
,
y1
,
x2
,
y2
)
{
return
Math
.
abs
((
x2
-
x1
)
*
(
y2
-
y1
));
...
...
@@ -353,7 +367,7 @@
}
Dashboard
.
prototype
.
init
=
function
()
{
var
options
=
this
.
options
;
var
options
=
this
.
options
,
that
=
this
;
if
(
options
.
data
)
{
var
$row
=
$
(
'
<div class="row"/>
'
);
$
.
each
(
options
.
data
,
function
(
idx
,
config
)
{
...
...
@@ -371,18 +385,18 @@
}
$row
.
append
(
$col
.
append
(
$panel
.
data
(
'
url
'
,
config
.
url
)));
});
th
is
.
$
.
append
(
$row
);
th
at
.
$
.
append
(
$row
);
}
th
is
.
handlePanelHeight
();
th
is
.
handlePanelPadding
();
th
is
.
handleRemoveEvent
();
th
is
.
handleRefreshEvent
();
if
(
options
.
resizable
)
th
is
.
handleResizeEvent
();
if
(
th
is
.
draggable
)
this
.
handleDraggable
();
th
at
.
handlePanelHeight
();
th
at
.
handlePanelPadding
();
th
at
.
handleRemoveEvent
();
th
at
.
handleRefreshEvent
();
if
(
options
.
resizable
)
th
at
.
handleResizeEvent
();
if
(
th
at
.
draggable
)
that
.
handleDraggable
();
var
orderSeed
=
0
;
th
is
.
$
.
find
(
'
.panel
'
).
each
(
function
()
{
th
at
.
$
.
find
(
'
.panel
'
).
each
(
function
()
{
var
$this
=
$
(
this
);
$this
.
data
(
'
order
'
,
++
orderSeed
);
if
(
!
$this
.
attr
(
'
id
'
))
{
...
...
@@ -392,7 +406,7 @@
$this
.
attr
(
'
data-id
'
,
orderSeed
);
}
refreshPanel
(
$this
,
options
.
onlyRefreshBody
);
that
.
refresh
(
$this
,
options
.
onlyRefreshBody
);
});
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录