Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
b95daeff
Commit
b95daeff
authored
Aug 04, 2021
by
mgandres
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Query commit sha via graphql
parent
95bc8490
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
35 deletions
+15
-35
app/assets/javascripts/pipeline_editor/pipeline_editor_app.vue
...ssets/javascripts/pipeline_editor/pipeline_editor_app.vue
+15
-35
No files found.
app/assets/javascripts/pipeline_editor/pipeline_editor_app.vue
View file @
b95daeff
...
...
@@ -16,11 +16,9 @@ import {
LOAD_FAILURE_UNKNOWN
,
STARTER_TEMPLATE_NAME
,
}
from
'
./constants
'
;
import
updateCommitShaMutation
from
'
./graphql/mutations/update_commit_sha.mutation.graphql
'
;
import
getBlobContent
from
'
./graphql/queries/blob_content.graphql
'
;
import
getCiConfigData
from
'
./graphql/queries/ci_config.graphql
'
;
import
getAppStatus
from
'
./graphql/queries/client/app_status.graphql
'
;
import
getCommitSha
from
'
./graphql/queries/client/commit_sha.graphql
'
;
import
getCurrentBranch
from
'
./graphql/queries/client/current_branch.graphql
'
;
import
getIsNewCiConfigFile
from
'
./graphql/queries/client/is_new_ci_config_file.graphql
'
;
import
getTemplate
from
'
./graphql/queries/get_starter_template.query.graphql
'
;
...
...
@@ -156,7 +154,21 @@ export default {
query
:
getAppStatus
,
},
commitSha
:
{
query
:
getCommitSha
,
query
:
getLatestCommitShaQuery
,
variables
()
{
return
{
projectPath
:
this
.
projectFullPath
,
ref
:
this
.
currentBranch
,
};
},
update
(
data
)
{
const
pipelineNodes
=
data
.
project
?.
pipelines
?.
nodes
??
[];
if
(
pipelineNodes
.
length
===
0
)
{
return
''
;
}
return
pipelineNodes
[
0
].
sha
;
},
},
currentBranch
:
{
query
:
getCurrentBranch
,
...
...
@@ -257,38 +269,6 @@ export default {
updateCiConfig
(
ciFileContent
)
{
this
.
currentCiFileContent
=
ciFileContent
;
},
async
updateCommitSha
({
newBranch
})
{
let
fetchResults
;
try
{
fetchResults
=
await
this
.
$apollo
.
query
({
query
:
getLatestCommitShaQuery
,
variables
:
{
projectPath
:
this
.
projectFullPath
,
ref
:
newBranch
,
},
});
}
catch
{
this
.
showFetchError
();
return
;
}
if
(
fetchResults
.
errors
?.
length
>
0
)
{
this
.
showFetchError
();
return
;
}
const
pipelineNodes
=
fetchResults
?.
data
?.
project
?.
pipelines
?.
nodes
??
[];
if
(
pipelineNodes
.
length
===
0
)
{
return
;
}
const
commitSha
=
pipelineNodes
[
0
].
sha
;
this
.
$apollo
.
mutate
({
mutation
:
updateCommitShaMutation
,
variables
:
{
commitSha
},
});
},
updateOnCommit
({
type
})
{
this
.
reportSuccess
(
type
);
...
...
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