lesli 5.0.1 → 5.0.2
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.
- checksums.yaml +4 -4
- data/app/assets/config/lesli_manifest.js +7 -4
- data/app/assets/fonts/lesli/Domine/Domine-VariableFont_wght.ttf +0 -0
- data/app/assets/fonts/lesli/Domine/OFL.txt +2 -0
- data/app/assets/javascripts/lesli/users/passwords.js +776 -0
- data/app/assets/javascripts/lesli/users/registrations.js +776 -0
- data/app/assets/javascripts/lesli/users/sessions.js +776 -1
- data/app/assets/stylesheets/lesli/users/passwords.scss +5 -6
- data/app/assets/stylesheets/lesli/users/registrations.scss +5 -6
- data/app/assets/stylesheets/lesli/users/sessions.scss +5 -10
- data/app/controllers/lesli/application_lesli_controller.rb +0 -1
- data/app/controllers/lesli/interfaces/application/logger.rb +9 -9
- data/app/controllers/lesli/roles_controller.rb +43 -0
- data/{lib/sass/lesli/devise/registrations.scss.erb → app/controllers/lesli/users_controller.rb} +18 -23
- data/app/controllers/users/registrations_controller.rb +137 -58
- data/app/helpers/lesli/assets_helper.rb +2 -2
- data/app/helpers/lesli/general_helper.rb +1 -1
- data/app/helpers/lesli/navigation_helper.rb +7 -10
- data/app/helpers/lesli/system_helper.rb +1 -1
- data/app/lib/lesli/system.rb +7 -3
- data/app/mailers/lesli/application_lesli_mailer.rb +199 -0
- data/app/mailers/lesli/application_mailer.rb +7 -0
- data/app/mailers/lesli/devise_mailer.rb +33 -0
- data/app/models/concerns/user_guard.rb +3 -4
- data/app/models/lesli/account.rb +29 -0
- data/{lib/sass/lesli/pages/passes.scss → app/models/lesli/descriptor.rb} +14 -8
- data/app/models/lesli/role.rb +90 -0
- data/app/models/lesli/system_controller.rb +1 -0
- data/app/models/lesli/user/detail.rb +55 -0
- data/{lib/sass/lesli/pages/otps.scss → app/models/lesli/user/role.rb} +13 -9
- data/app/models/lesli/user.rb +4 -3
- data/app/services/lesli/role_service.rb +45 -0
- data/app/services/lesli/user_service.rb +69 -0
- data/app/views/devise/passwords/new.html.erb +72 -12
- data/app/views/devise/registrations/new.html.erb +146 -28
- data/app/views/devise/sessions/new.html.erb +11 -78
- data/app/views/devise/shared/_links.html.erb +96 -25
- data/app/views/lesli/emails/devise_mailer/confirmation_instructions.html.erb +23 -0
- data/app/views/lesli/emails/user_mailer/invitation.html.erb +23 -0
- data/app/views/lesli/layouts/application-devise.html.erb +1 -1
- data/app/views/lesli/layouts/application-public.html.erb +2 -2
- data/app/views/lesli/layouts/mailer.html.erb +13 -0
- data/app/views/lesli/layouts/mailer.text.erb +1 -0
- data/app/views/lesli/partials/_application-lesli-header.html.erb +27 -41
- data/app/views/lesli/partials/_application-lesli-javascript.html.erb +10 -6
- data/app/views/lesli/partials/_application-public-javascript.html.erb +12 -8
- data/{lib/sass/lesli/devise/confirmations.scss.erb → app/views/lesli/wrappers/_application-devise-simple.erb} +30 -46
- data/app/views/lesli/wrappers/{_application-auth.html.erb → _application-devise.html.erb} +15 -0
- data/config/initializers/{lesli_defaults.rb → lesli.rb} +4 -2
- data/config/locales/translations.en.yml +7 -0
- data/config/locales/translations.es.yml +7 -0
- data/config/routes.rb +22 -17
- data/db/migrate/v1.0/0010000210_create_lesli_roles.rb +1 -1
- data/db/{tables/0010003010_create_user_details.rb → migrate/v1.0/0010003010_create_lesli_user_details.rb} +6 -6
- data/db/{tables/0010003510_create_user_roles.rb → migrate/v1.0/0010003410_create_lesli_user_roles.rb} +4 -4
- data/db/{tables/0010005010_create_descriptors.rb → migrate/v1.0/0010005010_create_lesli_descriptors.rb} +5 -6
- data/db/{tables/0010005110_create_descriptor_privileges.rb → migrate/v1.0/0010005110_create_lesli_descriptor_privileges.rb} +8 -7
- data/db/{tables/0010005210_create_descriptor_activities.rb → migrate/v1.0/0010005210_create_lesli_descriptor_activities.rb} +6 -8
- data/db/seeds.rb +0 -2
- data/lib/lesli/engine.rb +25 -2
- data/lib/lesli/routing.rb +26 -0
- data/lib/lesli/version.rb +2 -2
- data/lib/lesli.rb +1 -0
- data/lib/{sass/lesli/pages/mfas.scss → mailer_previews/devise_mailer_preview.rb} +12 -6
- data/lib/sass/lesli/bulma/loader.scss +3 -0
- data/lib/sass/lesli/elements/header.scss +1 -1
- data/lib/sass/lesli/fonts/families.scss +3 -3
- data/lib/sass/lesli/layouts/application-container.scss +4 -0
- data/lib/sass/lesli/{devise/passwords.scss.erb → pages/devise-simple.scss} +38 -38
- data/lib/sass/lesli/{templates → pages}/devise.scss +4 -26
- data/lib/sass/lesli/settings/variables.scss +1 -1
- data/lib/sass/lesli/templates/application.scss +8 -4
- data/lib/sass/lesli/templates/dashboards.scss +8 -0
- data/lib/sass/lesli/templates/public.scss +2 -3
- data/lib/tasks/lesli/controllers.rake +33 -0
- data/lib/tasks/lesli/db.rake +88 -0
- data/lib/tasks/lesli/git.rake +74 -0
- data/lib/tasks/lesli_tasks.rake +70 -20
- data/lib/vue/devise/registrations.js +10 -15
- data/lib/vue/layouts/application-container.vue +10 -2
- data/lib/vue/layouts/application-header.vue +10 -3
- data/lib/vue/stores/account.js +113 -0
- data/lib/vue/stores/role.js +243 -0
- data/lib/vue/stores/translations.json +86 -0
- data/lib/vue/stores/user.js +102 -0
- data/lib/{sass/lesli/devise/sessions.scss → vue/translation.js} +14 -5
- data/lib/webpack/base.js +2 -2
- data/lib/webpack/core.js +2 -0
- data/readme.md +74 -55
- metadata +196 -51
- data/app/assets/fonts/lesli/Domine/Domine-Bold.ttf +0 -0
- data/app/assets/fonts/lesli/Domine/Domine-Regular.ttf +0 -0
- data/app/assets/stylesheets/lesli/users/devise.scss +0 -32
- data/app/controllers/lesli/profiles_controller.rb +0 -60
- data/app/helpers/lesli/profiles_helper.rb +0 -4
- data/app/models/lesli/profile.rb +0 -4
- data/app/views/lesli/devise/sessions/_form.html.erb +0 -17
- data/app/views/lesli/devise/sessions/_session.html.erb +0 -2
- data/app/views/lesli/devise/sessions/edit.html.erb +0 -10
- data/app/views/lesli/devise/sessions/index.html.erb +0 -14
- data/app/views/lesli/devise/sessions/new.html.erb +0 -9
- data/app/views/lesli/devise/sessions/show.html.erb +0 -10
- data/app/views/lesli/profiles/_form.html.erb +0 -17
- data/app/views/lesli/profiles/_profile.html.erb +0 -2
- data/app/views/lesli/profiles/edit.html.erb +0 -10
- data/app/views/lesli/profiles/index.html.erb +0 -14
- data/app/views/lesli/profiles/new.html.erb +0 -9
- data/app/views/lesli/profiles/show.html.erb +0 -10
- data/lib/sass/lesli/pages/dashboards.scss +0 -57
- data/lib/tasks/db.rb +0 -76
- data/lib/vue/stores/profile.js +0 -90
- data/lib/vue/stores/workflow2.js +0 -345
- data/lib/vue/stores/workflows/actions.js +0 -327
- data/lib/vue/stores/workflows/associations.js +0 -130
- data/lib/vue/stores/workflows/checks.js +0 -210
- /data/lib/vue/stores/{announcements.js → entities/announcements.js} +0 -0
- /data/lib/vue/stores/{dashboard.js → entities/dashboard.js} +0 -0
- /data/lib/vue/stores/{workflow.js → entities/workflow.js} +0 -0
- /data/lib/vue/stores/{cloud-bell → panels}/notification.js +0 -0
- /data/lib/vue/stores/{firebase.js → services/firebase.js} +0 -0
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/*
|
|
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 platform.
|
|
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
|
-
// ·
|
|
35
|
-
.dashboard-components {
|
|
36
|
-
.column {
|
|
37
|
-
margin-bottom: .6rem;
|
|
38
|
-
|
|
39
|
-
div.component-chart {
|
|
40
|
-
border-radius: .6rem;
|
|
41
|
-
box-shadow: $lesli-box-shadow;
|
|
42
|
-
background-color: lesli-css-color(solid, white);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// widgets with tables
|
|
46
|
-
table.lesli-table {
|
|
47
|
-
box-shadow: $lesli-box-shadow;
|
|
48
|
-
thead {
|
|
49
|
-
background-color: transparent;
|
|
50
|
-
border-bottom: 1px solid lesli-css-color(slate);
|
|
51
|
-
th {
|
|
52
|
-
padding-bottom: 0px;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
data/lib/tasks/db.rb
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
=begin
|
|
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.dev
|
|
27
|
-
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
|
28
|
-
|
|
29
|
-
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
|
30
|
-
// ·
|
|
31
|
-
=end
|
|
32
|
-
|
|
33
|
-
# Build, migrate & seed database (development only)
|
|
34
|
-
def setup
|
|
35
|
-
|
|
36
|
-
L2.br(2)
|
|
37
|
-
L2.info("Setup Lesli database for development")
|
|
38
|
-
|
|
39
|
-
Rake::Task['db:create'].invoke
|
|
40
|
-
Rake::Task['db:migrate'].invoke
|
|
41
|
-
Rake::Task['db:seed'].invoke
|
|
42
|
-
seed()
|
|
43
|
-
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
# Drop, build, migrate & seed database (development only)
|
|
48
|
-
def reset
|
|
49
|
-
|
|
50
|
-
return if Rails.env.production?
|
|
51
|
-
|
|
52
|
-
L2.br(2)
|
|
53
|
-
L2.info("Reset Lesli database for development")
|
|
54
|
-
|
|
55
|
-
Rake::Task['db:drop'].invoke
|
|
56
|
-
Rake::Task['db:create'].invoke
|
|
57
|
-
Rake::Task['db:migrate'].invoke
|
|
58
|
-
Rake::Task['db:seed'].invoke
|
|
59
|
-
seed()
|
|
60
|
-
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
# Drop, build, migrate & seed database (development only)
|
|
65
|
-
def seed
|
|
66
|
-
|
|
67
|
-
return if Rails.env.production?
|
|
68
|
-
|
|
69
|
-
L2.br(2)
|
|
70
|
-
L2.info("Seed Lesli database for #{ Rails.env.downcase } environment")
|
|
71
|
-
|
|
72
|
-
Lesli::Engine.load_seed
|
|
73
|
-
LesliBell::Engine.load_seed if defined?(LesliBell)
|
|
74
|
-
LesliAudit::Engine.load_seed if defined?(LesliAudit)
|
|
75
|
-
|
|
76
|
-
end
|
data/lib/vue/stores/profile.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/*
|
|
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 · Your Smart Business Assistant.
|
|
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://lesli.tech
|
|
27
|
-
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
|
28
|
-
|
|
29
|
-
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
|
30
|
-
// ·
|
|
31
|
-
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
// ·
|
|
37
|
-
import { defineStore } from "pinia"
|
|
38
|
-
import { useUser } from "LesliApp/administration/stores/user"
|
|
39
|
-
import { useLesliUtils } from "lesli-vue/composables"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const storeUtils = useLesliUtils()
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
// ·
|
|
46
|
-
export const useProfile = defineStore("profile", {
|
|
47
|
-
state: () => {
|
|
48
|
-
return {
|
|
49
|
-
storeUser: useUser(),
|
|
50
|
-
loading: false,
|
|
51
|
-
profile: {
|
|
52
|
-
detail_attributes: {}
|
|
53
|
-
},
|
|
54
|
-
roles: [],
|
|
55
|
-
new_email: null
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
actions: {
|
|
59
|
-
|
|
60
|
-
fetch() {
|
|
61
|
-
if (!this.profile.id) {
|
|
62
|
-
this.fetchProfile()
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
fetchProfile() {
|
|
67
|
-
this.loading = true
|
|
68
|
-
this.roles = []
|
|
69
|
-
this.http.get(this.url.admin("profile")).then(result => {
|
|
70
|
-
this.profile = result
|
|
71
|
-
this.profile['initials'] = storeUtils.initials(
|
|
72
|
-
this.profile.first_name,
|
|
73
|
-
this.profile.last_name
|
|
74
|
-
)
|
|
75
|
-
this.parseRoles(result.roles)
|
|
76
|
-
}).catch(error => {
|
|
77
|
-
console.log(error)
|
|
78
|
-
}).finally(() => {
|
|
79
|
-
this.loading = false
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
},
|
|
83
|
-
parseRoles(roles){
|
|
84
|
-
this.roles = []
|
|
85
|
-
roles.forEach(role =>{
|
|
86
|
-
this.roles.push(role.name)
|
|
87
|
-
})
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
})
|
data/lib/vue/stores/workflow2.js
DELETED
|
@@ -1,345 +0,0 @@
|
|
|
1
|
-
/*
|
|
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 · Your Smart Business Assistant.
|
|
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://lesli.tech
|
|
27
|
-
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
|
28
|
-
|
|
29
|
-
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
|
30
|
-
// ·
|
|
31
|
-
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
// · This store is needed to make http requests, manage the reactivity
|
|
36
|
-
// · of a workflow.
|
|
37
|
-
|
|
38
|
-
import { defineStore } from "pinia"
|
|
39
|
-
import { toHandlers } from "vue"
|
|
40
|
-
|
|
41
|
-
export const useWorkflow = defineStore("core.shared.workflow", {
|
|
42
|
-
state: () => {
|
|
43
|
-
return {
|
|
44
|
-
transitionOptions: [],
|
|
45
|
-
workflows: [],
|
|
46
|
-
loading: false,
|
|
47
|
-
cloudModule: null,
|
|
48
|
-
cloudObject: null,
|
|
49
|
-
cloudObjectId: null,
|
|
50
|
-
workflow: {},
|
|
51
|
-
new_status_name: '',
|
|
52
|
-
deleted_workflow_statuses: [],
|
|
53
|
-
selected_status: {},
|
|
54
|
-
status_select: [],
|
|
55
|
-
status_transition: null,
|
|
56
|
-
transition_statuses: [],
|
|
57
|
-
list_status: [],
|
|
58
|
-
|
|
59
|
-
workflowId: "",
|
|
60
|
-
workflowStatusId: "",
|
|
61
|
-
workflow_statuses: [],
|
|
62
|
-
currentStatus: {}
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
actions: {
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* @param {*} url is the url of the api to be called
|
|
69
|
-
* @description This action is used to fetch the list of transition options
|
|
70
|
-
*/
|
|
71
|
-
fetchWorkflows(url) {
|
|
72
|
-
this.loading = true
|
|
73
|
-
|
|
74
|
-
if (!url) url = this.url[this.cloudModule](this.cloudObject)
|
|
75
|
-
|
|
76
|
-
this.http.get(url).then(result => {
|
|
77
|
-
this.workflows = result.workflows
|
|
78
|
-
}).catch(error => {
|
|
79
|
-
this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
|
|
80
|
-
}).finally(() => {
|
|
81
|
-
this.loading = false
|
|
82
|
-
})
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* @param {string} stringToFind String to search for
|
|
87
|
-
* @description This action is used to search for a string in the workflows
|
|
88
|
-
*/
|
|
89
|
-
searchWorkflows(stringToFind) {
|
|
90
|
-
const workflowsUrl = this.url[this.cloudModule](this.cloudObject).search(stringToFind)
|
|
91
|
-
this.fetchWorkflows(workflowsUrl)
|
|
92
|
-
},
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* @description This action is used to get the statuses from a workflow
|
|
96
|
-
*/
|
|
97
|
-
async fetchWorkflowStatuses(){
|
|
98
|
-
|
|
99
|
-
this.loading = true
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
let cloudObjectScope = null
|
|
103
|
-
|
|
104
|
-
if (this.cloudObject.split("/").length >= 2) {
|
|
105
|
-
cloudObjectScope = this.cloudObject.split("/")[0]
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
let path = "workflows/:workflow_id/statuses"
|
|
110
|
-
|
|
111
|
-
if (cloudObjectScope) {
|
|
112
|
-
path = cloudObjectScope + "/" + path
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
let url = this.url[this.cloudModule](path, {
|
|
116
|
-
workflow_id: this.workflowId,
|
|
117
|
-
})
|
|
118
|
-
|
|
119
|
-
return this.http.get(url).then(result => {
|
|
120
|
-
this.workflow_statuses = result.sort((a, b) => a.number - b.number)
|
|
121
|
-
}).catch(error => {
|
|
122
|
-
this.msg.danger(I18n.t("core.shared").messages_danger_getting_transition_options)
|
|
123
|
-
}).finally(() => {
|
|
124
|
-
this.loading = false
|
|
125
|
-
})
|
|
126
|
-
},
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* @description This action is used to get the current status from workflow statuses
|
|
130
|
-
*/
|
|
131
|
-
getCurrentStatus(){
|
|
132
|
-
this.currentStatus = this.workflow_statuses.find((status)=> status.id === this.workflowStatusId)
|
|
133
|
-
},
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* @description This action is used to fetch the list of transition options
|
|
137
|
-
*/
|
|
138
|
-
fetchTransitionOptions(url) {
|
|
139
|
-
this.loading = true
|
|
140
|
-
|
|
141
|
-
// · If the cloud object has / split the url
|
|
142
|
-
let cloudObject = this.cloudObject.split("/").pop()
|
|
143
|
-
let cloudObjectScope = null
|
|
144
|
-
|
|
145
|
-
if (this.cloudObject.split("/").length >= 2) {
|
|
146
|
-
cloudObjectScope = this.cloudObject.split("/")[0]
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
// · Singularize the cloud object
|
|
150
|
-
let cloudObjectSingular = this.utils.singularize(cloudObject)
|
|
151
|
-
|
|
152
|
-
let path = "workflows/resources/transition-options/:cloudObject/:cloudObjectId"
|
|
153
|
-
|
|
154
|
-
if (cloudObjectScope) {
|
|
155
|
-
path = cloudObjectScope + "/" + path
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
if (!url) url = this.url[this.cloudModule](path, {
|
|
159
|
-
cloudObject: cloudObjectSingular,
|
|
160
|
-
cloudObjectId: this.cloudObjectId,
|
|
161
|
-
})
|
|
162
|
-
|
|
163
|
-
this.http.get(url).then(result => {
|
|
164
|
-
if (result === "") return this.transitionOptions = []
|
|
165
|
-
this.transitionOptions = result
|
|
166
|
-
}).catch(error => {
|
|
167
|
-
if (error?.message === "Not found") return this.transitionOptions = []
|
|
168
|
-
this.msg.danger(I18n.t("core.shared").messages_danger_getting_transition_options)
|
|
169
|
-
}).finally(() => {
|
|
170
|
-
this.loading = false
|
|
171
|
-
})
|
|
172
|
-
},
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* @param {*} payload
|
|
176
|
-
* @description This action is used to update the cloud object status
|
|
177
|
-
*/
|
|
178
|
-
updateStatus(payload) {
|
|
179
|
-
this.loading = true
|
|
180
|
-
|
|
181
|
-
const url = this.url[this.cloudModule](`${this.cloudObject}/:cloudObjectId`, { cloudObjectId: this.cloudObjectId })
|
|
182
|
-
|
|
183
|
-
this.http.put(url, payload).then(() => {
|
|
184
|
-
this.msg.success(I18n.t("core.shared").messages_success_status_changed)
|
|
185
|
-
this.fetchTransitionOptions()
|
|
186
|
-
}).catch(error => {
|
|
187
|
-
this.msg.danger(I18n.t("core.shared").messages_danger_updating_status)
|
|
188
|
-
}).finally(() => {
|
|
189
|
-
this.loading = false
|
|
190
|
-
})
|
|
191
|
-
},
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* @description This action is used to reset the store
|
|
195
|
-
*/
|
|
196
|
-
reset() {
|
|
197
|
-
this.transitionOptions = []
|
|
198
|
-
this.workflows = []
|
|
199
|
-
this.loading = false
|
|
200
|
-
this.cloudModule = null
|
|
201
|
-
this.cloudObject = null
|
|
202
|
-
this.cloudObjectId = null
|
|
203
|
-
},
|
|
204
|
-
/**
|
|
205
|
-
* @description This action is used to get the information from a workflow
|
|
206
|
-
*/
|
|
207
|
-
async fetchWorkflow (worfkflow_id){
|
|
208
|
-
this.loading = true
|
|
209
|
-
const url = this.url[this.cloudModule](`${this.cloudObject}/:workflowId`, { workflowId: worfkflow_id })
|
|
210
|
-
|
|
211
|
-
return this.http.get(url).then(result => {
|
|
212
|
-
this.workflow = result
|
|
213
|
-
this.loading = false
|
|
214
|
-
}).catch(error => {
|
|
215
|
-
this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
|
|
216
|
-
})
|
|
217
|
-
},
|
|
218
|
-
/**
|
|
219
|
-
* @description This action is used to post a workflow
|
|
220
|
-
*/
|
|
221
|
-
async postWorkflow (){
|
|
222
|
-
this.loading = true
|
|
223
|
-
let statuses_attributes = this.workflow.statuses
|
|
224
|
-
|
|
225
|
-
let data = {
|
|
226
|
-
workflow: {
|
|
227
|
-
name: this.workflow.name,
|
|
228
|
-
statuses_attributes: statuses_attributes
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
const url = this.url[this.cloudModule](`${this.cloudObject}`)
|
|
233
|
-
|
|
234
|
-
return this.http.post(url, data).then(result => {
|
|
235
|
-
this.workflow = result
|
|
236
|
-
this.msg.success(I18n.t("core.users.messages_success_operation"))
|
|
237
|
-
this.loading = false
|
|
238
|
-
}).catch(error => {
|
|
239
|
-
this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
|
|
240
|
-
}).finally(()=>{
|
|
241
|
-
this.loading = false
|
|
242
|
-
})
|
|
243
|
-
},
|
|
244
|
-
/**
|
|
245
|
-
* @description This action is used to update workflow info
|
|
246
|
-
*/
|
|
247
|
-
updateWorkflow(){
|
|
248
|
-
|
|
249
|
-
this.loading = true
|
|
250
|
-
const url = this.url[this.cloudModule](`${this.cloudObject}/:workflowId`, { workflowId: this.workflow.id })
|
|
251
|
-
|
|
252
|
-
this.http.put(url, {
|
|
253
|
-
workflow: {
|
|
254
|
-
name: this.workflow.name
|
|
255
|
-
}
|
|
256
|
-
}).then(result => {
|
|
257
|
-
this.msg.success(I18n.t("core.users.messages_success_operation"))
|
|
258
|
-
}).catch(error => {
|
|
259
|
-
this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
|
|
260
|
-
}).finally(()=>{
|
|
261
|
-
this.loading = false
|
|
262
|
-
})
|
|
263
|
-
},
|
|
264
|
-
/**
|
|
265
|
-
* @description This action is used to post a new status for the actual workflow
|
|
266
|
-
*/
|
|
267
|
-
async postStatus(){
|
|
268
|
-
this.loading = true
|
|
269
|
-
let new_status = {
|
|
270
|
-
next_statuses: '',
|
|
271
|
-
status_type: 'normal',
|
|
272
|
-
number: 0,
|
|
273
|
-
name: this.new_status_name
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
let data = {
|
|
277
|
-
workflow_status: new_status
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
const url = this.url[this.cloudModule](`${this.cloudObject}/:workflowId/statuses`, { workflowId: this.workflow.id })
|
|
281
|
-
|
|
282
|
-
return this.http.post(url, data).then(result => {
|
|
283
|
-
new_status.id = result.id
|
|
284
|
-
this.new_status_name = ''
|
|
285
|
-
}).catch(error => {
|
|
286
|
-
this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
|
|
287
|
-
}).finally(()=>{
|
|
288
|
-
this.loading = false
|
|
289
|
-
})
|
|
290
|
-
|
|
291
|
-
},
|
|
292
|
-
/**
|
|
293
|
-
* @description This action is used to post delete the actual workflow
|
|
294
|
-
*/
|
|
295
|
-
async deleteWorkflow(){
|
|
296
|
-
this.loading = true
|
|
297
|
-
const url = this.url[this.cloudModule](`${this.cloudObject}/:workflowId`, { workflowId: this.workflow.id })
|
|
298
|
-
|
|
299
|
-
return this.http.delete(url).then(result => {
|
|
300
|
-
this.msg.success(I18n.t("core.users.messages_success_operation"))
|
|
301
|
-
this.loading = false
|
|
302
|
-
}).catch(error => {
|
|
303
|
-
this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
|
|
304
|
-
})
|
|
305
|
-
},
|
|
306
|
-
/**
|
|
307
|
-
* @description This action is used to update statuses from a workflow
|
|
308
|
-
*/
|
|
309
|
-
updateWorkflowStatuses(){
|
|
310
|
-
|
|
311
|
-
this.loading = true
|
|
312
|
-
|
|
313
|
-
let statuses_attributes = Object.values(this.workflow.statuses).concat(this.deleted_workflow_statuses)
|
|
314
|
-
|
|
315
|
-
let data = {
|
|
316
|
-
workflow: {
|
|
317
|
-
name: this.workflow.name,
|
|
318
|
-
statuses_attributes: statuses_attributes
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
const url = this.url[this.cloudModule](`${this.cloudObject}/:workflowId`, { workflowId: this.workflow.id })
|
|
322
|
-
|
|
323
|
-
this.http.put(url, data).then(result => {
|
|
324
|
-
this.msg.success(I18n.t("core.users.messages_success_operation"))
|
|
325
|
-
this.deleted_workflow_statuses = []
|
|
326
|
-
}).catch(error => {
|
|
327
|
-
this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
|
|
328
|
-
}).finally(()=>{
|
|
329
|
-
this.loading = false
|
|
330
|
-
})
|
|
331
|
-
|
|
332
|
-
},
|
|
333
|
-
/**
|
|
334
|
-
* @description This action is used to post reset workflow values for the workflow form
|
|
335
|
-
*/
|
|
336
|
-
resetWorkflow(){
|
|
337
|
-
this.workflow = {}
|
|
338
|
-
this.selected_status = {},
|
|
339
|
-
this.status_select = [],
|
|
340
|
-
this.status_transition = null,
|
|
341
|
-
this.transition_statuses = [],
|
|
342
|
-
this.list_status = []
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
})
|