提交 d19f8028 编写于 作者: P Piotr Bryk

Singularize api endpoints and urls (#763)

Applies to: #719
上级 76ea2396
......@@ -89,220 +89,150 @@ func CreateHttpApiHandler(client *client.Client, heapsterClient HeapsterClient,
apiHandler := ApiHandler{client, heapsterClient, clientConfig, verber}
wsContainer := restful.NewContainer()
deployWs := new(restful.WebService)
deployWs.Filter(wsLogger)
deployWs.Path("/api/v1/appdeployments").
apiV1Ws := new(restful.WebService)
apiV1Ws.Filter(wsLogger)
apiV1Ws.Path("/api/v1").
Consumes(restful.MIME_JSON).
Produces(restful.MIME_JSON)
deployWs.Route(
deployWs.POST("").
wsContainer.Add(apiV1Ws)
apiV1Ws.Route(
apiV1Ws.POST("/appdeployment").
To(apiHandler.handleDeploy).
Reads(AppDeploymentSpec{}).
Writes(AppDeploymentSpec{}))
deployWs.Route(
deployWs.POST("/validate/name").
apiV1Ws.Route(
apiV1Ws.POST("/appdeployment/validate/name").
To(apiHandler.handleNameValidity).
Reads(AppNameValiditySpec{}).
Writes(AppNameValidity{}))
deployWs.Route(
deployWs.POST("/validate/imagereference").
apiV1Ws.Route(
apiV1Ws.POST("/appdeployment/validate/imagereference").
To(apiHandler.handleImageReferenceValidity).
Reads(ImageReferenceValiditySpec{}).
Writes(ImageReferenceValidity{}))
deployWs.Route(
deployWs.POST("/validate/protocol").
apiV1Ws.Route(
apiV1Ws.POST("/appdeployment/validate/protocol").
To(apiHandler.handleProtocolValidity).
Reads(ProtocolValiditySpec{}).
Writes(ProtocolValidity{}))
deployWs.Route(
deployWs.GET("/protocols").
apiV1Ws.Route(
apiV1Ws.GET("/appdeployment/protocols").
To(apiHandler.handleGetAvailableProcotols).
Writes(Protocols{}))
wsContainer.Add(deployWs)
deployFromFileWs := new(restful.WebService)
deployFromFileWs.Path("/api/v1/appdeploymentfromfile").
Consumes(restful.MIME_JSON).
Produces(restful.MIME_JSON)
deployFromFileWs.Route(
deployFromFileWs.POST("").
apiV1Ws.Route(
apiV1Ws.POST("/appdeploymentfromfile").
To(apiHandler.handleDeployFromFile).
Reads(AppDeploymentFromFileSpec{}).
Writes(AppDeploymentFromFileResponse{}))
wsContainer.Add(deployFromFileWs)
replicationControllerWs := new(restful.WebService)
replicationControllerWs.Filter(wsLogger)
replicationControllerWs.Path("/api/v1/replicationcontrollers").
Consumes(restful.MIME_JSON).
Produces(restful.MIME_JSON)
replicationControllerWs.Route(
replicationControllerWs.GET("").
apiV1Ws.Route(
apiV1Ws.GET("/replicationcontroller").
To(apiHandler.handleGetReplicationControllerList).
Writes(ReplicationControllerList{}))
replicationControllerWs.Route(
replicationControllerWs.GET("/{namespace}/{replicationController}").
apiV1Ws.Route(
apiV1Ws.GET("/replicationcontroller/{namespace}/{replicationController}").
To(apiHandler.handleGetReplicationControllerDetail).
Writes(ReplicationControllerDetail{}))
replicationControllerWs.Route(
replicationControllerWs.POST("/{namespace}/{replicationController}/update/pods").
apiV1Ws.Route(
apiV1Ws.POST("/replicationcontroller/{namespace}/{replicationController}/update/pod").
To(apiHandler.handleUpdateReplicasCount).
Reads(ReplicationControllerSpec{}))
replicationControllerWs.Route(
replicationControllerWs.DELETE("/{namespace}/{replicationController}").
apiV1Ws.Route(
apiV1Ws.DELETE("/replicationcontroller/{namespace}/{replicationController}").
To(apiHandler.handleDeleteReplicationController))
replicationControllerWs.Route(
replicationControllerWs.GET("/pods/{namespace}/{replicationController}").
apiV1Ws.Route(
apiV1Ws.GET("/replicationcontroller/pod/{namespace}/{replicationController}").
To(apiHandler.handleGetReplicationControllerPods).
Writes(ReplicationControllerPods{}))
wsContainer.Add(replicationControllerWs)
workloadsWs := new(restful.WebService)
workloadsWs.Filter(wsLogger)
workloadsWs.Path("/api/v1/workloads").
Consumes(restful.MIME_JSON).
Produces(restful.MIME_JSON)
workloadsWs.Route(
workloadsWs.GET("").
apiV1Ws.Route(
apiV1Ws.GET("/workload").
To(apiHandler.handleGetWorkloads).
Writes(workload.Workloads{}))
wsContainer.Add(workloadsWs)
replicaSetsWs := new(restful.WebService)
replicaSetsWs.Filter(wsLogger)
replicaSetsWs.Path("/api/v1/replicasets").
Consumes(restful.MIME_JSON).
Produces(restful.MIME_JSON)
replicaSetsWs.Route(
replicaSetsWs.GET("").
apiV1Ws.Route(
apiV1Ws.GET("/replicaset").
To(apiHandler.handleGetReplicaSets).
Writes(replicaset.ReplicaSetList{}))
replicaSetsWs.Route(
replicaSetsWs.GET("/{namespace}/{replicaSet}").
apiV1Ws.Route(
apiV1Ws.GET("/replicaset/{namespace}/{replicaSet}").
To(apiHandler.handleGetReplicaSetDetail).
Writes(replicaset.ReplicaSetDetail{}))
wsContainer.Add(replicaSetsWs)
podsWs := new(restful.WebService)
podsWs.Filter(wsLogger)
podsWs.Path("/api/v1/pods").
Consumes(restful.MIME_JSON).
Produces(restful.MIME_JSON)
podsWs.Route(
podsWs.GET("").
apiV1Ws.Route(
apiV1Ws.GET("/pod").
To(apiHandler.handleGetPods).
Writes(pod.PodList{}))
podsWs.Route(
podsWs.GET("/{namespace}/{pod}").
apiV1Ws.Route(
apiV1Ws.GET("/pod/{namespace}/{pod}").
To(apiHandler.handleGetPodDetail).
Writes(pod.PodDetail{}))
wsContainer.Add(podsWs)
deploymentsWs := new(restful.WebService)
deploymentsWs.Filter(wsLogger)
deploymentsWs.Path("/api/v1/deployments").
Consumes(restful.MIME_JSON).
Produces(restful.MIME_JSON)
deploymentsWs.Route(
deploymentsWs.GET("").
apiV1Ws.Route(
apiV1Ws.GET("/deployment").
To(apiHandler.handleGetDeployments).
Writes(deployment.DeploymentList{}))
wsContainer.Add(deploymentsWs)
daemonSetWs := new(restful.WebService)
daemonSetWs.Filter(wsLogger)
daemonSetWs.Path("/api/v1/daemonsets").
Consumes(restful.MIME_JSON).
Produces(restful.MIME_JSON)
daemonSetWs.Route(
daemonSetWs.GET("").
apiV1Ws.Route(
apiV1Ws.GET("/daemonset").
To(apiHandler.handleGetDaemonSetList).
Writes(daemonset.DaemonSetList{}))
daemonSetWs.Route(
daemonSetWs.GET("/{namespace}/{daemonSet}").
apiV1Ws.Route(
apiV1Ws.GET("/daemonset/{namespace}/{daemonSet}").
To(apiHandler.handleGetDaemonSetDetail).
Writes(daemonset.DaemonSetDetail{}))
daemonSetWs.Route(
daemonSetWs.DELETE("/{namespace}/{daemonSet}").
apiV1Ws.Route(
apiV1Ws.DELETE("/daemonset/{namespace}/{daemonSet}").
To(apiHandler.handleDeleteDaemonSet))
wsContainer.Add(daemonSetWs)
namespacesWs := new(restful.WebService)
namespacesWs.Filter(wsLogger)
namespacesWs.Path("/api/v1/namespaces").
Consumes(restful.MIME_JSON).
Produces(restful.MIME_JSON)
namespacesWs.Route(
namespacesWs.POST("").
apiV1Ws.Route(
apiV1Ws.POST("/namespace").
To(apiHandler.handleCreateNamespace).
Reads(NamespaceSpec{}).
Writes(NamespaceSpec{}))
namespacesWs.Route(
namespacesWs.GET("").
apiV1Ws.Route(
apiV1Ws.GET("/namespace").
To(apiHandler.handleGetNamespaces).
Writes(NamespaceList{}))
wsContainer.Add(namespacesWs)
logsWs := new(restful.WebService)
logsWs.Filter(wsLogger)
logsWs.Path("/api/v1/logs").
Produces(restful.MIME_JSON)
logsWs.Route(
logsWs.GET("/{namespace}/{podId}").
apiV1Ws.Route(
apiV1Ws.GET("/log/{namespace}/{podId}").
To(apiHandler.handleLogs).
Writes(Logs{}))
logsWs.Route(
logsWs.GET("/{namespace}/{podId}/{container}").
apiV1Ws.Route(
apiV1Ws.GET("/log/{namespace}/{podId}/{container}").
To(apiHandler.handleLogs).
Writes(Logs{}))
wsContainer.Add(logsWs)
eventsWs := new(restful.WebService)
eventsWs.Filter(wsLogger)
eventsWs.Path("/api/v1/events").
Produces(restful.MIME_JSON)
eventsWs.Route(
eventsWs.GET("/{namespace}/{replicationController}").
apiV1Ws.Route(
apiV1Ws.GET("/event/{namespace}/{replicationController}").
To(apiHandler.handleEvents).
Writes(common.EventList{}))
wsContainer.Add(eventsWs)
secretsWs := new(restful.WebService)
secretsWs.Path("/api/v1/secrets").Produces(restful.MIME_JSON)
secretsWs.Route(
secretsWs.GET("/{namespace}").
apiV1Ws.Route(
apiV1Ws.GET("/secret/{namespace}").
To(apiHandler.handleGetSecrets).
Writes(SecretsList{}))
secretsWs.Route(
secretsWs.POST("").
apiV1Ws.Route(
apiV1Ws.POST("/secret").
To(apiHandler.handleCreateImagePullSecret).
Reads(ImagePullSecretSpec{}).
Writes(Secret{}))
wsContainer.Add(secretsWs)
servicesWs := new(restful.WebService)
servicesWs.Filter(wsLogger)
servicesWs.Path("/api/v1/services").
Consumes(restful.MIME_JSON).
Produces(restful.MIME_JSON)
servicesWs.Route(
servicesWs.GET("").
apiV1Ws.Route(
apiV1Ws.GET("/service").
To(apiHandler.handleGetServiceList).
Writes(resourceService.ServiceList{}))
servicesWs.Route(
servicesWs.GET("/{namespace}/{service}").
apiV1Ws.Route(
apiV1Ws.GET("/service/{namespace}/{service}").
To(apiHandler.handleGetServiceDetail).
Writes(resourceService.ServiceDetail{}))
wsContainer.Add(servicesWs)
resourceVerberWs := new(restful.WebService)
resourceVerberWs.Filter(wsLogger)
resourceVerberWs.Path("/api/v1").
Consumes(restful.MIME_JSON).
Produces(restful.MIME_JSON)
resourceVerberWs.Route(
resourceVerberWs.DELETE("/{kind}/namespace/{namespace}/name/{name}").
apiV1Ws.Route(
apiV1Ws.DELETE("/{kind}/namespace/{namespace}/name/{name}").
To(apiHandler.handleDeleteResource))
wsContainer.Add(resourceVerberWs)
return wsContainer
}
......
......@@ -16,7 +16,7 @@ limitations under the License.
<md-toolbar class="kd-toolbar">
<div class="md-toolbar-tools kd-toolbar-tools">
<a ui-sref="workloads" ui-sref-opts="{ reload: true }" tabindex="-1">
<a ui-sref="workload" 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>
......
......@@ -92,7 +92,7 @@ export default class NamespaceDialogController {
let namespaceSpec = {name: this.namespace};
/** @type {!angular.Resource<!backendApi.NamespaceSpec>} */
let resource = this.resource_('api/v1/namespaces');
let resource = this.resource_('api/v1/namespace');
resource.save(
namespaceSpec,
......
......@@ -102,7 +102,7 @@ export default class CreateSecretController {
data: this.data,
};
/** @type {!angular.Resource<!backendApi.SecretSpec>} */
let resource = this.resource_(`api/v1/secrets/`);
let resource = this.resource_(`api/v1/secret/`);
resource.save(
secretSpec,
......
......@@ -42,7 +42,7 @@ export default function stateConfig($stateProvider) {
*/
function resolveNamespaces($resource) {
/** @type {!angular.Resource<!backendApi.NamespaceList>} */
let resource = $resource('api/v1/namespaces');
let resource = $resource('api/v1/namespace');
return resource.get().$promise;
}
......@@ -53,7 +53,7 @@ function resolveNamespaces($resource) {
* @ngInject
*/
function getProtocolsResource($resource) {
return $resource('api/v1/appdeployments/protocols');
return $resource('api/v1/appdeployment/protocols');
}
/**
......
......@@ -214,7 +214,7 @@ export default class DeployFromSettingsController {
let defer = this.q_.defer();
/** @type {!angular.Resource<!backendApi.AppDeploymentSpec>} */
let resource = this.resource_('api/v1/appdeployments');
let resource = this.resource_('api/v1/appdeployment');
resource.save(
appDeploymentSpec,
(savedConfig) => {
......@@ -288,7 +288,7 @@ export default class DeployFromSettingsController {
*/
getSecrets(namespace) {
/** @type {!angular.Resource<!backendApi.SecretsList>} */
let resource = this.resource_(`api/v1/secrets/${namespace}`);
let resource = this.resource_(`api/v1/secret/${namespace}`);
resource.get(
(res) => { this.secrets = res.secrets; },
(err) => { this.log_.log(`Error getting secrets: ${err}`); });
......
......@@ -53,7 +53,7 @@ function validate(name, namespace, resource, q) {
let deferred = q.defer();
/** @type {!angular.Resource<!backendApi.AppNameValiditySpec>} */
let resourceClass = resource('api/v1/appdeployments/validate/name');
let resourceClass = resource('api/v1/appdeployment/validate/name');
/** @type {!backendApi.AppNameValiditySpec} */
let spec = {name: name, namespace: namespace};
resourceClass.save(
......
......@@ -51,7 +51,7 @@ function validate(reference, scope, resource, q) {
let deferred = q.defer();
/** @type {!angular.Resource<!backendApi.ImageReferenceValiditySpec>} */
let resourceClass = resource('api/v1/appdeployments/validate/imagereference');
let resourceClass = resource('api/v1/appdeployment/validate/imagereference');
/** @type {!backendApi.ImageReferenceValiditySpec} */
let spec = {reference: reference};
......
......@@ -68,7 +68,7 @@ function validate(ngModelController, externalChanged, protocol, isExternal, reso
}
/** @type {!angular.Resource<!backendApi.ProtocolValiditySpec>} */
let resourceClass = resource('api/v1/appdeployments/validate/protocol');
let resourceClass = resource('api/v1/appdeployment/validate/protocol');
/** @type {!backendApi.ProtocolValiditySpec} */
let spec = {protocol: protocol, isExternal: isExternal};
resourceClass.save(
......
......@@ -22,6 +22,6 @@ import {stateName} from './deploymentdetail_state';
*/
export default function stateConfig($stateProvider) {
$stateProvider.state(stateName, {
url: '/deployments/:namespace/:deployment',
url: '/deployment/:namespace/:deployment',
});
}
......@@ -13,7 +13,7 @@
// limitations under the License.
/** Name of the state. Can be used in, e.g., $state.go method. */
export const stateName = 'deployments';
export const stateName = 'deployment';
/** Absolute URL of the state. */
export const stateUrl = '/deployments';
export const stateUrl = '/deployment';
......@@ -59,6 +59,6 @@ export default function stateConfig($stateProvider) {
*/
export function resolveDeployments($resource) {
/** @type {!angular.Resource<!backendApi.DeploymentList>} */
let resource = $resource('api/v1/deployments');
let resource = $resource('api/v1/deployment');
return resource.get().$promise;
}
......@@ -13,7 +13,7 @@
// limitations under the License.
/** Name of the state. Can be used in, e.g., $state.go method. */
export const stateName = 'logs';
export const stateName = 'log';
/**
* Parameters for this state.
......
......@@ -38,7 +38,7 @@ export default function stateConfig($stateProvider) {
};
$stateProvider.state(stateName, {
url: '/logs/:namespace/:replicationController/:podId/:container?',
url: '/log/:namespace/:replicationController/:podId/:container?',
resolve: {
'replicationControllerPods': resolveReplicationControllerPods,
'podLogs': resolvePodLogs,
......@@ -56,7 +56,7 @@ export default function stateConfig($stateProvider) {
function resolveReplicationControllerPods($stateParams, $resource) {
/** @type {!angular.Resource<!backendApi.ReplicationControllerPods>} */
let resource = $resource(
`api/v1/replicationcontrollers/pods/${$stateParams.namespace}/${$stateParams.replicationController}`);
`api/v1/replicationcontroller/pod/${$stateParams.namespace}/${$stateParams.replicationController}`);
return resource.get().$promise;
}
......@@ -69,7 +69,7 @@ function resolveReplicationControllerPods($stateParams, $resource) {
*/
function resolvePodLogs($stateParams, $resource) {
/** @type {!angular.Resource<!backendApi.Logs>} */
let resource = $resource(`api/v1/logs/${$stateParams.namespace}/${$stateParams.podId}/${$stateParams.container}`);
let resource = $resource(`api/v1/log/${$stateParams.namespace}/${$stateParams.podId}/${$stateParams.container}`);
return resource.get().$promise;
}
......@@ -55,7 +55,7 @@ export default function stateConfig($stateProvider) {
* @ngInject
*/
export function getPodDetailResource($resource, $stateParams) {
return $resource(`api/v1/pods/${$stateParams.namespace}/${$stateParams.pod}`);
return $resource(`api/v1/pod/${$stateParams.namespace}/${$stateParams.pod}`);
}
/**
......
......@@ -13,7 +13,7 @@
// limitations under the License.
/** Name of the state. Can be used in, e.g., $state.go method. */
export const stateName = 'pods';
export const stateName = 'pod';
/** Absolute URL of the state. */
export const stateUrl = '/pods';
export const stateUrl = '/pod';
......@@ -59,6 +59,6 @@ export default function stateConfig($stateProvider) {
*/
export function resolvePodList($resource) {
/** @type {!angular.Resource<!backendApi.PodList>} */
let resource = $resource('api/v1/pods');
let resource = $resource('api/v1/pod');
return resource.get().$promise;
}
......@@ -55,7 +55,7 @@ export default function stateConfig($stateProvider) {
* @ngInject
*/
export function getReplicaSetDetailResource($resource, $stateParams) {
return $resource(`api/v1/replicasets/${$stateParams.namespace}/${$stateParams.replicaSet}`);
return $resource(`api/v1/replicaset/${$stateParams.namespace}/${$stateParams.replicaSet}`);
}
/**
......
......@@ -13,7 +13,7 @@
// limitations under the License.
/** Name of the state. Can be used in, e.g., $state.go method. */
export const stateName = 'replicasets';
export const stateName = 'replicaset';
/** Absolute URL of the state. */
export const stateUrl = '/replicasets';
export const stateUrl = '/replicaset';
......@@ -59,6 +59,6 @@ export default function stateConfig($stateProvider) {
*/
export function resolveReplicaSets($resource) {
/** @type {!angular.Resource<!backendApi.ReplicaSetList>} */
let resource = $resource('api/v1/replicasets');
let resource = $resource('api/v1/replicaset');
return resource.get().$promise;
}
......@@ -27,7 +27,7 @@ import ReplicationControllerDetailController from './replicationcontrollerdetail
*/
export default function stateConfig($stateProvider) {
$stateProvider.state(stateName, {
url: '/replicationcontrollers/:namespace/:replicationController',
url: '/replicationcontroller/:namespace/:replicationController',
resolve: {
'replicationControllerSpecPodsResource': getReplicationControllerSpecPodsResource,
'replicationControllerDetailResource': getReplicationControllerDetailsResource,
......@@ -63,7 +63,7 @@ export default function stateConfig($stateProvider) {
*/
export function getReplicationControllerDetailsResource($stateParams, $resource) {
return $resource(
`api/v1/replicationcontrollers/${$stateParams.namespace}/` +
`api/v1/replicationcontroller/${$stateParams.namespace}/` +
`${$stateParams.replicationController}`);
}
......@@ -75,8 +75,8 @@ export function getReplicationControllerDetailsResource($stateParams, $resource)
*/
export function getReplicationControllerSpecPodsResource($stateParams, $resource) {
return $resource(
`api/v1/replicationcontrollers/${$stateParams.namespace}/` +
`${$stateParams.replicationController}/update/pods`);
`api/v1/replicationcontroller/${$stateParams.namespace}/` +
`${$stateParams.replicationController}/update/pod`);
}
/**
......@@ -98,7 +98,7 @@ function resolveReplicationControllerDetails(replicationControllerDetailResource
function resolveReplicationControllerEvents($stateParams, $resource) {
/** @type {!angular.Resource<!backendApi.Events>} */
let resource =
$resource(`api/v1/events/${$stateParams.namespace}/${$stateParams.replicationController}`);
$resource(`api/v1/event/${$stateParams.namespace}/${$stateParams.replicationController}`);
return resource.get().$promise;
}
......@@ -78,7 +78,7 @@ export class PodLogsMenuController {
getReplicationControllerPods_() {
/** @type {!angular.Resource<!backendApi.ReplicationControllerPods>} */
let resource = this.resource_(
`api/v1/replicationcontrollers/pods/${this.namespace}/` +
`api/v1/replicationcontroller/pod/${this.namespace}/` +
`${this.replicationControllerName}?limit=10`);
resource.get(
......
......@@ -13,7 +13,7 @@
// limitations under the License.
/** Name of the state. Can be used in, e.g., $state.go method. */
export const stateName = 'replicationcontrollers';
export const stateName = 'replicationcontroller';
/** Absolute URL of the state. */
export const stateUrl = '/replicationcontrollers';
export const stateUrl = '/replicationcontroller';
......@@ -59,6 +59,6 @@ export default function stateConfig($stateProvider) {
*/
export function resolveReplicationControllers($resource) {
/** @type {!angular.Resource<!backendApi.ReplicationControllerList>} */
let resource = $resource('api/v1/replicationcontrollers');
let resource = $resource('api/v1/replicationcontroller');
return resource.get().$promise;
}
......@@ -55,7 +55,7 @@ export default function stateConfig($stateProvider) {
* @ngInject
*/
export function getServiceDetailResource($stateParams, $resource) {
return $resource(`api/v1/services/${$stateParams.namespace}/${$stateParams.service}`);
return $resource(`api/v1/service/${$stateParams.namespace}/${$stateParams.service}`);
}
/**
......
......@@ -13,7 +13,7 @@
// limitations under the License.
/** Name of the state. Can be used in, e.g., $state.go method. */
export const stateName = 'services';
export const stateName = 'service';
/** Absolute URL of the state. */
export const stateUrl = '/services';
export const stateUrl = '/service';
......@@ -52,7 +52,7 @@ export default function stateConfig($stateProvider) {
* @ngInject
*/
export function getServiceListResource($resource) {
return $resource('api/v1/services');
return $resource('api/v1/service');
}
/**
......
......@@ -16,7 +16,7 @@ limitations under the License.
<kd-content-card ng-if=$ctrl.workloads.deploymentList.deployments.length>
<kd-title>
<a ui-sref="deployments">
<a ui-sref="deployment">
Deployments
</a>
</kd-title>
......@@ -28,7 +28,7 @@ limitations under the License.
<kd-content-card ng-if="$ctrl.workloads.replicaSetList.replicaSets.length">
<kd-title>
<a ui-sref="replicasets">
<a ui-sref="replicaset">
Replica Sets
</a>
</kd-title>
......@@ -40,7 +40,7 @@ limitations under the License.
<kd-content-card ng-if="$ctrl.workloads.replicationControllerList.replicationControllers.length">
<kd-title>
<a ui-sref="replicationcontrollers">
<a ui-sref="replicationcontroller">
Replication Controllers
</a>
</kd-title>
......@@ -53,7 +53,7 @@ limitations under the License.
<kd-content-card ng-if="$ctrl.workloads.podList.pods.length">
<kd-title>
<a ui-sref="pods">
<a ui-sref="pod">
Pods
</a>
</kd-title>
......
......@@ -13,7 +13,7 @@
// limitations under the License.
/** Name of the state. Can be used in, e.g., $state.go method. */
export const stateName = 'workloads';
export const stateName = 'workload';
/** Absolute URL of the state. */
export const stateUrl = '/workloads';
export const stateUrl = '/workload';
......@@ -55,6 +55,6 @@ export default function stateConfig($stateProvider) {
*/
export function resolveWorkloads($resource) {
/** @type {!angular.Resource<!backendApi.Workloads>} */
let resource = $resource('api/v1/workloads');
let resource = $resource('api/v1/workload');
return resource.get().$promise;
}
......@@ -106,7 +106,7 @@ describe('Create-Namespace dialog', () => {
/** @type {string} */
let errorMessage = 'Something bad happened';
// return an erranous response
httpBackend.expectPOST('api/v1/namespaces').respond(500, errorMessage);
httpBackend.expectPOST('api/v1/namespace').respond(500, errorMessage);
// when
ctrl.createNamespace();
httpBackend.flush();
......
......@@ -103,7 +103,7 @@ describe('Create-Secret dialog', () => {
`MzTjNiM0prTVRJSyIsICJlbWFpbCI6` + `ICJqZG9lQGV4YW1wbGUuY29tIiB9IH0K`;
httpBackend
.expect(
'POST', 'api/v1/secrets',
'POST', 'api/v1/secret',
{name: ctrl.secretName, namespace: ctrl.namespace, data: ctrl.data})
.respond(201, 'success');
// when trying to submit
......@@ -121,7 +121,7 @@ describe('Create-Secret dialog', () => {
/** @type {string} */
let errorMessage = 'Something bad happened';
// return an erranous response
httpBackend.expectPOST('api/v1/secrets').respond(500, errorMessage);
httpBackend.expectPOST('api/v1/secret').respond(500, errorMessage);
// when
ctrl.createSecret();
httpBackend.flush();
......
......@@ -306,7 +306,7 @@ describe('DeployFromSettings controller', () => {
let response = {
secrets: ['secret1', 'secret2', 'secret3'],
};
httpBackend.expectGET('api/v1/secrets/default').respond(200, response);
httpBackend.expectGET('api/v1/secret/default').respond(200, response);
// when
ctrl.getSecrets('default');
httpBackend.flush();
......
......@@ -35,7 +35,7 @@ describe('Unique name directive', () => {
it('should validate name asynchronosuly', () => {
scope.name = 'foo-name';
scope.namespace = 'foo-namespace';
let endpoint = httpBackend.when('POST', 'api/v1/appdeployments/validate/name');
let endpoint = httpBackend.when('POST', 'api/v1/appdeployment/validate/name');
let elem = compileFn(scope)[0];
expect(elem.classList).toContain('ng-valid');
......@@ -67,7 +67,7 @@ describe('Unique name directive', () => {
scope.namespace = 'foo-namespace';
let elem = compileFn(scope)[0];
httpBackend.when('POST', 'api/v1/appdeployments/validate/name').respond({
httpBackend.when('POST', 'api/v1/appdeployment/validate/name').respond({
valid: false,
});
httpBackend.flush();
......@@ -83,7 +83,7 @@ describe('Unique name directive', () => {
scope.namespace = 'foo-namespace';
let elem = compileFn(scope)[0];
httpBackend.when('POST', 'api/v1/appdeployments/validate/name').respond(503, '');
httpBackend.when('POST', 'api/v1/appdeployment/validate/name').respond(503, '');
httpBackend.flush();
expect(elem.classList).not.toContain('ng-pending');
expect(elem.classList).toContain('ng-valid');
......
......@@ -35,7 +35,7 @@ describe('Valid ImageReference directive', () => {
it('should validate image reference', () => {
scope.containerImage = 'Test';
let endpoint = httpBackend.when('POST', 'api/v1/appdeployments/validate/imagereference');
let endpoint = httpBackend.when('POST', 'api/v1/appdeployment/validate/imagereference');
let elem = compileFn(scope)[0];
expect(elem.classList).toContain('ng-valid');
......@@ -69,7 +69,7 @@ describe('Valid ImageReference directive', () => {
scope.containerImage = 'test';
let elem = compileFn(scope)[0];
httpBackend.when('POST', 'api/v1/appdeployments/validate/imagereference')
httpBackend.when('POST', 'api/v1/appdeployment/validate/imagereference')
.respond(503, 'Service Unavailable');
httpBackend.flush();
expect(elem.classList).not.toContain('ng-pending');
......
......@@ -34,7 +34,7 @@ describe('Valid protocol directive', () => {
});
it('should validate protocol asynchronosuly', () => {
let endpoint = httpBackend.whenPOST('api/v1/appdeployments/validate/protocol');
let endpoint = httpBackend.whenPOST('api/v1/appdeployment/validate/protocol');
let elem = compileFn(scope)[0];
expect(elem.classList).toContain('ng-valid');
......@@ -66,7 +66,7 @@ describe('Valid protocol directive', () => {
it('should validate on service type change', () => {
let elem = compileFn(scope)[0];
httpBackend.whenPOST('api/v1/appdeployments/validate/protocol').respond({
httpBackend.whenPOST('api/v1/appdeployment/validate/protocol').respond({
valid: false,
});
scope.$apply();
......@@ -82,7 +82,7 @@ describe('Valid protocol directive', () => {
it('should treat failures as invalid protocol', () => {
let elem = compileFn(scope)[0];
httpBackend.whenPOST('api/v1/appdeployments/validate/protocol').respond(503, '');
httpBackend.whenPOST('api/v1/appdeployment/validate/protocol').respond(503, '');
scope.$apply();
scope.isExternal = false;
......
......@@ -37,7 +37,7 @@ describe('Deployment card', () => {
};
// then
expect(ctrl.getDeploymentDetailHref()).toEqual('#/deployments/foo-namespace/foo-name');
expect(ctrl.getDeploymentDetailHref()).toEqual('#/deployment/foo-namespace/foo-name');
});
it('should return true when at least one replication controller pod has warning', () => {
......
......@@ -26,7 +26,7 @@ describe('StateConfig for replication controller list', () => {
let actual = resolveDeployments(resource);
expect(resource).toHaveBeenCalledWith('api/v1/deployments');
expect(resource).toHaveBeenCalledWith('api/v1/deployment');
expect(actual).toBe(promise);
}));
});
......@@ -50,6 +50,6 @@ describe('Pod card list controller', () => {
name: 'foo-pod',
namespace: 'foo-namespace',
},
})).toBe('#/pods/foo-namespace/foo-pod');
})).toBe('#/pod/foo-namespace/foo-pod');
});
});
......@@ -26,7 +26,7 @@ describe('StateConfig for pod list', () => {
let actual = resolvePodList(resource);
expect(resource).toHaveBeenCalledWith('api/v1/pods');
expect(resource).toHaveBeenCalledWith('api/v1/pod');
expect(actual).toBe(promise);
}));
});
......@@ -37,7 +37,7 @@ describe('Replica Set card', () => {
};
// then
expect(ctrl.getReplicaSetDetailHref()).toEqual('#/replicasets/foo-namespace/foo-name');
expect(ctrl.getReplicaSetDetailHref()).toEqual('#/replicaset/foo-namespace/foo-name');
});
it('should return true when at least one replication controller pod has warning', () => {
......
......@@ -26,7 +26,7 @@ describe('StateConfig for replication controller list', () => {
let actual = resolveReplicaSets(resource);
expect(resource).toHaveBeenCalledWith('api/v1/replicasets');
expect(resource).toHaveBeenCalledWith('api/v1/replicaset');
expect(actual).toBe(promise);
}));
});
......@@ -63,6 +63,6 @@ describe('Replication Controller Detail controller', () => {
objectMeta: {
name: 'foo-pod',
},
})).toBe('#/logs/foo-namespace/foo-replicationcontroller/foo-pod/');
})).toBe('#/log/foo-namespace/foo-replicationcontroller/foo-pod/');
});
});
......@@ -66,7 +66,7 @@ describe('Update Replicas controller', () => {
};
spyOn(log, 'info');
spyOn(state, 'reload');
httpBackend.whenPOST('api/v1/replicationcontrollers/foo-namespace/foo-name/update/pods')
httpBackend.whenPOST('api/v1/replicationcontroller/foo-namespace/foo-name/update/pod')
.respond(200, replicaSpec);
// when
......@@ -82,7 +82,7 @@ describe('Update Replicas controller', () => {
it('should log error on failed update', () => {
// given
spyOn(log, 'error');
httpBackend.whenPOST('api/v1/replicationcontrollers/foo-namespace/foo-name/update/pods')
httpBackend.whenPOST('api/v1/replicationcontroller/foo-namespace/foo-name/update/pod')
.respond(404);
// when
......
......@@ -75,8 +75,9 @@ describe('Pod logs menu controller', () => {
ctrl.openMenu(mdOpenMenu);
let pods = {};
$httpBackend.whenGET('api/v1/replicationcontrollers/pods/undefined/undefined?limit=10')
.respond({pods: pods});
$httpBackend.whenGET('api/v1/replicationcontroller/pod/undefined/undefined?limit=10').respond({
pods: pods,
});
$rootScope.$digest();
expect(ctrl.replicationControllerPodsList).toEqual(undefined);
......@@ -91,7 +92,7 @@ describe('Pod logs menu controller', () => {
spyOn($log, 'error').and.callThrough();
let err = {};
$httpBackend.whenGET('api/v1/replicationcontrollers/pods/undefined/undefined?limit=10')
$httpBackend.whenGET('api/v1/replicationcontroller/pod/undefined/undefined?limit=10')
.respond(500, err);
$httpBackend.flush();
expect($log.error).toHaveBeenCalled();
......
......@@ -38,7 +38,7 @@ describe('Replication controller card', () => {
// then
expect(ctrl.getReplicationControllerDetailHref())
.toEqual('#/replicationcontrollers/foo-namespace/foo-name');
.toEqual('#/replicationcontroller/foo-namespace/foo-name');
});
it('should return true when at least one replication controller pod has warning', () => {
......
......@@ -26,7 +26,7 @@ describe('StateConfig for replication controller list', () => {
let actual = resolveReplicationControllers(resource);
expect(resource).toHaveBeenCalledWith('api/v1/replicationcontrollers');
expect(resource).toHaveBeenCalledWith('api/v1/replicationcontroller');
expect(actual).toBe(promise);
}));
});
......@@ -35,6 +35,6 @@ describe('Service list controller', () => {
name: 'foo-service',
namespace: 'foo-namespace',
},
})).toBe('#/services/foo-namespace/foo-service');
})).toBe('#/service/foo-namespace/foo-service');
});
});
......@@ -26,7 +26,7 @@ describe('StateConfig for replication controller list', () => {
let actual = resolveWorkloads(resource);
expect(resource).toHaveBeenCalledWith('api/v1/workloads');
expect(resource).toHaveBeenCalledWith('api/v1/workload');
expect(actual).toBe(promise);
}));
});
......@@ -31,7 +31,7 @@ export default class ReplicationControllerDetailPageObject {
this.eventsTableQuery = by.xpath('//kd-event-card-list');
this.eventsTable = element(this.eventsTableQuery);
this.podLogsLinkQuery = by.xpath(`//a[contains(@href, 'logs')]`);
this.podLogsLinkQuery = by.xpath(`//a[contains(@href, 'log')]`);
this.podLogsLink = element(this.podLogsLinkQuery);
}
}
......@@ -32,7 +32,7 @@ export default class ReplicationControllersPageObject {
*/
getElementByAppName(xpathString, appName, isArray) {
let elemQuery = by.xpath(
`//*[@href='#/replicationcontrollers/default/${appName}']/ancestor::kd-resource-card//${xpathString}`);
`//*[@href='#/replicationcontroller/default/${appName}']/ancestor::kd-resource-card//${xpathString}`);
if (isArray) {
return element.all(elemQuery);
}
......
......@@ -66,7 +66,7 @@ xdescribe('Deploy and delete replication controller user story test', () => {
it('should deploy replication controller', () => {
deployPage.deployButton.click().then(() => {
expect(browser.getCurrentUrl()).toContain('replicationcontrollers');
expect(browser.getCurrentUrl()).toContain('replicationcontroller');
expect(element(by.xpath(applicationCardXPath))).not.toBeNull();
});
});
......
......@@ -55,7 +55,7 @@ describe('Deploy from valid file user story test', () => {
deployFromFilePage.deployButton.click();
// then
expect(browser.getCurrentUrl()).toContain('replicationcontrollers');
expect(browser.getCurrentUrl()).toContain('replicationcontroller');
let cardNameLink = replicationControllersPage.getElementByAppName(
replicationControllersPage.cardDetailsPageLinkQuery, appName);
......@@ -66,7 +66,7 @@ describe('Deploy from valid file user story test', () => {
// clean up
let cardMenuButton = replicationControllersPage.getElementByAppName(
replicationControllersPage.cardMenuButtonQuery, appName);
browser.get('#/replicationcontrollers');
browser.get('#/replicationcontroller');
cardMenuButton.click();
replicationControllersPage.deleteAppButton.click().then(
() => { deleteDialog.deleteAppButton.click(); });
......
......@@ -64,7 +64,7 @@ describe('Deploy not existing image story', () => {
// when
deployPage.deployButton.click().then(() => {
// then
expect(browser.getCurrentUrl()).toContain('replicationcontrollers');
expect(browser.getCurrentUrl()).toContain('replicationcontroller');
doneFn();
});
});
......@@ -102,7 +102,7 @@ describe('Deploy not existing image story', () => {
cardDetailsPageLink.click();
// then
expect(browser.getCurrentUrl()).toContain(`replicationcontrollers/default/${appName}`);
expect(browser.getCurrentUrl()).toContain(`replicationcontroller/default/${appName}`);
});
it('should switch to events tab and check for errors', () => {
......@@ -130,7 +130,7 @@ describe('Deploy not existing image story', () => {
browser.getAllWindowHandles().then((handles) => {
let logsWindowHandle = handles[1];
browser.switchTo().window(logsWindowHandle).then(() => {
expect(browser.getCurrentUrl()).toContain(`logs/default/${appName}`);
expect(browser.getCurrentUrl()).toContain(`log/default/${appName}`);
});
});
});
......@@ -141,7 +141,7 @@ describe('Deploy not existing image story', () => {
let cardMenuButton = replicationControllersPage.getElementByAppName(
replicationControllersPage.cardMenuButtonQuery, appName);
browser.get('#/replicationcontrollers');
browser.get('#/replicationcontroller');
cardMenuButton.click();
replicationControllersPage.deleteAppButton.click().then(() => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册