#5204 -- No longer show service control buttons on unstarted stations.

This commit is contained in:
Buster "Silver Eagle" Neece 2022-03-17 02:05:13 -05:00
parent 3db6903185
commit ea64d9fe04
No known key found for this signature in database
GPG Key ID: 9FC8B9E008872109
3 changed files with 48 additions and 41 deletions

View File

@ -20,16 +20,18 @@
<a class="btn btn-primary" :href="managePlaylistsUri" key="lang_profile_manage_playlists" v-translate>Playlists</a>
</div>
</div>
<div class="card-actions" v-if="userCanManageBroadcasting">
<div class="card-actions" v-if="userCanManageBroadcasting && hasStarted">
<a class="api-call no-reload btn btn-outline-secondary" :href="backendRestartUri">
<icon icon="update"></icon>
<translate key="lang_profile_backend_restart">Restart</translate>
</a>
<a class="api-call no-reload btn btn-outline-success" v-show="!np.services.backend_running" :href="backendStartUri">
<a class="api-call no-reload btn btn-outline-success" v-show="!np.services.backend_running"
:href="backendStartUri">
<icon icon="play_arrow"></icon>
<translate key="lang_profile_backend_start">Start</translate>
</a>
<a class="api-call no-reload btn btn-outline-danger" v-show="np.services.backend_running" :href="backendStopUri">
<a class="api-call no-reload btn btn-outline-danger" v-show="np.services.backend_running"
:href="backendStopUri">
<icon icon="stop"></icon>
<translate key="lang_profile_backend_stop">Stop</translate>
</a>
@ -46,6 +48,7 @@ export const profileBackendProps = {
numSongs: Number,
numPlaylists: Number,
backendType: String,
hasStarted: Boolean,
userCanManageBroadcasting: Boolean,
userCanManageMedia: Boolean,
manageMediaUri: String,

View File

@ -72,16 +72,18 @@
</tbody>
</b-table-simple>
<div class="card-actions">
<div class="card-actions" v-if="hasStarted">
<a class="api-call no-reload btn btn-outline-secondary" :href="frontendRestartUri">
<icon icon="update"></icon>
<translate key="lang_profile_frontend_restart">Restart</translate>
</a>
<a class="api-call no-reload btn btn-outline-success" v-show="!np.services.frontend_running" :href="frontendStartUri">
<a class="api-call no-reload btn btn-outline-success" v-show="!np.services.frontend_running"
:href="frontendStartUri">
<icon icon="play_arrow"></icon>
<translate key="lang_profile_frontend_start">Start</translate>
</a>
<a class="api-call no-reload btn btn-outline-danger" v-show="np.services.frontend_running" :href="frontendStopUri">
<a class="api-call no-reload btn btn-outline-danger" v-show="np.services.frontend_running"
:href="frontendStopUri">
<icon icon="stop"></icon>
<translate key="lang_profile_frontend_stop">Stop</translate>
</a>
@ -105,6 +107,7 @@ export const profileFrontendProps = {
frontendRestartUri: String,
frontendStartUri: String,
frontendStopUri: String,
hasStarted: Boolean,
userCanManageBroadcasting: Boolean
}
};

View File

