Skip to content

Commit c682782

Browse files
authored
Merge branch 'develop' into release/1.1.1
2 parents a6ccdca + b1a370c commit c682782

File tree

14 files changed

+171
-98
lines changed

14 files changed

+171
-98
lines changed

.env.development

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ VUE_APP_BI_REFERENCE_SOURCE=${BRAPI_REFERENCE_SOURCE}
1818

1919
# feature flags
2020
VUE_APP_BRAPI_VENDOR_SUBMISSION_ENABLED=${BRAPI_VENDOR_SUBMISSION_ENABLED}
21+
VUE_APP_ALTERNATE_AUTHENTICATION_ENABLED=${ALTERNATE_AUTHENTICATION_ENABLED}

src/assets/scss/main.scss

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,10 @@ table tr.is-edited + .detail {
579579
margin-bottom: 7em;
580580
}
581581

582+
.githubBtn {
583+
margin: 1em auto;
584+
}
585+
582586
.program-selection-level {
583587
.level-item:not(:last-child) {
584588
margin-right:0.5em !important;
@@ -621,7 +625,7 @@ a.is-underlined {
621625
text-decoration: underline;
622626
}
623627

624-
#connect-orcid-button{
628+
#connect-orcid-button #connect-github-button {
625629
border: 1px solid #D3D3D3;
626630
padding: .3em;
627631
background-color: #fff;
@@ -635,7 +639,7 @@ a.is-underlined {
635639
vertical-align: middle;
636640
}
637641

638-
#connect-orcid-button:hover{
642+
#connect-orcid-button:hover #connect-github-button:hover {
639643
border: 1px solid #338caf;
640644
color: #338caf;
641645
}

src/components/file-import/ImportInfoTemplateMessageBox.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
<!-- temporary link until the backend card is done -->
3131
<a v-bind:href="templateUrl"
3232
class="button is-outlined is-primary" :id="downloadTemplateId">Download the {{toTitleCase(importTypeName)}} Import Template</a>
33-
<br/>Template version placeholder
3433
</div>
3534
</div>
3635
</div>

src/components/layouts/BaseSideBarLayout.vue

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,17 @@
1717

1818
<template>
1919
<div class="sidebarlayout">
20-
2120
<header class="main-header">
2221
<div class="level header-title is-marginless">
2322
<div class="level-left">
24-
<div class="level-item is-pulled-left">
23+
<div v-if="showMenu" class="level-item is-pulled-left">
2524
<a role="button"
2625
class="navbar-hamburger has-text-dark"
2726
aria-label="Open Navigation Menu"
2827
aria-expanded="false"
2928
@click="toggleSidebar()"
3029
>
31-
<MenuIcon v-if="showMenuToggle"></MenuIcon>
30+
<MenuIcon ></MenuIcon>
3231
</a>
3332
</div>
3433
<div class="level-item">
@@ -40,7 +39,7 @@
4039
>
4140
</a>
4241
</div>
43-
<div v-if="sandboxConfig !== ''" class="level-item">
42+
<div v-if="isSandbox" class="level-item">
4443
<div id="sandbox-feedback" v-bind:class="{'notification is-warning px-5 has-text-centered': sandboxConfig === SandboxMode.Public,
4544
'notification is-info px-5 has-text-centered': sandboxConfig === SandboxMode.Coordinator}">
4645
<p class="title is-size-5">Sandbox </p>
@@ -119,13 +118,21 @@ import UserStatusMenu from "@/components/layouts/menus/UserStatusMenu.vue";
119118
@Prop({default: true})
120119
showMenu?: boolean;
121120
121+
mounted () {
122+
// Default to Showing the sidebar menu if the width is wider than 700px or if it not in Sandbox mode, Otherwise default to hiding the sidebar.
123+
store.commit(SHOW_SIDEBAR_MOBILE, (window.matchMedia("(min-width: 700px)").matches || !this.isSandbox));
124+
}
122125
toggleSidebar() {
123126
store.commit(SHOW_SIDEBAR_MOBILE, !this.showSidebarMobile);
124127
}
125128
126129
get sandboxConfig() {
127130
return process.env.VUE_APP_SANDBOX;
128131
}
132+
133+
get isSandbox() {
134+
return (this.sandboxConfig===SandboxMode.Coordinator || this.sandboxConfig===SandboxMode.Public || this.sandboxConfig==='1');
135+
}
129136
}
130137
131138
</script>

src/components/layouts/InfoSideBarLayout.vue

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,13 @@
5656
>
5757
Guest Account
5858
</h1>
59-
<p class="has-text-light is-paddingless">
59+
<p class="has-text-light is-paddingless mb-3">
6060
Use these credentials to explore sample data and currently available features.
6161
</p>
62-
<div class="is-hidden-touch">
62+
<p class="has-text-light is-paddingless">
63+
Data submitted to this site is not private.
64+
</p>
65+
<div>
6366
<hr class="is-light">
6467
<div class="columns is-gapless">
6568
<div class="column is-narrow mr-2">
@@ -81,7 +84,7 @@
8184

8285
<article class="block">
8386
<h2 class="has-text-warning is-5 is-normal">
84-
Guest
87+
Sandbox Guest
8588
</h2>
8689
<p class="has-text-light is-paddingless is-marginless">
8790
user: guestusr@mailinator.com
@@ -128,6 +131,19 @@
128131
<p>
129132
To access to your breeding program, please log in.
130133
</p>
134+
<div>
135+
<button
136+
v-if="alternateAuthenticationEnabled()"
137+
id="connect-github-button"
138+
class="button githubBtn"
139+
v-bind:class="{'is-loading': githubLoginProcessing}"
140+
v-bind:disabled="githubLoginProcessing"
141+
v-on:click="githubLogin"
142+
>
143+
SIGN IN with GitHub
144+
</button>
145+
</div>
146+
<div>
131147
<button
132148
id="connect-orcid-button"
133149
class="button orcidBtn"
@@ -146,6 +162,7 @@
146162
alt="ORCID iD icon"
147163
>
148164
</button>
165+
</div>
149166
<p class="is-size-7 has-text-left">
150167
To acknowledge that you have used your iD and that it has been authenticated, we display
151168
the ORCID iD icon
@@ -188,6 +205,7 @@
188205
public isLoginModalActive: boolean = false;
189206
public isLoginServerErrorModalActive: boolean = false;
190207
public loginProcessing: boolean = false;
208+
public githubLoginProcessing: boolean = false;
191209
private orcidLogoUrl: string = 'https://orcid.org/sites/default/files/images/orcid_24x24.png';
192210
@Prop()
193211
public loginRedirect!: boolean;
@@ -231,9 +249,28 @@
231249
window.location.href = process.env.VUE_APP_BI_API_ROOT+'/sso/start';
232250
}
233251
252+
async githubLogin() {
253+
// Check the server can be contacted
254+
this.githubLoginProcessing = true;
255+
try {
256+
await ServerManagementService.checkHealth();
257+
} catch (error) {
258+
this.isLoginServerErrorModalActive = true;
259+
this.githubLoginProcessing = false;
260+
return;
261+
}
262+
263+
// Start login process
264+
window.location.href = process.env.VUE_APP_BI_API_ROOT+'/sso/start/github';
265+
}
266+
234267
get sandboxConfig() {
235268
return process.env.VUE_APP_SANDBOX;
236269
}
237270
271+
alternateAuthenticationEnabled() {
272+
return process.env.VUE_APP_ALTERNATE_AUTHENTICATION_ENABLED === 'true';
238273
}
274+
275+
}
239276
</script>

