-
Notifications
You must be signed in to change notification settings - Fork 277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vueify footer #4520
Merged
Merged
Vueify footer #4520
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8778c4e
Convert footer into a Vue SFC
sharkykh 7d2f8db
Add render test
sharkykh 1cee67c
[bundle]
sharkykh 15c70ee
Remove unused stuff from `server.web.core.base`
sharkykh 0011127
Merge branch 'develop' into vueify/footer
sharkykh 47a23c8
Updates
sharkykh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
<template> | ||
<footer> | ||
<div class="footer clearfix"> | ||
<span class="footerhighlight">{{ stats.overall.shows.total }}</span> Shows (<span class="footerhighlight">{{ stats.overall.shows.active }}</span> Active) | ||
| <span class="footerhighlight">{{ stats.overall.episodes.downloaded }}</span> | ||
<template v-if="stats.overall.episodes.snatched"> | ||
<span class="footerhighlight"><app-link :href="`manage/episodeStatuses?whichStatus=${snatchedStatus}`" title="View overview of snatched episodes">+{{ stats.overall.episodes.snatched }}</app-link></span> | ||
Snatched | ||
</template> | ||
/ <span class="footerhighlight">{{ stats.overall.episodes.total }}</span> Episodes Downloaded <span v-if="episodePercentage" class="footerhighlight">({{ episodePercentage }})</span> | ||
| Daily Search: <span class="footerhighlight">{{ schedulerNextRun('dailySearch') }}</span> | ||
| Backlog Search: <span class="footerhighlight">{{ schedulerNextRun('backlog') }}</span> | ||
<div> | ||
<template v-if="system.memoryUsage"> | ||
Memory used: <span class="footerhighlight">{{ system.memoryUsage }}</span> | | ||
</template> | ||
<!-- Load time: <span class="footerhighlight">{{ loadTime }}s</span> / Mako: <span class="footerhighlight">{{ makoTime }}s</span> | --> | ||
Branch: <span class="footerhighlight">{{ config.branch || 'Unknown' }}</span> | | ||
Now: <span class="footerhighlight">{{ nowInUserPreset }}</span> | ||
</div> | ||
</div> | ||
</footer> | ||
</template> | ||
|
||
<script> | ||
import { mapGetters, mapState } from 'vuex'; | ||
import formatDate from 'date-fns/format'; | ||
|
||
import { convertDateFormat } from '../utils/core'; | ||
import { AppLink } from './helpers'; | ||
|
||
export default { | ||
name: 'app-footer', | ||
components: { | ||
AppLink | ||
}, | ||
computed: { | ||
...mapState([ | ||
'config', | ||
'stats', | ||
'system' | ||
]), | ||
...mapGetters([ | ||
'getStatus', | ||
'getScheduler' | ||
]), | ||
snatchedStatus() { | ||
const status = this.getStatus({ key: 'snatched' }); | ||
return status ? status.value : ''; | ||
}, | ||
episodePercentage() { | ||
const { downloaded, total } = this.stats.overall.episodes; | ||
if (!total) { | ||
return ''; | ||
} | ||
const raw = (downloaded / total) * 100; | ||
return raw.toFixed(1) + '%'; | ||
}, | ||
nowInUserPreset() { | ||
const { datePreset, timePreset } = this.config; | ||
const preset = convertDateFormat(`${datePreset} ${timePreset}`); | ||
return formatDate(new Date(), preset); | ||
} | ||
}, | ||
methods: { | ||
/** | ||
* Return a formatted next run time of the scheduler matching the provided key. | ||
* | ||
* @param {string} scheduler A scheduler key. | ||
* @returns {string} The formatted next run time. | ||
*/ | ||
schedulerNextRun(scheduler) { | ||
/** @type {import('../store/modules/system').Scheduler} */ | ||
const { nextRun } = this.getScheduler(scheduler); | ||
// The next run can be `undefined` when the scheduler was not initialized | ||
// on the backend, and `null` when the scheduler is not enabled. | ||
if (nextRun === undefined) { | ||
return '??:??:??'; | ||
} | ||
if (nextRun === null) { | ||
return 'Disabled'; | ||
} | ||
return this.formatTimeDuration(nextRun); | ||
}, | ||
/** | ||
* Return a formatted string representing the provided duration. | ||
* | ||
* This function will not use any units greater than a day. | ||
* @param {number} durationInMs Duration of time in milliseconds. | ||
* @returns {string} The formatted duration. | ||
* | ||
* @example | ||
*/ | ||
formatTimeDuration(durationInMs) { | ||
const days = parseInt(durationInMs / 86400000, 10); | ||
let daysText = ''; | ||
if (days > 0) { | ||
daysText = String(days) + (days > 1 ? ' days, ' : ' day, '); | ||
} | ||
|
||
const date = new Date(durationInMs % 86400000); | ||
const zeroPad = (num, len = 2) => String(num).padStart(len, '0'); | ||
const hours = String(date.getUTCHours()); | ||
const minutes = zeroPad(date.getUTCMinutes()); | ||
const seconds = zeroPad(date.getUTCSeconds() + Math.round(date.getUTCMilliseconds() / 1000)); | ||
return daysText + [hours, minutes, seconds].join(':'); | ||
} | ||
} | ||
}; | ||
</script> | ||
|
||
<style scoped> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Version 3.7.0 added native support for
per-file-ignores
.http://flake8.pycqa.org/en/latest/user/options.html#cmdoption-flake8-per-file-ignores