Skip to content
Next
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
T
t3
Project
Project
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Security & Compliance
Security & Compliance
Dependency List
Packages
Packages
List
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
t3
Commits
5ee9358d
Commit
5ee9358d
authored
26 minutes ago
by
Olivia Madrid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
yuck changes
parent
66e69f2f
master
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
230 additions
and
25 deletions
+230
-25
trust.component.scss
app/src/app/modules/trust/trust.component.scss
+5
-3
trust.component.ts
app/src/app/modules/trust/trust.component.ts
+70
-17
trust.service.ts
app/src/app/modules/trust/trust.service.ts
+155
-5
No files found.
app/src/app/modules/trust/trust.component.scss
View file @
5ee9358d
...
...
@@ -219,9 +219,11 @@ t3-trust {
align-items
:
center
;
}
.detailsHeader__right
{
&
:hover
{
text-decoration
:
underline
;
}
color
:
rgba
(
$coolGrey
,
0
.7
);
text-decoration
:
underline
;
// &:hover {
// text-decoration: underline;
// }
}
}
.detailsContent
{
...
...
This diff is collapsed.
Click to expand it.
app/src/app/modules/trust/trust.component.ts
View file @
5ee9358d
...
...
@@ -70,46 +70,83 @@ export class T3TrustComponent implements OnInit, OnDestroy {
lastIndex
:
number
;
currentIndex
:
number
=
0
;
hasRecalculated
:
boolean
=
false
;
isPaging
:
boolean
=
false
;
// scoreChanged: boolean = false;
trustTreeRaw
:
Array
<
any
>
=
[];
finalTrustTree
:
Array
<
any
>
=
[];
// trustTreeRaw: Array<any> = [
// {
// entity_did: 'did:fake:2',
// actor_did: 'did:fake:1',
// vote: 0,
// degree: 1
// },
// {
// entity_did: 'did:fake:3',
// actor_did: 'did:fake:1',
// vote: -1,
// degree: 1
// },
// {
// entity_did: 'did:fake:4',
// actor_did: 'did:fake:2',
// vote: 1,
// degree: 2
// }
// ];
// ! remove one of these later
usersRaw
:
Array
<
any
>
=
[
{
entity_did
:
'
did:fake:2
'
,
score
:
0.33
,
name
:
'
Sideshow Bob
'
,
avatarUrl
:
'
/assets/brewski.jpg
'
},
{
entity_did
:
'
did:fake:3
'
,
score
:
0.77
,
name
:
'
Good girl
'
,
avatarUrl
:
'
/assets/avatar.png
'
},
{
entity_did
:
'
did:fake:4
'
,
score
:
1.0
,
name
:
'
Astronaut Lily
'
,
avatarUrl
:
'
/assets/moonlily.jpg
'
}
];
users
:
Array
<
any
>
=
[
{
actor_did
:
'
000
'
,
entity_did
:
'
111
'
,
entity_type
:
'
user
'
,
vote
:
-
1
,
degree
:
1
,
entity_did
:
'
did:fake:2
'
,
score
:
0.33
,
name
:
'
Sideshow Bob
'
,
avatarUrl
:
'
/assets/brewski.jpg
'
},
{
actor_did
:
1
,
entity_did
:
'
222
'
,
entity_type
:
'
user
'
,
vote
:
0
,
degree
:
1
,
entity_did
:
'
did:fake:3
'
,
score
:
0.77
,
name
:
'
Good girl
'
,
avatarUrl
:
'
/assets/avatar.png
'
},
{
actor_did
:
1
,
entity_did
:
'
333
'
,
entity_type
:
'
user
'
,
vote
:
1
,
degree
:
1
,
entity_did
:
'
did:fake:4
'
,
score
:
1.0
,
name
:
'
Astronaut Lily
'
,
avatarUrl
:
'
/assets/moonlily.jpg
'
}
];
usersNew
:
Array
<
any
>
=
[];
//!!
constructor
(
public
trustService
:
T3TrustService
)
{}
ngOnInit
()
{
this
.
finalTrustTree
=
this
.
trustService
.
getTrustTree
(
'
1
'
);
console
.
log
(
this
.
finalTrustTree
);
this
.
joinArrays
();
// ! TODO : switch trustTreeRaw for finalTrustTree
this
.
actorDid
=
this
.
users
[
0
].
actor_did
;
this
.
user
=
this
.
users
[
0
];
...
...
@@ -119,6 +156,20 @@ export class T3TrustComponent implements OnInit, OnDestroy {
this
.
lastIndex
=
this
.
users
.
length
-
1
;
}
joinArrays
()
{
// tslint:disable-next-line: prefer-for-of
for
(
let
i
=
0
;
i
<
this
.
trustTreeRaw
.
length
;
i
++
)
{
this
.
users
.
push
({
...
this
.
trustTreeRaw
[
i
],
...
this
.
usersRaw
.
find
(
itmInner
=>
itmInner
.
entity_did
===
this
.
trustTreeRaw
[
i
].
entity_did
)
});
}
console
.
log
(
this
.
users
);
}
switchView
(
view
)
{
this
.
view
=
view
;
// do something with router or url?
...
...
@@ -187,4 +238,6 @@ export class T3TrustComponent implements OnInit, OnDestroy {
clearTimeout
(
this
.
pagingTimeout
);
}
}
// -------------------------------------------------------------------------------------------
}
This diff is collapsed.
Click to expand it.
app/src/app/modules/trust/trust.service.ts
View file @
5ee9358d
import
{
Injectable
}
from
"
@angular/core
"
;
import
{
Observable
}
from
"
rxjs
"
;
import
{
Injectable
}
from
'
@angular/core
'
;
import
{
Observable
}
from
'
rxjs
'
;
@
Injectable
()
export
class
T3TrustService
{
constructor
()
{
this
.
getTrustTree
();
constructor
()
{}
getTrustTree
(
actorDid
:
string
)
{
let
finalTrustTree
:
Array
<
any
>
=
[];
// END STRUCTURE
// [
// {
// actor_did: '1',
// entity_did: '2',
// vote: 1,
// degree: 1
// },
// {
// actor_did: '1',
// entity_did: '3',
// vote: 0,
// degree: 2
// },
// {...},
// {...},
// {...},
// {...},
// {...},
// {...},
// {...}
// ]
// QUERY FAKE DB
const
fakeResponse
=
this
.
getBlockchainResponse
(
actorDid
);
const
fakeResponseWithAllDidsArray
=
this
.
makeAllDidsArray
(
fakeResponse
);
// PROCESS BLOCKCHAIN RESPONSE
// fakeResponse.forEach(function(value) {
// const tempArray = value.split(':');
// this.currentActorObj.allDids.push(tempArray[1]);
// switch (tempArray[2]) {
// case '1':
// currentActorObj.trustedDids.push(tempArray[2]);
// break;
// case '0':
// currentActorObj.neutralDids.push(tempArray[2]);
// break;
// case '-1':
// currentActorObj.distrustedDids.push(tempArray[2]);
// }
// });
// AFTER CURRENTACTOROBJ is populated,
// add all
// go through each actor in network[] and get their network
console
.
log
(
finalTrustTree
);
return
finalTrustTree
;
}
getTrustTree
()
{}
makeAllDidsArray
(
fakeResponse
)
{
const
newFakeResponse
=
fakeResponse
;
console
.
log
(
newFakeResponse
[
0
].
blockchainResponse
);
let
allDids
:
Array
<
any
>
;
allDids
=
newFakeResponse
[
0
].
blockchainResponse
.
trustedDids
.
concat
(
newFakeResponse
[
0
].
blockchainResponse
.
NeutralDids
)
.
concat
(
newFakeResponse
[
0
].
blockchainResponse
.
DistrustedDids
);
// allDids = allDids.concat(newFakeResponse[0].blockchainResponse.NeutralDids);
// allDids = allDids.concat(
// newFakeResponse[0].blockchainResponse.DistrustedDids
// );
console
.
log
(
allDids
);
return
newFakeResponse
;
}
getBlockchainResponse
(
actorDid
:
string
)
{
const
fakeDatabase
=
[
{
actorDid
:
'
1
'
,
blockchainResponse
:
{
trustedDids
:
[
'
2
'
],
neutralDids
:
[
'
3
'
],
distrustedDids
:
[
'
4
'
]
}
},
{
actorDid
:
'
2
'
,
blockchainResponse
:
{
trustedDids
:
[
'
1
'
,
'
3
'
,
'
5
'
],
neutralDids
:
[
'
4
'
],
distrustedDids
:
[]
}
},
{
actorDid
:
'
3
'
,
blockchainResponse
:
{
trustedDids
:
[
'
1
'
],
neutralDids
:
[
'
4
'
,
'
5
'
],
distrustedDids
:
[
'
2
'
]
}
},
{
actorDid
:
'
4
'
,
blockchainResponse
:
{
trustedDids
:
[
'
3
'
],
neutralDids
:
[
'
1
'
],
distrustedDids
:
[
'
2
'
,
'
5
'
]
}
},
{
actorDid
:
'
5
'
,
blockchainResponse
:
{
trustedDids
:
[
'
3
'
,
'
6
'
],
neutralDids
:
[
'
2
'
],
distrustedDids
:
[
'
4
'
]
}
},
{
actorDid
:
'
6
'
,
blockchainResponse
:
{
trustedDids
:
[],
neutralDids
:
[
'
3
'
],
distrustedDids
:
[
'
7
'
,
'
8
'
]
}
}
];
// tslint:disable-next-line: only-arrow-functions
let
result
=
fakeDatabase
.
filter
(
function
(
item
)
{
return
item
.
actorDid
===
actorDid
;
});
console
.
log
(
'
raw Result
'
);
console
.
log
(
result
);
return
result
;
}
}
// OLD
// const fakeBlockchainDatabase = [
// {
// actorDid: '2',
// blockchainResponse: ['did:1:1', 'did:3:1', 'did:4:0', 'did:5:1']
// },
// {
// actorDid: '3',
// blockchainResponse: ['did:1:1', 'did:2:-1', 'did:4:0', 'did:5:0']
// },
// {
// actorDid: '4',
// blockchainResponse: ['did:1:0', 'did:2:-1', 'did:3:1', 'did:5:-1']
// },
// {
// actorDid: '5',
// blockchainResponse: ['did:2:0', 'did:3:1', 'did:4:-1', 'did:6:1']
// }
This diff is collapsed.
Click to expand it.
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