lesli_admin 0.1.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/lesli_admin/admin-logo.svg +1 -0
  3. data/app/assets/javascripts/lesli_admin/application.js +2698 -219
  4. data/app/assets/stylesheets/lesli_admin/application.scss +33 -0
  5. data/app/assets/stylesheets/lesli_admin/users.scss +67 -0
  6. data/app/controllers/lesli_admin/profiles_controller.rb +56 -0
  7. data/app/controllers/lesli_admin/users_controller.rb +13 -19
  8. data/app/helpers/lesli_admin/profiles_helper.rb +4 -0
  9. data/app/models/lesli_admin/account.rb +3 -31
  10. data/app/services/lesli_admin/user_service.rb +17 -52
  11. data/app/views/lesli_admin/profiles/show.html.erb +1 -0
  12. data/app/views/lesli_admin/users/show.html.erb +1 -10
  13. data/config/locales/translations.en.yml +5 -0
  14. data/config/locales/translations.es.yml +5 -0
  15. data/config/routes.rb +4 -7
  16. data/db/migrate/0101000110_create_lesli_admin_accounts.rb +42 -0
  17. data/lib/lesli_admin/engine.rb +31 -0
  18. data/lib/lesli_admin/version.rb +2 -1
  19. data/lib/vue/application.js +15 -98
  20. data/lib/vue/apps/account/components/form-information.vue +1 -1
  21. data/lib/vue/apps/account/show.vue +3 -3
  22. data/lib/vue/apps/dashboard/show.vue +6 -9
  23. data/lib/vue/apps/profile/show.vue +29 -18
  24. data/lib/vue/apps/users/components/information-card.vue +4 -7
  25. data/lib/vue/apps/users/components/information-form.vue +4 -7
  26. data/lib/vue/apps/users/index.vue +9 -4
  27. data/lib/vue/apps/users/show.vue +25 -10
  28. data/lib/vue/stores/translations.json +38 -0
  29. data/lib/vue/stores/user.js +17 -5
  30. data/lib/vue/stores/users.js +25 -0
  31. data/readme.md +61 -18
  32. metadata +27 -12
  33. data/app/assets/stylesheets/lesli_admin/application.css +0 -15
  34. data/app/models/lesli_admin/dashboard.rb +0 -4
  35. data/app/models/lesli_admin/user.rb +0 -4
  36. data/lib/vue/stores/account.js +0 -113
  37. data/lib/vue/stores/descriptor.js +0 -116
  38. data/lib/vue/stores/descriptors.js +0 -167
  39. data/lib/vue/stores/integration.js +0 -103
  40. data/lib/vue/stores/role.js +0 -243
  41. data/lib/vue/stores/systemController.js +0 -67
  42. /data/lib/vue/stores/{accountSettings.js → account_settings.js} +0 -0
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lesli_admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.3.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-09-25 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
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 7.0.6
27
+ - !ruby/object:Gem::Dependency
28
+ name: lesli
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '5'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '5'
27
41
  description: Administration area for the Lesli Framework
28
42
  email:
29
43
  - hello@lesli.tech
@@ -33,20 +47,22 @@ extra_rdoc_files: []
33
47
  files:
34
48
  - Rakefile
35
49
  - app/assets/config/lesli_admin_manifest.js
50
+ - app/assets/images/lesli_admin/admin-logo.svg
36
51
  - app/assets/javascripts/lesli_admin/application.js
37
- - app/assets/stylesheets/lesli_admin/application.css
52
+ - app/assets/stylesheets/lesli_admin/application.scss
53
+ - app/assets/stylesheets/lesli_admin/users.scss
38
54
  - app/controllers/lesli_admin/accounts_controller.rb
39
55
  - app/controllers/lesli_admin/application_controller.rb
40
56
  - app/controllers/lesli_admin/dashboards_controller.rb
57
+ - app/controllers/lesli_admin/profiles_controller.rb
41
58
  - app/controllers/lesli_admin/users_controller.rb
42
59
  - app/helpers/lesli_admin/application_helper.rb
43
60
  - app/helpers/lesli_admin/dashboards_helper.rb
61
+ - app/helpers/lesli_admin/profiles_helper.rb
44
62
  - app/jobs/lesli_admin/application_job.rb
45
63
  - app/mailers/lesli_admin/application_mailer.rb
