lesli 5.0.4 → 5.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/lesli/brand/app-logo2.svg +52 -0
  3. data/app/assets/javascripts/lesli/users/passwords.js +3 -3
  4. data/app/assets/javascripts/lesli/users/registrations.js +3 -3
  5. data/app/assets/javascripts/lesli/users/sessions.js +3 -3
  6. data/app/controllers/lesli/application_controller.rb +3 -3
  7. data/app/controllers/lesli/application_lesli_controller.rb +2 -2
  8. data/app/controllers/lesli/interfaces/application/authorization.rb +1 -1
  9. data/app/controllers/lesli/interfaces/application/requester.rb +1 -1
  10. data/app/controllers/lesli/shared/dashboards_controller.rb +308 -0
  11. data/app/controllers/users/confirmations_controller.rb +1 -1
  12. data/app/controllers/users/passwords_controller.rb +7 -10
  13. data/app/helpers/lesli/general_helper.rb +1 -1
  14. data/app/helpers/lesli/navigation_helper.rb +17 -16
  15. data/app/lib/lesli/system.rb +2 -1
  16. data/app/mailers/lesli/devise_mailer.rb +1 -1
  17. data/app/models/concerns/account_initializer.rb +9 -0
  18. data/app/models/lesli/account.rb +1 -0
  19. data/app/models/lesli/application_lesli_record.rb +1 -1
  20. data/app/models/lesli/shared/dashboard.rb +162 -0
  21. data/app/models/lesli/system_controller.rb +1 -0
  22. data/app/operators/lesli/controller_operator.rb +148 -0
  23. data/app/views/devise/passwords/new.html.erb +1 -1
  24. data/app/views/lesli/partials/_application-lesli-engines.html.erb +1 -1
  25. data/app/views/lesli/partials/_application-lesli-icons.html.erb +1 -1
  26. data/config/locales/translations.en.yml +17 -0
  27. data/config/locales/translations.es.yml +17 -0
  28. data/config/routes.rb +4 -2
  29. data/db/seed/development/users.rb +0 -1
  30. data/db/seeds.rb +16 -29
  31. data/lib/lesli/version.rb +1 -1
  32. data/lib/mailer_previews/devise_mailer_preview.rb +7 -0
  33. data/lib/sass/lesli/layouts/application-navbar.scss +1 -1
  34. data/lib/tasks/lesli/controllers.rake +1 -91
  35. data/lib/tasks/lesli/db.rake +36 -6
  36. data/lib/tasks/lesli/dev.rake +66 -0
  37. data/lib/tasks/lesli/engine.rake +59 -0
  38. data/lib/tasks/lesli/{role.rake → privileges.rake} +3 -3
  39. data/lib/tasks/lesli_tasks.rake +5 -0
  40. data/lib/vue/application.js +2 -1
  41. data/lib/vue/devise/passwords.js +8 -8
  42. data/lib/vue/devise/registrations.js +2 -2
  43. data/lib/vue/devise/sessions.js +11 -6
  44. data/lib/vue/layouts/application-header.vue +6 -1
  45. data/lib/vue/shared/dashboards/apps/edit.vue +215 -0
  46. data/lib/vue/{apps → shared}/dashboards/apps/index.vue +3 -5
  47. data/lib/vue/{apps → shared}/dashboards/apps/show.vue +26 -16
  48. data/lib/vue/{apps → shared}/dashboards/components/form.vue +31 -43
  49. data/lib/vue/shared/stores/dashboard.js +251 -0
  50. data/lib/vue/stores/translations.json +24 -72
  51. data/lib/vue/stores/{user.js → users.js} +1 -1
  52. data/lib/webpack/base.js +3 -2
  53. data/readme.md +1 -1
  54. metadata +46 -52
  55. data/lib/vue/apps/dashboards/apps/edit.vue +0 -105
  56. data/lib/vue/apps/dashboards/components/preview.vue +0 -172
  57. /data/app/assets/icons/lesli/{cloud-vault.svg → cloud-guard.svg} +0 -0
  58. /data/lib/vue/{apps → shared}/cloudobjects/action.vue +0 -0
  59. /data/lib/vue/{apps → shared}/cloudobjects/discussion/content.vue +0 -0
  60. /data/lib/vue/{apps → shared}/cloudobjects/discussion/element.vue +0 -0
  61. /data/lib/vue/{apps → shared}/cloudobjects/discussion/filters.vue +0 -0
  62. /data/lib/vue/{apps → shared}/cloudobjects/discussion/new.vue +0 -0
  63. /data/lib/vue/{apps → shared}/cloudobjects/discussion.vue +0 -0
  64. /data/lib/vue/{apps → shared}/cloudobjects/file/grid.vue +0 -0
  65. /data/lib/vue/{apps → shared}/cloudobjects/file/list.vue +0 -0
  66. /data/lib/vue/{apps → shared}/cloudobjects/file.vue +0 -0
  67. /data/lib/vue/{apps → shared}/dashboards/apps/new.vue +0 -0
  68. /data/lib/vue/{apps → shared}/workflows2/apps/actions/form.vue +0 -0
  69. /data/lib/vue/{apps → shared}/workflows2/apps/actions/forms/chatroom-form.vue +0 -0
  70. /data/lib/vue/{apps → shared}/workflows2/apps/actions/forms/cloud-object-clone-form.vue +0 -0
  71. /data/lib/vue/{apps → shared}/workflows2/apps/actions/forms/cloud-object-file-form.vue +0 -0
  72. /data/lib/vue/{apps → shared}/workflows2/apps/actions/forms/email-form.vue +0 -0
  73. /data/lib/vue/{apps → shared}/workflows2/apps/actions/forms/notification-form.vue +0 -0
  74. /data/lib/vue/{apps → shared}/workflows2/apps/actions/forms/send-cloud-object-file.vue +0 -0
  75. /data/lib/vue/{apps → shared}/workflows2/apps/actions/forms/task-form.vue +0 -0
  76. /data/lib/vue/{apps → shared}/workflows2/apps/actions/index.vue +0 -0
  77. /data/lib/vue/{apps → shared}/workflows2/apps/checks/form.vue +0 -0
  78. /data/lib/vue/{apps → shared}/workflows2/apps/checks/index.vue +0 -0
  79. /data/lib/vue/{apps → shared}/workflows2/apps/index.vue +0 -0
  80. /data/lib/vue/{apps → shared}/workflows2/apps/new.vue +0 -0
  81. /data/lib/vue/{apps → shared}/workflows2/apps/show.vue +0 -0
  82. /data/lib/vue/{apps → shared}/workflows2/components/associations.vue +0 -0
  83. /data/lib/vue/{apps → shared}/workflows2/components/chart.vue +0 -0
  84. /data/lib/vue/{apps → shared}/workflows2/components/workflow-form.vue +0 -0
  85. /data/lib/vue/{apps → shared}/workflows2/components/workflow-status-dropdown.vue +0 -0
