help_desk_dashboard 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/help_desk_dashboard.rb +20 -8
- data/lib/help-desk-dashboard/config_loader.rb +13 -0
- data/lib/help-desk-dashboard/extensions.rb +6 -0
- data/lib/help-desk-dashboard/provider_factory.rb +2 -1
- data/lib/help-desk-dashboard/providers/track-it/2003.10.1/provider.rb +3 -3
- data/lib/help-desk-dashboard/web/public/index.html +15 -15
- data/lib/help-desk-dashboard/web/public/js/app.js +4 -3
- metadata +21 -8
data/bin/help_desk_dashboard.rb
CHANGED
@@ -1,19 +1,31 @@
|
|
1
1
|
$stdout.sync = true
|
2
2
|
|
3
|
+
require_relative '../lib/help-desk-dashboard/config_loader'
|
4
|
+
require_relative '../lib/help-desk-dashboard/extensions'
|
3
5
|
require_relative '../lib/help-desk-dashboard/provider_factory'
|
4
6
|
|
5
|
-
|
6
|
-
ENV['CONFIG_FILE'] ||= 'config.json'
|
7
|
-
|
8
|
-
config = JSON.parse File.read(ENV['CONFIG_FILE'])
|
9
|
-
config['thread_limit'] = ENV['THREAD_LIMIT'] ||= '5'
|
7
|
+
config = load_config
|
10
8
|
provider_factory = ProviderFactory.new
|
11
9
|
provider = provider_factory.create config
|
12
|
-
requests = provider.get_requests
|
10
|
+
requests = provider.get_requests.map do |r|
|
11
|
+
r.pick :id, :title, :status, :deadline, :assigned_to, :submitted_by, :submitted_on, :resolved_on
|
12
|
+
end
|
13
|
+
|
14
|
+
requests.each do |r|
|
15
|
+
user = config[:users].select { |u| u[:username] == r[:assigned_to] }[0]
|
16
|
+
r[:assigned_to] = user[:name] if user
|
17
|
+
user = config[:users].select { |u| u[:username] == r[:submitted_by] }[0]
|
18
|
+
r[:submitted_by] = user[:name] if user
|
19
|
+
end
|
20
|
+
|
21
|
+
data = {
|
22
|
+
title: config[:title],
|
23
|
+
requests: requests
|
24
|
+
}
|
13
25
|
|
14
26
|
public_web_dir = File.join File.dirname(__FILE__) + '/../lib/help-desk-dashboard/web/public'
|
15
27
|
data_file = File.join public_web_dir, 'data.json'
|
16
|
-
File.write data_file,
|
17
|
-
FileUtils.cp_r "#{public_web_dir}/.", config[
|
28
|
+
File.write data_file, data.to_json
|
29
|
+
FileUtils.cp_r "#{public_web_dir}/.", config[:output_dir]
|
18
30
|
|
19
31
|
puts 'Done.'
|
@@ -0,0 +1,13 @@
|
|
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,7 +1,8 @@
|
|
1
1
|
class ProviderFactory
|
2
2
|
|
3
3
|
def create(config)
|
4
|
-
|
4
|
+
provider = config[:provider]
|
5
|
+
path = File.join File.dirname(__FILE__), 'providers', provider[:name], provider[:version], 'provider.rb'
|
5
6
|
load path
|
6
7
|
Provider.new config
|
7
8
|
end
|
@@ -10,8 +10,8 @@ class Provider
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def get_requests
|
13
|
-
url = @config[
|
14
|
-
users = @config[
|
13
|
+
url = @config[:provider][:url]
|
14
|
+
users = @config[:users].select { |u| u[:password] }
|
15
15
|
|
16
16
|
b = Watir::Browser.new
|
17
17
|
navigator = Navigator.new b, url
|
@@ -20,7 +20,7 @@ class Provider
|
|
20
20
|
b.close
|
21
21
|
|
22
22
|
user = users.first
|
23
|
-
parallel_request_scraper = ParallelRequestScraper.new url, user, @config[
|
23
|
+
parallel_request_scraper = ParallelRequestScraper.new url, user, @config[:threads]
|
24
24
|
parallel_request_scraper.scrape request_ids
|
25
25
|
end
|
26
26
|
|
@@ -1,16 +1,16 @@
|
|
1
|
-
<html>
|
2
|
-
<head>
|
3
|
-
<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">
|
14
|
-
</div>
|
15
|
-
</body>
|
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
16
|
</html>
|
@@ -94,12 +94,13 @@ function getParameterByName(name) {
|
|
94
94
|
}
|
95
95
|
|
96
96
|
$(document).ready(function () {
|
97
|
-
$.getJSON('data.json', function (
|
98
|
-
|
97
|
+
$.getJSON('data.json', function (data) {
|
98
|
+
$('div.title').text(data.title);
|
99
|
+
$.each(data.requests, function (i, request) {
|
99
100
|
add_methods_to_request(request);
|
100
101
|
});
|
101
102
|
|
102
|
-
create_requests_table(requests);
|
103
|
+
create_requests_table(data.requests);
|
103
104
|
});
|
104
105
|
|
105
106
|
var font_size = getParameterByName('font-size');
|
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.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: hashie
|
16
|
+
requirement: &70140410978900 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 2.0.5
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70140410978900
|
14
25
|
- !ruby/object:Gem::Dependency
|
15
26
|
name: json
|
16
|
-
requirement: &
|
27
|
+
requirement: &70140410978420 !ruby/object:Gem::Requirement
|
17
28
|
none: false
|
18
29
|
requirements:
|
19
30
|
- - ~>
|
@@ -21,10 +32,10 @@ dependencies:
|
|
21
32
|
version: 1.7.7
|
22
33
|
type: :runtime
|
23
34
|
prerelease: false
|
24
|
-
version_requirements: *
|
35
|
+
version_requirements: *70140410978420
|
25
36
|
- !ruby/object:Gem::Dependency
|
26
37
|
name: watir-webdriver
|
27
|
-
requirement: &
|
38
|
+
requirement: &70140410977960 !ruby/object:Gem::Requirement
|
28
39
|
none: false
|
29
40
|
requirements:
|
30
41
|
- - ~>
|
@@ -32,10 +43,10 @@ dependencies:
|
|
32
43
|
version: 0.6.4
|
33
44
|
type: :runtime
|
34
45
|
prerelease: false
|
35
|
-
version_requirements: *
|
46
|
+
version_requirements: *70140410977960
|
36
47
|
- !ruby/object:Gem::Dependency
|
37
48
|
name: rack
|
38
|
-
requirement: &
|
49
|
+
requirement: &70140410977500 !ruby/object:Gem::Requirement
|
39
50
|
none: false
|
40
51
|
requirements:
|
41
52
|
- - ~>
|
@@ -43,7 +54,7 @@ dependencies:
|
|
43
54
|
version: 1.5.2
|
44
55
|
type: :runtime
|
45
56
|
prerelease: false
|
46
|
-
version_requirements: *
|
57
|
+
version_requirements: *70140410977500
|
47
58
|
description:
|
48
59
|
email: matthew-github@matthewriley.name
|
49
60
|
executables:
|
@@ -51,6 +62,8 @@ executables:
|
|
51
62
|
extensions: []
|
52
63
|
extra_rdoc_files: []
|
53
64
|
files:
|
65
|
+
- lib/help-desk-dashboard/config_loader.rb
|
66
|
+
- lib/help-desk-dashboard/extensions.rb
|
54
67
|
- lib/help-desk-dashboard/provider_factory.rb
|
55
68
|
- lib/help-desk-dashboard/providers/service-desk-plus/8.1/provider.rb
|
56
69
|
- lib/help-desk-dashboard/providers/track-it/2003.10.1/navigator.rb
|