46
64
  - app/models/lesli_admin/account.rb
47
65
  - app/models/lesli_admin/application_record.rb
48
- - app/models/lesli_admin/dashboard.rb
49
- - app/models/lesli_admin/user.rb
50
66
  - app/services/lesli_admin/user_service.rb
51
67
  - app/views/layouts/lesli_admin/application.html.erb
52
68
  - app/views/lesli_admin/accounts/_account.html.erb
@@ -62,11 +78,15 @@ files:
62
78
  - app/views/lesli_admin/dashboards/new.html.erb
63
79
  - app/views/lesli_admin/dashboards/show.html.erb
64
80
  - app/views/lesli_admin/partials/_engine-navigation.html.erb
81
+ - app/views/lesli_admin/profiles/show.html.erb
65
82
  - app/views/lesli_admin/users/edit.html.erb
66
83
  - app/views/lesli_admin/users/index.html.erb
67
84
  - app/views/lesli_admin/users/new.html.erb
68
85
  - app/views/lesli_admin/users/show.html.erb
86
+ - config/locales/translations.en.yml
87
+ - config/locales/translations.es.yml
69
88
  - config/routes.rb
89
+ - db/migrate/0101000110_create_lesli_admin_accounts.rb
70
90
  - lib/lesli_admin.rb
71
91
  - lib/lesli_admin/engine.rb
72
92
  - lib/lesli_admin/version.rb
@@ -90,14 +110,9 @@ files:
90
110
  - lib/vue/apps/users/index.vue
91
111
  - lib/vue/apps/users/new.vue
92
112
  - lib/vue/apps/users/show.vue
93
- - lib/vue/stores/account.js
94
- - lib/vue/stores/accountSettings.js
95
- - lib/vue/stores/descriptor.js
96
- - lib/vue/stores/descriptors.js
97
- - lib/vue/stores/integration.js
98
- - lib/vue/stores/role.js
113
+ - lib/vue/stores/account_settings.js
99
114
  - lib/vue/stores/roles.js
100
- - lib/vue/stores/systemController.js
115
+ - lib/vue/stores/translations.json
101
116
  - lib/vue/stores/user.js
102
117
  - lib/vue/stores/users.js
103
118
  - readme.md