@@ -0,0 +1,215 @@
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
+ import { useRouter, useRoute } from "vue-router"
37
+
38
+
39
+ // · import stores
40
+ import { useDashboard } from "Lesli/shared/stores/dashboard"
41
+
42
+
43
+ // · import components
44
+ import dashboardForm from "../components/form.vue"
45
+
46
+
47
+ // ·
48
+ const route = useRoute()
49
+ const router = useRouter()
50
+ const url = inject("url")
51
+
52
+
53
+ // · implement stores
54
+ const storeDashboard = useDashboard()
55
+
56
+
57
+ // · defining props
58
+ const props = defineProps({
59
+ components: {
60
+ type: Object,
61
+ require: false,
62
+ default: {}
63
+ }
64
+ })
65
+
66
+
67
+ // · translations
68
+ const translations = {
69
+ main: I18n.t(`${props.engine}.dashboards`),
70
+ dashboards: I18n.t('core.dashboards'),
71
+ core: I18n.t('core.shared')
72
+ }
73
+
74
+
75
+ // ·
76
+ const onDeleteDashboard = () => {
77
+ storeDashboard.deleteDashboard().then(()=> {
78
+ router.push(url[props.engine]('dashboards').s)
79
+ })
80
+ }
81
+
82
+
83
+ // ·
84
+ function sizeIncrease(component) {
85
+ if (component.layout >= 12) {
86
+ return
87
+ }
88
+ component.layout++
89
+ }
90
+
91
+
92
+ // ·
93
+ function sizeDecrease(component) {
94
+ if (component.layout <= 3) {
95
+ return
96
+ }
97
+ component.layout--
98
+ }
99
+
100
+
101
+ // ·
102
+ function remove(component) {
103
+ component._destroy = true
104
+ }
105
+
106
+
107
+ // ·
108
+ onMounted(() => {
109
+ storeDashboard.setEngine(lesli.engine)
110
+ storeDashboard.getDashboard(route.params.id)
111
+ storeDashboard.getDashboardOptions()
112
+ })
113
+
114
+ </script>
115
+ <template>
116
+ <lesli-application-container>
117
+ <lesli-header :title="storeDashboard.dashboard.name">
118
+ <lesli-button icon="list">
119
+ {{ translations.core.view_btn_list }}
120
+ </lesli-button>
121
+ </lesli-header>
122
+
123
+ <!-- Dashboard general configuration -->
124
+ <dashboard-form is-editable></dashboard-form>
125
+
126
+ <!-- Dashboard components -->
127
+ <template v-if="storeDashboard.dashboard.components">
128
+ <div class="columns is-multiline is-variable is-4 dashboard-components">
129
+ <template v-for="(component, index) in storeDashboard.dashboard.components" :key="index">
130
+ <div :class="['column', 'is-' + component?.layout]">
131
+
132
+ <!-- Dashboard widget component when in edition mode -->
133
+ <div class="edit">
134
+
135
+ <!-- Dashboard widget preview -->
136
+ <component
137
+ :component.sync="component"
138
+ :is="props.components[component.component_id]">
139
+ </component>
140
+
141
+ <!-- Edition controls -->
142
+ <div class="mt-4 mb-2">
143
+ <div class="field has-addons is-justify-content-center">
144
+ <p class="control">
145
+ <button class="button is-small" @click="sizeDecrease(component)">
146
+ <span class="icon is-small">
147
+ <span class="material-icons">
148
+ remove
149
+ </span>
150
+ </span>
151
+ </button>
152
+ </p>
153
+ <p class="control control-label has-text-centered">
154
+ size
155
+ </p>
156
+ <p class="control">
157
+ <button class="button is-small" @click="sizeIncrease(component)">
158
+ <span class="icon is-small">
159
+ <span class="material-icons">
160
+ add
161
+ </span>
162
+ </span>
163
+ </button>
164
+ </p>
165
+ </div>
166
+
167
+ <div class="field has-addons is-justify-content-center">
168
+ <p class="control">
169
+ <button class="button is-small" @click="sizeDecrease(component)">
170
+ <span class="icon is-small">
171
+ <span class="material-icons">
172
+ chevron_left
173
+ </span>
174
+ </span>
175
+ </button>
176
+ </p>
177
+ <p class="control control-label has-text-centered px-4">
178
+ position
179
+ </p>
180
+ <p class="control">
181
+ <button class="button is-small" @click="sizeIncrease(component)">
182
+ <span class="icon is-small">
183
+ <span class="material-icons">
184
+ chevron_right
185
+ </span>
186
+ </span>
187
+ </button>
188
+ </p>
189
+ </div>
190
+
191
+ <div class="has-text-centered">
192
+ <lesli-button small danger icon="delete" @click="remove(component)">
193
+ remove
194
+ </lesli-button>
195
+ </div>
196
+ </div>
197
+ </div>
198
+ </div>
199
+ </template>
200
+ </div>
201
+ </template>
202
+
203
+ </lesli-application-container>
204
+ </template>
205
+ <style>
206
+ .dashboard-components .edit {
207
+ border-radius: 6px;
208
+ padding: 1.2rem 1.4rem;
209
+ border: 1px solid #CCC;
210
+ background-color: #FFF8F8;
211
+ }
212
+ .dashboard-components .edit .control-label {
213
+ width: 100px;
214
+ }
215
+ </style>
@@ -1,6 +1,5 @@
1
1
  <script setup>
