This repository has been archived by the owner on Oct 20, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dictionary): Add global dictionary
Closes gravitee-io/issues#1400
- Loading branch information
1 parent
ceae57e
commit 439219a
Showing
17 changed files
with
838 additions
and
4 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Dictionaries | ||
|
||
Dictionaries let you manage global properties to gateway runtime. | ||
|
||
These properties are then available to API publisher who are able to use them from their API configuration. |
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,16 @@ | ||
# Dictionary | ||
|
||
A dictionary can be MANUAL or DYNAMIC. | ||
|
||
## MANUAL | ||
In the case of a _manual_ dictionary, it is the responsibility of the administrator (or any user with update right) to | ||
create / update or remove properties. | ||
|
||
In the same, it is the responsibility of the administrator to deploy the dictionary into API Gateways. | ||
|
||
|
||
## DYNAMIC | ||
In the case of a _dynamic_ dictionary, properties are updated automatically according to an underlying provider. | ||
|
||
Each time a change has been detected between previous properties and new properties, the dictionary is automatically | ||
deployed into API Gateways and are then available during the HTTP request process. |
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
33 changes: 33 additions & 0 deletions
33
src/management/configuration/dictionaries/add-property.dialog.controller.ts
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,33 @@ | ||
/* | ||
* Copyright (C) 2015 The Gravitee team (http://gravitee.io) | ||
* | ||
* Licensed 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. | ||
*/ | ||
function DialogDictionaryAddPropertyController($scope, $mdDialog) { | ||
'ngInject'; | ||
|
||
this.hide = function () { | ||
$mdDialog.hide(); | ||
}; | ||
|
||
this.save = function () { | ||
let property = { | ||
key: $scope.property.name, | ||
value: $scope.property.value | ||
}; | ||
|
||
$mdDialog.hide(property); | ||
}; | ||
} | ||
|
||
export default DialogDictionaryAddPropertyController; |
41 changes: 41 additions & 0 deletions
41
src/management/configuration/dictionaries/add-property.dialog.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,41 @@ | ||
<!-- | ||
Copyright (C) 2015 The Gravitee team (http://gravitee.io) | ||
Licensed 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. | ||
--> | ||
<md-dialog aria-label="New property"> | ||
<form name="formDictionaryProperty" ng-submit="dialogDictionaryAddPropertyCtrl.save()" novalidate> | ||
<md-dialog-content layout-padding> | ||
<h4>New property</h4> | ||
<md-input-container> | ||
<label>Name</label> | ||
<input ng-model="property.name" id="key" required> | ||
</md-input-container> | ||
<md-input-container> | ||
<label>Value</label> | ||
<input ng-model="property.value" id="value" required> | ||
</md-input-container> | ||
</md-dialog-content> | ||
|
||
<md-dialog-actions layout="row"> | ||
<md-button ng-click="dialogDictionaryAddPropertyCtrl.hide()" class="md-primary"> | ||
Cancel | ||
</md-button> | ||
<md-button type="submit" class="md-raised md-primary" ng-disabled="formDictionaryProperty.$invalid"> | ||
Add | ||
</md-button> | ||
</md-dialog-actions> | ||
</form> | ||
</md-dialog> |
24 changes: 24 additions & 0 deletions
24
src/management/configuration/dictionaries/dictionaries.component.ts
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,24 @@ | ||
/* | ||
* Copyright (C) 2015 The Gravitee team (http://gravitee.io) | ||
* | ||
* Licensed 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. | ||
*/ | ||
const DictionariesComponent: ng.IComponentOptions = { | ||
bindings: { | ||
dictionaries: '<' | ||
}, | ||
controller: 'DictionariesController', | ||
template: require('./dictionaries.html') | ||
}; | ||
|
||
export default DictionariesComponent; |
32 changes: 32 additions & 0 deletions
32
src/management/configuration/dictionaries/dictionaries.controller.ts
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,32 @@ | ||
/* | ||
* Copyright (C) 2015 The Gravitee team (http://gravitee.io) | ||
* | ||
* Licensed 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. | ||
*/ | ||
import { StateService } from "@uirouter/core"; | ||
|
||
class DictionariesController { | ||
|
||
constructor( | ||
private $state: StateService | ||
) { | ||
'ngInject'; | ||
} | ||
|
||
select = (dictionary) => { | ||
this.$state.go('management.settings.dictionaries.dictionary', {dictionaryId: dictionary.id}); | ||
} | ||
|
||
} | ||
|
||
export default DictionariesController; |
69 changes: 69 additions & 0 deletions
69
src/management/configuration/dictionaries/dictionaries.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,69 @@ | ||
<!-- | ||
Copyright (C) 2015 The Gravitee team (http://gravitee.io) | ||
Licensed 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. | ||
--> | ||
<md-toolbar class="md-table-toolbar md-default"> | ||
<div class="md-toolbar-tools"> | ||
<span>Dictionaries</span> | ||
<div flex></div> | ||
</div> | ||
</md-toolbar> | ||
|
||
<md-table-container ng-if="$ctrl.dictionaries.length > 0"> | ||
<table md-table> | ||
<thead md-head> | ||
<tr md-row> | ||
<th md-column>ID</th> | ||
<th md-column>Name</th> | ||
<th md-column>Description</th> | ||
<th md-column>Type</th> | ||
<th md-column>Number of properties</th> | ||
<th md-column>Last updated at</th> | ||
<th md-column>Last deployment at</th> | ||
</tr> | ||
</thead> | ||
<tbody md-body> | ||
<tr md-row ng-repeat="dictionary in $ctrl.dictionaries | orderBy: name" ng-click="$ctrl.select(dictionary)"> | ||
<td md-cell>{{dictionary.id}}</td> | ||
<td md-cell>{{dictionary.name}}</td> | ||
<td md-cell>{{dictionary.description}}</td> | ||
<td md-cell> | ||
{{dictionary.type}} | ||
<span permission permission-only="['management-dictionary-u']" ng-if="dictionary.type === 'dynamic' && dictionary.state === 'started'" style="color: #429f46;"> - Started</span> | ||
<span permission permission-only="['management-dictionary-u']" ng-if="dictionary.type === 'dynamic' && dictionary.state !== 'started'" style="color: red"> - Stopped</span> | ||
</td> | ||
<td md-cell>{{dictionary.properties}}</td> | ||
<td md-cell>{{dictionary.updated_at | date:'MMM d, y h:mm:ss a'}}</td> | ||
<td md-cell>{{(dictionary.deployed_at | date:'MMM d, y h:mm:ss a') || '-'}}</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</md-table-container> | ||
|
||
<gravitee-empty-state ng-if="$ctrl.dictionaries.length === 0" | ||
icon="assignment" | ||
model="Dictionary" | ||
message="Dictionaries will appear here" | ||
sub-message="Start creating a dictionary" | ||
create-mode="true"></gravitee-empty-state> | ||
|
||
<md-button permission permission-only="'management-dictionary-c'" | ||
aria-label="Add dictionary" | ||
class="md-fab md-fab-bottom-right gravitee-add-button" | ||
ui-sref="management.settings.dictionaries.new"> | ||
<md-tooltip md-direction="top" md-visible="false">Add a new dictionary</md-tooltip> | ||
<ng-md-icon icon="add"></ng-md-icon> | ||
</md-button> |
24 changes: 24 additions & 0 deletions
24
src/management/configuration/dictionaries/dictionary.component.ts
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,24 @@ | ||
/* | ||
* Copyright (C) 2015 The Gravitee team (http://gravitee.io) | ||
* | ||
* Licensed 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. | ||
*/ | ||
const DictionaryComponent: ng.IComponentOptions = { | ||
bindings: { | ||
dictionary: '<' | ||
}, | ||
controller: 'DictionaryController', | ||
template: require('./dictionary.html') | ||
}; | ||
|
||
export default DictionaryComponent; |
Oops, something went wrong.