beginning to implement export favorites
This commit is contained in:
parent
eef14a79b7
commit
7a0b6bc7df
@ -3,6 +3,8 @@
|
|||||||
### Added
|
### Added
|
||||||
- Nextcloud 21 & PHP 8 support
|
- Nextcloud 21 & PHP 8 support
|
||||||
[#251](https://git.project-insanity.org/onny/nextcloud-app-radio/-/issues/251) @onny
|
[#251](https://git.project-insanity.org/onny/nextcloud-app-radio/-/issues/251) @onny
|
||||||
|
- Support add stations manually
|
||||||
|
[#157](https://git.project-insanity.org/onny/nextcloud-app-radio/-/issues/157) @onny
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Cleanup SCSS
|
- Cleanup SCSS
|
||||||
|
@ -25,6 +25,7 @@ return [
|
|||||||
'resources' => [
|
'resources' => [
|
||||||
'favorite' => ['url' => '/api/favorites'],
|
'favorite' => ['url' => '/api/favorites'],
|
||||||
'recent' => ['url' => '/api/recent'],
|
'recent' => ['url' => '/api/recent'],
|
||||||
|
'export' => ['url' => '/export'],
|
||||||
],
|
],
|
||||||
'routes' => [
|
'routes' => [
|
||||||
|
|
||||||
|
59
lib/Controller/ExportController.php
Normal file
59
lib/Controller/ExportController.php
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Radio App
|
||||||
|
*
|
||||||
|
* @author Jonas Heinrich
|
||||||
|
* @copyright 2021 Jonas Heinrich <onny@project-insanity.org>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 3 of the License, or any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace OCA\Radio\Controller;
|
||||||
|
|
||||||
|
use OCA\Radio\AppInfo\Application;
|
||||||
|
use OCA\Radio\Service\FavoriteService;
|
||||||
|
use OCP\AppFramework\Controller;
|
||||||
|
use OCP\AppFramework\Http\DataResponse;
|
||||||
|
use OCP\IRequest;
|
||||||
|
|
||||||
|
class ExportController extends Controller {
|
||||||
|
/** @var FavoriteService */
|
||||||
|
private $service;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
private $userId;
|
||||||
|
|
||||||
|
use Errors;
|
||||||
|
|
||||||
|
public function __construct(IRequest $request,
|
||||||
|
FavoriteService $service,
|
||||||
|
$userId) {
|
||||||
|
parent::__construct(Application::APP_ID, $request);
|
||||||
|
$this->service = $service;
|
||||||
|
$this->userId = $userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @NoAdminRequired
|
||||||
|
*/
|
||||||
|
public function index() {
|
||||||
|
header('Content-Type: application/csv');
|
||||||
|
header('Content-Disposition: attachment; filename="filename.csv"');
|
||||||
|
//return new DataResponse($this->service->findAll($this->userId));
|
||||||
|
return "hello";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -38,7 +38,7 @@ Vue.prototype.t = translate
|
|||||||
Vue.prototype.n = translatePlural
|
Vue.prototype.n = translatePlural
|
||||||
Vue.prototype.OC = window.OC
|
Vue.prototype.OC = window.OC
|
||||||
Vue.prototype.OCA = window.OCA
|
Vue.prototype.OCA = window.OCA
|
||||||
Vue.prototype.$version = '1.0.2'
|
Vue.prototype.$version = '1.0.3'
|
||||||
|
|
||||||
Vue.use(VueClipboard)
|
Vue.use(VueClipboard)
|
||||||
Vue.use(VueBlurHash)
|
Vue.use(VueBlurHash)
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
<ActionButton
|
<ActionButton
|
||||||
icon="icon-download"
|
icon="icon-download"
|
||||||
:close-after-click="true"
|
:close-after-click="true"
|
||||||
@click="alert('Export')">
|
@click="exportList">
|
||||||
Export favorites
|
Export favorites
|
||||||
</ActionButton>
|
</ActionButton>
|
||||||
</Actions>
|
</Actions>
|
||||||
@ -118,9 +118,11 @@ import Navigation from './../components/Navigation'
|
|||||||
import Table from './../components/Table'
|
import Table from './../components/Table'
|
||||||
import Sidebar from './../components/Sidebar'
|
import Sidebar from './../components/Sidebar'
|
||||||
import { mapGetters, mapActions } from 'vuex'
|
import { mapGetters, mapActions } from 'vuex'
|
||||||
|
import axios from '@nextcloud/axios'
|
||||||
|
import { generateUrl } from '@nextcloud/router'
|
||||||
import { RadioBrowserApi } from './../services/RadioBrowserApi'
|
import { RadioBrowserApi } from './../services/RadioBrowserApi'
|
||||||
const apiClient = new RadioBrowserApi()
|
const apiClient = new RadioBrowserApi()
|
||||||
|
const requesttoken = axios.defaults.headers.requesttoken
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Favorites',
|
name: 'Favorites',
|
||||||
@ -143,7 +145,7 @@ export default {
|
|||||||
showSidebar: false,
|
showSidebar: false,
|
||||||
sidebarStation: {},
|
sidebarStation: {},
|
||||||
tableData: [],
|
tableData: [],
|
||||||
modal: true,
|
modal: false,
|
||||||
station: {
|
station: {
|
||||||
faviconUrl: '',
|
faviconUrl: '',
|
||||||
},
|
},
|
||||||
@ -243,13 +245,20 @@ export default {
|
|||||||
this.modal = false
|
this.modal = false
|
||||||
},
|
},
|
||||||
|
|
||||||
|
uuidv4() {
|
||||||
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
||||||
|
const r = Math.random() * 16 | 0; const v = c === 'x' ? r : (r & 0x3 | 0x8)
|
||||||
|
return v.toString(16)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
addCustomStation(e) {
|
addCustomStation(e) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
const station = {
|
const station = {
|
||||||
name: this.station.name,
|
name: this.station.name,
|
||||||
urlresolved: this.station.streamUrl,
|
urlresolved: this.station.streamUrl,
|
||||||
favicon: this.station.faviconUrl,
|
favicon: this.station.faviconUrl,
|
||||||
stationuuid: '932eb148-e6f6-11e9-a96c-52543be04c81',
|
stationuuid: this.uuidv4(),
|
||||||
bitrate: '',
|
bitrate: '',
|
||||||
country: '',
|
country: '',
|
||||||
language: '',
|
language: '',
|
||||||
@ -261,6 +270,17 @@ export default {
|
|||||||
this.modal = false
|
this.modal = false
|
||||||
},
|
},
|
||||||
|
|
||||||
|
exportList() {
|
||||||
|
console.log('export list')
|
||||||
|
axios.defaults.headers.requesttoken = requesttoken
|
||||||
|
axios.get(generateUrl('/apps/radio/export'))
|
||||||
|
.then(
|
||||||
|
(response) => {
|
||||||
|
return Promise.resolve(response.data)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user