@ -73,39 +73,40 @@ class ProfileController
title: __('Profile'),
props: [
// Common
'backendType' => $station->getBackendType(),
'frontendType' => $station->getFrontendType(),
'stationTimeZone' => $station->getTimezone(),
'stationSupportsRequests' => $backend->supportsRequests(),
'stationSupportsStreamers' => $backend->supportsStreamers(),
'enableRequests' => $station->getEnableRequests(),
'enableStreamers' => $station->getEnableStreamers(),
'enablePublicPage' => $station->getEnablePublicPage(),
'enableOnDemand' => $station->getEnableOnDemand(),
'profileApiUri' => (string)$router->fromHere('api:stations:profile'),
'backendType' => $station->getBackendType(),
'frontendType' => $station->getFrontendType(),
'stationTimeZone' => $station->getTimezone(),
'stationSupportsRequests' => $backend->supportsRequests(),
'stationSupportsStreamers' => $backend->supportsStreamers(),
'enableRequests' => $station->getEnableRequests(),
'enableStreamers' => $station->getEnableStreamers(),
'enablePublicPage' => $station->getEnablePublicPage(),
'enableOnDemand' => $station->getEnableOnDemand(),
'profileApiUri' => (string)$router->fromHere('api:stations:profile'),
'hasStarted' => $station->getHasStarted(),
// ACL
'userCanManageMedia' => $acl->isAllowed(StationPermissions::Media, $station->getId()),
'userCanManageBroadcasting' => $acl->isAllowed(StationPermissions::Broadcasting, $station->getId()),
'userCanManageProfile' => $acl->isAllowed(StationPermissions::Profile, $station->getId()),
'userCanManageReports' => $acl->isAllowed(StationPermissions::Reports, $station->getId()),
'userCanManageStreamers' => $acl->isAllowed(StationPermissions::Streamers, $station->getId()),
'userCanManageMedia' => $acl->isAllowed(StationPermissions::Media, $station->getId()),
'userCanManageBroadcasting' => $acl->isAllowed(StationPermissions::Broadcasting, $station->getId()),
'userCanManageProfile' => $acl->isAllowed(StationPermissions::Profile, $station->getId()),
'userCanManageReports' => $acl->isAllowed(StationPermissions::Reports, $station->getId()),
'userCanManageStreamers' => $acl->isAllowed(StationPermissions::Streamers, $station->getId()),
// Header
'stationName' => $station->getName(),
'stationDescription' => $station->getDescription(),
'manageProfileUri' => (string)$router->fromHere('stations:profile:edit'),
'stationName' => $station->getName(),
'stationDescription' => $station->getDescription(),
'manageProfileUri' => (string)$router->fromHere('stations:profile:edit'),
// Now Playing
'backendSkipSongUri' => (string)$router->fromHere('api:stations:backend', ['do' => 'skip']),
'backendSkipSongUri' => (string)$router->fromHere('api:stations:backend', ['do' => 'skip']),
'backendDisconnectStreamerUri' => (string)$router->fromHere(
'api:stations:backend',
['do' => 'disconnect']
),
// Requests
'requestsViewUri' => (string)$router->fromHere('stations:reports:requests'),
'requestsToggleUri' => (string)$router->fromHere(
'requestsViewUri' => (string)$router->fromHere('stations:reports:requests'),
'requestsToggleUri' => (string)$router->fromHere(
'stations:profile:toggle',
['feature' => 'requests', 'csrf' => $csrf]
),
@ -169,28 +170,28 @@ class ProfileController
absolute: true
),
'togglePublicPageUri' => (string)$router->fromHere(
'togglePublicPageUri' => (string)$router->fromHere(
route_name: 'stations:profile:toggle',
route_params: ['feature' => 'public', 'csrf' => $csrf]
),
// Frontend
'frontendAdminUri' => (string)$frontend->getAdminUrl($station, $router->getBaseUrl()),
'frontendAdminPassword' => $frontendConfig->getAdminPassword(),
'frontendAdminUri' => (string)$frontend->getAdminUrl($station, $router->getBaseUrl()),
'frontendAdminPassword' => $frontendConfig->getAdminPassword(),
'frontendSourcePassword' => $frontendConfig->getSourcePassword(),
'frontendRelayPassword' => $frontendConfig->getRelayPassword(),
'frontendRestartUri' => (string)$router->fromHere('api:stations:frontend', ['do' => 'restart']),
'frontendStartUri' => (string)$router->fromHere('api:stations:frontend', ['do' => 'start']),
'frontendStopUri' => (string)$router->fromHere('api:stations:frontend', ['do' => 'stop']),
'frontendRelayPassword' => $frontendConfig->getRelayPassword(),
'frontendRestartUri' => (string)$router->fromHere('api:stations:frontend', ['do' => 'restart']),
'frontendStartUri' => (string)$router->fromHere('api:stations:frontend', ['do' => 'start']),
'frontendStopUri' => (string)$router->fromHere('api:stations:frontend', ['do' => 'stop']),
// Backend
'numSongs' => (int)$num_songs,
'numPlaylists' => (int)$num_playlists,
'manageMediaUri' => (string)$router->fromHere('stations:files:index'),
'managePlaylistsUri' => (string)$router->fromHere('stations:playlists:index'),
'backendRestartUri' => (string)$router->fromHere('api:stations:backend', ['do' => 'restart']),
'backendStartUri' => (string)$router->fromHere('api:stations:backend', ['do' => 'start']),
'backendStopUri' => (string)$router->fromHere('api:stations:backend', ['do' => 'stop']),
'numSongs' => (int)$num_songs,
'numPlaylists' => (int)$num_playlists,
'manageMediaUri' => (string)$router->fromHere('stations:files:index'),
'managePlaylistsUri' => (string)$router->fromHere('stations:playlists:index'),
'backendRestartUri' => (string)$router->fromHere('api:stations:backend', ['do' => 'restart']),
'backendStartUri' => (string)$router->fromHere('api:stations:backend', ['do' => 'start']),
'backendStopUri' => (string)$router->fromHere('api:stations:backend', ['do' => 'stop']),
],
);
}