Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ conf/interpreter.json
conf/notebook-authorization.json
conf/shiro.ini
conf/credentials.json
conf/code-editor.json

# other generated files
spark/dependency-reduced-pom.xml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.apache.zeppelin.search.SearchService;
import org.apache.zeppelin.socket.NotebookServer;
import org.apache.zeppelin.user.Credentials;
import org.apache.zeppelin.util.CodeEditorWebSettings;
import org.apache.zeppelin.utils.SecurityUtils;
import org.eclipse.jetty.http.HttpVersion;
import org.eclipse.jetty.server.*;
Expand All @@ -70,6 +71,7 @@ public class ZeppelinServer extends Application {
public static NotebookServer notebookWsServer;
public static Helium helium;
public static HeliumApplicationFactory heliumApplicationFactory;
public static CodeEditorWebSettings webEditorSetting;

private SchedulerFactory schedulerFactory;
private InterpreterFactory replFactory;
Expand Down Expand Up @@ -103,6 +105,10 @@ public ZeppelinServer() throws Exception {
// to update fire websocket event on application event.
heliumApplicationFactory.setApplicationEventListener(notebookWsServer);

webEditorSetting = new CodeEditorWebSettings(conf);
// user web editor settings
webEditorSetting.deserialize();

notebook.addNotebookEventListener(heliumApplicationFactory);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
import org.apache.zeppelin.scheduler.Job.Status;
import org.apache.zeppelin.server.ZeppelinServer;
import org.apache.zeppelin.ticket.TicketContainer;
import org.apache.zeppelin.util.CodeEditorWebSettings;
import org.apache.zeppelin.util.CodeEditorWebSettings.EditorConfig;
import org.apache.zeppelin.utils.SecurityUtils;
import org.eclipse.jetty.websocket.servlet.WebSocketServlet;
import org.eclipse.jetty.websocket.servlet.WebSocketServletFactory;
Expand Down Expand Up @@ -88,6 +90,7 @@ String getKey() {
private Notebook notebook() {
return ZeppelinServer.notebook;
}
private CodeEditorWebSettings codeEditorWebSettings() { return ZeppelinServer.webEditorSetting; }

@Override
public void configure(WebSocketServletFactory factory) {
Expand Down Expand Up @@ -234,6 +237,12 @@ public void onMessage(NotebookSocket conn, String msg) {
case LIST_UPDATE_NOTEBOOK_JOBS:
unicastUpdateNotebookJobInfo(conn, messagereceived);
break;
case GET_USER_CODE_EDITOR_SETTING:
getUserCodeEditorSetting(conn, messagereceived);
break;
case SAVE_USER_CODE_EDITOR_SETTING:
saveUserCodeEditorSetting(conn, messagereceived);
break;
default:
break;
}
Expand Down Expand Up @@ -743,6 +752,40 @@ private void completion(NotebookSocket conn, HashSet<String> userAndRoles, Noteb
conn.send(serializeMessage(resp));
}

// clover
private void getUserCodeEditorSetting(NotebookSocket conn, Message fromMessage)
throws IOException {
String userName = (String) fromMessage.get("principal");

if (userName == null) {
throw new IOException("principal is null");
}

List<EditorConfig> userEditorSetting = codeEditorWebSettings().getUserEditorConfig(userName);

if (userEditorSetting == null) {
LOG.info("does not exists [{}] user code editor settings", userName);
conn.send(serializeMessage(new Message(OP.GET_USER_CODE_EDITOR_SETTING)
.put("editorSettings", new LinkedList<>())));
} else {
conn.send(serializeMessage(new Message(OP.GET_USER_CODE_EDITOR_SETTING)
.put("editorSettings", userEditorSetting)));
}
}

private void saveUserCodeEditorSetting(NotebookSocket conn, Message fromMessage)
throws IOException {
List<EditorConfig> userEditorSetting = fromMessage.getType("editorSettings");
String userName = (String) fromMessage.get("principal");
if (userName == null) {
throw new IOException("principal is null");
}
codeEditorWebSettings().setUserEditorConfig(userName, userEditorSetting);
codeEditorWebSettings().serialize();

conn.send(serializeMessage(new Message(OP.SAVE_USER_CODE_EDITOR_SETTING)));
}

/**
* When angular object updated from client
*
Expand Down
49 changes: 42 additions & 7 deletions zeppelin-web/bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,50 @@
"ace-builds": {
"main": [
"src-noconflict/ace.js",
"src-noconflict/mode-scala.js",
"src-noconflict/mode-python.js",
"src-noconflict/mode-sql.js",
"src-noconflict/mode-markdown.js",
"src-noconflict/mode-sh.js",
"src-noconflict/mode-r.js",
"src-noconflict/mode-scala.js",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indention does not look aligned with the parent "main" above. Previous one was.

Also, adding such changes to PR that implements new functions makes code review task harder (and slower) - now everyone who reads this need to think, if this changes are part of the new feature or not.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bzz
I will fix.

"src-noconflict/mode-python.js",
"src-noconflict/mode-sql.js",
"src-noconflict/mode-markdown.js",
"src-noconflict/mode-sh.js",
"src-noconflict/mode-r.js",
"src-noconflict/mode-mysql.js",
"src-noconflict/mode-pgsql.js",
"src-noconflict/mode-javascript.js",
"src-noconflict/mode-java.js",
"src-noconflict/keybinding-emacs.js",
"src-noconflict/ext-language_tools.js",
"src-noconflict/theme-chrome.js"
"src-noconflict/theme-ambiance.js",
"src-noconflict/theme-chaos.js",
"src-noconflict/theme-chrome.js",
"src-noconflict/theme-clouds.js",
"src-noconflict/theme-clouds_midnight.js",
"src-noconflict/theme-cobalt.js",
"src-noconflict/theme-crimson_editor.js",
"src-noconflict/theme-dawn.js",
"src-noconflict/theme-dreamweaver.js",
"src-noconflict/theme-eclipse.js",
"src-noconflict/theme-github.js",
"src-noconflict/theme-idle_fingers.js",
"src-noconflict/theme-katzenmilch.js",
"src-noconflict/theme-kr_theme.js",
"src-noconflict/theme-kuroir.js",
"src-noconflict/theme-merbivore.js",
"src-noconflict/theme-merbivore_soft.js",
"src-noconflict/theme-mono_industrial.js",
"src-noconflict/theme-monokai.js",
"src-noconflict/theme-pastel_on_dark.js",
"src-noconflict/theme-solarized_dark.js",
"src-noconflict/theme-solarized_light.js",
"src-noconflict/theme-terminal.js",
"src-noconflict/theme-textmate.js",
"src-noconflict/theme-tomorrow.js",
"src-noconflict/theme-tomorrow_night.js",
"src-noconflict/theme-tomorrow_night_blue.js",
"src-noconflict/theme-tomorrow_night_bright.js",
"src-noconflict/theme-tomorrow_night_eighties.js",
"src-noconflict/theme-twilight.js",
"src-noconflict/theme-vibrant_ink.js",
"src-noconflict/theme-xcode.js"
],
"version": "1.1.9",
"name": "ace-builds"
Expand Down
4 changes: 4 additions & 0 deletions zeppelin-web/src/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@
templateUrl: 'app/configuration/configuration.html',
controller: 'ConfigurationCtrl'
})
.when('/configuration/editor', {
templateUrl: 'app/editor-configuration/editor.configuration.html',
controller: 'EditorConfigurationCtrl'
})
.when('/search/:searchTerm', {
templateUrl: 'app/search/result-list.html',
controller: 'SearchResultCtrl'
Expand Down
Loading