2
2
  /*
3
-
4
3
  Lesli
5
4
 
6
5
  Copyright (c) 2023, Lesli Technologies, S. A.
@@ -18,18 +17,17 @@ GNU General Public License for more details.
18
17
  You should have received a copy of the GNU General Public License
19
18
  along with this program. If not, see http://www.gnu.org/licenses/.
20
19
 
21
- Lesli · Your Smart Business Assistant.
20
+ Lesli · Ruby on Rails SaaS Development Framework.
22
21
 
23
22
  Made with ♥ by https://www.lesli.tech
24
23
  Building a better future, one line of code at a time.
25
24
 
26
25
  @contact hello@lesli.tech
27
- @website https://lesli.tech
26
+ @website https://www.lesli.tech
28
27
  @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
29
28
 
30
- // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
29
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
31
30
  // ·
32
-
33
31
  */
34
32
 
35
33
 
@@ -17,7 +17,7 @@ GNU General Public License for more details.
17
17
  You should have received a copy of the GNU General Public License
18
18
  along with this program. If not, see http://www.gnu.org/licenses/.
19
19
 
20
- Lesli · Ruby on Rails SaaS development platform.
20
+ Lesli · Ruby on Rails SaaS Development Framework.
21
21
 
22
22
  Made with ♥ by https://www.lesli.tech
