diff --git a/app/index.html b/app/index.html index 48ba90eb190..be95fcd9514 100644 --- a/app/index.html +++ b/app/index.html @@ -94,7 +94,7 @@ - + diff --git a/app/scripts/app.js b/app/scripts/app.js index bcf3f57bc84..f32070d77d2 100644 --- a/app/scripts/app.js +++ b/app/scripts/app.js @@ -81,6 +81,16 @@ App.config(function ($routeProvider) { controller: 'ClassEditController', resolve: DatabaseResolve }) + .when('/database/:database/schema/create/:clazz', { + templateUrl: 'views/database/createRecord.html', + controller: 'CreateController', + resolve: DatabaseResolve + }). + when('/database/:database/schema/editclass/:clazz', { + templateUrl: 'views/database/editclass.html', + controller: 'ClassEditController', + resolve: DatabaseResolve + }) .when('/database/:database/db', { templateUrl: 'views/database/configuration.html', controller: 'ConfigurationController', diff --git a/app/scripts/controllers/document-controller.js b/app/scripts/controllers/document-controller.js index 3eb86936793..d5d706d5a12 100644 --- a/app/scripts/controllers/document-controller.js +++ b/app/scripts/controllers/document-controller.js @@ -288,6 +288,7 @@ function BaseEditController($scope, $routeParams, $route, $location, $modal, $q, if (type == 'INTEGER') { $scope.doc[name] = 0; } + console.log(type); if (Database.getMappingFor(type)) { if (types) { types = types + ',' + name + '=' + Database.getMappingFor(type); @@ -319,4 +320,19 @@ function BaseEditController($scope, $routeParams, $route, $location, $modal, $q, $scope.create = function () { $location.path('database/' + $scope.database + '/browse/create/' + $scope.doc['@class']); } -} \ No newline at end of file +} +DocController.controller("EmbeddedController", ['$scope', '$ojson', function ($scope, $ojson) { + + + $scope.viewerOptions = { + lineWrapping: true, + lineNumbers: true, + mode: 'javascript', + onLoad: function (_cm) { + $scope.vcm = _cm; + $scope.vcm.setValue(JSON.stringify($scope.doc[$scope.header])); + } + + }; + +}]); \ No newline at end of file diff --git a/app/scripts/controllers/function-controller.js b/app/scripts/controllers/function-controller.js index 758ba1a9499..34c0cf58d97 100644 --- a/app/scripts/controllers/function-controller.js +++ b/app/scripts/controllers/function-controller.js @@ -13,6 +13,10 @@ schemaModule.controller("FunctionController", ['$scope', '$routeParams', '$locat $scope.executeFunction(); } + }, + onLoad: function (_cm) { + $scope.vcm = _cm; + $scope.createNewFunction(); } }; Database.setWiki("https://github.com/orientechnologies/orientdb-studio/wiki/Functions"); @@ -159,6 +163,8 @@ schemaModule.controller("FunctionController", ['$scope', '$routeParams', '$locat $scope.selectedLanguage = selectedFunction['language']; $scope.functionToExecute = selectedFunction; $scope.inParams = $scope.functionToExecute['parameters']; + $scope.vcm.setValue($scope.consoleValue != null ? $scope.consoleValue : ""); + } $scope.showInConsole = function (selectedFunction) { @@ -195,6 +201,7 @@ schemaModule.controller("FunctionController", ['$scope', '$routeParams', '$locat if ($scope.isNewFunction == true) { DocumentApi.createDocument($scope.database.getName(), $scope.functionToExecute['@rid'], $scope.functionToExecute, function (data) { $scope.getListFunction(); + $scope.isNewFunction = false; var message = 'Function saved successfully. Server returns ' + JSON.stringify(data); Notification.push({content: message }); } @@ -240,7 +247,6 @@ schemaModule.controller("FunctionController", ['$scope', '$routeParams', '$locat }); } - $scope.createNewFunction(); }]) ; diff --git a/app/scripts/controllers/header-controller.js b/app/scripts/controllers/header-controller.js index 833925a9ef2..d000d4bc4d0 100644 --- a/app/scripts/controllers/header-controller.js +++ b/app/scripts/controllers/header-controller.js @@ -31,7 +31,10 @@ angular.module('header.controller', ['database.services']).controller("HeaderCon var find = $location.path().indexOf("/" + element.name.toLowerCase()); if (find != -1) { $scope.selectedMenu = element; - + if (!$scope.$$phase && !$scope.$root.$$phase) { + $scope.$apply(); + } + return; } }); diff --git a/app/scripts/controllers/schema-controller.js b/app/scripts/controllers/schema-controller.js index 68ea0435bab..5325149ca69 100644 --- a/app/scripts/controllers/schema-controller.js +++ b/app/scripts/controllers/schema-controller.js @@ -23,7 +23,7 @@ schemaModule.controller("SchemaController", ['$scope', '$routeParams', '$locatio $scope.classClicked = clazz; } $scope.openClass = function (clazz) { - $location.path("/database/" + $scope.database.getName() + "/browse/editclass/" + clazz.name); + $location.path("/database/" + $scope.database.getName() + "/schema/editclass/" + clazz.name); } $scope.refreshWindow = function () { $window.location.reload(); @@ -343,7 +343,7 @@ schemaModule.controller("IndexController", ['$scope', '$routeParams', '$location $scope.prop2add.splice(index, 1) } var first = true; - $scope.nameIndexToShow = $scope.classInject + '_'; + $scope.nameIndexToShow = $scope.classInject + '.'; for (entry in $scope.prop2add) { if (first) { @@ -526,7 +526,6 @@ schemaModule.controller("NewClassController", ['$scope', '$routeParams', '$locat schemaModule.controller("IndexesController", ['$scope', '$routeParams', '$location', 'Database', 'CommandApi', '$modal', '$q', '$route', function ($scope, $routeParams, $location, Database, CommandApi, $modal, $q, $route) { $scope.indexes = Database.getMetadata()["indexes"]; - console.log($scope.indexes); $scope.rebuildIndex = function (indexName) { var sql = 'REBUILD INDEX ' + indexName; @@ -551,4 +550,20 @@ schemaModule.controller("IndexesController", ['$scope', '$routeParams', '$locati } }); } + $scope.getFields = function (definition) { + var fields = ""; + if (definition) { + if (definition.indexDefinitions) { + fields += " ["; + definition.indexDefinitions.forEach(function (elem, idx, array) { + if (idx > 0)fields += "," + fields += elem.field; + }); + fields += "]"; + } else { + fields += "[" + definition.field + "]"; + } + } + return fields; + } }]); diff --git a/app/scripts/services/database-services.js b/app/scripts/services/database-services.js index 6ecdc127180..bf0e7d16d7a 100644 --- a/app/scripts/services/database-services.js +++ b/app/scripts/services/database-services.js @@ -34,7 +34,7 @@ database.factory('Database', function (DatabaseApi, localStorageService) { listTypes: ['BINARY', 'BYTE', 'BOOLEAN', 'EMBEDDED', 'EMBEDDEDLIST', 'EMBEDDEDMAP', 'EMBEDDEDSET', 'DECIMAL', 'FLOAT', 'DATE', 'DATETIME', 'DOUBLE', 'INTEGER', 'LINK', 'LINKLIST', 'LINKMAP', 'LINKSET', 'LONG', 'SHORT', 'STRING'], - mapping: { 'BINARY': 'b', 'BYTE': 'b', 'DATE': 'a', 'DATETIME': 't', 'FLOAT': 'f', 'DECIMAL': 'c', 'LONG': 'l', 'DOUBLE': 'd', 'SHORT': 's', 'LINKSET': 'e'}, + mapping: { 'BINARY': 'b', 'BYTE': 'b', 'DATE': 'a', 'DATETIME': 't', 'FLOAT': 'f', 'DECIMAL': 'c', 'LONG': 'l', 'DOUBLE': 'd', 'SHORT': 's', 'LINKSET': 'e', 'EMBEDDEDLIST': 'e', 'EMBEDDEDMAP': 'e', 'EMBEDDEDSET': 'e', 'EMBEDDED': 'e'}, getMetadata: function () { /*if (current.metadata == null) { var tmp = localStorageService.get("CurrentDB"); diff --git a/app/scripts/widgets/patch/ui-codemirror.js b/app/scripts/widgets/patch/ui-codemirror.js new file mode 100644 index 00000000000..5cfc5d4e71b --- /dev/null +++ b/app/scripts/widgets/patch/ui-codemirror.js @@ -0,0 +1,79 @@ +'use strict'; +angular.module('ui.codemirror', []).constant('uiCodemirrorConfig', {}).directive('uiCodemirror', [ + 'uiCodemirrorConfig', + function (uiCodemirrorConfig) { + return { + restrict: 'EA', + require: '?ngModel', + priority: 1, + compile: function compile(tElement) { + if (angular.isUndefined(window.CodeMirror)) { + throw new Error('ui-codemirror need CodeMirror to work... (o rly?)'); + } + var value = tElement.text(); + var codeMirror = new window.CodeMirror(function (cm_el) { + angular.forEach(tElement.prop('attributes'), function (a) { + if (a.name === 'ui-codemirror') { + cm_el.setAttribute('ui-codemirror-opts', a.textContent); + } else { + cm_el.setAttribute(a.name, a.textContent); + } + }); + if (tElement.parent().length <= 0) { + tElement.wrap('
'); + } + tElement.replaceWith(cm_el); + }, { value: value }); + return function postLink(scope, iElement, iAttrs, ngModel) { + var options, opts; + options = uiCodemirrorConfig.codemirror || {}; + opts = angular.extend({}, options, scope.$eval(iAttrs.uiCodemirror), scope.$eval(iAttrs.uiCodemirrorOpts)); + function updateOptions(newValues) { + for (var key in newValues) { + if (newValues.hasOwnProperty(key)) { + codeMirror.setOption(key, newValues[key]); + } + } + } + updateOptions(opts); + if (angular.isDefined(scope.$eval(iAttrs.uiCodemirror))) { + scope.$watch(iAttrs.uiCodemirror, updateOptions, true); + } + codeMirror.on('change', function (instance) { + var newValue = instance.getValue(); + if (ngModel && newValue !== ngModel.$viewValue) { + ngModel.$setViewValue(newValue); + } + if (!scope.$$phase && !scope.$root.$$phase) { + scope.$apply(); + } + }); + if (ngModel) { + ngModel.$formatters.push(function (value) { + if (angular.isUndefined(value) || value === null) { + return ''; + } else if (angular.isObject(value) || angular.isArray(value)) { + throw new Error('ui-codemirror cannot use an object or an array as a model'); + } + return value; + }); + ngModel.$render = function () { + var safeViewValue = ngModel.$viewValue || ''; + codeMirror.setValue(safeViewValue); + }; + } + if (iAttrs.uiRefresh) { + scope.$watch(iAttrs.uiRefresh, function (newVal, oldVal) { + if (newVal !== oldVal) { + codeMirror.refresh(); + } + }); + } + if (angular.isFunction(opts.onLoad)) { + opts.onLoad(codeMirror); + } + }; + } + }; + } +]); \ No newline at end of file diff --git a/app/scripts/widgets/widget.js b/app/scripts/widgets/widget.js index ac6435f9a3d..1db495a8280 100644 --- a/app/scripts/widgets/widget.js +++ b/app/scripts/widgets/widget.js @@ -380,7 +380,7 @@ Widget.directive('ridrender', function (Database) { i++; } }); - html = html.replace(/,([^,]*)$/,'$1'); + html = html.replace(/,([^,]*)$/, '$1'); html += ""; if (html != "" && i == value.length) { element.html(html); @@ -390,16 +390,6 @@ Widget.directive('ridrender', function (Database) { } }; }); -Widget.directive("autofill", function () { - return { - require: "ngModel", - link: function (scope, element, attrs, ngModel) { - scope.$on("autofill:update", function() { - ngModel.$setViewValue(element.val()); - }); - } - } -}); Widget.directive('dtpicker', function () { diff --git a/app/styles/main.css b/app/styles/main.css index e3d852aa1b1..d40c8851409 100644 --- a/app/styles/main.css +++ b/app/styles/main.css @@ -6,9 +6,11 @@ body { height: 100%; background-color: #E7E9EB; } + .header { box-shadow: 0 2px 4px rgba(0, 0, 0, 0.07); } + body div.container-studio { padding-top: 0px } @@ -23,9 +25,11 @@ body div.container-studio { min-height: 50px; max-height: 300px; } + .jsonView .CodeMirror { height: 200px !important; } + .CodeMirror-scroll { /*overflow-y: hidden;*/ /*overflow-x: auto;*/ @@ -155,12 +159,15 @@ div.edge form.bs-docs-example:after { position: absolute; top: -1px; } + .record-header { } + .query-header > h5 { margin: 5px 0; } + .query-header { background-color: #F5F5F5; border: 1px solid #DDDDDD; @@ -173,15 +180,22 @@ div.edge form.bs-docs-example:after { top: -1px; max-width: 30%; } + +.odoc .query-header a { + display: inline; +} + .query-header a { text-overflow: ellipsis; overflow: hidden; white-space: nowrap; - display:block; + display: block; } + .search-history { margin: 0; } + .query-actions { border: 1px solid #DDDDDD; color: #9DA0A4; @@ -195,51 +209,61 @@ div.edge form.bs-docs-example:after { .ocontainer { background-color: #FFFFFF; - box-shadow: 0 0 0 4px rgba(0,0,0,0.05); + box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.05); /*box-shadow: 0 1px 1px rgba(0,0,0,.05);*/ border: 1px solid #DDDDDD; margin: 15px 0; position: relative; } + .ocontainer-body { padding: 10px 10px 0px; } + .odoc .query-actions { border: none; } + .odoc .query-body { padding-top: 0; } + .query-container { background-color: #FFFFFF; - box-shadow: 0 0 0 4px rgba(0,0,0,0.05); + box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.05); /*box-shadow: 0 1px 1px rgba(0,0,0,.05);*/ border: 1px solid #DDDDDD; margin: 15px 0; position: relative; } + .query-body { padding: 60px 19px 14px; overflow: auto; } + .master-query .query-header { font-size: 11; } + .master-query .query-body .CodeMirror { border: none; } + .master-query .query-actions .btn-toolbar { margin-bottom: 0px; margin-top: 0px; } + .master-query .query-actions { border: none; bottom: -1px; top: auto; } + .master-query .query-info { background-color: #F5F5F5; height: 30px; @@ -247,13 +271,16 @@ div.edge form.bs-docs-example:after { padding: 0; border-top: none; } -.master-query .query-body{ + +.master-query .query-body { padding: 0px 0px 0px; height: 100%; } + .master-query .query-body > form { margin-bottom: 0; } + .query-info { background-color: #FFFFFF; border-top: 1px solid #E7E9EB; @@ -263,6 +290,7 @@ div.edge form.bs-docs-example:after { padding: 0px 19px 14px; line-height: 39px; } + .query-info .row-fluid [class*="span"] { padding-top: 8px; } @@ -551,9 +579,11 @@ ul.horizontallist, ol.horizontallist { margin-top: 0; border-radius: 4px; } + .pagination > li { display: inline; } + .pagination > li > a, .pagination > li > span { background-color: #FFFFFF; border: 1px solid #DDDDDD; @@ -564,21 +594,25 @@ ul.horizontallist, ol.horizontallist { position: relative; text-decoration: none; } + .pagination > .disabled > span, .pagination > .disabled > a, .pagination > .disabled > a:hover, .pagination > .disabled > a:focus { background-color: #FFFFFF; border-color: #DDDDDD; color: #999999; cursor: not-allowed; } + .pagination > li:first-child > a, .pagination > li:first-child > span { border-bottom-left-radius: 4px; border-top-left-radius: 4px; margin-left: 0; } + .pagination > li:last-child > a, .pagination > li:last-child > span { border-bottom-right-radius: 4px; border-top-right-radius: 4px; } + table.editClass_panel { margin-left: 20px; } @@ -614,7 +648,7 @@ ul.arrayrid > li { top: -10px; } -.animate-enter{ +.animate-enter { -webkit-transition: 400ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all; -moz-transition: 400ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all; -ms-transition: 400ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all; @@ -623,8 +657,8 @@ ul.arrayrid > li { position: relative; display: block; } -.animate-leave -{ + +.animate-leave { -webkit-transition: 400ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all; -moz-transition: 400ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all; -ms-transition: 400ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all; @@ -634,29 +668,31 @@ ul.arrayrid > li { display: block; } -.animate-enter.animate-enter-active{ +.animate-enter.animate-enter-active { opacity: 1; top: 0; height: 500px; } + .animate-leave { opacity: 1; top: 0; height: 500px; } -.animate-leave.animate-leave-active{ +.animate-leave.animate-leave-active { opacity: 0; top: -50px; height: 0px; } + .animate-enter { opacity: 0; top: -50px; height: 0px; } -.notification-enter{ +.notification-enter { -webkit-transition: 400ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all; -moz-transition: 400ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all; -ms-transition: 400ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all; @@ -665,8 +701,8 @@ ul.arrayrid > li { position: relative; display: block; } -.notification-leave -{ + +.notification-leave { -webkit-transition: 400ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all; -moz-transition: 400ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all; -ms-transition: 400ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all; @@ -676,22 +712,24 @@ ul.arrayrid > li { display: block; } -.notification-enter.notification-enter-active{ +.notification-enter.notification-enter-active { opacity: 1; top: 0; height: 50px; } + .notification-leave { opacity: 1; top: 0; height: 50px; } -.notification-leave.notification-leave-active{ +.notification-leave.notification-leave-active { opacity: 1; top: -50px; height: 0px; } + .notification-enter { opacity: 1; top: -50px; @@ -699,7 +737,7 @@ ul.arrayrid > li { } .navbar .nav > li > a { - font-family: 'Open Sans',sans-serif !important; + font-family: 'Open Sans', sans-serif !important; font-weight: 300; color: #FFFFFF; float: none; @@ -707,12 +745,15 @@ ul.arrayrid > li { text-decoration: none; font-size: 13px; } + .navbar .nav { margin-top: 4px; } -.container-notification .alert{ + +.container-notification .alert { margin-bottom: 0px; } + .class-body .btn-toolbar { margin-bottom: 0px; margin-top: 0px; diff --git a/app/views/database/index/indexMain.html b/app/views/database/index/indexMain.html index 2e4de560d07..de74157cc47 100644 --- a/app/views/database/index/indexMain.html +++ b/app/views/database/index/indexMain.html @@ -23,12 +23,16 @@ Type + - Engine + Class Properties + + Engine + Actions @@ -44,11 +48,15 @@ {{index.configuration.type}} + - {{index.configuration.algorithm}} + {{index.configuration.indexDefinition.className}} - {{index.fields}} + {{getFields(index.configuration.indexDefinition)}} + + + {{index.configuration.algorithm}} diff --git a/app/views/database/record.html b/app/views/database/record.html index 44847e27362..8f24777e258 100644 --- a/app/views/database/record.html +++ b/app/views/database/record.html @@ -1,7 +1,7 @@
-
{{ label }}: {{doc['@class']}} - {{doc['@rid']}} - Version +
{{ label }}: {{doc['@class']}} - {{doc['@rid']}} - Version {{doc['@version']}}
diff --git a/app/views/widget/embedded.html b/app/views/widget/embedded.html index 90b1da76613..58e3095798c 100644 --- a/app/views/widget/embedded.html +++ b/app/views/widget/embedded.html @@ -1,3 +1,3 @@ - - - \ No newline at end of file +
+ +
\ No newline at end of file diff --git a/app/views/widget/embeddedlist.html b/app/views/widget/embeddedlist.html index 90b1da76613..45e9cbf82dd 100644 --- a/app/views/widget/embeddedlist.html +++ b/app/views/widget/embeddedlist.html @@ -1,3 +1,5 @@ +
- - \ No newline at end of file + + +
\ No newline at end of file diff --git a/app/views/widget/embeddedmap.html b/app/views/widget/embeddedmap.html index 90b1da76613..54aeb94c173 100644 --- a/app/views/widget/embeddedmap.html +++ b/app/views/widget/embeddedmap.html @@ -1,3 +1,4 @@ - - - \ No newline at end of file +
+ + +
\ No newline at end of file diff --git a/app/views/widget/embeddedset.html b/app/views/widget/embeddedset.html new file mode 100644 index 00000000000..616e485be32 --- /dev/null +++ b/app/views/widget/embeddedset.html @@ -0,0 +1,6 @@ +
+ + + + +
\ No newline at end of file