Skip to content
This repository has been archived by the owner on Oct 20, 2021. It is now read-only.

Commit

Permalink
feat(api): Associate labels to API
Browse files Browse the repository at this point in the history
  • Loading branch information
brasseld committed Jun 1, 2017
1 parent c0fd63e commit f9af8b0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/management/api/general/apiGeneral.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class ApiAdminController {
if (!this.api.group) {
this.api.group = GroupService.getEmptyGroup();
}

this.api.labels = this.api.labels || [];
this.groups = [this.api.group];

this.$scope.lbs = [
Expand Down
25 changes: 18 additions & 7 deletions src/management/api/general/apiGeneral.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
-->
<form name="generalCtrl.formApi" ng-submit="generalCtrl.update(generalCtrl.api)" novalidate>
<md-subheader class="md-primary" style="background-color: #fafafa">General</md-subheader>
<div layout="column" layout-gt-sm="row">
<md-input-container flex="30">
<label>Name</label>
Expand Down Expand Up @@ -61,17 +62,13 @@
</md-input-container>
</div>

<md-subheader class="md-primary" style="background-color: #fafafa">Portal</md-subheader>
<div layout="column">
<md-input-container class="flex">
<label>Sharding tags</label>
<md-select ng-model="generalCtrl.api.tags" multiple>
<md-option ng-repeat="tag in generalCtrl.tags" ng-value="tag.id">
{{tag.name}}<span ng-if="tag.description" class="gravitee-general-description"> - {{tag.description}}</span>
</md-option>
</md-select>
<label>Labels</label>
<md-chips ng-model="generalCtrl.api.labels" placeholder="Enter a label" ng-click="generalCtrl.formApi.$setDirty()"></md-chips>
</md-input-container>
</div>

<div layout="column">
<md-input-container class="flex">
<label>Portal views</label>
Expand All @@ -83,6 +80,20 @@
</md-input-container>
</div>

<md-subheader class="md-primary" style="background-color: #fafafa">Deployment</md-subheader>
<div layout="column">
<md-input-container class="flex">
<label>Sharding tags</label>
<md-select ng-model="generalCtrl.api.tags" multiple>
<md-option ng-repeat="tag in generalCtrl.tags" ng-value="tag.id">
{{tag.name}}<span ng-if="tag.description" class="gravitee-general-description"> - {{tag.description}}</span>
</md-option>
</md-select>
</md-input-container>
</div>



<div class="md-actions gravitee-api-save-button" layout="row">
<md-button class="md-raised" type="submit" ng-disabled="generalCtrl.formApi.$invalid || generalCtrl.formApi.$pristine">
Save
Expand Down
3 changes: 2 additions & 1 deletion src/services/api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ class ApiService {
return this.$http.put(this.apisURL + api.id,
{'version': api.version, 'description': api.description, 'proxy': api.proxy, 'paths': api.paths, 'private': api.private,
'visibility': api.visibility, 'name': api.name, 'services': api.services, 'properties': api.properties, 'tags': api.tags,
'picture': api.picture, 'resources': api.resources, 'views': api.views, 'group': api.group ? api.group.id : ''
'picture': api.picture, 'resources': api.resources, 'views': api.views, 'group': api.group ? api.group.id : '',
'labels': api.labels
}
);
}
Expand Down

0 comments on commit f9af8b0

Please sign in to comment.