beginning to implement export favorites
This commit is contained in:
parent
eef14a79b7
commit
7a0b6bc7df
@ -3,6 +3,8 @@
|
||||
### Added
|
||||
- Nextcloud 21 & PHP 8 support
|
||||
[#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
|
||||
- Cleanup SCSS
|
||||
|
@ -25,6 +25,7 @@ return [
|
||||
'resources' => [
|
||||
'favorite' => ['url' => '/api/favorites'],
|
||||
'recent' => ['url' => '/api/recent'],
|
||||
'export' => ['url' => '/export'],
|
||||
],
|
||||
'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.OC = window.OC
|
||||
Vue.prototype.OCA = window.OCA
|
||||
Vue.prototype.$version = '1.0.2'
|
||||
Vue.prototype.$version = '1.0.3'
|
||||
|
||||
Vue.use(VueClipboard)
|
||||
Vue.use(VueBlurHash)
|
||||
|
@ -40,7 +40,7 @@
|
||||
<ActionButton
|
||||
icon="icon-download"
|
||||
:close-after-click="true"
|
||||
@click="alert('Export')">
|
||||
@click="exportList">
|
||||
Export favorites
|
||||
</ActionButton>
|
||||
</Actions>
|
||||
@ -118,9 +118,11 @@ import Navigation from './../components/Navigation'
|
||||
import Table from './../components/Table'
|
||||
import Sidebar from './../components/Sidebar'
|
||||
import { mapGetters, mapActions } from 'vuex'
|
||||
|
||||
import axios from '@nextcloud/axios'
|
||||
import { generateUrl } from '@nextcloud/router'
|
||||
import { RadioBrowserApi } from './../services/RadioBrowserApi'
|
||||
const apiClient = new RadioBrowserApi()
|
||||
const requesttoken = axios.defaults.headers.requesttoken
|
||||
|
||||
export default {
|
||||
name: 'Favorites',
|
||||
@ -143,7 +145,7 @@ export default {
|
||||
showSidebar: false,
|
||||
sidebarStation: {},
|
||||
tableData: [],
|
||||
modal: true,
|
||||
modal: false,
|
||||
station: {
|
||||
faviconUrl: '',
|
||||
},
|
||||
@ -243,13 +245,20 @@ export default {
|
||||
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) {
|
||||
e.preventDefault()
|
||||
const station = {
|
||||
name: this.station.name,
|
||||
urlresolved: this.station.streamUrl,
|
||||
favicon: this.station.faviconUrl,
|
||||
stationuuid: '932eb148-e6f6-11e9-a96c-52543be04c81',
|
||||
stationuuid: this.uuidv4(),
|
||||
bitrate: '',
|
||||
country: '',
|
||||
language: '',
|
||||
@ -261,6 +270,17 @@ export default {
|
||||
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>
|
||||
|
Loading…
Reference in New Issue
Block a user