Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DojoCLI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dojo Project (HES-SO)
Projects
UI
DojoCLI
Commits
ed57c9f0
Commit
ed57c9f0
authored
2 years ago
by
michael.minelli
Browse files
Options
Downloads
Patches
Plain Diff
Update shared
parent
537e215d
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
NodeApp/src/commander/enonce/EnonceCreateCommand.ts
+1
-1
1 addition, 1 deletion
NodeApp/src/commander/enonce/EnonceCreateCommand.ts
NodeApp/src/managers/GitlabManager.ts
+12
-7
12 additions, 7 deletions
NodeApp/src/managers/GitlabManager.ts
NodeApp/src/shared
+1
-1
1 addition, 1 deletion
NodeApp/src/shared
with
14 additions
and
9 deletions
NodeApp/src/commander/enonce/EnonceCreateCommand.ts
+
1
−
1
View file @
ed57c9f0
...
@@ -5,8 +5,8 @@ import GitlabManager from '../../managers/GitlabManager';
...
@@ -5,8 +5,8 @@ import GitlabManager from '../../managers/GitlabManager';
import
SessionManager
from
'
../../managers/SessionManager
'
;
import
SessionManager
from
'
../../managers/SessionManager
'
;
import
GitlabUser
from
'
../../shared/types/Gitlab/GitlabUser
'
;
import
GitlabUser
from
'
../../shared/types/Gitlab/GitlabUser
'
;
import
DojoBackendManager
from
'
../../managers/DojoBackendManager
'
;
import
DojoBackendManager
from
'
../../managers/DojoBackendManager
'
;
import
Toolbox
from
'
../../shared/Toolbox
'
;
import
Enonce
from
'
../../types/Enonce
'
;
import
Enonce
from
'
../../types/Enonce
'
;
import
Toolbox
from
'
../../shared/helpers/Toolbox
'
;
class
EnonceCreateCommand
extends
CommanderCommand
{
class
EnonceCreateCommand
extends
CommanderCommand
{
...
...
This diff is collapsed.
Click to expand it.
NodeApp/src/managers/GitlabManager.ts
+
12
−
7
View file @
ed57c9f0
...
@@ -4,6 +4,7 @@ import axios from 'axios';
...
@@ -4,6 +4,7 @@ import axios from 'axios';
import
Config
from
'
../config/Config
'
;
import
Config
from
'
../config/Config
'
;
import
ora
from
'
ora
'
;
import
ora
from
'
ora
'
;
import
GitlabUser
from
'
../shared/types/Gitlab/GitlabUser
'
;
import
GitlabUser
from
'
../shared/types/Gitlab/GitlabUser
'
;
import
GitlabRoutes
from
'
../shared/types/Gitlab/GitlabRoutes
'
;
class
GitlabManager
{
class
GitlabManager
{
...
@@ -21,6 +22,10 @@ class GitlabManager {
...
@@ -21,6 +22,10 @@ class GitlabManager {
return
GitlabManager
.
_instance
;
return
GitlabManager
.
_instance
;
}
}
private
getApiUrl
(
route
:
GitlabRoutes
):
string
{
return
`
${
Config
.
gitlab
.
apiURL
}${
route
}
`
;
}
get
isLogged
():
boolean
{
get
isLogged
():
boolean
{
return
this
.
_token
!==
null
;
return
this
.
_token
!==
null
;
}
}
...
@@ -114,14 +119,14 @@ class GitlabManager {
...
@@ -114,14 +119,14 @@ class GitlabManager {
}
}
public
getNotificationSettings
()
{
public
getNotificationSettings
()
{
return
axios
.
get
(
`
${
Config
.
gitlab
.
apiURL
}
/notification_settings`
);
return
axios
.
get
(
this
.
getApiUrl
(
GitlabRoutes
.
NOTIFICATION_SETTINGS
)
);
}
}
public
setNotificationSettings
(
newSettings
:
any
)
{
public
setNotificationSettings
(
newSettings
:
any
)
{
return
axios
.
put
(
`
${
Config
.
gitlab
.
apiURL
}
/notification_settings`
,
{
params
:
new
URLSearchParams
(
newSettings
)
});
return
axios
.
put
(
this
.
getApiUrl
(
GitlabRoutes
.
NOTIFICATION_SETTINGS
)
,
{
params
:
new
URLSearchParams
(
newSettings
)
});
}
}
private
async
getGitlabUser
(
paramsToSearch
:
Array
<
string
|
number
>
,
paramName
:
string
,
verbose
:
boolean
=
false
,
verboseIndent
:
number
=
0
):
Promise
<
Array
<
GitlabUser
|
undefined
>>
{
private
async
getGitlabUser
s
(
paramsToSearch
:
Array
<
string
|
number
>
,
paramName
:
string
,
verbose
:
boolean
=
false
,
verboseIndent
:
number
=
0
):
Promise
<
Array
<
GitlabUser
|
undefined
>>
{
try
{
try
{
return
await
Promise
.
all
(
paramsToSearch
.
map
(
async
param
=>
{
return
await
Promise
.
all
(
paramsToSearch
.
map
(
async
param
=>
{
const
spinner
:
ora
.
Ora
=
ora
({
const
spinner
:
ora
.
Ora
=
ora
({
...
@@ -133,7 +138,7 @@ class GitlabManager {
...
@@ -133,7 +138,7 @@ class GitlabManager {
}
}
const
params
:
any
=
{};
const
params
:
any
=
{};
params
[
paramName
]
=
param
;
params
[
paramName
]
=
param
;
const
user
=
await
axios
.
get
<
Array
<
GitlabUser
>>
(
`
${
Config
.
gitlab
.
apiURL
}
/users`
,
{
params
:
params
});
const
user
=
await
axios
.
get
<
Array
<
GitlabUser
>>
(
this
.
getApiUrl
(
GitlabRoutes
.
USERS_GET
)
,
{
params
:
params
});
if
(
user
.
data
[
0
]
)
{
if
(
user
.
data
[
0
]
)
{
const
gitlabUser
=
user
.
data
[
0
];
const
gitlabUser
=
user
.
data
[
0
];
...
@@ -154,15 +159,15 @@ class GitlabManager {
...
@@ -154,15 +159,15 @@ class GitlabManager {
}
}
public
async
getUsersById
(
ids
:
Array
<
number
>
,
verbose
:
boolean
=
false
,
verboseIndent
:
number
=
0
):
Promise
<
Array
<
GitlabUser
|
undefined
>>
{
public
async
getUsersById
(
ids
:
Array
<
number
>
,
verbose
:
boolean
=
false
,
verboseIndent
:
number
=
0
):
Promise
<
Array
<
GitlabUser
|
undefined
>>
{
return
await
this
.
getGitlabUser
(
ids
,
'
id
'
,
verbose
,
verboseIndent
);
return
await
this
.
getGitlabUser
s
(
ids
,
'
id
'
,
verbose
,
verboseIndent
);
}
}
public
async
getUsersByUsername
(
usernames
:
Array
<
string
>
,
verbose
:
boolean
=
false
,
verboseIndent
:
number
=
0
):
Promise
<
Array
<
GitlabUser
|
undefined
>>
{
public
async
getUsersByUsername
(
usernames
:
Array
<
string
>
,
verbose
:
boolean
=
false
,
verboseIndent
:
number
=
0
):
Promise
<
Array
<
GitlabUser
|
undefined
>>
{
return
await
this
.
getGitlabUser
(
usernames
,
'
search
'
,
verbose
,
verboseIndent
);
return
await
this
.
getGitlabUser
s
(
usernames
,
'
search
'
,
verbose
,
verboseIndent
);
}
}
public
async
getRepository
(
repoId
:
number
):
Promise
<
any
>
{
public
async
getRepository
(
repoId
:
number
):
Promise
<
any
>
{
return
await
axios
.
get
(
`
${
Config
.
gitlab
.
apiURL
}
/projects/
${
repoId
}
`
);
return
await
axios
.
get
(
this
.
getApiUrl
(
GitlabRoutes
.
REPOSITORY_GET
).
replace
(
'
{{id}}
'
,
repoId
.
toString
())
);
}
}
public
async
fetchMembers
(
options
:
any
):
Promise
<
Array
<
GitlabUser
>
|
false
>
{
public
async
fetchMembers
(
options
:
any
):
Promise
<
Array
<
GitlabUser
>
|
false
>
{
...
...
This diff is collapsed.
Click to expand it.
shared
@
aa038f29
Compare
3d613661
...
aa038f29
Subproject commit
3d6136619804a215db7488756a7bea4f5ff56513
Subproject commit
aa038f29e4595c631084935ea5e3e4846ceea1b1
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment