Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update feature for Kong 0.10.x #117

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/kong-dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if (argv._[0] === 'build') {

// start server
if (argv._[0] === 'start') {
var port = argv.p ? argv.p : 8080;
var port = argv.p || process.env.PORT || 4000;
var auth = argv.a;

// launch server
Expand Down
50 changes: 50 additions & 0 deletions src/html/certificates/form.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<div class="container">
<h3 class="header">{{title}}</h3>

<div class="row">
<div class="col s5">
<div class="card-panel teal">
<p class="white-text">
The Certificate object of SNI
</p>

<p class="white-text">
...
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please elaborate on that?

</p>
<p class="white-text">
Checkout <a href="https://getkong.org/docs/admin-api/#add-certificate" target="_blank">Kong documentation</a> for the meaning of these parameters.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This page doesn't exist on getkong.org

</p>
</div>
</div>
<form name="addCertificate" class="col s7" novalidate ng-submit="save()">
<div class="row">
<div class="input-field col s12" ng-show="isAdd()">
<input id="id" ng-model="certificate.id" type="text" class="validate" ng-class="{invalid: error.id}">
<label for="id" ng-class="{active: certificate.id}">ID</label>
<app-field-error error="error.id"></app-field-error>
</div>
<div class="input-field col s12">
<textarea id="cert" ng-model="certificate.cert" type="text" class="validate" ng-class="{invalid: error.cert}"></textarea>
<label for="cert" ng-class="{active: certificate.cert}">Cert</label>
<app-field-error error="error.cert"></app-field-error>
</div>
<div class="input-field col s12">
<textarea id="key" ng-model="certificate.key" type="text" class="validate" ng-class="{invalid: error.key}"></textarea>
<label for="key" ng-class="{active: certificate.key}">Key</label>
<app-field-error error="error.key"></app-field-error>
</div>
<div class="input-field col s12" ng-show="isAdd()">
<input id="snis" ng-model="certificate.snis" type="text" class="validate" ng-class="{invalid: error.snis}">
<label for="snis" ng-class="{active: certificate.snis}">SNIs</label>
<app-field-error error="error.key"></app-field-error>
</div>
<div class="input-field col s12">
<button type="submit" class="waves-effect waves-light btn right">
{{action}}
</button>
</div>
</div>
<input type="hidden" ng-model="certificate.id" value="{{certificate.id}}" />
</form>
</div>
</div>
61 changes: 61 additions & 0 deletions src/html/certificates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<div class="container" infinite-scroll="loadMore()" infinite-scroll-distance="5" infinite-scroll-use-document-bottom="true">
<a href="#/certificates/add" class="btn-floating btn-large waves-effect waves-light right" ng-show="certificates.length >= 1">
<i class="material-icons">add</i>
</a>

<h3 class="header">Certificates</h3>

<p class="flow-text center" ng-show="total === null" style="margin-top:50px;">
<app-loader></app-loader>
</p>

<div class ng-show="total === 0">
<p class="flow-text center">
You haven't created any Certificate in Kong yet.
</p>
<p class="center">
<a href="#/certificates/add" class="waves-effect waves-light btn">
<i class="material-icons left">add_box</i>
Add Certificate
</a>
</p>
</div>

<table class="bordered" ng-show="total > 0">
<thead>
<tr>
<th>Name</th>
<th>SNIs</th>
<th>Created</th>
<th></th>
</tr>
</thead>

<tbody>
<tr ng-repeat="certificate in certificates">
<td>{{certificate.id}}</td>
<td>{{certificate.snis.join(',')}}</td>
<td>{{certificate.created_at | date}}</td>
<td class="right">
<a class="btn-floating waves-effect waves-light" href="#/certificates/{{certificate.id}}">
<i class="material-icons">mode_edit</i>
</a>
<a class="btn-floating waves-effect waves-light red modal-trigger" ng-click="showDeleteModal(certificate.name, certificate.id)">
<i class="material-icons">delete</i>
</a>
</td>
</tr>
</tbody>
</table>
</div>

<!-- Modal Structure -->
<div id="deleteCertificate" class="modal">
<div class="modal-content">
<h5>Do you really want to delete the Certificate "{{current.name}}"?</h5>
</div>
<div class="modal-footer">
<a class="waves-effect waves-green btn" ng-click="abortDelete()">Noooooo!</a>
<a class="waves-effect waves-red btn red" ng-click="performDelete()" style="margin-right:10px">Yes</a>
</div>
</div>
36 changes: 36 additions & 0 deletions src/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,24 @@
Plugins
</a>
</li>
<li>
<a href="#/upstreams">
<i class="material-icons">swap_vert</i>
Upstreams
</a>
</li>
<li>
<a href="#/snis">
<i class="material-icons">swap_vert</i>
SNIs
</a>
</li>
<li>
<a href="#/certificates">
<i class="material-icons">swap_vert</i>
Certificates
</a>
</li>
<li>
<a href="#/config">
<i class="material-icons">settings</i>
Expand Down Expand Up @@ -67,6 +85,24 @@
Plugins
</a>
</li>
<li>
<a href="#/upstreams">
<i class="material-icons">swap_vert</i>
Upstreams
</a>
</li>
<li>
<a href="#/snis">
<i class="material-icons">vpn_lock</i>
SNIs
</a>
</li>
<li>
<a href="#/certificates">
<i class="material-icons">vpn_key</i>
Certificates
</a>
</li>
<li>
<a href="#/config">
<i class="material-icons">settings</i>
Expand Down
40 changes: 40 additions & 0 deletions src/html/snis/form.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<div class="container">
<h3 class="header">{{title}}</h3>

<div class="row">
<div class="col s5">
<div class="card-panel teal">
<p class="white-text">
The SNI object of Kong
</p>

<p class="white-text">
...
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please elaborate on that?

</p>
<p class="white-text">
Checkout <a href="https://getkong.org/docs/admin-api/#add-sni" target="_blank">Kong documentation</a> for the meaning of these parameters.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This page doesn't exist on getkong.org. Should be https://getkong.org/docs/latest/admin-api/#add-sni

</p>
</div>
</div>
<form name="addSNI" class="col s7" novalidate ng-submit="save()">
<div class="row">
<div class="input-field col s12">
<input id="name" ng-model="sni.name" type="text" class="validate" ng-class="{invalid: error.name}">
<label for="name" ng-class="{active: sni.name}">Name</label>
<app-field-error error="error.name"></app-field-error>
</div>
<div class="input-field col s12">
<input id="ssl_certificate_id" ng-model="sni.ssl_certificate_id" type="text" class="validate" ng-class="{invalid: error.ssl_certificate_id}">
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this field be required?

<label for="ssl_certificate_id" ng-class="{active:sni.ssl_certificate_id}">SSL Certificate ID</label>
<app-field-error error="error.ssl_certificate_id"></app-field-error>
</div>
<div class="input-field col s12">
<button type="submit" class="waves-effect waves-light btn right">
{{action}}
</button>
</div>
</div>
<input type="hidden" ng-model="sni.id" value="{{sni.id}}" />
</form>
</div>
</div>
62 changes: 62 additions & 0 deletions src/html/snis/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<div class="container" infinite-scroll="loadMore()" infinite-scroll-distance="5" infinite-scroll-use-document-bottom="true">
<a href="#/snis/add" class="btn-floating btn-large waves-effect waves-light right" ng-show="snis.length >= 1">
<i class="material-icons">add</i>
</a>

<h3 class="header">snis</h3>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"SNIs", with uppercase?


<p class="flow-text center" ng-show="total === null" style="margin-top:50px;">
<app-loader></app-loader>
</p>

<div class ng-show="total === 0">
<p class="flow-text center">
You haven't created any SNI in Kong yet.
</p>
<p class="center">
<a href="#/snis/add" class="waves-effect waves-light btn">
<i class="material-icons left">add_box</i>
Add Sni
</a>
</p>
</div>

<table class="bordered" ng-show="total > 0">
<thead>
<tr>
<th>Name</th>
<th>Created</th>
<th></th>
</tr>
</thead>

<tbody>
<tr ng-repeat="sni in snis">
<td>{{sni.name}}</td>
<td>{{sni.created_at | date}}</td>
<td class="right">
<a class="btn-floating waves-effect waves-light" href="#/snis/{{sni.id}}">
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After creating an SNI, clicking this link would bring me back to /snis. So I'm unable to edit an SNI.

<i class="material-icons">mode_edit</i>
</a>
<a class="btn-floating waves-effect waves-light blue" href="#/certificates">
<i class="material-icons">group_work</i>
</a>
<a class="btn-floating waves-effect waves-light red modal-trigger" ng-click="showDeleteModal(sni.name, sni.id)">
<i class="material-icons">delete</i>
</a>
</td>
</tr>
</tbody>
</table>
</div>

<!-- Modal Structure -->
<div id="deleteSni" class="modal">
<div class="modal-content">
<h5>Do you really want to delete the SNI "{{current.name}}"?</h5>
</div>
<div class="modal-footer">
<a class="waves-effect waves-green btn" ng-click="abortDelete()">Noooooo!</a>
<a class="waves-effect waves-red btn red" ng-click="performDelete()" style="margin-right:10px">Yes</a>
</div>
</div>
40 changes: 40 additions & 0 deletions src/html/targets/form.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<div class="container">
<h3 class="header">{{title}}</h3>

<div class="row">
<div class="col s5">
<div class="card-panel teal">
<p class="white-text">
The Target object of upstream "{{owner.name}}"
</p>

<p class="white-text">
...
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please elaborate on that?

</p>
<p class="white-text">
Checkout <a href="https://getkong.org/docs/admin-api/#add-target" target="_blank">Kong documentation</a> for the meaning of these parameters.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This page doesn't exist on getkong.org

</p>
</div>
</div>
<form name="addTarget" class="col s7" novalidate ng-submit="save()">
<div class="row">
<div class="input-field col s12">
<input id="target" ng-model="target.target" type="text" class="validate" ng-class="{invalid: error.target}">
<label for="target" ng-class="{active: target.target}">Target</label>
<app-field-error error="error.target"></app-field-error>
</div>
<div class="input-field col s12">
<input id="weight" ng-model="target.weight" type="text" class="validate" ng-class="{invalid: error.weight}">
<label for="weight" ng-class="{active: target.weight}">Weight</label>
<app-field-error error="error.weight"></app-field-error>
</div>
<div class="input-field col s12">
<button type="submit" class="waves-effect waves-light btn right">
{{action}}
</button>
</div>
</div>
<input type="hidden" ng-model="target.id" value="{{target.id}}" />
</form>
</div>
</div>
60 changes: 60 additions & 0 deletions src/html/targets/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<div class="container" infinite-scroll="loadMore()" infinite-scroll-distance="5" infinite-scroll-use-document-bottom="true">
<a href="#/upstreams/{{owner.id}}/targets/add" class="btn-floating btn-large waves-effect waves-light right" ng-show="targets.length >= 1">
<i class="material-icons">add</i>
</a>

<h3 class="header">Targets of Upstream "{{owner.name}}"</h3>

<p class="flow-text center" ng-show="total === null" style="margin-top:50px;">
<app-loader></app-loader>
</p>

<div class ng-show="total === 0">
<p class="flow-text center">
You haven't created any target for Upstream {{owner.name}} yet.
</p>
<p class="center">
<a href="#/upstreams/{{owner.id}}/targets/add" class="waves-effect waves-light btn">
<i class="material-icons left">add_box</i>
Add Target
</a>
</p>
</div>

<table class="bordered" ng-show="total > 0">
<thead>
<tr>
<th>Id</th>
<th>Target</th>
<th>Weight</th>
<th>Created</th>
<th></th>
</tr>
</thead>

<tbody>
<tr ng-repeat="target in targets">
<td>{{target.id}}</td>
<td>{{target.target}}</td>
<td>{{target.weight}}</td>
<td>{{target.created_at | date}}</td>
<td class="right">
<a class="btn-floating waves-effect waves-light red modal-trigger" ng-click="showDeleteModal(target.target, target.id)">
<i class="material-icons">delete</i>
</a>
</td>
</tr>
</tbody>
</table>
</div>

<!-- Modal Structure -->
<div id="deleteTarget" class="modal">
<div class="modal-content">
<h5>Do you really want to delete the Target "{{current.name}}"?</h5>
</div>
<div class="modal-footer">
<a class="waves-effect waves-green btn" ng-click="abortDelete()">Noooooo!</a>
<a class="waves-effect waves-red btn red" ng-click="performDelete()" style="margin-right:10px">Yes</a>
</div>
</div>
Loading