Merge branch 'develop' into i18n-components

This commit is contained in:
Bat 2018-04-22 09:45:22 +01:00
commit 28c067b43c
50 changed files with 580 additions and 134 deletions

View file

@ -35,7 +35,7 @@
<router-link class="item" v-if="$store.state.auth.authenticated" :to="{name: 'logout'}"><i class="sign out icon"></i> {{ $t('Logout') }}</router-link>
<router-link class="item" v-else :to="{name: 'login'}"><i class="sign in icon"></i> {{ $t('Login') }}</router-link>
<router-link class="item" :to="{path: '/library'}"><i class="sound icon"> </i>{{ $t('Browse library') }}</router-link>
<router-link class="item" :to="{path: '/favorites'}"><i class="heart icon"></i> {{ $t('Favorites') }}</router-link>
<router-link class="item" v-if="$store.state.auth.authenticated" :to="{path: '/favorites'}"><i class="heart icon"></i> {{ $t('Favorites') }}</router-link>
<a
@click="$store.commit('playlists/chooseTrack', null)"
v-if="$store.state.auth.authenticated"

View file

@ -48,7 +48,7 @@
<div
v-if="track"
class="ui green icon basic small right floated button"
:title="{{ $t('Add to this playlist') }}"
:title="$t('Add to this playlist')"
@click="addToPlaylist(playlist.id)">
<i class="plus icon"></i> {{ $t('Add track') }}
</div>

View file

