LoginSignup
4
2

More than 5 years have passed since last update.

シスコ NeXt UI をカスタマイズしてみた

Last updated at Posted at 2017-12-06

シスコ NeXt UI を使ってトポロジを描画してみたでは、シスコ NeXt UI のダウンロードからインストールまで紹介しました。ここではいろいろなカスタマイズについてまとめます。

アイコンの変更

シスコ NeXt UI には、以下のように様々なアイコンが最初から含まれています(https://developer.cisco.com/site/neXt/discover/demo/ の Topology Icons から一部分のみ引用)。

Screen Shot 2017-12-06 at 8.46.14 PM.png

デフォルトではノードが unknown の ? マークになっていますので、これをルータに変更します。これだけであれば、Shell.js に一行追加するだけで実現できます。

 16                     nodeConfig: {
 17                         // label display name from of node's model, could change to 'model.id' to show id
 18                         label: 'model.name',
 19                         iconType: 'router'  // 追加
 20 
 21                     },

これで無事にルータのアイコンになりました。

Screen Shot 2017-12-06 at 8.56.29 PM.png

リンクの変更

リンクタイプは curve と parallel が選べます。これまでのトポロジは curve でしたので、Shell.js を次のように変えて parallel にしてみます。

 23                     linkConfig: {
 24                         // multiple link type is curve, could change to 'parallel' to use parallel link
 25                         linkType: 'parallel'  // parallel に変更
 26                     },

すると、下記のようにリンクが平行線になりました。

Screen Shot 2017-12-06 at 9.03.33 PM.png

テーマの変更

NeXt UI では blue, green, dark, slate および yellow の 5 つのテーマが用意されています。デフォルトは blue です。ブラウザで描画したときの設定ボタン(ギアのアイコン)を押しても変更できますが、コード上で変更する際には、下記のように nx.graphic.Topology クラスに theme プロパティを追加します。

 13                     width: 580,
 14                     height: 580,
 15                     theme: "green",  // blue, green, dark, slate, yellow のいずれかを追加
 16                     // node config
 17                     nodeConfig: {

それぞれのテーマは以下のような感じです(デフォルトの blue はこれまでの画面なので省略します)。

green

Screen Shot 2017-12-06 at 9.09.35 PM.png

dark

Screen Shot 2017-12-06 at 9.10.03 PM.png

slate

Screen Shot 2017-12-06 at 9.10.19 PM.png

yellow

Screen Shot 2017-12-06 at 9.10.33 PM.png

4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2