Skip to content

Commit

Permalink
request cert from the UI (#36)
Browse files Browse the repository at this point in the history
* Add skeleton for creating certificate

Co-authored-by: Tasdik Rahman <tasdik.r@go-jek.com>

* Add placeholder value for create cert form

Co-authored-by: Tasdik Rahman <tasdik.r@go-jek.com>

* fix the form varible for create cert

Co-authored-by: Tasdik Rahman <tasdik.r@go-jek.com>

*  created cert show flow

Co-authored-by: Tasdik Rahman <tasdik.r@go-jek.com>
  • Loading branch information
tasdikrahman and tasdikrahman committed Aug 2, 2019
1 parent d0e4ab1 commit 25ee31f
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 2 deletions.
4 changes: 4 additions & 0 deletions app/controllers/v1/cert_bundles_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,8 @@ def create
render status: 500, body: {message: 'error obtaining certs'}.to_json
end
end

def show
@cert_bundle = V1::CertBundle.find(params[:id])
end
end
34 changes: 33 additions & 1 deletion app/views/v1/cert_bundles/index.html.slim
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
br
br
h1
h1[style="display:inline;"]
| List of SSL Certificates
.create-certificate[style="display:inline;float:right;"]
button.btn.btn-info.mb-1.ml-1[data-toggle="modal" data-target="#create_certificate"]
=t("create_certificate")
table.table.table-striped
thead
tr
Expand All @@ -16,3 +19,32 @@ table.table.table-striped
= cert_bundle.sub_domain + '.' + cert_bundle.top_level_domain
td
= cert_bundle.updated_at + 3.months
td
= link_to 'Show', v1_cert_bundle_path(cert_bundle.id)
td
= link_to 'Create', v1_cert_bundle_path(cert_bundle.id)
td
= link_to 'Delete', v1_cert_bundle_path(cert_bundle.id), method: :delete, data: { confirm: 'Are you sure?' }


#create_certificate.modal.fade[role="dialog"]
.modal-dialog
.modal-content
.modal-header
h4.modal-title
=t("modal.header.create_certificate")
button.close[type="button" data-dismiss="modal"]
| ×
.modal-body
= form_with url: v1_cert_bundles_path do |f|
= hidden_field_tag :authenticity_token, form_authenticity_token
.form-group
= label_tag(:name, t("label.top_level_domain"))
= text_field_tag(:top_level_domain,nil,{class: "form-control", placeholder: 'example: google.com'} )
.form-group
= label_tag(:name, t("label.sub_domain"))
= text_field_tag(:sub_domain,nil, {class: "form-control", placeholder: 'example: maps'} )
= submit_tag(t("label.create.submit"), {class: "btn btn-success", style: "float: right", data: { "disable-with": "Saving..." } })
.modal-footer
p#add_client_error.text-danger
p#add_client_notice.text-primary
17 changes: 17 additions & 0 deletions app/views/v1/cert_bundles/show.html.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
br
br
h1
| Certificate for
table.table.table-striped
thead
tr
th
| Private Key
th
| Full Chain
tbody
tr
td
= @cert_bundle.private_key
td
= @cert_bundle.full_chain
3 changes: 3 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@

en:
hello: "Hello world"
label:
create:
submit: 'submit'
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
resource :ping, only: [:show]
root to: 'v1/cert_bundles#index'
namespace :v1 do
resources :cert_bundles, only: [:create, :index]
resources :cert_bundles, only: [:create, :index, :show, :delete]
end
end

0 comments on commit 25ee31f

Please sign in to comment.