Commit 84a62924 authored by Marcel Rieger's avatar Marcel Rieger
Browse files

Remove password and update unique key in workspace model, adjust alembic, style updates.

parent cc6a7084
......@@ -2,9 +2,13 @@
#sqlalchemy_url = sqlite:///var/db/vispa.db
[alembic]
script_location = "vispa:models.alembic"
# inplace installation
script_location = vispa/models/alembic
# global installation
#script_location = vispa:models/alembic
auto_migrate = True
[web]
dev_mode = True
# use base when running in subdirectory
......
......@@ -105,7 +105,7 @@ class AjaxController(AbstractController):
@cherrypy.expose
@cherrypy.tools.ajax()
def addworkspace(self, name, host, login, key=None, dir=None, cmd=None):
def addworkspace(self, name, host, login, key=None, cmd=None):
if not vispa.config("workspace", "allow_new_workspaces", True):
raise MessageException("No permission to add a new Workspace!")
db = self.get("db")
......@@ -120,7 +120,7 @@ class AjaxController(AbstractController):
# add the workspace
workspace = Workspace.add(db, user_id, name, host, login, key=key,
basedir=dir, command=cmd)
command=cmd)
return self._root.workspace_data(workspace)
@cherrypy.expose
......@@ -197,11 +197,11 @@ class AjaxController(AbstractController):
@cherrypy.expose
@cherrypy.tools.ajax()
def checkworkspace(self, name, host, login, key=None, dir=None, cmd=None):
def checkworkspace(self, name, host, login, key=None, cmd=None):
db = cherrypy.request.db
user_id = self.get("user_id")
workspace = Workspace.add(db, user_id, name, host, login, key=key,
basedir=dir, command=cmd, add=False)
command=cmd, add=False)
if not workspace.is_valid():
raise MessageException("Workspace not valid")
......
"""remove password from workspace and update unique keys
Revision ID: 219b64f9f5c8
Revises: 53f0259321a8
Create Date: 2014-01-07 11:35:18.181807
"""
# revision identifiers, used by Alembic.
revision = '219b64f9f5c8'
down_revision = '53f0259321a8'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_column('workspace', u'password')
op.alter_column('workspace', 'user_id',
existing_type=mysql.INTEGER(display_width=11),
nullable=False)
### end Alembic commands ###
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.alter_column('workspace', 'user_id',
existing_type=mysql.INTEGER(display_width=11),
nullable=True)
op.add_column('workspace', sa.Column(u'password', mysql.VARCHAR(length=100), nullable=True))
### end Alembic commands ###
"""remove basedir from workspace
Revision ID: 533e525b1b4
Revises: 219b64f9f5c8
Create Date: 2014-01-07 11:57:59.509784
"""
# revision identifiers, used by Alembic.
revision = '533e525b1b4'
down_revision = '219b64f9f5c8'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_column('workspace', u'basedir')
### end Alembic commands ###
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column('workspace', sa.Column(u'basedir', mysql.TEXT(), nullable=True))
### end Alembic commands ###
......@@ -20,13 +20,12 @@ class Workspace(Base):
host = Column(Unicode(100), nullable=True, default=None)
login = Column(Unicode(100), nullable=True, default=None)
key = Column(Text, nullable=True, default=None)
basedir = Column(Text, nullable=True, default=None)
command = Column(Text, nullable=True, default=None)
created = Column(DateTime, nullable=True, default=datetime.now)
__table_args__ = (schema.UniqueConstraint(host, login),)
__table_args__ = (schema.UniqueConstraint(user_id, name),)
KEYS = ['id', 'user_id', 'name', 'host', 'login', 'key', 'basedir',
'command', 'created']
KEYS = ['id', 'user_id', 'name', 'host', 'login', 'key', 'command',
'created']
def make_dict(self, keys=None):
converters = {'id': int, 'user_id': int}
......@@ -70,11 +69,11 @@ class Workspace(Base):
return user_workspaces.union(public_workspaces).count()
@staticmethod
def add(session, user_id, name, host, login, key=None, basedir=None,
command=None, add=True):
def add(session, user_id, name, host, login, key=None, command=None,
add=True):
if not name:
raise MessageException("No workspace name given")
safe, msg = insertion_safe(name, host, login, key, command, basedir)
safe, msg = insertion_safe(name, host, login, key, command)
if not safe:
raise MessageException(msg)
entries = {'user_id' : user_id,
......@@ -82,7 +81,6 @@ class Workspace(Base):
'host' : host,
'login' : login,
'key' : key,
'basedir' : basedir,
'command' : command}
workspace = Workspace(**entries)
if add:
......
......@@ -13,7 +13,6 @@
@tab-cross-width: 24px;
@tab-color: #444;
@tab-color-active: #000;
@header-shadow: inset 0px 4px 3px rgba(0, 0, 0, 0.5);
/* vispa styles */
......@@ -108,7 +107,6 @@
.vispa-welcome {
text-align: center;
background-color: white;
box-shadow: @header-shadow;
}
.vispa-nav-link {
......@@ -140,7 +138,6 @@
.vispa-view-wrapper {
.vispa-absolute;
background-color: white;
box-shadow: @header-shadow;
}
.vispa-view-wrapper > div {
......@@ -187,13 +184,13 @@
}
.vispa-preferenceview-nav .nav > li:not(.active) > a {
color: #666;
color: #555;
}
.vispa-preferenceview-nav .nav .nav a {
padding: 2px 5px 2px 20px;
}
.vispa-preferenceview-nav .nav .nav .nav a {
padding: 2px 5px 2px 30px;
}
......@@ -300,6 +297,10 @@
margin-left: 5px;
}
.workspace-add-dialog form > div.form-group:last-child {
margin-bottom: 0px;
}
.vispa-logs-wrapper {
position: absolute;
bottom: 0px;
......@@ -332,7 +333,8 @@
.vispa-log {
display: none;
padding: 2px 6px;
color: #666;
color: #555;
text-shadow: 0px 1px 0px #fff;
}
.vispa-log > i.glyphicon {
......@@ -376,7 +378,7 @@
left: 0px;
height: @tab-bar-height;
background-color: #ddd;
box-shadow: @header-shadow, inset 0px -1px 0px #b8b8b8;
box-shadow: inset 0px -1px 0px #b8b8b8;
}
.vispa-centerview-tabs-container {
.vispa-absolute(@right: @border-offset, @left: @border-offset);
......
......@@ -15,10 +15,6 @@
<label>Private key <span class="label label-success">optional</span></label>
<input type="text" class="form-control" id="key" placeholder="Enter private key" />
</div>
<div class="form-group">
<label>Base directory <span class="label label-success">optional</span></label>
<input type="text" class="form-control" id="dir" placeholder="Enter base directory" />
</div>
<div class="form-group">
<label>Command <span class="label label-success">optional</span></label>
<input type="text" class="form-control" id="cmd" placeholder="Enter command" />
......
......@@ -807,7 +807,7 @@ var WorkspaceView = VispaView.extend({
var getFormData = function(dialog) {
var data = {};
$("#name, #host, #login, #key, #dir, #cmd", dialog).each(function(i, input) {
$("#name, #host, #login, #key, #cmd", dialog).each(function(i, input) {
data[input.id] = $(input).val() || undefined;
});
// check mandatory entries
......@@ -870,7 +870,7 @@ var WorkspaceView = VispaView.extend({
var addButton = $("button#add", dialog);
var closeButton = $("button#close", dialog);
$("#name, #host, #login, #key, #dir, #cmd", dialog).keydown(function() {
$("#name, #host, #login, #key, #cmd", dialog).keydown(function() {
if (!checkButton.hasClass("btn-primary"))
setCheckStatus(dialog, 0);
if (!addButton.hasClass("btn-primary"))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment