lesli_audit 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Rakefile +5 -0
- data/app/assets/config/lesli_audit_manifest.js +38 -0
- data/app/assets/images/lesli_audit/audit-logo.svg +72 -0
- data/app/assets/javascripts/lesli_audit/application.js +3592 -0
- data/app/assets/stylesheets/lesli_audit/application.scss +35 -0
- data/app/assets/stylesheets/lesli_audit/dashboard.scss +0 -0
- data/app/controllers/lesli_audit/analytics_controller.rb +36 -0
- data/app/controllers/lesli_audit/application_controller.rb +4 -0
- data/app/controllers/lesli_audit/dashboards_controller.rb +59 -0
- data/app/helpers/lesli_audit/analytics_helper.rb +4 -0
- data/app/helpers/lesli_audit/application_helper.rb +4 -0
- data/app/helpers/lesli_audit/dashboards_helper.rb +4 -0
- data/app/jobs/lesli_audit/application_job.rb +4 -0
- data/app/mailers/lesli_audit/application_mailer.rb +6 -0
- data/app/models/lesli_audit/analytic.rb +4 -0
- data/app/models/lesli_audit/application_record.rb +5 -0
- data/app/models/lesli_audit/dashboard.rb +4 -0
- data/app/services/lesli_audit/account/activity_services.rb +69 -0
- data/app/services/lesli_audit/analytic_service.rb +151 -0
- data/app/services/lesli_audit/analytics/trend_services.rb +84 -0
- data/app/services/lesli_audit/analytics/visitor_service.rb +166 -0
- data/app/services/lesli_audit/request_services.rb +71 -0
- data/app/services/lesli_audit/users/activity_services.rb +61 -0
- data/app/services/lesli_audit/users/log_services.rb +62 -0
- data/app/services/lesli_audit/users/registration_services.rb +62 -0
- data/app/services/lesli_audit/users/role_services.rb +61 -0
- data/app/services/lesli_audit/users/working_hour_services.rb +78 -0
- data/app/views/lesli_audit/analytics/_analytic.html.erb +2 -0
- data/app/views/lesli_audit/analytics/_form.html.erb +17 -0
- data/app/views/lesli_audit/analytics/edit.html.erb +10 -0
- data/app/views/lesli_audit/analytics/index.html.erb +1 -0
- data/app/views/lesli_audit/analytics/new.html.erb +9 -0
- data/app/views/lesli_audit/analytics/show.html.erb +10 -0
- data/app/views/lesli_audit/dashboards/_dashboard.html.erb +2 -0
- data/app/views/lesli_audit/dashboards/_form.html.erb +17 -0
- data/app/views/lesli_audit/dashboards/edit.html.erb +10 -0
- data/app/views/lesli_audit/dashboards/index.html.erb +14 -0
- data/app/views/lesli_audit/dashboards/new.html.erb +9 -0
- data/app/views/lesli_audit/dashboards/show.html.erb +1 -0
- data/app/views/lesli_audit/partials/_engine-navigation.html.erb +39 -0
- data/config/routes.rb +45 -0
- data/db/migrate/v1.0/0803000110_create_lesli_audit_accounts.rb +42 -0
- data/db/migrate/v1.0/0803050110_create_lesli_audit_dashboards.rb +51 -0
- data/db/migrate/v1.0/0803050210_create_lesli_audit_dashboard_components.rb +53 -0
- data/lib/lesli_audit/engine.rb +18 -0
- data/lib/lesli_audit/version.rb +3 -0
- data/lib/lesli_audit.rb +6 -0
- data/lib/tasks/lesli_audit_tasks.rake +4 -0
- data/lib/vue/application.js +102 -0
- data/lib/vue/apps/accounts/activities.vue +48 -0
- data/lib/vue/apps/analytics/index.vue +18 -0
- data/lib/vue/apps/analytics/requests.vue +67 -0
- data/lib/vue/apps/analytics/trends.vue +149 -0
- data/lib/vue/apps/analytics/visitors.vue +91 -0
- data/lib/vue/apps/requests/index.vue +123 -0
- data/lib/vue/apps/security/passwords.vue +52 -0
- data/lib/vue/apps/security/sessions.vue +63 -0
- data/lib/vue/apps/users/activities.vue +49 -0
- data/lib/vue/apps/users/logs.vue +49 -0
- data/lib/vue/apps/users/registrations.vue +98 -0
- data/lib/vue/apps/users/roles.vue +70 -0
- data/lib/vue/apps/users/workingHours.vue +52 -0
- data/lib/vue/stores/accounts/activities.js +87 -0
- data/lib/vue/stores/analytics/visitors.js +130 -0
- data/lib/vue/stores/request.js +70 -0
- data/lib/vue/stores/security/password.js +75 -0
- data/lib/vue/stores/security/session.js +78 -0
- data/lib/vue/stores/users/activities.js +76 -0
- data/lib/vue/stores/users/logs.js +74 -0
- data/lib/vue/stores/users/registrations.js +61 -0
- data/lib/vue/stores/users/roles.js +52 -0
- data/lib/vue/stores/users/working_hours.js +92 -0
- data/license +674 -0
- data/readme.md +120 -0
- metadata +134 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
|
|
3
|
+
Lesli
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
|
6
|
+
|
|
7
|
+
This program is free software: you can redistribute it and/or modify
|
|
8
|
+
it under the terms of the GNU General Public License as published by
|
|
9
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
(at your option) any later version.
|
|
11
|
+
|
|
12
|
+
This program is distributed in the hope that it will be useful,
|
|
13
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
GNU General Public License for more details.
|
|
16
|
+
|
|
17
|
+
You should have received a copy of the GNU General Public License
|
|
18
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
|
19
|
+
|
|
20
|
+
Lesli · Ruby on Rails SaaS development platform.
|
|
21
|
+
|
|
22
|
+
Made with ♥ by https://www.lesli.tech
|
|
23
|
+
Building a better future, one line of code at a time.
|
|
24
|
+
|
|
25
|
+
@contact hello@lesli.tech
|
|
26
|
+
@website https://www.lesli.tech
|
|
27
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
|
28
|
+
|
|
29
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
|
30
|
+
// ·
|
|
31
|
+
=end
|
|
32
|
+
|
|
33
|
+
module CloudAudit
|
|
34
|
+
class RequestServices < ApplicationLesliServices
|
|
35
|
+
|
|
36
|
+
# @overwrite
|
|
37
|
+
# @return {Hash} Paginated list of the records
|
|
38
|
+
# @param {query} Has of the formated queries/filters that will be applied to filter data
|
|
39
|
+
# @description
|
|
40
|
+
# @example
|
|
41
|
+
def index
|
|
42
|
+
search_string = nil # query[:search].downcase.gsub(" ","%") unless query[:search].blank?
|
|
43
|
+
order_string = "user_requests.created_at"
|
|
44
|
+
|
|
45
|
+
user_requests = current_user.account.users.joins(:requests)
|
|
46
|
+
#user_requests = user_requests.where("users.email = ?", query[:filters][:user]) unless query[:filters][:user].blank?
|
|
47
|
+
|
|
48
|
+
if !search_string.blank?
|
|
49
|
+
# user_requests = user_requests.where([
|
|
50
|
+
# "lower(users.email) like :search_string",
|
|
51
|
+
# "lower(request_controller) like :search_string",
|
|
52
|
+
# "lower(request_action) like :search_string"
|
|
53
|
+
# ].join(" or "), {
|
|
54
|
+
# search_string: "%#{search_string}%"
|
|
55
|
+
# })
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
user_requests.select(
|
|
59
|
+
:id,
|
|
60
|
+
"users.id as user_id",
|
|
61
|
+
"users.email",
|
|
62
|
+
:request_controller,
|
|
63
|
+
:request_action,
|
|
64
|
+
:request_method,
|
|
65
|
+
:user_session_id,
|
|
66
|
+
Date2.new.date_time.db_timestamps("user_requests")
|
|
67
|
+
).page(query[:pagination][:page])
|
|
68
|
+
.per(query[:pagination][:perPage])
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
|
|
3
|
+
Lesli
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
|
6
|
+
|
|
7
|
+
This program is free software: you can redistribute it and/or modify
|
|
8
|
+
it under the terms of the GNU General Public License as published by
|
|
9
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
(at your option) any later version.
|
|
11
|
+
|
|
12
|
+
This program is distributed in the hope that it will be useful,
|
|
13
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
GNU General Public License for more details.
|
|
16
|
+
|
|
17
|
+
You should have received a copy of the GNU General Public License
|
|
18
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
|
19
|
+
|
|
20
|
+
Lesli · Ruby on Rails SaaS development platform.
|
|
21
|
+
|
|
22
|
+
Made with ♥ by https://www.lesli.tech
|
|
23
|
+
Building a better future, one line of code at a time.
|
|
24
|
+
|
|
25
|
+
@contact hello@lesli.tech
|
|
26
|
+
@website https://www.lesli.tech
|
|
27
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
|
28
|
+
|
|
29
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
|
30
|
+
// ·
|
|
31
|
+
=end
|
|
32
|
+
|
|
33
|
+
module CloudAudit
|
|
34
|
+
class Users::ActivityServices < ApplicationLesliServices
|
|
35
|
+
|
|
36
|
+
# @overwrite
|
|
37
|
+
# @return {Hash} Paginated list of the records
|
|
38
|
+
# @param {query} Has of the formated queries/filters that will be applied to filter data
|
|
39
|
+
# @description
|
|
40
|
+
# @example
|
|
41
|
+
def index
|
|
42
|
+
#search_string = query[:search].downcase.gsub(" ","%") unless query[:search].blank?
|
|
43
|
+
|
|
44
|
+
activities = ::User::Activity.joins(:user)
|
|
45
|
+
#activities = activities.where("users.email = ?", query[:filters][:user]) unless query[:filters][:user].blank?
|
|
46
|
+
#activities = activities.where("field_name like :search or value_from like :search or value_to like: search", { search: "%#{search_string}%"}) unless search_string.blank?
|
|
47
|
+
activities = activities.select(
|
|
48
|
+
"users.email",
|
|
49
|
+
"users.id",
|
|
50
|
+
:field_name,
|
|
51
|
+
:value_from,
|
|
52
|
+
:value_to,
|
|
53
|
+
:category,
|
|
54
|
+
Date2.new.date_time.db_timestamps("user_activities")
|
|
55
|
+
)
|
|
56
|
+
.page(query[:pagination][:page])
|
|
57
|
+
.per(query[:pagination][:perPage])
|
|
58
|
+
.order(created_at: :desc)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
|
|
3
|
+
Lesli
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
|
6
|
+
|
|
7
|
+
This program is free software: you can redistribute it and/or modify
|
|
8
|
+
it under the terms of the GNU General Public License as published by
|
|
9
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
(at your option) any later version.
|
|
11
|
+
|
|
12
|
+
This program is distributed in the hope that it will be useful,
|
|
13
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
GNU General Public License for more details.
|
|
16
|
+
|
|
17
|
+
You should have received a copy of the GNU General Public License
|
|
18
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
|
19
|
+
|
|
20
|
+
Lesli · Ruby on Rails SaaS development platform.
|
|
21
|
+
|
|
22
|
+
Made with ♥ by https://www.lesli.tech
|
|
23
|
+
Building a better future, one line of code at a time.
|
|
24
|
+
|
|
25
|
+
@contact hello@lesli.tech
|
|
26
|
+
@website https://www.lesli.tech
|
|
27
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
|
28
|
+
|
|
29
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
|
30
|
+
// ·
|
|
31
|
+
=end
|
|
32
|
+
|
|
33
|
+
module CloudAudit
|
|
34
|
+
class Users::LogServices < ApplicationLesliServices
|
|
35
|
+
|
|
36
|
+
# @overwrite
|
|
37
|
+
# @return {Hash} Paginated list of the records
|
|
38
|
+
# @param {query} Has of the formated queries/filters that will be applied to filter data
|
|
39
|
+
# @description
|
|
40
|
+
# @example
|
|
41
|
+
def index
|
|
42
|
+
search_string = query[:search].downcase.gsub(" ","%") unless query[:search].blank?
|
|
43
|
+
|
|
44
|
+
records = current_user.account.users.joins(:logs)
|
|
45
|
+
#records = records.where("users.email = ?", query[:filters][:user]) unless query[:filters][:user].blank?
|
|
46
|
+
records = records.where("title like :search or description like :search", { search: "%#{search_string}%"}) unless search_string.blank?
|
|
47
|
+
records = records.select(
|
|
48
|
+
:id,
|
|
49
|
+
"users.id as user_id",
|
|
50
|
+
"users.email",
|
|
51
|
+
:title,
|
|
52
|
+
:description,
|
|
53
|
+
Date2.new.date_time.db_timestamps("user_logs")
|
|
54
|
+
)
|
|
55
|
+
.page(query[:pagination][:page])
|
|
56
|
+
.per(query[:pagination][:perPage])
|
|
57
|
+
.order("user_logs.created_at DESC")
|
|
58
|
+
|
|
59
|
+
records
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
|
|
3
|
+
Lesli
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
|
6
|
+
|
|
7
|
+
This program is free software: you can redistribute it and/or modify
|
|
8
|
+
it under the terms of the GNU General Public License as published by
|
|
9
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
(at your option) any later version.
|
|
11
|
+
|
|
12
|
+
This program is distributed in the hope that it will be useful,
|
|
13
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
GNU General Public License for more details.
|
|
16
|
+
|
|
17
|
+
You should have received a copy of the GNU General Public License
|
|
18
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
|
19
|
+
|
|
20
|
+
Lesli · Ruby on Rails SaaS development platform.
|
|
21
|
+
|
|
22
|
+
Made with ♥ by https://www.lesli.tech
|
|
23
|
+
Building a better future, one line of code at a time.
|
|
24
|
+
|
|
25
|
+
@contact hello@lesli.tech
|
|
26
|
+
@website https://www.lesli.tech
|
|
27
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
|
28
|
+
|
|
29
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
|
30
|
+
// ·
|
|
31
|
+
=end
|
|
32
|
+
|
|
33
|
+
module CloudAudit
|
|
34
|
+
class Users::RegistrationServices < ApplicationLesliServices
|
|
35
|
+
|
|
36
|
+
# @overwrite
|
|
37
|
+
# @return {Hash} Paginated list of the records
|
|
38
|
+
# @param {query} Has of the formated queries/filters that will be applied to filter data
|
|
39
|
+
# @description
|
|
40
|
+
# @example
|
|
41
|
+
def index
|
|
42
|
+
period = 'month'
|
|
43
|
+
#Get filters from http request
|
|
44
|
+
group = query[:group]
|
|
45
|
+
#Get period only if the request have filters
|
|
46
|
+
unless group.blank?
|
|
47
|
+
period = group
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
unless period.blank? || (period != 'day' && period != 'week' && period != 'month' && period != 'year')
|
|
51
|
+
registrations = current_user.account.users.group("DATE_TRUNC('#{period}', created_at)")
|
|
52
|
+
registrations.order("date_trunc_#{period}_created_at DESC").count.map do |request|
|
|
53
|
+
{
|
|
54
|
+
:date => Date2.new(request[0]).date.to_s,
|
|
55
|
+
:count => request[1]
|
|
56
|
+
}
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
|
|
3
|
+
Lesli
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
|
6
|
+
|
|
7
|
+
This program is free software: you can redistribute it and/or modify
|
|
8
|
+
it under the terms of the GNU General Public License as published by
|
|
9
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
(at your option) any later version.
|
|
11
|
+
|
|
12
|
+
This program is distributed in the hope that it will be useful,
|
|
13
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
GNU General Public License for more details.
|
|
16
|
+
|
|
17
|
+
You should have received a copy of the GNU General Public License
|
|
18
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
|
19
|
+
|
|
20
|
+
Lesli · Ruby on Rails SaaS development platform.
|
|
21
|
+
|
|
22
|
+
Made with ♥ by https://www.lesli.tech
|
|
23
|
+
Building a better future, one line of code at a time.
|
|
24
|
+
|
|
25
|
+
@contact hello@lesli.tech
|
|
26
|
+
@website https://www.lesli.tech
|
|
27
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
|
28
|
+
|
|
29
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
|
30
|
+
// ·
|
|
31
|
+
=end
|
|
32
|
+
|
|
33
|
+
module CloudAudit
|
|
34
|
+
class Users::RoleServices < ApplicationLesliServices
|
|
35
|
+
|
|
36
|
+
# @overwrite
|
|
37
|
+
# @return {Hash} Paginated list of the records
|
|
38
|
+
# @param {query} Has of the formated queries/filters that will be applied to filter data
|
|
39
|
+
# @description
|
|
40
|
+
# @example
|
|
41
|
+
def index
|
|
42
|
+
current_user.account.roles
|
|
43
|
+
.joins("
|
|
44
|
+
inner join (
|
|
45
|
+
select
|
|
46
|
+
role_id,
|
|
47
|
+
count(1) as users
|
|
48
|
+
from user_roles ur
|
|
49
|
+
group by role_id
|
|
50
|
+
) ur
|
|
51
|
+
on ur.role_id = roles.id "
|
|
52
|
+
).select(
|
|
53
|
+
"roles.id",
|
|
54
|
+
"roles.name",
|
|
55
|
+
"roles.active",
|
|
56
|
+
"roles.object_level_permission",
|
|
57
|
+
"ur.users"
|
|
58
|
+
)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
|
|
3
|
+
Lesli
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
|
6
|
+
|
|
7
|
+
This program is free software: you can redistribute it and/or modify
|
|
8
|
+
it under the terms of the GNU General Public License as published by
|
|
9
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
(at your option) any later version.
|
|
11
|
+
|
|
12
|
+
This program is distributed in the hope that it will be useful,
|
|
13
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
GNU General Public License for more details.
|
|
16
|
+
|
|
17
|
+
You should have received a copy of the GNU General Public License
|
|
18
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
|
19
|
+
|
|
20
|
+
Lesli · Ruby on Rails SaaS development platform.
|
|
21
|
+
|
|
22
|
+
Made with ♥ by https://www.lesli.tech
|
|
23
|
+
Building a better future, one line of code at a time.
|
|
24
|
+
|
|
25
|
+
@contact hello@lesli.tech
|
|
26
|
+
@website https://www.lesli.tech
|
|
27
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
|
28
|
+
|
|
29
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
|
30
|
+
// ·
|
|
31
|
+
=end
|
|
32
|
+
|
|
33
|
+
module CloudAudit
|
|
34
|
+
class Users::WorkingHourServices < ApplicationLesliServices
|
|
35
|
+
|
|
36
|
+
# @overwrite
|
|
37
|
+
# @return {Hash} Paginated list of the records
|
|
38
|
+
# @param {query} Has of the formated queries/filters that will be applied to filter data
|
|
39
|
+
# @description
|
|
40
|
+
# @example
|
|
41
|
+
def index
|
|
42
|
+
|
|
43
|
+
#Get string for search query
|
|
44
|
+
search_string = query[:search].downcase.gsub(" ","%") unless query[:search].blank?
|
|
45
|
+
|
|
46
|
+
#Order by column in table of users
|
|
47
|
+
order_string = "date"
|
|
48
|
+
unless query.dig(:order, :by).blank?
|
|
49
|
+
order_string = query.dig(:order, :by)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
user_requests = current_user.account.users.joins(:requests).joins(:roles)
|
|
53
|
+
|
|
54
|
+
user_requests = user_requests.select(
|
|
55
|
+
:id,
|
|
56
|
+
"users.id as userid",
|
|
57
|
+
"users.email",
|
|
58
|
+
"DATE_TRUNC('day', user_requests.created_at) as date",
|
|
59
|
+
"min(user_requests.created_at) as first_activity",
|
|
60
|
+
"max(user_requests.created_at) as last_activity",
|
|
61
|
+
"roles.name"
|
|
62
|
+
).order(order_string.concat(" ").concat(query.dig(:order, :dir)))
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
user_requests = user_requests.group(:userid, "DATE_TRUNC('day', user_requests.created_at)", "roles.name")
|
|
66
|
+
|
|
67
|
+
unless search_string.blank?
|
|
68
|
+
user_requests = user_requests.where([
|
|
69
|
+
"lower(users.email) like :search_string or lower(roles.name) like :search_string",
|
|
70
|
+
].join(" or "), {
|
|
71
|
+
search_string: "%#{search_string}%"
|
|
72
|
+
})
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
user_requests
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<%= form_with(model: analytic) do |form| %>
|
|
2
|
+
<% if analytic.errors.any? %>
|
|
3
|
+
<div style="color: red">
|
|
4
|
+
<h2><%= pluralize(analytic.errors.count, "error") %> prohibited this analytic from being saved:</h2>
|
|
5
|
+
|
|
6
|
+
<ul>
|
|
7
|
+
<% analytic.errors.each do |error| %>
|
|
8
|
+
<li><%= error.full_message %></li>
|
|
9
|
+
<% end %>
|
|
10
|
+
</ul>
|
|
11
|
+
</div>
|
|
12
|
+
<% end %>
|
|
13
|
+
|
|
14
|
+
<div>
|
|
15
|
+
<%= form.submit %>
|
|
16
|
+
</div>
|
|
17
|
+
<% end %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<router-view></router-view>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<p style="color: green"><%= notice %></p>
|
|
2
|
+
|
|
3
|
+
<%= render @analytic %>
|
|
4
|
+
|
|
5
|
+
<div>
|
|
6
|
+
<%= link_to "Edit this analytic", edit_analytic_path(@analytic) %> |
|
|
7
|
+
<%= link_to "Back to analytics", analytics_path %>
|
|
8
|
+
|
|
9
|
+
<%= button_to "Destroy this analytic", @analytic, method: :delete %>
|
|
10
|
+
</div>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<%= form_with(model: dashboard) do |form| %>
|
|
2
|
+
<% if dashboard.errors.any? %>
|
|
3
|
+
<div style="color: red">
|
|
4
|
+
<h2><%= pluralize(dashboard.errors.count, "error") %> prohibited this dashboard from being saved:</h2>
|
|
5
|
+
|
|
6
|
+
<ul>
|
|
7
|
+
<% dashboard.errors.each do |error| %>
|
|
8
|
+
<li><%= error.full_message %></li>
|
|
9
|
+
<% end %>
|
|
10
|
+
</ul>
|
|
11
|
+
</div>
|
|
12
|
+
<% end %>
|
|
13
|
+
|
|
14
|
+
<div>
|
|
15
|
+
<%= form.submit %>
|
|
16
|
+
</div>
|
|
17
|
+
<% end %>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<p style="color: green"><%= notice %></p>
|
|
2
|
+
|
|
3
|
+
<h1>Dashboards</h1>
|
|
4
|
+
|
|
5
|
+
<div id="dashboards">
|
|
6
|
+
<% @dashboards.each do |dashboard| %>
|
|
7
|
+
<%= render dashboard %>
|
|
8
|
+
<p>
|
|
9
|
+
<%= link_to "Show this dashboard", dashboard %>
|
|
10
|
+
</p>
|
|
11
|
+
<% end %>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<%= link_to "New dashboard", new_dashboard_path %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<router-view></router-view>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<%
|
|
2
|
+
=begin
|
|
3
|
+
|
|
4
|
+
Lesli
|
|
5
|
+
|
|
6
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
|
7
|
+
|
|
8
|
+
This program is free software: you can redistribute it and/or modify
|
|
9
|
+
it under the terms of the GNU General Public License as published by
|
|
10
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
(at your option) any later version.
|
|
12
|
+
|
|
13
|
+
This program is distributed in the hope that it will be useful,
|
|
14
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
GNU General Public License for more details.
|
|
17
|
+
|
|
18
|
+
You should have received a copy of the GNU General Public License
|
|
19
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
|
20
|
+
|
|
21
|
+
Lesli · Ruby on Rails SaaS development platform.
|
|
22
|
+
|
|
23
|
+
Made with ♥ by https://www.lesli.tech
|
|
24
|
+
Building a better future, one line of code at a time.
|
|
25
|
+
|
|
26
|
+
@contact hello@lesli.tech
|
|
27
|
+
@website https://www.lesli.tech
|
|
28
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
|
29
|
+
|
|
30
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
|
31
|
+
// ·
|
|
32
|
+
=end
|
|
33
|
+
%>
|
|
34
|
+
|
|
35
|
+
<%= navigation_item(lesli_audit.dashboard_path, "Dashboard", "ri-dashboard-3-line"); %>
|
|
36
|
+
<%= navigation_item(lesli_audit.dashboard_path, "Users", "ri-team-line"); %>
|
|
37
|
+
<%= navigation_item(lesli_audit.analytics_path, "Analytics", "ri-pie-chart-line"); %>
|
|
38
|
+
<%= navigation_item(lesli_audit.dashboard_path, "Account", "ri-briefcase-line"); %>
|
|
39
|
+
<%= navigation_item(lesli_audit.dashboard_path, "Requests", "ri-arrow-left-right-fill"); %>
|
data/config/routes.rb
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
|
|
3
|
+
Lesli
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
|
6
|
+
|
|
7
|
+
This program is free software: you can redistribute it and/or modify
|
|
8
|
+
it under the terms of the GNU General Public License as published by
|
|
9
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
(at your option) any later version.
|
|
11
|
+
|
|
12
|
+
This program is distributed in the hope that it will be useful,
|
|
13
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
GNU General Public License for more details.
|
|
16
|
+
|
|
17
|
+
You should have received a copy of the GNU General Public License
|
|
18
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
|
19
|
+
|
|
20
|
+
Lesli · Ruby on Rails SaaS Development Framework.
|
|
21
|
+
|
|
22
|
+
Made with ♥ by https://www.lesli.tech
|
|
23
|
+
Building a better future, one line of code at a time.
|
|
24
|
+
|
|
25
|
+
@contact hello@lesli.tech
|
|
26
|
+
@website https://www.lesli.tech
|
|
27
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
|
28
|
+
|
|
29
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
|
30
|
+
// ·
|
|
31
|
+
=end
|
|
32
|
+
|
|
33
|
+
LesliAudit::Engine.routes.draw do
|
|
34
|
+
root to: "dashboards#show"
|
|
35
|
+
resource :dashboard, only: [:show]
|
|
36
|
+
resources :analytics, only: [:index] do
|
|
37
|
+
collection do
|
|
38
|
+
get :trends
|
|
39
|
+
get :visitors
|
|
40
|
+
get :controllers
|
|
41
|
+
get :devices
|
|
42
|
+
get :users
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
|
|
3
|
+
Lesli
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
|
6
|
+
|
|
7
|
+
This program is free software: you can redistribute it and/or modify
|
|
8
|
+
it under the terms of the GNU General Public License as published by
|
|
9
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
(at your option) any later version.
|
|
11
|
+
|
|
12
|
+
This program is distributed in the hope that it will be useful,
|
|
13
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
GNU General Public License for more details.
|
|
16
|
+
|
|
17
|
+
You should have received a copy of the GNU General Public License
|
|
18
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
|
19
|
+
|
|
20
|
+
Lesli · Ruby on Rails SaaS Development Framework.
|
|
21
|
+
|
|
22
|
+
Made with ♥ by https://www.lesli.tech
|
|
23
|
+
Building a better future, one line of code at a time.
|
|
24
|
+
|
|
25
|
+
@contact hello@lesli.tech
|
|
26
|
+
@website https://www.lesli.tech
|
|
27
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
|
28
|
+
|
|
29
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
|
30
|
+
// ·
|
|
31
|
+
=end
|
|
32
|
+
|
|
33
|
+
class CreateLesliAuditAccounts < ActiveRecord::Migration[6.0]
|
|
34
|
+
def change
|
|
35
|
+
create_table :lesli_audit_accounts do |t|
|
|
36
|
+
t.integer :status
|
|
37
|
+
t.datetime :deleted_at, index: true
|
|
38
|
+
t.timestamps
|
|
39
|
+
end
|
|
40
|
+
add_reference(:lesli_audit_accounts, :account, foreign_key: { to_table: :lesli_accounts })
|
|
41
|
+
end
|
|
42
|
+
end
|