Skip to content

Commit 0411c73

Browse files
Merge branch 'develop' into migrate/profile_view_PR-3
2 parents 4e60a1d + 35571ba commit 0411c73

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1205
-25
lines changed

app/adapters/user.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ export default class UserAdapter extends ApplicationAdapter {
1616
}
1717

1818
urlForUpdateRecord() {
19-
return `${this.host}/users/self`;
19+
return `${this.host}/users?profile=true`;
2020
}
2121
}

app/components/debug-grids.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export default class DebugGridsComponent extends Component {
5959
const previousState = target.checked;
6060

6161
try {
62-
const response = await fetch(`${APPS.API_BACKEND}/users/self?dev=true`, {
62+
const response = await fetch(`${APPS.API_BACKEND}/users?profile=true`, {
6363
method: 'PATCH',
6464
credentials: 'include',
6565
headers: {

app/components/header.hbs

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
class="nav__element"
5252
href={{this.STATUS_URL}}
5353
>Status</a></li>
54-
{{#if @dev}}
54+
{{#if @dev}}
5555
<li>
5656
{{! TODO - remove query for dev when it goes to production }}
5757
<LinkTo
@@ -92,17 +92,25 @@
9292
<Fa-Icon data-test-icon @icon="chevron-down" />
9393
</button>
9494
{{else}}
95-
<a data-test-login class="login" href={{this.AUTH_URL}}>
96-
<span class="login__signin">Sign In</span>
97-
<span class="login__github">with GitHub</span>
98-
<img
99-
data-test-login-img
100-
class="login__logo"
101-
src="assets/icons/github-logo.png"
102-
alt="GitHub"
103-
height="20px"
104-
width="20px"
105-
/>
95+
<a
96+
data-test-login
97+
class="login"
98+
href={{if @dev "/login?dev=true" this.AUTH_URL}}
99+
>
100+
{{#if @dev}}
101+
<span class="login__signin">Sign In</span>
102+
{{else}}
103+
<span class="login__signin">Sign In</span>
104+
<span class="login__github">with GitHub</span>
105+
<img
106+
data-test-login-img
107+
class="login__logo"
108+
src="assets/icons/github-logo.png"
109+
alt="GitHub"
110+
height="20px"
111+
width="20px"
112+
/>
113+
{{/if}}
106114
</a>
107115
{{/if}}
108116
{{/if}}

app/components/header.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@ export default class HeaderComponent extends Component {
4343
this.fastboot.request.host +
4444
this.fastboot.request.path
4545
: window.location.href;
46-
return `${AUTH.SIGN_IN}?redirectURL=${currentURL}`;
46+
return `${AUTH.GITHUB_SIGN_IN}?redirectURL=${currentURL}`;
4747
}
4848
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<div class='identity-box-heading' data-test-getStarted-heading>Qualification
2+
Criteria</div>
3+
<div class='identity-box-desc' data-test-getStarted-desc>
4+
To update your profile details, link your profile service URL with
5+
RealDevSquad Service.<br />
6+
<span class='identity-box-desc-bold'>Profile Service Template:</span>
7+
<a
8+
class='identity-box-desc-a'
9+
target='_blank'
10+
href='https://github.com/Real-Dev-Squad/sample-profile-service' rel="noopener noreferrer"
11+
>https://github.com/Real-Dev-Squad/sample-profile-service</a>
12+
</div>
13+
<button
14+
class='identity-box-button'
15+
data-test-getStarted-button type="button" {{on 'click' (fn @setState 'step1')}}
16+
>Get Started</button>

app/components/identity/reload.hbs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<div class='identity-box-heading' data-test-reload-heading>Status Pending</div>
2+
<div class='identity-box-desc' data-test-reload-desc>Reload to complete and
3+
verify the link between Profile Service and RealDevSquad Service.</div>
4+
<button
5+
class='identity-box-button' type="button" {{on 'click' this.handleReload}}
6+
>Reload</button>

app/components/identity/reload.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import Component from '@glimmer/component';
2+
import { action } from '@ember/object';
3+
4+
export default class ReloadComponent extends Component {
5+
@action async handleReload(e) {
6+
e.preventDefault();
7+
window.location.reload();
8+
}
9+
}

app/components/identity/step1.hbs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<div class='identity-box-heading' data-test-step1-heading>Step 1: Chaincode
2+
Generation</div>
3+
<div class='identity-box-desc' data-test-step1-desc>A private key that you need
4+
to use in your profile service URL and deploy for validation that you’re the
5+
source of URL.</div>
6+
{{#if this.isChaincodeGenerated}}
7+
<div class='identity-chaincode-copy-box'>
8+
<div class='identity-chaincode-box' data-test-step1-chaincode>
9+
{{if this.isChaincodeVisible this.chaincode '********************'}}
10+
<img
11+
class='identity-box-eye
12+
{{if this.isChaincodeVisible "" "identity-box-eye-margin"}}'
13+
alt={{if this.isChaincodeVisible 'closeeye' 'openeye'}}
14+
src={{if
15+
this.isChaincodeVisible
16+
'/assets/images/identity/closeeye.svg'
17+
'/assets/images/identity/openeye.svg'
18+
}}
19+
role="button"
20+
{{on 'click' this.handleEyeClick}}
21+
data-test-step1-eye
22+
/></div>
23+
<button class='identity-copy-box' type="button" {{on 'click' this.handleCopy}}>
24+
<img alt='copy' src='/assets/images/identity/copy.svg' />
25+
<div class='identity-copy-text'>Copy</div>
26+
</button>
27+
</div>
28+
{{else}}
29+
<button
30+
class='identity-box-button'
31+
data-test-step1-button
32+
type='button'
33+
{{on 'click' this.handleGenerateChaincode}}
34+
>{{#if this.isGeneratingChaincode}}<div class='loader'></div>{{else}}
35+
Generate Chaincode
36+
{{/if}}</button>
37+
{{/if}}
38+
{{#if this.isChaincodeGenerated}}
39+
<button
40+
class='identity-next-button'
41+
data-test-step1-next-button
42+
type='button'
43+
{{on 'click' this.handleNext}}
44+
>Next</button>
45+
{{/if}}

app/components/identity/step1.js

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
import Component from '@glimmer/component';
2+
import { action } from '@ember/object';
3+
import { tracked } from '@glimmer/tracking';
4+
import { inject as service } from '@ember/service';
5+
import { toastNotificationTimeoutOptions } from '../../constants/toast-notification';
6+
import { APPS } from '../../constants/urls';
7+
const BASE_URL = APPS.API_BACKEND;
8+
9+
export default class Step1Component extends Component {
10+
@tracked isChaincodeGenerated = false;
11+
@tracked isGeneratingChaincode = false;
12+
@tracked chaincode = 'asxjdDZVNTfuDMQJiunJ';
13+
@tracked isChaincodeVisible = false;
14+
@service toast;
15+
16+
@action handleNext() {
17+
if (
18+
confirm(
19+
'Make sure you copied the chaincode as you are not able to see it again. If not, click `Cancel` and copy it.',
20+
)
21+
) {
22+
this.args.setState('step2');
23+
}
24+
}
25+
26+
@action handleEyeClick() {
27+
this.isChaincodeVisible = !this.isChaincodeVisible;
28+
}
29+
30+
@action handleCopy() {
31+
navigator.clipboard.writeText(this.chaincode);
32+
this.toast.info('Chaincode Copied!!', '', toastNotificationTimeoutOptions);
33+
}
34+
35+
@action async handleGenerateChaincode(e) {
36+
e.preventDefault();
37+
if (this.isGeneratingChaincode === false) {
38+
this.isGeneratingChaincode = true;
39+
try {
40+
const response = await fetch(`${BASE_URL}/users/chaincode`, {
41+
method: 'GET',
42+
headers: {
43+
'Content-Type': 'application/json',
44+
},
45+
credentials: 'include',
46+
});
47+
48+
const { chaincode } = await response.json();
49+
50+
if (response.ok) {
51+
this.chaincode = chaincode;
52+
this.isChaincodeGenerated = true;
53+
this.toast.info(
54+
'Generated New Chaincode!!',
55+
'',
56+
toastNotificationTimeoutOptions,
57+
);
58+
} else {
59+
console.log(response);
60+
this.toast.error(
61+
'Something went wrong. Please check console errors.',
62+
'',
63+
toastNotificationTimeoutOptions,
64+
);
65+
}
66+
} catch (error) {
67+
console.log('error', error);
68+
this.toast.error(
69+
'Something went wrong. Please check console errors.',
70+
'',
71+
toastNotificationTimeoutOptions,
72+
);
73+
} finally {
74+
this.isGeneratingChaincode = false;
75+
}
76+
}
77+
}
78+
}

app/components/identity/step2.hbs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<div class='identity-box-heading' data-test-step2-heading>Step 2: Profile
2+
Service URL</div>
3+
<div class='identity-box-desc' data-test-step2-desc>Set the chaincode on your
4+
profile service, deploy it and enter your profile service URL.</div>
5+
<label class="identity-box-input-label">
6+
<Input
7+
@value={{this.profileURL}}
8+
class='identity-box-input'
9+
placeholder='E.g.: https://my-profile-service.com'
10+
data-test-step2-input
11+
/>
12+
</label>
13+
{{#if this.profileURL}}
14+
<button
15+
class='identity-next-button'
16+
data-test-step2-next-button
17+
type='button'
18+
{{on 'click' this.handleNext}}
19+
>
20+
{{#if this.savingURL}}<div class='loader'></div>{{else}}Next{{/if}}</button>
21+
{{/if}}

0 commit comments

Comments
 (0)