Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
9a9cb3d9
Unverified
Commit
9a9cb3d9
authored
Sep 15, 2021
by
liuzhe-lz
Committed by
GitHub
Sep 15, 2021
Browse files
add icon (#4177)
parent
0ad73ef0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
ts/jupyter_extension/src/index.ts
ts/jupyter_extension/src/index.ts
+14
-6
No files found.
ts/jupyter_extension/src/index.ts
View file @
9a9cb3d9
...
@@ -2,6 +2,17 @@ import { JupyterFrontEnd, JupyterFrontEndPlugin } from '@jupyterlab/application'
...
@@ -2,6 +2,17 @@ import { JupyterFrontEnd, JupyterFrontEndPlugin } from '@jupyterlab/application'
import
{
ICommandPalette
,
IFrame
}
from
'
@jupyterlab/apputils
'
;
import
{
ICommandPalette
,
IFrame
}
from
'
@jupyterlab/apputils
'
;
import
{
PageConfig
}
from
'
@jupyterlab/coreutils
'
;
import
{
PageConfig
}
from
'
@jupyterlab/coreutils
'
;
import
{
ILauncher
}
from
'
@jupyterlab/launcher
'
;
import
{
ILauncher
}
from
'
@jupyterlab/launcher
'
;
import
{
LabIcon
}
from
'
@jupyterlab/ui-components
'
;
const
nniIconSvg
=
`
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 162 84">
<polygon fill="#0b6bac" points="0,84 12,84 34,18 56,84 68,84 87,27 75,27 62,66 40,0 28,0 0,84"/>
<polygon fill="#0b6bac" points="94,84 106,84 125,27 113,27 100,66 90,36 84,54 94,84"/>
<polygon fill="#0b6bac" points="122,0 128,18 140,18 134,0 122,0"/>
<polygon fill="#0b6bac" points="131,27 150,84 162,84 143,27 131,27"/>
</svg>
`
;
const
nniIcon
=
new
LabIcon
({
name
:
'
nni
'
,
svgstr
:
nniIconSvg
});
class
NniWidget
extends
IFrame
{
class
NniWidget
extends
IFrame
{
constructor
()
{
constructor
()
{
...
@@ -14,6 +25,7 @@ class NniWidget extends IFrame {
...
@@ -14,6 +25,7 @@ class NniWidget extends IFrame {
this
.
url
=
PageConfig
.
getBaseUrl
()
+
'
nni/index
'
;
this
.
url
=
PageConfig
.
getBaseUrl
()
+
'
nni/index
'
;
this
.
id
=
'
nni
'
;
this
.
id
=
'
nni
'
;
this
.
title
.
label
=
'
NNI
'
;
this
.
title
.
label
=
'
NNI
'
;
this
.
title
.
icon
=
nniIcon
;
this
.
title
.
closable
=
true
;
this
.
title
.
closable
=
true
;
}
}
}
}
...
@@ -27,7 +39,7 @@ async function activate(app: JupyterFrontEnd, palette: ICommandPalette, launcher
...
@@ -27,7 +39,7 @@ async function activate(app: JupyterFrontEnd, palette: ICommandPalette, launcher
commands
.
addCommand
(
command
,
{
commands
.
addCommand
(
command
,
{
label
:
'
NNI
'
,
label
:
'
NNI
'
,
caption
:
'
NNI
'
,
caption
:
'
NNI
'
,
icon
Class
:
(
args
)
=>
(
args
.
isPalette
?
null
:
'
jp-Launcher-kernel
Icon
'
),
icon
:
(
args
)
=>
(
args
.
isPalette
?
null
:
nni
Icon
),
execute
:
()
=>
{
execute
:
()
=>
{
shell
.
add
(
new
NniWidget
(),
'
main
'
);
shell
.
add
(
new
NniWidget
(),
'
main
'
);
}
}
...
@@ -36,11 +48,7 @@ async function activate(app: JupyterFrontEnd, palette: ICommandPalette, launcher
...
@@ -36,11 +48,7 @@ async function activate(app: JupyterFrontEnd, palette: ICommandPalette, launcher
palette
.
addItem
({
command
,
category
});
palette
.
addItem
({
command
,
category
});
if
(
launcher
)
{
if
(
launcher
)
{
launcher
.
add
({
launcher
.
add
({
command
,
category
});
command
,
category
,
kernelIconUrl
:
'
/nni/icon.png
'
// FIXME: this field only works for "Notebook" category
});
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment