summaryrefslogtreecommitdiffstats
path: root/ecomp-portal-FE/client/app/views/search
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-portal-FE/client/app/views/search')
-rw-r--r--ecomp-portal-FE/client/app/views/search/search.controller.js184
-rw-r--r--ecomp-portal-FE/client/app/views/search/search.controller.spec.js19
-rw-r--r--ecomp-portal-FE/client/app/views/search/search.less55
-rw-r--r--ecomp-portal-FE/client/app/views/search/search.tpl.html82
4 files changed, 340 insertions, 0 deletions
diff --git a/ecomp-portal-FE/client/app/views/search/search.controller.js b/ecomp-portal-FE/client/app/views/search/search.controller.js
new file mode 100644
index 00000000..60e27593
--- /dev/null
+++ b/ecomp-portal-FE/client/app/views/search/search.controller.js
@@ -0,0 +1,184 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * 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';
+(function () {
+
+ class SearchCtrl {
+ constructor($log, $scope, $cookies, $timeout, userProfileService, sessionService, dashboardService) {
+ $scope.firstName="";
+ $scope.lastName="";
+
+ function showHideSearchSnippet() {
+
+ setTimeout(function() {
+ jQuery("#mainSearchSnippet").click();
+ },500);
+
+ setTimeout(function() {
+ jQuery("#mainSearchText").focus();
+ },1000);
+ }
+
+ jQuery("#mainSearchDiv").keyup(function(event){
+ if(event.keyCode == 13){
+ // there is a watch on this variable which will trigger the database pull
+ dashboardService.searchString = jQuery("#mainSearchText").val();
+
+ // opens the popup
+ var popupDomObj = jQuery("[content='searchSnippet.html']");
+ if(popupDomObj.length == 0) {
+ showHideSearchSnippet();
+ } else {
+ jQuery("#mainSearchSnippet").click();
+ showHideSearchSnippet();
+ }
+
+
+
+ }
+ });
+
+
+
+ }
+
+
+ }
+
+
+ class SearchSnippetCtrl {
+ constructor($log, $scope, $cookies, $timeout, userProfileService, sessionService, dashboardService,applicationsService, $window, $state) {
+ $scope.firstName="";
+ $scope.lastName="";
+ $scope.goToUrl = goToUrl;
+ $scope.dService = dashboardService;
+
+
+
+ function goToUrl (item, type) {
+ $log.info("goToUrl called")
+ $log.info(item + "/" + type);
+
+
+ if(type == 'intra') {
+
+ var intraSearcLink = "http://to_do_link.com";
+ var intraSpecSearcLink = intraSearcLink + encodeURIComponent(dashboardService.searchString);
+ $window.open(intraSpecSearcLink, '_blank');
+
+ } else if (type == 'extra') {
+ var extraSearcLink = "https://to_do_link.com";
+ var extraSpecSearcLink = extraSearcLink + encodeURIComponent(dashboardService.searchString);
+ $window.open(extraSpecSearcLink, '_blank');
+ }
+
+ let url = item.target;
+ let restrictedApp = item.uuid;
+ let getAccessState = "root.getAccess"
+ if (!url) {
+
+ applicationsService.goGetAccessAppName = item.name;
+ if($state.current.name == getAccessState)
+ $state.reload();
+ else
+ $state.go(getAccessState);
+ //$log.info('No url found for this application, doing nothing..');
+ return;
+ }
+
+ if (restrictedApp != "true") {
+ $window.open(url, '_blank');
+ } else {
+ if(item.url=="root.access"){
+ $state.go(url);
+ var tabContent = { id: new Date(), title: 'Home', url: url };
+ $cookies.putObject('addTab', tabContent );
+ } else {
+ var tabContent = { id: new Date(), title: item.name, url: url };
+ $cookies.putObject('addTab', tabContent );
+ }
+ }
+
+ }
+
+ function getItems(searchString) {
+
+ var items;
+ var itemMap = dashboardService.getSearchAllByStringResults(searchString)
+ .then(res => {
+ $scope.items = res;
+
+
+ }).catch(err => {
+ $scope.items = [];
+ $log.error('Couldnt get search results...', err)
+ });
+
+ }
+
+ $scope.$watch('dService.searchString', function(searchString) {
+ if(searchString != undefined )
+ getItems(searchString);
+
+ });
+
+
+
+ }
+
+
+
+ }
+
+
+
+ SearchCtrl.$inject = ['$log', '$scope', '$cookies', '$timeout','userProfileService', 'sessionService', 'dashboardService'];
+ SearchSnippetCtrl.$inject = ['$log', '$scope', '$cookies', '$timeout','userProfileService', 'sessionService', 'dashboardService','applicationsService', '$window','$state'];
+ angular.module('ecompApp').controller('searchCtrl', SearchCtrl);
+ angular.module('ecompApp').controller('searchSnippetCtrl', SearchSnippetCtrl);
+ angular.module('ecompApp').directive('searchBox', function() {
+ return {
+ restrict: "E",
+ templateUrl: 'app/views/search/search.tpl.html',
+ link: function(scope, element) {
+
+ //var iframeId = "#tabframe-" + scope.$parent.tab.title.split(' ').join('-');
+ // jQuery(iframeId).load(function() {
+ // alert("hello");
+ // }); //.attr("src",'{{tab.content | trusted}}' ); //src='{{tab.content | trusted}}'
+ // jQuery(iframeId).attr('src', '{{tab.content | trusted}}');
+
+ //element.childNodes[0].on('load', function() {
+ // alert('hello');
+ //});
+ }
+ }
+ });
+ angular.module( 'ecompApp' ).config( [
+ '$compileProvider',
+ function( $compileProvider )
+ {
+ $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|chrome-extension|qto):/);
+ }
+ ]);
+
+})();
+
+
diff --git a/ecomp-portal-FE/client/app/views/search/search.controller.spec.js b/ecomp-portal-FE/client/app/views/search/search.controller.spec.js
new file mode 100644
index 00000000..34042c14
--- /dev/null
+++ b/ecomp-portal-FE/client/app/views/search/search.controller.spec.js
@@ -0,0 +1,19 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * 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.
+ * ================================================================================
+ */
diff --git a/ecomp-portal-FE/client/app/views/search/search.less b/ecomp-portal-FE/client/app/views/search/search.less
new file mode 100644
index 00000000..a21559ec
--- /dev/null
+++ b/ecomp-portal-FE/client/app/views/search/search.less
@@ -0,0 +1,55 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * 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.
+ * ================================================================================
+ */
+ .searchLiHeader {
+font-weight: bold;
+color: #0574ac;
+font-size: 16px;
+padding-bottom: 10px;
+line-height: 1.5;
+font-family: arial;
+
+}
+
+.searchLiItems{
+cursor: pointer;
+font-weight: normal;
+font-size: 12px;
+color: #444444;
+font-family: arial;
+}
+
+.searchUl {
+list-style: none;
+border-bottom: 1px solid #bbb;
+padding-bottom: 20px;
+}
+
+#contentVertical {
+ height: 300px;
+ width: 250px;
+ }
+
+#contentVertical .scroll-viewport {
+ height: 300px;
+ width: 250px;
+ }
+#mainSearchText::-ms-clear{
+ display:none;
+} \ No newline at end of file
diff --git a/ecomp-portal-FE/client/app/views/search/search.tpl.html b/ecomp-portal-FE/client/app/views/search/search.tpl.html
new file mode 100644
index 00000000..bd37f772
--- /dev/null
+++ b/ecomp-portal-FE/client/app/views/search/search.tpl.html
@@ -0,0 +1,82 @@
+<!--
+ ================================================================================
+ eCOMP Portal
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ 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.
+ ================================================================================
+ -->
+
+<div class="col-md-12 font-clearview">
+ <div class="form-field form-field__small" >
+ <input id="mainSearchText" type="text" placeholder="What are you looking for?" class="form-field form-field__small" style="height:30px;border-radius: 10px;border: 2px solid rgb(250,250,250);" />
+ <i class="ion-ios-search" id="search-icon" style="position:relative;line-height:10px;top:-30px;right:-250px">&nbsp;</i>
+
+ <div id="mainSearchSnippet" popover="searchSnippet.html"
+ aria-label="search Snippet" referby="searchSnippet" att-accessibility-click="13,32"
+ popover-style="" popover-trigger="click" popover-placement="below" >
+ </div>
+ </div>
+
+</div>
+
+
+
+
+<script type="text/ng-template" id="searchSnippet.html">
+ <div style="line-height: normal; right: 167px; min-height: 122px; height: auto; width: auto;" ng-controller="searchSnippetCtrl" >
+ <div id="reg-header-snippet">
+
+ <div tabindex="0" class="reg-profileDetails" id="reg-searchPop-id" >
+ <div id="contentVertical" att-scrollbar="y" class="ng-scope vertical" style="position: relative;">
+ <ul class="searchUl">
+ <li>
+ <a class="ion-android-apps"></a>
+ <a id="searchItem" ng-click="goToUrl(item)" class="searchLiHeader">Applications:</a>
+ </li>
+ <li ng-repeat='item in items.application'>
+ <a id="searchItem" ng-click="goToUrl(item)" class="searchLiItems">{{item.name}}</a>
+ </li>
+ </ul>
+
+ <ul class="searchUl">
+ <li>
+ <a class="ion-android-apps"></a>
+ <a id="searchItem" ng-click="goToUrl(item)" class="searchLiHeader">Functional Menus:</a>
+ </li>
+ <li ng-repeat='item in items.menu'>
+ <a id="searchItem" ng-click="goToUrl(item)" class="searchLiItems">{{item.name}}</a>
+ </li>
+ </ul>
+
+
+ <ul class="searchUl">
+ <li>
+ <a class="ion-ios-person-outline" style="font-size:16px;"></a>
+ <a id="searchItem" ng-click="goToUrl(item)" class="searchLiHeader">Users:</a>
+ </li>
+ <li ng-repeat='item in items.user'>
+ <a id="searchItem" ng-href="mailto:{{item.target}}" class="searchLiItems">{{item.name}}</a>
+
+ </li>
+ </ul>
+
+
+ </div>
+ </div>
+ </div>
+ </div>
+
+
+</script>