@@ -1,15 +0,0 @@
1
- /*
2
- * This is a manifest file that'll be compiled into application.css, which will include all the files
3
- * listed below.
4
- *
5
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
- *
8
- * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
- * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
- * files in this directory. Styles in this file should be added after the last require_* statement.
11
- * It is generally better to create a new file per style scope.
12
- *
13
- *= require_tree .
14
- *= require_self
15
- */
@@ -1,4 +0,0 @@
1
- module LesliAdmin
2
- class Dashboard < ApplicationRecord
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- module LesliAdmin
2
- class User < ::Lesli::User
3
- end
4
- end
@@ -1,113 +0,0 @@
1
- /*
2
- Lesli
3
-
4
- Copyright (c) 2023, Lesli Technologies, S. A.
5
-
6
- This program is free software: you can redistribute it and/or modify
7
- it under the terms of the GNU General Public License as published by
8
- the Free Software Foundation, either version 3 of the License, or
9
- (at your option) any later version.
10
-
11
- This program is distributed in the hope that it will be useful,
12
- but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- GNU General Public License for more details.
15
-
16
- You should have received a copy of the GNU General Public License
17
- along with this program. If not, see http://www.gnu.org/licenses/.
18
-
19
- Lesli · Ruby on Rails SaaS Development Framework.
20
-
21
- Made with ♥ by https://www.lesli.tech
22
- Building a better future, one line of code at a time.
23
-
24
- @contact hello@lesli.tech
25
- @website https://www.lesli.tech
26
- @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
27
-
28
- // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
29
- // ·
30
- */
31
-
32
-
33
- // ·
34
- import { defineStore } from "pinia";
35
-
36
-
37
- // ·
38
- export const useAccount = defineStore("account", {
39
- state: () => {
40
- return {
41
- accountInfo: {},
42
- options: {
43
- countries: [],
44
- regions: [],
45
- time_zones: []
46
- }
47
- }
48
- },
49
- actions: {
50
-
51
- fetch (){
52
- this.loading = true
53
- this.http.get(this.url.admin("account")).then(result => {
54
- this.accountInfo = result
55
- delete this.accountInfo.created_at
56
- delete this.accountInfo.updated_at
57
- delete this.accountInfo.phone_number_2
58
- delete this.accountInfo.phone_number_3
59
- delete this.accountInfo.phone_number_4
60
- }).catch(error => {
61
- this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
62
- }).finally(() => {
63
- this.loading = false
64
- })
65
- },
66
-
67
- update() {
68
- this.submitting_form = true
69
- this.http.patch(this.url.admin("account"), {
70
- account: this.accountInfo
71
- }).then(result => {
72
- this.msg.success(I18n.t("core.users.messages_success_operation"))
73
- }).catch(error => {
74
- this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
75
- }).finally(() => {
76
- this.fetch()
77
- })
78
- },
79
- getOptions (){
80
- this.loading = true
81
- this.http.get(this.url.admin("account/options")).then(result => {
82
- this.options.countries = result.countries.map((country)=> {
83
- return {
84
- label: country.name,
85
- value: country.id
86
- }
87
- } )
88
- this.options.regions = result.regions.map((region)=> {
89
- return {
90
- label: region.value,
91
- value: region.key
92
- }
93
- } )
94
- }).catch(error => {
95
- this.msg.danger(this.translations.core.shared.messages_danger_internal_error)
96
- }).finally(() => {
97
- this.loading = false
98
- })
99
- // Get options for time zone selection
100
- this.http.get(this.url.admin("account/settings/options")).then(result => {
101
- this.options.time_zones = result.time_zones.map((time_zone)=> {
102
- return {
103
- label: time_zone.text,
104
- value: time_zone.value
105
- }
106
- } )
107
- }).catch(error => {
108
- this.msg.danger(this.translations.core.shared.messages_danger_internal_error)
109
- })
110
- }
111
-
112
- },
113
- });
@@ -1,116 +0,0 @@
1
- /*
2
- Lesli
3
-
4
- Copyright (c) 2023, Lesli Technologies, S. A.
5
-
6
- This program is free software: you can redistribute it and/or modify
7
- it under the terms of the GNU General Public License as published by
8
- the Free Software Foundation, either version 3 of the License, or
9
- (at your option) any later version.
10
-
11
- This program is distributed in the hope that it will be useful,
12
- but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- GNU General Public License for more details.
15
-
16
- You should have received a copy of the GNU General Public License
17
- along with this program. If not, see http://www.gnu.org/licenses/.
18
-
19
- All the information provided by this platform is protected by international laws related to
20
- industrial property, intellectual property, copyright and relative international laws.
21
- All intellectual or industrial property rights of the code, texts, trade mark, design,
22
- pictures and any other information belongs to the owner of this platform.
23
-
24
- Made with ♥ by https://www.lesli.tech
25
- Building a better future, one line of code at a time.
26
-
27
- @contact hello@lesli.tech
28
- @website https://www.lesli.tech
29
- @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
30
-
31
- // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
32
- // ·
33
- */
34
-
35
-
36
- // ·
37
- import { defineStore } from "pinia"
38
-
39
-
40
- // ·
41
- export const useDescriptor = defineStore("administration.descriptor", {
42
- state: () => {
43
- return {
44
- list: [],
45
- descriptor: {},
46
- privileges: [],
47
- privilegesLoading: false
48
- }
49
- },
50
- actions: {
51
-
52
- fetchDescriptor(id) {
53
- if (this.descriptor.id != null) {
54
- return
55
- }
56
-
57
- this.getDescriptor(id)
58
- },
59
-
60
- getDescriptor(id) {
61
- this.http.get(this.url.admin("descriptors/:id", id)).then(result => {
62
- this.descriptor = result
63
- this.getDescriptorPrivileges()
64
- }).catch(error => {
65
- this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
66
- }).finally(() => {
67
-
68
- })
69
- },
70
-
71
- resetDescriptor() {
72
- this.descriptor = {}
73
- this.privileges = []
74
- },
75
-
76
- getDescriptorPrivileges() {
77
- this.privilegesLoading = true
78
- this.http.get(this.url.admin("descriptors/:id/privileges", this.descriptor.id)).then(result => {
79
- this.privileges = result
80
- }).catch(error => {
81
- console.log(error)
82
- }).finally(() => {
83
- this.privilegesLoading = false
84
- })
85
- },
86
-
87
- // Add privilege to descriptor
88
- postDescriptorPrivilege(action) {
89
-
90
- this.http.post(this.url.admin("descriptors/:id/privileges", this.descriptor.id), {
91
- descriptor_privilege: {
92
- //controller_id: action.controller_id,
93
- action_id: action.action_id
94
- }
95
- }).then(result => {
96
- console.log(result)
97
- }).catch(error => {
98
- console.log(error)
99
- })
100
- },
101
-
102
-
103
- // Add privilege to descriptor
104
- deleteDescriptorPrivilege(action) {
105
- console.log(action)
106
- this.http.delete(this.url.admin("descriptors/:descriptorId/privileges/:descriptorPrivilegeId", {
107
- descriptorId: this.descriptor.id,
108
- descriptorPrivilegeId: action.descriptor_privilege_id
109
- })).then(result => {
110
- console.log(result)
111
- }).catch(error => {
112
- console.log(error)
113
- })
114
- }
115
- }
116
- })
@@ -1,167 +0,0 @@
1
- /*
2
- Lesli
3
-
4
- Copyright (c) 2023, Lesli Technologies, S. A.
5
-
6
- This program is free software: you can redistribute it and/or modify
7
- it under the terms of the GNU General Public License as published by
8
- the Free Software Foundation, either version 3 of the License, or
9
- (at your option) any later version.
10
-
11
- This program is distributed in the hope that it will be useful,
12
- but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- GNU General Public License for more details.
15
-
16
- You should have received a copy of the GNU General Public License
17
- along with this program. If not, see http://www.gnu.org/licenses/.
18
-
19
- Lesli · Ruby on Rails SaaS development platform.
20
-
21
- Made with ♥ by https://www.lesli.tech
22
- Building a better future, one line of code at a time.
23
-
24
- @contact hello@lesli.tech
25
- @website https://www.lesli.tech
26
- @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
27
-
28
- // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
29
- // ·
30
- */
31
-
32
-
33
- // ·
34
- import { defineStore } from "pinia"
35
-
36
-
37
- // ·
38
- export const useDescriptors = defineStore("administration.descriptors", {
39
- state: () => {
40
- return {
41
- list: [],
42
- descriptor: {},
43
- index: {
44
- loading: false,
45
- pagination: {},
46
- records: []
47
- }
48
- }
49
- },
50
- actions: {
51
-
52
- fetchDescriptors() {
53
- if (this.index.records.length > 0) {
54
- return
55
- }
56
-
57
- this.getDescriptors()
58
- },
59
-
60
- getDescriptors() {
61
- this.index.loading = true
62
- this.http.get(this.url.admin("descriptors")).then(result => {
63
- this.index.pagination = result.pagination
64
- this.index.records = result.records
65
- }).catch(error => {
66
- this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
67
- }).finally(() => {
68
- this.index.loading = false
69
- })
70
- },
71
-
72
- postDescriptor() {
73
- this.loading = true
74
- this.http.post(this.url.admin("descriptors"), { descriptor: this.descriptor }).then(result => {
75
- this.descriptor.id = result.id
76
- this.msg.success(I18n.t("core.users.messages_success_operation"))
77
- this.loading = false
78
- }).catch(error => {
79
- this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
80
- })
81
- },
82
-
83
- resetDescriptor() {
84
- this.descriptor = {}
85
- this.privileges = []
86
- },
87
-
88
- paginateIndex(page) {
89
- console.log("store page: ", page)
90
- this.index.pagination.page = page
91
- //this.fetch(this.url.admin("descriptors").paginate(this.pagination.page))
92
- },
93
-
94
- /*
95
- fetchDescriptorList() {
96
- this.http.get(this.url.admin("descriptors/list")).then(result => {
97
- this.list = result.map(descriptor => {
98
- descriptor.active = false
99
- return descriptor
100
- })
101
- })
102
- },
103
-
104
- /**
105
- * @description This action is used to reset descriptor object
106
- * /
107
-
108
-
109
- /**
110
- * @description This action is used to create a descriptor
111
- * /
112
-
113
-
114
- /**
115
- * @description This action is used to update a descriptor
116
- * /
117
- updateDescriptor(){
118
- this.loading = true
119
- this.http.put(this.url.admin("descriptors/:id", this.descriptor.id), { descriptor: this.descriptor }).then(result => {
120
- this.msg.success(I18n.t("core.users.messages_success_operation"))
121
- this.loading = false
122
- }).catch(error => {
123
- this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
124
- })
125
-
126
- },
127
- /**
128
- * @description This action is used to sort the results
129
- * /
130
- sortIndex(column, direction) {
131
- this.fetch(this.url.admin("descriptors").order(column, direction))
132
- },
133
- /**
134
- * @description This action is used to search
135
- * @param {string} search_string
136
- * /
137
- search(search_string) {
138
- this.fetch(this.url.admin("descriptors").search(search_string))
139
- },
140
- /**
141
- * @description This action is used to paginate index
142
- * @param {string} page actual page
143
- * /
144
- paginateIndex(page) {
145
- this.pagination.page = page
146
- this.fetch(this.url.admin("descriptors").paginate(this.pagination.page))
147
- },
148
- /**
149
- * @description This action is used to get descriptors as options
150
- * /
151
- getDescriptorsOptions(){
152
- this.loading = true
153
- this.descriptors_options = []
154
- this.http.get(this.url.admin("descriptors/list")).then(result => {
155
- result.forEach((descriptor)=>{
156
- this.descriptors_options.push({
157
- label: descriptor.name,
158
- value: descriptor.id
159
- })
160
- })
161
-
162
- this.loading = false
163
- })
164
- },
165
- */
166
- }
167
- })
@@ -1,103 +0,0 @@
1
- /*
2
- Lesli
3
-
4
- Copyright (c) 2023, Lesli Technologies, S. A.
5
-
6
- This program is free software: you can redistribute it and/or modify
7
- it under the terms of the GNU General Public License as published by
8
- the Free Software Foundation, either version 3 of the License, or
9
- (at your option) any later version.
10
-
11
- This program is distributed in the hope that it will be useful,
12
- but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- GNU General Public License for more details.
15
-
16
- You should have received a copy of the GNU General Public License
17
- along with this program. If not, see http://www.gnu.org/licenses/.
18
-
19
- Lesli · Ruby on Rails Development Platform.
20
-
21
- Made with ♥ by https://www.lesli.tech
22
- Building a better future, one line of code at a time.
23
-
24
- @contact hello@lesli.tech
25
- @website https://www.lesli.tech
26
- @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
27
-
28
- // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
29
- // ·
30
- */
31
-
32
-
33
- // ·
34
- import { defineStore } from "pinia"
35
-
36
-
37
- // ·
38
- export const useIntegration = defineStore("administration.integration", {
39
- state: () => {
40
- return {
41
- token: "",
42
- records: [],
43
- pagination: {},
44
- integration: {
45
- name: ""
46
- }
47
- }
48
- },
49
- actions: {
50
-
51
- fetch() {
52
- this.http.get(this.url.admin("account/integrations")).then(result => {
53
- this.pagination = result.pagination
54
- this.records = result.records.map(integrations => {
55
- integrations.created_at = this.date.dateTime(integrations.created_at)
56
- return integrations
57
- })
58
- })
59
- },
60
-
61
- post() {
62
-
63
- if (this.integration.name == "") {
64
- return
65
- }
66
-
67
- this.http.post(this.url.admin("account/integrations"), {
68
- account_integration: this.integration
69
- }).then(result => {
70
- this.integration.name = ""
71
- this.token = result
72
- })
73
- },
74
- /**
75
- * @description This action is used to delete an integration
76
- */
77
- deleteIntegration(integration_id){
78
- this.dialog.confirmation({
79
- title: "Delete integration",
80
- text: 'Are you sure you want to delete this integration?',
81
- confirmText: "Yes",
82
- cancelText: "No"
83
- })
84
- .then(({ isConfirmed }) => {
85
- if (isConfirmed) {
86
- this.http.delete(this.url.admin("account/integrations/:id", { id: integration_id})).then(result => {
87
- // delete user associated with integration
88
- this.http.delete(this.url.admin("/users/:user_id", {
89
- user_id: result.users_id
90
- })).then(result => {
91
- this.msg.success(I18n.t("core.users.messages_success_operation"))
92
- }).catch(error => {
93
- this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
94
- })
95
- }).catch(error => {
96
- this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
97
- })
98
- this.fetch()
99
- }
100
- })
101
- }
102
- }
103
- })