Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
community
pount
pount-front
Commits
9198fbf5
Commit
9198fbf5
authored
Oct 08, 2021
by
Jean Rabreau
Browse files
🚧
targeting set loads its template
parent
468816ef
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/store/template.js
View file @
9198fbf5
import
authority
from
'
@/assets/authAxios
'
import
i18n
from
'
@/plugins/vue-i18n
'
/**
* @typedef {Object} UsfLayout
* @property {string} id
* @property {boolean} [exist]
* @property {boolean} visible
* @property {boolean} [vertical]
* @property {boolean} [width]
* @property {string} component
* @property {string} parentId
* @property {UsfField[]} fields
*/
/**
* @typedef {Object} UsfInput
* @property {string} id
* @property {boolean} exist
* @property {boolean} visible
*/
/**
* @typedef {UsfInput|UsfLayout} UsfField
* @typedef {Object} UsfField
* @property {string} id -
* @property {string} name -
* @property {string} component - "Usf" prefixed form builder name
* @property {boolean} exist -
* @property {boolean} visible -
* @property {string} parentId - parent id or "root"
* @property {UsfField[]} [fields] - layout children
* @property {boolean} [required] -
* @property {boolean} [vertical] - row direction
* @property {boolean} [width] - col width
*/
...
...
@@ -73,6 +62,23 @@ const getPrivateFields = (fields, privateParent=false) => {
},
[])
}
/**
*
* @param {UsfField[]} fields
* @return {UsfField[]}
*/
const
getInputFields
=
(
fields
)
=>
{
return
fields
.
reduce
((
names
,
field
)
=>
{
if
(
field
.
name
)
{
names
.
push
(
field
)
}
if
(
field
.
fields
)
{
names
.
push
(...
getInputFields
(
field
.
fields
))
}
return
names
},
[])
}
export
{
TEMPLATE_SCOPE
,
LAYOUT_COMPONENTS
,
getPrivateFields
}
...
...
@@ -115,6 +121,7 @@ const Template = {
},
getters
:
{
current
:
state
=>
state
.
current
,
inputFields
:
state
=>
getInputFields
(
state
.
current
.
fields
),
projectList
:
state
=>
state
.
projectList
,
publicList
:
state
=>
state
.
publicList
,
templateList
:
state
=>
state
.
templateList
,
...
...
src/views/items/ItemCopy.vue
View file @
9198fbf5
...
...
@@ -20,7 +20,7 @@
</p>
<p
v-else-if=
"item.level"
@
click=
"
copyHere(item
)"
@
click=
"
analyseForCopy(item.templateId
)"
>
<v-icon
color=
"secondary"
...
...
@@ -86,23 +86,22 @@ export default {
},
computed
:
{
...
mapGetters
(
'
item
'
,
[
'
projectId
'
,
'
templateId
'
]),
...
mapState
(
'
set
'
,
{
sets
:
'
projectSets
'
,
setsLength
:
'
projectSetsCount
'
,
pages
:
'
pageCount
'
,
}),
...
mapGetters
(
'
template
'
,
[
'
current
'
]),
...
mapGetters
(
'
project
'
,
{
storedProject
:
'
projectId
'
,
currentProject
:
'
current
'
,
managedProjects
:
'
contributions
'
}),
...
mapState
(
'
set
'
,
[
'
projectSets
'
]),
...
mapGetters
(
'
template
'
,
[
'
inputFields
'
]),
...
mapGetters
(
'
project
'
,
{
currentProject
:
'
current
'
,
managedProjects
:
'
contributions
'
}),
},
methods
:
{
...
mapActions
(
'
item
'
,
[
'
itemDuplicate
'
]),
...
mapActions
(
'
project
'
,
[
'
loadProject
'
,
'
retrieveProjects
'
]),
...
mapActions
(
'
set
'
,
[
'
loadProjectSets
'
]),
...
mapActions
(
'
template
'
,
[
'
loadProjectTemplates
'
]),
...
mapActions
(
'
template
'
,
[
'
loadTemplate
'
,
'
loadProjectTemplates
'
]),
async
analyseForCopy
(
targetedTemplateId
)
{
await
this
.
loadTemplate
(
targetedTemplateId
)
},
async
duplicate
()
{
await
this
.
itemDuplicate
()
this
.
$router
.
push
({
...
...
@@ -111,7 +110,7 @@ export default {
})
},
async
displayProjectSets
()
{
if
(
this
.
projectId
!==
this
.
stored
Project
)
{
if
(
this
.
projectId
!==
this
.
current
Project
.
id
)
{
await
this
.
loadProject
(
this
.
projectId
)
}
await
this
.
loadProjectSets
({
size
:
0
})
...
...
@@ -120,7 +119,7 @@ export default {
id
:
this
.
projectId
,
title
:
this
.
currentProject
.
name
,
level
:
0
,
children
:
this
.
s
ets
.
map
(
children
:
this
.
projectS
ets
.
map
(
s
=>
({
id
:
s
.
id
,
title
:
s
.
title
,
...
...
@@ -153,7 +152,7 @@ export default {
},
async
addSets
(
project
)
{
await
this
.
loadProjectSets
({
projectId
:
project
.
id
,
size
:
0
})
project
.
children
=
this
.
s
ets
.
map
(
s
=>
({
level
:
1
,
...
s
}))
project
.
children
=
this
.
projectS
ets
.
map
(
s
=>
({
level
:
1
,
...
s
}))
},
onPagination
(
pagination
){
this
.
loadProjectSets
({
page
:
pagination
.
page
,
size
:
pagination
.
itemsPerPage
});
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment