GUAC-932: Move history-related things into own module. Begin "types/" hierarchy convention for services providing constructors only.

This commit is contained in:
Michael Jumper
2014-11-30 15:26:52 -08:00
parent 331644ddd9
commit 10171ff1ba
5 changed files with 84 additions and 28 deletions

View File

@@ -23,4 +23,4 @@
/**
* The module for code used to connect to a connection or balancing group.
*/
angular.module('client', ['auth']);
angular.module('client', ['auth', 'history']);

View File

@@ -0,0 +1,26 @@
/*
* Copyright (C) 2014 Glyptodon LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/**
* The module for code relating to connection history.
*/
angular.module('history', []);

View File

@@ -21,9 +21,9 @@
*/
/**
* A service for creating Guacamole clients.
* A service for reading and manipulating the Guacamole connection history.
*/
angular.module('home').factory('guacHistory', [function guacHistory() {
angular.module('history').factory('guacHistory', ['HistoryEntry', function guacHistory(HistoryEntry) {
var service = {};
@@ -36,30 +36,6 @@ angular.module('home').factory('guacHistory', [function guacHistory() {
*/
var IDEAL_LENGTH = 6;
/**
* A single entry in the connection history.
*
* @constructor
* @param {String} id The ID of the connection.
*
* @param {String} thumbnail
* The URL of the thumbnail to use to represent the connection.
*/
var HistoryEntry = function HistoryEntry(id, thumbnail) {
/**
* The ID of the connection associated with this history entry.
*/
this.id = id;
/**
* The thumbnail associated with the connection associated with this
* history entry.
*/
this.thumbnail = thumbnail;
};
/**
* The top few recent connections, sorted in order of most recent access.
*

View File

@@ -0,0 +1,54 @@
/*
* Copyright (C) 2014 Glyptodon LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/**
* Provides the HistoryEntry class used by the guacHistory service.
*/
angular.module('history').factory('HistoryEntry', [function defineHistoryEntry() {
/**
* A single entry in the connection history.
*
* @constructor
* @param {String} id The ID of the connection.
*
* @param {String} thumbnail
* The URL of the thumbnail to use to represent the connection.
*/
var HistoryEntry = function HistoryEntry(id, thumbnail) {
/**
* The ID of the connection associated with this history entry.
*/
this.id = id;
/**
* The thumbnail associated with the connection associated with this
* history entry.
*/
this.thumbnail = thumbnail;
};
return HistoryEntry;
}]);

View File

@@ -20,4 +20,4 @@
* THE SOFTWARE.
*/
angular.module('home', ['connection', 'connectionGroup', 'user', 'permission']);
angular.module('home', ['connection', 'connectionGroup', 'history', 'user', 'permission']);