23
23
  Building a better future, one line of code at a time.
@@ -45,32 +45,42 @@ const storeDashboard = useDashboard()
45
45
 
46
46
  // ·
47
47
  const props = defineProps({
48
- engine: {
49
- type: String,
50
- require: true
51
- },
52
48
  components: {
53
49
  type: Object,
54
- require: true
50
+ require: false,
51
+ default: {}
55
52
  }
56
53
  })
57
54
 
58
55
 
59
56
  // ·
60
57
  onMounted(() => {
61
- storeDashboard.engine = props.engine
62
- storeDashboard.getDashboard(props.engine)
58
+ storeDashboard.setEngine(lesli.engine)
59
+ storeDashboard.getDashboard()
63
60
  })
64
61
 
65
62
  </script>
66
63
  <template>
67
- <application-component>
68
- <div class="columns is-multiline is-variable is-4 dashboard-components">
69
- <div
70
- v-for="(component, index) in storeDashboard.dashboard.components" :key="index"
71
- :class="['column', 'is-' + component?.layout]">
72
- <component :component.sync="component" :is="components[component.component_id]"></component>
64
+ <lesli-application-container>
65
+
66
+ <lesli-header :title="storeDashboard.dashboard.name"></lesli-header>
67
+
68
+ <template v-if="storeDashboard.dashboard.components">
69
+ <div class="columns is-multiline is-variable is-4 dashboard-components">
70
+ <template v-for="(component, index) in storeDashboard.dashboard.components" :key="index">
71
+ <div :class="['column', 'is-' + component?.layout]">
72
+ <component
73
+ :component.sync="component"
74
+ :is="props.components[component.component_id]">
75
+ </component>
76
+ </div>
77
+ </template>
73
78
  </div>
74
- </div>
75
- </application-component>
79
+ </template>
80
+
81
+ <lesli-empty
82
+ v-if="!storeDashboard.dashboard.components || storeDashboard.dashboard.components.length <= 0"
83
+ text="Empty dashboard">
84
+ </lesli-empty>
85
+ </lesli-application-container>
76
86
  </template>
@@ -56,17 +56,12 @@ const msg = inject("msg")
56
56
  const route = useRoute()
57
57
 
58
58
 
59
- // · defining props
59
+ // ·
60
60
  const props = defineProps({
61
61
  isEditable: {
62
62
  type: Boolean,
63
- required: false,
64
- default: false,
65
- },
66
- engine: {
67
- type: String,
68
- required: true,
69
- },
63
+ require: false
64
+ }
70
65
  })
71
66
 
72
67
 
@@ -81,6 +76,7 @@ const translations = {
81
76
  }
82
77
 
83
78
 
