vue_delayed_job_dashboard 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.babelrc +5 -0
- data/.gitignore +10 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +21 -0
- data/README.md +40 -0
- data/Rakefile +6 -0
- data/b02bdc1b846fd65473922f5f62832108.ttf +0 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/d2f69a92faa6fe990d2e613c358be705.woff +0 -0
- data/delayed_job_dashboard.gemspec +25 -0
- data/lib/delayed_job_dashboard/version.rb +3 -0
- data/lib/delayed_job_dashboard/web/app.rb +62 -0
- data/lib/delayed_job_dashboard/web/priv/App.vue +52 -0
- data/lib/delayed_job_dashboard/web/priv/JobsList.vue +144 -0
- data/lib/delayed_job_dashboard/web/priv/app.js +14 -0
- data/lib/delayed_job_dashboard/web/public/b02bdc1b846fd65473922f5f62832108.ttf +0 -0
- data/lib/delayed_job_dashboard/web/public/bundle.js +63960 -0
- data/lib/delayed_job_dashboard/web/public/d2f69a92faa6fe990d2e613c358be705.woff +0 -0
- data/lib/delayed_job_dashboard/web/views/enqueued.haml +0 -0
- data/lib/delayed_job_dashboard/web/views/error.haml +2 -0
- data/lib/delayed_job_dashboard/web/views/failed.haml +1 -0
- data/lib/delayed_job_dashboard/web/views/layout.haml +16 -0
- data/lib/delayed_job_dashboard/web/views/overview.haml +1 -0
- data/lib/delayed_job_dashboard/web/views/pending.haml +1 -0
- data/lib/delayed_job_dashboard/web/views/working.haml +1 -0
- data/lib/delayed_job_dashboard.rb +2 -0
- data/package.json +29 -0
- data/webpack.config.js +34 -0
- metadata +118 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a703d267c0397ca9874e4b226e57492f78922c02
|
4
|
+
data.tar.gz: f9ab6da27b371a49c7a8798697f270064aaf41f6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: afef016a91be0eb1d1330186c5dd7688541b81d7b27f647ffaf15073d7034f63505d6862433c52eb8de6d18a9668ef3f48b0083e6bab268c84ac554141c096ab
|
7
|
+
data.tar.gz: c0cb4c1807165ee46c1003b979416efbe2d58d695e1e458c466378933ce8e3bfb579151805953599390431e17854f24ef5008411a1fe0a034a86223e1ed41df6
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at long.polyglot@gmail.com. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Long Nguyen
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# DelayedJobDashboard (Under development)
|
2
|
+
|
3
|
+
![screenshot1](https://cloud.githubusercontent.com/assets/2282642/24837740/2de53704-1d65-11e7-89dc-8d8fe85e093f.png)
|
4
|
+
|
5
|
+
![screenshot2](https://cloud.githubusercontent.com/assets/2282642/24837741/309915e2-1d65-11e7-92fa-239a729709f7.png)
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'vue_delayed_job_dashboard'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install vue_delayed_job_dashboard
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/delayed_job_dashboard. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
+
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
Binary file
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "delayed_job_dashboard"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
Binary file
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'delayed_job_dashboard/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "vue_delayed_job_dashboard"
|
8
|
+
spec.version = DelayedJobDashboard::VERSION
|
9
|
+
spec.authors = ["Long Nguyen"]
|
10
|
+
spec.email = ["long.polyglot@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Modern DelayedJob Dashboard}
|
13
|
+
spec.description = %q{Modern DelayedJob Dashboard built with VueJS and Sinatra.}
|
14
|
+
spec.homepage = "https://github.com/kimquy/delayed_job_dashboard"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
25
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'sinatra/base'
|
2
|
+
|
3
|
+
module DelayedJobDashboard
|
4
|
+
class WebApplication < Sinatra::Base
|
5
|
+
set :root, File.dirname(__FILE__)
|
6
|
+
set :static, true
|
7
|
+
set :public_folder, File.expand_path('../public', __FILE__)
|
8
|
+
set :views, File.expand_path('../views', __FILE__)
|
9
|
+
|
10
|
+
get "/" do
|
11
|
+
redirect "/delayed_job/overview"
|
12
|
+
end
|
13
|
+
|
14
|
+
get '/overview' do
|
15
|
+
if defined?(Delayed::Job)
|
16
|
+
haml :overview, escape_html: false
|
17
|
+
else
|
18
|
+
@message = "Delayed::Job is not available"
|
19
|
+
haml :error
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
get '/enqueued' do
|
24
|
+
haml :enqueued, escape_html: false
|
25
|
+
end
|
26
|
+
|
27
|
+
get '/pending' do
|
28
|
+
haml :pending, escape_html: false
|
29
|
+
end
|
30
|
+
|
31
|
+
get '/failed' do
|
32
|
+
haml :failed, escape_html: false
|
33
|
+
end
|
34
|
+
|
35
|
+
get '/working' do
|
36
|
+
haml :working, escape_html: false
|
37
|
+
end
|
38
|
+
|
39
|
+
get '/jobs.json' do
|
40
|
+
content_type :json
|
41
|
+
|
42
|
+
case params["filter"]
|
43
|
+
when "pending"
|
44
|
+
@jobs = Delayed::Job.where(locked_at: nil, attempts: 0).order(created_at: :desc)
|
45
|
+
when "failed"
|
46
|
+
@jobs = Delayed::Job.where.not(failed_at: nil).order(created_at: :desc)
|
47
|
+
when "working"
|
48
|
+
@jobs = Delayed::Job.where.not(locked_at: nil).order(created_at: :desc)
|
49
|
+
when "enqueued"
|
50
|
+
@jobs = Delayed::Job.order(created_at: :desc)
|
51
|
+
end
|
52
|
+
|
53
|
+
@jobs = Delayed::Job.order(created_at: :desc) if @jobs.nil?
|
54
|
+
|
55
|
+
@jobs_json = @jobs.as_json
|
56
|
+
@jobs_json.each_with_index do |job, index|
|
57
|
+
job["payload_object"] = @jobs[index].payload_object
|
58
|
+
end
|
59
|
+
@jobs_json.to_json
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
<template>
|
2
|
+
<el-row>
|
3
|
+
<el-menu theme="dark" :default-active="activeIndex" class="el-menu-demo" mode="horizontal">
|
4
|
+
<el-menu-item index="1"><a href="/delayed_job/overview">DELAYED JOB DASHBOARD</a></el-menu-item>
|
5
|
+
<el-menu-item index="2"><a href="/delayed_job/enqueued">Enqueued</a></el-menu-item>
|
6
|
+
<el-menu-item index="3"><a href="/delayed_job/working">Working</a></el-menu-item>
|
7
|
+
<el-menu-item index="4"><a href="/delayed_job/pending">Pending</a></el-menu-item>
|
8
|
+
<el-menu-item index="5"><a href="/delayed_job/failed">Failed</a></el-menu-item>
|
9
|
+
</el-menu>
|
10
|
+
|
11
|
+
<el-col :span="24">
|
12
|
+
<jobs-list></jobs-list>
|
13
|
+
</el-col>
|
14
|
+
</el-row>
|
15
|
+
</template>
|
16
|
+
|
17
|
+
<script>
|
18
|
+
import JobsList from './JobsList.vue'
|
19
|
+
|
20
|
+
export default {
|
21
|
+
data () {
|
22
|
+
return {
|
23
|
+
activeIndex: '1'
|
24
|
+
}
|
25
|
+
},
|
26
|
+
|
27
|
+
created () {
|
28
|
+
let path = window.location.pathname;
|
29
|
+
if (path.includes("overview")) {
|
30
|
+
this.activeIndex = '1'
|
31
|
+
} else if (path.includes("enqueued")) {
|
32
|
+
this.activeIndex = '2'
|
33
|
+
} else if (path.includes("working")) {
|
34
|
+
this.activeIndex = '3'
|
35
|
+
} else if (path.includes("pending")) {
|
36
|
+
this.activeIndex = '4'
|
37
|
+
} else if (path.includes("failed")) {
|
38
|
+
this.activeIndex = '5'
|
39
|
+
}
|
40
|
+
},
|
41
|
+
|
42
|
+
components: {
|
43
|
+
jobsList: JobsList
|
44
|
+
}
|
45
|
+
}
|
46
|
+
</script>
|
47
|
+
|
48
|
+
<style scoped>
|
49
|
+
a {
|
50
|
+
text-decoration: none;
|
51
|
+
}
|
52
|
+
</style>
|
@@ -0,0 +1,144 @@
|
|
1
|
+
<template>
|
2
|
+
<div>
|
3
|
+
<el-table
|
4
|
+
:data="jobs"
|
5
|
+
v-loading.body="loading"
|
6
|
+
style="width: 100%">
|
7
|
+
<el-table-column
|
8
|
+
prop="id"
|
9
|
+
label="Job ID">
|
10
|
+
</el-table-column>
|
11
|
+
<el-table-column
|
12
|
+
label="Status">
|
13
|
+
<template scope="scope">
|
14
|
+
<el-tag
|
15
|
+
:type="filterTag(scope.row)">{{filterTagName(scope.row)}}</el-tag>
|
16
|
+
</template>
|
17
|
+
</el-table-column>
|
18
|
+
<el-table-column
|
19
|
+
prop="payload_object"
|
20
|
+
label="Handler"
|
21
|
+
:formatter="formatter"
|
22
|
+
width="400">
|
23
|
+
</el-table-column>
|
24
|
+
<el-table-column
|
25
|
+
prop="priority"
|
26
|
+
label="Priority">
|
27
|
+
</el-table-column>
|
28
|
+
<el-table-column
|
29
|
+
prop="attempts"
|
30
|
+
label="Attempts">
|
31
|
+
</el-table-column>
|
32
|
+
<el-table-column
|
33
|
+
prop="run_at"
|
34
|
+
label="Run At"
|
35
|
+
width="180"
|
36
|
+
:formatter="runAtFormatter">
|
37
|
+
</el-table-column>
|
38
|
+
<el-table-column
|
39
|
+
prop="created_at"
|
40
|
+
label="Created At"
|
41
|
+
:formatter="createdAtFormatter">
|
42
|
+
</el-table-column>
|
43
|
+
|
44
|
+
<el-table-column
|
45
|
+
label="Actions"
|
46
|
+
width="120">
|
47
|
+
<template scope="scope">
|
48
|
+
<el-button type="info" size="mini" @click.native.prevent="handleClickDialog(scope.$index, jobs)">
|
49
|
+
Show
|
50
|
+
</el-button>
|
51
|
+
</template>
|
52
|
+
</el-table-column>
|
53
|
+
</el-table>
|
54
|
+
|
55
|
+
<el-dialog title="Object Payload" v-model="dialogVisible" size="small">
|
56
|
+
<pre>{{jobDetailHandler}}</pre>
|
57
|
+
<span slot="footer" class="dialog-footer">
|
58
|
+
<el-button type="primary" @click="dialogVisible = false">Ok!</el-button>
|
59
|
+
</span>
|
60
|
+
</el-dialog>
|
61
|
+
</div>
|
62
|
+
</template>
|
63
|
+
|
64
|
+
<script>
|
65
|
+
const moment = require('moment');
|
66
|
+
|
67
|
+
export default {
|
68
|
+
props: ["mydata"],
|
69
|
+
data () {
|
70
|
+
return {
|
71
|
+
jobs: [],
|
72
|
+
dialogVisible: false,
|
73
|
+
jobDetailHandler: "",
|
74
|
+
jobDetailId: "",
|
75
|
+
loading: true
|
76
|
+
|
77
|
+
}
|
78
|
+
},
|
79
|
+
created () {
|
80
|
+
let path = window.location.pathname;
|
81
|
+
if (path.includes("pending")) {
|
82
|
+
this.loadJobs({ params: { filter: "pending" } });
|
83
|
+
} else if (path.includes("failed")) {
|
84
|
+
this.loadJobs({ params: { filter: "failed" } });
|
85
|
+
} else if (path.includes("working")) {
|
86
|
+
this.loadJobs({ params: { filter: "working" } });
|
87
|
+
} else if (path.includes("enqueued")) {
|
88
|
+
this.loadJobs({ params: { filter: "enqueued" } });
|
89
|
+
}
|
90
|
+
else {
|
91
|
+
this.loadJobs({ params: {} });
|
92
|
+
}
|
93
|
+
},
|
94
|
+
|
95
|
+
methods: {
|
96
|
+
handleClickDialog(index, jobs){
|
97
|
+
this.jobDetailHandler = jobs[index].payload_object;
|
98
|
+
this.jobDetailId = jobs[index].id;
|
99
|
+
this.dialogVisible = true;
|
100
|
+
},
|
101
|
+
|
102
|
+
formatter(row, column){
|
103
|
+
return row.handler.substring(0,300)
|
104
|
+
},
|
105
|
+
|
106
|
+
filterTag(row){
|
107
|
+
if (row.failed_at !== null) {
|
108
|
+
return "danger"
|
109
|
+
} else if (row.locked_at !== null) {
|
110
|
+
return "warning"
|
111
|
+
} else {
|
112
|
+
return "gray"
|
113
|
+
}
|
114
|
+
},
|
115
|
+
|
116
|
+
filterTagName(row) {
|
117
|
+
if (row.failed_at !== null) {
|
118
|
+
return "Failed"
|
119
|
+
} else if (row.locked_at !== null) {
|
120
|
+
return "Running"
|
121
|
+
} else {
|
122
|
+
return "Queued"
|
123
|
+
}
|
124
|
+
},
|
125
|
+
|
126
|
+
runAtFormatter(row, column){
|
127
|
+
return moment(row.run_at).format('MMMM Do YYYY, h:mm:ss a');
|
128
|
+
},
|
129
|
+
|
130
|
+
createdAtFormatter(row, column){
|
131
|
+
return moment(row.created_at).format('MMMM Do YYYY, h:mm:ss a');
|
132
|
+
},
|
133
|
+
|
134
|
+
loadJobs(queries) {
|
135
|
+
this.$http.get("/delayed_job/jobs.json", queries).then(response => {
|
136
|
+
this.jobs = response.body;
|
137
|
+
this.loading = false;
|
138
|
+
}, response => {
|
139
|
+
this.loading = false;
|
140
|
+
});
|
141
|
+
}
|
142
|
+
}
|
143
|
+
}
|
144
|
+
</script>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import Vue from 'vue'
|
2
|
+
import VueResource from 'vue-resource'
|
3
|
+
import ElementUI from 'element-ui'
|
4
|
+
import App from './App.vue'
|
5
|
+
import 'element-ui/lib/theme-default/index.css'
|
6
|
+
import locale from 'element-ui/lib/locale/lang/en'
|
7
|
+
|
8
|
+
Vue.use(ElementUI, { locale })
|
9
|
+
Vue.use(VueResource)
|
10
|
+
|
11
|
+
new Vue({
|
12
|
+
el: '#main',
|
13
|
+
render: h => h(App)
|
14
|
+
})
|