From dbb8c649de4f73c1e10543c1f55490c4efae7cd8 Mon Sep 17 00:00:00 2001
From: Joe Fiorini
Date: Wed, 17 Jun 2015 15:58:39 -0400
Subject: [PATCH] [system_tracking] Refactor angular modules
---
.../main.js} | 6 +-
.../js/system-tracking/data-services/main.js | 11 +++
.../fact-data-table.partial.html | 38 -----------
.../fact-data-error.block.less | 0
.../fact-data-group.block.less | 0
.../fact-data-table-heading.block.less | 0
.../fact-data-table.block.less | 0
.../fact-data-table.directive.js | 16 +++++
.../fact-data-table.partial.html | 62 +++++++++++++++++
.../fact-datum.block.less | 0
.../system-tracking/fact-data-table/main.js | 5 ++
awx/ui/static/js/system-tracking/main.js | 17 ++---
.../system-tracking/string-or-date.filter.js | 19 ------
.../system-tracking.controller.js | 2 +-
.../system-tracking.partial.html | 68 ++-----------------
15 files changed, 111 insertions(+), 133 deletions(-)
rename awx/ui/static/js/system-tracking/{compare-facts.js => compare-facts/main.js} (91%)
create mode 100644 awx/ui/static/js/system-tracking/data-services/main.js
delete mode 100644 awx/ui/static/js/system-tracking/fact-data-table.partial.html
rename awx/ui/static/js/system-tracking/{ => fact-data-table}/fact-data-error.block.less (100%)
rename awx/ui/static/js/system-tracking/{ => fact-data-table}/fact-data-group.block.less (100%)
rename awx/ui/static/js/system-tracking/{ => fact-data-table}/fact-data-table-heading.block.less (100%)
rename awx/ui/static/js/system-tracking/{ => fact-data-table}/fact-data-table.block.less (100%)
create mode 100644 awx/ui/static/js/system-tracking/fact-data-table/fact-data-table.directive.js
create mode 100644 awx/ui/static/js/system-tracking/fact-data-table/fact-data-table.partial.html
rename awx/ui/static/js/system-tracking/{ => fact-data-table}/fact-datum.block.less (100%)
create mode 100644 awx/ui/static/js/system-tracking/fact-data-table/main.js
delete mode 100644 awx/ui/static/js/system-tracking/string-or-date.filter.js
diff --git a/awx/ui/static/js/system-tracking/compare-facts.js b/awx/ui/static/js/system-tracking/compare-facts/main.js
similarity index 91%
rename from awx/ui/static/js/system-tracking/compare-facts.js
rename to awx/ui/static/js/system-tracking/compare-facts/main.js
index b8e466f00a..e7927df005 100644
--- a/awx/ui/static/js/system-tracking/compare-facts.js
+++ b/awx/ui/static/js/system-tracking/compare-facts/main.js
@@ -4,9 +4,9 @@
* All Rights Reserved
*************************************************/
-import compareNestedFacts from './compare-facts/nested';
-import compareFlatFacts from './compare-facts/flat';
-import FactTemplate from './compare-facts/fact-template';
+import compareNestedFacts from './nested';
+import compareFlatFacts from './flat';
+import FactTemplate from './fact-template';
export function compareFacts(module, facts) {
diff --git a/awx/ui/static/js/system-tracking/data-services/main.js b/awx/ui/static/js/system-tracking/data-services/main.js
new file mode 100644
index 0000000000..cf72087b27
--- /dev/null
+++ b/awx/ui/static/js/system-tracking/data-services/main.js
@@ -0,0 +1,11 @@
+import factScanDataService from './fact-scan-data.service';
+import getDataForComparison from './get-data-for-comparison.factory';
+import getModuleOptions from './get-module-options.factory';
+import resolveEmptyVersions from './resolve-empty-versions.factory';
+
+export default
+ angular.module('systemTracking.dataServices', [])
+ .factory('getModuleOptions', getModuleOptions)
+ .factory('getDataForComparison', getDataForComparison)
+ .factory('resolveEmptyVersions', resolveEmptyVersions)
+ .service('factScanDataService', factScanDataService);
diff --git a/awx/ui/static/js/system-tracking/fact-data-table.partial.html b/awx/ui/static/js/system-tracking/fact-data-table.partial.html
deleted file mode 100644
index 22e17b1d4b..0000000000
--- a/awx/ui/static/js/system-tracking/fact-data-table.partial.html
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
- |
- {{comparisonLeftHeader|stringOrDate:'L'}} |
- {{comparisonRightHeader|stringOrDate:'L'}} |
-
-
-
-
-
- {{group.displayKeyPath}}
- |
-
- {{group.displayKeyPath}}
- |
-
- {{group.displayKeyPath}}
- |
-
- {{group.displayKeyPath}}
- |
-
-
- | {{fact.keyName}} |
-
-
- {{fact.value1}}
-
- |
-
-
- {{fact.value2}}
-
- |
-
-
-
diff --git a/awx/ui/static/js/system-tracking/fact-data-error.block.less b/awx/ui/static/js/system-tracking/fact-data-table/fact-data-error.block.less
similarity index 100%
rename from awx/ui/static/js/system-tracking/fact-data-error.block.less
rename to awx/ui/static/js/system-tracking/fact-data-table/fact-data-error.block.less
diff --git a/awx/ui/static/js/system-tracking/fact-data-group.block.less b/awx/ui/static/js/system-tracking/fact-data-table/fact-data-group.block.less
similarity index 100%
rename from awx/ui/static/js/system-tracking/fact-data-group.block.less
rename to awx/ui/static/js/system-tracking/fact-data-table/fact-data-group.block.less
diff --git a/awx/ui/static/js/system-tracking/fact-data-table-heading.block.less b/awx/ui/static/js/system-tracking/fact-data-table/fact-data-table-heading.block.less
similarity index 100%
rename from awx/ui/static/js/system-tracking/fact-data-table-heading.block.less
rename to awx/ui/static/js/system-tracking/fact-data-table/fact-data-table-heading.block.less
diff --git a/awx/ui/static/js/system-tracking/fact-data-table.block.less b/awx/ui/static/js/system-tracking/fact-data-table/fact-data-table.block.less
similarity index 100%
rename from awx/ui/static/js/system-tracking/fact-data-table.block.less
rename to awx/ui/static/js/system-tracking/fact-data-table/fact-data-table.block.less
diff --git a/awx/ui/static/js/system-tracking/fact-data-table/fact-data-table.directive.js b/awx/ui/static/js/system-tracking/fact-data-table/fact-data-table.directive.js
new file mode 100644
index 0000000000..8bac06f3ae
--- /dev/null
+++ b/awx/ui/static/js/system-tracking/fact-data-table/fact-data-table.directive.js
@@ -0,0 +1,16 @@
+/* jshint unused: vars */
+
+export default
+ [ function() {
+ return { restrict: 'E',
+ templateUrl: '/static/js/system-tracking/fact-data-table/fact-data-table.partial.html',
+ scope:
+ { leftHostname: '=',
+ rightHostname: '=',
+ leftScanDate: '=',
+ rightScanDate: '=',
+ factData: '='
+ }
+ };
+ }
+ ];
diff --git a/awx/ui/static/js/system-tracking/fact-data-table/fact-data-table.partial.html b/awx/ui/static/js/system-tracking/fact-data-table/fact-data-table.partial.html
new file mode 100644
index 0000000000..ca466cba45
--- /dev/null
+++ b/awx/ui/static/js/system-tracking/fact-data-table/fact-data-table.partial.html
@@ -0,0 +1,62 @@
+
+
+
+
+ Comparing facts collected from:
+
+
+
+ {{leftHostname}}
+ {{leftScanDate|longDate}}
+
+
+ {{rightHostname}}
+ {{rightScanDate|longDate}}
+
+
+
+
+ {{group.facts.keyName}}
+ {{group.facts.value1}}
+ {{group.facts.value2}}
+
+
+
+
+
+
+
+
+ {{group.displayKeyPath}}
+
+
+
+
+
+
+ {{fact.keyName}}
+
+
+ {{fact.value1}}
+
+
+ {{fact.value2}}
+
+
+
+
+
+ {{fact.keyName}}
+
+
+ {{fact.value1}}
+
+
+ {{fact.value2}}
+
+
+
+
+
+
+
diff --git a/awx/ui/static/js/system-tracking/fact-datum.block.less b/awx/ui/static/js/system-tracking/fact-data-table/fact-datum.block.less
similarity index 100%
rename from awx/ui/static/js/system-tracking/fact-datum.block.less
rename to awx/ui/static/js/system-tracking/fact-data-table/fact-datum.block.less
diff --git a/awx/ui/static/js/system-tracking/fact-data-table/main.js b/awx/ui/static/js/system-tracking/fact-data-table/main.js
new file mode 100644
index 0000000000..d77cd22fee
--- /dev/null
+++ b/awx/ui/static/js/system-tracking/fact-data-table/main.js
@@ -0,0 +1,5 @@
+import factDataTable from './fact-data-table.directive';
+
+export default
+ angular.module('systemTracking.factDataTable', [])
+ .directive('factDataTable', factDataTable);
diff --git a/awx/ui/static/js/system-tracking/main.js b/awx/ui/static/js/system-tracking/main.js
index 956b80be8d..9800ee677d 100644
--- a/awx/ui/static/js/system-tracking/main.js
+++ b/awx/ui/static/js/system-tracking/main.js
@@ -5,27 +5,22 @@
*************************************************/
import route from './system-tracking.route';
-import factScanDataService from './data-services/fact-scan-data.service';
-import getDataForComparison from './data-services/get-data-for-comparison.factory';
-import getModuleOptions from './data-services/get-module-options.factory';
-import resolveEmptyVersions from './data-services/resolve-empty-versions.factory';
import controller from './system-tracking.controller';
-import stringOrDateFilter from './string-or-date.filter';
import shared from 'tower/shared/main';
import utilities from 'tower/shared/Utilities';
+
import datePicker from './date-picker/main';
+import dataServices from './data-services/main';
+import factDataTable from './fact-data-table/main';
export default
angular.module('systemTracking',
[ utilities.name,
shared.name,
- datePicker.name
+ datePicker.name,
+ factDataTable.name,
+ dataServices.name
])
- .service('factScanDataService', factScanDataService)
- .factory('getDataForComparison', getDataForComparison)
- .factory('getModuleOptions', getModuleOptions)
- .factory('resolveEmptyVersions', resolveEmptyVersions)
- .filter('stringOrDate', stringOrDateFilter)
.controller('systemTracking', controller)
.config(['$routeProvider', function($routeProvider) {
var url = route.route;
diff --git a/awx/ui/static/js/system-tracking/string-or-date.filter.js b/awx/ui/static/js/system-tracking/string-or-date.filter.js
deleted file mode 100644
index 4e3f7d387e..0000000000
--- a/awx/ui/static/js/system-tracking/string-or-date.filter.js
+++ /dev/null
@@ -1,19 +0,0 @@
-/*************************************************
- * Copyright (c) 2015 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-export default
- [ 'amDateFormatFilter',
- 'moment',
- function(dateFormat, moment) {
- return function(string, format) {
- if (moment.isMoment(string)) {
- return dateFormat(string, format);
- } else {
- return string;
- }
- };
- }
- ];
diff --git a/awx/ui/static/js/system-tracking/system-tracking.controller.js b/awx/ui/static/js/system-tracking/system-tracking.controller.js
index 9536148a17..108c4feffd 100644
--- a/awx/ui/static/js/system-tracking/system-tracking.controller.js
+++ b/awx/ui/static/js/system-tracking/system-tracking.controller.js
@@ -5,7 +5,7 @@
*************************************************/
import {searchDateRange} from './search-date-range';
-import {compareFacts} from './compare-facts';
+import {compareFacts} from './compare-facts/main';
function controller($rootScope,
$scope,
diff --git a/awx/ui/static/js/system-tracking/system-tracking.partial.html b/awx/ui/static/js/system-tracking/system-tracking.partial.html
index fa4c45c4ca..6f1c020119 100644
--- a/awx/ui/static/js/system-tracking/system-tracking.partial.html
+++ b/awx/ui/static/js/system-tracking/system-tracking.partial.html
@@ -40,65 +40,11 @@
To setup or run scan jobs, edit the "{{inventory.name}}" inventory and select "Scan Jobs Templates".
-
-
-
-
- Comparing facts collected from:
-
-
-
- {{leftHostname}}
- {{leftScanDate|longDate}}
-
-
- {{rightHostname}}
- {{rightScanDate|longDate}}
-
-
-
-
- {{group.facts.keyName}}
- {{group.facts.value1}}
- {{group.facts.value2}}
-
-
-
-
-
-
-
-
- {{group.displayKeyPath}}
-
-
-
-
-
-
- {{fact.keyName}}
-
-
- {{fact.value1}}
-
-
- {{fact.value2}}
-
-
-
-
-
- {{fact.keyName}}
-
-
- {{fact.value1}}
-
-
- {{fact.value2}}
-
-
-
-
-
-
+
+