11 angular.module('yardStickGui2App')
12 .factory('mainFactory', ['$resource','$rootScope','$http', '$location', 'toaster',function($resource, $rootScope ,$http ,$location, toaster) {
14 Base_URL = 'http://' + $location.host() + ':' + $location.port();
15 Grafana_URL = 'http://' + $location.host();
19 postEnvironmentVariable: function() {
20 return $resource(Base_URL + '/api/v2/yardstick/openrcs', {}, {
26 uploadOpenrc: function() {
27 return $resource(Base_URL + '/ap/v2/yardstick/openrcs', {}, {
33 getEnvironmentList: function() {
34 return $resource(Base_URL+ '/api/v2/yardstick/environments', {}, {
40 getEnvironmentDetail: function() {
41 return $resource(Base_URL + '/api/v2/yardstick/openrcs/:openrc_id', { openrc_id: "@openrc_id" }, {
47 addEnvName: function() {
48 return $resource(Base_URL + '/api/v2/yardstick/environments', {}, {
54 ItemDetail: function() {
55 return $resource(Base_URL + '/api/v2/yardstick/environments/:envId', { envId: "@envId" }, {
61 SUTDetail: function() {
62 return $resource(Base_URL + '/api/v2/yardstick/environments/:envId/sut', { envId: "@envId" }, {
68 ImageDetail: function() {
69 return $resource(Base_URL + '/api/v2/yardstick/images/:image_id', { image_id: "@image_id" }, {
75 podDeatil: function() {
76 return $resource(Base_URL + '/api/v2/yardstick/pods/:podId', { podId: "@podId" }, {
82 containerDetail: function() {
83 return $resource(Base_URL + '/api/v2/yardstick/containers/:containerId', { containerId: "@containerId" }, {
89 ImageList: function() {
90 return $resource(Base_URL + '/api/v2/yardstick/images', {}, {
97 return $resource(Base_URL + '/api/v2/yardstick/images/:imageId', {imageId: "@imageId"}, {
103 deleteImage: function() {
104 return $resource(Base_URL + '/api/v2/yardstick/images/:imageId', { imageId: '@imageId' }, {
110 uploadImage: function() {
111 return $resource(Base_URL + '/api/v2/yardstick/images', {}, {
117 uploadImageByUrl: function() {
118 return $resource(Base_URL + '/api/v2/yardstick/images', {}, {
124 getPodDetail: function() {
125 return $resource(Base_URL + '/api/v2/yardstick/pods/:podId', { podId: "@podId" }, {
131 runAcontainer: function() {
132 return $resource(Base_URL + '/api/v2/yardstick/containers', { podId: "@podId" }, {
138 getTestcaselist: function() {
139 return $resource(Base_URL + '/api/v2/yardstick/testcases', {}, {
145 getTestcaseDetail: function() {
146 return $resource(Base_URL + '/api/v2/yardstick/testcases/:testcasename', { testcasename: "@testcasename" }, {
152 suiteList: function() {
153 return $resource(Base_URL + '/api/v2/yardstick/testsuites', {}, {
159 suiteDetail: function() {
160 return $resource(Base_URL + '/api/v2/yardstick/testsuites/:suiteName', { suiteName: "@suiteName" }, {
166 suiteCreate: function() {
167 return $resource(Base_URL + '/api/v2/yardstick/testsuites', {}, {
173 projectList: function() {
174 return $resource(Base_URL + '/api/v2/yardstick/projects', {}, {
180 createProjectName: function() {
181 return $resource(Base_URL + '/api/v2/yardstick/projects', {}, {
187 getProjectDetail: function() {
188 return $resource(Base_URL + '/api/v2/yardstick/projects/:project_id', { project_id: "@project_id" }, {
194 createTask: function() {
195 return $resource(Base_URL + '/api/v2/yardstick/tasks', {}, {
201 getTaskDetail: function() {
202 return $resource(Base_URL + '/api/v2/yardstick/tasks/:taskId', { taskId: "@taskId" }, {
209 getTaskLog: function(){
210 return $resource(Base_URL + '/api/v2/yardstick/tasks/:taskId/log?index=:index', { taskId: "@taskId", index: "@index" }, {
217 taskAddEnv: function() {
218 return $resource(Base_URL + '/api/v2/yardstick/tasks/:taskId', { taskId: "@taskId" }, {
225 taskAddParams: function() {
226 return $resource(Base_URL + '/api/v2/yardstick/tasks/:taskId', { taskId: "@taskId" }, {
233 deleteEnv: function() {
234 return $resource(Base_URL + '/api/v2/yardstick/environments/:env_id', { env_id: '@env_id' }, {
240 deleteOpenrc: function() {
241 return $resource(Base_URL + '/api/v2/yardstick/openrcs/:openrc', { openrc: '@openrc' }, {
247 deletePod: function() {
248 return $resource(Base_URL + '/api/v2/yardstick/pods/:podId', { podId: '@podId' }, {
254 deleteContainer: function() {
255 return $resource(Base_URL + '/api/v2/yardstick/containers/:containerId', { containerId: '@containerId' }, {
261 deleteTestCase: function() {
262 return $resource(Base_URL + '/api/v2/yardstick/testcases/:caseName', { caseName: '@caseName' }, {
268 deleteTestSuite: function() {
269 return $resource(Base_URL + '/api/v2/yardstick/testsuites/:suite_name', { suite_name: '@suite_name' }, {
275 deleteProject: function() {
276 return $resource(Base_URL + '/api/v2/yardstick/projects/:project_id', { project_id: '@project_id' }, {
282 deleteTask: function() {
283 return $resource(Base_URL + '/api/v2/yardstick/tasks/:task_id', { task_id: '@task_id' }, {
289 errorHandler1: function(response){
293 'body': response.result,
294 'showCloseButton': true
297 errorHandler2: function(response){
300 'title': response.status,
301 'body': response.statusText,
302 'showCloseButton': true