lesli_admin 0.2.0 → 0.4.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.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/config/lesli_admin_manifest.js +0 -1
  3. data/app/assets/javascripts/lesli_admin/application.js +362 -831
  4. data/app/assets/stylesheets/lesli_admin/application.scss +2 -1
  5. data/app/controllers/lesli_admin/accounts_controller.rb +3 -5
  6. data/app/controllers/lesli_admin/dashboard/components_controller.rb +60 -0
  7. data/app/controllers/lesli_admin/dashboards_controller.rb +26 -50
  8. data/app/models/lesli_admin/account.rb +7 -29
  9. data/app/{controllers/lesli_admin/profiles_controller.rb → models/lesli_admin/dashboard/component.rb} +13 -19
  10. data/app/models/lesli_admin/dashboard.rb +58 -0
  11. data/app/{controllers/lesli_admin/users_controller.rb → services/lesli_admin/account_service.rb} +6 -20
  12. data/app/views/lesli_admin/dashboards/edit.html.erb +29 -7
  13. data/app/views/lesli_admin/dashboards/index.html.erb +29 -11
  14. data/app/views/lesli_admin/dashboards/new.html.erb +29 -6
  15. data/app/views/lesli_admin/dashboards/show.html.erb +31 -0
  16. data/app/views/lesli_admin/partials/_engine-navigation.html.erb +0 -1
  17. data/config/locales/translations.en.yml +29 -4
  18. data/config/locales/translations.es.yml +29 -4
  19. data/config/routes.rb +46 -5
  20. data/db/migrate/0101000110_create_lesli_admin_accounts.rb +42 -0
  21. data/db/migrate/0101050110_create_lesli_admin_dashboards.rb +51 -0
  22. data/db/migrate/0101050210_create_lesli_admin_dashboard_components.rb +53 -0
  23. data/lib/lesli_admin/engine.rb +1 -0
  24. data/lib/lesli_admin/version.rb +2 -2
  25. data/lib/vue/application.js +28 -15
  26. data/lib/vue/apps/account/components/{address-form.vue → form-address.vue} +27 -42
  27. data/lib/vue/apps/account/components/form-contact.vue +122 -0
  28. data/lib/vue/apps/account/components/form-information.vue +13 -31
  29. data/lib/vue/apps/account/show.vue +14 -13
  30. data/lib/vue/apps/{users/components/integrations-information.vue → dashboards/components/lesli-version.vue} +36 -26
  31. data/lib/vue/apps/{profile/components/change-email.vue → dashboards/show.vue} +9 -6
  32. data/lib/vue/stores/translations.json +62 -10
  33. data/readme.md +3 -3
  34. metadata +30 -30
  35. data/app/assets/javascripts/lesli_admin/translations.js +0 -2291
  36. data/app/views/lesli_admin/dashboards/_dashboard.html.erb +0 -2
  37. data/app/views/lesli_admin/dashboards/_form.html.erb +0 -17
  38. data/app/views/lesli_admin/profiles/edit.html.erb +0 -10
  39. data/app/views/lesli_admin/profiles/index.html.erb +0 -14
  40. data/app/views/lesli_admin/profiles/new.html.erb +0 -9
  41. data/lib/vue/apps/account/components/contact-form.vue +0 -162
  42. data/lib/vue/apps/dashboard/show.vue +0 -31
  43. data/lib/vue/apps/profile/components/subscriptions.vue +0 -94
  44. data/lib/vue/apps/profile/show.vue +0 -148
  45. data/lib/vue/apps/users/components/information-card.vue +0 -116
  46. data/lib/vue/apps/users/components/information-form.vue +0 -177
  47. data/lib/vue/apps/users/components/management-roles.vue +0 -109
  48. data/lib/vue/apps/users/components/management-security.vue +0 -113
  49. data/lib/vue/apps/users/components/management-sessions.vue +0 -106
  50. data/lib/vue/apps/users/components/management-settings.vue +0 -94
  51. data/lib/vue/apps/users/index.vue +0 -207
  52. data/lib/vue/apps/users/new.vue +0 -181
  53. data/lib/vue/apps/users/show.vue +0 -116
  54. data/lib/vue/stores/users.js +0 -150
