lesli_audit 0.2.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/lesli_audit/application.js +222 -89
  3. data/app/assets/javascripts/lesli_audit/application.js.LICENSE.txt +327 -0
  4. data/app/controllers/lesli_audit/accounts_controller.rb +60 -0
  5. data/app/controllers/lesli_audit/analytics_controller.rb +0 -4
  6. data/{lib/vue/components/resources.vue → app/controllers/lesli_audit/requests_controller.rb} +18 -45
  7. data/app/controllers/lesli_audit/users_controller.rb +12 -0
  8. data/app/helpers/lesli_audit/accounts_helper.rb +4 -0
  9. data/app/helpers/lesli_audit/requests_helper.rb +4 -0
  10. data/app/helpers/lesli_audit/users_helper.rb +4 -0
  11. data/app/models/lesli_audit/account/request.rb +4 -0
  12. data/app/models/lesli_audit/account.rb +7 -0
  13. data/app/models/lesli_audit/account_request.rb +5 -0
  14. data/app/models/lesli_audit/analytic.rb +2 -2
  15. data/app/models/lesli_audit/request.rb +4 -0
  16. data/app/models/lesli_audit/user.rb +4 -0
  17. data/app/models/lesli_audit/user_request.rb +7 -0
  18. data/app/services/lesli_audit/analytic_service.rb +13 -48
  19. data/app/services/lesli_audit/{request_services.rb → request_service.rb} +14 -3
  20. data/app/views/lesli_audit/accounts/_account.html.erb +2 -0
  21. data/app/views/lesli_audit/accounts/_form.html.erb +17 -0
  22. data/app/views/lesli_audit/accounts/edit.html.erb +10 -0
  23. data/app/views/lesli_audit/accounts/index.html.erb +14 -0
  24. data/app/views/lesli_audit/accounts/new.html.erb +9 -0
  25. data/app/views/lesli_audit/accounts/show.html.erb +10 -0
  26. data/app/views/lesli_audit/partials/_engine-navigation.html.erb +2 -2
  27. data/app/views/lesli_audit/requests/_form.html.erb +17 -0
  28. data/app/views/lesli_audit/requests/_request.html.erb +2 -0
  29. data/app/views/lesli_audit/requests/edit.html.erb +10 -0
  30. data/app/views/lesli_audit/requests/index.html.erb +1 -0
  31. data/app/views/lesli_audit/requests/new.html.erb +9 -0
  32. data/app/views/lesli_audit/requests/show.html.erb +10 -0
  33. data/app/views/lesli_audit/users/_form.html.erb +17 -0
  34. data/app/views/lesli_audit/users/_user.html.erb +2 -0
  35. data/app/views/lesli_audit/users/edit.html.erb +10 -0
  36. data/app/views/lesli_audit/users/index.html.erb +1 -0
  37. data/app/views/lesli_audit/users/new.html.erb +9 -0
  38. data/app/views/lesli_audit/users/show.html.erb +10 -0
  39. data/config/locales/translations.en.yml +5 -0
  40. data/config/locales/translations.es.yml +5 -0
  41. data/config/routes.rb +19 -11
  42. data/db/migrate/v1.0/0803100010_create_lesli_audit_account_requests.rb +44 -0
  43. data/db/migrate/v1.0/0803110010_create_lesli_audit_user_requests.rb +46 -0
  44. data/db/seed/development.rb +31 -24
  45. data/lib/lesli_audit/version.rb +2 -2
  46. data/lib/vue/application.js +8 -6
  47. data/lib/vue/apps/analytics/index.vue +3 -7
  48. data/lib/vue/apps/requests/index.vue +43 -41
  49. data/lib/vue/apps/users/index.vue +31 -0
  50. data/lib/vue/components/requests.vue +2 -6
  51. data/lib/vue/components/visitors.vue +3 -0
  52. data/lib/vue/stores/analytics.js +4 -36
  53. data/lib/vue/stores/request.js +4 -4
  54. data/lib/vue/stores/translations.json +38 -0
  55. data/readme.md +44 -93
  56. metadata +41 -5
