You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2017/12/07 07:59:18 UTC

ignite git commit: IGNITE-7133 Web Console: Implemented service for managing icons.

Repository: ignite
Updated Branches:
  refs/heads/master 9813c626b -> cab5cc562


IGNITE-7133 Web Console: Implemented service for managing icons.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/cab5cc56
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/cab5cc56
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/cab5cc56

Branch: refs/heads/master
Commit: cab5cc56245ae5035de18d373227ce8aa22955f9
Parents: 9813c62
Author: Ilya Borisov <kl...@gmail.com>
Authored: Thu Dec 7 14:59:12 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Thu Dec 7 14:59:12 2017 +0700

----------------------------------------------------------------------
 modules/web-console/frontend/app/app.js         |  4 ++-
 .../app/components/ignite-icon/directive.js     | 10 +++---
 .../app/components/ignite-icon/index.js         |  2 ++
 .../app/components/ignite-icon/service.js       | 32 ++++++++++++++++++++
 4 files changed, 41 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/cab5cc56/modules/web-console/frontend/app/app.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/app.js b/modules/web-console/frontend/app/app.js
index f367d3e..dde6aa9 100644
--- a/modules/web-console/frontend/app/app.js
+++ b/modules/web-console/frontend/app/app.js
@@ -136,6 +136,7 @@ import igniteServices from './services';
 import IgniteModules from 'IgniteModules/index';
 
 import baseTemplate from 'views/base.pug';
+import * as icons from '../public/images/icons';
 
 angular.module('ignite-console', [
     // Optional AngularJS modules.
@@ -323,4 +324,5 @@ angular.module('ignite-console', [
                 .catch(Messages.showError);
         };
     }
-]);
+])
+.run(['IgniteIcon', (IgniteIcon) => IgniteIcon.registerIcons(icons)]);

http://git-wip-us.apache.org/repos/asf/ignite/blob/cab5cc56/modules/web-console/frontend/app/components/ignite-icon/directive.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/ignite-icon/directive.js b/modules/web-console/frontend/app/components/ignite-icon/directive.js
index de087d8..4ce87a7 100644
--- a/modules/web-console/frontend/app/components/ignite-icon/directive.js
+++ b/modules/web-console/frontend/app/components/ignite-icon/directive.js
@@ -15,16 +15,14 @@
  * limitations under the License.
  */
 
-import * as icons from '../../../public/images/icons/index.js';
-
 export default function() {
     return {
         restrict: 'A',
         controller: class {
-            static $inject = ['$scope', '$attrs', '$sce', '$element', '$window'];
+            static $inject = ['$scope', '$attrs', '$sce', '$element', '$window', 'IgniteIcon'];
 
-            constructor($scope, $attrs, $sce, $element, $window) {
-                Object.assign(this, {$scope, $attrs, $sce, $element, $window});
+            constructor($scope, $attrs, $sce, $element, $window, IgniteIcon) {
+                Object.assign(this, {$scope, $attrs, $sce, $element, $window, IgniteIcon});
             }
 
             $onInit() {
@@ -43,7 +41,7 @@ export default function() {
 
             $postLink() {
                 this.name = this.$attrs.igniteIcon;
-                this.$element.attr('viewBox', icons[this.name].viewBox);
+                this.$element.attr('viewBox', this.IgniteIcon.getIcon(this.name).viewBox);
 
                 this.render(this.getFragmentURL());
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/cab5cc56/modules/web-console/frontend/app/components/ignite-icon/index.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/ignite-icon/index.js b/modules/web-console/frontend/app/components/ignite-icon/index.js
index e12b5b0..30954f1 100644
--- a/modules/web-console/frontend/app/components/ignite-icon/index.js
+++ b/modules/web-console/frontend/app/components/ignite-icon/index.js
@@ -18,8 +18,10 @@
 import angular from 'angular';
 
 import directive from './directive';
+import service from './service';
 import './style.scss';
 
 export default angular
     .module('ignite-console.ignite-icon', [])
+    .service('IgniteIcon', service)
     .directive('igniteIcon', directive);

http://git-wip-us.apache.org/repos/asf/ignite/blob/cab5cc56/modules/web-console/frontend/app/components/ignite-icon/service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/ignite-icon/service.js b/modules/web-console/frontend/app/components/ignite-icon/service.js
new file mode 100644
index 0000000..e142a2d
--- /dev/null
+++ b/modules/web-console/frontend/app/components/ignite-icon/service.js
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+export default class IgniteIcon {
+    _icons = {};
+
+    registerIcons(icons) {
+        return Object.assign(this._icons, icons);
+    }
+
+    getIcon(name) {
+        return this._icons[name];
+    }
+
+    getAllIcons() {
+        return this._icons;
+    }
+}