Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
angular-frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eclipse Projects
Eclipse Graphene
angular-frontend
Commits
cedcbf7b
Commit
cedcbf7b
authored
1 year ago
by
Kawtar Laariche
Browse files
Options
Downloads
Patches
Plain Diff
#19
: add disableEdit function
parent
ecc28fd9
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/app/features/model-details/model-details.component.scss
+2
-68
2 additions, 68 deletions
src/app/features/model-details/model-details.component.scss
src/app/features/model-details/model-details.component.ts
+44
-3
44 additions, 3 deletions
src/app/features/model-details/model-details.component.ts
with
46 additions
and
71 deletions
src/app/features/model-details/model-details.component.scss
+
2
−
68
View file @
cedcbf7b
...
...
@@ -306,74 +306,6 @@ ul {
text-transform
:
none
;
}
.c-breadcrumb
{
list-style-type
:
none
;
clear
:
both
;
padding
:
0
;
margin
:
0
;
}
.c-breadcrumb
li
:first-child
{
margin-left
:
0
;
padding-left
:
0
;
}
.c-breadcrumb
li
{
display
:
inline-block
;
padding
:
0
5px
;
}
.c-breadcrumb
li
:first-child:before
{
content
:
""
;
}
.c-breadcrumb
li
:before
{
content
:
"/"
;
position
:
relative
;
left
:
-6px
;
}
.c-breadcrumb
li
a
{
color
:
#2e2f2f
;
text-decoration
:
none
;
font-weight
:
600
;
font-size
:
13px
;
}
.c-breadcrumb.solution_id_top
li
:last-child::before
{
content
:
"-"
!
important
;
}
.c-breadcrumb
li
span
.md-breadcrumb-item
{
max-width
:
300px
;
position
:
relative
;
text-overflow
:
ellipsis
;
overflow
:
hidden
;
white-space
:
nowrap
;
display
:
inline-block
;
float
:
right
;
}
.c-breadcrumb
li
:last-child
,
.c-breadcrumb
li
:last-child
a
{
font-weight
:
normal
;
color
:
#8f8f8f
;
font-size
:
13px
;
}
.c-breadcrumb
li
{
display
:
inline-block
;
padding
:
0
5px
;
}
.solution_id_top
.solution_id_bg
{
background-color
:
#f1f1f1
;
border
:
1px
solid
#ccc
;
font-size
:
10px
;
border-radius
:
15px
;
padding
:
0
5px
;
}
.md-lbl1
{
margin-right
:
3px
;
margin-top
:
0
;
...
...
@@ -433,6 +365,8 @@ ul {
font-size
:
12px
;
font-weight
:
normal
;
border
:
1px
solid
#671c9d
;
background
:
#671c9d
;
color
:
#fff
;
text-transform
:
none
;
line-height
:
24px
;
height
:
25px
;
...
...
This diff is collapsed.
Click to expand it.
src/app/features/model-details/model-details.component.ts
+
44
−
3
View file @
cedcbf7b
...
...
@@ -49,6 +49,8 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import
{
JwtTokenService
}
from
'
src/app/core/services/auth/jwt-token.service
'
;
import
{
apiConfig
}
from
'
src/app/core/config
'
;
import
{
PrivateCatalogsService
}
from
'
src/app/core/services/private-catalogs.service
'
;
import
{
SolutionIdComponent
}
from
'
src/app/shared/components/solution-id/solution-id.component
'
;
import
{
BreadcrumbNavigationComponent
}
from
'
src/app/shared/components/breadcrumb-navigation/breadcrumb-navigation.component
'
;
interface
SolutionData
{
solutionId
:
string
;
...
...
@@ -86,6 +88,8 @@ interface SolutionData {
MatSelectModule
,
ReactiveFormsModule
,
FormsModule
,
SolutionIdComponent
,
BreadcrumbNavigationComponent
,
],
templateUrl
:
'
./model-details.component.html
'
,
styleUrl
:
'
./model-details.component.scss
'
,
...
...
@@ -107,7 +111,6 @@ export class ModelDetailsComponent implements OnInit {
version
:
string
;
revisionId
:
string
;
};
editModel
:
boolean
=
false
;
averageRatings
!
:
AverageRatings
;
allRatings
:
AllUserRating
[]
=
[];
totalRatingsCount
:
number
=
0
;
...
...
@@ -125,6 +128,7 @@ export class ModelDetailsComponent implements OnInit {
.
getUserDetails
()
.
pipe
(
map
((
details
)
=>
details
?.
userId
));
isLoggedIn$
:
Observable
<
boolean
>
;
userId
!
:
string
;
data$
:
Observable
<
SolutionData
>
;
defaultSolutionData
:
SolutionData
=
{
...
...
@@ -145,6 +149,7 @@ export class ModelDetailsComponent implements OnInit {
comments
!
:
CommentReplyModel
[];
firstName
:
string
=
''
;
lastName
:
string
=
''
;
editModel
:
boolean
=
false
;
constructor
(
private
activatedRoute
:
ActivatedRoute
,
...
...
@@ -218,7 +223,13 @@ export class ModelDetailsComponent implements OnInit {
// Handle the case where userId is not available
return
of
(
null
);
}
this
.
userId
=
userId
;
this
.
solutionId
=
params
[
'
solutionId
'
];
this
.
publicSolutionsService
.
getSolutionDetails
(
params
[
'
solutionId
'
],
params
[
'
revisionId
'
])
.
subscribe
((
res
)
=>
{
this
.
disableEdit
(
userId
,
res
);
});
return
this
.
privateCatalogsService
.
getSolutionRatings
(
this
.
solutionId
,
userId
,
...
...
@@ -535,7 +546,6 @@ export class ModelDetailsComponent implements OnInit {
this
.
privateCatalogsService
.
getComments
(
solutionId
,
revisionId
)
.
subscribe
((
res
)
=>
{
console
.
log
({
res
});
this
.
comments
=
this
.
transformComments
(
res
);
});
}
...
...
@@ -554,7 +564,7 @@ export class ModelDetailsComponent implements OnInit {
}
});
//
Now,
associate each comment with its parent.
// associate each comment with its parent.
const
rootComments
:
CommentReplyModel
[]
=
[];
comments
.
forEach
((
comment
)
=>
{
if
(
...
...
@@ -574,4 +584,35 @@ export class ModelDetailsComponent implements OnInit {
return
rootComments
;
}
disableEdit
(
userId
:
string
,
solution
:
PublicSolutionDetailsModel
)
{
// Allow editing if the solution is not active.
if
(
!
solution
.
active
)
{
this
.
editModel
=
true
;
return
;
// No further checks needed if the solution is inactive.
}
// If the solution is active and the user is the owner, allow editing.
if
(
solution
.
ownerId
===
userId
)
{
this
.
editModel
=
true
;
return
;
}
// If there are other owners and the user is one of them, allow editing.
const
isCoOwner
=
solution
.
ownerListForSol
?.
some
(
(
owner
)
=>
owner
.
userId
===
userId
,
);
if
(
isCoOwner
)
{
this
.
editModel
=
true
;
}
}
OnlClickManageMyModel
()
{
this
.
router
.
navigate
([
'
/dashboard/manageMyModel/solutionId
'
,
this
.
solutionId
,
'
revisionId
'
,
this
.
revisionId
,
]);
}
}
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