help_desk_dashboard 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/help_desk_dashboard.rb +22 -15
- data/lib/help-desk-dashboard/app_config.rb +33 -0
- data/lib/help-desk-dashboard/provider_factory.rb +3 -4
- data/lib/help-desk-dashboard/providers/service-desk-plus/8.1/provider.rb +3 -3
- data/lib/help-desk-dashboard/providers/track-it/2003.10.1/provider.rb +6 -7
- data/lib/help-desk-dashboard/web/{public → assets}/bootstrap/css/bootstrap-responsive.css +0 -0
- data/lib/help-desk-dashboard/web/{public → assets}/bootstrap/css/bootstrap-responsive.min.css +0 -0
- data/lib/help-desk-dashboard/web/{public → assets}/bootstrap/css/bootstrap.css +0 -0
- data/lib/help-desk-dashboard/web/{public → assets}/bootstrap/css/bootstrap.min.css +0 -0
- data/lib/help-desk-dashboard/web/{public → assets}/bootstrap/img/glyphicons-halflings-white.png +0 -0
- data/lib/help-desk-dashboard/web/{public → assets}/bootstrap/img/glyphicons-halflings.png +0 -0
- data/lib/help-desk-dashboard/web/{public → assets}/bootstrap/js/bootstrap.js +0 -0
- data/lib/help-desk-dashboard/web/{public → assets}/bootstrap/js/bootstrap.min.js +0 -0
- data/lib/help-desk-dashboard/web/{public → assets}/css/app.css +0 -0
- data/lib/help-desk-dashboard/web/{public → assets}/js/app.js +5 -1
- data/lib/help-desk-dashboard/web/{public → assets}/js/jquery-1.10.1.min.js +0 -0
- data/lib/help-desk-dashboard/web/{public → assets}/js/moment.min.js +0 -0
- data/lib/help-desk-dashboard/web/config.ru +2 -4
- data/lib/help-desk-dashboard/web/index.html +16 -0
- data/lib/help-desk-dashboard/web_generator.rb +27 -0
- metadata +25 -24
- data/lib/help-desk-dashboard/config_loader.rb +0 -13
- data/lib/help-desk-dashboard/web/public/index.html +0 -16
data/bin/help_desk_dashboard.rb
CHANGED
@@ -1,31 +1,38 @@
|
|
1
1
|
$stdout.sync = true
|
2
2
|
|
3
|
-
require_relative '../lib/help-desk-dashboard/
|
3
|
+
require_relative '../lib/help-desk-dashboard/app_config'
|
4
4
|
require_relative '../lib/help-desk-dashboard/extensions'
|
5
5
|
require_relative '../lib/help-desk-dashboard/provider_factory'
|
6
|
+
require_relative '../lib/help-desk-dashboard/web_generator'
|
7
|
+
|
8
|
+
ENV['HTTP_PROXY'] = nil
|
9
|
+
ENV['CONFIG_FILE'] ||= 'config.json'
|
10
|
+
config = AppConfig.from_file ENV['CONFIG_FILE']
|
6
11
|
|
7
|
-
config = load_config
|
8
12
|
provider_factory = ProviderFactory.new
|
9
|
-
provider = provider_factory.create config
|
10
|
-
requests = provider.get_requests.map do |r|
|
13
|
+
provider = provider_factory.create config[:provider]
|
14
|
+
requests = provider.get_requests(config.users_with_password, threads: config[:threads]).map do |r|
|
11
15
|
r.pick :id, :title, :status, :deadline, :assigned_to, :submitted_by, :submitted_on, :resolved_on
|
12
16
|
end
|
13
17
|
|
18
|
+
requests_by_submitter = requests.group_by { |r| r[:submitted_by] }
|
19
|
+
|
20
|
+
teams = config[:teams].map do |team|
|
21
|
+
{
|
22
|
+
team_name: team[:name],
|
23
|
+
title: "#{team[:name]} Help Desk Requests",
|
24
|
+
requests: team[:members].map { |username| requests_by_submitter[username] }.flatten
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
14
28
|
requests.each do |r|
|
15
|
-
user = config[:users].
|
29
|
+
user = config[:users].find { |u| u[:username] == r[:assigned_to] }
|
16
30
|
r[:assigned_to] = user[:name] if user
|
17
|
-
user = config[:users].
|
31
|
+
user = config[:users].find { |u| u[:username] == r[:submitted_by] }
|
18
32
|
r[:submitted_by] = user[:name] if user
|
19
33
|
end
|
20
34
|
|
21
|
-
|
22
|
-
|
23
|
-
requests: requests
|
24
|
-
}
|
25
|
-
|
26
|
-
public_web_dir = File.join File.dirname(__FILE__) + '/../lib/help-desk-dashboard/web/public'
|
27
|
-
data_file = File.join public_web_dir, 'data.json'
|
28
|
-
File.write data_file, data.to_json
|
29
|
-
FileUtils.cp_r "#{public_web_dir}/.", config[:output_dir]
|
35
|
+
generator = WebGenerator.new config[:output_dir]
|
36
|
+
generator.generate teams
|
30
37
|
|
31
38
|
puts 'Done.'
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'hashie'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
class AppConfig
|
5
|
+
|
6
|
+
def initialize(config)
|
7
|
+
set_defaults config
|
8
|
+
@config = Hashie::Mash.new config
|
9
|
+
end
|
10
|
+
|
11
|
+
def [](key)
|
12
|
+
@config[key]
|
13
|
+
end
|
14
|
+
|
15
|
+
def users_with_password
|
16
|
+
@config[:users].select { |u| u[:password] }
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.from_file(path)
|
20
|
+
json = File.read path
|
21
|
+
config = JSON.parse json
|
22
|
+
AppConfig.new config
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def set_defaults(config)
|
28
|
+
config[:title] ||= 'Help Desk Dashboard'
|
29
|
+
config[:output_dir] ||= 'output'
|
30
|
+
config[:threads] = (config[:threads] || '1').to_i
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -1,10 +1,9 @@
|
|
1
1
|
class ProviderFactory
|
2
2
|
|
3
|
-
def create(
|
4
|
-
|
5
|
-
path = File.join File.dirname(__FILE__), 'providers', provider[:name], provider[:version], 'provider.rb'
|
3
|
+
def create(provider_info)
|
4
|
+
path = File.join File.dirname(__FILE__), 'providers', provider_info[:name], provider_info[:version], 'provider.rb'
|
6
5
|
load path
|
7
|
-
Provider.new
|
6
|
+
Provider.new provider_info[:url]
|
8
7
|
end
|
9
8
|
|
10
9
|
end
|
@@ -5,22 +5,21 @@ require_relative 'user_operations'
|
|
5
5
|
|
6
6
|
class Provider
|
7
7
|
|
8
|
-
def initialize(
|
9
|
-
@
|
8
|
+
def initialize(url)
|
9
|
+
@url = url
|
10
10
|
end
|
11
11
|
|
12
|
-
def get_requests
|
13
|
-
|
14
|
-
users = @config[:users].select { |u| u[:password] }
|
12
|
+
def get_requests(users, options={})
|
13
|
+
threads = options[:threads] || 5
|
15
14
|
|
16
15
|
b = Watir::Browser.new
|
17
|
-
navigator = Navigator.new b, url
|
16
|
+
navigator = Navigator.new b, @url
|
18
17
|
user_operations = UserOperations.new b, navigator
|
19
18
|
request_ids = user_operations.get_request_ids users
|
20
19
|
b.close
|
21
20
|
|
22
21
|
user = users.first
|
23
|
-
parallel_request_scraper = ParallelRequestScraper.new url, user,
|
22
|
+
parallel_request_scraper = ParallelRequestScraper.new @url, user, threads
|
24
23
|
parallel_request_scraper.scrape request_ids
|
25
24
|
end
|
26
25
|
|
File without changes
|
data/lib/help-desk-dashboard/web/{public → assets}/bootstrap/css/bootstrap-responsive.min.css
RENAMED
File without changes
|
File without changes
|
File without changes
|
data/lib/help-desk-dashboard/web/{public → assets}/bootstrap/img/glyphicons-halflings-white.png
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -94,7 +94,11 @@ function getParameterByName(name) {
|
|
94
94
|
}
|
95
95
|
|
96
96
|
$(document).ready(function () {
|
97
|
-
|
97
|
+
var team = getParameterByName('team');
|
98
|
+
if(team == null) return;
|
99
|
+
var data_file = 'data/' + team + '.json';
|
100
|
+
|
101
|
+
$.getJSON(data_file, function (data) {
|
98
102
|
$('div.title').text(data.title);
|
99
103
|
$.each(data.requests, function (i, request) {
|
100
104
|
add_methods_to_request(request);
|
File without changes
|
File without changes
|
@@ -1,8 +1,6 @@
|
|
1
1
|
require 'rack'
|
2
2
|
|
3
|
-
use Rack::Static,
|
4
|
-
:urls => %w(/bootstrap /css /js /data.json),
|
5
|
-
:root => 'public'
|
3
|
+
use Rack::Static, urls: %w(/assets /data)
|
6
4
|
|
7
5
|
run lambda { |env|
|
8
6
|
[
|
@@ -11,6 +9,6 @@ run lambda { |env|
|
|
11
9
|
'Content-Type' => 'text/html',
|
12
10
|
'Cache-Control' => 'public, max-age=86400'
|
13
11
|
},
|
14
|
-
File.open('
|
12
|
+
File.open('index.html', File::RDONLY)
|
15
13
|
]
|
16
14
|
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>Help Desk Requests</title>
|
4
|
+
<link href="assets/bootstrap/css/bootstrap.min.css" rel="stylesheet"/>
|
5
|
+
<link href="assets/css/app.css" rel="stylesheet"/>
|
6
|
+
<script src="assets/js/jquery-1.10.1.min.js"></script>
|
7
|
+
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
|
8
|
+
<script src="assets/js/moment.min.js"></script>
|
9
|
+
<script src="assets/js/app.js"></script>
|
10
|
+
</head>
|
11
|
+
<body>
|
12
|
+
<div id="container" class="container-fluid">
|
13
|
+
<div class="title">Help Desk Requests</div>
|
14
|
+
</div>
|
15
|
+
</body>
|
16
|
+
</html>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'fileutils'; include FileUtils
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
class WebGenerator
|
5
|
+
|
6
|
+
def initialize(dest_dir)
|
7
|
+
@dest_dir = dest_dir
|
8
|
+
@dest_data_dir = File.join @dest_dir, 'data'
|
9
|
+
@source_dir = File.join File.dirname(__FILE__), 'web'
|
10
|
+
end
|
11
|
+
|
12
|
+
def generate(teams)
|
13
|
+
rm_rf @dest_dir
|
14
|
+
cp_r "#{@source_dir}/.", @dest_dir
|
15
|
+
mkdir_p @dest_data_dir
|
16
|
+
teams.each { |t| create_data_file t }
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def create_data_file(team)
|
22
|
+
file_name = "#{team[:team_name]}.json".downcase.gsub(' ', '-')
|
23
|
+
path = File.join @dest_data_dir, file_name
|
24
|
+
File.write path, team.to_json
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: help_desk_dashboard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-07-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hashie
|
16
|
-
requirement: &
|
16
|
+
requirement: &70277845991220 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 2.0.5
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70277845991220
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: json
|
27
|
-
requirement: &
|
27
|
+
requirement: &70277845990740 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 1.7.7
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70277845990740
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: watir-webdriver
|
38
|
-
requirement: &
|
38
|
+
requirement: &70277845990280 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 0.6.4
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70277845990280
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rack
|
49
|
-
requirement: &
|
49
|
+
requirement: &70277845989820 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: 1.5.2
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70277845989820
|
58
58
|
description:
|
59
59
|
email: matthew-github@matthewriley.name
|
60
60
|
executables:
|
@@ -62,7 +62,7 @@ executables:
|
|
62
62
|
extensions: []
|
63
63
|
extra_rdoc_files: []
|
64
64
|
files:
|
65
|
-
- lib/help-desk-dashboard/
|
65
|
+
- lib/help-desk-dashboard/app_config.rb
|
66
66
|
- lib/help-desk-dashboard/extensions.rb
|
67
67
|
- lib/help-desk-dashboard/provider_factory.rb
|
68
68
|
- lib/help-desk-dashboard/providers/service-desk-plus/8.1/provider.rb
|
@@ -72,20 +72,21 @@ files:
|
|
72
72
|
- lib/help-desk-dashboard/providers/track-it/2003.10.1/request_scraper.rb
|
73
73
|
- lib/help-desk-dashboard/providers/track-it/2003.10.1/user_operations.rb
|
74
74
|
- lib/help-desk-dashboard/providers/track-it/2003.10.1/user_request_scraper.rb
|
75
|
+
- lib/help-desk-dashboard/web/assets/bootstrap/css/bootstrap-responsive.css
|
76
|
+
- lib/help-desk-dashboard/web/assets/bootstrap/css/bootstrap-responsive.min.css
|
77
|
+
- lib/help-desk-dashboard/web/assets/bootstrap/css/bootstrap.css
|
78
|
+
- lib/help-desk-dashboard/web/assets/bootstrap/css/bootstrap.min.css
|
79
|
+
- lib/help-desk-dashboard/web/assets/bootstrap/img/glyphicons-halflings-white.png
|
80
|
+
- lib/help-desk-dashboard/web/assets/bootstrap/img/glyphicons-halflings.png
|
81
|
+
- lib/help-desk-dashboard/web/assets/bootstrap/js/bootstrap.js
|
82
|
+
- lib/help-desk-dashboard/web/assets/bootstrap/js/bootstrap.min.js
|
83
|
+
- lib/help-desk-dashboard/web/assets/css/app.css
|
84
|
+
- lib/help-desk-dashboard/web/assets/js/app.js
|
85
|
+
- lib/help-desk-dashboard/web/assets/js/jquery-1.10.1.min.js
|
86
|
+
- lib/help-desk-dashboard/web/assets/js/moment.min.js
|
75
87
|
- lib/help-desk-dashboard/web/config.ru
|
76
|
-
- lib/help-desk-dashboard/web/
|
77
|
-
- lib/help-desk-dashboard/
|
78
|
-
- lib/help-desk-dashboard/web/public/bootstrap/css/bootstrap.css
|
79
|
-
- lib/help-desk-dashboard/web/public/bootstrap/css/bootstrap.min.css
|
80
|
-
- lib/help-desk-dashboard/web/public/bootstrap/img/glyphicons-halflings-white.png
|
81
|
-
- lib/help-desk-dashboard/web/public/bootstrap/img/glyphicons-halflings.png
|
82
|
-
- lib/help-desk-dashboard/web/public/bootstrap/js/bootstrap.js
|
83
|
-
- lib/help-desk-dashboard/web/public/bootstrap/js/bootstrap.min.js
|
84
|
-
- lib/help-desk-dashboard/web/public/css/app.css
|
85
|
-
- lib/help-desk-dashboard/web/public/index.html
|
86
|
-
- lib/help-desk-dashboard/web/public/js/app.js
|
87
|
-
- lib/help-desk-dashboard/web/public/js/jquery-1.10.1.min.js
|
88
|
-
- lib/help-desk-dashboard/web/public/js/moment.min.js
|
88
|
+
- lib/help-desk-dashboard/web/index.html
|
89
|
+
- lib/help-desk-dashboard/web_generator.rb
|
89
90
|
- !binary |-
|
90
91
|
YmluL2hlbHBfZGVza19kYXNoYm9hcmQucmI=
|
91
92
|
homepage:
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'hashie'
|
2
|
-
require 'json'
|
3
|
-
|
4
|
-
def load_config
|
5
|
-
ENV['HTTP_PROXY'] = nil
|
6
|
-
ENV['CONFIG_FILE'] ||= 'config.json'
|
7
|
-
json = File.read(ENV['CONFIG_FILE'])
|
8
|
-
config = Hashie::Mash.new JSON.parse(json)
|
9
|
-
config[:title] ||= 'Help Desk Dashboard'
|
10
|
-
config[:output_dir] ||= 'output'
|
11
|
-
config[:threads] = (config[:threads] || '1').to_i
|
12
|
-
config
|
13
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
<html>
|
2
|
-
<head>
|
3
|
-
<title>Help Desk Dashboard</title>
|
4
|
-
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet"/>
|
5
|
-
<link href="css/app.css" rel="stylesheet"/>
|
6
|
-
<script src="js/jquery-1.10.1.min.js"></script>
|
7
|
-
<script src="/bootstrap/js/bootstrap.min.js"></script>
|
8
|
-
<script src="js/moment.min.js"></script>
|
9
|
-
<script src="js/app.js"></script>
|
10
|
-
</head>
|
11
|
-
<body>
|
12
|
-
<div id="container" class="container-fluid">
|
13
|
-
<div class="title">Help Desk Dashboard</div>
|
14
|
-
</div>
|
15
|
-
</body>
|
16
|
-
</html>
|