This repository has been archived by the owner on Oct 20, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes gravitee-io/issues#277
- Loading branch information
Showing
10 changed files
with
341 additions
and
15 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<!-- | ||
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="Close plan" style="width: 60%"> | ||
<md-toolbar> | ||
<div class="md-toolbar-tools"> | ||
<h2>Close plan</h2> | ||
<span flex></span> | ||
<md-button class="md-icon-button" aria-label="Hide dialog" ng-click="hide()"> | ||
<ng-md-icon icon="close"></ng-md-icon> | ||
</md-button> | ||
</div> | ||
</md-toolbar> | ||
<md-dialog-content> | ||
<div class="md-dialog-content"> | ||
<h5 ng-if="subscriptions == 0">No subscription is associated to this plan. You can delete it safely.</h5> | ||
<h5 ng-if="subscriptions > 0">There are <code>{{subscriptions}}</code> subscriptions associated to this plan.</h5> | ||
<p ng-if="subscriptions > 0"> | ||
By closing this plan, all relative subscriptions will also be closed and associated api-keys will be no longer | ||
available. | ||
</p> | ||
</div> | ||
</md-dialog-content> | ||
|
||
<md-dialog-actions layout="row"> | ||
<md-button type="button" ng-click="hide()" class="md-primary" md-autofocus> | ||
Cancel | ||
</md-button> | ||
<md-button type="submit" class="md-primary" ng-click="close()"> | ||
{{subscriptions == 0 ? 'Delete' : 'Close'}} | ||
</md-button> | ||
</md-dialog-actions> | ||
</md-dialog> |
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,48 @@ | ||
/* | ||
* 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 DialogClosePlanController($scope, $mdDialog, ApiService, NotificationService, apiId, plan, subscriptions) { | ||
'ngInject'; | ||
|
||
$scope.apiId = apiId; | ||
$scope.plan = plan; | ||
$scope.subscriptions = subscriptions; | ||
|
||
$scope.hide = function () { | ||
$mdDialog.cancel(); | ||
}; | ||
|
||
$scope.close = function () { | ||
if ($scope.subscriptions === 0) { | ||
ApiService.deletePlan($scope.apiId, $scope.plan.id).then(function() { | ||
NotificationService.show('Plan ' + plan.name + ' has been deleted'); | ||
}).catch(function (error) { | ||
NotificationService.show('Error while deleting plan ' + plan.name); | ||
$scope.error = error; | ||
}); | ||
} else { | ||
ApiService.closePlan($scope.apiId, $scope.plan.id).then(function() { | ||
NotificationService.show('Plan ' + plan.name + ' has been closed'); | ||
}).catch(function (error) { | ||
NotificationService.show('Error while closing plan ' + plan.name); | ||
$scope.error = error; | ||
}); | ||
} | ||
|
||
$mdDialog.hide($scope.plan); | ||
}; | ||
} | ||
|
||
export default DialogClosePlanController; |
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,45 @@ | ||
<!-- | ||
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="Publish plan" style="width: 60%"> | ||
<md-toolbar> | ||
<div class="md-toolbar-tools"> | ||
<h2>Publish plan</h2> | ||
<span flex></span> | ||
<md-button class="md-icon-button" aria-label="Hide dialog" ng-click="hide()"> | ||
<ng-md-icon icon="close"></ng-md-icon> | ||
</md-button> | ||
</div> | ||
</md-toolbar> | ||
<md-dialog-content> | ||
<div class="md-dialog-content"> | ||
<h5>Would you like to publish plan <code>{{plan.name}}</code> ?</h5> | ||
<p> | ||
By publishing this plan, users will now be able to subscribe to it. | ||
</p> | ||
</div> | ||
</md-dialog-content> | ||
|
||
<md-dialog-actions layout="row"> | ||
<md-button type="button" ng-click="hide()" class="md-primary" md-autofocus> | ||
Cancel | ||
</md-button> | ||
<md-button type="submit" class="md-primary" ng-click="publish()"> | ||
Publish | ||
</md-button> | ||
</md-dialog-actions> | ||
</md-dialog> |
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,38 @@ | ||
/* | ||
* 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 DialogPublishPlanController($scope, $mdDialog, ApiService, NotificationService, apiId, plan) { | ||
'ngInject'; | ||
|
||
$scope.apiId = apiId; | ||
$scope.plan = plan; | ||
|
||
$scope.hide = function () { | ||
$mdDialog.cancel(); | ||
}; | ||
|
||
$scope.publish = function () { | ||
ApiService.publishPlan($scope.apiId, $scope.plan.id).then(function() { | ||
NotificationService.show('Plan ' + plan.name + ' has been published'); | ||
}).catch(function (error) { | ||
NotificationService.show('Error while publishing plan ' + plan.name); | ||
$scope.error = error; | ||
}); | ||
|
||
$mdDialog.hide($scope.plan); | ||
}; | ||
} | ||
|
||
export default DialogPublishPlanController; |
Oops, something went wrong.