@@ -1,177 +0,0 @@
1
- <script setup>
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
- */
32
-
33
-
34
- // · import vue tools
35
- import { onMounted, inject } from "vue"
36
-
37
-
38
- // · import lesli stores
39
- import { useUser } from "Lesli/stores/user"
40
-
41
-
42
- // · import vue router composable
43
- import { useRouter, useRoute } from "vue-router"
44
-
45
-
46
- // · implement stores
47
- const storeUser = useUser()
48
-
49
-
50
- // · initialize/inject plugins
51
- const router = useRouter()
52
- const route = useRoute()
53
- const url = inject("url")
54
-
55
-
56
- // ·
57
- const translations = {
58
- users: I18n.t("core.users"),
59
- shared: I18n.t("core.shared")
60
- }
61
-
62
- </script>
63
- <template>
64
- <form class="information" @submit.prevent="storeUser.putUser()">
65
- <div class="field is-horizontal">
66
- <div class="field-label">
67
- <label class="label"> {{ translations.shared.view_text_salutation}} </label>
68
- </div>
69
- <div class="field-body">
70
- <div class="field is-narrow">
71
- <div class="control">
72
- <label :for="salutation.value" class="radio" v-for="salutation in storeUser.options.salutations" :key="salutation">
73
- <input name="user_salutation" type="radio" :id="salutation.value" :value="salutation.value" v-model="storeUser.user.detail_attributes.salutation" />
74
- {{salutation.text}}
75
- </label>
76
- </div>
77
- </div>
78
- </div>
79
- </div>
80
-
81
- <div class="field is-horizontal">
82
- <div class="field-label is-normal">
83
- <label class="label">
84
- {{translations.shared.view_text_email}}
85
- <span class="is-danger">*</span>
86
- </label>
87
- </div>
88
- <div class="field-body">
89
- <div class="field">
90
- <div class="control">
91
- <input name="user_email" v-model="storeUser.user.email" required="required" type="email" class="input">
92
- </div>
93
- </div>
94
- </div>
95
- </div>
96
-
97
- <div class="field is-horizontal">
98
- <div class="field-label is-normal">
99
- <label class="label">
100
- {{ translations.shared.view_text_first_name }}
101
- </label>
102
- </div>
103
- <div class="field-body">
104
- <div class="field">
105
- <div class="control">
106
- <input name="first_name" v-model="storeUser.user.first_name" type="text" class="input">
107
- </div>
108
- </div>
109
- </div>
110
- </div>
111
-
112
- <div class="field is-horizontal">
113
- <div class="field-label is-normal">
114
- <label class="label"> {{ translations.shared.view_text_last_name }} </label>
115
- </div>
116
- <div class="field-body">
117
- <div class="field">
118
- <div class="control">
119
- <input name="last_name" v-model="storeUser.user.last_name" class="input">
120
- </div>
121
- </div>
122
- </div>
123
- </div>
124
-
125
- <div class="field is-horizontal">
126
- <div class="field-label is-normal">
127
- <label class="label"> {{ translations.shared.view_text_alias }} </label>
128
- </div>
129
- <div class="field-body">
130
- <div class="field">
131
- <div class="control">
132
- <input name="user_alias" v-model="storeUser.user.alias" class="input">
133
- </div>
134
- </div>
135
- </div>
136
- </div>
137
-
138
- <div class="field is-horizontal">
139
- <div class="field-label is-normal">
140
- <label class="label"> {{ translations.shared.view_text_telephone }} </label>
141
- </div>
142
- <div class="field-body">
143
- <div class="field">
144
- <div class="control">
145
- <input name="user_number" v-model="storeUser.user.telephone" class="input">
146
- </div>
147
- </div>
148
- </div>
149
- </div>
150
-
151
- <div class="field is-horizontal">
152
- <div class="field-label is-normal">
153
- <label class="label"> {{ translations.users.view_text_title }} </label>
154
- </div>
155
- <div class="field-body">
156
- <div class="field">
157
- <div class="control">
158
- <input name="user_title" v-model="storeUser.user.detail_attributes.title" class="input">
159
- </div>
160
- </div>
161
- </div>
162
- </div>
163
- <div class="field is-horizontal">
164
- <div class="field-label is-normal">
165
- </div>
166
- <div class="field-body">
167
- <div class="field">
168
- <div class="control">
169
- <lesli-button icon="save">
170
- {{ translations.shared.view_btn_save }}
171
- </lesli-button>
172
- </div>
173
- </div>
174
- </div>
175
- </div>
176
- </form>
177
- </template>
@@ -1,109 +0,0 @@
1
- <script setup>
2
- /*
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 · Your Smart Business Assistant.
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://lesli.tech
28
- @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
29
-
30
- // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
31
- // ·
32
-
33
- */
34
-
35
-
36
-
37
- // · import vue tools
38
- import { ref, reactive, onMounted, watch, computed } from "vue"
39
-
40
-
41
- // · import lesli stores
42
- import { useUser } from "LesliApp/administration/stores/user"
43
- import { useRoles } from "LesliApp/administration/stores/roles"
44
-
45
-
46
- // · implement stores
47
- const storeUser = useUser()
48
- const storeRoles = useRoles()
49
-
50
-
51
- // ·
52
- const translations = {
53
- shared: I18n.t("core.shared"),
54
- passwords: I18n.t("core.users/passwords"),
55
- users: I18n.t("core.users")
56
- }
57
-
58
-
59
- // ·
60
- function updateRole(role){
61
- if (role.active) {
62
- storeUser.postRole(role)
63
- } else {
64
- storeUser.deleteRole(role)
65
- }
66
- }
67
-
68
-
69
- // ·
70
- onMounted(() => {
71
- storeUser.getRoles()
72
- })
73
- </script>
74
- <template>
75
- <div class="media px-6" v-for="role in storeUser.roles">
76
- <div class="media-content pt-4">
77
- <h4>{{ role.name }}</h4>
78
- <p style="color:#aaa;">
79
- {{ role.description }}
80
- Profile view, Role view, Role create, Role update
81
- </p>
82
- </div>
83
- <div class="media-right pt-4">
84
- <lesli-toggle v-model="role.active" @change="updateRole(role)">
85
- </lesli-toggle>
86
- </div>
87
- </div>
88
- <lesli-empty v-if="storeUser.roles.length == 0"></lesli-empty>
89
- <!--
90
- <div class="roles-types">
91
- <div
92
- class="card roles-types-item p-4 is-flex is-flex-direction-column is-justify-content-space-between is-clickable"
93
- v-for="role in storeUser.options.roles"
94
- :key="role">
95
- <div class="role-type-title">
96
- <span class="has-text-weight-semibold is-size-5 ">
97
- {{ role.name }}
98
- </span>
99
- </div>
100
- <div>
101
- <span>Permission level: {{ role.object_level_permission }} </span>
102
- </div>
103
- <div class="is-flex is-justify-content-space-between is-align-items-center">
104
- <lesli-toggle v-model="storeUser.rolesToggle[role.id]" v-on:update:modelValue="updateRole(role,storeUser.rolesToggle[role.id])" ></lesli-toggle>
105
- </div>
106
- </div>
107
- </div>
108
- -->
109
- </template>
@@ -1,113 +0,0 @@
1
- <script setup>
2
- /*
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 · Your Smart Business Assistant.
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://lesli.tech
28
- @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
29
-
30
- // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
31
- // ·
32
-
33
- */
34
-
35
-
36
-
37
- // · import lesli stores
38
- import { useUser } from "LesliApp/administration/stores/user"
39
-
40
-
41
- // · implement stores
42
- const storeUser = useUser()
43
-
44
-
45
- // · translations
46
- const translations = {
47
- users: I18n.t("core.users"),
48
- shared: I18n.t("core.shared")
49
- }
50
-
51
-
52
- </script>
53
- <template>
54
- <div>
55
- <fieldset class="mb-4">
56
- <legend>Force the user to change the password</legend>
57
- <lesli-button
58
- icon="lock_reset"
59
- @click="storeUser.doRequestPassword">
60
- {{ translations.users.view_btn_request_password || "Request password" }}
61
- </lesli-button>
62
- </fieldset>
63
-
64
- <fieldset class="mb-4">
65
- <legend>Generate a new password for the user</legend>
66
- <lesli-button
67
- icon="key"
68
- @click="storeUser.doPasswordReset">
69
- {{ translations.users.view_btn_password_reset || "Password reset" }}
70
- </lesli-button>
71
- </fieldset>
72
-
73
- <fieldset class="mb-4">
74
- <legend>Close all the active sessions of the user</legend>
75
- <lesli-button
76
- icon="logout"
77
- @click="storeUser.doLogout">
78
- {{ translations.users.view_btn_logout }}
79
- </lesli-button>
80
- </fieldset>
81
-
82
- <fieldset class="mb-4">
83
- <legend>Remove all user access</legend>
84
- <lesli-button
85
- danger
86
- icon="lock_outline"
87
- @click="storeUser.doRevokeAccess">
88
- {{ translations.users.view_btn_revoke_access }}
89
- </lesli-button>
90
- </fieldset>
91
-
92
- <br><br>
93
-
94
- <fieldset class="mb-4">
95
- <lesli-button
96
- danger
97
- icon="delete_forever"
98
- @click="storeUser.deleteUser">
99
- {{ translations.users.view_btn_delete_user }}
100
- </lesli-button>
101
- </fieldset>
102
- </div>
103
- </template>
104
- <style scoped>
105
- fieldset {
106
- padding: 1.6rem;
107
- border: 1px solid #ccc;
108
- border-radius: 4px;
109
- }
110
- legend {
111
- color: #555;
112
- }
113
- </style>
@@ -1,106 +0,0 @@
1
- <script setup>
2
- /*
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 · Your Smart Business Assistant.
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://lesli.tech
28
- @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
29
-
30
- // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
31
- // ·
32
-
33
- */
34
-
35
-
36
-
37
- // · import vue tools
38
- import { ref, reactive, onMounted, watch, computed } from "vue"
39
-
40
-
41
- // · import vue router composable
42
- import { useRoute } from "vue-router"
43
-
44
-
45
- // · import lesli stores
46
- import { useUser } from "LesliApp/administration/stores/user"
47
-
48
-
49
- // · implement stores
50
- const storeUser = useUser()
51
-
52
-
53
- // · initialize/inject plugins
54
- const route = useRoute()
55
-
56
-
57
- // ·
58
- const translations = {
59
- users: I18n.t("core.users"),
60
- shared: I18n.t("core.shared")
61
- }
62
-
63
-
64
- // ·
65
- const columns = [{
66
- field: 'id',
67
- label: 'ID'
68
- }, {
69
- field: 'user_agent',
70
- label: 'Device'
71
- }, {
72
- field: 'session_source',
73
- label: 'Source'
74
- }, {
75
- field: 'created_at_date',
76
- label: 'Created at'
77
- }, {
78
- field: 'last_used_at_string',
79
- label: 'Last used at'
80
- }]
81
-
82
-
83
- // ·
84
- onMounted(() => {
85
- storeUser.fetchSessions()
86
- })
87
-
88
- </script>
89
- <template>
90
- <lesli-card>
91
- <lesli-toolbar>
92
- <lesli-button icon="refresh">
93
- Reload
94
- </lesli-button>
95
- </lesli-toolbar>
96
- <lesli-table
97
- :columns="columns"
98
- :records="storeUser.sessions.records">
99
- <template #buttons="{ record, value }">
100
- <lesli-button danger icon="delete" @click="storeUser.deleteSession(record.id)">
101
- {{ translations.users.view_btn_logout }}
102
- </lesli-button>
103
- </template>
104
- </lesli-table>
105
- </lesli-card>
106
- </template>
@@ -1,94 +0,0 @@
1
- <script setup>
2
- /*
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 · Your Smart Business Assistant.
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://lesli.tech
28
- @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
29
-
30
- // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
31
- // ·
32
-
33
- */
34
-
35
-
36
- // · import vue tools
37
- import { ref, reactive, onMounted, watch, computed } from "vue"
38
-
39
-
40
- // · import lesli stores
41
- import { useUser } from "LesliApp/administration/stores/user"
42
-
43
-
44
- // · implement stores
45
- const storeUser = useUser()
46
-
47
-
48
- // · translations
49
- const translations = {
50
- users: I18n.t("core.users"),
51
- shared: I18n.t("core.shared")
52
- }
53
-
54
-
55
- // · initializing
56
- onMounted(() => {
57
- storeUser.getOptions()
58
- })
59
- </script>
60
- <template>
61
- <lesli-form @submit="storeUser.postLanguage">
62
- <div class="field is-horizontal">
63
- <div class="field-label">
64
- <label class="label">Select preferred language </label>
65
- </div>
66
- <div class="field-body">
67
- <div class="field is-narrow">
68
- <div class="control">
69
- <div class="select">
70
- <lesli-select
71
- icon="language"
72
- v-model="storeUser.user.locale.value"
73
- :options="storeUser.options.locales">
74
- </lesli-select>
75
- </div>
76
- </div>
77
- </div>
78
- </div>
79
- </div>
80
- <div class="field is-horizontal">
81
- <div class="field-label is-normal">
82
- </div>
83
- <div class="field-body">
84
- <div class="field">
85
- <div class="control">
86
- <lesli-button icon="save">
87
- {{ translations.shared.view_btn_save }}
88
- </lesli-button>
89
- </div>
90
- </div>
91
- </div>
92
- </div>
93
- </lesli-form>
94
- </template>