Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimize textarea editor by ace framework #828

Merged
merged 2 commits into from
Nov 16, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion apollo-portal/src/main/resources/static/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
应用Id</label>
<div class="col-sm-3">
<input type="text" class="form-control" name="appId" ng-model="app.appId">
<small>(CMS上申请的App Id)</small>
<small>(应用唯一标识)</small>
</div>
</div>
<div class="form-group" valdr-form-group>
Expand Down
10 changes: 10 additions & 0 deletions apollo-portal/src/main/resources/static/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,16 @@ <h4 class="modal-title">创建灰度须知</h4>

<script src="vendor/clipboard.min.js" type="text/javascript"></script>

<script src="vendor/ui-ace/ace.js" type="text/javascript"></script>
<script src="vendor/ui-ace/ui-ace.min.js" type="text/javascript"></script>
<script src="vendor/ui-ace/mode-properties.js" type="text/javascript"></script>
<script src="vendor/ui-ace/mode-xml.js" type="text/javascript"></script>
<script src="vendor/ui-ace/mode-yaml.js" type="text/javascript"></script>
<script src="vendor/ui-ace/mode-json.js" type="text/javascript"></script>
<script src="vendor/ui-ace/worker-json.js" type="text/javascript"></script>
<script src="vendor/ui-ace/worker-xml.js" type="text/javascript"></script>



<!--valdr-->
<script src="vendor/valdr/valdr.min.js" type="text/javascript"></script>
Expand Down
2 changes: 1 addition & 1 deletion apollo-portal/src/main/resources/static/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var directive_module = angular.module('apollo.directive', ['app.service', 'app.u
// 首页
var index_module = angular.module('index', ['toastr', 'app.service', 'apollo.directive', 'app.util', 'angular-loading-bar']);
//项目主页
var application_module = angular.module('application', ['app.service', 'apollo.directive', 'app.util', 'toastr', 'angular-loading-bar', 'valdr']);
var application_module = angular.module('application', ['app.service', 'apollo.directive', 'app.util', 'toastr', 'angular-loading-bar', 'valdr', 'ui.ace']);
//创建项目页面
var app_module = angular.module('create_app', ['apollo.directive', 'toastr', 'app.service', 'app.util', 'angular-loading-bar', 'valdr']);
//配置同步页面
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ function controller($rootScope, $scope, toastr, AppUtil, EventManager, ConfigSer

new Clipboard('.clipboard');


}


Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function directive($window, toastr, AppUtil, EventManager, PermissionService, Na
scope.editRuleItem = editRuleItem;

scope.deleteNamespace = deleteNamespace;

var subscriberId = EventManager.subscribe(EventManager.EventType.UPDATE_GRAY_RELEASE_RULES,
function (context) {
useRules(context.branch);
Expand Down Expand Up @@ -208,9 +208,9 @@ function directive($window, toastr, AppUtil, EventManager, PermissionService, Na
}

function generateNamespaceId(namespace) {
namespace.id = Math.random().toString(36).substr(2);
namespace.id = Math.random().toString(36).substr(2);
}

function initPermission(namespace) {

PermissionService.has_modify_namespace_permission(
Expand Down Expand Up @@ -415,7 +415,7 @@ function directive($window, toastr, AppUtil, EventManager, PermissionService, Na
}

function loadInstanceInfo(namespace) {

var size = 20;
if (namespace.isBranch) {
size = 2000;
Expand Down Expand Up @@ -604,7 +604,7 @@ function directive($window, toastr, AppUtil, EventManager, PermissionService, Na
scope.namespace.baseInfo.namespaceName,
branch.baseInfo.clusterName,
branch.rules
)
)
.then(function (result) {
toastr.success('灰度规则更新成功');

Expand Down Expand Up @@ -798,14 +798,32 @@ function directive($window, toastr, AppUtil, EventManager, PermissionService, Na
function rollback(namespace) {
EventManager.emit(EventManager.EventType.PRE_ROLLBACK_NAMESPACE, {namespace: namespace});
}

function deleteNamespace(namespace) {
EventManager.emit(EventManager.EventType.PRE_DELETE_NAMESPACE, {namespace: namespace});
EventManager.emit(EventManager.EventType.PRE_DELETE_NAMESPACE, {namespace: namespace});
}

//theme: https://github.com/ajaxorg/ace-builds/tree/ba3b91e04a5aa559d56ac70964f9054baa0f4caf/src-min
scope.aceConfig = {
$blockScrolling: Infinity,
showPrintMargin: false,
theme: 'eclipse',
mode: scope.namespace.format === 'yml' ? 'yaml' : scope.namespace.format,
onLoad: function (_editor) {
_editor.$blockScrolling = Infinity;
_editor.setOptions({
fontSize: 13,
minLines: 10,
maxLines: 20
})
}
};

setTimeout(function () {
scope.namespace.show = true;
}, 70);


}
}
}
Expand Down
13 changes: 13 additions & 0 deletions apollo-portal/src/main/resources/static/vendor/ui-ace/ace.js

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading