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

Add Import form to db views #98

Merged
merged 2 commits into from
Apr 9, 2024

Conversation

moozzi
Copy link
Member

@moozzi moozzi commented Apr 4, 2024

#93

@moozzi moozzi requested a review from postmodern April 4, 2024 12:22
Copy link
Member

@postmodern postmodern left a comment

Choose a reason for hiding this comment

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

Noticed a few things. All .import methods should return a saved model.

Also, we might want to use .find_or_import in case the user enters a value that's already in the database.

app/db.rb Outdated
redirect "db/host_names"
end

if host_name.save
Copy link
Member

Choose a reason for hiding this comment

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

I think the host_name.save is unnecessary, since HostName.import calls create(...) with the host name. Can probably simply the if statement to just a simple redirect "/db/host_names/#{host_name.id}".

app/db.rb Outdated
post '/db/host_names/import' do
begin
host_name = Ronin::DB::HostName.import(params[:host_name])
rescue ArgumentError => e
Copy link
Member

Choose a reason for hiding this comment

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

I try to avoid single letter variable names and prefer to use error instead of e.

<h1>Credential: <%=h @password %></h1>
<%= partial(:delete, record: @password, path: "credentials") %>
<h1>Credential: <%=h @credential %></h1>
<%= partial(:delete, record: @credential, path: "credentials") %>
Copy link
Member

Choose a reason for hiding this comment

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

This could probably be a separate commit.

<p><a href="/db/organizations/<%=h organization.id %>"><%=h organization %></a></p>
<% end %>

<%= partial(:pagination, pagy: @pagy) %>
Copy link
Member

Choose a reason for hiding this comment

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

I'm guessing your editor automatically re-indented this code?

<li><a href="/">Home</a></li>
<li><a href="/db">Database</a></li>
</ul>
</nav>
<% end %>
Copy link
Member

Choose a reason for hiding this comment

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

I'm guessing your editor automatically re-indented stuff?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, I did it intentionally :D

@postmodern postmodern merged commit 2a796c5 into ronin-rb:main Apr 9, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants