You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/06/30 18:29:15 UTC
[1/7] ignite git commit: IGNITE-5611 Fix text color cascading issue.
Repository: ignite
Updated Branches:
refs/heads/ignite-gg-12389 66f5eabf0 -> c22a7f547
IGNITE-5611 Fix text color cascading issue.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/531a0de3
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/531a0de3
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/531a0de3
Branch: refs/heads/ignite-gg-12389
Commit: 531a0de302a00e2285bf4bc16bee1f1bdcc7d4f1
Parents: 5699be7
Author: Ilya Borisov <kl...@gmail.com>
Authored: Fri Jun 30 14:16:49 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Jun 30 14:39:27 2017 +0700
----------------------------------------------------------------------
.../web-console/frontend/app/components/bs-select-menu/style.scss | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/531a0de3/modules/web-console/frontend/app/components/bs-select-menu/style.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/bs-select-menu/style.scss b/modules/web-console/frontend/app/components/bs-select-menu/style.scss
index 67dec24..faddd3c 100644
--- a/modules/web-console/frontend/app/components/bs-select-menu/style.scss
+++ b/modules/web-console/frontend/app/components/bs-select-menu/style.scss
@@ -36,6 +36,7 @@
border-radius: $ignite-button-border-radius;
border: 1px solid #c5c5c5;
background: white;
+ color: initial; // Fixes color inheritance inside some containers
.bssm-active-indicator {
font-size: 14px;
[6/7] ignite git commit: GG-12330 Do not destroy single cache if
cache group will be destroyed
Posted by sb...@apache.org.
GG-12330 Do not destroy single cache if cache group will be destroyed
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/18bbb14e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/18bbb14e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/18bbb14e
Branch: refs/heads/ignite-gg-12389
Commit: 18bbb14e35eecaddb86ec4361f18a652b9559836
Parents: c697d45
Author: Pavel Kovalenko <jo...@gmail.com>
Authored: Fri Jun 30 21:22:28 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Jun 30 21:22:28 2017 +0300
----------------------------------------------------------------------
.../cache/CacheAffinitySharedManager.java | 26 ++---
.../processors/cache/ClusterCachesInfo.java | 13 ++-
.../cache/DynamicCacheChangeRequest.java | 1 +
.../processors/cache/ExchangeActions.java | 109 +++++++++++++++----
.../processors/cache/GridCacheProcessor.java | 58 +++++-----
5 files changed, 141 insertions(+), 66 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/18bbb14e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
index 5984ef5..9516f84 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
@@ -772,10 +772,10 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
for (ExchangeActions.ActionData action : exchActions.cacheStopRequests())
cctx.cache().blockGateway(action.request().cacheName(), true, action.request().restart());
- for (CacheGroupDescriptor grpDesc : exchActions.cacheGroupsToStop()) {
- cctx.exchange().clearClientTopology(grpDesc.groupId());
+ for (ExchangeActions.CacheGroupActionData action : exchActions.cacheGroupsToStop()) {
+ cctx.exchange().clearClientTopology(action.descriptor().groupId());
- CacheGroupContext gctx = cctx.cache().cacheGroup(grpDesc.groupId());
+ CacheGroupContext gctx = cctx.cache().cacheGroup(action.descriptor().groupId());
if (gctx != null) {
IgniteCheckedException ex;
@@ -797,11 +797,11 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
Set<Integer> stoppedGrps = null;
if (crd && lateAffAssign) {
- for (CacheGroupDescriptor grpDesc : exchActions.cacheGroupsToStop()) {
- if (grpDesc.config().getCacheMode() != LOCAL) {
- CacheGroupHolder cacheGrp = grpHolders.remove(grpDesc.groupId());
+ for (ExchangeActions.CacheGroupActionData data : exchActions.cacheGroupsToStop()) {
+ if (data.descriptor().config().getCacheMode() != LOCAL) {
+ CacheGroupHolder cacheGrp = grpHolders.remove(data.descriptor().groupId());
- assert cacheGrp != null : grpDesc;
+ assert cacheGrp != null : data.descriptor();
if (stoppedGrps == null)
stoppedGrps = new HashSet<>();
@@ -2270,7 +2270,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
if (!registeredGrps.containsKey(grpDesc.groupId()))
registeredGrps.put(grpDesc.groupId(), grpDesc);
- if (!registeredCaches.containsKey(desc.cacheName()))
+ if (!registeredCaches.containsKey(desc.cacheId()))
registeredCaches.put(desc.cacheId(), desc);
}
}
@@ -2279,14 +2279,14 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
* @param exchActions Exchange actions.
*/
void updateCachesInfo(ExchangeActions exchActions) {
- for (CacheGroupDescriptor stopDesc : exchActions.cacheGroupsToStop()) {
- CacheGroupDescriptor rmvd = registeredGrps.remove(stopDesc.groupId());
+ for (ExchangeActions.CacheGroupActionData stopAction : exchActions.cacheGroupsToStop()) {
+ CacheGroupDescriptor rmvd = registeredGrps.remove(stopAction.descriptor().groupId());
- assert rmvd != null : stopDesc.cacheOrGroupName();
+ assert rmvd != null : stopAction.descriptor().cacheOrGroupName();
}
- for (CacheGroupDescriptor startDesc : exchActions.cacheGroupsToStart()) {
- CacheGroupDescriptor old = registeredGrps.put(startDesc.groupId(), startDesc);
+ for (ExchangeActions.CacheGroupActionData startAction : exchActions.cacheGroupsToStart()) {
+ CacheGroupDescriptor old = registeredGrps.put(startAction.descriptor().groupId(), startAction.descriptor());
assert old == null : old;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/18bbb14e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
index 15345d9..4e9dcf1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
@@ -539,7 +539,18 @@ class ClusterCachesInfo {
ctx.discovery().removeCacheGroup(grpDesc);
- exchangeActions.addCacheGroupToStop(grpDesc);
+ exchangeActions.addCacheGroupToStop(grpDesc, req.destroy());
+
+ assert exchangeActions.checkStopRequestConsistency(grpDesc.groupId());
+
+ // If all caches in group will be destroyed it is not necessary to destroy single cache
+ // because group will be stopped anyway.
+ if (req.destroy()) {
+ for (ExchangeActions.ActionData action : exchangeActions.cacheStopRequests()) {
+ if (action.descriptor().groupId() == grpDesc.groupId())
+ action.request().destroy(false);
+ }
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/18bbb14e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
index 2c9e7f2..6d5eaf3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
@@ -427,6 +427,7 @@ public class DynamicCacheChangeRequest implements Serializable {
", nodeId=" + initiatingNodeId +
", clientStartOnly=" + clientStartOnly +
", stop=" + stop +
+ ", destroy=" + destroy +
']';
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/18bbb14e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeActions.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeActions.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeActions.java
index 1a6b068..9caf9aa 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeActions.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeActions.java
@@ -35,10 +35,10 @@ import org.jetbrains.annotations.Nullable;
*/
public class ExchangeActions {
/** */
- private List<CacheGroupDescriptor> cacheGrpsToStart;
+ private List<CacheGroupActionData> cacheGrpsToStart;
/** */
- private List<CacheGroupDescriptor> cacheGrpsToStop;
+ private List<CacheGroupActionData> cacheGrpsToStop;
/** */
private Map<String, ActionData> cachesToStart;
@@ -53,6 +53,29 @@ public class ExchangeActions {
private ClusterState newState;
/**
+ * @param grpId Group ID.
+ * @return Always {@code true}, fails with assert error if inconsistent.
+ */
+ boolean checkStopRequestConsistency(int grpId) {
+ Boolean destroy = null;
+
+ // Check that caches associated with that group will be all stopped only or all destroyed.
+ for (ExchangeActions.ActionData action : cacheStopRequests()) {
+ if (action.descriptor().groupId() == grpId) {
+ if (destroy == null)
+ destroy = action.request().destroy();
+ else {
+ assert action.request().destroy() == destroy
+ : "Both cache stop only and cache destroy request associated with one group in batch "
+ + cacheStopRequests();
+ }
+ }
+ }
+
+ return true;
+ }
+
+ /**
* @return {@code True} if server nodes should not participate in exchange.
*/
public boolean clientOnlyExchange() {
@@ -237,14 +260,14 @@ public class ExchangeActions {
if (cacheGrpsToStart == null)
cacheGrpsToStart = new ArrayList<>();
- cacheGrpsToStart.add(grpDesc);
+ cacheGrpsToStart.add(new CacheGroupActionData(grpDesc));
}
/**
* @return Cache groups to start.
*/
- public List<CacheGroupDescriptor> cacheGroupsToStart() {
- return cacheGrpsToStart != null ? cacheGrpsToStart : Collections.<CacheGroupDescriptor>emptyList();
+ public List<CacheGroupActionData> cacheGroupsToStart() {
+ return cacheGrpsToStart != null ? cacheGrpsToStart : Collections.<CacheGroupActionData>emptyList();
}
/**
@@ -253,8 +276,8 @@ public class ExchangeActions {
*/
public boolean cacheGroupStarting(int grpId) {
if (cacheGrpsToStart != null) {
- for (CacheGroupDescriptor grp : cacheGrpsToStart) {
- if (grp.groupId() == grpId)
+ for (CacheGroupActionData grp : cacheGrpsToStart) {
+ if (grp.desc.groupId() == grpId)
return true;
}
}
@@ -264,21 +287,22 @@ public class ExchangeActions {
/**
* @param grpDesc Group descriptor.
+ * @param destroy Destroy flag.
*/
- public void addCacheGroupToStop(CacheGroupDescriptor grpDesc) {
+ public void addCacheGroupToStop(CacheGroupDescriptor grpDesc, boolean destroy) {
assert grpDesc != null;
if (cacheGrpsToStop == null)
cacheGrpsToStop = new ArrayList<>();
- cacheGrpsToStop.add(grpDesc);
+ cacheGrpsToStop.add(new CacheGroupActionData(grpDesc, destroy));
}
/**
* @return Cache groups to start.
*/
- public List<CacheGroupDescriptor> cacheGroupsToStop() {
- return cacheGrpsToStop != null ? cacheGrpsToStop : Collections.<CacheGroupDescriptor>emptyList();
+ public List<CacheGroupActionData> cacheGroupsToStop() {
+ return cacheGrpsToStop != null ? cacheGrpsToStop : Collections.<CacheGroupActionData>emptyList();
}
/**
@@ -287,8 +311,8 @@ public class ExchangeActions {
*/
public boolean cacheGroupStopping(int grpId) {
if (cacheGrpsToStop != null) {
- for (CacheGroupDescriptor grp : cacheGrpsToStop) {
- if (grp.groupId() == grpId)
+ for (CacheGroupActionData grp : cacheGrpsToStop) {
+ if (grp.desc.groupId() == grpId)
return true;
}
}
@@ -312,10 +336,10 @@ public class ExchangeActions {
*/
static class ActionData {
/** */
- private DynamicCacheChangeRequest req;
+ private final DynamicCacheChangeRequest req;
/** */
- private DynamicCacheDescriptor desc;
+ private final DynamicCacheDescriptor desc;
/**
* @param req Request.
@@ -344,16 +368,59 @@ public class ExchangeActions {
}
}
+ /**
+ *
+ */
+ static class CacheGroupActionData {
+ /** */
+ private final CacheGroupDescriptor desc;
+
+ /** */
+ private final boolean destroy;
+
+ /**
+ * @param desc Group descriptor
+ * @param destroy Destroy flag
+ */
+ CacheGroupActionData(CacheGroupDescriptor desc, boolean destroy) {
+ assert desc != null;
+
+ this.desc = desc;
+ this.destroy = destroy;
+ }
+
+ /**
+ * @param desc Group descriptor
+ */
+ CacheGroupActionData(CacheGroupDescriptor desc) {
+ this(desc, false);
+ }
+
+ /**
+ * @return Group descriptor
+ */
+ public CacheGroupDescriptor descriptor() {
+ return desc;
+ }
+
+ /**
+ * @return Destroy flag
+ */
+ public boolean destroy() {
+ return destroy;
+ }
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
- Object startGrps = F.viewReadOnly(cacheGrpsToStart, new C1<CacheGroupDescriptor, String>() {
- @Override public String apply(CacheGroupDescriptor desc) {
- return desc.cacheOrGroupName();
+ Object startGrps = F.viewReadOnly(cacheGrpsToStart, new C1<CacheGroupActionData, String>() {
+ @Override public String apply(CacheGroupActionData data) {
+ return data.desc.cacheOrGroupName();
}
});
- Object stopGrps = F.viewReadOnly(cacheGrpsToStop, new C1<CacheGroupDescriptor, String>() {
- @Override public String apply(CacheGroupDescriptor desc) {
- return desc.cacheOrGroupName();
+ Object stopGrps = F.viewReadOnly(cacheGrpsToStop, new C1<CacheGroupActionData, String>() {
+ @Override public String apply(CacheGroupActionData data) {
+ return data.desc.cacheOrGroupName() + ", destroy=" + data.destroy;
}
});
http://git-wip-us.apache.org/repos/asf/ignite/blob/18bbb14e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index c425bfb..bb6d068 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -2110,40 +2110,34 @@ public class GridCacheProcessor extends GridProcessorAdapter {
public void onExchangeDone(
AffinityTopologyVersion topVer,
@Nullable ExchangeActions exchActions,
- Throwable err
+ @Nullable Throwable err
) {
initCacheProxies(topVer, err);
- if (exchActions != null && exchActions.systemCachesStarting() && exchActions.newClusterState() == null)
- ctx.dataStructures().restoreStructuresState(ctx);
-
- if (exchActions != null && err == null) {
- Collection<IgniteBiTuple<CacheGroupContext, Boolean>> stoppedGrps = null;
-
- boolean forceCheckpoint = false;
-
- for (ExchangeActions.ActionData action : exchActions.cacheStopRequests()) {
- GridCacheContext<?, ?> stopCtx;
- boolean destroy;
+ if (exchActions == null)
+ return;
- if (!forceCheckpoint){
- try {
- sharedCtx.database().waitForCheckpoint("caches stop");
- }
- catch (IgniteCheckedException e) {
- U.error(log, "Failed to wait for checkpoint finish during cache stop.", e);
- }
+ if (exchActions.systemCachesStarting() && exchActions.newClusterState() == null)
+ ctx.dataStructures().restoreStructuresState(ctx);
- forceCheckpoint = true;
+ if (err == null) {
+ // Force checkpoint if there is any cache stop request
+ if (exchActions.cacheStopRequests().size() > 0) {
+ try {
+ sharedCtx.database().waitForCheckpoint("caches stop");
}
+ catch (IgniteCheckedException e) {
+ U.error(log, "Failed to wait for checkpoint finish during cache stop.", e);
+ }
+ }
+ for (ExchangeActions.ActionData action : exchActions.cacheStopRequests()) {
stopGateway(action.request());
sharedCtx.database().checkpointReadLock();
try {
- stopCtx = prepareCacheStop(action.request().cacheName(), action.request().destroy());
- destroy = action.request().destroy();
+ prepareCacheStop(action.request().cacheName(), action.request().destroy());
if (exchActions.newClusterState() == null)
ctx.state().onCacheStop(action.request());
@@ -2151,20 +2145,22 @@ public class GridCacheProcessor extends GridProcessorAdapter {
finally {
sharedCtx.database().checkpointReadUnlock();
}
+ }
+
+ List<IgniteBiTuple<CacheGroupContext, Boolean>> stoppedGroups = new ArrayList<>();
- if (stopCtx != null && !stopCtx.group().hasCaches()) {
- if (stoppedGrps == null)
- stoppedGrps = new ArrayList<>();
+ for (ExchangeActions.CacheGroupActionData action : exchActions.cacheGroupsToStop()) {
+ Integer groupId = action.descriptor().groupId();
- stoppedGrps.add(F.t(stopCtx.group(), destroy));
+ if (cacheGrps.containsKey(groupId)) {
+ stoppedGroups.add(F.t(cacheGrps.get(groupId), action.destroy()));
+
+ stopCacheGroup(groupId);
}
}
- for (CacheGroupDescriptor grpDesc : exchActions.cacheGroupsToStop())
- stopCacheGroup(grpDesc.groupId());
-
- if (stoppedGrps != null && !sharedCtx.kernalContext().clientNode())
- sharedCtx.database().onCacheGroupsStopped(stoppedGrps);
+ if (!sharedCtx.kernalContext().clientNode())
+ sharedCtx.database().onCacheGroupsStopped(stoppedGroups);
}
}
[3/7] ignite git commit: Fixed CSS for IE11.
Posted by sb...@apache.org.
Fixed CSS for IE11.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6239e04a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6239e04a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6239e04a
Branch: refs/heads/ignite-gg-12389
Commit: 6239e04a8273faa7763d2e11e933b1852637ff03
Parents: 4a1fef5
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Fri Jun 30 17:51:39 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Jun 30 17:51:39 2017 +0700
----------------------------------------------------------------------
modules/web-console/frontend/public/stylesheets/style.scss | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6239e04a/modules/web-console/frontend/public/stylesheets/style.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/public/stylesheets/style.scss b/modules/web-console/frontend/public/stylesheets/style.scss
index 305e7f7..183dc29 100644
--- a/modules/web-console/frontend/public/stylesheets/style.scss
+++ b/modules/web-console/frontend/public/stylesheets/style.scss
@@ -2185,3 +2185,7 @@ html,body,.splash-screen {
line-height: $line-height-base;
}
}
+
+.center-container {
+ position: absolute !important;
+}
[4/7] ignite git commit: Fixed "IGNITE-5521 Large near caches lead to
cluster instability with metrics enabled". This closes #2201.
Posted by sb...@apache.org.
Fixed "IGNITE-5521 Large near caches lead to cluster instability with metrics enabled". This closes #2201.
Signed-off-by: nikolay_tikhonov <nt...@gridgain.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c697d450
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c697d450
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c697d450
Branch: refs/heads/ignite-gg-12389
Commit: c697d4509b2d3ff7ef5bed93a9b697f45c830f8c
Parents: 6239e04
Author: mcherkasov <mc...@gridgain.com>
Authored: Thu Jun 29 12:15:33 2017 +0300
Committer: mcherkasov <mc...@gridgain.com>
Committed: Fri Jun 30 18:40:41 2017 +0300
----------------------------------------------------------------------
.../distributed/near/GridNearCacheAdapter.java | 4 +--
.../near/GridCacheNearEvictionSelfTest.java | 5 ++--
.../near/GridCacheNearMetricsSelfTest.java | 29 +++++++++++++++++++-
3 files changed, 32 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c697d450/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
index 5b53935..b27591e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
@@ -37,7 +37,6 @@ import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
import org.apache.ignite.internal.processors.cache.CacheEntryPredicateAdapter;
-import org.apache.ignite.internal.processors.cache.CacheObject;
import org.apache.ignite.internal.processors.cache.GridCacheClearAllRunnable;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
@@ -46,7 +45,6 @@ import org.apache.ignite.internal.processors.cache.GridCacheLocalConcurrentMap;
import org.apache.ignite.internal.processors.cache.GridCacheMapEntry;
import org.apache.ignite.internal.processors.cache.GridCacheMapEntryFactory;
import org.apache.ignite.internal.processors.cache.GridCachePreloader;
-import org.apache.ignite.internal.processors.cache.GridCacheValueCollection;
import org.apache.ignite.internal.processors.cache.IgniteCacheExpiryPolicy;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.processors.cache.distributed.GridDistributedCacheAdapter;
@@ -298,7 +296,7 @@ public abstract class GridNearCacheAdapter<K, V> extends GridDistributedCacheAda
/** {@inheritDoc} */
@Override public int size() {
- return nearEntries().size() + dht().size();
+ return dht().size();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/c697d450/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearEvictionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearEvictionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearEvictionSelfTest.java
index 1b09cff..9c7c933 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearEvictionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearEvictionSelfTest.java
@@ -163,12 +163,13 @@ public class GridCacheNearEvictionSelfTest extends GridCommonAbstractTest {
for (int i = 0; i < gridCnt; i++) {
final GridCacheAdapter cache = internalCache(i);
+ final GridCacheAdapter near = near(i);
// Repeatedly check cache sizes because of concurrent cache updates.
assertTrue(GridTestUtils.waitForCondition(new PA() {
@Override public boolean apply() {
// Every node contains either near, backup, or primary.
- return cnt == cache.size();
+ return cnt == cache.size() + near.nearSize();
}
}, getTestTimeout()));
@@ -181,4 +182,4 @@ public class GridCacheNearEvictionSelfTest extends GridCommonAbstractTest {
stopAllGrids();
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/c697d450/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMetricsSelfTest.java
index 30e9146..f9d567d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMetricsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMetricsSelfTest.java
@@ -21,7 +21,9 @@ import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.cache.GridCacheAbstractSelfTest;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -100,6 +102,31 @@ public class GridCacheNearMetricsSelfTest extends GridCacheAbstractSelfTest {
/**
* @throws Exception If failed.
*/
+ public void testNearCacheDoesNotAffectCacheSize() throws Exception {
+ IgniteCache<Integer, Integer> cache0 = grid(0).cache(DEFAULT_CACHE_NAME);
+
+ for (int i = 0; i < 100 ; i++)
+ cache0.put(i, i);
+
+ IgniteEx g1 = grid(1);
+
+ IgniteCache<Integer, Integer> cache1 = g1.cache(DEFAULT_CACHE_NAME);
+
+ ClusterNode localNode = g1.cluster().localNode();
+
+ int beforeSize = cache1.localMetrics().getSize();
+
+ for (int i = 0; i < 100 ; i++) {
+ if (!affinity(cache1).isPrimaryOrBackup(localNode, i))
+ cache1.get(i); // put entry to near cache
+ }
+
+ assertEquals(beforeSize, cache1.localMetrics().getSize());
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testPrimaryPut() throws Exception {
Ignite g0 = grid(0);
@@ -417,4 +444,4 @@ public class GridCacheNearMetricsSelfTest extends GridCacheAbstractSelfTest {
}
}
}
-}
\ No newline at end of file
+}
[2/7] ignite git commit: IGNITE-5627 Refactored grid columns menu.
Posted by sb...@apache.org.
IGNITE-5627 Refactored grid columns menu.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4a1fef5c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4a1fef5c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4a1fef5c
Branch: refs/heads/ignite-gg-12389
Commit: 4a1fef5cb2442833e1110fc45b341cb146592bd3
Parents: 531a0de
Author: Ilya Borisov <ib...@gridgain.com>
Authored: Fri Jun 30 16:47:18 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Jun 30 16:47:18 2017 +0700
----------------------------------------------------------------------
modules/web-console/frontend/.eslintrc | 2 +-
modules/web-console/frontend/app/app.js | 4 +
.../grid-column-selector/component.js | 29 ++
.../grid-column-selector/controller.js | 111 +++++
.../grid-column-selector/controller.spec.js | 435 +++++++++++++++++++
.../components/grid-column-selector/index.js | 24 +
.../components/grid-column-selector/style.scss | 24 +
.../grid-column-selector/template.pug | 28 ++
.../list-of-registered-users.categories.js | 22 +-
.../list-of-registered-users.column-defs.js | 4 +-
.../list-of-registered-users.controller.js | 46 --
.../list-of-registered-users.scss | 3 +
.../list-of-registered-users.tpl.pug | 26 +-
.../components/pcbProtectFromBsSelectRender.js | 32 --
.../components/page-configure-basic/index.js | 2 -
.../page-configure-basic/template.pug | 4 +-
.../protect-from-bs-select-render/directive.js | 32 ++
.../protect-from-bs-select-render/index.js | 24 +
.../frontend/app/helpers/jade/mixins.pug | 1 -
.../frontend/app/modules/sql/sql.controller.js | 21 +-
.../frontend/app/primitives/btn/index.scss | 8 +-
.../frontend/app/primitives/dropdown/index.pug | 2 +-
.../app/primitives/ui-grid-settings/index.pug | 33 --
.../frontend/public/stylesheets/style.scss | 13 +
.../web-console/frontend/views/sql/sql.tpl.pug | 6 +-
25 files changed, 764 insertions(+), 172 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/.eslintrc
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/.eslintrc b/modules/web-console/frontend/.eslintrc
index 6778b86..d88fb97 100644
--- a/modules/web-console/frontend/.eslintrc
+++ b/modules/web-console/frontend/.eslintrc
@@ -178,7 +178,7 @@ rules:
prefer-const: 1
prefer-spread: 2
quote-props: [2, "as-needed"]
- quotes: [2, "single"]
+ quotes: [2, "single", {"allowTemplateLiterals": true}]
radix: 1
semi: [2, "always"]
semi-spacing: [2, {"before": false, "after": true}]
http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/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 61372a2..7b8196e 100644
--- a/modules/web-console/frontend/app/app.js
+++ b/modules/web-console/frontend/app/app.js
@@ -123,7 +123,9 @@ import userNotifications from './components/user-notifications';
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 bsSelectMenu from './components/bs-select-menu';
+import protectFromBsSelectRender from './components/protect-from-bs-select-render';
// Inject external modules.
import IgniteModules from 'IgniteModules/index';
@@ -189,7 +191,9 @@ angular
pageConfigure.name,
pageConfigureBasic.name,
pageConfigureAdvanced.name,
+ gridColumnSelector.name,
bsSelectMenu.name,
+ protectFromBsSelectRender.name,
// Ignite modules.
IgniteModules.name
])
http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/components/grid-column-selector/component.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/grid-column-selector/component.js b/modules/web-console/frontend/app/components/grid-column-selector/component.js
new file mode 100644
index 0000000..957c821f
--- /dev/null
+++ b/modules/web-console/frontend/app/components/grid-column-selector/component.js
@@ -0,0 +1,29 @@
+/*
+ * 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';
+import './style.scss';
+
+export default {
+ template,
+ controller,
+ transclude: true,
+ bindings: {
+ gridApi: '<'
+ }
+};
http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/components/grid-column-selector/controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/grid-column-selector/controller.js b/modules/web-console/frontend/app/components/grid-column-selector/controller.js
new file mode 100644
index 0000000..1f04861
--- /dev/null
+++ b/modules/web-console/frontend/app/components/grid-column-selector/controller.js
@@ -0,0 +1,111 @@
+/*
+ * 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 uniq from 'lodash/fp/uniq';
+import difference from 'lodash/difference';
+import findLast from 'lodash/findLast';
+
+const hasGrouping = (changes) => {
+ return changes.gridApi.currentValue !== changes.gridApi.previousValue && changes.gridApi.currentValue.grouping;
+};
+const id = (column) => column.categoryDisplayName || column.displayName || column.name;
+const picksrc = (state) => state.categories.length ? state.categories : state.columns;
+
+export default class GridColumnSelectorController {
+ 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.COLUMN]);
+ if (hasGrouping(changes)) this.gridApi.grouping.on.groupingChanged(this.$scope, () => this.applyValues());
+ }
+ }
+
+ applyValues() {
+ this.state = this.getState();
+ this.columnsMenu = this.makeMenu();
+ this.selectedColumns = this.getSelectedColumns();
+ this.setSelectedColumns();
+ }
+
+ getSelectedColumns() {
+ return picksrc(this.state).filter((i) => i.isVisible && i.isInMenu).map((i) => id(i.item));
+ }
+
+ makeMenu() {
+ return picksrc(this.state).filter((i) => i.isInMenu).map((i) => ({
+ name: id(i.item),
+ item: i.item
+ }));
+ }
+
+ getState() {
+ const api = this.gridApi;
+ const columns = api.grid.options.columnDefs;
+ const categories = api.grid.options.categories || [];
+ const grouping = api.grouping
+ ? api.grouping.getGrouping().grouping.map((g) => columns.find((c) => c.name === g.colName).categoryDisplayName)
+ : [];
+ const mapfn = (item) => ({
+ item,
+ isInMenu: item.enableHiding !== false && !grouping.includes(item.name),
+ isVisible: grouping.includes(item.name) || item.visible !== false
+ });
+ return ({
+ categories: categories.map(mapfn),
+ columns: columns.map(mapfn)
+ });
+ }
+
+ findScrollToNext(columns, prevColumns) {
+ if (!prevColumns) return;
+ const diff = difference(columns, prevColumns);
+ if (diff.length === 1 && columns.includes(diff[0])) return diff[0];
+ }
+
+ setSelectedColumns() {
+ const {selectedColumns} = this;
+ const scrollToNext = this.findScrollToNext(selectedColumns, this.prevSelectedColumns);
+ this.prevSelectedColumns = selectedColumns;
+ const all = this.state.categories.concat(this.state.columns);
+ const itemsToShow = uniq(all.filter((i) => !i.isInMenu && i.isVisible).map((i) => id(i.item)).concat(selectedColumns));
+ (this.gridApi.grid.options.categories || []).concat(this.gridApi.grid.options.columnDefs).forEach((item) => {
+ item.visible = itemsToShow.includes(id(item));
+ });
+ // Scrolls to the last matching columnDef, useful if it was out of view after being enabled.
+ this.refreshColumns().then(() => {
+ if (scrollToNext) {
+ const column = findLast(this.gridApi.grid.options.columnDefs, (c) => id(c) === scrollToNext);
+ this.gridApi.grid.scrollTo(null, column);
+ }
+ });
+ }
+
+ // gridApi.grid.refreshColumns method does not allow to wait until async operation completion.
+ // This method does roughly the same, but returns a Promise.
+ refreshColumns() {
+ return this.gridApi.grid.processColumnsProcessors(this.gridApi.grid.columns)
+ .then((renderableColumns) => this.gridApi.grid.setVisibleColumns(renderableColumns))
+ .then(() => this.gridApi.grid.redrawInPlace())
+ .then(() => this.gridApi.grid.refreshCanvas(true));
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/components/grid-column-selector/controller.spec.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/grid-column-selector/controller.spec.js b/modules/web-console/frontend/app/components/grid-column-selector/controller.spec.js
new file mode 100644
index 0000000..d163a9c
--- /dev/null
+++ b/modules/web-console/frontend/app/components/grid-column-selector/controller.spec.js
@@ -0,0 +1,435 @@
+/*
+ * 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 {suite, test} from 'mocha';
+import {assert} from 'chai';
+import {spy, stub} from 'sinon';
+
+import Controller from './controller';
+
+const mocks = () => new Map([
+ ['$scope', {}],
+ ['uiGridConstants', {
+ dataChange: {
+ COLUMN: 'COLUMN'
+ }
+ }]
+]);
+
+const apiMock = () => ({
+ grid: {
+ options: {
+ columnDefs: []
+ },
+ registerDataChangeCallback: spy(),
+ processColumnsProcessors: spy((v) => Promise.resolve(v)),
+ setVisibleColumns: spy((v) => Promise.resolve(v)),
+ redrawInPlace: spy((v) => Promise.resolve(v)),
+ refreshCanvas: spy((v) => Promise.resolve(v)),
+ scrollTo: spy()
+ },
+ grouping: {
+ on: {
+ groupingChanged: spy()
+ },
+ getGrouping: stub().returns({grouping: []})
+ }
+});
+
+suite('grid-column-selector component controller', () => {
+ test('$onChanges', () => {
+ const c = new Controller(...mocks().values());
+ c.applyValues = spy(c.applyValues.bind(c));
+ const api = apiMock();
+ c.gridApi = api;
+ c.$onChanges({gridApi: {currentValue: api}});
+
+ assert.equal(c.applyValues.callCount, 1, 'calls applyValues');
+ assert.isFunction(
+ c.gridApi.grid.registerDataChangeCallback.lastCall.args[0]
+ );
+
+ c.gridApi.grid.registerDataChangeCallback.lastCall.args[0]();
+
+ assert.equal(
+ c.applyValues.callCount,
+ 2,
+ 'registers applyValues as data change callback'
+ );
+ assert.deepEqual(
+ c.gridApi.grid.registerDataChangeCallback.lastCall.args[1],
+ [c.uiGridConstants.dataChange.COLUMN],
+ 'registers data change callback for COLUMN'
+ );
+ assert.equal(
+ c.gridApi.grouping.on.groupingChanged.lastCall.args[0],
+ c.$scope,
+ 'registers grouping change callback with correct $scope'
+ );
+
+ c.gridApi.grouping.on.groupingChanged.lastCall.args[1]();
+
+ assert.equal(
+ c.applyValues.callCount,
+ 3,
+ 'registers applyValues as grouping change callback'
+ );
+ });
+ test('applyValues', () => {
+ const c = new Controller(...mocks().values());
+ const mock = {
+ getState: stub().returns({}),
+ makeMenu: stub().returns({}),
+ getSelectedColumns: stub().returns({}),
+ setSelectedColumns: spy()
+ };
+ c.applyValues.call(mock);
+
+ assert.equal(
+ mock.state,
+ mock.getState.lastCall.returnValue,
+ 'assigns getState return value as this.state'
+ );
+ assert.equal(
+ mock.columnsMenu,
+ mock.makeMenu.lastCall.returnValue,
+ 'assigns makeMenu return value as this.columnsMenu'
+ );
+ assert.equal(
+ mock.selectedColumns,
+ mock.getSelectedColumns.lastCall.returnValue,
+ 'assigns getSelectedColumns return value as this.selectedColumns'
+ );
+ assert.equal(
+ mock.setSelectedColumns.callCount,
+ 1,
+ 'calls setSelectedColumns once'
+ );
+ });
+ test('getSelectedColumns, using categories', () => {
+ const c = new Controller(...mocks().values());
+ c.state = {
+ categories: [
+ {isVisible: false},
+ {isVisible: true, isInMenu: false},
+ {isVisible: true, isInMenu: true, item: {categoryDisplayName: '1'}},
+ {isVisible: true, isInMenu: true, item: {displayName: '2'}},
+ {isVisible: true, isInMenu: true, item: {name: '3'}}
+ ],
+ columns: []
+ };
+
+ assert.deepEqual(
+ c.getSelectedColumns(),
+ ['1', '2', '3'],
+ 'returns correct value, prefers categories over columns'
+ );
+ });
+ test('getSelectedColumns, using columnDefs', () => {
+ const c = new Controller(...mocks().values());
+ c.state = {
+ categories: [
+ ],
+ columns: [
+ {isVisible: false},
+ {isVisible: true, isInMenu: false},
+ {isVisible: true, isInMenu: true, item: {categoryDisplayName: '1'}},
+ {isVisible: true, isInMenu: true, item: {displayName: '2'}},
+ {isVisible: true, isInMenu: true, item: {name: '3'}}
+ ]
+ };
+
+ assert.deepEqual(
+ c.getSelectedColumns(),
+ ['1', '2', '3'],
+ 'returns correct value, uses columns if there are no categories'
+ );
+ });
+ test('makeMenu, using categories', () => {
+ const c = new Controller(...mocks().values());
+ c.state = {
+ categories: [
+ {isVisible: false},
+ {isVisible: true, isInMenu: false},
+ {isVisible: true, isInMenu: true, item: {categoryDisplayName: '1'}},
+ {isVisible: true, isInMenu: true, item: {displayName: '2'}},
+ {isVisible: true, isInMenu: true, item: {name: '3'}}
+ ],
+ columns: []
+ };
+
+ assert.deepEqual(
+ c.makeMenu(),
+ [
+ {item: {categoryDisplayName: '1'}, name: '1'},
+ {item: {displayName: '2'}, name: '2'},
+ {item: {name: '3'}, name: '3'}
+ ],
+ 'returns correct value, prefers categories over columns'
+ );
+ });
+ test('makeMenu, using columns', () => {
+ const c = new Controller(...mocks().values());
+ c.state = {
+ categories: [],
+ columns: [
+ {isVisible: false},
+ {isVisible: true, isInMenu: false},
+ {isVisible: true, isInMenu: true, item: {categoryDisplayName: '1'}},
+ {isVisible: true, isInMenu: true, item: {displayName: '2'}},
+ {isVisible: true, isInMenu: true, item: {name: '3'}}
+ ]
+ };
+
+ assert.deepEqual(
+ c.makeMenu(),
+ [
+ {item: {categoryDisplayName: '1'}, name: '1'},
+ {item: {displayName: '2'}, name: '2'},
+ {item: {name: '3'}, name: '3'}
+ ],
+ 'returns correct value, uses columns if there are no categories'
+ );
+ });
+ test('getState', () => {
+ const c = new Controller(...mocks().values());
+ c.gridApi = apiMock();
+ c.gridApi.grouping.getGrouping = () => ({grouping: [{colName: 'a', categoryDisplayName: 'A'}]});
+ c.gridApi.grid.options.columnDefs = [
+ {visible: false, name: 'a', categoryDisplayName: 'A'},
+ {visible: true, name: 'a1', categoryDisplayName: 'A'},
+ {visible: true, name: 'a2', categoryDisplayName: 'A'},
+ {visible: true, name: 'b1', categoryDisplayName: 'B'},
+ {visible: true, name: 'b2', categoryDisplayName: 'B'},
+ {visible: true, name: 'b3', categoryDisplayName: 'B'},
+ {visible: true, name: 'c1', categoryDisplayName: 'C'},
+ {visible: true, name: 'c2', categoryDisplayName: 'C', enableHiding: false},
+ {visible: false, name: 'c3', categoryDisplayName: 'C'}
+ ];
+ c.gridApi.grid.options.categories = [
+ {categoryDisplayName: 'A', enableHiding: false, visible: true},
+ {categoryDisplayName: 'B', enableHiding: true, visible: false},
+ {categoryDisplayName: 'C', enableHiding: true, visible: true}
+ ];
+
+ assert.deepEqual(
+ c.getState(),
+ {
+ categories: [{
+ isInMenu: false,
+ isVisible: true,
+ item: {
+ categoryDisplayName: 'A',
+ enableHiding: false,
+ visible: true
+ }
+ }, {
+ isInMenu: true,
+ isVisible: false,
+ item: {
+ categoryDisplayName: 'B',
+ enableHiding: true,
+ visible: false
+ }
+ }, {
+ isInMenu: true,
+ isVisible: true,
+ item: {
+ categoryDisplayName: 'C',
+ enableHiding: true,
+ visible: true
+ }
+ }],
+ columns: [{
+ isInMenu: true,
+ isVisible: false,
+ item: {
+ categoryDisplayName: 'A',
+ name: 'a',
+ visible: false
+ }
+ }, {
+ isInMenu: true,
+ isVisible: true,
+ item: {
+ categoryDisplayName: 'A',
+ name: 'a1',
+ visible: true
+ }
+ }, {
+ isInMenu: true,
+ isVisible: true,
+ item: {
+ categoryDisplayName: 'A',
+ name: 'a2',
+ visible: true
+ }
+ }, {
+ isInMenu: true,
+ isVisible: true,
+ item: {
+ categoryDisplayName: 'B',
+ name: 'b1',
+ visible: true
+ }
+ }, {
+ isInMenu: true,
+ isVisible: true,
+ item: {
+ categoryDisplayName: 'B',
+ name: 'b2',
+ visible: true
+ }
+ }, {
+ isInMenu: true,
+ isVisible: true,
+ item: {
+ categoryDisplayName: 'B',
+ name: 'b3',
+ visible: true
+ }
+ }, {
+ isInMenu: true,
+ isVisible: true,
+ item: {
+ categoryDisplayName: 'C',
+ name: 'c1',
+ visible: true
+ }
+ }, {
+ isInMenu: false,
+ isVisible: true,
+ item: {
+ categoryDisplayName: 'C',
+ name: 'c2',
+ visible: true,
+ enableHiding: false
+ }
+ }, {
+ isInMenu: true,
+ isVisible: false,
+ item: {
+ categoryDisplayName: 'C',
+ name: 'c3',
+ visible: false
+ }
+ }]
+ },
+ 'returns correct value'
+ );
+ });
+ test('findScrollToNext', () => {
+ assert.deepEqual(
+ Controller.prototype.findScrollToNext([1, 2, 3], [1, 2]),
+ 3,
+ `returns new item if it's in selected collection end`
+ );
+ assert.deepEqual(
+ Controller.prototype.findScrollToNext([1, 2], [1, 3]),
+ 2,
+ `returns new item if it's in selected collection middle`
+ );
+ assert.deepEqual(
+ Controller.prototype.findScrollToNext([1, 2, 3], [2, 3]),
+ 1,
+ `returns new item if it's in selected collection start`
+ );
+ assert.equal(
+ Controller.prototype.findScrollToNext([1, 2, 3, 4, 5], [1]),
+ void 0,
+ `returns nothing if there's more than one new item`
+ );
+ assert.equal(
+ Controller.prototype.findScrollToNext([1, 2], [1, 2, 3]),
+ void 0,
+ `returns nothing if items were removed`
+ );
+ });
+ test('setSelectedColumns', () => {
+ const c = new Controller(...mocks().values());
+ const api = c.gridApi = apiMock();
+ c.refreshColumns = stub().returns(({then: (f) => f()}));
+ c.gridApi.grid.options.columnDefs = [
+ {name: 'a', visible: false, categoryDisplayName: 'A'},
+ {name: 'a1', visible: false, categoryDisplayName: 'A'},
+ {name: 'b', visible: true, categoryDisplayName: 'B'}
+ ];
+ c.gridApi.grid.options.categories = [
+ {categoryDisplayName: 'A', visible: false},
+ {categoryDisplayName: 'B'}
+ ];
+ c.$onChanges({gridApi: {currentValue: api}});
+ c.selectedColumns = ['A', 'B'];
+ c.setSelectedColumns();
+
+ assert.equal(
+ c.refreshColumns.callCount,
+ 2,
+ 'calls refreshColumns'
+ );
+ assert.deepEqual(
+ c.gridApi.grid.options.categories,
+ [
+ {categoryDisplayName: 'A', visible: true},
+ {categoryDisplayName: 'B', visible: true}
+ ],
+ 'changes category visibility'
+ );
+ assert.deepEqual(
+ c.gridApi.grid.options.columnDefs,
+ [
+ {name: 'a', visible: true, categoryDisplayName: 'A'},
+ {name: 'a1', visible: true, categoryDisplayName: 'A'},
+ {name: 'b', visible: true, categoryDisplayName: 'B'}
+ ],
+ 'changes column visibility'
+ );
+ assert.deepEqual(
+ c.gridApi.grid.scrollTo.lastCall.args,
+ [null, {name: 'a1', visible: true, categoryDisplayName: 'A'}],
+ 'scrolls to last added column'
+ );
+ });
+ test('refreshColumns', () => {
+ const c = new Controller(...mocks().values());
+ c.gridApi = apiMock();
+ c.gridApi.grid.columns = [1, 2, 3];
+
+ return c.refreshColumns().then(() => {
+ assert.equal(
+ c.gridApi.grid.processColumnsProcessors.lastCall.args[0],
+ c.gridApi.grid.columns,
+ 'calls processColumnsProcessors with correct args'
+ );
+ assert.equal(
+ c.gridApi.grid.setVisibleColumns.lastCall.args[0],
+ c.gridApi.grid.columns,
+ 'calls setVisibleColumns with correct args'
+ );
+ assert.equal(
+ c.gridApi.grid.redrawInPlace.callCount,
+ 1,
+ 'calls redrawInPlace'
+ );
+ assert.equal(
+ c.gridApi.grid.refreshCanvas.lastCall.args[0],
+ true,
+ 'calls refreshCanvas with correct args'
+ );
+ });
+ });
+});
http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/components/grid-column-selector/index.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/grid-column-selector/index.js b/modules/web-console/frontend/app/components/grid-column-selector/index.js
new file mode 100644
index 0000000..16ef655
--- /dev/null
+++ b/modules/web-console/frontend/app/components/grid-column-selector/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-column-selector', [])
+ .component('gridColumnSelector', component);
http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/components/grid-column-selector/style.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/grid-column-selector/style.scss b/modules/web-console/frontend/app/components/grid-column-selector/style.scss
new file mode 100644
index 0000000..5e0d5d4
--- /dev/null
+++ b/modules/web-console/frontend/app/components/grid-column-selector/style.scss
@@ -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.
+ */
+
+grid-column-selector {
+ display: inline-block;
+
+ .btn-ignite, .icon {
+ margin: 0 !important;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/components/grid-column-selector/template.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/grid-column-selector/template.pug b/modules/web-console/frontend/app/components/grid-column-selector/template.pug
new file mode 100644
index 0000000..86fd152
--- /dev/null
+++ b/modules/web-console/frontend/app/components/grid-column-selector/template.pug
@@ -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.
+
+button.btn-ignite.btn-ignite--link-dashed-secondary(
+ protect-from-bs-select-render
+ bs-select
+ ng-model='$ctrl.selectedColumns'
+ ng-change='$ctrl.setSelectedColumns()'
+ ng-model-options='{debounce: {default: 5}}',
+ bs-options='column.name as column.name for column in $ctrl.columnsMenu'
+ bs-on-before-show='$ctrl.onShow'
+ data-multiple='true'
+ ng-transclude
+)
+ svg(ignite-icon='gear').icon
http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.categories.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.categories.js b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.categories.js
index 01b1fc8..e73dd17 100644
--- a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.categories.js
+++ b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.categories.js
@@ -16,15 +16,15 @@
*/
export default [
- {name: 'Actions', visible: false, selectable: false},
- {name: 'User', visible: true, selectable: false},
- {name: 'Email', visible: true, selectable: true},
- {name: 'Company', visible: true, selectable: true},
- {name: 'Country', visible: true, selectable: true},
- {name: 'Last login', visible: false, selectable: true},
- {name: 'Last activity', visible: true, selectable: true},
- {name: 'Configurations', visible: false, selectable: true},
- {name: 'Total activities', visible: true, selectable: true},
- {name: 'Configuration\'s activities', visible: false, selectable: true},
- {name: 'Queries\' activities', visible: false, selectable: true}
+ {name: 'Actions', visible: false, enableHiding: false},
+ {name: 'User', visible: true, enableHiding: false},
+ {name: 'Email', visible: true, enableHiding: true},
+ {name: 'Company', visible: true, enableHiding: true},
+ {name: 'Country', visible: true, enableHiding: true},
+ {name: 'Last login', visible: false, enableHiding: true},
+ {name: 'Last activity', visible: true, enableHiding: true},
+ {name: 'Configurations', visible: false, enableHiding: true},
+ {name: 'Total activities', visible: true, enableHiding: true},
+ {name: 'Configuration\'s activities', visible: false, enableHiding: true},
+ {name: 'Queries\' activities', visible: false, enableHiding: true}
];
http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.column-defs.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.column-defs.js b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.column-defs.js
index baf5aed..493c239 100644
--- a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.column-defs.js
+++ b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.column-defs.js
@@ -49,8 +49,8 @@ const ACTIONS_TEMPLATE = `
const EMAIL_TEMPLATE = '<div class="ui-grid-cell-contents"><a ng-href="mailto:{{ COL_FIELD }}">{{ COL_FIELD }}</a></div>';
export default [
- {name: 'actions', displayName: 'Actions', categoryDisplayName: 'Actions', cellTemplate: ACTIONS_TEMPLATE, field: 'actions', minWidth: 70, width: 70, enableFiltering: false, enableSorting: false, visible: false},
- {name: 'user', displayName: 'User', categoryDisplayName: 'User', field: 'userName', cellTemplate: USER_TEMPLATE, minWidth: 160, enableFiltering: true, pinnedLeft: true, filter: { placeholder: 'Filter by name...' }},
+ {name: 'actions', enableHiding: false, displayName: 'Actions', categoryDisplayName: 'Actions', cellTemplate: ACTIONS_TEMPLATE, field: 'actions', minWidth: 70, width: 70, enableFiltering: false, enableSorting: false, visible: false},
+ {name: 'user', enableHiding: false, displayName: 'User', categoryDisplayName: 'User', field: 'userName', cellTemplate: USER_TEMPLATE, minWidth: 160, enableFiltering: true, pinnedLeft: true, filter: { placeholder: 'Filter by name...' }},
{name: 'email', displayName: 'Email', categoryDisplayName: 'Email', field: 'email', cellTemplate: EMAIL_TEMPLATE, minWidth: 160, enableFiltering: true, filter: { placeholder: 'Filter by email...' }},
{name: 'company', displayName: 'Company', categoryDisplayName: 'Company', field: 'company', minWidth: 180, enableFiltering: true, filter: { placeholder: 'Filter by company...' }},
{name: 'country', displayName: 'Country', categoryDisplayName: 'Country', field: 'countryCode', minWidth: 160, enableFiltering: true, filter: { placeholder: 'Filter by country...' }},
http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.controller.js b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.controller.js
index c006003..58e93b4 100644
--- a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.controller.js
+++ b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.controller.js
@@ -246,52 +246,6 @@ export default class IgniteListOfRegisteredUsersCtrl {
this.selected = ids;
}
- _enableColumns(_categories, visible) {
- _.forEach(_categories, (cat) => {
- cat.visible = visible;
-
- _.forEach(this.gridOptions.columnDefs, (col) => {
- if (col.categoryDisplayName === cat.name)
- col.visible = visible;
- });
- });
-
- // Check to all selected columns.
- this.gridOptions.selectedAll = true;
- _.forEach(this._selectableColumns(), ({ visible }) => this.gridOptions.selectedAll = visible);
-
- // Workaround for this.gridApi.grid.refresh() didn't return promise.
- this.gridApi.grid.processColumnsProcessors(this.gridApi.grid.columns)
- .then((renderableColumns) => this.gridApi.grid.setVisibleColumns(renderableColumns))
- .then(() => this.gridApi.grid.redrawInPlace())
- .then(() => this.gridApi.grid.refreshCanvas(true))
- .then(() => {
- if (visible) {
- const categoryDisplayName = _.last(_categories).name;
-
- const col = _.findLast(this.gridOptions.columnDefs, {categoryDisplayName});
-
- this.gridApi.grid.scrollTo(null, col);
- }
- });
- }
-
- _selectableColumns() {
- return _.filter(this.gridOptions.categories, (cat) => cat.selectable);
- }
-
- toggleColumns(category, visible) {
- this._enableColumns([category], visible);
- }
-
- selectAllColumns() {
- this._enableColumns(this._selectableColumns(), true);
- }
-
- clearAllColumns() {
- this._enableColumns(this._selectableColumns(), false);
- }
-
exportCsv() {
this.gridApi.exporter.csvExport('visible', 'visible');
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.scss b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.scss
index d94fb2e..71d93a7 100644
--- a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.scss
+++ b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.scss
@@ -20,6 +20,9 @@ ignite-list-of-registered-users {
}
.list-of-registered-users {
+ .ui-grid-settings--heading {
+ display: flex;
+ }
& > a {
display: inline-block;
margin: 10px;
http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/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 85a2070..3558ab5 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
@@ -16,21 +16,6 @@
include /app/helpers/jade/mixins
-mixin grid-settings()
- .grid-settings
- svg(ignite-icon='gear' data-animation='am-flip-x' bs-dropdown='' aria-haspopup='true' aria-expanded='expanded' data-auto-close='1' data-trigger='click')
- ul.select.dropdown-menu(role='menu')
- li
- a(ng-click='$ctrl.gridOptions.selectedAll ? $ctrl.clearAllColumns() : $ctrl.selectAllColumns()')
- i.fa.fa-check-square-o.pull-left(ng-if='$ctrl.gridOptions.selectedAll')
- i.fa.fa-square-o.pull-left(ng-if='!$ctrl.gridOptions.selectedAll')
- span All
- li(ng-repeat='item in $ctrl.gridOptions.categories|filter:{selectable:true}')
- a(ng-click='$ctrl.toggleColumns(item, !item.visible)')
- i.fa.fa-check-square-o.pull-left(ng-if='item.visible')
- i.fa.fa-square-o.pull-left(ng-if='!item.visible')
- span {{::item.name}}
-
.list-of-registered-users
ul.tabs.tabs--blue
li(role='presentation' ng-class='{ active: $ctrl.groupBy === "user" }')
@@ -52,7 +37,14 @@ mixin grid-settings()
.panel--ignite
.panel-heading.ui-grid-settings
.panel-title
- +ignite-form-field-bsdropdown('Actions', '$ctrl.action', 'action', '!$ctrl.selected.length', false, '$ctrl.actionOptions')
+ +ignite-form-field-bsdropdown({
+ label: 'Actions',
+ model: '$ctrl.action',
+ name: 'action',
+ disabled: '!$ctrl.selected.length',
+ required: false,
+ options: '$ctrl.actionOptions'
+ })
button.btn-ignite.btn-ignite--primary-outline(ng-click='$ctrl.exportCsv()' bs-tooltip='' data-title='Export table to csv' data-placement='top')
svg(ignite-icon='csv')
form.ui-grid-settings-dateperiod(name=form novalidate)
@@ -67,7 +59,7 @@ mixin grid-settings()
span(ng-if='$ctrl.groupBy === "user"') List of registered users
span(ng-if='$ctrl.groupBy === "company"') List of registered companies
span(ng-if='$ctrl.groupBy === "country"') List of registered countries
- +grid-settings
+ grid-column-selector(grid-api='$ctrl.gridApi')
.panel-selected(ng-show='$ctrl.selected.length')
| {{ $ctrl.selected.length }} item{{ $ctrl.selected.length > 1 ? 's' : '' }} selected
http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/components/page-configure-basic/components/pcbProtectFromBsSelectRender.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure-basic/components/pcbProtectFromBsSelectRender.js b/modules/web-console/frontend/app/components/page-configure-basic/components/pcbProtectFromBsSelectRender.js
deleted file mode 100644
index 5d0ef53..0000000
--- a/modules/web-console/frontend/app/components/page-configure-basic/components/pcbProtectFromBsSelectRender.js
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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 function pcbProtectFromBsSelectRender() {
- return {
- link(scope, el, attr, ctrl) {
- const {$render} = ctrl;
-
- Object.defineProperty(ctrl, '$render', {
- set() {},
- get() {
- return $render;
- }
- });
- },
- require: 'ngModel'
- };
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/components/page-configure-basic/index.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure-basic/index.js b/modules/web-console/frontend/app/components/page-configure-basic/index.js
index 1bec7cb..21ae777 100644
--- a/modules/web-console/frontend/app/components/page-configure-basic/index.js
+++ b/modules/web-console/frontend/app/components/page-configure-basic/index.js
@@ -20,12 +20,10 @@ import angular from 'angular';
import component from './component';
import service from './service';
-import pcbProtectFromBsSelectRender from './components/pcbProtectFromBsSelectRender';
import pcbScaleNumber from './components/pcbScaleNumber';
export default angular
.module('ignite-console.page-configure-basic', [])
.component('pageConfigureBasic', component)
- .directive('pcbProtectFromBsSelectRender', pcbProtectFromBsSelectRender)
.directive('pcbScaleNumber', pcbScaleNumber)
.service('PageConfigureBasic', service);
http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/components/page-configure-basic/template.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure-basic/template.pug b/modules/web-console/frontend/app/components/page-configure-basic/template.pug
index 36dfb20..ab8f43c 100644
--- a/modules/web-console/frontend/app/components/page-configure-basic/template.pug
+++ b/modules/web-console/frontend/app/components/page-configure-basic/template.pug
@@ -99,7 +99,7 @@ form(novalidate name=form)
bs-select
bs-options='size as size.label for size in $ctrl.sizesMenu'
ng-model='$ctrl.memorySizeScale'
- pcb-protect-from-bs-select-render
+ protect-from-bs-select-render
)
| {{ $ctrl.memorySizeScale.label }}
span.fa.fa-caret-down.icon-right
@@ -153,7 +153,7 @@ form(novalidate name=form)
bs-options='cache._id as cache.name for cache in $ctrl.cachesMenu'
data-multiple='true'
data-placement='top-left'
- pcb-protect-from-bs-select-render
+ protect-from-bs-select-render
)
| + Select from existing caches
http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/components/protect-from-bs-select-render/directive.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/protect-from-bs-select-render/directive.js b/modules/web-console/frontend/app/components/protect-from-bs-select-render/directive.js
new file mode 100644
index 0000000..e51d477
--- /dev/null
+++ b/modules/web-console/frontend/app/components/protect-from-bs-select-render/directive.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 function protectFromBsSelectRender() {
+ return {
+ link(scope, el, attr, ctrl) {
+ const {$render} = ctrl;
+
+ Object.defineProperty(ctrl, '$render', {
+ set() {},
+ get() {
+ return $render;
+ }
+ });
+ },
+ require: 'ngModel'
+ };
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/components/protect-from-bs-select-render/index.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/protect-from-bs-select-render/index.js b/modules/web-console/frontend/app/components/protect-from-bs-select-render/index.js
new file mode 100644
index 0000000..fd63000
--- /dev/null
+++ b/modules/web-console/frontend/app/components/protect-from-bs-select-render/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 directive from './directive';
+
+export default angular
+ .module('ignite-console.protect-from-bs-select-render', [])
+ .directive('protectFromBsSelectRender', directive);
http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/helpers/jade/mixins.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/helpers/jade/mixins.pug b/modules/web-console/frontend/app/helpers/jade/mixins.pug
index 9dfdab3..fc193eb 100644
--- a/modules/web-console/frontend/app/helpers/jade/mixins.pug
+++ b/modules/web-console/frontend/app/helpers/jade/mixins.pug
@@ -20,7 +20,6 @@ include ../../primitives/datepicker/index
include ../../primitives/timepicker/index
include ../../primitives/dropdown/index
include ../../primitives/tooltip/index
-include ../../primitives/ui-grid-settings/index
include ../../primitives/switcher/index
//- Mixin for advanced options toggle.
http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/modules/sql/sql.controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/sql/sql.controller.js b/modules/web-console/frontend/app/modules/sql/sql.controller.js
index 5c678d6..633f167 100644
--- a/modules/web-console/frontend/app/modules/sql/sql.controller.js
+++ b/modules/web-console/frontend/app/modules/sql/sql.controller.js
@@ -57,25 +57,6 @@ class Paragraph {
_.assign(this, paragraph);
- const _enableColumns = (categories, visible) => {
- _.forEach(categories, (cat) => {
- cat.visible = visible;
-
- _.forEach(this.gridOptions.columnDefs, (col) => {
- if (col.displayName === cat.name)
- col.visible = visible;
- });
- });
-
- this.gridOptions.api.grid.refresh();
- };
-
- const _selectableColumns = () => _.filter(this.gridOptions.categories, (cat) => cat.selectable);
-
- this.toggleColumns = (category, visible) => _enableColumns([category], visible);
- this.selectAllColumns = () => _enableColumns(_selectableColumns(), true);
- this.clearAllColumns = () => _enableColumns(_selectableColumns(), false);
-
Object.defineProperty(this, 'gridOptions', {value: {
enableGridMenu: false,
enableColumnMenus: false,
@@ -101,7 +82,7 @@ class Paragraph {
this.categories.push({
name: col.fieldName,
visible: self.columnFilter(col),
- selectable: true
+ enableHiding: true
});
return cols;
http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/primitives/btn/index.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/primitives/btn/index.scss b/modules/web-console/frontend/app/primitives/btn/index.scss
index 6fb76c8..94b5bd2 100644
--- a/modules/web-console/frontend/app/primitives/btn/index.scss
+++ b/modules/web-console/frontend/app/primitives/btn/index.scss
@@ -17,6 +17,9 @@
@import "./../../../public/stylesheets/variables.scss";
+$btn-content-padding: 10px 12px;
+$btn-content-padding-with-border: 9px 11px;
+
@mixin active-focus-shadows(
$focus: (0 0 5px #095d9a, 0 0 5px #095d9a),
$active: (inset 0 1px 3px 0 rgba(0, 0, 0, 0.5))
@@ -39,7 +42,6 @@
}
.btn-ignite {
- $content-padding: 10px 12px;
$icon-margin: 8px;
display: inline-flex;
@@ -48,7 +50,7 @@
align-items: center;
box-sizing: border-box;
margin: 0;
- padding: $content-padding;
+ padding: $btn-content-padding;
border: none;
border-radius: $ignite-button-border-radius;
@@ -128,6 +130,7 @@
border: 1px solid $accent-color;
background: white;
color: $accent-color;
+ padding: $btn-content-padding-with-border;
&:hover, &.hover,
&:active, &.active {
@@ -248,6 +251,7 @@
background-color: white;
color: #424242;
border: 1px solid #dedede;
+ padding: $btn-content-padding-with-border;
&:hover, &.hover,
&:active, &.active {
http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/primitives/dropdown/index.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/primitives/dropdown/index.pug b/modules/web-console/frontend/app/primitives/dropdown/index.pug
index 3a5f1b1..c145244 100644
--- a/modules/web-console/frontend/app/primitives/dropdown/index.pug
+++ b/modules/web-console/frontend/app/primitives/dropdown/index.pug
@@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-mixin ignite-form-field-bsdropdown(label, model, name, disabled, required, options, tip)
+mixin ignite-form-field-bsdropdown({label, model, name, disabled, required, options, tip})
.dropdown--ignite.ignite-form-field
.btn-ignite.btn-ignite--primary-outline(
data-ng-model=model
http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/app/primitives/ui-grid-settings/index.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/primitives/ui-grid-settings/index.pug b/modules/web-console/frontend/app/primitives/ui-grid-settings/index.pug
deleted file mode 100644
index 8f1487e..0000000
--- a/modules/web-console/frontend/app/primitives/ui-grid-settings/index.pug
+++ /dev/null
@@ -1,33 +0,0 @@
-//-
- 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.
-
-mixin ui-grid-settings()
- .ui-grid-settings
- i.fa.fa-bars(data-animation='am-flip-x' bs-dropdown='' aria-haspopup='true' aria-expanded='expanded' data-auto-close='1' data-trigger='click')
- ul.select.dropdown-menu(role='menu')
- li(ng-repeat='item in paragraph.gridOptions.categories|filter:{selectable:true}')
- a(ng-click='paragraph.toggleColumns(item, !item.visible)')
- i.fa.fa-check-square-o.pull-left(ng-if='item.visible')
- i.fa.fa-square-o.pull-left(ng-if='!item.visible')
- span {{::item.name}}
- li.divider
- li
- a(ng-click='paragraph.selectAllColumns()') Select all
- li
- a(ng-click='paragraph.clearAllColumns()') Clear all
- li.divider
- li
- a(ng-click='$hide()') Close
http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/public/stylesheets/style.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/public/stylesheets/style.scss b/modules/web-console/frontend/public/stylesheets/style.scss
index 857cdce..305e7f7 100644
--- a/modules/web-console/frontend/public/stylesheets/style.scss
+++ b/modules/web-console/frontend/public/stylesheets/style.scss
@@ -604,6 +604,19 @@ button.form-control {
padding: 5px 10px;
}
+
+ grid-column-selector {
+ margin-right: 5px;
+
+ .btn-ignite {
+ padding: 5px 0;
+ box-shadow: none !important;
+
+ .fa {
+ font-size: 14px;
+ }
+ }
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4a1fef5c/modules/web-console/frontend/views/sql/sql.tpl.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/sql/sql.tpl.pug b/modules/web-console/frontend/views/sql/sql.tpl.pug
index 94251f9..f215c43 100644
--- a/modules/web-console/frontend/views/sql/sql.tpl.pug
+++ b/modules/web-console/frontend/views/sql/sql.tpl.pug
@@ -124,7 +124,8 @@ mixin query-actions
mixin table-result-heading-query
.total.row
.col-xs-4
- +ui-grid-settings
+ grid-column-selector(grid-api='paragraph.gridOptions.api')
+ .fa.fa-bars.icon
label Page: #[b {{paragraph.page}}]
label.margin-left-dflt Results so far: #[b {{paragraph.rows.length + paragraph.total}}]
label.margin-left-dflt Duration: #[b {{paragraph.duration | duration}}]
@@ -139,7 +140,8 @@ mixin table-result-heading-query
mixin table-result-heading-scan
.total.row
.col-xs-4
- +ui-grid-settings
+ grid-column-selector(grid-api='paragraph.gridOptions.api')
+ .fa.fa-bars.icon
label Page: #[b {{paragraph.page}}]
label.margin-left-dflt Results so far: #[b {{paragraph.rows.length + paragraph.total}}]
label.margin-left-dflt Duration: #[b {{paragraph.duration | duration}}]
[7/7] ignite git commit: Merge remote-tracking branch
'remotes/community/ignite-2.1.2' into ignite-gg-12389
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/community/ignite-2.1.2' into ignite-gg-12389
# Conflicts:
# modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c22a7f54
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c22a7f54
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c22a7f54
Branch: refs/heads/ignite-gg-12389
Commit: c22a7f547b5097333c56df7096b75e327fdb9b67
Parents: 3443d88 18bbb14
Author: sboikov <sb...@gridgain.com>
Authored: Fri Jun 30 21:28:35 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Jun 30 21:28:35 2017 +0300
----------------------------------------------------------------------
.../cache/CacheAffinitySharedManager.java | 26 +-
.../processors/cache/ClusterCachesInfo.java | 13 +-
.../cache/DynamicCacheChangeRequest.java | 1 +
.../processors/cache/ExchangeActions.java | 109 ++++-
.../processors/cache/GridCacheProcessor.java | 58 ++-
.../distributed/near/GridNearCacheAdapter.java | 4 +-
.../near/GridCacheNearEvictionSelfTest.java | 5 +-
.../near/GridCacheNearMetricsSelfTest.java | 29 +-
modules/web-console/frontend/.eslintrc | 2 +-
modules/web-console/frontend/app/app.js | 4 +
.../app/components/bs-select-menu/style.scss | 1 +
.../grid-column-selector/component.js | 29 ++
.../grid-column-selector/controller.js | 111 +++++
.../grid-column-selector/controller.spec.js | 435 +++++++++++++++++++
.../components/grid-column-selector/index.js | 24 +
.../components/grid-column-selector/style.scss | 24 +
.../grid-column-selector/template.pug | 28 ++
.../list-of-registered-users.categories.js | 22 +-
.../list-of-registered-users.column-defs.js | 4 +-
.../list-of-registered-users.controller.js | 46 --
.../list-of-registered-users.scss | 3 +
.../list-of-registered-users.tpl.pug | 26 +-
.../components/pcbProtectFromBsSelectRender.js | 32 --
.../components/page-configure-basic/index.js | 2 -
.../page-configure-basic/template.pug | 4 +-
.../protect-from-bs-select-render/directive.js | 32 ++
.../protect-from-bs-select-render/index.js | 24 +
.../frontend/app/helpers/jade/mixins.pug | 1 -
.../frontend/app/modules/sql/sql.controller.js | 21 +-
.../frontend/app/primitives/btn/index.scss | 8 +-
.../frontend/app/primitives/dropdown/index.pug | 2 +-
.../app/primitives/ui-grid-settings/index.pug | 33 --
.../frontend/public/stylesheets/style.scss | 17 +
.../web-console/frontend/views/sql/sql.tpl.pug | 6 +-
34 files changed, 942 insertions(+), 244 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c22a7f54/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c22a7f54/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c22a7f54/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c22a7f54/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeActions.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeActions.java
index a2fe129,9caf9aa..04b15ee
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeActions.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeActions.java
@@@ -50,9 -50,32 +50,32 @@@ public class ExchangeActions
private Map<String, ActionData> cachesToResetLostParts;
/** */
- private ClusterState newState;
+ private StateChangeRequest stateChangeReq;
/**
+ * @param grpId Group ID.
+ * @return Always {@code true}, fails with assert error if inconsistent.
+ */
+ boolean checkStopRequestConsistency(int grpId) {
+ Boolean destroy = null;
+
+ // Check that caches associated with that group will be all stopped only or all destroyed.
+ for (ExchangeActions.ActionData action : cacheStopRequests()) {
+ if (action.descriptor().groupId() == grpId) {
+ if (destroy == null)
+ destroy = action.request().destroy();
+ else {
+ assert action.request().destroy() == destroy
+ : "Both cache stop only and cache destroy request associated with one group in batch "
+ + cacheStopRequests();
+ }
+ }
+ }
+
+ return true;
+ }
+
+ /**
* @return {@code True} if server nodes should not participate in exchange.
*/
public boolean clientOnlyExchange() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/c22a7f54/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index 8fc55bd,bb6d068..1bf30cd
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@@ -2087,36 -2114,33 +2087,30 @@@ public class GridCacheProcessor extend
) {
initCacheProxies(topVer, err);
- if (exchActions != null && exchActions.systemCachesStarting() && exchActions.stateChangeRequest() == null)
- ctx.dataStructures().restoreStructuresState(ctx);
-
- if (exchActions != null && err == null) {
- Collection<IgniteBiTuple<CacheGroupContext, Boolean>> stoppedGrps = null;
-
- boolean forceCheckpoint = false;
-
- for (ExchangeActions.ActionData action : exchActions.cacheStopRequests()) {
- GridCacheContext<?, ?> stopCtx;
- boolean destroy;
+ if (exchActions == null)
+ return;
- if (!forceCheckpoint){
- try {
- sharedCtx.database().waitForCheckpoint("caches stop");
- }
- catch (IgniteCheckedException e) {
- U.error(log, "Failed to wait for checkpoint finish during cache stop.", e);
- }
- if (exchActions.systemCachesStarting() && exchActions.newClusterState() == null)
++ if (exchActions.systemCachesStarting() && exchActions.stateChangeRequest() == null)
+ ctx.dataStructures().restoreStructuresState(ctx);
- forceCheckpoint = true;
+ if (err == null) {
+ // Force checkpoint if there is any cache stop request
+ if (exchActions.cacheStopRequests().size() > 0) {
+ try {
+ sharedCtx.database().waitForCheckpoint("caches stop");
+ }
+ catch (IgniteCheckedException e) {
+ U.error(log, "Failed to wait for checkpoint finish during cache stop.", e);
}
+ }
+ for (ExchangeActions.ActionData action : exchActions.cacheStopRequests()) {
stopGateway(action.request());
sharedCtx.database().checkpointReadLock();
try {
- stopCtx = prepareCacheStop(action.request().cacheName(), action.request().destroy());
- destroy = action.request().destroy();
+ prepareCacheStop(action.request().cacheName(), action.request().destroy());
-
- if (exchActions.newClusterState() == null)
- ctx.state().onCacheStop(action.request());
}
finally {
sharedCtx.database().checkpointReadUnlock();
[5/7] ignite git commit: gg-12389
Posted by sb...@apache.org.
gg-12389
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3443d888
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3443d888
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3443d888
Branch: refs/heads/ignite-gg-12389
Commit: 3443d888cce6336eb4866b33a5eb5c8ca89bd4e7
Parents: 66f5eab
Author: sboikov <sb...@gridgain.com>
Authored: Fri Jun 30 16:33:52 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Jun 30 20:07:56 2017 +0300
----------------------------------------------------------------------
.../processors/cache/ClusterCachesInfo.java | 40 +++-
.../processors/cache/GridCacheProcessor.java | 8 +
.../GridDhtPartitionsExchangeFuture.java | 67 +++++-
.../cluster/GridClusterStateProcessor.java | 19 +-
.../IgniteClusterActivateDeactivateTest.java | 211 ++++++++++++++++---
5 files changed, 299 insertions(+), 46 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3443d888/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
index a5d68bc..85c5600 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
@@ -40,7 +40,7 @@ import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cluster.DiscoveryDataClusterState;
+import org.apache.ignite.internal.processors.cluster.ChangeGlobalStateFinishMessage;
import org.apache.ignite.internal.processors.query.QuerySchema;
import org.apache.ignite.internal.processors.query.QueryUtils;
import org.apache.ignite.internal.processors.query.schema.SchemaOperationException;
@@ -98,6 +98,9 @@ class ClusterCachesInfo {
/** */
private Map<UUID, CacheClientReconnectDiscoveryData> clientReconnectReqs;
+ /** */
+ private boolean joinOnTransition;
+
/**
* @param ctx Context.
*/
@@ -951,11 +954,17 @@ class ClusterCachesInfo {
private void initStartCachesForLocalJoin(boolean firstNode) {
assert locJoinStartCaches == null;
- locJoinStartCaches = new ArrayList<>();
- locCfgsForActivation = new HashMap<>();
-
if (joinDiscoData != null) {
- boolean active = ctx.state().clusterState().active() && !ctx.state().clusterState().transition();
+ if (ctx.state().clusterState().transition()) {
+ joinOnTransition = true;
+
+ return;
+ }
+
+ locJoinStartCaches = new ArrayList<>();
+ locCfgsForActivation = new HashMap<>();
+
+ boolean active = ctx.state().clusterState().active() && !ctx.state().clusterState().transition();
for (DynamicCacheDescriptor desc : registeredCaches.values()) {
if (firstNode && !joinDiscoData.caches().containsKey(desc.cacheName()))
@@ -1006,6 +1015,17 @@ class ClusterCachesInfo {
}
/**
+ *
+ */
+ void onStateChangeFinish(ChangeGlobalStateFinishMessage msg) {
+ if (joinOnTransition) {
+ initStartCachesForLocalJoin(false);
+
+ joinOnTransition = false;
+ }
+ }
+
+ /**
* @param exchangeActions Exchange actions to modify.
*/
void onStateChangeRequest(ExchangeActions exchangeActions) {
@@ -1040,7 +1060,15 @@ class ClusterCachesInfo {
exchangeActions.addCacheGroupToStart(grpDesc);
}
else {
- // TODO GG-12389.
+ for (DynamicCacheDescriptor desc : registeredCaches.values()) {
+ DynamicCacheChangeRequest req =
+ DynamicCacheChangeRequest.stopRequest(ctx, desc.cacheName(), desc.sql(), false);
+
+ exchangeActions.addCacheToStop(req, desc);
+ }
+
+ for (CacheGroupDescriptor grpDesc : registeredCacheGroups().values())
+ exchangeActions.addCacheGroupToStop(grpDesc);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3443d888/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index ac01ea0..8fc55bd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -107,6 +107,7 @@ import org.apache.ignite.internal.processors.cache.transactions.IgniteTransactio
import org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersionManager;
import org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessor;
+import org.apache.ignite.internal.processors.cluster.ChangeGlobalStateFinishMessage;
import org.apache.ignite.internal.processors.cluster.DiscoveryDataClusterState;
import org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor;
import org.apache.ignite.internal.processors.plugin.CachePluginManager;
@@ -2287,6 +2288,13 @@ public class GridCacheProcessor extends GridProcessorAdapter {
}
/**
+ * @param msg Message.
+ */
+ public void onStateChangeFinish(ChangeGlobalStateFinishMessage msg) {
+ cachesInfo.onStateChangeFinish(msg);
+ }
+
+ /**
* @param exchangeActions Exchange actions to modify.
*/
public void onStateChangeRequest(ExchangeActions exchangeActions) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/3443d888/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index b10c25c..edd9d63 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -742,16 +742,69 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
* @throws IgniteCheckedException If failed.
*/
private ExchangeType onClusterStateChangeRequest(boolean crd) throws IgniteCheckedException {
- assert exchActions != null && !exchActions.empty() && exchActions.stateChangeRequest() != null : this;
+ assert exchActions != null && !exchActions.empty() : this;
+
+ StateChangeRequest req = exchActions.stateChangeRequest();
+
+ assert req != null : exchActions;
+
+ if (req.activate()) {
+ if (log.isInfoEnabled()) {
+ log.info("Start activation process [nodeId=" + cctx.localNodeId() +
+ ", client=" + cctx.kernalContext().clientNode() +
+ ", topVer=" + topologyVersion() + "]");
+ }
+
+ try {
+ cctx.activate();
- changeGlobalStateE = cctx.kernalContext().state().changeGlobalState(exchActions.stateChangeRequest());
+ cctx.affinity().onCacheChangeRequest(this, crd, exchActions);
- if (changeGlobalStateE != null) {
- if (crd)
- changeGlobalStateExceptions.put(cctx.localNodeId(), changeGlobalStateE);
+ if (log.isInfoEnabled()) {
+ log.info("Successfully activated caches [nodeId=" + cctx.localNodeId() +
+ ", client=" + cctx.kernalContext().clientNode() +
+ ", topVer=" + topologyVersion() + "]");
+ }
+ }
+ catch (Exception e) {
+ U.error(log, "Failed to activate node components [nodeId=" + cctx.localNodeId() +
+ ", client=" + cctx.kernalContext().clientNode() +
+ ", topVer=" + topologyVersion() + "]", e);
+
+ changeGlobalStateE = e;
+ }
+ }
+ else {
+ if (log.isInfoEnabled()) {
+ log.info("Start deactivation process [nodeId=" + cctx.localNodeId() +
+ ", client=" + cctx.kernalContext().clientNode() +
+ ", topVer=" + topologyVersion() + "]");
+ }
+
+ try {
+ cctx.kernalContext().dataStructures().onDeActivate(cctx.kernalContext());
+
+ cctx.kernalContext().service().onDeActivate(cctx.kernalContext());
+
+ cctx.affinity().onCacheChangeRequest(this, crd, exchActions);
+
+ cctx.deactivate();
+
+ if (log.isInfoEnabled()) {
+ log.info("Successfully deactivated data structures, services and caches [" +
+ "nodeId=" + cctx.localNodeId() +
+ ", client=" + cctx.kernalContext().clientNode() +
+ ", topVer=" + topologyVersion() + "]");
+ }
+ }
+ catch (Exception e) {
+ U.error(log, "Failed to deactivate node components [nodeId=" + cctx.localNodeId() +
+ ", client=" + cctx.kernalContext().clientNode() +
+ ", topVer=" + topologyVersion() + "]", e);
+
+ changeGlobalStateE = e;
+ }
}
- else
- cctx.affinity().onCacheChangeRequest(this, crd, exchActions);
return cctx.kernalContext().clientNode() ? ExchangeType.CLIENT : ExchangeType.ALL;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3443d888/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
index 6f1f769..3a2811a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
@@ -165,8 +165,11 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
if (joinFut != null)
joinFut.onDone(msg.clusterActive());
- if (msg.requestId().equals(globalState.transitionRequestId()))
+ if (msg.requestId().equals(globalState.transitionRequestId())) {
globalState = DiscoveryDataClusterState.createState(msg.clusterActive());
+
+ ctx.cache().onStateChangeFinish(msg);
+ }
}
/**
@@ -410,8 +413,6 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
sharedCtx.affinity().removeAllCacheInfo();
- ctx.discovery().cleanCachesAndGroups();
-
if (!ctx.clientNode()) {
sharedCtx.database().onDeActivate(ctx);
@@ -849,6 +850,7 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
/**
* @param state Current state.
+ * @param discoCache Discovery data cache.
*/
TransitionOnJoinWaitFuture(DiscoveryDataClusterState state, DiscoCache discoCache) {
assert state.transition() : state;
@@ -860,5 +862,16 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
transitionNodes.add(nodeId);
}
}
+
+ /** {@inheritDoc} */
+ @Override public boolean onDone(@Nullable Boolean res, @Nullable Throwable err) {
+ if (super.onDone(res, err)) {
+ joinFut = null;
+
+ return true;
+ }
+
+ return false;
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3443d888/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java
index f5cbc56..580c0d3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java
@@ -21,6 +21,7 @@ import java.util.concurrent.Callable;
import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cluster.ClusterNode;
@@ -30,7 +31,9 @@ import org.apache.ignite.configuration.MemoryConfiguration;
import org.apache.ignite.configuration.PersistentStoreConfiguration;
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.TestRecordingCommunicationSpi;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsSingleMessage;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiPredicate;
@@ -157,7 +160,7 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest
/**
* @param srvs Number of servers.
* @param clients Number of clients.
- * @param activateFrom Index of node running activation.
+ * @param activateFrom Index of node stating activation.
* @throws Exception If failed.
*/
private void activateSimple(int srvs, int clients, int activateFrom) throws Exception {
@@ -165,38 +168,49 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest
final int CACHES = 2;
- for (int i = 0; i < srvs; i++) {
- client = false;
+ for (int i = 0; i < srvs + clients; i++) {
+ client = i >= srvs;
ccfgs = cacheConfigurations1();
startGrid(i);
- }
-
- for (int i = 0; i < clients; i++) {
- client = true;
-
- ccfgs = cacheConfigurations1();
- startGrid(srvs + i);
+ checkNoCaches(i);
}
+ for (int i = 0; i < srvs + clients; i++)
+ assertFalse(ignite(i).active());
+
ignite(activateFrom).active(false); // Should be no-op.
ignite(activateFrom).active(true);
+ for (int i = 0; i < srvs + clients; i++)
+ assertTrue(ignite(i).active());
+
+ for (int i = 0; i < srvs + clients; i++) {
+ for (int c = 0; c < 2; c++)
+ checkCache(ignite(i), CACHE_NAME_PREFIX + c, true);
+ }
+
checkCaches(srvs + clients, CACHES);
client = false;
startGrid(srvs + clients);
+ for (int c = 0; c < 2; c++)
+ checkCache(ignite(srvs + clients), CACHE_NAME_PREFIX + c, true);
+
checkCaches(srvs + clients + 1, CACHES);
client = true;
startGrid(srvs + clients + 1);
+ for (int c = 0; c < 2; c++)
+ checkCache(ignite(srvs + clients + 1), CACHE_NAME_PREFIX + c, false);
+
checkCaches(srvs + clients + 2, CACHES);
}
@@ -225,11 +239,79 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest
/**
* @throws Exception If failed.
*/
- public void testJoinWhileActivate1() throws Exception {
+ public void testJoinWhileActivate1_Server() throws Exception {
+ joinWhileActivate1(false, false);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testJoinWhileActivate1_WithCache_Server() throws Exception {
+ joinWhileActivate1(false, true);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testJoinWhileActivate1_Client() throws Exception {
+ joinWhileActivate1(true, false);
+ }
+
+ /**
+ * @param startClient If {@code true} joins client node, otherwise server.
+ * @param withNewCache If {@code true} joining node has new cache in configuration.
+ * @throws Exception If failed.
+ */
+ private void joinWhileActivate1(final boolean startClient, final boolean withNewCache) throws Exception {
+ IgniteInternalFuture<?> activeFut = startNodesAndBlockActivation(2, 0);
+
+ IgniteInternalFuture<?> startFut = GridTestUtils.runAsync(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ client = startClient;
+
+ ccfgs = withNewCache ? cacheConfigurations2() : cacheConfigurations1();
+
+ startGrid(2);
+
+ return null;
+ }
+ });
+
+ TestRecordingCommunicationSpi spi1 = TestRecordingCommunicationSpi.spi(ignite(1));
+
+ spi1.stopBlock();
+
+ activeFut.get();
+ startFut.get();
+
+ for (int c = 0; c < 2; c++)
+ checkCache(ignite(2), CACHE_NAME_PREFIX + c, true);
+
+ if (withNewCache) {
+ for (int i = 0; i < 3; i++) {
+ for (int c = 0; c < 4; c++)
+ checkCache(ignite(i), CACHE_NAME_PREFIX + c, true);
+ }
+ }
+
+ awaitPartitionMapExchange();
+
+ checkCaches(3, withNewCache ? 4 : 2);
+ }
+
+ /**
+ * @param srvs Number of servers.
+ * @param clients Number of clients.
+ * @return Activation future.
+ * @throws Exception If failed.
+ */
+ private IgniteInternalFuture<?> startNodesAndBlockActivation(int srvs, int clients) throws Exception {
active = false;
testSpi = true;
- for (int i = 0; i < 2; i++) {
+ for (int i = 0; i < srvs + clients; i++) {
+ client = i >= srvs;
+
ccfgs = cacheConfigurations1();
startGrid(i);
@@ -237,12 +319,14 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest
TestRecordingCommunicationSpi spi1 = TestRecordingCommunicationSpi.spi(ignite(1));
+ final AffinityTopologyVersion ACTIVATE_TOP_VER = new AffinityTopologyVersion(srvs + clients, 1);
+
spi1.blockMessages(new IgniteBiPredicate<ClusterNode, Message>() {
@Override public boolean apply(ClusterNode clusterNode, Message msg) {
if (msg instanceof GridDhtPartitionsSingleMessage) {
GridDhtPartitionsSingleMessage pMsg = (GridDhtPartitionsSingleMessage)msg;
- if (pMsg.exchangeId() != null && pMsg.exchangeId().topologyVersion().topologyVersion() == 2)
+ if (pMsg.exchangeId() != null && pMsg.exchangeId().topologyVersion().equals(ACTIVATE_TOP_VER))
return true;
}
@@ -262,28 +346,13 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest
assertFalse(activeFut.isDone());
- IgniteInternalFuture<?> startFut = GridTestUtils.runAsync(new Callable<Void>() {
- @Override public Void call() throws Exception {
- ccfgs = cacheConfigurations1();
-
- startGrid(2);
-
- return null;
- }
- });
-
- spi1.stopBlock();
-
- activeFut.get();
- startFut.get();
-
- checkCaches(3, 2);
+ return activeFut;
}
/**
* @throws Exception If failed.
*/
- public void testJoinAndActivate() throws Exception {
+ public void testConcurrentJoinAndActivate() throws Exception {
for (int iter = 0; iter < 3; iter++) {
log.info("Iteration: " + iter);
@@ -335,6 +404,48 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest
}
/**
+ * @throws Exception If failed.
+ */
+ public void testDeactivateSimpleSingleNode() throws Exception {
+ deactivateSimple(1, 0, 0);
+ }
+
+ /**
+ * @param srvs Number of servers.
+ * @param clients Number of clients.
+ * @param deactivateFrom Index of node stating deactivation.
+ * @throws Exception If failed.
+ */
+ private void deactivateSimple(int srvs, int clients, int deactivateFrom) throws Exception {
+ active = true;
+
+ final int CACHES = 2;
+
+ for (int i = 0; i < srvs + clients; i++) {
+ client = i >= srvs;
+
+ ccfgs = cacheConfigurations1();
+
+ startGrid(i);
+ }
+
+ if (persistenceEnabled())
+ ignite(deactivateFrom).active(true);
+
+ ignite(deactivateFrom).active(true); // Should be no-op.
+
+ checkCaches(srvs + clients, CACHES);
+
+ for (int i = 0; i < srvs + clients; i++)
+ assertTrue(ignite(i).active());
+
+ ignite(deactivateFrom).active(false);
+
+ for (int i = 0; i < srvs + clients; i++)
+ assertFalse(ignite(i).active());
+ }
+
+ /**
* @return Cache configurations.
*/
private CacheConfiguration[] cacheConfigurations1() {
@@ -347,6 +458,20 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest
}
/**
+ * @return Cache configurations.
+ */
+ private CacheConfiguration[] cacheConfigurations2() {
+ CacheConfiguration[] ccfgs = new CacheConfiguration[4];
+
+ ccfgs[0] = cacheConfigurations(CACHE_NAME_PREFIX + 0, ATOMIC);
+ ccfgs[1] = cacheConfigurations(CACHE_NAME_PREFIX + 1, TRANSACTIONAL);
+ ccfgs[2] = cacheConfigurations(CACHE_NAME_PREFIX + 2, ATOMIC);
+ ccfgs[3] = cacheConfigurations(CACHE_NAME_PREFIX + 3, TRANSACTIONAL);
+
+ return ccfgs;
+ }
+
+ /**
* @param name Cache name.
* @param atomicityMode Atomicity mode.
* @return Cache configuration.
@@ -360,4 +485,30 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest
return ccfg;
}
+
+ /**
+ * @param cacheName Cache name.
+ * @param node Node.
+ * @param exp {@code True} if expect that cache is started on node.
+ */
+ private void checkCache(Ignite node, String cacheName, boolean exp) {
+ GridCacheAdapter cache = ((IgniteKernal)node).context().cache().internalCache(cacheName);
+
+ if (exp)
+ assertNotNull(cache);
+ else
+ assertNull(cache);
+ }
+
+ /**
+ * @param nodes Number of nodes.
+ */
+ private void checkNoCaches(int nodes) {
+ for (int i = 0; i < nodes; i++) {
+ GridCacheProcessor cache = ((IgniteKernal)ignite(i)).context().cache();
+
+ assertTrue(cache.caches().isEmpty());
+ assertTrue(cache.internalCaches().isEmpty());
+ }
+ }
}