lesli_admin 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/config/lesli_admin_manifest.js +1 -0
- data/app/assets/images/lesli_admin/admin-logo.svg +1 -0
- data/app/assets/javascripts/lesli_admin/application.js +2635 -244
- data/app/assets/javascripts/lesli_admin/translations.js +2291 -0
- data/app/assets/stylesheets/lesli_admin/application.scss +32 -0
- data/app/assets/stylesheets/lesli_admin/users.scss +67 -0
- data/app/controllers/lesli_admin/profiles_controller.rb +56 -0
- data/app/controllers/lesli_admin/users_controller.rb +5 -196
- data/app/helpers/lesli_admin/profiles_helper.rb +4 -0
- data/app/views/lesli_admin/profiles/edit.html.erb +10 -0
- data/app/views/lesli_admin/profiles/index.html.erb +14 -0
- data/app/views/lesli_admin/profiles/new.html.erb +9 -0
- data/app/views/lesli_admin/profiles/show.html.erb +1 -0
- data/app/views/lesli_admin/users/show.html.erb +1 -10
- data/config/locales/translations.en.yml +6 -0
- data/config/locales/translations.es.yml +6 -0
- data/config/routes.rb +4 -7
- data/lib/lesli_admin/engine.rb +31 -0
- data/lib/lesli_admin/version.rb +2 -1
- data/lib/vue/application.js +15 -98
- data/lib/vue/apps/account/show.vue +2 -2
- data/lib/vue/apps/dashboard/show.vue +6 -8
- data/lib/vue/apps/profile/show.vue +22 -15
- data/lib/vue/apps/users/components/information-card.vue +4 -7
- data/lib/vue/apps/users/components/information-form.vue +4 -7
- data/lib/vue/apps/users/index.vue +10 -4
- data/lib/vue/apps/users/show.vue +25 -10
- data/lib/vue/stores/translations.json +20 -0
- data/lib/vue/stores/users.js +1 -1
- data/readme.md +61 -18
- metadata +16 -14
- data/app/assets/stylesheets/lesli_admin/application.css +0 -15
- data/app/models/lesli_admin/dashboard.rb +0 -4
- data/app/models/lesli_admin/user.rb +0 -4
- data/app/services/lesli_admin/user_service.rb +0 -300
- data/lib/vue/stores/account.js +0 -113
- data/lib/vue/stores/descriptor.js +0 -116
- data/lib/vue/stores/descriptors.js +0 -167
- data/lib/vue/stores/integration.js +0 -103
- data/lib/vue/stores/role.js +0 -243
- data/lib/vue/stores/systemController.js +0 -67
- data/lib/vue/stores/user.js +0 -319
- /data/lib/vue/stores/{accountSettings.js → account_settings.js} +0 -0
@@ -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
|
-
})
|
data/lib/vue/stores/role.js
DELETED
@@ -1,243 +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 useRole = defineStore("administration.role", {
|
39
|
-
state: () => {
|
40
|
-
return {
|
41
|
-
options: {},
|
42
|
-
records: [],
|
43
|
-
descriptors: [],
|
44
|
-
descriptorsCustom: [],
|
45
|
-
descriptorSearchString: '',
|
46
|
-
role: {
|
47
|
-
name: "",
|
48
|
-
descriptors: []
|
49
|
-
},
|
50
|
-
pagination: {
|
51
|
-
page: 1
|
52
|
-
},
|
53
|
-
index: {
|
54
|
-
pagination: {},
|
55
|
-
records: []
|
56
|
-
},
|
57
|
-
loading: false,
|
58
|
-
order: {
|
59
|
-
column: "id",
|
60
|
-
direction: "desc"
|
61
|
-
},
|
62
|
-
search_string: "",
|
63
|
-
role_activities: {}
|
64
|
-
}
|
65
|
-
},
|
66
|
-
actions: {
|
67
|
-
|
68
|
-
fetch() {
|
69
|
-
this.loading = true
|
70
|
-
this.http.get(this.url.admin("roles")
|
71
|
-
.paginate(this.pagination.page)
|
72
|
-
.order(this.order.column, this.order.direction)
|
73
|
-
.search(this.search_string))
|
74
|
-
.then(result => {
|
75
|
-
this.index = result
|
76
|
-
this.records = result.records.map(integrations => {
|
77
|
-
integrations.created_at = this.date.dateTime(integrations.created_at)
|
78
|
-
return integrations
|
79
|
-
})
|
80
|
-
this.loading = false
|
81
|
-
})
|
82
|
-
},
|
83
|
-
|
84
|
-
paginateIndex(page) {
|
85
|
-
this.pagination.page = page
|
86
|
-
this.fetch()
|
87
|
-
},
|
88
|
-
|
89
|
-
fetchRole(id) {
|
90
|
-
this.loading = true
|
91
|
-
this.http.get(this.url.admin("roles/:id", id)).then(result => {
|
92
|
-
this.role = result
|
93
|
-
this.getDescriptors()
|
94
|
-
this.loading = false
|
95
|
-
})
|
96
|
-
},
|
97
|
-
|
98
|
-
postRole() {
|
99
|
-
return this.http.post(this.url.admin("roles"), this.role)
|
100
|
-
},
|
101
|
-
|
102
|
-
putRole() {
|
103
|
-
this.http.put(this.url.admin("roles/:id", this.role.id), this.role).then(result => {
|
104
|
-
this.msg.success(I18n.t('core.roles.messages_success_role_successfully_updated'))
|
105
|
-
})
|
106
|
-
},
|
107
|
-
|
108
|
-
searchDescriptors(string) {
|
109
|
-
this.descriptorSearchString = string
|
110
|
-
this.getDescriptors()
|
111
|
-
},
|
112
|
-
|
113
|
-
getDescriptors() {
|
114
|
-
|
115
|
-
let url = this.url.admin("roles/:id/descriptors", this.role.id)
|
116
|
-
|
117
|
-
if (this.descriptorSearchString != '') {
|
118
|
-
url = url.search(this.descriptorSearchString)
|
119
|
-
}
|
120
|
-
|
121
|
-
this.http.get(url).then(descriptors => {
|
122
|
-
|
123
|
-
// reset the list of descriptors
|
124
|
-
this.descriptors = []
|
125
|
-
this.descriptorsCustom = []
|
126
|
-
|
127
|
-
// temporary container for the descriptor matrix
|
128
|
-
let descriptorgrid = {}
|
129
|
-
|
130
|
-
// convert list of descriptors from: controller/action to controller/actions (like a matrix)
|
131
|
-
descriptors.forEach(descriptor => {
|
132
|
-
|
133
|
-
if (["list", "index", "show", "create", "update", "destroy"].includes(descriptor.action)) {
|
134
|
-
|
135
|
-
if (!descriptorgrid[descriptor.reference]) {
|
136
|
-
descriptorgrid[descriptor.reference] = {
|
137
|
-
id: descriptor.id,
|
138
|
-
name: descriptor.name,
|
139
|
-
reference: descriptor.reference,
|
140
|
-
controller: descriptor.controller,
|
141
|
-
index: null,
|
142
|
-
show: null,
|
143
|
-
create: null,
|
144
|
-
update: null,
|
145
|
-
destroy: null
|
146
|
-
}
|
147
|
-
}
|
148
|
-
|
149
|
-
// add the id of the descriptor that the action belongs to
|
150
|
-
descriptorgrid[descriptor.reference][descriptor.action] = {
|
151
|
-
id: descriptor.id,
|
152
|
-
active: descriptor.active
|
153
|
-
}
|
154
|
-
|
155
|
-
return;
|
156
|
-
|
157
|
-
}
|
158
|
-
|
159
|
-
this.descriptorsCustom.push(descriptor)
|
160
|
-
|
161
|
-
})
|
162
|
-
|
163
|
-
// return the arrys only
|
164
|
-
this.descriptors = Object.values(descriptorgrid)
|
165
|
-
|
166
|
-
})
|
167
|
-
},
|
168
|
-
|
169
|
-
updateDescriptor(descriptor) {
|
170
|
-
|
171
|
-
// enable descriptor
|
172
|
-
if (descriptor.active) {
|
173
|
-
return this.postDescriptor(descriptor)
|
174
|
-
}
|
175
|
-
|
176
|
-
// disable descriptor
|
177
|
-
this.deleteDescriptor(descriptor)
|
178
|
-
|
179
|
-
},
|
180
|
-
|
181
|
-
postDescriptor(descriptor) {
|
182
|
-
this.http.post(this.url.admin("roles/:id/descriptors", this.role.id), {
|
183
|
-
role_descriptor: {
|
184
|
-
id: descriptor.id
|
185
|
-
}
|
186
|
-
})
|
187
|
-
},
|
188
|
-
|
189
|
-
deleteDescriptor(descriptor) {
|
190
|
-
this.http.delete(this.url.admin("roles/:id/descriptors/:descriptor_id", {
|
191
|
-
id: this.role.id,
|
192
|
-
descriptor_id: descriptor.id
|
193
|
-
}))
|
194
|
-
},
|
195
|
-
|
196
|
-
getOptions() {
|
197
|
-
this.http.get(this.url.admin("roles/options")).then(result => {
|
198
|
-
|
199
|
-
this.options = result
|
200
|
-
})
|
201
|
-
},
|
202
|
-
/**
|
203
|
-
* @description This action is used to sort the results
|
204
|
-
*/
|
205
|
-
sortIndex(column, direction) {
|
206
|
-
this.order.column = column
|
207
|
-
this.order.direction = direction
|
208
|
-
this.fetch()
|
209
|
-
},
|
210
|
-
/**
|
211
|
-
* @description This action is used to search
|
212
|
-
* @param {string} search_string
|
213
|
-
*/
|
214
|
-
search(search_string) {
|
215
|
-
this.search_string = search_string
|
216
|
-
this.fetch()
|
217
|
-
},
|
218
|
-
/**
|
219
|
-
* @description This action is used to delete a role
|
220
|
-
* @param {Integer} role_id id of the role to be deleted
|
221
|
-
*/
|
222
|
-
deleteRole(role_id){
|
223
|
-
this.http.delete(this.url.admin('roles/:id', {id: role_id})).then(result => {
|
224
|
-
this.msg.success(I18n.t("core.users.messages_success_operation"))
|
225
|
-
this.fetch()
|
226
|
-
}).catch(error => {
|
227
|
-
this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
|
228
|
-
})
|
229
|
-
},
|
230
|
-
/**
|
231
|
-
* @description This action is used to fetch activity logs from a role
|
232
|
-
*/
|
233
|
-
fetchLogs(){
|
234
|
-
this.loading = true
|
235
|
-
this.http.get(this.url.admin('roles/:id/activities', {id: this.role.id})).then(result => {
|
236
|
-
this.role_activities = result.activities
|
237
|
-
this.loading = false
|
238
|
-
}).catch(error => {
|
239
|
-
this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
|
240
|
-
})
|
241
|
-
}
|
242
|
-
}
|
243
|
-
})
|
@@ -1,67 +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 useSystemController = defineStore("administration.systemController", {
|
39
|
-
state: () => {
|
40
|
-
return {
|
41
|
-
options: { categories: []},
|
42
|
-
controllerActions: {},
|
43
|
-
}
|
44
|
-
},
|
45
|
-
actions: {
|
46
|
-
|
47
|
-
fetchControllers() {
|
48
|
-
this.http.get(this.url.admin("system_controllers")).then(result => {
|
49
|
-
result.forEach(controllerAction => {
|
50
|
-
if (!this.controllerActions[controllerAction.action]) {
|
51
|
-
this.controllerActions[controllerAction.action] = []
|
52
|
-
}
|
53
|
-
controllerAction['active'] = false
|
54
|
-
this.controllerActions[controllerAction.action].push(controllerAction)
|
55
|
-
})
|
56
|
-
}).catch(error => {
|
57
|
-
console.log(error)
|
58
|
-
})
|
59
|
-
},
|
60
|
-
|
61
|
-
fetchOptions() {
|
62
|
-
this.http.get(this.url.admin("system_controllers/options")).then(result => {
|
63
|
-
this.options = result
|
64
|
-
})
|
65
|
-
}
|
66
|
-
}
|
67
|
-
})
|