Skip to content

Commit cc888b0

Browse files
authored
Merge pull request #1 from awssamdwar/JupyterLab-v3,0
Adding JL3 support
2 parents 9d4d151 + 1dba3e6 commit cc888b0

File tree

12 files changed

+79
-54
lines changed

12 files changed

+79
-54
lines changed

README.md

+23-28
Original file line numberDiff line numberDiff line change
@@ -10,43 +10,38 @@ for the frontend extension.
1010

1111
## Requirements
1212
* Requires [SageMaker Studio Docker CLI Extension](https://github.com/aws-samples/sagemaker-studio-docker-cli-extension) to be installed.
13-
* Please ensure your JupyterLab version is >= v1.2.18 and < 2.0. You can check the version by opening a terminal window in SageMaker Studio (File > New -> Terminal) and running the following command: 'jupyter lab --version'
13+
* Compatible with *JupyterServer* running *Jupyter Lab* v1.0 or v3.0
1414

1515
## Installation Steps
1616

17-
Use Studio LifeCycle configuration
17+
Use Studio LifeCycle configuration and attach it to *JupyterServer* app.
1818
```
1919
#!/bin/bash
2020
2121
set -eux
22-
STATUS=$(python3 -c "import sagemaker_dataprep";echo $?)
23-
if [ "$STATUS" -eq 0 ]; then
24-
echo 'Instance is of Type Data Wrangler'
22+
23+
cd ~
24+
if cd sagemaker-studio-docker-cli-extension
25+
then
26+
git reset --hard
27+
git pull
2528
else
26-
echo 'Instance is not of Type Data Wrangler'
27-
cd ~
28-
if cd sagemaker-studio-docker-cli-extension
29-
then
30-
git reset --hard
31-
git pull
32-
else
33-
git clone https://github.com/aws-samples/sagemaker-studio-docker-cli-extension.git
34-
cd sagemaker-studio-docker-cli-extension
35-
fi
36-
nohup ./setup.sh > docker_setup.out 2>&1 &
37-
38-
if cd ~/sagemaker-studio-docker-ui-extension
39-
then
40-
git reset --hard
41-
git pull
42-
cd
43-
else
44-
cd
45-
git clone https://github.com/aws-samples/sagemaker-studio-docker-ui-extension.git
46-
fi
47-
48-
nohup ~/sagemaker-studio-docker-ui-extension/setup.sh > docker_setup.out 2>&1 &
29+
git clone https://github.com/aws-samples/sagemaker-studio-docker-cli-extension.git
30+
cd sagemaker-studio-docker-cli-extension
4931
fi
32+
nohup ./setup.sh > docker_setup.out 2>&1 &
33+
34+
if cd ~/sagemaker-studio-docker-ui-extension
35+
then
36+
git reset --hard
37+
git pull
38+
cd
39+
else
40+
cd
41+
git clone https://github.com/aws-samples/sagemaker-studio-docker-ui-extension.git
42+
fi
43+
44+
nohup ~/sagemaker-studio-docker-ui-extension/setup.sh > docker_setup.out 2>&1 &
5045
```
5146

5247
## Security

SageMaker-Studio-Docker-UI.png

62.5 KB
Loading

labextension/sagemaker_studio_docker_ui/package/lib/components/GetContexts.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import {
66
itemIconSpan,
77
instanceDescriptionDiv,
88
runningHostStyle,
9-
idleHostStyle
9+
idleHostStyle,
10+
powerIconStyle
1011
} from '../style/getContextsStyle';
1112
import { ContextSwitcher } from './SwitchContext';
1213
import { HostTerminator } from './TerminateHost';
@@ -57,7 +58,7 @@ function getItem(
5758
{
5859
className: SHUTDOWN_BUTTON_CLASS,
5960
tooltip: 'Set as default docker host',
60-
iconClassName: idleHostStyle,
61+
iconClass: idleHostStyle,
6162
onClick: switcherInstance.switcher
6263
}
6364
);
@@ -88,7 +89,7 @@ function getItem(
8889
{
8990
className: SHUTDOWN_BUTTON_CLASS,
9091
tooltip: tooltip,
91-
iconClassName: "jp-CodeQuitIcon",
92+
iconClass: powerIconStyle,
9293
onClick: terminatorInstance.terminator
9394
}
9495
)

labextension/sagemaker_studio_docker_ui/package/lib/components/SwitchContext.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ async function switchContext(instance, instanceType, instanceId){
1111
method: 'POST',
1212
});
1313
console.log(reply);
14-
instance.addAlert({message: `Switching to host ${instanceId}`, wait: 5000});
14+
instance.addAlert({ message: `Switching to host ${instanceId}`, wait: 5000 });
1515
}
1616
catch (reason) {
1717
console.error(`Error on POST /docker-host/switch_context ${JSON.stringify(dataToSend)}.\n${reason}`);

labextension/sagemaker_studio_docker_ui/package/lib/components/TerminateHost.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ async function terminateHost(instance, instanceId){
1111
method: 'POST',
1212
});
1313
console.log(reply);
14-
instance.addAlert({message: `Terminating host ${instanceId}`, wait: 5000 });
14+
instance.addAlert({ message: `Terminating host ${instanceId}`, wait: 5000 });
1515
}
1616
catch (reason) {
1717
console.error(`Error on POST /docker-host/terminate_host ${JSON.stringify(dataToSend)}.\n${reason}`);

labextension/sagemaker_studio_docker_ui/package/lib/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ILayoutRestorer } from '@jupyterlab/application';
2-
import { IStateDB } from '@jupyterlab/coreutils';
2+
import { IStateDB } from '@jupyterlab/statedb';
33
import { requestAPIServer } from './sagemaker-studio-docker-ui';
44
import { SdockerWidget } from './widgets/SdockerWidget';
55
/**
@@ -51,4 +51,4 @@ const extension = {
5151
});
5252
}
5353
};
54-
export default extension;
54+
export default extension;

labextension/sagemaker_studio_docker_ui/package/lib/sagemaker-studio-docker-ui.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ export async function requestAPIServer(endPoint = '', init = {}) {
2424
throw new ServerConnection.ResponseError(response, data.message);
2525
}
2626
return data;
27-
}
27+
}

labextension/sagemaker_studio_docker_ui/package/lib/style/getContextsStyle.js

+18
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,22 @@ export const containerIconStyle = style(
106106
color: 'var(--jp-ui-font-color1)',
107107
lineHeight: 'var(--jp-private-running-item-height)'
108108
}
109+
)
110+
export const powerIconStyle = style(
111+
{
112+
backgroundImage: 'var(--jp-powerIcon)',
113+
flex: '0 0 auto',
114+
padding: '0px 8px',
115+
marginRight: '6px',
116+
marginLeft: '12px',
117+
verticalAlign: 'middle',
118+
backgroundSize: '16px',
119+
backgroundRepeat: 'no-repeat',
120+
backgroundPosition: 'center center',
121+
display: 'flex',
122+
flexDirection: 'row',
123+
justifyContent: 'space-around',
124+
color: 'var(--jp-ui-font-color1)',
125+
lineHeight: 'var(--jp-private-running-item-height)'
126+
}
109127
)

labextension/sagemaker_studio_docker_ui/package/lib/widgets/SdockerWidget.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ export class SdockerWidget extends ReactWidget {
1616
render() {
1717
return (React.createElement(SdockerPanel, { stateDB: this.stateDB }));
1818
}
19-
}
19+
}

labextension/sagemaker_studio_docker_ui/package/package.json

+23-17
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
"jupyterlab",
88
"jupyterlab-extension"
99
],
10-
"homepage": "https://aws.amazon.com/sagemaker/",
10+
"homepage": "https://github.com/aws-samples/sagemaker-studio-docker-ui-extension",
1111
"bugs": {
12-
"url": "https://aws.amazon.com/sagemaker/issues"
12+
"url": "https://github.com/aws-samples/sagemaker-studio-docker-ui-extension/issues"
1313
},
1414
"license": "BSD-3-Clause",
1515
"author": "Sam Edwards",
@@ -22,30 +22,35 @@
2222
"style": "style/index.css",
2323
"repository": {
2424
"type": "git",
25-
"url": "https://aws.amazon.com/sagemaker/.git"
25+
"url": "https://github.com/aws-samples/sagemaker-studio-docker-ui-extension.git"
2626
},
2727
"scripts": {
28-
"build": "jlpm install && tsc",
29-
"build:labextension": "jlpm build && jlpm clean:labextension && mkdirp sagemaker-studio-docker-ui/labextension && cd sagemaker-studio-docker-ui/labextension && npm pack ../..",
30-
"clean": "rimraf lib tsconfig.tsbuildinfo",
31-
"clean:labextension": "rimraf sagemaker-studio-docker-ui/labextension",
28+
"build": "jlpm run build:lib && jlpm run build:labextension:dev",
29+
"build:prod": "jlpm run build:lib && jlpm run build:labextension",
30+
"build:lib": "tsc",
31+
"build:labextension": "jupyter labextension build .",
32+
"build:labextension:dev": "jupyter labextension build --development True .",
33+
"clean": "rimraf lib tsconfig.tsbuildinfo sagemaker-studio-docker-ui-extension/labextension",
34+
"clean:all": "jlpm run clean:lib && jlpm run clean:labextension",
35+
"clean:labextension": "rimraf sagemaker-studio-docker-ui-extension/labextension",
3236
"clean:slate": "jlpm clean:more && jlpm clean:labextension && rimraf node_modules",
3337
"eslint": "eslint . --fix --ext .ts,.tsx",
3438
"eslint:check": "eslint . --ext .ts,.tsx",
3539
"watch": "tsc -w"
3640
},
3741
"dependencies": {
38-
"@jupyterlab/application": "^1.2.1",
39-
"@jupyterlab/apputils": "^1.2.1",
40-
"@jupyterlab/ui-components": "^1.2.1",
41-
"@jupyterlab/notebook": "^1.0",
42-
"@phosphor/coreutils": "^1.3.1",
43-
"@phosphor/messaging": "^1.3.0",
42+
"@jupyterlab/application": "^3.0.0",
43+
"@jupyterlab/apputils": "^3.0.0",
44+
"@jupyterlab/ui-components": "^3.0.0",
45+
"@jupyterlab/notebook": "^3.0.0",
46+
"@lumino/coreutils": "^1.3.1",
47+
"@lumino/messaging": "^1.3.0",
4448
"classnames": "^2.2.6",
45-
"react": "16.8.6",
46-
"@jupyterlab/services": "^4.2.3"
49+
"react": "17.0.1",
50+
"@jupyterlab/services": "^6.0.0"
4751
},
4852
"devDependencies": {
53+
"@jupyterlab/builder": "^3.0.0",
4954
"@typescript-eslint/eslint-plugin": "^2.25.0",
5055
"@typescript-eslint/parser": "^2.25.0",
5156
"eslint": "^6.8.0",
@@ -70,6 +75,7 @@
7075
}
7176
}
7277
},
73-
"extension": true
78+
"extension": true,
79+
"outputDir": "sagemaker-studio-docker-ui-extension/labextension"
7480
}
75-
}
81+
}

labextension/sagemaker_studio_docker_ui/package/style/index.css

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
--jp-idleHostIcon: url('./idle-host.svg');
44
--jp-containerIcon: url('./container-icon.svg');
55
--jp-imageIcon: url('./image-icon.svg');
6+
--jp-powerIcon: url('./power-icon.svg');
67
}
78

89
.jp-dockerIcon {
Loading

0 commit comments

Comments
 (0)