Ngiler SH3LL 360
Home
Information
Create File
Create Folder
:
/
home
/
tbf
/
curs.tbf.ro
/
src
/
components
/
General
/
Information Server
MySQL :
OFF
Perl :
OFF
CURL :
ON
WGET :
OFF
PKEXEC :
OFF
Directive
Local Value
IP Address
89.40.16.97
System
Linux server.atelieruldeit.ro 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64
User
tbf
PHP Version
7.3.33
Software
Apache
Doc root
Writable
close
Edit File :
Navbar.vue
| Size :
5.76
KB
Copy
<template> <nav class="navbar-tbfdigital"> <div class="fe-btn-translation" @click="$root.$emit('open_modal_translation', 'Untranslated', [])" v-if="globalTranslate">Untranslated</div> <div class="space-left"> <img src="/build/icons/daily-plan.svg" class="main-page-icon" v-if="$route.name == 'homepage' || $route.name == 'dashboard'"> <img src="/build/icons/master-goals.svg" class="main-page-icon" v-else-if="$route.name == 'master-goals'"> <img src="/build/icons/objectives.svg" class="main-page-icon" v-else-if="$route.name == 'objectives'"> <img src="/build/icons/people.svg" class="main-page-icon" v-else-if="$route.name == 'users'"> <img src="/build/icons/reports.svg" class="main-page-icon" v-else-if="$route.name == 'reports'"> <img src="/build/icons/back-cta.svg" class="back-btn" @click="goRoute(navbarBack)" v-else-if="navbarBack"> </div> <div class="content-section"> <div class="title-page" v-if="viewTitle">{{ navbarTitle }}</div> <div v-if="navbarDescription && viewTitle"> <v-popover offset="10" trigger="hover click" placement="bottom" popoverBaseClass="popover-tbf" popoverClass="description-popover" :delay="{show: 100, hide: 0}" class="margin-left-desc"> <icon-info class="icon-info"/> <template slot="popover"> <div class="description">{{ navbarDescription }}</div> </template> </v-popover> </div> <div class="title-page" v-if="!viewTitle"><div class="placeholder-loader" style="height: 22px; width: 170px;"></div></div> <div class="profile-items"> <div class="system_notifications" @click="showModal('notifications')"> <div class="has_notification" v-if="notifications.length"></div> <icon-bell></icon-bell> </div> <div class="profile-navbar" @click="showModal('profile_settings')"> <img :src="$auth.user().avatar" v-if="$auth.user().avatar"> <div class="user-circle" v-else> <icon-user-settings/> </div> </div> </div> </div> <div class="space-right"></div> </nav> </template> <script> import IconBell from '../Icons/Bell' import IconInfo from '../Icons/Info' import IconArrow from '../Icons/Arrow' import IconUserSettings from '../Icons/UserSettings' export default { data() { return { notifications: [], navbarTitle: '', navbarDescription: '', navbarBack: '', isSocketActive: false, viewTitle: true }; }, components: { IconBell, IconArrow, IconInfo, IconUserSettings }, watch:{ $route (to, from){ if(from.name != to.name){ this.viewTitle = false } } }, created(){ this.$root.$on("navbar_title", (title, back = false, description = false) => { this.viewTitle = true this.navbarTitle = title this.navbarBack = back this.navbarDescription = description }); }, async mounted() { if(!this.isSocketActive && this.$auth.check()){ this.initWebSocket(); } this.$root.$on("navbar_title", (title, back = false, description = false) => { this.navbarTitle = title this.navbarBack = back this.navbarDescription = description }); this.$root.$on("clear_notifications", () => { this.notifications = [] }); }, methods: { initAppcues() { window.Appcues.identify( this.$auth.user().id, // unique, required { createdAt: null, // Unix timestamp of user signup date purchasedAd: null, // Unix timestamp of account purchase date (leave null if empty) planTier: this.$auth.user().package ? this.$auth.user().package.name : '', // Current user’s plan tier role: this.$auth.user().is_admin ? 'admin' : 'employee', // Current user’s role or permissions accountId: this.$auth.user().id, // Current user's account ID firstName: this.$auth.user().last_name, // current user's first name // additional suggestions email: this.$auth.user().email, // Current user's email version: "2.0", // users on different versions may need to see different content language: this.$auth.user().language, // for multi-language applications } ); }, initWebSocket() { // console.log('Connecting to websocket...'); this.socket = new WebSocket('wss://digitalbackend.tbf.ro:12346') // console.log('Connecting to websocket...'); // this.socket = new WebSocket('wss://tbfdigitalbackend.atelieruldeit.ro:11134') this.socket.onopen = event => { // console.log('Connection to websocket established'); this.isSocketActive = true; // check in to websocket this.socket.send(JSON.stringify({ 'user_id': this.$auth.user().id })); // console.log('Subscribed to websocket'); }; // when receiving a message this.socket.onmessage = ({data}) => { const parsedData = JSON.parse(data); this.notifications.unshift(parsedData) this.$root.$emit('updateNotificationsList', parsedData); }; this.socket.onerror = error => { console.log(`Websocket error`); }; this.socket.onclose = event => { if (this.isSocketActive) { this.isSocketActive = false; } if (event.wasClean) { // console.log(`[close] Connection closed cleanly, code=${event.code} reason=${event.reason}`); } else { // e.g. server process killed or network down // event.code is usually 1006 in this case // console.log('[close] Connection died'); setTimeout(() => { this.initWebSocket(); }, 600000); } }; }, logout(){ this.$auth.logout(); }, showModal(type){ this.$root.$emit('open_modal', type); }, viewObjective(objectiveSlug){ this.$router.push({ name: 'show-objective', params: { slug: objectiveSlug }}) }, goRoute(route){ this.$router.push({ name: route}) } }, computed:{} }; </script>
Back