Commit 0a1ef762 authored by Marcel Nellesen's avatar Marcel Nellesen Committed by Petar Hristov
Browse files

New: Added a Notification Banner.

parent d6f8957f
......@@ -20,3 +20,6 @@ yarn-error.log*
*.njsproj
*.sln
*.sw*
# npm packages
package-lock.json
......@@ -4,6 +4,17 @@
:rwthImage="rwthImage"
:locale="this.$root.$i18n.locale"
@changeLocale="changeLocale"/>
<br/>
<coscine-notification-banner
v-show="displayMaintenceNotice"
id="notificationBanner"
:bannerText1="maintenanceNotices"
:bannerText2="$t('banner.maintenance.notificationEndText')"
:linkText="$t('banner.maintenance.moreInformation')"
:bannerLink="bannerLink"
:visible="true"
:dismissable="false"
/>
<div class="container-fluid app-content">
<div class="row">
<div class="col-xl-2"></div>
......@@ -96,9 +107,8 @@ import VueMarkdown from 'vue-markdown';
import LoginMain from './components/LoginMain.vue';
import LogoutMain from './components/LogoutMain.vue';
import TOS from './components/TOS.vue';
import { CoscinePageHeader, CoscinePageFooter } from '@coscine/component-library';
import { CoscinePageHeader, CoscinePageFooter, CoscineNotificationBanner } from '@coscine/component-library';
import '@coscine/component-library/dist/index.css';
import coscineImageBluePath from './assets/rwth_coscine_rgb.svg';
import rwthImagePath from './assets/rwth_coscine_weiss_rgb.svg';
import linkWhitePath from './assets/link_white.svg';
......@@ -127,6 +137,7 @@ export default Vue.extend({
VueMarkdown,
CoscinePageHeader,
CoscinePageFooter,
CoscineNotificationBanner,
},
computed: {
cssProps() {
......@@ -140,6 +151,8 @@ export default Vue.extend({
},
data() {
return {
bannerLink: '',
maintenanceNotices: '',
coscineImageBlue: rootUrl + coscineImageBluePath,
rwthImage: rootUrl + rwthImagePath,
imageEnabled,
......@@ -155,11 +168,13 @@ export default Vue.extend({
tos: linkUtil.getIsTOS(),
news: '',
storedUrl: {} as any,
displayMaintenceNotice: false
};
},
watch: {
'$i18n.locale'() {
this.retrieveNotices();
this.retrieveMaintenanceNotices();
},
},
methods: {
......@@ -171,6 +186,38 @@ export default Vue.extend({
this.news= this.news.replace('## ', '##### ');
});
},
retrieveMaintenanceNotices() {
NoticeApi.GetMaintenance((response: any) => {
if (response.data.startsDate !== null && response.data.startsDate !== undefined) {
this.displayMaintenceNotice = true;
var now = new Date(Date.now());
var startDate = new Date(response.data.startsDate);
var endDate = response.data.endsDate;
if (startDate <= now && (endDate === null || new Date(endDate) >= now)) {
this.bannerLink = response.data.url;
this.maintenanceNotices = this.createNotificationText(response.data.type);
}
}
});
},
createNotificationText(type: any): any {
switch (type) {
case 'Störung':
return this.$t('banner.maintenance.notificationMaintenance');
case 'Teilstörung':
return this.$t('banner.maintenance.notificationPartiaMulfunction');
case 'Unterbrechung':
return this.$t('banner.maintenance.notificationInteruption');
case 'eingeschränkt betriebsfähig':
return this.$t('banner.maintenance.notificationLimitedOperability');
case 'Wartung':
return this.$t('banner.maintenance.notificationMaintenance');
case 'Teilwartung':
return this.$t('banner.maintenance.notificationPartialMaintenance');
default:
return this.$t('banner.maintenance.notificationDefaultText');
}
},
loginBack() {
this.currentInputCard = 'LoginMain';
},
......@@ -190,7 +237,8 @@ export default Vue.extend({
},
created() {
this.retrieveNotices();
},
this.retrieveMaintenanceNotices();
}
});
</script>
......@@ -308,8 +356,9 @@ export default Vue.extend({
text-align: left;
border-radius: .2rem;
}
.alert.alert-warning {
border-radius: .2rem;
#notificationBanner {
margin-bottom: 4px;
margin-top: 26px;
}
.multiselect__option--highlight {
......
declare var coscine: {
i18n: {
login: {},
},
};
export default {
headline: 'Willkommen bei ',
description_headline: 'Coscine-Anmeldeinformationen',
description_text: 'Sie können sich entweder über DFN-AAI mit Ihrem institutionellen Account (z.B. RWTH Single Sign-On) oder über ORCID anmelden.',
description_help: 'Schreiben Sie an ',
description_help_headline: 'Technische Fragen oder allgemeines Feedback?',
login_headline: 'Login',
login_button_with_account: 'Login-Zugang',
login_button_orcid: 'Anmelden mit ORCID',
login_button_form: 'Anmelden mit User ID',
login_rwth: 'Anmelden mit RWTH Aachen University',
login_fh: 'Anmelden mit University of Applied Sciences Aachen',
login_button_without_account: 'Weiter ohne Login',
logout_button_orcid: 'Logout von ORCID',
logout_shibboleth: 'Logout von Shibboleth',
other_institutes: 'Anderes Institutionelles Konto',
signup: 'Anmelden',
back: 'Zurück',
continue: 'Weiter',
InstituteSelection: 'Institution auswählen',
login_form_headline: 'Login mit Nutzer-ID',
login_form_submit: 'Senden',
login_form_id_required: 'Das UserId-Feld wird benötigt.',
localeValue: 'De',
help: 'Hilfe',
disclaimer: 'Datenschutz',
imprint: 'Impressum',
contact: 'Kontakt',
otherLocale: 'En',
alert_headline: 'Informationen zur Pilotphase',
alert_text2: ' senden.',
alert_text1: `Coscine befindet sich derzeit in der ersten Pilotphase. Sie können sich also gerne
einloggen und das System erkunden, aber benutzen Sie es noch nicht für Ihre wichtigen Forschungsdaten!
Bitte kontaktieren Sie uns, wenn Sie an dem Pilotprogramm teilnehmen möchten. Feedback und
Verbesserungsvorschläge können Sie gerne an `,
tosppTitle: 'Nutzungsbedingungen und Datenschutzerklärung',
tosppCancel: 'Abbrechen',
tosppContinue: 'Fortfahren',
tosBodyStart: 'Um Coscine nutzen zu können, müssen Sie den Nutzungsbedingungen (',
tosBodyLink: '',
tosBodyEnd: ') zustimmen.',
tosBodyCheckBox: 'Ich akzeptiere die Nutzungsbedingungen',
ppBodyStart: 'Zudem bestätigen Sie, die Datenschutzerklärung (',
ppBodyLink: '',
ppBodyEnd: ') zur Kenntnis genommen zu haben.',
ppBodyCheckBox: 'Ich habe die Datenschutzerklärung zur Kenntnis genommen',
};
export default {
headline: 'Welcome to ',
description_headline: 'Coscine login information',
description_text: 'You can log in using either DFN-AAI with your institutional account (e.g. RWTH Single Sign-On) or via ORCID.',
description_help_headline: 'Technical question or general feedback?',
description_help: 'Write us at ',
login_headline: 'Login',
login_button_with_account: 'Login Access',
login_button_orcid: 'Sign in with ORCID',
login_button_form: 'Sign in with a User ID',
login_rwth: 'Sign in with RWTH Aachen University',
login_fh: 'Sign in with University of Applied Sciences Aachen',
login_button_without_account: 'Continue without Login',
logout_button_orcid: 'Logout from ORCID',
logout_shibboleth: 'Logout from Shibboleth',
other_institutes: 'Other Institutional Account',
signup: 'Sign In',
back: 'Back',
continue: 'Continue',
InstituteSelection: 'Select Institution',
login_form_headline: 'Login with user ID',
login_form_submit: 'Submit',
login_form_id_required: 'The UserId field is required.',
localeValue: 'En',
help: 'Help',
disclaimer: 'Disclaimer',
imprint: 'Imprint',
contact: 'Contact',
otherLocale: 'De',
alert_headline: 'Information about the pilot phase',
alert_text2: '.',
alert_text1: `Coscine is currently in the first pilot phase. So you are welcome to
log in and explore the system, but do not use it for your important
research data yet! Please contact us if you want to be part of the
pilot program. If you have feedback you are welcome to send it to `,
tosppTitle: 'Terms of use and privacy policy',
tosppCancel: 'Cancel',
tosppContinue: 'Continue',
tosBodyStart: 'In order to access Coscine you need to accept the current Terms of Use (',
tosBodyLink: '',
tosBodyEnd: ').',
tosBodyCheckBox: 'I accept the Terms of Use',
ppBodyStart: 'Further you need to confirm that you have read and understood the Privacy Policy (',
ppBodyLink: '',
ppBodyEnd: ').',
ppBodyCheckBox: 'I have read and understood the Privacy Policy',
};
import de from './de';
import en from './en';
export default {
de,
en,
};
......@@ -5,13 +5,12 @@ import BootstrapVue from 'bootstrap-vue';
import '@itcenter-layout/bootstrap/dist/css/rwth-theme.css';
import '@itcenter-layout/bootstrap/dist/css/material-icons.css';
import '@itcenter-layout/masterpage/dist/css/itcenter-masterdesign-masterpage.css';
import locales from './locale/locales';
import VueI18n from 'vue-i18n';
Vue.config.productionTip = false;
Vue.use(BootstrapVue);
Vue.use(VueI18n);
Vue.use(VueI18n);
let localeValue = ((navigator as any).language || (navigator as any).userLanguage) as string;
if (localeValue.indexOf('de') !== -1) {
......@@ -23,7 +22,7 @@ if (localeValue.indexOf('de') !== -1) {
jQuery(() => {
const i18n = new VueI18n({
locale: localeValue, // set locale
messages: locales, // set locale messages
messages: coscine.i18n.login, // set locale messages
silentFallbackWarn: true,
});
......
......@@ -15,4 +15,4 @@ declare module '*.png' {
declare module '*.svg' {
const value: any;
export default value;
}
}
\ No newline at end of file
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment