Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sarun Mungthanya
SpnPatch-Laravel
Commits
4a8a9412
Commit
4a8a9412
authored
Aug 06, 2024
by
Sarun Mungthanya
Browse files
add fetch project
parent
db34b0ab
Changes
2
Show whitespace changes
Inline
Side-by-side
app/Http/Livewire/Pages/Patch/PatchEdit.php
View file @
4a8a9412
...
...
@@ -53,9 +53,36 @@ class PatchEdit extends Component
$this
->
patchId
=
$editPid
;
$this
->
loadPatchData
();
}
public
function
updatedSearchProject
()
{
$this
->
fetchProjects
();
}
public
function
fetchProjects
()
{
$client
=
new
Client
([
'headers'
=>
[
'Authorization'
=>
'Bearer '
.
env
(
'GITLAB_API_TOKEN'
),
'Accept'
=>
'application/json'
,
],
'verify'
=>
false
,
]);
$page
=
1
;
$perPage
=
100
;
$response
=
$client
->
get
(
env
(
'GITLAB_API_URL'
)
.
'/projects'
,
[
'query'
=>
[
'membership'
=>
true
,
'min_access_level'
=>
30
,
'search'
=>
$this
->
searchProject
,
'per_page'
=>
$perPage
,
],
]);
$this
->
projects
=
json_decode
(
$response
->
getBody
(),
true
);
$this
->
dispatchBrowserEvent
(
'projects-fetched'
);
}
public
function
getChangedFiles
()
{
// dd($this->selectedProject);die();
$this
->
fileChangesTemp
=
[];
$client
=
new
Client
([
...
...
resources/views/livewire/pages/patch/patch-edit.blade.php
View file @
4a8a9412
...
...
@@ -4,6 +4,7 @@
console.log(result)
progress = result;
if (progress >= 100) {
progress = 0 ;
clearInterval(interval);
}
});
...
...
@@ -44,7 +45,7 @@
isLoading: false,
fetchProjects() {
this.isLoading = true;
this.selectedProject = '60';
{{--
this.selectedProject = '60';
--}}
this.$wire.set('searchProject', this.searchQuery);
},
fetchBranches() {
...
...
@@ -81,7 +82,7 @@
<div
x-show=
"isLoading"
class=
"mx-auto mt-2"
>
<span>
Loading...
</span>
</div>
<select
x-model=
"selectedProject"
x-show=
"!isLoading"
@
change=
"fetchBranches"
<select
x-model=
"selectedProject"
x-show=
"!isLoading"
id=
"project"
class=
"ml-2 w-64 h-8 mt-1 border border-gray-300 rounded-md"
>
<option
value=
""
>
Choose Project
</option>
<template
x-for=
"project in projects"
:key=
"project.id"
>
...
...
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