@@ -0,0 +1,31 @@
1
+ <script setup>
2
+
3
+ </script>
4
+ <template>
5
+ <lesli-application-container>
6
+ <lesli-columns>
7
+ <lesli-column>
8
+ <lesli-card title="Users registered">
9
+ <p class="number">160</p>
10
+ </lesli-card>
11
+ </lesli-column>
12
+ <lesli-column>
13
+ <lesli-card title="Active roles">
14
+ <p class="number">12</p>
15
+ </lesli-card>
16
+ </lesli-column>
17
+ <lesli-column>
18
+ <lesli-card title="Active descriptors">
19
+ <p class="number">70</p>
20
+ </lesli-card>
21
+ </lesli-column>
22
+ </lesli-columns>
23
+ </lesli-application-container>
24
+ </template>
25
+ <style>
26
+ .number {
27
+ padding: 1rem;
28
+ font-size: 3rem;
29
+ text-align: center;
30
+ }
31
+ </style>
@@ -46,18 +46,14 @@ const storeAnalytics = useAnalytics()
46
46
  <template>
47
47
  <div class="columns">
48
48
  <div class="column">
49
+ <h3>Most active users</h3>
49
50
  <lesli-table
50
51
  :columns="storeAnalytics.users.columns"
51
52
  :records="storeAnalytics.users.records">
52
53
  </lesli-table>
53
54
  </div>
54
55
  <div class="column">
55
- <lesli-table
56
- :columns="storeAnalytics.devices.columns"
57
- :records="storeAnalytics.devices.records">
58
- </lesli-table>
59
- </div>
60
- <div class="column">
56
+ <h3>Most active controllers</h3>
61
57
  <lesli-table
62
58
  :columns="storeAnalytics.controllers.columns"
63
59
  :records="storeAnalytics.controllers.records">
@@ -58,6 +58,9 @@ watch(() => storeAnalytics.visitors.records, () => {
58
58
  series.value = [{
59
59
  name: "Requests",
60
60
  data: storeAnalytics.visitors.records.map(visit => visit.requests)
61
+ }, {
62
+ name: "Resources",
63
+ data: storeAnalytics.visitors.records.map(visit => visit.resources)
61
64
  }]
62
65
  })
63
66
 
@@ -39,23 +39,6 @@ export const useAnalytics = defineStore("analytics", {
39
39
  label: 'Requests'
40
40
  }]
41
41
  },