79
+ // ·
84
80
  const default_options = {
85
81
  yes: {
86
82
  label: translations.core.view_text_yes,
@@ -93,6 +89,7 @@ const default_options = {
93
89
  }
94
90
 
95
91
 
92
+ // ·
96
93
  const layout_options = [{
97
94
  label: '25%',
98
95
  value: 3
@@ -114,27 +111,21 @@ const layout_options = [{
114
111
  }]
115
112
 
116
113
 
117
- /**
118
- * @description This function is used to update the workflow information
119
- */
114
+ // ·
120
115
  const onUpdate = () => {
121
116
  storeDashboard.updateDashboard()
122
117
  }
123
118
 
124
119
 
125
- /**
126
- * @description This function is used to create a new workflow
127
- */
120
+ // ·
128
121
  const onCreate = () => {
129
122
  storeDashboard.postDashboard().then(()=> {
130
- router.push(url[props.engine]('dashboards').s)
123
+ router.push(url[storeDashboard.engine]('dashboards').s)
131
124
  })
132
125
  }
133
126
 
134
127
 
135
- /**
136
- * @description This function is used to add a new component to dashboard
137
- */
128
+ // ·
138
129
  function addComponent(){
139
130
  msg.warning(translations.dashboards.messages_warning_save_changes_reminder)
140
131
  let new_component = {
@@ -155,9 +146,7 @@ function addComponent(){
155
146
  }
156
147
 
157
148
 
158
- /**
159
- * @description This function is used to select a component
160
- */
149
+ // ·
161
150
  function selectDashboardComponent(selected_component){
162
151
  if(storeDashboard.dashboard.components.find( component => component.id == selected_component.id)){
163
152
  storeDashboard.selected_dashboard_component = selected_component
@@ -165,9 +154,7 @@ function selectDashboardComponent(selected_component){
165
154
  }
166
155
 
167
156
 
168
- /**
169
- * @description This function is used to remove a component from the dashboard
170
- */
157
+ // ·
171
158
  function removeComponent(deleted_component){
172
159
  msg.warning(translations.dashboards.messages_warning_save_changes_reminder)
173
160
  storeDashboard.dashboard.components = storeDashboard.dashboard.components.filter((component)=> {
@@ -182,32 +169,30 @@ function removeComponent(deleted_component){
182
169
  }
183
170
 
184
171
 
185
- onMounted(() => {
186
- storeDashboard.engine = props.engine
187
- if (!props.isEditable){
188
- storeDashboard.resetDashboard()
189
- } else {
190
- storeDashboard.fetchDashboard(route.params?.id)
191
- }
192
- })
193
-
194
- // This function is used to delete a dashboard
172
+ // ·
195
173
  function onDeleteDashboard() {
196
174
  storeDashboard.deleteDashboard().then(()=> {
197
175
  router.push(url[props.engine]('dashboards').s)
198
176
  })
199
177
  }
200
178
 
179
+
180
+ // ·
181
+ onMounted(() => {
182
+ if (!props.isEditable){
183
+ storeDashboard.resetDashboard()
184
+ }
185
+ })
201
186
  </script>
202
187
  <template>
203
188
  <lesli-form class="mb-6" @submit="isEditable ? onUpdate() : onCreate()">
204
189
  <div class="columns">
190
+
191
+ <!-- Name -->
205
192
  <div class="column is-4">
206
- <!-- Name -->
207
193
  <div class="field">
208
194
  <label class="label">
209
- {{translations.dashboards.column_name}}
210
- <sup class="has-text-danger">*</sup>
195
+ {{ "translations.dashboards.column_name" }}
211
196
  </label>
212
197
  <div class="control">
213
198
  <input class="input" type="text" v-model="storeDashboard.dashboard.name" required>
@@ -215,10 +200,10 @@ function onDeleteDashboard() {
215
200
  </div>
216
201
  </div>
217
202
 
203
+ <!-- Role -->
218
204
  <div class="column is-4">
219
- <!-- Role -->
220
205
  <div class="field">
221
- <label class="label">{{ translations.dashboards.column_roles_id }}</label>
206
+ <label class="label">{{ "translations.dashboards.column_roles_id" }}</label>
222
207
  <div class="control">
223
208
  <lesli-select
224
209
  v-model="storeDashboard.dashboard.roles_id"
@@ -228,10 +213,10 @@ function onDeleteDashboard() {
228
213
  </div>
229
214
  </div>
230
215
 
216
+ <!-- Default -->
231
217
  <div class="column is-4">
232
- <!-- Default -->
233
218
  <div class="field">
234
- <label class="label">{{ translations.dashboards.column_default }}</label>
219
+ <label class="label">{{ "translations.dashboards.column_default" }}</label>
235
220
  <lesli-select
236
221
  v-model="storeDashboard.dashboard.default"
237
222
  :options="default_options">
@@ -240,11 +225,12 @@ function onDeleteDashboard() {
240
225
  </div>
241
226
  </div>
242
227
 
243
- <!-- Save button -->
244
228
  <div class="is-flex is-justify-content-space-between">
229
+
230
+ <!-- Components -->
245
231
  <div class="field">
246
232
  <label class="label">
247
- {{ translations.dashboards.view_title_add_component }}
233
+ {{ "translations.dashboards.view_title_add_component" }}
248
234
  </label>
249
235
  <div class="control">
250
236
  <lesli-select
@@ -254,6 +240,8 @@ function onDeleteDashboard() {
254
240
  </lesli-select>
255
241
  </div>
256
242
  </div>
243
+
244
+ <!-- Save button -->
257
245
  <div class="buttons">
258
246
  <lesli-button icon="save" :loading="storeDashboard.loading">
259
247
  {{ translations.dashboards.view_btn_save_dashboard }}