You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2017/08/01 09:26:06 UTC
[23/47] ignite git commit: IGNITE-5863 Web Console: Implemented
component for showing table totals.
IGNITE-5863 Web Console: Implemented component for showing table totals.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2cbc0491
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2cbc0491
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2cbc0491
Branch: refs/heads/master
Commit: 2cbc049172c47a77e2b9dcdbda09161ef54ad102
Parents: a57a851
Author: Dmitriy Shabalin <ds...@gridgain.com>
Authored: Fri Jul 28 18:05:16 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Fri Jul 28 18:05:16 2017 +0700
----------------------------------------------------------------------
modules/web-console/frontend/app/app.js | 2 ++
.../components/grid-item-selected/component.js | 28 +++++++++++++++
.../components/grid-item-selected/controller.js | 38 ++++++++++++++++++++
.../app/components/grid-item-selected/index.js | 24 +++++++++++++
.../components/grid-item-selected/template.pug | 17 +++++++++
.../list-of-registered-users.tpl.pug | 2 +-
6 files changed, 110 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2cbc0491/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 e2d609a..a322ff7 100644
--- a/modules/web-console/frontend/app/app.js
+++ b/modules/web-console/frontend/app/app.js
@@ -125,6 +125,7 @@ import pageConfigure from './components/page-configure';
import pageConfigureBasic from './components/page-configure-basic';
import pageConfigureAdvanced from './components/page-configure-advanced';
import gridColumnSelector from './components/grid-column-selector';
+import gridItemSelected from './components/grid-item-selected';
import bsSelectMenu from './components/bs-select-menu';
import protectFromBsSelectRender from './components/protect-from-bs-select-render';
@@ -193,6 +194,7 @@ angular.module('ignite-console', [
pageConfigureBasic.name,
pageConfigureAdvanced.name,
gridColumnSelector.name,
+ gridItemSelected.name,
bsSelectMenu.name,
protectFromBsSelectRender.name,
AngularStrapTooltip.name,
http://git-wip-us.apache.org/repos/asf/ignite/blob/2cbc0491/modules/web-console/frontend/app/components/grid-item-selected/component.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/grid-item-selected/component.js b/modules/web-console/frontend/app/components/grid-item-selected/component.js
new file mode 100644
index 0000000..d25ad74
--- /dev/null
+++ b/modules/web-console/frontend/app/components/grid-item-selected/component.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.
+ */
+
+import template from './template.pug';
+import controller from './controller.js';
+
+export default {
+ template,
+ controller,
+ transclude: true,
+ bindings: {
+ gridApi: '<'
+ }
+};
http://git-wip-us.apache.org/repos/asf/ignite/blob/2cbc0491/modules/web-console/frontend/app/components/grid-item-selected/controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/grid-item-selected/controller.js b/modules/web-console/frontend/app/components/grid-item-selected/controller.js
new file mode 100644
index 0000000..4923924
--- /dev/null
+++ b/modules/web-console/frontend/app/components/grid-item-selected/controller.js
@@ -0,0 +1,38 @@
+/*
+ * 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 {
+ static $inject = ['$scope', 'uiGridConstants'];
+
+ constructor($scope, uiGridConstants) {
+ Object.assign(this, {$scope, uiGridConstants});
+ }
+
+ $onChanges(changes) {
+ if (changes && 'gridApi' in changes && changes.gridApi.currentValue) {
+ this.applyValues();
+
+ this.gridApi.grid.registerDataChangeCallback(() => this.applyValues(), [this.uiGridConstants.dataChange.ROW]);
+ this.gridApi.selection.on.rowSelectionChanged(this.$scope, () => this.applyValues());
+ }
+ }
+
+ applyValues() {
+ this.selected = this.gridApi.selection.getSelectedRows().length;
+ this.count = this.gridApi.grid.rows.length;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2cbc0491/modules/web-console/frontend/app/components/grid-item-selected/index.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/grid-item-selected/index.js b/modules/web-console/frontend/app/components/grid-item-selected/index.js
new file mode 100644
index 0000000..583d871
--- /dev/null
+++ b/modules/web-console/frontend/app/components/grid-item-selected/index.js
@@ -0,0 +1,24 @@
+/*
+ * 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 component from './component';
+
+export default angular
+ .module('ignite-console.grid-item-selected', [])
+ .component('gridItemSelected', component);
http://git-wip-us.apache.org/repos/asf/ignite/blob/2cbc0491/modules/web-console/frontend/app/components/grid-item-selected/template.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/grid-item-selected/template.pug b/modules/web-console/frontend/app/components/grid-item-selected/template.pug
new file mode 100644
index 0000000..eca079e
--- /dev/null
+++ b/modules/web-console/frontend/app/components/grid-item-selected/template.pug
@@ -0,0 +1,17 @@
+//-
+ 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.
+
+i {{ $ctrl.selected }} of {{ $ctrl.count }} selected
http://git-wip-us.apache.org/repos/asf/ignite/blob/2cbc0491/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.tpl.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.tpl.pug b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.tpl.pug
index 3558ab5..68530a5 100644
--- a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.tpl.pug
+++ b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.tpl.pug
@@ -61,7 +61,7 @@ include /app/helpers/jade/mixins
span(ng-if='$ctrl.groupBy === "country"') List of registered countries
grid-column-selector(grid-api='$ctrl.gridApi')
.panel-selected(ng-show='$ctrl.selected.length')
- | {{ $ctrl.selected.length }} item{{ $ctrl.selected.length > 1 ? 's' : '' }} selected
+ grid-item-selected(grid-api='$ctrl.gridApi')
.panel-collapse
.grid.ui-grid--ignite.ui-grid-disabled-group-selection(ui-grid='$ctrl.gridOptions' ui-grid-resize-columns ui-grid-selection ui-grid-exporter ui-grid-pinning ui-grid-grouping)