ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [37/69] [abbrv] ignite git commit: Web Console beta-3.
Date Tue, 13 Sep 2016 09:53:29 GMT
http://git-wip-us.apache.org/repos/asf/ignite/blob/6af6560a/modules/web-console/frontend/app/modules/loading/loading.css
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/loading/loading.css b/modules/web-console/frontend/app/modules/loading/loading.css
new file mode 100644
index 0000000..87bbc6a
--- /dev/null
+++ b/modules/web-console/frontend/app/modules/loading/loading.css
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ */
+
+[ignite-loading] {
+    position: relative;
+}
+
+.loading {
+    position: absolute;
+    bottom: 0;
+    left: 0;
+    right: 0;
+    top: 0;
+    z-index: 1001;
+    opacity: 0;
+    visibility: hidden;
+    background-color: white;
+    transition: visibility 0s 0.5s, opacity 0.5s linear;
+}
+
+.loading-active {
+    opacity: 1;
+    visibility: visible;
+    transition: opacity 0.5s linear;
+}
+
+.loading:before {
+    content: '';
+    display: inline-block;
+    height: 100%;
+    vertical-align: middle;
+}
+
+.loading .loading-wrapper {
+    display: inline-block;
+    vertical-align: middle;
+    position: relative;
+    width: 100%;
+}
+
+.loading.loading-top .loading-wrapper {
+    position: absolute;
+    top: 100px;
+    display: block;
+}
+
+.loading .loading-text {
+    font-size: 18px;
+    margin: 20px 0;
+    text-align: center;
+}
+
+.loading-opacity-80 {
+    opacity: 0.8;
+}
+
+.loading-max-foreground {
+    z-index: 99999;
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/6af6560a/modules/web-console/frontend/app/modules/loading/loading.directive.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/loading/loading.directive.js b/modules/web-console/frontend/app/modules/loading/loading.directive.js
new file mode 100644
index 0000000..064b4c2
--- /dev/null
+++ b/modules/web-console/frontend/app/modules/loading/loading.directive.js
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ */
+
+import templateUrl from './loading.jade';
+import './loading.css';
+
+export default ['igniteLoading', ['IgniteLoading', '$templateCache', '$compile', (Loading,
$templateCache, $compile) => {
+    const link = (scope, element) => {
+        const compiledTemplate = $compile($templateCache.get(templateUrl));
+
+        const build = () => {
+            scope.position = scope.position || 'middle';
+
+            const loading = compiledTemplate(scope);
+
+            if (!scope.loading) {
+                scope.loading = loading;
+
+                Loading.add(scope.key || 'defaultSpinnerKey', scope.loading);
+                element.append(scope.loading);
+            }
+        };
+
+        build();
+    };
+
+    return {
+        scope: {
+            key: '@igniteLoading',
+            text: '@?igniteLoadingText',
+            class: '@?igniteLoadingClass',
+            position: '@?igniteLoadingPosition'
+        },
+        restrict: 'A',
+        link
+    };
+}]];

http://git-wip-us.apache.org/repos/asf/ignite/blob/6af6560a/modules/web-console/frontend/app/modules/loading/loading.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/loading/loading.jade b/modules/web-console/frontend/app/modules/loading/loading.jade
new file mode 100644
index 0000000..cc6cf45
--- /dev/null
+++ b/modules/web-console/frontend/app/modules/loading/loading.jade
@@ -0,0 +1,23 @@
+//-
+    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.
+
+.loading.loading-opacity-80(ng-class='[class, "loading-" + position]')
+    .loading-wrapper
+        .spinner
+            .bounce1
+            .bounce2
+            .bounce3
+        .loading-text {{ text }}

http://git-wip-us.apache.org/repos/asf/ignite/blob/6af6560a/modules/web-console/frontend/app/modules/loading/loading.module.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/loading/loading.module.js b/modules/web-console/frontend/app/modules/loading/loading.module.js
new file mode 100644
index 0000000..889cd6b
--- /dev/null
+++ b/modules/web-console/frontend/app/modules/loading/loading.module.js
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+import angular from 'angular';
+
+import IgniteLoadingDirective from './loading.directive';
+import IgniteLoadingService from './loading.service';
+
+angular
+    .module('ignite-console.loading', [])
+    .directive(...IgniteLoadingDirective)
+    .service(...IgniteLoadingService);

http://git-wip-us.apache.org/repos/asf/ignite/blob/6af6560a/modules/web-console/frontend/app/modules/loading/loading.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/loading/loading.service.js b/modules/web-console/frontend/app/modules/loading/loading.service.js
new file mode 100644
index 0000000..ec31c1a
--- /dev/null
+++ b/modules/web-console/frontend/app/modules/loading/loading.service.js
@@ -0,0 +1,48 @@
+/*
+ * 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 ['IgniteLoading', ['$timeout', ($timeout) => {
+    const _overlays = {};
+
+    const start = (key) => {
+        $timeout(() => {
+            const loadingOverlay = _overlays[key];
+
+            loadingOverlay && loadingOverlay.addClass('loading-active');
+        });
+    };
+
+    const finish = (key) => {
+        $timeout(() => {
+            const loadingOverlay = _overlays[key];
+
+            loadingOverlay && loadingOverlay.removeClass('loading-active');
+        });
+    };
+
+    const add = (key, element) => {
+        _overlays[key] = element;
+
+        return element;
+    };
+
+    return {
+        add,
+        start,
+        finish
+    };
+}]];

http://git-wip-us.apache.org/repos/asf/ignite/blob/6af6560a/modules/web-console/frontend/app/modules/navbar/Navbar.provider.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/navbar/Navbar.provider.js b/modules/web-console/frontend/app/modules/navbar/Navbar.provider.js
new file mode 100644
index 0000000..f1ae1b2
--- /dev/null
+++ b/modules/web-console/frontend/app/modules/navbar/Navbar.provider.js
@@ -0,0 +1,28 @@
+/*
+ * 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 ['IgniteNavbar', [function() {
+    const items = [];
+
+    this.push = function(data) {
+        items.push(data);
+    };
+
+    this.$get = [function() {
+        return items;
+    }];
+}]];

http://git-wip-us.apache.org/repos/asf/ignite/blob/6af6560a/modules/web-console/frontend/app/modules/navbar/Userbar.provider.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/navbar/Userbar.provider.js b/modules/web-console/frontend/app/modules/navbar/Userbar.provider.js
new file mode 100644
index 0000000..9513641
--- /dev/null
+++ b/modules/web-console/frontend/app/modules/navbar/Userbar.provider.js
@@ -0,0 +1,28 @@
+/*
+ * 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 ['IgniteUserbar', [function() {
+    const items = [];
+
+    this.push = function(data) {
+        items.push(data);
+    };
+
+    this.$get = [function() {
+        return items;
+    }];
+}]];

http://git-wip-us.apache.org/repos/asf/ignite/blob/6af6560a/modules/web-console/frontend/app/modules/navbar/navbar.directive.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/navbar/navbar.directive.js b/modules/web-console/frontend/app/modules/navbar/navbar.directive.js
new file mode 100644
index 0000000..020cfe4
--- /dev/null
+++ b/modules/web-console/frontend/app/modules/navbar/navbar.directive.js
@@ -0,0 +1,30 @@
+/*
+ * 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 ['igniteNavbar', ['IgniteNavbar', (IgniteNavbar) => {
+    function controller() {
+        const ctrl = this;
+
+        ctrl.items = IgniteNavbar;
+    }
+
+    return {
+        restrict: 'A',
+        controller,
+        controllerAs: 'navbar'
+    };
+}]];

http://git-wip-us.apache.org/repos/asf/ignite/blob/6af6560a/modules/web-console/frontend/app/modules/navbar/navbar.module.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/navbar/navbar.module.js b/modules/web-console/frontend/app/modules/navbar/navbar.module.js
new file mode 100644
index 0000000..b845cbc
--- /dev/null
+++ b/modules/web-console/frontend/app/modules/navbar/navbar.module.js
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+import angular from 'angular';
+
+import IgniteNavbar from './Navbar.provider';
+import IgniteUserbar from './Userbar.provider';
+
+import igniteNavbar from './navbar.directive';
+import igniteUserbar from './userbar.directive';
+
+angular
+.module('ignite-console.navbar', [
+
+])
+.provider(...IgniteNavbar)
+.provider(...IgniteUserbar)
+.directive(...igniteNavbar)
+.directive(...igniteUserbar);

http://git-wip-us.apache.org/repos/asf/ignite/blob/6af6560a/modules/web-console/frontend/app/modules/navbar/userbar.directive.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/navbar/userbar.directive.js b/modules/web-console/frontend/app/modules/navbar/userbar.directive.js
new file mode 100644
index 0000000..af70eb1
--- /dev/null
+++ b/modules/web-console/frontend/app/modules/navbar/userbar.directive.js
@@ -0,0 +1,48 @@
+/*
+ * 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 ['igniteUserbar', [function() {
+    return {
+        restrict: 'A',
+        controller: ['$rootScope', 'IgniteUserbar', 'AclService', function($root, IgniteUserbar,
AclService) {
+            const ctrl = this;
+
+            ctrl.items = [
+                {text: 'Profile', sref: 'settings.profile'},
+                {text: 'Getting started', click: 'gettingStarted.tryShow(true)'}
+            ];
+
+            const _rebuildSettings = () => {
+                ctrl.items.splice(2);
+
+                if (AclService.can('admin_page'))
+                    ctrl.items.push({text: 'Admin panel', sref: 'settings.admin'});
+
+                ctrl.items.push(...IgniteUserbar);
+
+                if (AclService.can('logout'))
+                    ctrl.items.push({text: 'Log out', sref: 'logout'});
+            };
+
+            if ($root.user)
+                _rebuildSettings(null, $root.user);
+
+            $root.$on('user', _rebuildSettings);
+        }],
+        controllerAs: 'userbar'
+    };
+}]];

http://git-wip-us.apache.org/repos/asf/ignite/blob/6af6560a/modules/web-console/frontend/app/modules/socket.module.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/socket.module.js b/modules/web-console/frontend/app/modules/socket.module.js
new file mode 100644
index 0000000..17856c4
--- /dev/null
+++ b/modules/web-console/frontend/app/modules/socket.module.js
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+import angular from 'angular';
+import io from 'socket.io-client'; // eslint-disable-line no-unused-vars
+
+angular
+.module('ignite-console.socket', [
+])
+.provider('igniteSocketFactory', [function() {
+    let _options = {};
+
+    /**
+     * @param {Object} options Socket io options.
+     */
+    this.set = (options) => {
+        _options = options;
+    };
+
+    this.$get = ['socketFactory', function(socketFactory) {
+        return () => {
+            const ioSocket = io.connect(_options);
+
+            return socketFactory({ioSocket});
+        };
+    }];
+}]);