42
- devices: {
43
- loading: false,
44
- pagination: {},
45
- records: [],
46
- columns: [{
47
- field: 'device',
48
- label: 'Device'
49
- }, {
50
- field: 'visits',
51
- label: 'Visits'
52
- }]
53
- },
54
- resources: {
55
- loading: false,
56
- pagination: {},
57
- records: []
58
- },
59
42
  visitors: {
60
43
  loading: false,
61
44
  pagination: {},
@@ -85,21 +68,15 @@ export const useAnalytics = defineStore("analytics", {
85
68
  fetchVisits() {
86
69
  this.visitors.loading = true
87
70
  this.http.get(this.url.audit("analytics/visitors")).then(result => {
88
- this.visitors.records = result.reverse()
71
+ this.visitors.records = result.map(record => {
72
+ record.date = this.date(record.date).date()
73
+ return record
74
+ }).reverse()
89
75
  }).finally(() => {
90
76
  this.visitors.loading = false
91
77
  })
92
78
  },
93
79
 
94
- fetchResources() {
95
- this.resources.loading = true
96
- this.http.get(this.url.audit("analytics/resourcess")).then(result => {
97
- this.resources.records = result.reverse()
98
- }).finally(() => {
99
- this.resources.loading = false
100
- })
101
- },
102
-
103
80
  fetchUsers() {
104
81
  this.users.loading = true
105
82
  this.http.get(this.url.audit("analytics/users")).then(result => {
@@ -109,15 +86,6 @@ export const useAnalytics = defineStore("analytics", {
109
86
  })
110
87
  },
111
88
 
112
- fetchDevices() {
113
- this.devices.loading = true
114
- this.http.get(this.url.audit("analytics/devices")).then(result => {
115
- this.devices.records = result
116
- }).finally(() => {
117
- this.devices.loading = false
118
- })
119
- },
120
-
121
89
  fetchControllers() {
122
90
  this.controllers.loading = true
123
91
  this.http.get(this.url.audit("analytics/controllers")).then(result => {
@@ -21,7 +21,7 @@ import { defineStore } from "pinia"
21
21
 
22
22
 
23
23
  // ·
24
- export const useLogRequest = defineStore("logRequest", {
24
+ export const useRequests = defineStore("Requests", {
25
25
  state: () => {
26
26
  return {
27
27
  date: "",
@@ -45,13 +45,13 @@ export const useLogRequest = defineStore("logRequest", {
45
45
  this.fetchLogs(this.url.audit("requests").paginate(page), false)
46
46
  },
47
47
 
48
- fetchLogsIfEmpty() {
48
+ fetch() {
49
49
  if (this.records.length <= 0) {
50
- this.fetchLogs()
50
+ this.getRequests()
51
51
  }
52
52
  },
53
53
 
54
- fetchLogs(url=this.url.audit("requests"), loading=true) {
54
+ getRequests(url=this.url.audit("requests"), loading=true) {
55
55
 
56
56
  this.loading = loading
57
57
 
@@ -0,0 +1,38 @@
1
+ {
2
+ "en": {
3
+ "lesli": {
4
+ "shared": {
5
+ "title_lesli": ":lesli.shared.title_lesli:"
6
+ },
7
+ "users": {
8
+ "title_users": "Users"
9
+ }
10
+ },
11
+ "lesli_audit": {
12
+ "shared": {
13
+ "title_lesli": ":lesli.shared.title_lesli:"
14
+ },
15
+ "users": {
16
+ "title_users": "Users"
17
+ }
18
+ }
19
+ },
20
+ "es": {
21
+ "lesli": {
22
+ "shared": {
23
+ "title_lesli": "Lesli en español "
24
+ },
25
+ "users": {
26
+ "title_users": "Usuarios"
27
+ }
28
+ },
29
+ "lesli_audit": {
30
+ "shared": {
31
+ "title_lesli": "Lesli en español "
32
+ },
33
+ "users": {
34
+ "title_users": "Usuarios"
35
+ }
36
+ }
37
+ }
38
+ }
data/readme.md CHANGED
@@ -1,120 +1,71 @@
1
1
  <p align="center">
2
- <img width="200" alt="Lesli logo" src="./app/assets/images/lesli/brand/app-logo.svg" />
2
+ <img width="90" alt="LesliCloud logo" src="./app/assets/images/lesli_audit/audit-logo.svg" />
3
+ <h3 align="center">Administration area for the Lesli Framework.</h3>
3
4
  </p>
4
5
 
5
- <h3 align="center">Ruby on Rails SaaS Development Framework.</h3>
6
-
6
+ <hr/>
7
+ <p align="center">
8
+ <a target="blank" href="https://rubygems.org/gems/lesli_audit">
9
+ <img src="https://badge.fury.io/rb/lesli_audit.svg" alt="Gem Version" height="22">
10
+ </a>
11
+ </p>
7
12
  <hr/>
8
13
 
9
- ## Introduction
10
-
11
- Lesli is a SaaS development framework designed to build highly scalable, secure and customizable software products.
12
-
13
- Built-on top of Ruby on Rails, Postgres, Vuejs, Bulma, SASS and many more awesome open-source libraries, packages, gems and tools.
14
-
15
- Lesli is completely open source and comes with features and tools that can save you years of development effort, additionally, our pre-built modules can seamlessly extend Lesli's functionality, allowing you to build your own SaaS in a matter of minutes.
16
-
17
- <br />
18
- <hr />
19
- <p align="center">
20
- Lesli is currently in alpha, but we're excited about the promising improvements coming soon!
21
- </p>
22
- <hr />
23
- <br />
24
- <br />
25
-
26
- Lesli is officially released and supported as of version 5
27
-
28
- > Lesli goes beyond being just a starter-kit, template, admin panel or dashboard. Lesli is a Ruby on Rails gem that you can use to build modules (a.k.a. engines) and standard Rails applications leveraging its robust set of built-in features, generators, components, and industry standards. With Lesli, you have the flexibility to extend existing functionalities or develop fully customized software tailored to your specific needs.
29
-
30
-
31
- ## Documentation
32
- * [Roadmap](./docs/roadmap.md)
33
- * [Core database](./docs/database.md)
34
- * [Main documentation](https://www.lesli.dev/documentation/)
35
-
36
-
37
- ## Installation
38
-
39
- __Get the latest stable version of Lesli__
40
-
41
- ```ruby
42
- # Gemfile
43
- gem "lesli"
44
- ```
45
-
46
- __Run bundle install:__
47
-
48
- ```shell
49
- bundle install
50
- ```
51
-
52
- __Generate the init files:__
14
+ ### Quick start
53
15
 
54
16
  ```shell
55
- rails g lesli:install
17
+ # Add LesliAudit engine
18
+ bundle add lesli_audit
56
19
  ```
57
20
 
58
- __Load the database and demo data:__
59
-
60
21
  ```shell
61
- rake rake lesli:db:setup
22
+ # Setup database
23
+ rake lesli:db:setup
62
24
  ```
63
25
 
64
- __Run server__
65
- ```shell
66
- rails s # for development
67
- rails s --binding=0.0.0.0 # debug in local network
68
- RAILS_SERVE_STATIC_FILES=true rails s --environment=production # production mode
26
+ ```ruby
27
+ # Load LesliAudit
28
+ Rails.application.routes.draw do
29
+ mount LesliAudit::Engine => "/audit"
30
+ end
69
31
  ```
70
32
 
71
- For more details about the installation check the official [documentation.](https://www.lesli.dev/documentation)
72
-
73
-
74
33
 
75
- ## Development
76
-
77
- __Get the latest version of Lesli source code__
78
-
79
- ```shell
80
- # clone the lesli repo inside your engine folder: RailsApp/engines
81
- git clone https://github.com/LesliTech/Lesli.git
82
- ```
34
+ ### Documentation
35
+ * [website](https://www.lesli.dev/audit/)
36
+ * [database](./docs/database.md)
37
+ * [documentation](https://www.lesli.dev/documentation/)
83
38
 
84
- __Load Lesli as a Gem__
85
- ```ruby
86
- gem "lesli", path: "engines/Lesli"
87
- ```
88
39
 
89
- __Install the necessary Gems to run Lesli:__
40
+ ### Get in touch with Lesli
90
41
 
91
- ```shell
92
- bundle install
93
- ```
42
+ * [Website: https://www.lesli.tech](https://www.lesli.tech)
43
+ * [Email: hello@lesli.tech](hello@lesli.tech)
44
+ * [Twitter: @LesliTech](https://twitter.com/LesliTech)
94
45
 
95
- __Work with the database:__
96
46
 
97
- ```shell
98
- # Hard reset for development:
99
- rake lesli:db:reset
100
- ```
47
+ ### License
48
+ -------
49
+ Copyright (c) 2023, Lesli Technologies, S. A.
101
50
 
102
- __Run server__
103
- ```shell
104
- rails s
105
- rails s --binding=0.0.0.0
106
- rails s --environment=test
107
- rails s --environment=development
108
- RAILS_SERVE_STATIC_FILES=true rails s --environment=production
109
- ```
51
+ This program is free software: you can redistribute it and/or modify
52
+ it under the terms of the GNU General Public License as published by
53
+ the Free Software Foundation, either version 3 of the License, or
54
+ (at your option) any later version.
110
55
 
56
+ This program is distributed in the hope that it will be useful,
57
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
58
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
59
+ GNU General Public License for more details.
111
60
 
112
- ## License
113
- ------
114
- Software developed in [Guatemala](http://visitguatemala.com/) by [LesliTech](https://www.lesli.tech) distributed under the *General Public License v 3.0* you can read the full license [here](http://www.gnu.org/licenses/gpl-3.0.html)
61
+ You should have received a copy of the GNU General Public License
62
+ along with this program. If not, see http://www.gnu.org/licenses/.
115
63
 
116
- <br>
64
+ <hr />
65
+ <br />
117
66
 
118
67
  <p align="center">
119
- <img alt="Lesli logo" width="100" src="./app/assets/images/lesli/brand/app-icon.svg" />
68
+ <img width="200" alt="Lesli logo" src="https://cdn.lesli.tech/lesli/brand/app-logo.svg" />
69
+ <h4 align="center">Ruby on Rails SaaS Development Framework.</h4>
120
70
  </p>
71
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lesli_audit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Lesli Development Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-06 00:00:00.000000000 Z
11
+ date: 2023-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -35,29 +35,48 @@ files:
35
35
  - app/assets/config/lesli_audit_manifest.js
36
36
  - app/assets/images/lesli_audit/audit-logo.svg
37
37
  - app/assets/javascripts/lesli_audit/application.js
38
+ - app/assets/javascripts/lesli_audit/application.js.LICENSE.txt
38
39
  - app/assets/stylesheets/lesli_audit/application.scss
39
40
  - app/assets/stylesheets/lesli_audit/dashboard.scss
41
+ - app/controllers/lesli_audit/accounts_controller.rb
40
42
  - app/controllers/lesli_audit/analytics_controller.rb
41
43
  - app/controllers/lesli_audit/application_controller.rb
42
44
  - app/controllers/lesli_audit/dashboards_controller.rb
45
+ - app/controllers/lesli_audit/requests_controller.rb
46
+ - app/controllers/lesli_audit/users_controller.rb
47
+ - app/helpers/lesli_audit/accounts_helper.rb
43
48
  - app/helpers/lesli_audit/analytics_helper.rb
44
49
  - app/helpers/lesli_audit/application_helper.rb
45
50
  - app/helpers/lesli_audit/dashboards_helper.rb
51
+ - app/helpers/lesli_audit/requests_helper.rb
52
+ - app/helpers/lesli_audit/users_helper.rb
46
53
  - app/jobs/lesli_audit/application_job.rb
47
54
  - app/mailers/lesli_audit/application_mailer.rb
55
+ - app/models/lesli_audit/account.rb
56
+ - app/models/lesli_audit/account/request.rb
57
+ - app/models/lesli_audit/account_request.rb
48
58
  - app/models/lesli_audit/analytic.rb
49
59
  - app/models/lesli_audit/application_record.rb
50
60
  - app/models/lesli_audit/dashboard.rb
61
+ - app/models/lesli_audit/request.rb
62
+ - app/models/lesli_audit/user.rb
63
+ - app/models/lesli_audit/user_request.rb
51
64
  - app/services/lesli_audit/account/activity_services.rb
52
65
  - app/services/lesli_audit/analytic_service.rb
53
66
  - app/services/lesli_audit/analytics/trend_services.rb
54
67
  - app/services/lesli_audit/analytics/visitor_service.rb
55
- - app/services/lesli_audit/request_services.rb
68
+ - app/services/lesli_audit/request_service.rb
56
69
  - app/services/lesli_audit/users/activity_services.rb
57
70
  - app/services/lesli_audit/users/log_services.rb
58
71
  - app/services/lesli_audit/users/registration_services.rb
59
72
  - app/services/lesli_audit/users/role_services.rb
60
73
  - app/services/lesli_audit/users/working_hour_services.rb
74
+ - app/views/lesli_audit/accounts/_account.html.erb
75
+ - app/views/lesli_audit/accounts/_form.html.erb
76
+ - app/views/lesli_audit/accounts/edit.html.erb
77
+ - app/views/lesli_audit/accounts/index.html.erb
78
+ - app/views/lesli_audit/accounts/new.html.erb
79
+ - app/views/lesli_audit/accounts/show.html.erb
61
80
  - app/views/lesli_audit/analytics/_analytic.html.erb
62
81
  - app/views/lesli_audit/analytics/_form.html.erb
63
82
  - app/views/lesli_audit/analytics/edit.html.erb
@@ -71,10 +90,26 @@ files:
71
90
  - app/views/lesli_audit/dashboards/new.html.erb
72
91
  - app/views/lesli_audit/dashboards/show.html.erb
73
92
  - app/views/lesli_audit/partials/_engine-navigation.html.erb
93
+ - app/views/lesli_audit/requests/_form.html.erb
94
+ - app/views/lesli_audit/requests/_request.html.erb
95
+ - app/views/lesli_audit/requests/edit.html.erb
96
+ - app/views/lesli_audit/requests/index.html.erb
97
+ - app/views/lesli_audit/requests/new.html.erb
98
+ - app/views/lesli_audit/requests/show.html.erb
99
+ - app/views/lesli_audit/users/_form.html.erb
100
+ - app/views/lesli_audit/users/_user.html.erb
101
+ - app/views/lesli_audit/users/edit.html.erb
102
+ - app/views/lesli_audit/users/index.html.erb
103
+ - app/views/lesli_audit/users/new.html.erb
104
+ - app/views/lesli_audit/users/show.html.erb
105
+ - config/locales/translations.en.yml
106
+ - config/locales/translations.es.yml
74
107
  - config/routes.rb
75
108
  - db/migrate/v1.0/0803000110_create_lesli_audit_accounts.rb
76
109
  - db/migrate/v1.0/0803050110_create_lesli_audit_dashboards.rb
77
110
  - db/migrate/v1.0/0803050210_create_lesli_audit_dashboard_components.rb
111
+ - db/migrate/v1.0/0803100010_create_lesli_audit_account_requests.rb
112
+ - db/migrate/v1.0/0803110010_create_lesli_audit_user_requests.rb
78
113
  - db/seed/development.rb
79
114
  - db/seed/production.rb
80
115
  - db/seed/test.rb
@@ -91,18 +126,19 @@ files:
91
126
  - lib/vue/apps/security/passwords.vue
92
127
  - lib/vue/apps/security/sessions.vue
93
128
  - lib/vue/apps/users/activities.vue
129
+ - lib/vue/apps/users/index.vue
94
130
  - lib/vue/apps/users/logs.vue
95
131
  - lib/vue/apps/users/registrations.vue
96
132
  - lib/vue/apps/users/roles.vue
97
133
  - lib/vue/apps/users/workingHours.vue
98
134
  - lib/vue/components/requests.vue
99
- - lib/vue/components/resources.vue
100
135
  - lib/vue/components/visitors.vue
101
136
  - lib/vue/stores/accounts/activities.js
102
137
  - lib/vue/stores/analytics.js
103
138
  - lib/vue/stores/request.js
104
139
  - lib/vue/stores/security/password.js
105
140
  - lib/vue/stores/security/session.js
141
+ - lib/vue/stores/translations.json
106
142
  - lib/vue/stores/users/activities.js
107
143
  - lib/vue/stores/users/logs.js
108
144
  - lib/vue/stores/users/registrations.js
@@ -125,7 +161,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
125
161
  requirements:
126
162
  - - ">="
127
163
  - !ruby/object:Gem::Version
128
- version: '0'
164
+ version: 2.7.2
129
165
  required_rubygems_version: !ruby/object:Gem::Requirement
130
166
  requirements:
131
167
  - - ">="