Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'all_log'

  • Loading branch information...
commit 56eceacfc5d6805b830b08cd53bb6204e5aedbab 2 parents ed109d7 + 024b8f5
@suisho authored
View
6 .gitignore
@@ -163,7 +163,7 @@ pip-log.txt
.DS_Store
node_modules
-occhan
-*.sublime*
-*.komodo*
config.json
+
+#test fixture auto
+test/date
View
4 app/public/css/style.css
@@ -25,3 +25,7 @@ body{
.logs .highlight{
background: #FFFF66;
}
+
+.message-box{
+ display: none;
+}
View
26 app/routes/log.js
@@ -1,18 +1,32 @@
var fs = require('fs');
var http = require('http');
var url = require('url');
+var path = require('path');
+var util = require('util');
var config = require('../config.js');
+exports.all = function(req, res){
+ var params = {
+ all : 1,
+ target : 'all',
+ target_all : config.allTargets()
+ }
+ res.render('browse',params);
+}
+
//browse
exports.browse = function(req, res){
//ファイル中身取得(できればケツだけとりたい)
//ケツの方だけ出す。
//強調語設定
var target = req.query.target
- var fileName = config.getFilePathByTarget(target); //ファイル名信用問題
- var tailString = "";
+
+ var fileName = "";
var tailLines = [];
var error = undefined;
+
+ fileName = config.getFilePathByTarget(target);
+ var tailString = "";
try{
if(req.query.all == 1){
tailString = fs.readFileSync(fileName, "UTF-8");
@@ -28,14 +42,14 @@ exports.browse = function(req, res){
}catch(e){
error = e;
}
-
var params = { tail_lines : tailLines,
target : target,
file_name : fileName,
- all : req.query.all,
- error : error
+ resolved_file_name : path.resolve(fileName),
+ disable_notification : req.query.disable_notification,
+ error : error,
};
- switch(req.format){
+ switch(req.params.format){
case "json":
res.json(params);
break
View
10 app/views/browse.html
@@ -33,6 +33,9 @@
{{/if}}
</h3>
</header>
+ <!-- todo: conclude alert message"-->
+ <div class="alert message-box">
+ </div>
{{if error}}
<div class="alert alert-error">
${error}
@@ -85,10 +88,9 @@
})
if(permitLevel = window.webkitNotifications.checkPermission()){
-
var message = (permitLevel == 1)
? "このwindowはデスクトップ通知できますが、許可されていません。許可をするにはここをクリックしてください"
- : "このwindowはデスクトップ通知できますが、拒否されています。設定でなんとかしてください"
+ : "このwindowはデスクトップ通知できますが、拒否されています。設定を変更して下さい["
$(".notification-permit")
.removeClass("alert-info")
.addClass("alert-error")
@@ -159,6 +161,10 @@
}
},0);
});
+ selfClient.socket.on('disconnect',function(){
+ console.log("disc");
+ $(".message-box").show().text("切断されました").addClass("alert-error");
+ })
}
function isKillLine(text){
View
79 app/views/notification.html
@@ -2,45 +2,96 @@
<head>
<script type="text/javascript" src="/logs/jquery-1.7.2.min.js"></script>
<link rel="stylesheet" type="text/css" href="/bootstrap/css/bootstrap.css">
+ <style>
+ .container{
+ width : 290px;
+ padding: 5px;
+ padding-top:12px;
+ }
+ body{
+ overflow : hidden;
+ }
+ a.alert{
+ display: block;
+ }
+ a:hover{
+ cursor: pointer;
+ font-weight: bold;
+ text-decoration: underline;
+ }
+ /*label風アラート*/
+ a,
+ #log-notification.alert{
+ color : white;
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
+ }
+ body.level-error,
+ #log-notification.alert.alert-error{
+ background: #B94A48;
+ }
+ body.level-warning,
+ #log-notification.alert.alert-warning{
+ background: #F89406;
+ }
+ body.level-info,
+ #log-notification.alert.alert-info{
+ background: #3A87AD;
+ }
+ </style>
</head>
- <body data-target="${target}" >
- <div class="container" style="padding-left:5px;width: 300px;">
- <h3 class="title">
- ${title}
- </h3>
- <div class="message">
- ${message}
- </div>
+ <body id="log-notification" data-target="${target}" class="level-${level}">
+ <div class="container" >
+ <div id="console"></div>
+ <a><!--/log/browse?target=${target}-->
+ <button class="close" data-dismiss="alert">×</button>
+ <h4 class="alert-heading title">
+ ${title}
+ </h4>
+ <div>
+ </div>
+ <div class="message">
+ ${message}
+ </div>
+ </a>
</div>
<script>
$(function(){
var isExtraTime = false; //タイムアウト終了後か
var onMouse = false; // bodyにマウスがのってるか
+ var closeTime = 5000;
+
function closeWindow(){
console.log("close");
window.close();
}
+
function closeOnTimeout(){
if(onMouse === false){
closeWindow();
}
}
- var closeTimer = setTimeout(closeOnTimeout,3000);
+ var closeTimer = setTimeout(closeOnTimeout,closeTime);
$("body").click(function(){
- var target = $("body").data("target");
- if(target){
- window.open("/browse?target="+target,"logs");
- }
closeWindow();
})
+ $(".close").click(function(){
+ closeWindow();
+ return false;
+ })
+ $("#log-notification").click(function(){
+ var target = $("body").data("target");
+
+ window.open("/log/browse?disable_notification=1&target="+target,"logs");
+ })
$("body").mouseenter(function(){
clearTimeout(closeTimer);
onMouse = true;
})
+
$("body").mouseleave(function(){
onMouse = false;
- closeTimer = setTimeout(closeOnTimeout,3000);
+ closeTimer = setTimeout(closeOnTimeout,closeTime);
})
})
</script>
Please sign in to comment.
Something went wrong with that request. Please try again.