<commit_before>
/** The model for a Request */
function RequestModel(data) {	
	var self = this;	
	if (data) {		
		/** The id of this request */
		self.requestId = data.requestId;
		
		/** The name of this request */
		self.requestName = data.requestName;
		
		/** The status of this request */
		self.requestStatus = data.requestStatus;
		
		/** The date that this request was updated */
		self.requestUpdated = data.requestUpdated;
		
		self.requestUpdatedText = ko.computed( function() {
			return parseDate(self.requestUpdated);
		});
		
		/** The name of the device this request belongs to */
		self.requestDeviceName = data.requestDevice.deviceName;		
	}
	
}


/** The view model for displaying a list of all requests
 * 
 */
function PFRequestListViewModel() {

	var self = this;
	
	/** The list of requests to show */
	self.Requests = ko.observableArray([]);
	
	/** Fetches the requests from the server */
	self.fetchRequests = function() {
		$.getJSON("http://" + host + "/aft-servlet/manager/request/all", function(data) {	
			//remove the old requests, and add the new requests
			self.Requests.removeAll();			
			$.each(data, function(index, value) {
				self.Requests.push(new RequestModel(value));
			});			
		}).fail( function(jqXHR, textStatus, error) {
			alert("Error fethcing requests! " + textStatus + " : " + error);
		});		
	};
	
	
	//fetch the requests
	self.fetchRequests();
	
	/** Views the specified request
	 * 
	 * @param request The request to view, if null, uses calling context
	 */
	self.viewRequest = function(request) {	
		if (!request) {
			request = this;
		}
		//remove any observables
		request = ko.toJS(request);
		
		//navigate to the view page
		window.location.href = "/aft-web/createRequest.html?requestId=" + request.requestId;
		
	};
	
}<commit_msg>Updated the modify request link<commit_after>
/** The model for a Request */
function RequestModel(data) {	
	var self = this;	
	if (data) {		
		/** The id of this request */
		self.requestId = data.requestId;
		
		/** The name of this request */
		self.requestName = data.requestName;
		
		/** The status of this request */
		self.requestStatus = data.requestStatus;
		
		/** The date that this request was updated */
		self.requestUpdated = data.requestUpdated;
		
		self.requestUpdatedText = ko.computed( function() {
			return parseDate(self.requestUpdated);
		});
		
		/** The name of the device this request belongs to */
		self.requestDeviceName = data.requestDevice.deviceName;		
	}
	
}


/** The view model for displaying a list of all requests
 * 
 */
function PFRequestListViewModel() {

	var self = this;
	
	/** The list of requests to show */
	self.Requests = ko.observableArray([]);
	
	/** Fetches the requests from the server */
	self.fetchRequests = function() {
		$.getJSON("http://" + host + "/aft-servlet/manager/request/all", function(data) {	
			//remove the old requests, and add the new requests
			self.Requests.removeAll();			
			$.each(data, function(index, value) {
				self.Requests.push(new RequestModel(value));
			});			
		}).fail( function(jqXHR, textStatus, error) {
			alert("Error fethcing requests! " + textStatus + " : " + error);
		});		
	};
	
	
	//fetch the requests
	self.fetchRequests();
	
	/** Views the specified request
	 * 
	 * @param request The request to view, if null, uses calling context
	 */
	self.viewRequest = function(request) {	
		if (!request) {
			request = this;
		}
		//remove any observables
		request = ko.toJS(request);
		
		//navigate to the view page
		window.location.href = "./createRequest.html?requestId=" + request.requestId;
		
	};
	
}
{'fraction_non_alphanumeric': 0.1325368157821617, 'fraction_numerical': 0.0, 'mean_word_length': 3.1189931350114417, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5561142', 'n_tokens_mistral': 1237, 'n_tokens_neox': 1067, 'n_words': 316}