UI-Lion:
- BundleStitcherTest now working!
- Expand aliases in from lines.
- Added unit tests for parsing of from lines.
Change-Id: I65d343f1283fd60f46879431c37299c6ecd5a36e
diff --git a/core/api/src/main/java/org/onosproject/ui/lion/LionBundle.java b/core/api/src/main/java/org/onosproject/ui/lion/LionBundle.java
index a4f07c2..1e1a6e4 100644
--- a/core/api/src/main/java/org/onosproject/ui/lion/LionBundle.java
+++ b/core/api/src/main/java/org/onosproject/ui/lion/LionBundle.java
@@ -17,26 +17,170 @@
package org.onosproject.ui.lion;
+import com.google.common.collect.ImmutableSortedMap;
+import com.google.common.collect.ImmutableSortedSet;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Encapsulates a bundle of localization strings.
*/
public final class LionBundle {
- private final String key;
+ private final String id;
+ private final Set<LionItem> items;
+ private final Map<String, String> mapped;
- private LionBundle(String key) {
- this.key = key;
+ private LionBundle(String id, Set<LionItem> items) {
+ this.id = id;
+ this.items = ImmutableSortedSet.copyOf(items);
+ mapped = createLookup();
+ }
+
+ private Map<String, String> createLookup() {
+ Map<String, String> lookup = new HashMap<>(items.size());
+ for (LionItem item : items) {
+ lookup.put(item.key(), item.value());
+ }
+ return ImmutableSortedMap.copyOf(lookup);
}
/**
- * Returns the key identifying this bundle.
+ * Returns the bundle's identifier.
*
- * @return the bundle's key
+ * @return the bundle's ID
*/
- public String key() {
- return key;
+ public String id() {
+ return id;
}
+ /**
+ * Returns the number of entries in this bundle.
+ *
+ * @return number of entries
+ */
+ public int size() {
+ return items.size();
+ }
- // TODO: public static method to generate a bundle from a ResourceBundle
+ @Override
+ public String toString() {
+ return "LionBundle{id=" + id + ", #items=" + size() + "}";
+ }
+
+ /**
+ * Returns the localized value for the given key, or null if no such
+ * mapping exists.
+ *
+ * @param key the key
+ * @return the localized value
+ */
+ public String getValue(String key) {
+ return mapped.get(key);
+ }
+
+ // === --------------------------------------------------------------------
+
+ /**
+ * Builder of Lion Bundles.
+ */
+ public static final class Builder {
+ private final String id;
+ private final Set<LionItem> items = new HashSet<>();
+
+ /**
+ * Creates a builder of Lion Bundles.
+ *
+ * @param id the bundle's identifier
+ */
+ public Builder(String id) {
+ this.id = id;
+ }
+
+ /**
+ * Returns the bundle ID.
+ *
+ * @return the bundle ID
+ */
+ public String id() {
+ return id;
+ }
+
+ /**
+ * Adds an item to the bundle.
+ *
+ * @param key the item key
+ * @param value the item value
+ * @return self, for chaining
+ */
+ public Builder addItem(String key, String value) {
+ items.add(new LionItem(key, value));
+ return this;
+ }
+
+ /**
+ * Builds the lion bundle from this builder instance.
+ *
+ * @return the lion bundle
+ */
+ public LionBundle build() {
+ return new LionBundle(id, items);
+ }
+ }
+
+ // === --------------------------------------------------------------------
+
+ /**
+ * Represents a single localization item.
+ */
+ public static final class LionItem implements Comparable<LionItem> {
+ private final String key;
+ private final String value;
+
+ /**
+ * Creates a lion item with the given key and value.
+ *
+ * @param key the key
+ * @param value the value
+ */
+ private LionItem(String key, String value) {
+ checkNotNull(key);
+ checkNotNull(value);
+ this.key = key;
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return "LionItem{key=" + key + ", value=\"" + value + "\"}";
+ }
+
+ @Override
+ public int compareTo(LionItem o) {
+ return key.compareTo(o.key);
+ }
+
+ /**
+ * Returns the key.
+ *
+ * @return the key
+ */
+ public String key() {
+ return key;
+ }
+
+ /**
+ * Returns the value.
+ *
+ * @return the value
+ */
+ public String value() {
+ return value;
+ }
+ }
}
diff --git a/core/api/src/main/java/org/onosproject/ui/lion/stitch/BundleStitcher.java b/core/api/src/main/java/org/onosproject/ui/lion/stitch/BundleStitcher.java
new file mode 100644
index 0000000..612edd4
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/ui/lion/stitch/BundleStitcher.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed 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.onosproject.ui.lion.stitch;
+
+import org.onosproject.ui.lion.LionBundle;
+import org.onosproject.ui.lion.LionUtils;
+
+import java.util.ResourceBundle;
+import java.util.Set;
+
+/**
+ * Gathers and stitches together a localization bundle according to a
+ * "lion" configuration file.
+ */
+public class BundleStitcher {
+
+ private static final String CONFIG_DIR = "_config";
+ private static final String SUFFIX = ".lioncfg";
+ private static final String SLASH = "/";
+ private static final String DOT = ".";
+
+
+ private final String base;
+
+ /**
+ * Creates a bundle stitcher, configured with the specified base resource
+ * path.
+ *
+ * @param base the base resource path
+ */
+ public BundleStitcher(String base) {
+ this.base = base;
+ }
+
+ @Override
+ public String toString() {
+ return "BundleStitcher{base=\"" + base + "\"}";
+ }
+
+ /**
+ * Stitches together a LionBundle, based on the bundle configuration data
+ * for the given bundle ID.
+ *
+ * @param id the bundle ID
+ * @return a corresponding lion bundle
+ */
+ public LionBundle stitch(String id) {
+ String source = base + SLASH + CONFIG_DIR + SLASH + id + SUFFIX;
+ LionConfig cfg = new LionConfig().load(source);
+ LionBundle.Builder builder = new LionBundle.Builder(id);
+
+ for (LionConfig.CmdFrom from : cfg.entries()) {
+ addItemsToBuilder(builder, from);
+ }
+
+ return builder.build();
+ }
+
+ private void addItemsToBuilder(LionBundle.Builder builder,
+ LionConfig.CmdFrom from) {
+ String resBundleName = base + SLASH + from.res();
+ String resFqbn = convertToFqbn(resBundleName);
+ ResourceBundle bundle = LionUtils.getBundledResource(resFqbn);
+
+ if (from.starred()) {
+ addAllItems(builder, bundle);
+ } else {
+ addItems(builder, bundle, from.keys());
+ }
+ }
+
+ // to fully-qualified-bundle-name
+ private String convertToFqbn(String path) {
+ if (!path.startsWith(SLASH)) {
+ throw new IllegalArgumentException("path should start with '/'");
+ }
+ return path.substring(1).replaceAll(SLASH, DOT);
+ }
+
+ private void addAllItems(LionBundle.Builder builder, ResourceBundle bundle) {
+ addItems(builder, bundle, bundle.keySet());
+ }
+
+ private void addItems(LionBundle.Builder builder, ResourceBundle bundle,
+ Set<String> keys) {
+ keys.forEach(k -> builder.addItem(k, bundle.getString(k)));
+ }
+}
diff --git a/core/api/src/main/java/org/onosproject/ui/lion/stitch/LionConfig.java b/core/api/src/main/java/org/onosproject/ui/lion/stitch/LionConfig.java
new file mode 100644
index 0000000..68e5f9d
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/ui/lion/stitch/LionConfig.java
@@ -0,0 +1,413 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed 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.onosproject.ui.lion.stitch;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSortedSet;
+import org.apache.commons.io.IOUtils;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import static java.nio.charset.StandardCharsets.UTF_8;
+
+/**
+ * A Java representation of a lion configuration file. You can create one with
+ * something like the following:
+ * <pre>
+ * String filepath = "/path/to/some/file.lioncfg";
+ * LionConfig cfg = new LionConfig().load(filepath);
+ * </pre>
+ */
+public class LionConfig {
+ private static final Pattern RE_COMMENT = Pattern.compile("^\\s*#.*");
+ private static final Pattern RE_BLANK = Pattern.compile("^\\s*$");
+
+ static final Pattern RE_IMPORT =
+ Pattern.compile("^(\\S+)\\s+import\\s+(.*)$");
+
+ private static final String BUNDLE = "bundle";
+ private static final String ALIAS = "alias";
+ private static final String FROM = "from";
+ private static final String STAR = "*";
+ private static final char SPC = ' ';
+ private static final char DOT = '.';
+
+ private List<String> lines;
+ private List<String> badLines;
+
+ private CmdBundle bundle;
+ private final Set<CmdAlias> aliases = new TreeSet<>();
+ private final Set<CmdFrom> froms = new TreeSet<>();
+
+ private Map<String, String> aliasMap;
+ private Map<String, Set<String>> fromMap;
+
+ /**
+ * Loads in the specified file and attempts to parse it as a
+ * {@code .lioncfg} format file.
+ *
+ * @param source path to .lioncfg file
+ * @return the instance
+ * @throws IllegalArgumentException if there is a problem reading the file
+ */
+ public LionConfig load(String source) {
+ InputStream is = getClass().getResourceAsStream(source);
+ try {
+ lines = IOUtils.readLines(is, UTF_8);
+ } catch (IOException e) {
+ throw new IllegalArgumentException("Failed to read: " + source, e);
+ }
+
+ stripCommentsAndWhitespace();
+ parse();
+ processAliases();
+ processFroms();
+
+ return this;
+ }
+
+
+ private boolean isCommentOrBlank(String s) {
+ return RE_COMMENT.matcher(s).matches() || RE_BLANK.matcher(s).matches();
+ }
+
+
+ private void stripCommentsAndWhitespace() {
+ if (lines != null) {
+ lines.removeIf(this::isCommentOrBlank);
+ }
+ }
+
+ private void parse() {
+ badLines = new ArrayList<>();
+
+ lines.forEach(l -> {
+ int i = l.indexOf(SPC);
+ if (i < 1) {
+ badLines.add(l);
+ return;
+ }
+ String keyword = l.substring(0, i);
+ String params = l.substring(i + 1);
+
+ switch (keyword) {
+ case BUNDLE:
+ CmdBundle cb = new CmdBundle(l, params);
+
+ if (bundle != null) {
+ // we can only declare the bundle once
+ badLines.add(l);
+ } else {
+ bundle = cb;
+ }
+ break;
+
+ case ALIAS:
+ CmdAlias ca = new CmdAlias(l, params);
+ if (ca.malformed) {
+ badLines.add(l);
+ } else {
+ aliases.add(ca);
+ }
+ break;
+
+ case FROM:
+ CmdFrom cf = new CmdFrom(l, params);
+ if (cf.malformed) {
+ badLines.add(l);
+ } else {
+ froms.add(cf);
+ }
+ break;
+
+ default:
+ badLines.add(l);
+ break;
+ }
+ });
+ }
+
+ private void processAliases() {
+ aliasMap = new HashMap<>(aliasCount());
+ aliases.forEach(a -> aliasMap.put(a.alias, a.subst));
+ }
+
+ private void processFroms() {
+ fromMap = new HashMap<>(fromCount());
+ froms.forEach(f -> {
+ f.expandAliasIfAny(aliasMap);
+ if (singleStarCheck(f)) {
+ fromMap.put(f.expandedRes, f.keys);
+ } else {
+ badLines.add(f.orig);
+ }
+ });
+ }
+
+ private boolean singleStarCheck(CmdFrom from) {
+ from.starred = false;
+ Set<String> keys = from.keys();
+ for (String k: keys) {
+ if (STAR.equals(k)) {
+ from.starred = true;
+ }
+ }
+ return !from.starred || keys.size() == 1;
+ }
+
+ @Override
+ public String toString() {
+ int nlines = lines == null ? 0 : lines.size();
+ return String.format("LionConfig{#lines=%d}", nlines);
+ }
+
+ /**
+ * Returns the configured bundle ID for this config.
+ *
+ * @return the bundle ID
+ */
+ String id() {
+ return bundle == null ? null : bundle.id;
+ }
+
+ /**
+ * Returns the number of aliases configured in this config.
+ *
+ * @return the alias count
+ */
+ int aliasCount() {
+ return aliases.size();
+ }
+
+ /**
+ * Returns the number of from...import lines configured in this config.
+ *
+ * @return the number of from...import lines
+ */
+ int fromCount() {
+ return froms.size();
+ }
+
+ /**
+ * Returns the substitution string for the given alias.
+ *
+ * @param a the alias
+ * @return the substitution
+ */
+ String alias(String a) {
+ return aliasMap.get(a);
+ }
+
+ /**
+ * Returns the number of keys imported from the specified resource.
+ *
+ * @param res the resource
+ * @return number of keys imported from that resource
+ */
+ int fromKeyCount(String res) {
+ Set<String> keys = fromMap.get(res);
+ return keys == null ? 0 : keys.size();
+ }
+
+ /**
+ * Returns true if the specified resource exists and contains the
+ * given key.
+ *
+ * @param res the resource
+ * @param key the key
+ * @return true, if resource exists and contains the key; false otherwise
+ */
+ boolean fromContains(String res, String key) {
+ Set<String> keys = fromMap.get(res);
+ return keys != null && keys.contains(key);
+ }
+
+ /**
+ * Returns the set of (expanded) "from" entries in this configuration.
+ *
+ * @return the entries
+ */
+ public Set<CmdFrom> entries() {
+ return froms;
+ }
+
+ /**
+ * Returns the number of parse errors detected.
+ *
+ * @return number of bad lines
+ */
+ public int errorCount() {
+ return badLines.size();
+ }
+
+ /**
+ * Returns the lines that failed the parser.
+ *
+ * @return the erroneous lines in the config
+ */
+ public List<String> errorLines() {
+ return ImmutableList.copyOf(badLines);
+ }
+
+ // ==== Mini class hierarchy of command types
+
+ private abstract static class Cmd {
+ final String orig;
+ boolean malformed = false;
+
+ Cmd(String orig) {
+ this.orig = orig;
+ }
+ }
+
+ private static final class CmdBundle extends Cmd {
+ private final String id;
+
+ private CmdBundle(String orig, String params) {
+ super(orig);
+ id = params;
+ }
+
+ @Override
+ public String toString() {
+ return "CmdBundle{id=\"" + id + "\"}";
+ }
+ }
+
+ private static final class CmdAlias extends Cmd
+ implements Comparable<CmdAlias> {
+ private final String alias;
+ private final String subst;
+
+ private CmdAlias(String orig, String params) {
+ super(orig);
+ int i = params.indexOf(SPC);
+ if (i < 1) {
+ malformed = true;
+ alias = null;
+ subst = null;
+ } else {
+ alias = params.substring(0, i);
+ subst = params.substring(i + 1);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "CmdAlias{alias=\"" + alias + "\", subst=\"" + subst + "\"}";
+ }
+
+ @Override
+ public int compareTo(CmdAlias o) {
+ return alias.compareTo(o.alias);
+ }
+ }
+
+ /**
+ * Represents a "from {res} import {stuff}" command in the configuration.
+ */
+ public static final class CmdFrom extends Cmd
+ implements Comparable<CmdFrom> {
+ private final String rawRes;
+ private final Set<String> keys;
+ private String expandedRes;
+ private boolean starred = false;
+
+ private CmdFrom(String orig, String params) {
+ super(orig);
+ Matcher m = RE_IMPORT.matcher(params);
+ if (!m.matches()) {
+ malformed = true;
+ rawRes = null;
+ keys = null;
+ } else {
+ rawRes = m.group(1);
+ keys = genKeys(m.group(2));
+ }
+ }
+
+ private Set<String> genKeys(String keys) {
+ String[] k = keys.split("\\s*,\\s*");
+ Set<String> allKeys = new HashSet<>();
+ Collections.addAll(allKeys, k);
+ return ImmutableSortedSet.copyOf(allKeys);
+ }
+
+ private void expandAliasIfAny(Map<String, String> aliases) {
+ String expanded = rawRes;
+ int i = rawRes.indexOf(DOT);
+ if (i > 0) {
+ String alias = rawRes.substring(0, i);
+ String sub = aliases.get(alias);
+ if (sub != null) {
+ expanded = sub + rawRes.substring(i);
+ }
+ }
+ expandedRes = expanded;
+ }
+
+ @Override
+ public String toString() {
+ return "CmdFrom{res=\"" + rawRes + "\", keys=" + keys + "}";
+ }
+
+ @Override
+ public int compareTo(CmdFrom o) {
+ return rawRes.compareTo(o.rawRes);
+ }
+
+ /**
+ * Returns the resource bundle name from which to import things.
+ *
+ * @return the resource bundle name
+ */
+ public String res() {
+ return expandedRes;
+ }
+
+ /**
+ * Returns the set of keys which should be imported.
+ *
+ * @return the keys to import
+ */
+ public Set<String> keys() {
+ return keys;
+ }
+
+ /**
+ * Returns true if this "from" command is importing ALL keys from
+ * the specified resource; false otherwise.
+ *
+ * @return true, if importing ALL keys; false otherwise
+ */
+ public boolean starred() {
+ return starred;
+ }
+ }
+}
diff --git a/core/api/src/main/java/org/onosproject/ui/lion/stitch/package-info.java b/core/api/src/main/java/org/onosproject/ui/lion/stitch/package-info.java
new file mode 100644
index 0000000..0661144
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/ui/lion/stitch/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed 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.
+ *
+ */
+
+/**
+ * Facilities for stitching together localization bundles.
+ */
+package org.onosproject.ui.lion.stitch;
diff --git a/core/api/src/test/java/org/onosproject/ui/lion/LionBundleTest.java b/core/api/src/test/java/org/onosproject/ui/lion/LionBundleTest.java
index 7100088..f4f27ee 100644
--- a/core/api/src/test/java/org/onosproject/ui/lion/LionBundleTest.java
+++ b/core/api/src/test/java/org/onosproject/ui/lion/LionBundleTest.java
@@ -18,17 +18,36 @@
package org.onosproject.ui.lion;
import org.junit.Test;
+import org.onosproject.ui.AbstractUiTest;
+
+import static org.junit.Assert.assertEquals;
/**
* Unit tests for {@link LionBundle}.
*/
-public class LionBundleTest {
+public class LionBundleTest extends AbstractUiTest {
+
+ private static final String ID = "foo";
+ private static final String KEY_A = "ka";
+ private static final String KEY_B = "kb";
+ private static final String VAL_A = "Alpha";
+ private static final String VAL_B = "Beta";
private LionBundle bundle;
@Test
public void basic() {
+ title("basic");
-// bundle = new LionBundle();
+ bundle = new LionBundle.Builder(ID)
+ .addItem(KEY_A, VAL_A)
+ .addItem(KEY_B, VAL_B)
+ .build();
+ print(bundle);
+ assertEquals("wrong id", ID, bundle.id());
+ assertEquals("wrong item count", 2, bundle.size());
+
+ assertEquals("wrong A lookup", VAL_A, bundle.getValue(KEY_A));
+ assertEquals("wrong B lookup", VAL_B, bundle.getValue(KEY_B));
}
}
diff --git a/core/api/src/test/java/org/onosproject/ui/lion/stitch/BundleStitcherTest.java b/core/api/src/test/java/org/onosproject/ui/lion/stitch/BundleStitcherTest.java
new file mode 100644
index 0000000..a362deb
--- /dev/null
+++ b/core/api/src/test/java/org/onosproject/ui/lion/stitch/BundleStitcherTest.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed 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.onosproject.ui.lion.stitch;
+
+import org.junit.Test;
+import org.onosproject.ui.AbstractUiTest;
+import org.onosproject.ui.lion.LionBundle;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Unit tests for {@link BundleStitcher}.
+ */
+public class BundleStitcherTest extends AbstractUiTest {
+
+ private static final String TEST_RESOURCE_BASE =
+ "/org/onosproject/ui/lion/stitchtests";
+
+ private static final String[] CARD_GAME_1_KEYS = {
+ "of",
+ "flush",
+ "full_house",
+ "pair",
+ "three_oak",
+
+ "ace",
+ "king",
+ "queen",
+ "jack",
+ "ten",
+
+ "spades",
+ "clubs",
+ };
+
+ private static final String[] CARD_GAME_1_ENGLISH = {
+ "of",
+ "Flush",
+ "Full House",
+ "Pair",
+ "Three of a Kind",
+
+ "Ace",
+ "King",
+ "Queen",
+ "Jack",
+ "Ten",
+
+ "Spades",
+ "Clubs",
+ };
+
+
+ private LionBundle lion;
+
+ private BundleStitcher testStitcher() {
+ return new BundleStitcher(TEST_RESOURCE_BASE);
+ }
+
+ private void verifyItems(LionBundle lion, String[] values) {
+ final int max = values.length;
+ for (int i = 0; i < max; i++) {
+ String key = CARD_GAME_1_KEYS[i];
+ String expValue = values[i];
+ String actValue = lion.getValue(key);
+ assertEquals("wrong mapping", expValue, actValue);
+ }
+ }
+
+ @Test
+ public void cardGame1English() {
+ title("cardGame1English");
+ lion = testStitcher().stitch("CardGame1");
+ print(lion);
+ assertEquals("wrong key", "CardGame1", lion.id());
+ assertEquals("bad key count", 12, lion.size());
+ verifyItems(lion, CARD_GAME_1_ENGLISH);
+ }
+}
diff --git a/core/api/src/test/java/org/onosproject/ui/lion/stitch/LionConfigTest.java b/core/api/src/test/java/org/onosproject/ui/lion/stitch/LionConfigTest.java
new file mode 100644
index 0000000..ec636b1
--- /dev/null
+++ b/core/api/src/test/java/org/onosproject/ui/lion/stitch/LionConfigTest.java
@@ -0,0 +1,177 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed 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.onosproject.ui.lion.stitch;
+
+import org.junit.Test;
+import org.onosproject.ui.AbstractUiTest;
+
+import java.util.regex.Matcher;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Unit tests for {@link LionConfig}.
+ */
+public class LionConfigTest extends AbstractUiTest {
+
+ private static final String ROOT = "/org/onosproject/ui/lion/stitchtests/";
+ private static final String CMD_ROOT = ROOT + "_cmd/";
+ private static final String CONFIG_ROOT = ROOT + "_config/";
+
+ private static final String SUFFIX = ".lioncfg";
+
+ private static final String CARD_GAME_1 = CONFIG_ROOT + "CardGame1" + SUFFIX;
+
+ private LionConfig cfg;
+ private LionConfig.CmdFrom from;
+
+
+ private String cmdPath(String name) {
+ return CMD_ROOT + name + SUFFIX;
+ }
+
+ private String configPath(String name) {
+ return CONFIG_ROOT + name + SUFFIX;
+ }
+
+ private LionConfig cfg() {
+ return new LionConfig();
+ }
+
+ private void verifyStats(String expId, int expAliases, int expFroms) {
+ assertEquals("wrong bundle ID", expId, cfg.id());
+ assertEquals("wrong alias count", expAliases, cfg.aliasCount());
+ assertEquals("wrong from count", expFroms, cfg.fromCount());
+ }
+
+ private void verifyKeys(String res, String... keys) {
+ int nkeys = keys.length;
+ for (String k: keys) {
+ assertEquals("key not found: " + k, true, cfg.fromContains(res, k));
+ }
+ assertEquals("wrong key count", nkeys, cfg.fromKeyCount(res));
+ }
+
+ @Test
+ public void importMatch() {
+ title("importMatch");
+ String fromParams = "cs.rank import *";
+ Matcher m = LionConfig.RE_IMPORT.matcher(fromParams);
+ assertEquals("no match", true, m.matches());
+ assertEquals("bad group 1", "cs.rank", m.group(1));
+ assertEquals("bad group 2", "*", m.group(2));
+ }
+
+ @Test
+ public void basic() {
+ title("basic");
+ cfg = cfg().load(CARD_GAME_1);
+ print(cfg);
+ verifyStats("CardGame1", 1, 3);
+ }
+
+ @Test
+ public void cmd01GoodBundle() {
+ title("cmd01GoodBundle");
+ cfg = cfg().load(cmdPath("01-bundle"));
+ verifyStats("foo.bar", 0, 0);
+ assertEquals("wrong ID", "foo.bar", cfg.id());
+ }
+
+ @Test
+ public void cmd02GoodAlias() {
+ title("cmd02GoodAlias");
+ cfg = cfg().load(cmdPath("02-alias"));
+ verifyStats(null, 1, 0);
+ assertEquals("alias/subst not found", "xyzzy.wizard", cfg.alias("xy"));
+ }
+
+ @Test
+ public void cmd03GoodFrom() {
+ title("cmd03GoodFrom");
+ cfg = cfg().load(cmdPath("03-from"));
+ verifyStats(null, 0, 1);
+ assertEquals("from/keys bad count", 0, cfg.fromKeyCount("non.exist"));
+ assertEquals("from/keys bad count", 1, cfg.fromKeyCount("foo.bar"));
+ assertEquals("from/keys not found", true,
+ cfg.fromContains("foo.bar", "fizzbuzz"));
+
+ from = cfg.entries().iterator().next();
+ assertFalse("expected no star", from.starred());
+ }
+
+ @Test
+ public void cmd04GoodFromFour() {
+ title("cmd04GoodFromFour");
+ cfg = cfg().load(cmdPath("04-from-four"));
+ assertEquals("from/keys bad count", 4, cfg.fromKeyCount("hooray"));
+ verifyKeys("hooray", "ford", "arthur", "joe", "henry");
+ }
+
+ @Test
+ public void cmd05FromExpand() {
+ title("cmd05FromExpand");
+ cfg = cfg().load(cmdPath("05-from-expand"));
+ assertEquals("no expand 1", 0, cfg.fromKeyCount("xy.spell"));
+ assertEquals("no expand 2", 0, cfg.fromKeyCount("xy.learn"));
+ verifyKeys("xyzzy.wizard.spell", "zonk", "zip", "zuffer");
+ verifyKeys("xyzzy.wizard.learn", "zap", "zigzag");
+ }
+
+ @Test
+ public void cmd06FromStar() {
+ title("cmd06FromStar");
+ cfg = cfg().load(cmdPath("06-from-star"));
+ print(cfg);
+ assertEquals("bad from count", 1, cfg.fromCount());
+
+ from = cfg.entries().iterator().next();
+ assertTrue("expected a star", from.starred());
+ }
+
+ @Test
+ public void cmd07StarIsSpecial() {
+ title("cmd06StarIsSpecial");
+ cfg = cfg().load(cmdPath("07-star-is-special"));
+ print(cfg);
+ assertEquals("no error detected", 3, cfg.errorCount());
+
+ int iBad = 0;
+ for (String line: cfg.errorLines()) {
+ print(line);
+ iBad++;
+ String prefix = "from star.bad" + iBad + " import ";
+ assertTrue("unexpected bad line", line.startsWith(prefix));
+ }
+ }
+
+ @Test
+ public void cardGameConfig() {
+ title("cardGameConfig");
+ cfg = cfg().load(configPath("CardGame1"));
+ assertEquals("wrong id", "CardGame1", cfg.id());
+ assertEquals("wrong alias count", 1, cfg.aliasCount());
+ assertEquals("wrong from count", 3, cfg.fromCount());
+
+ verifyKeys("app.Cards", "*");
+ verifyKeys("core.stuff.Rank", "ten", "jack", "queen", "king", "ace");
+ verifyKeys("core.stuff.Suit", "spades", "clubs");
+ }
+}
diff --git a/core/api/src/test/resources/org/onosproject/ui/lion/stitchtests/_cmd/01-bundle.lioncfg b/core/api/src/test/resources/org/onosproject/ui/lion/stitchtests/_cmd/01-bundle.lioncfg
new file mode 100644
index 0000000..127de70
--- /dev/null
+++ b/core/api/src/test/resources/org/onosproject/ui/lion/stitchtests/_cmd/01-bundle.lioncfg
@@ -0,0 +1,2 @@
+# 01. test the bundle command
+bundle foo.bar
\ No newline at end of file
diff --git a/core/api/src/test/resources/org/onosproject/ui/lion/stitchtests/_cmd/02-alias.lioncfg b/core/api/src/test/resources/org/onosproject/ui/lion/stitchtests/_cmd/02-alias.lioncfg
new file mode 100644
index 0000000..1bdba86
--- /dev/null
+++ b/core/api/src/test/resources/org/onosproject/ui/lion/stitchtests/_cmd/02-alias.lioncfg
@@ -0,0 +1,2 @@
+# 02. good alias
+alias xy xyzzy.wizard
diff --git a/core/api/src/test/resources/org/onosproject/ui/lion/stitchtests/_cmd/03-from.lioncfg b/core/api/src/test/resources/org/onosproject/ui/lion/stitchtests/_cmd/03-from.lioncfg
new file mode 100644
index 0000000..d856ebd
--- /dev/null
+++ b/core/api/src/test/resources/org/onosproject/ui/lion/stitchtests/_cmd/03-from.lioncfg
@@ -0,0 +1,2 @@
+# 03. good from
+from foo.bar import fizzbuzz
diff --git a/core/api/src/test/resources/org/onosproject/ui/lion/stitchtests/_cmd/04-from-four.lioncfg b/core/api/src/test/resources/org/onosproject/ui/lion/stitchtests/_cmd/04-from-four.lioncfg
new file mode 100644
index 0000000..ec13545
--- /dev/null
+++ b/core/api/src/test/resources/org/onosproject/ui/lion/stitchtests/_cmd/04-from-four.lioncfg
@@ -0,0 +1,2 @@
+# 04. good from with 4 keys
+from hooray import henry, joe, arthur, ford
diff --git a/core/api/src/test/resources/org/onosproject/ui/lion/stitchtests/_cmd/05-from-expand.lioncfg b/core/api/src/test/resources/org/onosproject/ui/lion/stitchtests/_cmd/05-from-expand.lioncfg
new file mode 100644
index 0000000..920d701
--- /dev/null
+++ b/core/api/src/test/resources/org/onosproject/ui/lion/stitchtests/_cmd/05-from-expand.lioncfg
@@ -0,0 +1,4 @@
+# 05. from expanding alias
+alias xy xyzzy.wizard
+from xy.spell import zonk, zip, zuffer
+from xy.learn import zap, zigzag
diff --git a/core/api/src/test/resources/org/onosproject/ui/lion/stitchtests/_cmd/06-from-star.lioncfg b/core/api/src/test/resources/org/onosproject/ui/lion/stitchtests/_cmd/06-from-star.lioncfg
new file mode 100644
index 0000000..3019c2f
--- /dev/null
+++ b/core/api/src/test/resources/org/onosproject/ui/lion/stitchtests/_cmd/06-from-star.lioncfg
@@ -0,0 +1,2 @@
+# 06. from star
+from star.singular import *
diff --git a/core/api/src/test/resources/org/onosproject/ui/lion/stitchtests/_cmd/07-star-is-special.lioncfg b/core/api/src/test/resources/org/onosproject/ui/lion/stitchtests/_cmd/07-star-is-special.lioncfg
new file mode 100644
index 0000000..9a72010
--- /dev/null
+++ b/core/api/src/test/resources/org/onosproject/ui/lion/stitchtests/_cmd/07-star-is-special.lioncfg
@@ -0,0 +1,6 @@
+# 07. star is special
+from abc import foo, bar
+from star.bad1 import *, foo
+from star.good import *
+from star.bad2 import foo, *, bar
+from star.bad3 import xanth, *
diff --git a/core/api/src/test/resources/org/onosproject/ui/lion/stitchtests/_config/CardGame1.lioncfg b/core/api/src/test/resources/org/onosproject/ui/lion/stitchtests/_config/CardGame1.lioncfg
new file mode 100644
index 0000000..00135cc
--- /dev/null
+++ b/core/api/src/test/resources/org/onosproject/ui/lion/stitchtests/_config/CardGame1.lioncfg
@@ -0,0 +1,10 @@
+# test configuration
+
+bundle CardGame1
+
+alias cs core.stuff
+
+from app.Cards import *
+
+from cs.Rank import ace, king, queen, jack, ten
+from cs.Suit import spades, clubs
diff --git a/core/api/src/test/resources/org/onosproject/ui/lion/stitchtests/app/Cards.properties b/core/api/src/test/resources/org/onosproject/ui/lion/stitchtests/app/Cards.properties
new file mode 100644
index 0000000..23f8766
--- /dev/null
+++ b/core/api/src/test/resources/org/onosproject/ui/lion/stitchtests/app/Cards.properties
@@ -0,0 +1,23 @@
+#
+# Copyright 2017-present Open Networking Laboratory
+#
+# Licensed 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.
+#
+#
+# --- more properties for a card game
+of=of
+flush=Flush
+full_house=Full House
+pair=Pair
+three_oak=Three of a Kind
+
diff --git a/core/api/src/test/resources/org/onosproject/ui/lion/stitchtests/core/stuff/Rank.properties b/core/api/src/test/resources/org/onosproject/ui/lion/stitchtests/core/stuff/Rank.properties
new file mode 100644
index 0000000..a6b35f0
--- /dev/null
+++ b/core/api/src/test/resources/org/onosproject/ui/lion/stitchtests/core/stuff/Rank.properties
@@ -0,0 +1,30 @@
+#
+# Copyright 2017-present Open Networking Laboratory
+#
+# Licensed 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.
+#
+#
+# --- Card Ranks
+two=Two
+three=Three
+four=Four
+five=Five
+six=Six
+seven=Seven
+eight=Eight
+nine=Nine
+ten=Ten
+jack=Jack
+queen=Queen
+king=King
+ace=Ace
diff --git a/core/api/src/test/resources/org/onosproject/ui/lion/stitchtests/core/stuff/Suit.properties b/core/api/src/test/resources/org/onosproject/ui/lion/stitchtests/core/stuff/Suit.properties
new file mode 100644
index 0000000..dab0e22
--- /dev/null
+++ b/core/api/src/test/resources/org/onosproject/ui/lion/stitchtests/core/stuff/Suit.properties
@@ -0,0 +1,21 @@
+#
+# Copyright 2017-present Open Networking Laboratory
+#
+# Licensed 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.
+#
+#
+# --- Card Suits
+clubs=Clubs
+hearts=Hearts
+spades=Spades
+diamonds=Diamonds
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/_config/core.view.cluster.lioncfg b/web/gui/src/main/resources/org/onosproject/ui/lion/_config/core.view.cluster.lioncfg
new file mode 100644
index 0000000..9d0e1ef
--- /dev/null
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/_config/core.view.cluster.lioncfg
@@ -0,0 +1,27 @@
+#
+# Copyright 2017-present Open Networking Laboratory
+#
+# Licensed 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.
+#
+#
+
+bundle core.view.cluster
+
+alias cv core.view
+alias cc core.common
+
+from cv.cluster import *
+from cc.network import devices, node_id, ip_address, tcp_port, uri, protocol
+from cc.props import type, chassis_id, vendor, hw_version, sw_version, serial_number
+from cc.state import total, active, started, last_updated
+from cc.ui import click, scroll_down
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/action.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/action.properties
new file mode 100644
index 0000000..ef0932e
--- /dev/null
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/action.properties
@@ -0,0 +1,23 @@
+#
+# Copyright 2017-present Open Networking Laboratory
+#
+# Licensed 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.
+#
+#
+
+install=Install
+start=Start
+pause=Pause
+resume=Resume
+stop=Stop
+uninstall=Uninstall
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/network.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/network.properties
new file mode 100644
index 0000000..fffc4a6
--- /dev/null
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/network.properties
@@ -0,0 +1,49 @@
+#
+# Copyright 2017-present Open Networking Laboratory
+#
+# Licensed 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.
+#
+#
+# --- Elements (Singular)
+node=Node
+topology=Topology
+network=Network
+region=Region
+device=Device
+host=Host
+link=Link
+
+# --- Elements (Plural)
+nodes=Nodes
+topologies=Topologies
+networks=Networks
+regions=Regions
+devices=Devices
+hosts=Hosts
+links=Links
+
+# --- Element IDs
+node_id=Node ID
+region_id=Region ID
+device_id=Device ID
+host_id=Host ID
+link_id=Link ID
+
+# --- Protocol terms
+protocol=Protocol
+ip=IP
+ip_address=IP Address
+tcp_port=TCP Port
+mac=MAC
+mac_address=MAC Address
+uri=URI
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/props.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/props.properties
new file mode 100644
index 0000000..420e8ea
--- /dev/null
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/props.properties
@@ -0,0 +1,25 @@
+#
+# Copyright 2017-present Open Networking Laboratory
+#
+# Licensed 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.
+#
+#
+
+type=Type
+vendor=Vendor
+chassis_id=Chassis ID
+
+hw_version=H/W Version
+sw_version=S/W Version
+
+serial_number=Serial #
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/state.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/state.properties
new file mode 100644
index 0000000..c53463c
--- /dev/null
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/state.properties
@@ -0,0 +1,25 @@
+#
+# Copyright 2017-present Open Networking Laboratory
+#
+# Licensed 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.
+#
+#
+
+total=Total
+active=Active
+started=Started
+stopped=Stopped
+
+last_updated=Last Updated
+last_modified=Last Modified
+
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/ui.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/ui.properties
new file mode 100644
index 0000000..dd0cbc7
--- /dev/null
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/ui.properties
@@ -0,0 +1,22 @@
+#
+# Copyright 2017-present Open Networking Laboratory
+#
+# Licensed 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.
+#
+#
+ok=OK
+cancel=Cancel
+
+# --- key binding and user gesture descriptions
+click=click
+scroll_down=scroll down
\ No newline at end of file
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/cluster.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/cluster.properties
new file mode 100644
index 0000000..1ae723c
--- /dev/null
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/cluster.properties
@@ -0,0 +1,21 @@
+#
+# Copyright 2017-present Open Networking Laboratory
+#
+# Licensed 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.
+#
+#
+title_cluster_nodes=Cluster Nodes
+
+k_esc_hint=Close the details panel
+k_click_hint=Select a row to show cluster node details
+k_scroll_down_hint=See available cluster nodes
diff --git a/web/gui/src/main/webapp/app/fw/util/lion.js b/web/gui/src/main/webapp/app/fw/util/lion.js
index b30e8bb..56c5db4 100644
--- a/web/gui/src/main/webapp/app/fw/util/lion.js
+++ b/web/gui/src/main/webapp/app/fw/util/lion.js
@@ -34,28 +34,33 @@
if (bundleKey === 'core.view.cluster') {
bundle = {
+ // grouped to match core.view.cluster.lioncfg
title_cluster_nodes: 'Cluster Nodes',
- total: 'Total',
- active: 'Active',
- started: 'Started',
+ k_esc_hint: 'Close the details panel',
+ k_click_hint: 'Select a row to show cluster node details',
+ k_scroll_down_hint: 'See available cluster nodes',
+
+ devices: 'Devices',
node_id: 'Node ID',
ip_address: 'IP Address',
tcp_port: 'TCP Port',
- last_updated: 'Last Updated',
- devices: 'Devices',
uri: 'URI',
+ protocol: 'Protocol',
+
type: 'Type',
chassis_id: 'Chassis ID',
vendor: 'Vendor',
hw_version: 'H/W Version',
sw_version: 'S/W Version',
- protocol: 'Protocol',
serial_number: 'Serial #',
- k_esc_hint: 'Close the details panel',
- k_click_hint: 'Select a row to show cluster node details',
- k_scroll_down_hint: 'See available cluster nodes',
- k_click: 'click',
- k_scroll_down: 'scroll down'
+
+ total: 'Total',
+ active: 'Active',
+ started: 'Started',
+ last_updated: 'Last Updated',
+
+ click: 'click',
+ scroll_down: 'scroll down'
};
}
diff --git a/web/gui/src/main/webapp/app/view/cluster/cluster.js b/web/gui/src/main/webapp/app/view/cluster/cluster.js
index b1e6608..f4d94f7 100644
--- a/web/gui/src/main/webapp/app/view/cluster/cluster.js
+++ b/web/gui/src/main/webapp/app/view/cluster/cluster.js
@@ -282,8 +282,8 @@
_helpFormat: ['esc']
});
ks.gestureNotes([
- [lion('k_click'), lion('k_click_hint')],
- [lion('k_scroll_down'), lion('k_scroll_down_hint')]
+ [lion('click'), lion('k_click_hint')],
+ [lion('scroll_down'), lion('k_scroll_down_hint')]
]);
// if the panelData changes
scope.$watch('panelData', function () {