@ -19,6 +19,14 @@ export default {
}
},
mutations: {
reset (state) {
state.authenticated = false
state.profile = null
state.username = ''
state.token = ''
state.tokenData = {}
state.availablePermissions = {}
},
profile: (state, value) => {
state.profile = value
},
@ -53,8 +61,6 @@ export default {
return axios.post('token/', credentials).then(response => {
logger.default.info('Successfully logged in as', credentials.username)
commit('token', response.data.token)
commit('username', credentials.username)
commit('authenticated', true)
dispatch('fetchProfile')
// Redirect to a specified route
router.push(next)
@ -64,19 +70,25 @@ export default {
})
},
logout ({commit}) {
commit('authenticated', false)
let modules = [
'auth',
'favorites',
'player',
'playlists',
'queue',
'radios'
]
modules.forEach(m => {
commit(`${m}/reset`, null, {root: true})
})
logger.default.info('Log out, goodbye!')
router.push({name: 'index'})
},
check ({commit, dispatch, state}) {
logger.default.info('Checking authentication...')
var jwt = state.token
var username = state.username
if (jwt) {
commit('authenticated', true)
commit('username', username)
commit('token', jwt)
logger.default.info('Logged back in as ' + username)
dispatch('fetchProfile')
dispatch('refreshToken')
} else {
@ -88,6 +100,7 @@ export default {
return axios.get('users/users/me/').then((response) => {
logger.default.info('Successfully fetched user profile')
let data = response.data
commit('authenticated', true)
commit('profile', data)
commit('username', data.username)
dispatch('favorites/fetch', null, {root: true})

View file

@ -20,6 +20,10 @@ export default {
}
}
state.count = state.tracks.length
},
reset (state) {
state.tracks = []
state.count = 0
}
},
getters: {

View file

@ -15,6 +15,10 @@ export default {
looping: 0 // 0 -> no, 1 -> on track, 2 -> on queue
},
mutations: {
reset (state) {
state.errorCount = 0
state.playing = false
},
volume (state, value) {
value = parseFloat(value)
value = Math.min(value, 1)

View file

@ -17,6 +17,11 @@ export default {
},
showModal (state, value) {
state.showModal = value
},
reset (state) {
state.playlists = []
state.modalTrack = null
state.showModal = false
}
},
actions: {

View file

@ -10,6 +10,12 @@ export default {
previousQueue: null
},
mutations: {
reset (state) {
state.tracks = []
state.currentIndex = -1
state.ended = true
state.previousQueue = null
},
currentIndex (state, value) {
state.currentIndex = value
},

View file

@ -26,6 +26,10 @@ export default {
}
},
mutations: {
reset (state) {
state.running = false
state.current = false
},
current: (state, value) => {
state.current = value
},

View file

@ -3,16 +3,16 @@
<div class="ui secondary pointing menu">
<router-link
class="ui item"
:to="{name: 'federation.libraries.list'}">Libraries</router-link>
:to="{name: 'federation.libraries.list'}">{{ $t('Libraries') }}</router-link>
<router-link
class="ui item"
:to="{name: 'federation.tracks.list'}">Tracks</router-link>
:to="{name: 'federation.tracks.list'}">{{ $t('Tracks') }}</router-link>
<div class="ui secondary right menu">
<router-link
class="ui item"
:to="{name: 'federation.followers.list'}">
Followers
<div class="ui teal label" title="Pending requests">{{ requestsCount }}</div>
{{ $t('Followers') }}
<div class="ui teal label" :title="$t('Pending requests')">{{ requestsCount }}</div>
</router-link>
</div>
</div>

View file

@ -19,18 +19,18 @@
<tbody>
<tr>
<td >
Follow status
{{ $t('Follow status') }}
<span :data-tooltip="$t('This indicate if the remote library granted you access')"><i class="question circle icon"></i></span>
</td>
<td>
<template v-if="object.follow.approved === null">
<i class="loading icon"></i> Pending approval
<i class="loading icon"></i> {{ $t('Pending approval') }}
</template>
<template v-else-if="object.follow.approved === true">
<i class="check icon"></i> Following
<i class="check icon"></i> {{ $t('Following') }}
</template>
<template v-else-if="object.follow.approved === false">
<i class="x icon"></i> Not following
<i class="x icon"></i> {{ $t('Not following') }}
</template>
</td>
<td>
@ -38,7 +38,7 @@
</tr>
<tr>
<td>
Federation
{{ $t('Federation') }}
<span :data-tooltip="$t('Use this flag to enable/disable federation with this library')"><i class="question circle icon"></i></span>
</td>
<td>
@ -54,7 +54,7 @@
</tr>
<tr>
<td>
Auto importing
{{ $t('Auto importing') }}
<span :data-tooltip="$t('When enabled, auto importing will automatically import new tracks published in this library')"><i class="question circle icon"></i></span>
</td>
<td>
@ -82,14 +82,14 @@
</tr>
-->
<tr>
<td>Library size</td>
<td>{{ $t('Library size') }}</td>
<td>
{{ object.tracks_count }} tracks
{{ $t('{%count%} tracks', { count: object.tracks_count }) }}
</td>
<td></td>
</tr>
<tr>
<td>Last fetched</td>
<td>{{ $t('Last fetched') }}</td>
<td>
<human-date v-if="object.fetched_date" :date="object.fetched_date"></human-date>
<template v-else>Never</template>
@ -97,10 +97,10 @@
@click="scan"
v-if="!scanTrigerred"
:class="['ui', 'basic', {loading: isScanLoading}, 'button']">
<i class="sync icon"></i> Trigger scan
<i class="sync icon"></i> {{ $t('Trigger scan') }}
</button>
<button v-else class="ui success button">
<i class="check icon"></i> Scan triggered!
<i class="check icon"></i> {{ $t('Scan triggered!') }}
</button>
</td>
@ -110,10 +110,10 @@
</table>
</div>
<div class="ui hidden divider"></div>
<button @click="fetchData" class="ui basic button">Refresh</button>
<button @click="fetchData" class="ui basic button">{{ $t('Refresh') }}</button>
</div>
<div class="ui vertical stripe segment">
<h2>Tracks available in this library</h2>
<h2>{{ $t('Tracks available in this library') }}</h2>
<library-track-table v-if="!isLoading" :filters="{library: id}"></library-track-table>
</div>
</template>

View file

@ -1,10 +1,9 @@
<template>
<div v-title="'Followers'">
<div class="ui vertical stripe segment">
<h2 class="ui header">Browsing followers</h2>
<h2 class="ui header">{{ $t('Browsing followers') }}</h2>
<p>
Be careful when accepting follow requests, as it means the follower
will have access to your entire library.
{{ $t('Be careful when accepting follow requests, as it means the follower will have access to your entire library.') }}
</p>
<div class="ui hidden divider"></div>
<library-follow-table></library-follow-table>

View file

@ -1,22 +1,22 @@
<template>
<div v-title="'Libraries'">
<div class="ui vertical stripe segment">
<h2 class="ui header">Browsing libraries</h2>
<h2 class="ui header">{{ $t('Browsing libraries') }}</h2>
<router-link
class="ui basic green button"
:to="{name: 'federation.libraries.scan'}">
<i class="plus icon"></i>
Add a new library
{{ $t('Add a new library') }}
</router-link>
<div class="ui hidden divider"></div>
<div :class="['ui', {'loading': isLoading}, 'form']">
<div class="fields">
<div class="field">
<label>Search</label>
<label>{{ $t('Search') }}</label>
<input type="text" v-model="query" placeholder="Enter an library domain name..."/>
</div>
<div class="field">
<label>Ordering</label>
<label>{{ $t('Ordering') }}</label>
<select class="ui dropdown" v-model="ordering">
<option v-for="option in orderingOptions" :value="option[0]">
{{ option[1] }}
@ -24,14 +24,14 @@
</select>
</div>
<div class="field">
<label>Ordering direction</label>
<label>{{ $t('Ordering direction') }}</label>
<select class="ui dropdown" v-model="orderingDirection">
<option value="">Ascending</option>
<option value="-">Descending</option>
<option value="">{{ $t('Ascending') }}</option>
<option value="-">{{ $t('Descending') }}</option>
</select>
</div>
<div class="field">
<label>Results per page</label>
<label>{{ $t('Results per page') }}</label>
<select class="ui dropdown" v-model="paginateBy">
<option :value="parseInt(12)">12</option>
<option :value="parseInt(25)">25</option>

View file

@ -1,7 +1,7 @@
<template>
<div v-title="'Federated tracks'">
<div class="ui vertical stripe segment">
<h2 class="ui header">Browsing federated tracks</h2>
<h2 class="ui header">{{ $t('Browsing federated tracks') }}</h2>
<div class="ui hidden divider"></div>
<library-track-table :show-library="true"></library-track-table>
</div>

View file

@ -2,10 +2,10 @@
<div class="main pusher" v-title="'Instance Timeline'">
<div class="ui vertical center aligned stripe segment">
<div v-if="isLoading" :class="['ui', {'active': isLoading}, 'inverted', 'dimmer']">
<div class="ui text loader">Loading timeline...</div>
<div class="ui text loader">{{ $t('Loading timeline...') }}</div>
</div>
<div v-else class="ui text container">
<h1 class="ui header">Recent activity on this instance</h1>
<h1 class="ui header">{{ $t('Recent activity on this instance') }}</h1>
<div class="ui feed">
<component
class="event"