Skip to content
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 restart, move js files to vue, add state-switch & more #5159

Merged
merged 30 commits into from
Oct 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
39781f8
displayShow -> show
OmgImAlexis Sep 9, 2018
95f2945
add state-switch + tests and move restart js to vue
OmgImAlexis Sep 9, 2018
5679ae1
replaced is_alive jsonp route with json
OmgImAlexis Sep 9, 2018
7f64723
enable typescript validation in src directory
OmgImAlexis Sep 9, 2018
ebe146a
move config_general js to vue mounted
OmgImAlexis Sep 9, 2018
10124a3
move manage_failedDownloads js to vue mounted
OmgImAlexis Sep 9, 2018
92b25a0
move manage_subtitleMissed js to vue mounted
OmgImAlexis Sep 9, 2018
8b7ef23
move mass-update js to vue mounted
OmgImAlexis Sep 9, 2018
a0b44f2
built themes
OmgImAlexis Sep 9, 2018
79428ba
lint
OmgImAlexis Sep 9, 2018
4fe630d
add missing quotes
OmgImAlexis Sep 9, 2018
c7d9544
Merge branch 'develop' into misc-changes
sharkykh Sep 9, 2018
e6eac8b
Merge branch 'develop' into misc-changes
sharkykh Sep 9, 2018
95fa284
Update yarn.lock
sharkykh Sep 9, 2018
ff15877
Fix `manage.mako` white page
sharkykh Sep 9, 2018
349f9b7
Merge branch 'develop' into misc-changes
sharkykh Sep 14, 2018
e396622
Replace `log.*` with `console.*`
sharkykh Sep 14, 2018
15ff724
Remove extra `>` from `showheader.mako`
sharkykh Sep 14, 2018
216e71d
Move `$.makeSubtitleRow` from JS to Vue
sharkykh Sep 14, 2018
125e2dd
Move `$.makeEpisodeRow` from JS to Vue
sharkykh Sep 14, 2018
81c3848
Remove empty `manage/init.js`
sharkykh Sep 14, 2018
e5606c0
Move the rest of `mass-update` JS to Vue
sharkykh Sep 14, 2018
7265197
Remove empty `manage/index.js`
sharkykh Sep 14, 2018
d26099d
Remove empty `MEDUSA.manage` namespace
sharkykh Sep 14, 2018
ec08d23
Update tsconfig.json
sharkykh Sep 14, 2018
6cf3444
Update `is_alive` content type header
sharkykh Sep 14, 2018
e927b4d
Merge branch 'develop' into misc-changes
sharkykh Oct 5, 2018
2f090d7
Use restartState computed property
sharkykh Oct 5, 2018
47eb879
Update changelog
sharkykh Oct 5, 2018
a759e9f
Update tests
sharkykh Oct 5, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Converted "Add Show" options into a Vue SFC ([#4848](https://github.com/pymedusa/Medusa/pull/4848))
- Added publishing date to Speed.CD provider ([#5190](https://github.com/pymedusa/Medusa/pull/5190))
- Converted the "quality pill" into a Vue SFC ([#5103](https://github.com/pymedusa/Medusa/pull/5103))
- Vueify restart page, move JS files to Vue, add `state-switch` component and misc changes ([#5159](https://github.com/pymedusa/Medusa/pull/5159))

#### Fixes
- Fixed many release name parsing issues as a result of updating `guessit` ([#4244](https://github.com/pymedusa/Medusa/pull/4244))
Expand Down
18 changes: 4 additions & 14 deletions medusa/server/web/home/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,23 +248,13 @@ def show_statistics():
return show_stat, max_download_count

def is_alive(self, *args, **kwargs):
if 'callback' in kwargs and '_' in kwargs:
callback, _ = kwargs['callback'], kwargs['_']
else:
return 'Error: Unsupported Request. Send jsonp request with \'callback\' variable in the query string.'

# self.set_header('Cache-Control', 'max-age=0,no-cache,no-store')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know, maybe the cache control is needed right now since it's no longer a JSONP endpoint?

My point is the jQuery JSONP was sending the _ argument (which I think was a timestamp), so the request was never cached. But now I think it's possible the response would be cached?
I'm saying that just to be on the safe side.

self.set_header('Content-Type', 'text/javascript')
self.set_header('Content-Type', 'application/json; charset=UTF-8')
self.set_header('Access-Control-Allow-Origin', '*')
self.set_header('Access-Control-Allow-Headers', 'x-requested-with')

return '{callback}({msg});'.format(
callback=callback,
msg=json.dumps({
'msg': '{pid}'.format(
pid=app.PID if app.started else 'nope')
})
)
return json.dumps({
'pid': app.PID if app.started else ''
})

@staticmethod
# @TODO: Replace with /api/v2/config/kodi, check if enabled === true
Expand Down
4 changes: 2 additions & 2 deletions themes-default/slim/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ import {
Asset,
Backstretch,
Config,
DisplayShow,
FileBrowser,
LanguageSelect,
NamePattern,
PlotInfo,
RootDirs,
ScrollButtons,
SelectList,
Show,
ShowSelector
} from './components';

Expand Down Expand Up @@ -51,14 +51,14 @@ const globalComponents = [
Asset,
Backstretch,
Config,
DisplayShow,
FileBrowser,
LanguageSelect,
NamePattern,
PlotInfo,
RootDirs,
ScrollButtons,
SelectList,
Show,
ShowSelector
];

Expand Down
3 changes: 2 additions & 1 deletion themes-default/slim/src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export { default as ConfigPostProcessing } from './config-post-processing.vue';
export { default as ConfigTextbox } from './config-textbox.vue';
export { default as ConfigTextboxNumber } from './config-textbox-number.vue';
export { default as ConfigToggleSlider } from './config-toggle-slider.vue';
export { default as DisplayShow } from './display-show.vue';
export { default as FileBrowser } from './file-browser.vue';
export { default as Home } from './home.vue';
export { default as IRC } from './irc.vue';
Expand All @@ -24,7 +23,9 @@ export { default as QualityPill } from './quality-pill.vue';
export { default as RootDirs } from './root-dirs.vue';
export { default as ScrollButtons } from './scroll-buttons.vue';
export { default as SelectList } from './select-list.vue';
export { default as Show } from './show.vue';
export { default as ShowSelector } from './show-selector.vue';
export { default as SnatchSelection } from './snatch-selection.vue';
export { default as StateSwitch } from './state-switch.vue';
export { default as Status } from './status.vue';
export { NotFound } from './http';
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import AppLink from './app-link.vue';
import PlotInfo from './plot-info.vue';

export default {
name: 'displayShow',
template: '#display-show-template',
name: 'show',
template: '#show-template',
components: {
AppLink,
PlotInfo
Expand Down
60 changes: 60 additions & 0 deletions themes-default/slim/src/components/state-switch.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<template>
<img v-bind="{ src, alt }" height="16" width="16" />
</template>
<script>
export default {
name: 'state-switch',
props: {
/**
* Theme for loading spinner
*/
theme: {
type: String,
default: 'dark',
validator: theme => [
'dark',
'light'
].includes(theme)
},
/**
* Loading, yes or no
* null, true or false
*/
state: {
required: true,
validator: state => [
'yes',
'no',
'loading',
'true',
'false',
'null'
].includes(String(state))
}
},
computed: {
src() {
const { theme, realState: state } = this;
return state === 'loading' ? `images/loading16-${theme}.gif` : `images/${state}16.png`;
},
alt() {
const { realState: state } = this;
return state.charAt(0).toUpperCase() + state.substr(1);
},
realState() {
const { state } = this;
if (['null', 'true', 'false'].includes(String(state))) {
return {
null: 'loading',
true: 'yes',
false: 'no'
}[String(state)];
}
return state;
}
}
};
</script>
<style>
/* placeholder */
</style>
7 changes: 4 additions & 3 deletions themes-default/slim/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import {
AppLink,
Asset,
Backstretch,
DisplayShow,
FileBrowser,
Home,
LanguageSelect,
Expand All @@ -39,8 +38,10 @@ import {
RootDirs,
ScrollButtons,
SelectList,
Show,
ShowSelector,
SnatchSelection,
StateSwitch,
Status
} from './components';

Expand Down Expand Up @@ -71,7 +72,6 @@ if (window) {
common: {},
config: {},
home: {},
manage: {},
addShows: {}
};
window.webRoot = webRoot;
Expand All @@ -86,7 +86,6 @@ if (window) {
window.components.push(AppLink);
window.components.push(Asset);
window.components.push(Backstretch);
window.components.push(DisplayShow);
window.components.push(FileBrowser);
window.components.push(Home);
window.components.push(LanguageSelect);
Expand All @@ -97,8 +96,10 @@ if (window) {
window.components.push(RootDirs);
window.components.push(ScrollButtons);
window.components.push(SelectList);
window.components.push(Show);
window.components.push(ShowSelector);
window.components.push(SnatchSelection);
window.components.push(StateSwitch);
window.components.push(Status);
}

Expand Down
2 changes: 1 addition & 1 deletion themes-default/slim/src/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const homeRoutes = [{
name: 'editShow'
}, {
path: '/home/displayShow',
name: 'displayShow'
name: 'show'
}, {
path: '/home/snatchSelection',
name: 'snatchSelection'
Expand Down
32 changes: 0 additions & 32 deletions themes-default/slim/static/js/config/index.js

This file was deleted.

54 changes: 0 additions & 54 deletions themes-default/slim/static/js/manage/failed-downloads.js

This file was deleted.

50 changes: 0 additions & 50 deletions themes-default/slim/static/js/manage/index.js

This file was deleted.

39 changes: 0 additions & 39 deletions themes-default/slim/static/js/manage/init.js

This file was deleted.

Loading