forked from apache/incubator-atlas
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ATLAS-188 Provide Ability to Add Tag to Entity (sanjayp via sumasai)
- Loading branch information
1 parent
461a2a4
commit 4f61fff
Showing
19 changed files
with
319 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,4 @@ | |
|
||
.tab-content .table-bordered { | ||
border-top: none; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
.add-tag { | ||
text-decoration: underline; | ||
} | ||
|
||
.input-spacing{ | ||
padding-bottom: 10px!important; | ||
} | ||
|
||
.create-tag-entity .modal-footer{ | ||
border-top: 0; | ||
} | ||
|
||
.tag-list{ | ||
border:1px solid #ddd; | ||
padding:10px; | ||
background-color: #F5F5F5; | ||
} | ||
|
||
.tag-list ul{ | ||
padding-left: 0px; | ||
} | ||
|
||
.error{ | ||
color:red; | ||
} | ||
|
||
.tag-list ul li{ | ||
display: inline; | ||
line-height: 30px; | ||
border:none; | ||
padding: 0px; | ||
background-color: inherit; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
dashboard/public/modules/tags/definition/definitionTagsModule.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
angular.module('dgc.tags.definition', []); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
dashboard/public/modules/tags/instance/createTagController.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
angular.module('dgc.tags.instance').controller('CreateTagController', ['$scope', 'DetailsResource', '$modalInstance', 'typesList', 'lodash', 'TagsResource', '$stateParams', '$rootScope', 'TagClasses', 'NotificationService', | ||
function($scope, DetailsResource, $modalInstance, typesList, _, TagsResource, $stateParams, $rootScope, Categories, NotificationService) { | ||
if (typesList) { | ||
$scope.typesList = typesList; | ||
} | ||
$scope.categoryList = Categories; | ||
$scope.category = 'TRAIT'; | ||
|
||
$scope.getAttributeDefinations = function() { | ||
TagsResource.get({ | ||
id: $scope.selectedType | ||
}, function(data) { | ||
var instanceType = Categories[$scope.category].instanceInfo(); | ||
if (instanceType) { | ||
var traitTypes = angular.fromJson(data.definition)[instanceType][0]; | ||
if (traitTypes) { | ||
$scope.propertiesList = {}; | ||
$scope.isRequired = {}; | ||
_.each(traitTypes.attributeDefinitions, function(value) { | ||
$scope.propertiesList[value.name] = ''; | ||
$scope.isRequired[value.name] = value.isRequired; | ||
}); | ||
} | ||
} | ||
|
||
}); | ||
}; | ||
$scope.ok = function(tagDefinitionform) { | ||
if (tagDefinitionform.$valid) { | ||
var requestObject = { | ||
"jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Struct", | ||
"typeName": $scope.selectedType, | ||
"values": $scope.propertiesList | ||
}; | ||
DetailsResource.saveTag({ | ||
id: $stateParams.id | ||
}, requestObject).$promise.then(function() { | ||
$rootScope.$broadcast('refreshResourceData'); | ||
NotificationService.info('Tag "' + $scope.selectedType + '" has been added to entity', true); | ||
$modalInstance.close(true); | ||
}).catch(function(err) { | ||
$scope.isError = true; | ||
$scope.error = err.data.error; | ||
}); | ||
} | ||
}; | ||
|
||
$scope.cancel = function() { | ||
$modalInstance.dismiss('cancel'); | ||
}; | ||
} | ||
]); |
40 changes: 40 additions & 0 deletions
40
dashboard/public/modules/tags/instance/instanceTagsController.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
angular.module('dgc.tags.instance').controller('InstanceTagController', ['$scope', 'DetailsResource', '$stateParams', '$state', | ||
function($scope, DetailsResource, $stateParams, $state) { | ||
$scope.id = $stateParams.id; | ||
|
||
function getResourceData() { | ||
DetailsResource.get({ | ||
id: $stateParams.id | ||
}, function(data) { | ||
$scope.traitsList = data.traitNames; | ||
}); | ||
} | ||
$scope.openAddTag = function() { | ||
$state.go('addTag', { | ||
id: $scope.id | ||
}); | ||
}; | ||
getResourceData(); | ||
$scope.$on('refreshResourceData', getResourceData); | ||
} | ||
]); |
21 changes: 21 additions & 0 deletions
21
dashboard/public/modules/tags/instance/instanceTagsModule.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
angular.module('dgc.tags.instance', []); |
42 changes: 42 additions & 0 deletions
42
dashboard/public/modules/tags/instance/views/createTag.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<div class="modal-header"> | ||
<h4 class="modal-title">Add tag</h4> | ||
</div> | ||
<div class="modal-body"> | ||
<div class="form-group"> | ||
<div align="center" class="error col-sm-12" ng-if="isError"> | ||
{{error}} | ||
</div> | ||
</div> | ||
<form name="tagDefinitionform" class="css-form" novalidate> | ||
<div class="form-group hide"> | ||
<label for="category" class="col-sm-4 control-label">Category</label> | ||
<div class="col-sm-8 input-spacing"> | ||
<select class="form-control" id="category" name="category" | ||
ng-model="category" ng-change="categoryChange()" required> | ||
<option value="{{key}}" | ||
ng-repeat="(key, value) in categoryList" | ||
ng-selected="{{key===category}}">{{key}}</option> | ||
</select> | ||
</div> | ||
</div> | ||
<div class="form-group" ng-class="{'has-error': (tagDefinitionform.tagDefinition.$invalid && tagDefinitionform.tagDefinition.$dirty)}"> | ||
<label class="control-label col-sm-4" for="tagDefinition">Tag definition</label> | ||
<div class="col-sm-8 input-spacing"> | ||
<select ng-model="selectedType" class="form-control" id="tagDefinition" name="tagDefinition" | ||
ng-change="getAttributeDefinations(); isError =false" required> | ||
<option ng-repeat="data in typesList">{{data}}</option> | ||
</select> | ||
</div> | ||
</div> | ||
<div class="form-group" ng-repeat="(key, value) in propertiesList" ng-class="{'has-error': (tagDefinitionform.propertyId_{{$index}}.$invalid && tagDefinitionform.propertyId_{{$index}}.$dirty)}"> | ||
<label class="control-label col-sm-4" for="propertyId_{{$index}}">{{key}}</label> | ||
<div class="col-sm-8 input-spacing"> | ||
<input type="text" class="form-control" id="propertyId_{{$index}}" name="propertyId_{{$index}}" ng-model="propertiesList[key]" ng-required="isRequired[key]"/> | ||
</div> | ||
</div> | ||
<div class="modal-footer"> | ||
<button class="btn btn-success" type="submit" ng-click="ok(tagDefinitionform)" ng-disabled="tagDefinitionform.$invalid">Save</button> | ||
<button class="btn btn-warning" type="button" ng-click="cancel()">Cancel</button> | ||
</div> | ||
</form> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!-- | ||
~ Licensed to the Apache Software Foundation (ASF) under one | ||
~ or more contributor license agreements. See the NOTICE file | ||
~ distributed with this work for additional information | ||
~ regarding copyright ownership. The ASF licenses this file | ||
~ to you under the Apache License, Version 2.0 (the | ||
~ "License"); you may not use this file except in compliance | ||
~ with the License. You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
--> | ||
<div data-ng-controller="InstanceTagController"> | ||
<div class="container tag-list"> | ||
<h4>Tags</h4> | ||
<ul> | ||
<li ng-repeat="trait in traitsList" class="list-group-item"> | ||
{{trait}},</li> | ||
<li class="list-group-item"><a ng-click="openAddTag()" href="" | ||
class="add-tag">Add tag</a></li> | ||
</ul> | ||
</div> | ||
</div> |
Oops, something went wrong.