Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
Trèfle
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
6
Issues
6
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Open source
Trèfle
Commits
d4ce8e44
Commit
d4ce8e44
authored
Mar 31, 2020
by
David Foucher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add possibility to modify last modification
Hide modification button on rule view if a modifiction exists already
parent
ee4792ba
Pipeline
#2584
canceled with stage
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
8 deletions
+39
-8
backoffice/src/components/Referentiel.vue
backoffice/src/components/Referentiel.vue
+2
-1
backoffice/src/components/Rule.vue
backoffice/src/components/Rule.vue
+37
-7
No files found.
backoffice/src/components/Referentiel.vue
View file @
d4ce8e44
...
...
@@ -40,7 +40,7 @@
<div
v-if=
"modificationInProgress"
class=
"mt-5"
>
<h2>
Modification en cours...
</h2>
</div>
<img
src=
"./../assets/images/loading.gif"
alt=
"loading..."
>
<img
src=
"./../assets/images/loading.gif"
alt=
"loading..."
>
</div>
</div>
</div>
...
...
@@ -61,6 +61,7 @@
rules
:
[],
isLoading
:
true
,
windowLocationHash
:
decodeURI
(
window
.
location
.
hash
),
modificationInProgress
:
false
,
rerenderKey
:
0
,
collapsed
:
false
,
currentRuleName
:
decodeURI
(
window
.
location
.
hash
).
split
(
'
#
'
).
pop
()
==
"
modified
"
?
decodeURI
(
window
.
location
.
hash
).
split
(
'
#
'
)[
1
]:
decodeURI
(
window
.
location
.
hash
).
split
(
'
#
'
).
pop
(),
...
...
backoffice/src/components/Rule.vue
View file @
d4ce8e44
...
...
@@ -16,7 +16,7 @@
</div>
<div
class=
"col-md-6 col-sm-12 col-xs-12"
>
<h4
v-if=
"isEditMode"
class=
"pull-right"
><em>
Modification de la règle
</em></h4>
<input
v-else
v-b-modal.auth-modal
type=
"button"
class=
"main-button-primary btn pull-right"
value=
"Soumettre une modification"
/>
<input
v-else
-if=
"this.modifiedHashFlag | this.newModification"
v-b-modal.auth-modal
type=
"button"
class=
"main-button-primary btn pull-right"
value=
"Soumettre une modification"
/>
<!-- TODO: show gitlab link of modification if exists -->
</div>
</div>
...
...
@@ -46,7 +46,7 @@
<button
v-b-modal.mail-modal
class=
"btn main-button-primary pull-right"
>
Enregistrer
</button>
</div>
</div>
<div
class=
"row mb-3"
>
<div
v-if=
"content"
class=
"row mb-3"
>
<label
for=
"content"
><u>
Contenu de la règle
</u></label>
<textarea-autosize
id=
"content"
v-model=
"content"
class=
"rule-modification-text"
:class=
"
{editErrorClass: error_flags.notModified }">
</textarea-autosize>
<span
v-if=
"error_flags.notModified"
class=
"text-danger font-weight-light"
>
Aucune modification n'a été renseignée
</span>
...
...
@@ -114,9 +114,11 @@
modifiedHashFlag
:
decodeURI
(
window
.
location
.
hash
).
split
(
'
#
'
).
pop
()
==
"
modified
"
,
isLoading
:
true
,
ruleData
:
this
.
data
,
modification_list
:
[],
modification_list
:
{},
commit_id
:
''
,
content
:
''
,
comment
:
''
,
filename
:
'
trefle/config/rules/
'
+
this
.
path
,
isEditMode
:
''
,
viewModification
:
false
,
auth
:
{
...
...
@@ -138,7 +140,7 @@
this
.
updateLayout
();
window
.
addEventListener
(
'
popstate
'
,
()
=>
{
this
.
updateLayout
();
this
.
updateLayout
();
})
},
computed
:
{
...
...
@@ -154,6 +156,9 @@
ruleToEdit
:
function
()
{
return
this
.
ruleData
;
},
newModification
:
function
()
{
return
Boolean
(
!
this
.
modification_count
)
}
},
methods
:
{
updateLayout
:
function
()
{
...
...
@@ -172,6 +177,9 @@
.
get
(
'
/source/modified?branch=
'
+
encodeURIComponent
(
this
.
displayedName
))
.
then
(
response
=>
{
this
.
modification_list
=
response
.
body
;
if
(
Object
.
keys
(
this
.
modification_list
).
length
)
{
this
.
commit_id
=
this
.
modification_list
[
Object
.
keys
(
this
.
modification_list
)[
0
]].
id
;
}
this
.
isLoading
=
false
;
return
true
;
},
response
=>
{
...
...
@@ -179,6 +187,25 @@
return
false
;
})
},
getContentRule
:
function
(){
if
(
this
.
commit_id
)
{
let
data_param
=
{
'
file
'
:
this
.
filename
,
'
commit_id
'
:
this
.
commit_id
,
}
this
.
$http
.
get
(
'
/source/file
'
,
{
params
:
data_param
})
.
then
(
response
=>
{
this
.
content
=
response
.
body
;
return
true
;
},
response
=>
{
if
(
response
.
status
==
500
)
this
.
content
=
''
;
return
false
;
})
}
else
{
this
.
content
=
this
.
ruleData
}
},
auth_to_edit
:
function
()
{
this
.
error_flags
.
noUser
=
false
;
this
.
error_flags
.
noPass
=
false
;
...
...
@@ -195,7 +222,7 @@
.
then
(()
=>
{
this
.
viewModification
=
false
;
this
.
$parent
.
collapsed
=
true
;
this
.
content
=
this
.
ruleToEdit
;
this
.
getContentRule
()
;
this
.
isEditMode
=!
this
.
isEditMode
;
this
.
$bvModal
.
hide
(
"
auth-modal
"
);
},
error
=>
{
...
...
@@ -237,14 +264,17 @@
this
.
error_flags
.
noResume
=
true
;
return
false
;
}
const
postData
=
{
let
commitId
=
(
this
.
commit_id
!=
''
)
?
{
"
commit_id
"
:
this
.
commit_id
}
:
{}
const
prePostData
=
{
author_email
:
this
.
auth
.
email
,
author_name
:
this
.
auth
.
email
.
split
(
"
@
"
)[
0
],
title
:
this
.
displayedName
,
comment
:
this
.
comment
,
content
:
this
.
content
,
filename
:
'
trefle/config/rules/
'
+
this
.
path
filename
:
this
.
filename
}
let
postData
=
{...
prePostData
,
...
commitId
}
this
.
$http
.
post
(
'
/source/save
'
,
postData
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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