Merge pull request +9396 from c9/feature/experiemental

Added experimental panel in preferences
pull/199/head
Harutyun Amirjanyan 2015-09-16 14:43:09 +04:00
commit 664e704e98
10 zmienionych plików z 164 dodań i 26 usunięć

Wyświetl plik

@ -687,6 +687,7 @@ module.exports = function(options) {
basePath: workspaceDir,
local: options.local
},
"plugins/c9.ide.preferences/experimental",
{
packagePath: "plugins/c9.ide.login/login",
staticPrefix: staticPrefix + "/plugins/c9.ide.login",

Wyświetl plik

@ -55,7 +55,7 @@
"c9"
],
"c9plugins": {
"c9.ide.language": "#3c703d6784",
"c9.ide.language": "#ff78609c3f",
"c9.ide.language.css": "#a649f2a710",
"c9.ide.language.generic": "#77d43cfaf0",
"c9.ide.language.html": "#0f4078c187",
@ -98,7 +98,7 @@
"c9.ide.preview.browser": "#c50007ebbc",
"c9.ide.preview.markdown": "#ab8d30ad9f",
"c9.ide.pubsub": "#a85fb27eca",
"c9.ide.readonly": "#f6f07bbe42",
"c9.ide.readonly": "#c699cb172b",
"c9.ide.recentfiles": "#7c099abf40",
"c9.ide.remote": "#301d2ab519",
"c9.ide.processlist": "#bc11818bb5",
@ -106,7 +106,7 @@
"c9.ide.run.build": "#0598fff697",
"c9.ide.run.debug.xdebug": "#61dcbd0180",
"c9.ide.save": "#e00549cb0f",
"c9.ide.scm": "#9bedd0fcd3",
"c9.ide.scm": "#3fd9065f59",
"c9.ide.terminal.monitor": "#b76f1c9f24",
"c9.ide.theme.flat": "#2de8414db7",
"c9.ide.threewaymerge": "#229382aa0b",

Wyświetl plik

@ -395,7 +395,7 @@ define(function(require, exports, module) {
hash[key] = value;
// Tell everyone this property changed
emit(parts.join("/"));
emit(parts.join("/"), value);
// Tell everyone it's parent changed
emit(query, value);

Wyświetl plik

@ -3,7 +3,7 @@ define(function(require, exports, module) {
main.consumes = [
"Plugin", "vfs", "fs", "plugin.loader", "c9", "ext", "watcher",
"dialog.notification", "ui", "menus", "commands", "settings", "auth",
"installer", "find", "util"
"installer", "find", "util", "preferences.experimental"
];
main.provides = ["plugin.debug"];
return main;
@ -25,6 +25,7 @@ define(function(require, exports, module) {
var auth = imports.auth;
var loader = imports["plugin.loader"];
var notify = imports["dialog.notification"].show;
var experimental = imports["preferences.experimental"];
var dirname = require("path").dirname;
var basename = require("path").basename;
@ -41,7 +42,7 @@ define(function(require, exports, module) {
var plugins = [];
var ENABLED = c9.location.indexOf("debug=2") > -1;
var HASSDK = c9.location.indexOf("sdk=0") === -1;
var HASSDK = experimental.addExperiment("sdk=0", "SDK/Load Custom Plugins");;
var reParts = /^(builders|keymaps|modes|outline|runners|snippets|themes)\/(.*)/;
var reModule = /(?:_highlight_rules|_test|_worker|_fold|_behaviou?r)\.js$/;

Wyświetl plik

@ -1,6 +1,7 @@
define(function(require, exports, module) {
main.consumes = [
"Plugin", "proc", "c9", "pubsub", "auth", "util", "installer"
"Plugin", "proc", "c9", "pubsub", "auth", "util", "installer",
"preferences.experimental"
];
main.provides = ["plugin.installer"];
return main;
@ -13,6 +14,7 @@ define(function(require, exports, module) {
var auth = imports.auth;
var pubsub = imports.pubsub;
var installer = imports.installer;
var experimental = imports["preferences.experimental"];
var async = require("async");
@ -25,7 +27,7 @@ define(function(require, exports, module) {
var plugin = new Plugin("Ajax.org", main.consumes);
var emit = plugin.getEmitter();
var HASSDK = c9.location.indexOf("sdk=0") === -1;
var HASSDK = experimental.addExperiment("sdk=0", "SDK/Load Custom Plugins");
var installing;

Wyświetl plik

@ -1,7 +1,8 @@
/*global requirejs*/
define(function(require, exports, module) {
main.consumes = [
"Plugin", "vfs", "c9", "plugin.installer", "fs", "auth"
"Plugin", "vfs", "c9", "plugin.installer", "fs", "auth",
"preferences.experimental"
];
main.provides = ["plugin.loader"];
return main;
@ -13,6 +14,7 @@ define(function(require, exports, module) {
var fs = imports.fs;
var auth = imports.auth;
var installer = imports["plugin.installer"];
var experimental = imports["preferences.experimental"];
var dirname = require("path").dirname;
var join = require("path").join;
@ -26,8 +28,8 @@ define(function(require, exports, module) {
var plugin = new Plugin("Ajax.org", main.consumes);
// var emit = plugin.getEmitter();
var ENABLED = (c9.location.indexOf("plugins=0") === -1);
var HASSDK = (c9.location.indexOf("sdk=0") === -1);
var ENABLED = experimental.addExperiment("plugins=0", "SDK/Load Plugins From Workspace");
var HASSDK = experimental.addExperiment("sdk=0", "SDK/Load Custom Plugins");
var plugins = options.plugins;
var loadFromDisk = options.loadFromDisk

Wyświetl plik

@ -3,7 +3,8 @@ define(function(require, exports, module) {
main.consumes = [
"PreferencePanel", "settings", "ui", "util", "Form", "ext", "c9",
"dialog.alert", "dialog.confirm", "layout", "proc", "menus", "commands",
"dialog.error", "tree.favorites", "fs", "tree", "plugin.debug"
"dialog.error", "tree.favorites", "fs", "tree", "plugin.debug",
"preferences.experimental"
];
main.provides = ["plugin.manager"];
return main;
@ -56,6 +57,7 @@ define(function(require, exports, module) {
var showError = imports["dialog.error"].show;
var favs = imports["tree.favorites"];
var pluginDebug = imports["plugin.debug"];
var experimental = imports["preferences.experimental"];
var search = require("../c9.ide.navigate/search");
var Tree = require("ace_tree/tree");
@ -103,7 +105,7 @@ define(function(require, exports, module) {
});
// var emit = plugin.getEmitter();
var HASSDK = c9.location.indexOf("sdk=0") === -1;
var HASSDK = experimental.addExperiment("sdk=0", "SDK/Load Custom Plugins");
var model, datagrid, filterbox;
var btnUninstall, btnReport, btnReadme, btnCloud9, btnReload;

Wyświetl plik

@ -1,7 +1,8 @@
define(function(require, exports, module) {
main.consumes = [
"Editor", "editors", "ui", "commands", "menus", "layout",
"tabManager", "util", "settings", "api", "c9"
"tabManager", "util", "settings", "api", "c9",
"preferences.experimental"
];
main.provides = ["plugin.packages"];
return main;
@ -18,6 +19,7 @@ define(function(require, exports, module) {
var util = imports.util;
var layout = imports.layout;
var ui = imports.ui;
var experimental = imports["preferences.experimental"];
/***** Initialization *****/
@ -29,7 +31,7 @@ define(function(require, exports, module) {
var emit = handle.getEmitter();
emit.setMaxListeners(1000);
var HASSDK = c9.location.indexOf("sdk=0") === -1;
var HASSDK = experimental.addExperiment("sdk=0", "SDK/Load Custom Plugins");
function focusOpenPackages(){
var pages = tabs.getTabs();

Wyświetl plik

@ -0,0 +1,129 @@
define(function(require, exports, module) {
main.consumes = [
"PreferencePanel", "ui", "dialog.confirm", "settings",
"preferences", "c9"
];
main.provides = ["preferences.experimental"];
return main;
function main(options, imports, register) {
var PreferencePanel = imports.PreferencePanel;
var prefs = imports.preferences;
var settings = imports.settings;
var ui = imports.ui;
var c9 = imports.c9;
/***** Initialization *****/
var plugin = new PreferencePanel("Ajax.org", main.consumes, {
caption: "Experimental",
form: true,
index: 500
});
var emit = plugin.getEmitter();
emit.setMaxListeners(1000);
var intro;
var loaded = false;
function load() {
if (loaded) return false;
loaded = true;
settings.setDefaults("state/experiments", [["@enabled", true]]);
plugin.form.add([{
type: "custom",
title: "Introduction",
position: 1,
node: intro = new ui.bar({
height: 102,
"class" : "intro",
style: "padding:12px;position:relative;"
})
}], plugin);
}
var drawn = false;
function draw(e) {
if (drawn) return;
drawn = true;
intro.$int.innerHTML =
'<h1>Experimental Features (reload to apply changes)</h1><p style="white-space:normal">Cloud9 is continuously in '
+ 'development. New features in alpha or beta are first hidden '
+ 'and can be enabled via this page. <i>Use at your own risk</i></p>';
}
/***** Methods *****/
// =0 means the value should be set to 0 to disable otherwise it is enabled
// =1 means the value should be set to 1 to enable otherwise it is disabled
var found = {};
function addExperiment(query, name){
if (found[name]) return;
found[name] = true;
var key = query.split("=");
var defValue = Number(key[1]); key = key[0];
var uniqueId = key.replace(/\//g, "-");
var parts = name.split("/");
var current, obj = { "Experimental": current = {} };
for (var i = 0; i < parts.length; i++) {
current[parts[i]] = current = {};
}
current.type = "checkbox";
current.setting = "state/experiments/@" + uniqueId;
plugin.add(obj, plugin);
settings.setDefaults("state/experiments", [[uniqueId, !defValue]]);
// return value from url if present, otherwise return the setting
var idx = c9.location.indexOf(key + "=");
if (idx !== -1) {
if (c9.location.indexOf(key + "=0"))
return false;
if (c9.location.indexOf(key + "=1"))
return true;
}
return settings.getBool(current.setting);
}
/***** Lifecycle *****/
plugin.on("load", function() {
load();
});
plugin.on("draw", function(e) {
draw(e);
});
plugin.on("unload", function() {
loaded = false;
drawn = false;
intro = null;
});
/***** Register and define API *****/
/**
*
**/
plugin.freezePublicAPI({
_events: [
],
/**
*
*/
addExperiment: addExperiment
});
register(null, {
"preferences.experimental": plugin
});
}
});

Wyświetl plik

@ -91,13 +91,8 @@ function plugin(options, imports, register) {
},
}
}, function(req, res, next) {
var configType = null;
if (req.params.workspacetype)
configType = "workspace-" + req.params.workspacetype;
else if (req.params.devel)
configType = "devel";
var configName = getConfigName(configType, options);
var configName = getConfigName(req.params, options);
var collab = options.collab && req.params.collab !== 0 && req.params.nocollab != 1;
var opts = extend({}, options);
@ -118,7 +113,7 @@ function plugin(options, imports, register) {
opts.options.debug = req.params.debug !== undefined;
res.setHeader("Cache-Control", "no-cache, no-store");
res.render(__dirname + "/views/standalone.html.ejs", {
architectConfig: getConfig(configType, opts),
architectConfig: getConfig(configName, opts),
configName: configName,
packed: opts.packed,
version: opts.version
@ -284,8 +279,12 @@ function plugin(options, imports, register) {
function getConfigName(requested, options) {
var name;
if (requested) {
name = requested;
if (requested && requested.workspacetype) {
name = requested.workspacetype;
if (name == "readonly" || name == "ro")
name = "default-ro";
else
name = "workspace-" + name;
}
else if (options.workspaceType) {
name = "workspace-" + options.workspaceType;
@ -307,8 +306,8 @@ function getConfigName(requested, options) {
return name;
}
function getConfig(requested, options) {
var filename = __dirname + "/../../configs/client-" + getConfigName(requested, options) + ".js";
function getConfig(configName, options) {
var filename = __dirname + "/../../configs/client-" + configName + ".js";
var installPath = options.settingDir || options.installPath || "";
var workspaceDir = options.options.workspaceDir;