http://git-wip-us.apache.org/repos/asf/ignite/blob/6af6560a/modules/web-console/frontend/app/modules/sql/Notebook.data.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/sql/Notebook.data.js b/modules/web-console/frontend/app/modules/sql/Notebook.data.js
new file mode 100644
index 0000000..aef72eb
--- /dev/null
+++ b/modules/web-console/frontend/app/modules/sql/Notebook.data.js
@@ -0,0 +1,157 @@
+/*
+ * 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.
+ */
+
+const DEMO_NOTEBOOK = {
+    name: 'SQL demo',
+    paragraphs: [
+        {
+            name: 'Query with refresh rate',
+            cacheName: 'CarCache',
+            pageSize: 50,
+            query: [
+                'SELECT count(*)',
+                'FROM "CarCache".Car'
+            ].join('\n'),
+            result: 'bar',
+            timeLineSpan: '1',
+            rate: {
+                value: 3,
+                unit: 1000,
+                installed: true
+            }
+        },
+        {
+            name: 'Simple query',
+            cacheName: 'CarCache',
+            pageSize: 50,
+            query: 'SELECT * FROM "CarCache".Car',
+            result: 'table',
+            timeLineSpan: '1',
+            rate: {
+                value: 30,
+                unit: 1000,
+                installed: false
+            }
+        },
+        {
+            name: 'Query with aggregates',
+            cacheName: 'CarCache',
+            pageSize: 50,
+            query: [
+                'SELECT p.name, count(*) AS cnt',
+                'FROM "ParkingCache".Parking p',
+                'INNER JOIN "CarCache".Car c',
+                '  ON (p.id) = (c.parkingId)',
+                'GROUP BY P.NAME'
+            ].join('\n'),
+            result: 'table',
+            timeLineSpan: '1',
+            rate: {
+                value: 30,
+                unit: 1000,
+                installed: false
+            }
+        }
+    ],
+    expandedParagraphs: [0, 1, 2]
+};
+
+export default class NotebookData {
+    static $inject = ['$rootScope', '$http', '$q'];
+
+    constructor($root, $http, $q) {
+        this.demo = $root.IgniteDemoMode;
+
+        this.initLatch = null;
+        this.notebooks = null;
+
+        this.$http = $http;
+        this.$q = $q;
+    }
+
+    read() {
+        if (!_.isNil(this.initLatch))
+            return this.initLatch;
+
+        if (this.demo)
+            return this.initLatch = this.$q.when(this.notebooks = [DEMO_NOTEBOOK]);
+
+        return this.initLatch = this.$http.get('/api/v1/notebooks')
+            .then(({data}) => this.notebooks = data)
+            .catch(({data}) => Promise.reject(data));
+    }
+
+    find(_id) {
+        return this.read()
+            .then(() => {
+                const notebook = this.demo ? this.notebooks[0] : _.find(this.notebooks, {_id});
+
+                if (_.isNil(notebook))
+                    return this.$q.reject('Failed to load notebook.');
+
+                return notebook;
+            });
+    }
+
+    findIndex(notebook) {
+        return this.read()
+            .then(() => _.findIndex(this.notebooks, {_id: notebook._id}));
+    }
+
+    save(notebook) {
+        if (this.demo)
+            return this.$q.when(DEMO_NOTEBOOK);
+
+        return this.$http.post('/api/v1/notebooks/save', notebook)
+            .then(({data}) => {
+                const idx = _.findIndex(this.notebooks, {_id: data._id});
+
+                if (idx >= 0)
+                    this.notebooks[idx] = data;
+                else
+                    this.notebooks.push(data);
+
+                return data;
+            })
+            .catch(({data}) => Promise.reject(data));
+    }
+
+    remove(notebook) {
+        if (this.demo)
+            return this.$q.reject(`Removing "${notebook.name}" notebook is not supported.`);
+
+        const key = {_id: notebook._id};
+
+        return this.$http.post('/api/v1/notebooks/remove', key)
+            .then(() => {
+                const idx = _.findIndex(this.notebooks, key);
+
+                if (idx >= 0) {
+                    this.notebooks.splice(idx, 1);
+
+                    if (idx < this.notebooks.length)
+                        return this.notebooks[idx];
+                }
+
+                if (this.notebooks.length > 0)
+                    return this.notebooks[this.notebooks.length - 1];
+
+                return null;
+            })
+            .catch(({data}) => Promise.reject(data));
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/6af6560a/modules/web-console/frontend/app/modules/sql/Notebook.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/sql/Notebook.service.js b/modules/web-console/frontend/app/modules/sql/Notebook.service.js
new file mode 100644
index 0000000..12730be
--- /dev/null
+++ b/modules/web-console/frontend/app/modules/sql/Notebook.service.js
@@ -0,0 +1,74 @@
+/*
+ * 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 Notebook {
+    static $inject = ['$state', 'IgniteConfirm', 'IgniteMessages', 'IgniteNotebookData'];
+
+    /**
+     * @param $state
+     * @param confirmModal
+     * @param Messages
+     * @param {NotebookData} NotebookData
+     */
+    constructor($state, confirmModal, Messages, NotebookData) {
+        this.$state = $state;
+        this.confirmModal = confirmModal;
+        this.Messages = Messages;
+        this.NotebookData = NotebookData;
+    }
+
+    read() {
+        return this.NotebookData.read();
+    }
+
+    create(name) {
+        return this.NotebookData.save({name});
+    }
+
+    save(notebook) {
+        return this.NotebookData.save(notebook);
+    }
+
+    find(_id) {
+        return this.NotebookData.find(_id);
+    }
+
+    _openNotebook(idx) {
+        return this.NotebookData.read()
+            .then((notebooks) => {
+                const nextNotebook = notebooks.length > idx ? notebooks[idx] : _.last(notebooks);
+
+                if (nextNotebook)
+                    this.$state.go('base.sql.notebook', {noteId: nextNotebook._id});
+                else
+                    this.$state.go('base.configuration.clusters');
+            });
+    }
+
+    remove(notebook) {
+        return this.confirmModal.confirm(`Are you sure you want to remove: "${notebook.name}"?`)
+            .then(() => this.NotebookData.findIndex(notebook))
+            .then((idx) => {
+                this.NotebookData.remove(notebook)
+                    .then(() => {
+                        if (this.$state.includes('base.sql.notebook') && this.$state.params.noteId
=== notebook._id)
+                            return this._openNotebook(idx);
+                    })
+                    .catch(this.Messages.showError);
+            });
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/6af6560a/modules/web-console/frontend/app/modules/sql/notebook.controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/sql/notebook.controller.js b/modules/web-console/frontend/app/modules/sql/notebook.controller.js
new file mode 100644
index 0000000..f10a4d0
--- /dev/null
+++ b/modules/web-console/frontend/app/modules/sql/notebook.controller.js
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+
+// Controller that load notebooks in navigation bar .
+export default ['$scope', '$modal', '$state', 'IgniteMessages', 'IgniteNotebook',
+    (scope, $modal, $state, Messages, Notebook) => {
+        // Pre-fetch modal dialogs.
+        const nameModal = $modal({scope, templateUrl: '/sql/notebook-new.html', show: false});
+
+        scope.create = (name) => {
+            return Notebook.create(name)
+                .then((notebook) => {
+                    nameModal.hide();
+
+                    $state.go('base.sql.notebook', {noteId: notebook._id});
+                })
+                .catch(Messages.showError);
+        };
+
+        scope.createNotebook = () => nameModal.$promise.then(nameModal.show);
+
+        Notebook.read()
+            .then((notebooks) => {
+                scope.$watchCollection(() => notebooks, (changed) => {
+                    if (!changed.length)
+                        return scope.notebooks = [];
+
+                    scope.notebooks = [
+                        {text: 'Create new notebook', click: scope.createNotebook},
+                        {divider: true}
+                    ];
+
+                    _.forEach(changed, (notebook) => scope.notebooks.push({
+                        data: notebook,
+                        action: {
+                            icon: 'fa-trash',
+                            click: (item) => Notebook.remove(item)
+                        },
+                        text: notebook.name,
+                        sref: `base.sql.notebook({noteId:"${notebook._id}"})`
+                    }));
+                });
+            })
+            .catch(Messages.showError);
+    }
+];

http://git-wip-us.apache.org/repos/asf/ignite/blob/6af6560a/modules/web-console/frontend/app/modules/sql/scan-filter-input.jade
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/sql/scan-filter-input.jade b/modules/web-console/frontend/app/modules/sql/scan-filter-input.jade
new file mode 100644
index 0000000..addc5f3
--- /dev/null
+++ b/modules/web-console/frontend/app/modules/sql/scan-filter-input.jade
@@ -0,0 +1,39 @@
+//-
+    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.
+
+include ../../helpers/jade/mixins.jade
+
+.modal(tabindex='-1' role='dialog')
+    .modal-dialog
+        .modal-content
+            .modal-header
+                button.close(ng-click='$hide()') &times;
+                h4.modal-title Scan filter
+            form.form-horizontal.modal-body.row(name='ui.inputForm' novalidate)
+                .settings-row
+                    .col-sm-2
+                        label.required.labelFormField Filter:&nbsp;
+                    .col-sm-10
+                        .input-tip
+                            +ignite-form-field-input('"filter"', 'ui.filter', false, 'true',
'Enter filter')(
+                                data-ignite-form-field-input-autofocus='true'
+                                ignite-on-enter='form.$valid && ok()'
+                            )
+                .settings-row
+                    +checkbox('Case sensitive search', 'ui.caseSensitive', '"caseSensitive"',
'Select this checkbox for case sensitive search')
+            .modal-footer
+                button.btn.btn-default(id='btn-cancel' ng-click='$hide()') Cancel
+                button.btn.btn-primary(id='btn-scan' ng-disabled='ui.inputForm.$invalid'
ng-click='ok()') Scan

http://git-wip-us.apache.org/repos/asf/ignite/blob/6af6560a/modules/web-console/frontend/app/modules/sql/scan-filter-input.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/sql/scan-filter-input.service.js b/modules/web-console/frontend/app/modules/sql/scan-filter-input.service.js
new file mode 100644
index 0000000..18ba3ba
--- /dev/null
+++ b/modules/web-console/frontend/app/modules/sql/scan-filter-input.service.js
@@ -0,0 +1,51 @@
+/*
+ * 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 ScanFilter {
+    static $inject = ['$rootScope', '$q', '$modal'];
+
+    constructor($root, $q, $modal) {
+        this.deferred = null;
+        this.$q = $q;
+
+        const scope = $root.$new();
+
+        scope.ui = {};
+
+        scope.ok = () => {
+            this.deferred.resolve({filter: scope.ui.filter, caseSensitive: !!scope.ui.caseSensitive});
+
+            this.modal.hide();
+        };
+
+        scope.$hide = () => {
+            this.modal.hide();
+
+            this.deferred.reject();
+        };
+
+        this.modal = $modal({templateUrl: '/scan-filter-input.html', scope, placement: 'center',
show: false});
+    }
+
+    open() {
+        this.deferred = this.$q.defer();
+
+        this.modal.$promise.then(this.modal.show);
+
+        return this.deferred.promise;
+    }
+}


Mime
View raw message