提交 0266ed16 编写于 作者: S Sebastian Florek

Improve dashboard state transitions and fix dependency issues

上级 13ec6535
......@@ -69,3 +69,18 @@ func GetServiceList(client client.Interface) (*ServiceList, error) {
return serviceList, nil
}
// GetServiceListFromChannels returns a list of all services in the cluster.
func GetServiceListFromChannels(channels *common.ResourceChannels) (*ServiceList, error) {
services := <-channels.ServiceList.List
if err := <-channels.ServiceList.Error; err != nil {
return nil, err
}
serviceList := &ServiceList{Services: make([]Service, 0)}
for _, service := range services.Items {
serviceList.Services = append(serviceList.Services, ToService(&service))
}
return serviceList, nil
}
......@@ -16,7 +16,7 @@ limitations under the License.
<md-toolbar class="kd-toolbar">
<div class="md-toolbar-tools kd-toolbar-tools">
<a ui-sref="replicationcontrollersdeprecated" ui-sref-opts="{ reload: true }" tabindex="-1">
<a ui-sref="workloads" ui-sref-opts="{ reload: true }" tabindex="-1">
<md-icon md-svg-icon="assets/images/kubernetes-logo.svg" class="kd-toolbar-logo"></md-icon>
</a>
<h2>
......
......@@ -49,9 +49,13 @@ kd-resource-card-column {
&:last-child {
padding-right: $baseline-grid;
}
}
&:first-child {
padding-left: $baseline-grid;
.kd-resource-card-list-with-statuses {
kd-resource-card-column {
&:first-child {
padding-left: $baseline-grid;
}
}
}
......
......@@ -16,6 +16,7 @@ import {actionbarViewName} from 'chrome/chrome_state';
import {breadcrumbsConfig} from 'common/components/breadcrumbs/breadcrumbs_component';
import {DeploymentListController} from './deploymentlist_controller';
import {stateName, stateUrl} from './deploymentlist_state';
import {stateName as workloadsState} from 'workloads/workloads_state';
import {DeploymentListActionBarController} from './deploymentlistactionbar_controller';
/**
......@@ -33,6 +34,7 @@ export default function stateConfig($stateProvider) {
data: {
[breadcrumbsConfig]: {
'label': 'Deployments',
'parent': workloadsState,
},
},
views: {
......
......@@ -16,6 +16,7 @@ import {actionbarViewName} from 'chrome/chrome_state';
import {breadcrumbsConfig} from 'common/components/breadcrumbs/breadcrumbs_component';
import {PodListController} from './podlist_controller';
import {stateName, stateUrl} from './podlist_state';
import {stateName as workloadsState} from 'workloads/workloads_state';
import {PodListActionBarController} from './podlistactionbar_controller';
/**
......@@ -33,6 +34,7 @@ export default function stateConfig($stateProvider) {
data: {
[breadcrumbsConfig]: {
'label': 'Pods',
'parent': workloadsState,
},
},
views: {
......
......@@ -18,6 +18,7 @@
export class ReplicaSetDetailController {
/**
* @param {!backendApi.ReplicaSetDetail} replicaSetDetail
* @ngInject
*/
constructor(replicaSetDetail) {
/** @export {!backendApi.ReplicaSetDetail} */
......
......@@ -52,6 +52,7 @@ export default function stateConfig($stateProvider) {
* @param {!./replicasetdetail_state.StateParams} $stateParams
* @param {!angular.$resource} $resource
* @return {!angular.Resource<!backendApi.ReplicaSetDetail>}
* @ngInject
*/
export function getReplicaSetDetailResource($resource, $stateParams) {
return $resource(`api/v1/replicasets/${$stateParams.namespace}/${$stateParams.replicaSet}`);
......@@ -60,6 +61,7 @@ export function getReplicaSetDetailResource($resource, $stateParams) {
/**
* @param {!angular.Resource<!backendApi.ReplicaSetDetail>} replicaSetDetailResource
* @return {!angular.$q.Promise}
* @ngInject
*/
export function getReplicaSetDetail(replicaSetDetailResource) {
return replicaSetDetailResource.get().$promise;
......
......@@ -16,6 +16,7 @@ import {actionbarViewName} from 'chrome/chrome_state';
import {breadcrumbsConfig} from 'common/components/breadcrumbs/breadcrumbs_component';
import {ReplicaSetListController} from './replicasetlist_controller';
import {stateName, stateUrl} from './replicasetlist_state';
import {stateName as workloadsState} from 'workloads/workloads_state';
import ReplicaSetListActionBarController from './replicasetlistactionbar_controller';
/**
......@@ -33,6 +34,7 @@ export default function stateConfig($stateProvider) {
data: {
[breadcrumbsConfig]: {
'label': 'Replica Sets',
'parent': workloadsState,
},
},
views: {
......
......@@ -16,6 +16,7 @@ import {actionbarViewName} from 'chrome/chrome_state';
import {breadcrumbsConfig} from 'common/components/breadcrumbs/breadcrumbs_component';
import {ReplicationControllerListController} from './replicationcontrollerlist_controller';
import {stateName, stateUrl} from './replicationcontrollerlist_state';
import {stateName as workloadsState} from 'workloads/workloads_state';
import ReplicationControllerListActionBarController from './replicationcontrollerlistactionbar_controller';
/**
......@@ -33,6 +34,7 @@ export default function stateConfig($stateProvider) {
data: {
[breadcrumbsConfig]: {
'label': 'Replication Controllers',
'parent': workloadsState,
},
},
views: {
......
......@@ -18,6 +18,7 @@
export class ServiceDetailController {
/**
* @param {!backendApi.ServiceDetail} serviceDetail
* @ngInject
*/
constructor(serviceDetail) {
/** @export {!backendApi.ServiceDetail} */
......
......@@ -13,6 +13,7 @@
// limitations under the License.
import componentsModule from './../common/components/components_module';
import filtersModule from 'common/filters/filters_module';
import stateConfig from './servicedetail_stateconfig';
import {serviceInfoComponent} from './servicedetailinfo_component';
......@@ -26,6 +27,9 @@ export default angular
'kubernetesDashboard.serviceDetail',
[
'ngMaterial',
'ngResource',
'ui.router',
filtersModule.name,
componentsModule.name,
])
.config(stateConfig)
......
......@@ -52,6 +52,7 @@ export default function stateConfig($stateProvider) {
* @param {!./servicedetail_state.StateParams} $stateParams
* @param {!angular.$resource} $resource
* @return {!angular.Resource<!backendApi.ServiceDetail>}
* @ngInject
*/
export function getServiceDetailResource($stateParams, $resource) {
return $resource(`api/v1/services/${$stateParams.namespace}/${$stateParams.service}`);
......@@ -60,6 +61,7 @@ export function getServiceDetailResource($stateParams, $resource) {
/**
* @param {!angular.Resource<!backendApi.ServiceDetail>} serviceDetailResource
* @return {!angular.$q.Promise}
* @ngInject
*/
export function resolveServiceDetail(serviceDetailResource) {
return serviceDetailResource.get().$promise;
......
......@@ -18,6 +18,7 @@
export class ServiceListController {
/**
* @param {!backendApi.ServiceList} serviceList
* @ngInject
*/
constructor(serviceList) {
/** @export {!backendApi.ServiceList} */
......
......@@ -49,6 +49,7 @@ export default function stateConfig($stateProvider) {
/**
* @param {!angular.$resource} $resource
* @return {!angular.Resource<!backendApi.ServiceList>}
* @ngInject
*/
export function getServiceListResource($resource) {
return $resource('api/v1/services');
......@@ -57,6 +58,7 @@ export function getServiceListResource($resource) {
/**
* @param {!angular.Resource<!backendApi.ServiceList>} serviceListResource
* @return {!angular.$q.Promise}
* @ngInject
*/
export function resolveServiceList(serviceListResource) {
return serviceListResource.get().$promise;
......
......@@ -14,9 +14,11 @@ See the License for the specific language governing permissions and
limitations under the License.
-->
<kd-content-card ng-if=$ctrl.workloads.deploymentList.deployments>
<kd-content-card ng-if=$ctrl.workloads.deploymentList.deployments.length>
<kd-title>
Deployments
<a ui-sref="deployments">
Deployments
</a>
</kd-title>
<kd-content>
<kd-deployment-card-list deployments="$ctrl.workloads.deploymentList.deployments">
......@@ -24,9 +26,11 @@ limitations under the License.
</kd-content>
</kd-content-card>
<kd-content-card>
<kd-content-card ng-if="$ctrl.workloads.replicaSetList.replicaSets.length">
<kd-title>
Replica Sets
<a ui-sref="replicasets">
Replica Sets
</a>
</kd-title>
<kd-content>
<kd-replica-set-card-list replica-sets="$ctrl.workloads.replicaSetList.replicaSets">
......@@ -34,20 +38,24 @@ limitations under the License.
</kd-content>
</kd-content-card>
<kd-content-card>
<kd-content-card ng-if="$ctrl.workloads.replicationControllerList.replicationControllers.length">
<kd-title>
Replication Controllers
<a ui-sref="replicationcontrollers">
Replication Controllers
</a>
</kd-title>
<kd-content>
<kd-replication-controller-card-list
replication-controllers="$ctrl.workloads.replicationControllerList.replicationControllers">
replication-controllers="$ctrl.workloads.replicationControllerList.replicationControllers">
</kd-replication-controller-card-list>
</kd-content>
</kd-content-card>
<kd-content-card>
<kd-content-card ng-if="$ctrl.workloads.podList.pods.length">
<kd-title>
Pods
<a ui-sref="pods">
Pods
</a>
</kd-title>
<kd-content>
<kd-pod-card-list pod-list="$ctrl.workloads.podList">
......
......@@ -12,12 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import stateConfig from './workloads_stateconfig';
import filtersModule from 'common/filters/filters_module';
import componentsModule from 'common/components/components_module';
import deploymentListModule from 'deploymentlist/deploymentlist_module';
import filtersModule from 'common/filters/filters_module';
import replicationControllerListModule from 'replicationcontrollerlist/replicationcontrollerlist_module';
import replicaSetListModule from 'replicasetlist/replicasetlist_module';
import deploymentListModule from 'deploymentlist/deploymentlist_module';
import stateConfig from './workloads_stateconfig';
/**
* Module with a view that displays resources categorized as workloads, e.g., Replica Sets or
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册