Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
'use strict';
var conf = require('conf');
require('app')
.constant('apiURLS', {
JOBS: conf.apiURL + '/api/v1/jobs/',
REMOTECIS: conf.apiURL + '/api/v1/remotecis/',
JOBSTATES: conf.apiURL + '/api/v1/jobstates/',
FILES: conf.apiURL + '/api/v1/files/'
})
.factory('api', ['_', '$q', '$http', 'apiURLS', function(_, $q, $http, urls) {
function getJobs(page) {
var offset = 20 * (page - 1);
var config = {'params': {
'limit': 20, 'offset': offset,
'embed': 'remoteci,jobdefinition,jobdefinition.test'
}};
return $http.get(urls.JOBS, config).then(_.property('data'));
}
function getJobStates(job) {
var url = urls.JOBS + job + '/jobstates';
return $http.get(url).then(_.property('data.jobstates'));
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
'use strict';
var conf = require('conf');
require('app')
.constant('apiURLS', {
JOBS: conf.apiURL + '/api/v1/jobs/',
REMOTECIS: conf.apiURL + '/api/v1/remotecis/',
JOBSTATES: conf.apiURL + '/api/v1/jobstates/',
FILES: conf.apiURL + '/api/v1/files/'
})
.factory('api', ['_', '$q', '$http', 'apiURLS', function(_, $q, $http, urls) {
function getJobs(page) {
var offset = 20 * (page - 1);
var config = {'params': {
'limit': 20, 'offset': offset,
'embed': 'remoteci,jobdefinition,jobdefinition.test'
}};
return $http.get(urls.JOBS, config).then(_.property('data'));
}
function getJobStates(job) {