src/components/modals/SubEntityDatasetModal.vue

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
>
4646
<template v-slot="validations">
4747
<div class="message is-success">
48-
<div class="message-body">
48+
<div class="message-body has-text-dark">
4949
Prepare a dataset for repeated observations within {{ defaultObservationLevel }}.
5050
</div>
5151
</div>
@@ -69,7 +69,7 @@
6969
v-model="newSubEntity.repeatedMeasures"
7070
v-bind:validations="validations.repeatedMeasures"
7171
v-bind:field-name="'Repeated Measures'"
72-
v-bind:field-help="'Maximum expected'"
72+
v-bind:field-help="'Maximum expected between 1-50'"
7373
/>
7474
</div>
7575
</div>
@@ -116,6 +116,8 @@ export default class SubEntityDatasetModal extends Vue {
116116
experiment!: Trial;
117117
@Prop()
118118
defaultObservationLevel?: string;
119+
@Prop()
120+
existingDatasetNames!: string[];
119121
120122
// Reactive, private (would not be reactive if declared without initial values).
121123
private newSubEntity: SubEntityDatasetNewRequest = new SubEntityDatasetNewRequest();
@@ -130,7 +132,7 @@ export default class SubEntityDatasetModal extends Vue {
130132
repeatedMeasures: {
131133
required,
132134
integer,
133-
between: between(1, 50), // Note: capped at 50 for performance considerations.
135+
between: between(1, 50), // Note: capped at 50 for performance considerations
134136
}
135137
}
136138
@@ -142,6 +144,14 @@ export default class SubEntityDatasetModal extends Vue {
142144
}
143145
144146
async invokeCreate(){
147+
//Check if sub-entity name is already in experiment
148+
let nameAlreadyInExp = this.existingDatasetNames.map(y => y.toLowerCase()).includes(this.newSubEntity.name.toLowerCase());
149+
if (nameAlreadyInExp) {
150+
this.$emit('show-error-notification', `A ${this.newSubEntity.name} dataset already exists in ${this.experiment.trialName}.`);
151+
this.newSubEntityFormState.bus.$emit(DataFormEventBusHandler.SAVE_COMPLETE_EVENT);
152+
return;
153+
}
154+
145155
try {
146156
// Invoke the create prop, which returns true if create succeeded.
147157
await this.create(this.newSubEntity)
@@ -155,4 +165,4 @@ export default class SubEntityDatasetModal extends Vue {
155165
}
156166
157167
}
158-
</script>
168+
</script>

src/components/trait/TraitImportTemplateMessageBox.vue

Lines changed: 0 additions & 59 deletions
This file was deleted.

src/views/account/AccountSignUp.vue

Lines changed: 53 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,37 @@
2727
<p>
2828
To activate your account, please log in.
2929
</p>
30-
<button
31-
id="connect-orcid-button"
32-
class="button orcidBtn"
33-
v-bind:class="{'is-loading': loginProcessing}"
34-
v-bind:disabled="loginProcessing"
35-
v-on:click="orcidLogin"
36-
>
37-
SIGN IN with ORCID
38-
<img
39-
id="orcid-id-icon"
40-
src="https://orcid.org/sites/default/files/images/orcid_24x24.png"
41-
width="24"
42-
height="24"
43-
class="is-pulled-right"
44-
alt="ORCID iD icon"
30+
<div>
31+
<button
32+
v-if="alternateAuthenticationEnabled()"
33+
id="connect-github-button"
34+
class="button githubBtn"
35+
v-bind:class="{'is-loading': loginGithubProcessing}"
36+
v-bind:disabled="loginGithubProcessing"
37+
v-on:click="githubLogin"
38+
>
39+
SIGN IN with GitHub
40+
</button>
41+
</div>
42+
<div>
43+
<button
44+
id="connect-orcid-button"
45+
class="button orcidBtn"
46+
v-bind:class="{'is-loading': loginProcessing}"
47+
v-bind:disabled="loginProcessing"
48+
v-on:click="orcidLogin"
4549
>
46-
</button>
50+
SIGN IN with ORCID
51+
<img
52+
id="orcid-id-icon"
53+
src="https://orcid.org/sites/default/files/images/orcid_24x24.png"
54+
width="24"
55+
height="24"
56+
class="is-pulled-right"
57+
alt="ORCID iD icon"
58+
>
59+
</button>
60+
</div>
4761
<p class="is-size-7 has-text-left">
4862
To acknowledge that you have used your iD and that it has been authenticated, we display
4963
the ORCID iD icon
@@ -79,6 +93,7 @@
7993
})
8094
export default class AccountSignUp extends Vue {
8195
public loginProcessing: boolean = false;
96+
public loginGithubProcessing: boolean = false;
8297
public accountTokenCookieName: string = Vue.prototype.$cookieNames.accountToken;
8398
public isLoginServerErrorModalActive: boolean = false;
8499
@Prop()
@@ -110,6 +125,28 @@
110125
// Start login process
111126
window.location.href = process.env.VUE_APP_BI_API_ROOT+'/sso/start';
112127
}
128+
129+
async githubLogin() {
130+
// Check the server can be contacted
131+
this.loginGithubProcessing = true;
132+
try {
133+
await ServerManagementService.checkHealth();
134+
} catch (error) {
135+
this.isLoginServerErrorModalActive = true;
136+
this.loginGithubProcessing = false;
137+
return;
138+
}
139+
140+
// Set the cookie to pass back their account token. Timeout is an hour
141+
Vue.$cookies.set(this.accountTokenCookieName, this.accountToken, 60*60);
142+
143+
// Start login process
144+
window.location.href = process.env.VUE_APP_BI_API_ROOT+'/sso/start/github';
145+
}
146+
147+
alternateAuthenticationEnabled() {
148+
return process.env.VUE_APP_ALTERNATE_AUTHENTICATION_ENABLED === 'true';
149+
}
113150
}
114151
</script>
115152

0 commit comments

Comments
 (0)