Skip to content

Commit fa741cd

Browse files
Review comments changes
1 parent 54aed23 commit fa741cd

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

src/batches/createBatch.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ function CreateBatch({
396396
if (batchInfoResponse.runtimeConfig.hasOwnProperty('properties')) {
397397
const updatedPropertyDetail = Object.entries(
398398
batchInfoResponse.runtimeConfig.properties
399-
).map(([k, v]) => `${k.substring(6)}:${v}`);
399+
).map(([k, v]) => `${k.substring(6)}:${v}`); // spark:spark.app.name , spark:spark.driver.cores - every property is appended with 'spark:' therefore getting the porperty key value after 'spark:'
400400
setPropertyDetail(prevPropertyDetail => [
401401
...prevPropertyDetail,
402402
...updatedPropertyDetail

src/index.ts

+22-22
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ const extension: JupyterFrontEndPlugin<void> = {
7272
window.addEventListener('beforeunload', () => {
7373
localStorage.removeItem('notebookValue');
7474
});
75-
let localStorageValue = '';
75+
let lastClusterName = '';
7676
const panel = new Panel();
7777
panel.id = 'dpms-tab';
7878
panel.title.icon = iconDpms;
@@ -89,15 +89,15 @@ const extension: JupyterFrontEndPlugin<void> = {
8989

9090

9191
panel.addWidget(new dpmsWidget(app as JupyterLab, themeManager));
92-
localStorageValue = localStorage.getItem('notebookValue') || '';
93-
if (localStorageValue) {
94-
loadDpmsWidget(localStorageValue);
92+
lastClusterName = localStorage.getItem('notebookValue') || '';
93+
if (lastClusterName) {
94+
loadDpmsWidget(lastClusterName);
9595
}
9696
app.shell.add(panel, 'left', { rank: 1000 });
9797

9898
const onTitleChanged = async (title: Title<Widget>) => {
9999
const widget = title.owner as NotebookPanel;
100-
localStorageValue = localStorage.getItem('notebookValue') || '';
100+
lastClusterName = localStorage.getItem('notebookValue') || '';
101101
if (widget && widget instanceof NotebookPanel) {
102102
const kernel = widget.sessionContext.session?.kernel;
103103
if (kernel) {
@@ -109,28 +109,28 @@ const extension: JupyterFrontEndPlugin<void> = {
109109
const parts =
110110
kernelSpec?.resources.endpointParentResource.split('/');
111111
const clusterValue = parts[parts.length - 1] + '/clusters';
112-
if (localStorageValue === null) {
112+
if (lastClusterName === null) {
113113
localStorage.setItem('notebookValue', clusterValue);
114-
localStorageValue = localStorage.getItem('notebookValue') || '';
115-
loadDpmsWidget(localStorageValue || '');
116-
} else if (localStorageValue !== clusterValue) {
114+
lastClusterName = localStorage.getItem('notebookValue') || '';
115+
loadDpmsWidget(lastClusterName || '');
116+
} else if (lastClusterName !== clusterValue) {
117117
localStorage.setItem('notebookValue', clusterValue);
118-
localStorageValue = localStorage.getItem('notebookValue') || '';
119-
loadDpmsWidget(localStorageValue || '');
118+
lastClusterName = localStorage.getItem('notebookValue') || '';
119+
loadDpmsWidget(lastClusterName || '');
120120
}
121121
} else if (
122122
kernelSpec?.resources.endpointParentResource.includes('/sessions')
123123
) {
124124
const parts = kernelSpec?.name.split('-');
125125
const sessionValue = parts.slice(1).join('-') + '/sessions';
126-
if (localStorageValue === null) {
126+
if (lastClusterName === null) {
127127
localStorage.setItem('notebookValue', sessionValue);
128-
localStorageValue = localStorage.getItem('notebookValue') || '';
129-
loadDpmsWidget(localStorageValue || '');
130-
} else if (localStorageValue !== sessionValue) {
128+
lastClusterName = localStorage.getItem('notebookValue') || '';
129+
loadDpmsWidget(lastClusterName || '');
130+
} else if (lastClusterName !== sessionValue) {
131131
localStorage.setItem('notebookValue', sessionValue);
132-
localStorageValue = localStorage.getItem('notebookValue') || '';
133-
loadDpmsWidget(localStorageValue || '');
132+
lastClusterName = localStorage.getItem('notebookValue') || '';
133+
loadDpmsWidget(lastClusterName || '');
134134
}
135135
}
136136
} else {
@@ -162,23 +162,23 @@ const extension: JupyterFrontEndPlugin<void> = {
162162
newValue.title.label === 'Config Setup' ||
163163
newValue.title.label === 'Clusters' ||
164164
newValue.title.label === 'Serverless') &&
165-
localStorageValue !== ''
165+
lastClusterName !== ''
166166
) {
167-
localStorage.setItem('oldNotebookValue', localStorageValue || '');
167+
localStorage.setItem('oldNotebookValue', lastClusterName || '');
168168
localStorage.removeItem('notebookValue');
169-
localStorageValue = '';
169+
lastClusterName = '';
170170
loadDpmsWidget('');
171171
} else {
172172
if (
173-
localStorageValue === '' &&
173+
lastClusterName === '' &&
174174
newValue.title.label !== 'Launcher' &&
175175
newValue.title.label !== 'Config Setup' &&
176176
newValue.title.label !== 'Clusters' &&
177177
newValue.title.label !== 'Serverless'
178178
) {
179179
let oldNotebook = localStorage.getItem('oldNotebookValue');
180180
localStorage.setItem('notebookValue', oldNotebook || '');
181-
localStorageValue = localStorage.getItem('notebookValue') || '';
181+
lastClusterName = localStorage.getItem('notebookValue') || '';
182182
loadDpmsWidget(oldNotebook || '');
183183
}
184184
}

0 commit comments

Comments
 (0)