Skip to content

Commit

Permalink
Fix #568
Browse files Browse the repository at this point in the history
  • Loading branch information
gashcrumb committed Oct 14, 2013
1 parent 6bc3f7c commit 2a03ca2
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 6 deletions.
16 changes: 10 additions & 6 deletions hawtio-web/src/main/webapp/app/wiki/html/viewPage.html
Expand Up @@ -69,24 +69,28 @@
data-placement="bottom">
<i class="icon-comments-alt"></i> History</a>
</li>
<!--
<li class="divider">
</li>
<li>
<a ng-click="openRenameDialog()" ng-disabled="gridOptions.selectedItems.length !== 1"
-->
<li ng-hide="gridOptions.selectedItems.length !== 1">
<a ng-click="openRenameDialog()"
title="Rename the selected document"
data-placement="bottom">
<i class="icon-adjust"></i> Rename</a>
</li>
<li>
<a ng-click="openMoveDialog()" ng-disabled="!gridOptions.selectedItems.length"
<li ng-hide="!gridOptions.selectedItems.length">
<a ng-click="openMoveDialog()"
title="move the selected documents to a new folder"
data-placement="bottom">
<i class="icon-move"></i> Move</a>
</li>
<!--
<li class="divider">
</li>
<li>
<a ng-click="openDeleteDialog()" ng-disabled="!gridOptions.selectedItems.length"
-->
<li ng-hide="!gridOptions.selectedItems.length">
<a ng-click="openDeleteDialog()"
title="Delete the selected document(s)"
data-placement="bottom">
<i class="icon-remove"></i> Delete</a>
Expand Down
12 changes: 12 additions & 0 deletions hawtio-web/src/main/webapp/app/wiki/js/helpers.ts
Expand Up @@ -27,6 +27,13 @@ module Wiki {
icon: "/app/wiki/img/folder.gif",
exemplar: "New Folder"
},
{
label: "Fabric Profile",
tooltip: "Create a new empty Fabric profile. Using a hyphen ('-') will create a folder heirarchy, for example 'my-awesome-profile' will be available via the path 'my/awesome/profile'.",
profile: true,
addClass: "icon-book green",
exemplar: "user-profile"
},
{
label: "Properties File",
tooltip: "A properties file typically used to configure Java classes",
Expand Down Expand Up @@ -98,6 +105,11 @@ module Wiki {
node.parent = parent;
node.entity = template;

var addClass = template.addClass;
if (addClass) {
node.addClass = addClass;
}

var key = template.exemplar;
var parentKey = parent.key || "";
node.key = parentKey ? parentKey + "_" + key : key;
Expand Down
41 changes: 41 additions & 0 deletions hawtio-web/src/main/webapp/app/wiki/js/view.ts
Expand Up @@ -240,6 +240,47 @@ module Wiki {
var link = Wiki.viewLink($scope.branch, path, $location);
goToLink(link, $timeout, $location);
});
} else if (template.profile) {

if (name.endsWith(".profile")) {
name = name.replace(".profile", '');
}

Fabric.createProfile(workspace.jolokia, $scope.branch, name, ['default'], () => {

$scope.addDialog.close();
notification('success', 'Created profile ' + name);

Fabric.newConfigFile(workspace.jolokia, $scope.branch, name, 'ReadMe.md', () => {

notification('info', 'Created empty Readme.md in profile ' + name);
Core.$apply($scope);

var contents = "Here's an empty ReadMe.md for '" + name + "', please update!";

Fabric.saveConfigFile(workspace.jolokia, $scope.branch, name, 'ReadMe.md', contents.encodeBase64(), () => {
notification('info', 'Updated Readme.md in profile ' + name);

Core.$apply($scope);

var link = Wiki.viewLink($scope.branch, path + '.profile', $location);
goToLink(link, $timeout, $location);

}, (response) => {
notification('error', 'Failed to set ReadMe.md data in profile ' + name + ' due to ' + response.error);
Core.$apply($scope);
});
}, (response) => {
notification('error', 'Failed to create ReadMe.md in profile ' + name + ' due to ' + response.error);
Core.$apply($scope);
});

}, (response) => {
notification('error', 'Failed to create profile ' + name + ' due to ' + response.error);
Core.$apply($scope);
})


} else {
notification("success", "Creating new document " + name);

Expand Down
17 changes: 17 additions & 0 deletions hawtio-web/src/main/webapp/css/site-base.css
Expand Up @@ -2555,3 +2555,20 @@ i.expandable-indicator.folder {
height: 45px;
}

[class^="dynatree-folder icon-"], [class*=" dynatree-folder icon-"] {

}

[class^="dynatree-folder icon-"]:before, [class*=" dynatree-folder icon-"]:before {
font-size: 17px;
margin-left: 18px;
}


[class^="dynatree-folder icon-"], [class*=" dynatree-folder icon-"] .dynatree-connector {
display: none;
}

[class^="dynatree-folder icon-"], [class*=" dynatree-folder icon-"] .dynatree-icon {
display: none;
}

0 comments on commit 2a03ca2

Please sign in to comment.