Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/ignite into ignite-5975
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/knn/KNNClassificationExample.java b/examples/src/main/java/org/apache/ignite/examples/ml/knn/KNNClassificationExample.java
new file mode 100644
index 0000000..f3cdbbe
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/ml/knn/KNNClassificationExample.java
@@ -0,0 +1,272 @@
+/*
+ * 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.
+ */
+
+package org.apache.ignite.examples.ml.knn;
+
+import java.util.Arrays;
+import java.util.UUID;
+import javax.cache.Cache;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+import org.apache.ignite.cache.query.QueryCursor;
+import org.apache.ignite.cache.query.ScanQuery;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.ml.dataset.impl.cache.CacheBasedDatasetBuilder;
+import org.apache.ignite.ml.knn.classification.KNNClassificationModel;
+import org.apache.ignite.ml.knn.classification.KNNClassificationTrainer;
+import org.apache.ignite.ml.knn.classification.KNNStrategy;
+import org.apache.ignite.ml.math.distances.EuclideanDistance;
+import org.apache.ignite.ml.math.impls.vector.DenseLocalOnHeapVector;
+import org.apache.ignite.thread.IgniteThread;
+
+/**
+ * Run kNN multi-class classification trainer over distributed dataset.
+ *
+ * @see KNNClassificationTrainer
+ */
+public class KNNClassificationExample {
+ /** Run example. */
+ public static void main(String[] args) throws InterruptedException {
+ System.out.println();
+ System.out.println(">>> kNN multi-class classification algorithm over cached dataset usage example started.");
+ // Start ignite grid.
+ try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+ System.out.println(">>> Ignite grid started.");
+
+ IgniteThread igniteThread = new IgniteThread(ignite.configuration().getIgniteInstanceName(),
+ KNNClassificationExample.class.getSimpleName(), () -> {
+ IgniteCache<Integer, double[]> dataCache = getTestCache(ignite);
+
+ KNNClassificationTrainer trainer = new KNNClassificationTrainer();
+
+ KNNClassificationModel knnMdl = trainer.fit(
+ new CacheBasedDatasetBuilder<>(ignite, dataCache),
+ (k, v) -> Arrays.copyOfRange(v, 1, v.length),
+ (k, v) -> v[0]
+ ).withK(3)
+ .withDistanceMeasure(new EuclideanDistance())
+ .withStrategy(KNNStrategy.WEIGHTED);
+
+ System.out.println(">>> ---------------------------------");
+ System.out.println(">>> | Prediction\t| Ground Truth\t|");
+ System.out.println(">>> ---------------------------------");
+
+ int amountOfErrors = 0;
+ int totalAmount = 0;
+
+ try (QueryCursor<Cache.Entry<Integer, double[]>> observations = dataCache.query(new ScanQuery<>())) {
+ for (Cache.Entry<Integer, double[]> observation : observations) {
+ double[] val = observation.getValue();
+ double[] inputs = Arrays.copyOfRange(val, 1, val.length);
+ double groundTruth = val[0];
+
+ double prediction = knnMdl.apply(new DenseLocalOnHeapVector(inputs));
+
+ totalAmount++;
+ if(groundTruth != prediction)
+ amountOfErrors++;
+
+ System.out.printf(">>> | %.4f\t\t| %.4f\t\t|\n", prediction, groundTruth);
+ }
+
+ System.out.println(">>> ---------------------------------");
+
+ System.out.println("\n>>> Absolute amount of errors " + amountOfErrors);
+ System.out.println("\n>>> Accuracy " + (1 - amountOfErrors / (double)totalAmount));
+ }
+ });
+
+ igniteThread.start();
+ igniteThread.join();
+ }
+ }
+
+ /**
+ * Fills cache with data and returns it.
+ *
+ * @param ignite Ignite instance.
+ * @return Filled Ignite Cache.
+ */
+ private static IgniteCache<Integer, double[]> getTestCache(Ignite ignite) {
+ CacheConfiguration<Integer, double[]> cacheConfiguration = new CacheConfiguration<>();
+ cacheConfiguration.setName("TEST_" + UUID.randomUUID());
+ cacheConfiguration.setAffinity(new RendezvousAffinityFunction(false, 10));
+
+ IgniteCache<Integer, double[]> cache = ignite.createCache(cacheConfiguration);
+
+ for (int i = 0; i < data.length; i++)
+ cache.put(i, data[i]);
+
+ return cache;
+ }
+
+ /** The Iris dataset. */
+ private static final double[][] data = {
+ {1, 5.1, 3.5, 1.4, 0.2},
+ {1, 4.9, 3, 1.4, 0.2},
+ {1, 4.7, 3.2, 1.3, 0.2},
+ {1, 4.6, 3.1, 1.5, 0.2},
+ {1, 5, 3.6, 1.4, 0.2},
+ {1, 5.4, 3.9, 1.7, 0.4},
+ {1, 4.6, 3.4, 1.4, 0.3},
+ {1, 5, 3.4, 1.5, 0.2},
+ {1, 4.4, 2.9, 1.4, 0.2},
+ {1, 4.9, 3.1, 1.5, 0.1},
+ {1, 5.4, 3.7, 1.5, 0.2},
+ {1, 4.8, 3.4, 1.6, 0.2},
+ {1, 4.8, 3, 1.4, 0.1},
+ {1, 4.3, 3, 1.1, 0.1},
+ {1, 5.8, 4, 1.2, 0.2},
+ {1, 5.7, 4.4, 1.5, 0.4},
+ {1, 5.4, 3.9, 1.3, 0.4},
+ {1, 5.1, 3.5, 1.4, 0.3},
+ {1, 5.7, 3.8, 1.7, 0.3},
+ {1, 5.1, 3.8, 1.5, 0.3},
+ {1, 5.4, 3.4, 1.7, 0.2},
+ {1, 5.1, 3.7, 1.5, 0.4},
+ {1, 4.6, 3.6, 1, 0.2},
+ {1, 5.1, 3.3, 1.7, 0.5},
+ {1, 4.8, 3.4, 1.9, 0.2},
+ {1, 5, 3, 1.6, 0.2},
+ {1, 5, 3.4, 1.6, 0.4},
+ {1, 5.2, 3.5, 1.5, 0.2},
+ {1, 5.2, 3.4, 1.4, 0.2},
+ {1, 4.7, 3.2, 1.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5.3, 1.9},
+ {3, 6.8, 3, 5.5, 2.1},
+ {3, 5.7, 2.5, 5, 2},
+ {3, 5.8, 2.8, 5.1, 2.4},
+ {3, 6.4, 3.2, 5.3, 2.3},
+ {3, 6.5, 3, 5.5, 1.8},
+ {3, 7.7, 3.8, 6.7, 2.2},
+ {3, 7.7, 2.6, 6.9, 2.3},
+ {3, 6, 2.2, 5, 1.5},
+ {3, 6.9, 3.2, 5.7, 2.3},
+ {3, 5.6, 2.8, 4.9, 2},
+ {3, 7.7, 2.8, 6.7, 2},
+ {3, 6.3, 2.7, 4.9, 1.8},
+ {3, 6.7, 3.3, 5.7, 2.1},
+ {3, 7.2, 3.2, 6, 1.8},
+ {3, 6.2, 2.8, 4.8, 1.8},
+ {3, 6.1, 3, 4.9, 1.8},
+ {3, 6.4, 2.8, 5.6, 2.1},
+ {3, 7.2, 3, 5.8, 1.6},
+ {3, 7.4, 2.8, 6.1, 1.9},
+ {3, 7.9, 3.8, 6.4, 2},
+ {3, 6.4, 2.8, 5.6, 2.2},
+ {3, 6.3, 2.8, 5.1, 1.5},
+ {3, 6.1, 2.6, 5.6, 1.4},
+ {3, 7.7, 3, 6.1, 2.3},
+ {3, 6.3, 3.4, 5.6, 2.4},
+ {3, 6.4, 3.1, 5.5, 1.8},
+ {3, 6, 3, 4.8, 1.8},
+ {3, 6.9, 3.1, 5.4, 2.1},
+ {3, 6.7, 3.1, 5.6, 2.4},
+ {3, 6.9, 3.1, 5.1, 2.3},
+ {3, 5.8, 2.7, 5.1, 1.9},
+ {3, 6.8, 3.2, 5.9, 2.3},
+ {3, 6.7, 3.3, 5.7, 2.5},
+ {3, 6.7, 3, 5.2, 2.3},
+ {3, 6.3, 2.5, 5, 1.9},
+ {3, 6.5, 3, 5.2, 2},
+ {3, 6.2, 3.4, 5.4, 2.3},
+ {3, 5.9, 3, 5.1, 1.8}
+ };
+}
diff --git a/examples/src/main/java/org/apache/ignite/examples/ml/knn/package-info.java b/examples/src/main/java/org/apache/ignite/examples/ml/knn/package-info.java
new file mode 100644
index 0000000..8de4656
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/ml/knn/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+
+/**
+ * <!-- Package description. -->
+ * kNN examples.
+ */
+package org.apache.ignite.examples.ml.knn;
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinWalModeChangeSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinWalModeChangeSelfTest.java
index 3aa88bc..addbf13 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinWalModeChangeSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinWalModeChangeSelfTest.java
@@ -18,6 +18,7 @@
package org.apache.ignite.jdbc.thin;
import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.IgniteKernal;
@@ -41,7 +42,7 @@
}
/** {@inheritDoc} */
- @Override protected void createCache(Ignite node, CacheConfiguration ccfg) {
+ @Override protected void createCache(Ignite node, CacheConfiguration ccfg) throws IgniteCheckedException {
String template = ccfg.getCacheMode() == CacheMode.PARTITIONED ?
QueryUtils.TEMPLATE_PARTITIONED : QueryUtils.TEMPLATE_REPLICATED;
@@ -54,13 +55,17 @@
"\"";
execute(node, cmd);
+
+ alignCacheTopologyVersion(node);
}
/** {@inheritDoc} */
- @Override protected void destroyCache(Ignite node, String cacheName) {
+ @Override protected void destroyCache(Ignite node, String cacheName) throws IgniteCheckedException {
String cmd = "DROP TABLE IF EXISTS " + cacheName;
execute(node, cmd);
+
+ alignCacheTopologyVersion(node);
}
/** {@inheritDoc} */
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WalModeChangeCommonAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WalModeChangeCommonAbstractSelfTest.java
index e2ae4fa..3056a13 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WalModeChangeCommonAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WalModeChangeCommonAbstractSelfTest.java
@@ -17,6 +17,10 @@
package org.apache.ignite.internal.processors.cache;
+import java.sql.SQLException;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.concurrent.Callable;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.Ignition;
@@ -28,20 +32,17 @@
import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteClientReconnectAbstractTest;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.util.lang.GridAbsPredicate;
import org.apache.ignite.internal.util.lang.IgniteInClosureX;
import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import java.sql.SQLException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.concurrent.Callable;
-
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
/**
@@ -127,8 +128,10 @@
* @param ccfg Cache configuration.
*/
@SuppressWarnings("unchecked")
- protected void createCache(Ignite node, CacheConfiguration ccfg) {
+ protected void createCache(Ignite node, CacheConfiguration ccfg) throws IgniteCheckedException {
node.getOrCreateCache(ccfg);
+
+ alignCacheTopologyVersion(node);
}
/**
@@ -137,8 +140,30 @@
* @param node Node.
* @param cacheName Cache name.
*/
- protected void destroyCache(Ignite node, String cacheName) {
+ protected void destroyCache(Ignite node, String cacheName) throws IgniteCheckedException {
node.destroyCache(cacheName);
+
+ alignCacheTopologyVersion(node);
+ }
+
+ /**
+ * Waits for the topology version to be not less than one registered on source node.
+ *
+ * @param src Source node.
+ * @throws IgniteCheckedException If failed to wait on affinity ready future.
+ */
+ protected void alignCacheTopologyVersion(Ignite src) throws IgniteCheckedException {
+ AffinityTopologyVersion topVer = ((IgniteEx)src).context().cache().context().exchange().readyAffinityVersion();
+
+ info("Will wait for topology version on all nodes: " + topVer);
+
+ for (Ignite ignite : Ignition.allGrids()) {
+ IgniteInternalFuture<?> ready = ((IgniteEx)ignite).context().cache().context().exchange()
+ .affinityReadyFuture(topVer);
+
+ if (ready != null)
+ ready.get();
+ }
}
/**
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java
index ee88b0f..2d130e1 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java
@@ -1050,8 +1050,6 @@
* @throws Exception If failed.
*/
public void testClientNodeFailOneServer() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-1776");
-
startServerNodes(1);
startClientNodes(1);
diff --git a/modules/web-console/frontend/app/components/list-of-registered-users/controller.js b/modules/web-console/frontend/app/components/list-of-registered-users/controller.js
index 41ac897..53a5521 100644
--- a/modules/web-console/frontend/app/components/list-of-registered-users/controller.js
+++ b/modules/web-console/frontend/app/components/list-of-registered-users/controller.js
@@ -59,7 +59,7 @@
AdminData.becomeUser(user._id)
.then(() => User.load())
- .then(() => $state.go('base.configuration.overview'))
+ .then(() => $state.go('default-state'))
.then(() => NotebookData.load());
};
diff --git a/modules/web-console/frontend/app/components/page-landing/index.js b/modules/web-console/frontend/app/components/page-landing/index.js
index 037f3d4..ff6ee59 100644
--- a/modules/web-console/frontend/app/components/page-landing/index.js
+++ b/modules/web-console/frontend/app/components/page-landing/index.js
@@ -53,9 +53,9 @@
const restored = trans.router.stateService.target(name, params);
- return restored.valid() ? restored : 'base.configuration.tabs';
+ return restored.valid() ? restored : 'default-state';
} catch (ignored) {
- return 'base.configuration.tabs';
+ return 'default-state';
}
})
.catch(() => true);
diff --git a/modules/web-console/frontend/app/components/page-queries/components/queries-notebook/controller.js b/modules/web-console/frontend/app/components/page-queries/components/queries-notebook/controller.js
index 9edc107..fa7460f 100644
--- a/modules/web-console/frontend/app/components/page-queries/components/queries-notebook/controller.js
+++ b/modules/web-console/frontend/app/components/page-queries/components/queries-notebook/controller.js
@@ -936,7 +936,7 @@
const _startWatch = () => {
const awaitClusters$ = fromPromise(
- agentMgr.startClusterWatch('Back to Configuration', 'base.configuration.overview'));
+ agentMgr.startClusterWatch('Back to Configuration', 'default-state'));
const finishLoading$ = defer(() => {
if (!$root.IgniteDemoMode)
diff --git a/modules/web-console/frontend/app/components/page-queries/components/queries-notebook/template.tpl.pug b/modules/web-console/frontend/app/components/page-queries/components/queries-notebook/template.tpl.pug
index 40ed54c..7d91a3f 100644
--- a/modules/web-console/frontend/app/components/page-queries/components/queries-notebook/template.tpl.pug
+++ b/modules/web-console/frontend/app/components/page-queries/components/queries-notebook/template.tpl.pug
@@ -79,7 +79,7 @@
mixin notebook-error
h2 Failed to load notebook
label.col-sm-12 Notebook not accessible any more. Go back to configuration or open to another notebook.
- button.h3.btn.btn-primary(ui-sref='base.configuration.tabs.advanced.clusters') Back to configuration
+ button.h3.btn.btn-primary(ui-sref='default-state') Back to configuration
mixin paragraph-rename
.col-sm-6(ng-hide='paragraph.edit')
diff --git a/modules/web-console/frontend/app/modules/demo/Demo.module.js b/modules/web-console/frontend/app/modules/demo/Demo.module.js
index 5dbd775..2e1a627 100644
--- a/modules/web-console/frontend/app/modules/demo/Demo.module.js
+++ b/modules/web-console/frontend/app/modules/demo/Demo.module.js
@@ -34,7 +34,7 @@
.state('demo.resume', {
url: '/resume',
permission: 'demo',
- redirectTo: 'base.configuration.overview',
+ redirectTo: 'default-state',
unsaved: true,
tfMetaTags: {
title: 'Demo resume'
@@ -47,11 +47,11 @@
const $http = trans.injector().get('$http');
return $http.post('/api/v1/demo/reset')
- .then(() => 'base.configuration.overview')
+ .then(() => 'default-state')
.catch((err) => {
trans.injector().get('IgniteMessages').showError(err);
- return 'base.configuration.overview';
+ return 'default-state';
});
},
unsaved: true,
diff --git a/modules/web-console/frontend/views/configuration/domains-import.tpl.pug b/modules/web-console/frontend/views/configuration/domains-import.tpl.pug
deleted file mode 100644
index 369c7de..0000000
--- a/modules/web-console/frontend/views/configuration/domains-import.tpl.pug
+++ /dev/null
@@ -1,182 +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.
-
-include /app/helpers/jade/mixins
-
-mixin chk(mdl, change, tip)
- input(type='checkbox' ng-model=mdl ng-change=change bs-tooltip='' data-title=tip data-trigger='hover' data-placement='top')
-
-mixin td-ellipses-lbl(w, lbl)
- td.td-ellipsis(width=`${w}` style=`min-width: ${w}; max-width: ${w}`)
- label #{lbl}
-
-.modal.modal-domain-import.center(role='dialog')
- -var tipOpts = {};
- - tipOpts.container = '.modal-content'
- - tipOpts.placement = 'top'
- .modal-dialog.domains-import-dialog
- .modal-content(ignite-loading='importDomainFromDb' ignite-loading-text='{{importDomain.loadingOptions.text}}')
- #errors-container.modal-header.header
- button.close(ng-click='$hide()' aria-hidden='true') ×
- h4.modal-title()
- i.fa.fa-database
- span(ng-if='!importDomain.demo') Import domain models from database
- span(ng-if='importDomain.demo') Import domain models from demo database
- .modal-body
- .import-domain-model-wizard-page(ng-if='importDomain.action == "drivers" && !importDomain.jdbcDriversNotFound')
- .import-domain-model-wizard-page(ng-if='importDomain.action == "drivers" && importDomain.jdbcDriversNotFound')
- | Domain model could not be imported
- ul
- li Agent failed to find JDBC drivers
- li Copy required JDBC drivers into agent 'jdbc-drivers' folder and try again
- li Refer to agent README.txt for more information
- .import-domain-model-wizard-page(ng-if='importDomain.action == "connect" && importDomain.demo')
- div(ng-if='demoConnection.db == "H2"')
- label Demo description:
- ul
- li In-memory H2 database server will be started inside agent
- li Database will be populated with sample tables
- li You could test domain model generation with this demo database
- li Click "Next" to continue
- div(ng-if='demoConnection.db != "H2"')
- label Demo could not be started
- ul
- li Agent failed to resolve H2 database jar
- li Copy h2-x.x.x.jar into agent 'jdbc-drivers' folder and try again
- li Refer to agent README.txt for more information
- .import-domain-model-wizard-page(ng-if='importDomain.action == "connect" && !importDomain.demo')
- -var form = 'connectForm'
-
- form.form-horizontal(name=form novalidate)
- .settings-row.settings-row_small-label
- +ignite-form-field-dropdown('Driver JAR:', 'ui.selectedJdbcDriverJar', '"jdbcDriverJar"', false, true, false,
- 'Choose JDBC driver', '', 'jdbcDriverJars',
- 'Select appropriate JAR with JDBC driver<br> To add another driver you need to place it into "/jdbc-drivers" folder of Ignite Web Agent<br> Refer to Ignite Web Agent README.txt for for more information'
- )
- .settings-row.settings-row_small-label
- +java-class('JDBC driver:', 'selectedPreset.jdbcDriverClass', '"jdbcDriverClass"', true, true, 'Fully qualified class name of JDBC driver that will be used to connect to database')
- .settings-row.settings-row_small-label
- +text-enabled-autofocus('JDBC URL:', 'selectedPreset.jdbcUrl', '"jdbcUrl"', true, true, 'JDBC URL', 'JDBC URL for connecting to database<br>Refer to your database documentation for details')
- .settings-row.settings-row_small-label
- +text('User:', 'selectedPreset.user', '"jdbcUser"', false, '', 'User name for connecting to database')
- .settings-row.settings-row_small-label
- +password('Password:', 'selectedPreset.password', '"jdbcPassword"', false, '', 'Password for connecting to database<br>Note, password would not be saved in preferences for security reasons')(ignite-on-enter='importDomainNext()')
- .settings-row
- - tipOpts.placement = 'auto'
- +checkbox('Tables only', 'selectedPreset.tablesOnly', '"tablesOnly"', 'If selected, then only tables metadata will be parsed<br>Otherwise table and view metadata will be parsed')
- - tipOpts.placement = 'top'
-
- .import-domain-model-wizard-page(ng-show='importDomain.action == "schemas"')
- table.table.metadata(st-table='importDomain.displayedSchemas' st-safe-src='importDomain.schemas')
- thead
- tr
- th.header(colspan='2')
- .col-sm-4.pull-right(style='margin-bottom: 5px')
- input.form-control(type='text' st-search='name' placeholder='Filter schemas...' ng-model='importDomain.displayedSchemasFilter' )
- tr
- th(width='30px')
- +chk('importDomain.allSchemasSelected', 'selectAllSchemas()', 'Select all schemas')
- th
- label Schema
- tbody
- tr
- td(colspan='2')
- .scrollable-y(style='height: 213px')
- table.table-modal-striped(id='importSchemasData')
- tbody
- tr(ng-repeat='schema in importDomain.displayedSchemas')
- td(width='30px')
- input(type='checkbox' ng-model='schema.use' ng-change='selectSchema()')
- td
- label {{schema.name}}
- .import-domain-model-wizard-page(ng-show='importDomain.action == "tables"')
- table.table.metadata(st-table='importDomain.displayedTables' st-safe-src='importDomain.tables')
- thead
- tr
- th.header(colspan='6')
- .col-sm-4.pull-right(style='margin-bottom: 8px')
- input.form-control(type='text' st-search='label' placeholder='Filter tables...' ng-model='importDomain.displayedTablesFilter' ng-change='selectTable()')
- tr
- th(width='30px')
- +chk('importDomain.allTablesSelected', 'selectAllTables()', 'Select all tables')
- th(width='130px')
- label Schema
- th(width='160px')
- label Table name
- th(colspan=2 width='288px')
- label Cache
- th
- tbody
- tr
- td(colspan='6')
- .scrollable-y(style='height: 143px')
- table.table-modal-striped(id='importTableData')
- tbody
- tr(ng-repeat='table in importDomain.displayedTables track by $index')
- td(width='30px' style='min-width: 30px; max-width: 30px')
- input(type='checkbox' ng-model='table.use' ng-change='selectTable()')
- +td-ellipses-lbl('130px', '{{table.schema}}')
- +td-ellipses-lbl('160px', '{{table.table}}')
- td(colspan='2' width='288px' style='min-width: 160px; max-width: 160px')
- div.td-ellipsis
- a(ng-if='!table.edit' ng-click='startEditDbTableCache(table)') {{tableActionView(table)}}
- div(style='display: flex' ng-if='table.edit')
- button.select-toggle.form-control(style='width: 35%; margin-right: 5px' bs-select ng-model='table.action' bs-options='item.value as item.shortLabel for item in importActions')
- button.select-toggle.form-control(style='width: 65%; margin-right: 0' bs-select ng-model='table.cacheOrTemplate' bs-options='item.value as item.label for item in table.cachesOrTemplates')
- td
- .settings-row
- label Defaults to be applied for filtered tables
- i.tipLabel.icon-help(bs-tooltip='' data-title='Select and apply options for caches generation')
- .settings-row
- .col-sm-11
- .col-sm-6(style='padding-right: 5px')
- button.select-toggle.form-control(bs-select ng-model='importCommon.action' bs-options='item.value as item.label for item in importActions')
- .col-sm-6(style='padding-left: 5px; padding-right: 5px')
- button.select-toggle.form-control(bs-select ng-model='importCommon.cacheOrTemplate' bs-options='item.value as item.label for item in importCommon.cachesOrTemplates')
- .col-sm-1(style='padding-left: 5px')
- button.btn.btn-primary(ng-click='applyDefaults()') Apply
- .import-domain-model-wizard-page(ng-show='importDomain.action == "options"')
- -var form = 'optionsForm'
- -var generatePojo = 'ui.generatePojo'
-
- form.form-horizontal(name=form novalidate)
- .settings-row
- +checkbox('Use Java built-in types for keys', 'ui.builtinKeys', '"domainBuiltinKeys"', 'Use Java built-in types like "Integer", "Long", "String" instead of POJO generation in case when table primary key contains only one field')
- .settings-row
- +checkbox('Use primitive types for NOT NULL table columns', 'ui.usePrimitives', '"domainUsePrimitives"', 'Use primitive types like "int", "long", "double" for POJOs fields generation in case of NOT NULL columns')
- .settings-row
- +checkbox('Generate query entity key fields', 'ui.generateKeyFields', '"generateKeyFields"',
- 'Generate key fields for query entity.<br\>\
- We need this for the cases when no key-value classes\
- are present on cluster nodes, and we need to build/modify keys and values during SQL DML operations.\
- Thus, setting this parameter is not mandatory and should be based on particular use case.')
- .settings-row
- +checkbox('Generate POJO classes', generatePojo, '"domainGeneratePojo"', 'If selected then POJO classes will be generated from database tables')
- .settings-row(ng-show=generatePojo)
- +checkbox('Generate aliases for query entity', 'ui.generateTypeAliases', '"domainGenerateTypeAliases"', 'Generate aliases for query entity if table name is invalid Java identifier')
- .settings-row(ng-show=generatePojo)
- +checkbox('Generate aliases for query fields', 'ui.generateFieldAliases', '"domainGenerateFieldAliases"', 'Generate aliases for query fields with database field names when database field name differ from Java field name')
- .settings-row.settings-row_small-label(ng-show=generatePojo)
- +java-package('Package:', 'ui.packageName', '"domainPackageName"', true, true, 'Package that will be used for POJOs generation')
- .settings-row.settings-row_small-label
- +ignite-form-field-dropdown('Clusters:', 'ui.generatedCachesClusters', '"generatedCachesClusters"', false, false, true,
- 'Choose clusters for generated caches', '', 'clusters',
- 'Choose clusters that will be associated with generated caches'
- )
- .modal-footer
- label(ng-hide='importDomain.action == "drivers" || (importDomain.action == "connect" && importDomain.demo)').labelField {{importDomain.info}}
- a.btn.btn-primary(ng-hide='importDomain.action == "drivers" || importDomain.action == "connect"' ng-click='importDomainPrev()' bs-tooltip='' data-title='{{prevTooltipText()}}' data-placement='bottom') Prev
- a.btn.btn-primary(ng-click='importDomainNext(optionsForm)' ng-disabled='!importDomainNextAvailable()' bs-tooltip='' data-title='{{nextTooltipText()}}' data-placement='bottom') {{importDomain.button}}
diff --git a/modules/web-console/frontend/views/configuration/domains.tpl.pug b/modules/web-console/frontend/views/configuration/domains.tpl.pug
deleted file mode 100644
index 89bd2ac..0000000
--- a/modules/web-console/frontend/views/configuration/domains.tpl.pug
+++ /dev/null
@@ -1,58 +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.
-
-pc-items-table(
- table-title='::"My domain models"'
- column-defs='$ctrl.modelsColumnDefs'
- items='$ctrl.modelsTable'
- on-action='$ctrl.onModelAction($event)'
- selected-row-id='$ctrl.selectedItemIDs'
- on-selection-change='$ctrl.selectionHook($event)'
-)
- footer-slot
- div(style='font-style: italic' ng-hide='$ctrl.modelsTable.length')
- | You have no domain models. #[a.link-success(ui-sref='base.configuration.tabs.advanced.models.model({modelID: "new"})') Create one?]
- a.link-success(ui-sref='base.configuration.tabs.advanced.models.model({modelID: "new"})' ng-show='$ctrl.modelsTable.length') + Add new domain model
-
-h2.pc-page-header(ng-if='$ctrl.selectedItemIDs.length !== 1')
- | {{ $ctrl.selectedItemIDs.length ? 'Multiple' : 'No' }} domain models selected
- span.pc-page-header-sub Select only one domain model to see settings and edit it
-
-h2.pc-page-header(ng-if='$ctrl.selectedItemIDs.length === 1')
- | {{ $ctrl.$state.params.modelID !== 'new' ? 'Edit' : 'Create' }} domain model {{ backupItem.valueType ? 'for ‘'+backupItem.valueType+'’ value type' : '' }}
-
-div(bs-collapse='' data-allow-multiple='true' ng-model='ui.activePanels' ng-class='{"pca-form-blocked": $ctrl.selectedItemIDs.length !== 1}')
- form.form-horizontal(name='ui.inputForm' novalidate )
- include /app/modules/states/configuration/domains/general
- include /app/modules/states/configuration/domains/query
- include /app/modules/states/configuration/domains/store
-
-.pc-form-actions-panel(ng-class='{"pca-form-blocked": $ctrl.selectedItemIDs.length !== 1}')
- button.btn-ignite.btn-ignite--success(
- ng-click='showImportDomainModal()'
- type='button'
- ) Import from database
- .pc-form-actions-panel__right-after
- button.btn-ignite.btn-ignite--link-success(
- type='button'
- ng-disabled='!ui.inputForm.$dirty'
- ng-click='ui.inputForm.$dirty && resetAll()'
- )
- | Cancel
- button.btn-ignite.btn-ignite--success(
- ng-disabled='!ui.inputForm.$dirty'
- ng-click='ui.inputForm.$dirty && $ctrl.saveItem(backupItem)'
- ) Save