Skip to content
Snippets Groups Projects
Commit 7bc54c47 authored by Cam Saul's avatar Cam Saul
Browse files

nicer database details

parent 312f32ef
Branches
Tags
No related merge requests found
......@@ -46,7 +46,7 @@ DatabasesControllers.controller('DatabaseList', ['$scope', 'Metabase', function(
DatabasesControllers.controller('DatabaseEdit', ['$scope', '$routeParams', '$location', 'Metabase', function($scope, $routeParams, $location, Metabase) {
$scope.databaseTypes = {
$scope.ENGINES = {
postgres: {
name: "Postgres",
example: "host=[ip address] port=5432 dbname=examples user=corvus password=******"
......
......@@ -2,38 +2,39 @@
<h2 class="py2" ng-if="!database.id">Add Database</h2>
<h2 class="py2" ng-if="database.id">{{database.name}}</h2>
<form class="bordered bg-white shadowed rounded" novalidate>
<div class="p4">
<div class="py1">
<label class="text-grey-4">Type:</label>
<label class="Select ml2">
<select class="my2" ng-model="database.engine" ng-options="type as properties.name for (type, properties) in databaseTypes"></select>
</label>
</div>
<table class="Table">
<tr>
<th>Name</th>
<td class="half">
<input class="input block full" type="text" ng-model="database.name" />
</td>
</tr>
<tr>
<th>Type</th>
<td>
<select class="Select my2" ng-model="database.engine" ng-options="type as properties.name for (type, properties) in ENGINES"></select>
</td>
</tr>
<tr>
<th>Timezone</th>
<td>
<select class="Select my2" ng-model="database.details.timezone" ng-options="tz for tz in form_input['timezones']">
<option value="">Select a timezone...</option>
</select>
</td>
</tr>
<tr>
<th>Connection String</th>
<td>
<input class="input block full" type="text" placeholder="{{ENGINES[database.engine].example}}" ng-model="database.details.conn_str">
</td>
</tr>
</table>
<div class="py1">
<label>Name:</label>
<input class="input block" type="text" ng-model="database.name"/>
</div>
<div class="py1">
<label>{{databaseTypes[database.engine].name}} Connection String:</label>
<input class="input block" type="text" ng-model="database.details.conn_str"/>
<span class="block mt1 text-grey-3">ex: {{databaseTypes[database.engine].example}}</span>
</div>
<div class="py1">
<label>Timezone:</label>
<label class="Select ml2">
<select ng-model="database.details.timezone" ng-options="tz for tz in form_input['timezones']">
<option value="">Select a timezone...</option>
</select>
</label>
</div>
</div>
<div class="py3 px4 border-top clearfix">
<input class="Button Button--primary float-right" type="button" value="Save" ng-click="save(database)"/>
</div>
</form>
<!-- SAVE BUTTON -->
<div class="py3 px4 border-top clearfix">
<button class="Button Button--primary float-right" ng-click="save(database)" ng-disabled="!database.name || !database.details.conn_str">
Save
</button>
</div>
</section>
......@@ -14,11 +14,11 @@
(defmethod post-select Database [_ {:keys [organization_id] :as db}]
(-> db
(realize-json :details) ; TODO wouldn't we want to actually strip this info instead of returning it?
(realize-json :details)
(util/assoc*
:organization (delay (sel :one Org :id organization_id))
:can_read (delay (org-can-read organization_id))
:can_write (delay (org-can-write organization_id)))))
:organization (delay (sel :one Org :id organization_id))
:can_read (delay (org-can-read organization_id))
:can_write (delay (org-can-write organization_id)))))
(defmethod pre-insert Database [_ {:keys [details engine] :as database}]
(assoc database
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment