Skip to content

Commit

Permalink
ui fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Peck committed Sep 13, 2016
1 parent 2330bc7 commit 87caf79
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 27 deletions.
60 changes: 60 additions & 0 deletions html/ui/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -3629,4 +3629,64 @@ margin-top: 20px;
.composelabel{
padding-top: 20px;
margin-left: 90px;
}
.fourtwenty{
width: 420px;
}
.betterh4 {
font-family: sans-serif;
font-size: 14px;

}
.agopullright {
float: right !important;
padding-top: 0px;
line-height: 1.1;
box-sizing: border-box;
}

.middletext_list {
display: block;
color: #999;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
height: 100%;
padding-top: 14px;
}

#sideBalance {
display: block;
margin-bottom: 5px;
}


.indicator_container {
width:100%;
border-top: 1px solid #fff;
height: 44px;
border-bottom: 1px solid #dbdbdb;
}

.indicator_column {
width: 33.33333333%;
height: 40px;
float: left;
text-align: center;
font-size: 12px;
padding-top: 3px;
}
.midcolumn {
border-right: 1px solid #fff;
}
.on{
background: #dff0d8;
}

.off{
background: #ffe6e6;

}
a.active .middletext_list {
color: #ffffff;
}
5 changes: 1 addition & 4 deletions html/ui/html/pages/myownwork.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,7 @@ <h2 class="workh2">
<label><i class="fa fa-hashtag fa-fw"></i> Programming Language</label>
<p class="form-control-static"><span id="programming_language">--</span></p>
</div>
<div class="form-group">
<label><i class="fa fa-sign-in fa-fw"></i> Random Input Integers</label>
<p class="form-control-static"><b><span id="num_in">--</span></b> Inputs</p>
</div>

<div class="form-group">
<label><i class="fa fa-file fa-fw"></i>Total Size on Blockchain</label>
<p class="form-control-static"><b><span id="blockchain_bytes">--</span></b> - fee [<a href=#>?</a>] was <b><span id="fee">--</span></b> XEL</p>
Expand Down
17 changes: 4 additions & 13 deletions html/ui/js/nrs.myownwork.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,7 @@ var NRS = (function(NRS, $, undefined) {
function status2Text(message){
return "<b>" + message.percent_done + "%</b> done";
}
function ETA(message){

if(message.cancellation_tx=="0" && message.last_payment_tx=="0")
return "ETA <b><1.5h</b>";
else if(message.cancellation_tx!="0" && message.last_payment_tx=="0")
return "Job Closed";
else if(message.cancellation_tx=="0" && message.last_payment_tx!="0")
return "Job Closed";
}

function timeOut(message){
var blocksLeft = parseInt(message.timeout_at_block);
blocksLeft -= NRS.lastBlockHeight;
Expand Down Expand Up @@ -473,13 +465,13 @@ var NRS = (function(NRS, $, undefined) {

function bottom_status_row(message){
if(message.cancellation_tx=="0" && message.last_payment_tx=="0"){
return "<div class='row fourtwenty'><div class='col-md-3'><i class='fa fa-tasks fa-fw'></i> " + status2Text(message) + "</div><div class='col-md-3'><i class='fa fa-hourglass-1 fa-fw'></i> " + ETA(message) + "</div><div class='col-md-3'><i class='fa fa-times-circle-o fa-fw'></i> " + timeOut(message) + "</div><div class='col-md-3'><i class='fa fa-star-half-empty fa-fw'></i> " + efficiency(message) + "</div></div>";
return "<div class='row fourtwenty'><div class='col-md-3'><i class='fa fa-tasks fa-fw'></i> " + status2Text(message) + "</div><div class='col-md-3'><i class='fa fa-hourglass-1 fa-fw'></i> " + "" + "</div><div class='col-md-3'><i class='fa fa-times-circle-o fa-fw'></i> " + timeOut(message) + "</div><div class='col-md-3'><i class='fa fa-star-half-empty fa-fw'></i> " + efficiency(message) + "</div></div>";
}
else if(message.cancellation_tx!="0" && message.last_payment_tx=="0"){
return "<div class='row fourtwenty'><div class='col-md-3'><i class='fa fa-hourglass-1 fa-fw'></i> " + ETA(message) + "</div><div class='col-md-6'><i class='fa fa-mail-reply fa-fw'></i> " + moneyReturned(message) + "</div><div class='col-md-3'><i class='fa fa-star-half-empty fa-fw'></i> " + efficiency(message) + "</div></div>";
return "<div class='row fourtwenty'><div class='col-md-3'><i class='fa fa-hourglass-1 fa-fw'></i> " + "" + "</div><div class='col-md-6'><i class='fa fa-mail-reply fa-fw'></i> " + moneyReturned(message) + "</div><div class='col-md-3'><i class='fa fa-star-half-empty fa-fw'></i> " + efficiency(message) + "</div></div>";
}
else if(message.cancellation_tx=="0" && message.last_payment_tx!="0"){
return "<div class='row fourtwenty'><div class='col-md-3'><i class='fa fa-hourglass-1 fa-fw'></i> " + ETA(message) + "</div><div class='col-md-6'><i class='fa fa-mail-forward fa-fw'></i> " + moneyPaid(message) + "</div><div class='col-md-3'><i class='fa fa-star-half-empty fa-fw'></i> " + efficiency(message) + "</div></div>";
return "<div class='row fourtwenty'><div class='col-md-3'><i class='fa fa-hourglass-1 fa-fw'></i> " + "" + "</div><div class='col-md-6'><i class='fa fa-mail-forward fa-fw'></i> " + moneyPaid(message) + "</div><div class='col-md-3'><i class='fa fa-star-half-empty fa-fw'></i> " + efficiency(message) + "</div></div>";
}
}

Expand Down Expand Up @@ -810,7 +802,6 @@ var NRS = (function(NRS, $, undefined) {
$("#blockchain_bytes").empty().append(formatBytes(parseInt(workItem.script_size_bytes)));
$("#fee").empty().append(NRS.formatAmount(workItem.fee));

$("#num_in").empty().append(workItem.num_input);
$("#percent_done").empty().append(workItem.percent_done);
$("#progbar_work").attr("aria-valuenow",parseInt(workItem.percent_done));
$("#progbar_work").css("width",workItem.percent_done + "%");
Expand Down
1 change: 1 addition & 0 deletions src/java/nxt/Nxt.java
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ private static class Init {
AccountLedger.init();
Hub.init();
PrunableMessage.init();
PrunableSourceCode.init();
Peers.init();
APIProxy.init();
Generator.init();
Expand Down
16 changes: 14 additions & 2 deletions src/java/nxt/NxtDbVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protected void update(int nextUpdate) {
+ "transaction_index SMALLINT NOT NULL, phased BOOLEAN NOT NULL DEFAULT FALSE, "
+ "attachment_bytes VARBINARY, version TINYINT NOT NULL, has_message BOOLEAN NOT NULL DEFAULT FALSE, "
+ "has_encrypted_message BOOLEAN NOT NULL DEFAULT FALSE, has_public_key_announcement BOOLEAN NOT NULL DEFAULT FALSE, "
+ "has_prunable_message BOOLEAN NOT NULL DEFAULT FALSE, has_prunable_attachment BOOLEAN NOT NULL DEFAULT FALSE, "
+ "has_prunable_message BOOLEAN NOT NULL DEFAULT FALSE, has_prunable_source_code BOOLEAN NOT NULL DEFAULT FALSE, has_prunable_attachment BOOLEAN NOT NULL DEFAULT FALSE, "
+ "ec_block_height INT DEFAULT NULL, ec_block_id BIGINT DEFAULT NULL, has_encrypttoself_message BOOLEAN NOT NULL DEFAULT FALSE)");
case 4:
apply("CREATE UNIQUE INDEX IF NOT EXISTS transaction_id_idx ON transaction (id)");
Expand Down Expand Up @@ -714,12 +714,17 @@ protected void update(int nextUpdate) {
+ "encrypted_message VARBINARY, encrypted_is_text BOOLEAN DEFAULT FALSE, "
+ "is_encrypted BOOLEAN NOT NULL, timestamp INT NOT NULL, expiration INT NOT NULL, height INT NOT NULL, "
+ "FOREIGN KEY (height) REFERENCES block (height) ON DELETE CASCADE)");
apply("CREATE TABLE IF NOT EXISTS prunable_source_code (db_id IDENTITY, id BIGINT NOT NULL, work_id BIGINT NOT NULL, "
+ "source VARBINARY NOT NULL, language SMALLINT NOT NULL, timestamp INT NOT NULL, expiration INT NOT NULL, height INT NOT NULL, "
+ "FOREIGN KEY (height) REFERENCES block (height) ON DELETE CASCADE)");
case 287:
apply("CREATE UNIQUE INDEX IF NOT EXISTS prunable_message_id_idx ON prunable_message (id)");
apply("CREATE UNIQUE INDEX IF NOT EXISTS prunable_source_code_id_idx ON prunable_source_code (id)");
case 288:
apply(null);
case 289:
apply("CREATE INDEX IF NOT EXISTS prunable_message_expiration_idx ON prunable_message (expiration DESC)");
apply("CREATE INDEX IF NOT EXISTS prunable_source_code_expiration_idx ON prunable_source_code (expiration DESC)");
case 290:
apply("ALTER TABLE transaction ADD COLUMN IF NOT EXISTS has_prunable_message BOOLEAN NOT NULL DEFAULT FALSE");
case 291:
Expand All @@ -731,25 +736,32 @@ protected void update(int nextUpdate) {
case 294:
apply("CREATE INDEX IF NOT EXISTS prunable_message_recipient_idx ON prunable_message (recipient_id)");
case 295:
apply(null);
apply("CREATE INDEX IF NOT EXISTS prunable_source_code_workid_idx ON prunable_source_code (work_id)");
case 296:
apply("ALTER TABLE transaction ADD COLUMN IF NOT EXISTS has_prunable_encrypted_message BOOLEAN NOT NULL DEFAULT FALSE");
case 297:
apply(null);
case 298:
apply("ALTER TABLE prunable_message ALTER COLUMN expiration RENAME TO transaction_timestamp");
apply("ALTER TABLE prunable_source_code ALTER COLUMN expiration RENAME TO transaction_timestamp");
case 299:
apply("UPDATE prunable_message SET transaction_timestamp = SELECT timestamp FROM transaction WHERE prunable_message.id = transaction.id");
apply("UPDATE prunable_source_code SET transaction_timestamp = SELECT timestamp FROM transaction WHERE prunable_source_code.id = transaction.id");
case 300:
apply("ALTER INDEX prunable_message_expiration_idx RENAME TO prunable_message_transaction_timestamp_idx");
apply("ALTER INDEX prunable_source_code_expiration_idx RENAME TO prunable_source_code_transaction_timestamp_idx");
case 301:
apply("ALTER TABLE prunable_message ALTER COLUMN timestamp RENAME TO block_timestamp");
apply("ALTER TABLE prunable_source_code ALTER COLUMN timestamp RENAME TO block_timestamp");
case 302:
apply("DROP INDEX IF EXISTS prunable_message_timestamp_idx");
apply("DROP INDEX IF EXISTS prunable_source_code_idx");
case 303:
apply("CREATE INDEX IF NOT EXISTS prunable_message_block_timestamp_dbid_idx ON prunable_message (block_timestamp DESC, db_id DESC)");
apply("CREATE INDEX IF NOT EXISTS prunable_source_code_block_timestamp_dbid_idx ON prunable_source_code (block_timestamp DESC, db_id DESC)");
case 304:
apply("DROP INDEX IF EXISTS prunable_message_height_idx");
apply("DROP INDEX IF EXISTS prunable_source_code_height_idx");
case 305:
apply("DROP INDEX IF EXISTS public_key_height_idx");
case 306:
Expand Down
16 changes: 12 additions & 4 deletions src/java/nxt/TransactionDb.java
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ static List<PrunableTransaction> findPrunableTransactions(Connection con, int mi
try (PreparedStatement pstmt = con.prepareStatement("SELECT id, type, subtype, "
+ "has_prunable_attachment AS prunable_attachment, "
+ "has_prunable_message AS prunable_plain_message, "
+ "has_prunable_source_code AS prunable_source_code, "
+ "has_prunable_encrypted_message AS prunable_encrypted_message "
+ "FROM transaction WHERE (timestamp BETWEEN ? AND ?) AND "
+ "(has_prunable_attachment = TRUE OR has_prunable_message = TRUE OR has_prunable_encrypted_message = TRUE)")) {
Expand All @@ -293,7 +294,7 @@ static List<PrunableTransaction> findPrunableTransactions(Connection con, int mi
result.add(new PrunableTransaction(id, transactionType,
rs.getBoolean("prunable_attachment"),
rs.getBoolean("prunable_plain_message"),
rs.getBoolean("prunable_encrypted_message")));
rs.getBoolean("prunable_encrypted_message"),rs.getBoolean("prunable_source_code")));
}
}
} catch (SQLException e) {
Expand All @@ -310,9 +311,9 @@ static void saveTransactions(Connection con, List<TransactionImpl> transactions)
+ "recipient_id, amount, fee, referenced_transaction_full_hash, height, "
+ "block_id, signature, timestamp, type, subtype, sender_id, attachment_bytes, "
+ "block_timestamp, full_hash, version, has_message, has_encrypted_message, has_public_key_announcement, "
+ "has_encrypttoself_message, has_prunable_message, has_prunable_encrypted_message, "
+ "has_encrypttoself_message, has_prunable_message, has_prunable_source_code, has_prunable_encrypted_message, "
+ "has_prunable_attachment, ec_block_height, ec_block_id, transaction_index) "
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")) {
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")) {
int i = 0;
pstmt.setLong(++i, transaction.getId());
pstmt.setShort(++i, transaction.getDeadline());
Expand Down Expand Up @@ -349,6 +350,7 @@ static void saveTransactions(Connection con, List<TransactionImpl> transactions)
pstmt.setBoolean(++i, transaction.getPublicKeyAnnouncement() != null);
pstmt.setBoolean(++i, transaction.getEncryptToSelfMessage() != null);
pstmt.setBoolean(++i, transaction.hasPrunablePlainMessage());
pstmt.setBoolean(++i, transaction.hasPrunableSourceCode());
pstmt.setBoolean(++i, transaction.hasPrunableEncryptedMessage());
pstmt.setBoolean(++i, transaction.getAttachment() instanceof Appendix.Prunable);
pstmt.setInt(++i, transaction.getECBlockHeight());
Expand Down Expand Up @@ -376,14 +378,16 @@ static class PrunableTransaction {
private final boolean prunableAttachment;
private final boolean prunablePlainMessage;
private final boolean prunableEncryptedMessage;
private final boolean prunableSourceCode;

public PrunableTransaction(long id, TransactionType transactionType, boolean prunableAttachment,
boolean prunablePlainMessage, boolean prunableEncryptedMessage) {
boolean prunablePlainMessage, boolean prunableEncryptedMessage, boolean prunableSourceCode) {
this.id = id;
this.transactionType = transactionType;
this.prunableAttachment = prunableAttachment;
this.prunablePlainMessage = prunablePlainMessage;
this.prunableEncryptedMessage = prunableEncryptedMessage;
this.prunableSourceCode = prunableSourceCode;
}

public long getId() {
Expand All @@ -405,6 +409,10 @@ public boolean hasPrunablePlainMessage() {
public boolean hasPrunableEncryptedMessage() {
return prunableEncryptedMessage;
}

public boolean hasPrunableSourceCode() {
return prunableSourceCode;
}
}

}
6 changes: 2 additions & 4 deletions src/java/nxt/WorkLogicManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ private JSONObject workEntryLite(long workId, String workTitle,
private JSONObject workEntry(byte version, long workId, long referenced_tx,
long block_created, long block_closed, long cancellation_tx,
long last_payment_tx, String title, String account,
String language, int num_input,
String language,
long balance_original, long paid_bounties, long paid_pow,
int bounties_connected, int pow_connected, int timeout_at_block,
int script_size_bytes, long fee, int block_created_h,
Expand All @@ -316,7 +316,6 @@ private JSONObject workEntry(byte version, long workId, long referenced_tx,
response.put("title", title);
response.put("account", account);
response.put("language", language);
response.put("num_input", num_input);
response.put("percent_work", work_percentage);
response.put("percent_bounties", bounty_percentage);
response.put("balance_original", dd(balance_original));
Expand Down Expand Up @@ -783,7 +782,6 @@ public JSONObject get(Connection con, ResultSet rs)

long workId = rs.getLong("id");
String work_title = rs.getString("work_title");
int num_input = rs.getInt("variables_input");
byte version = rs.getByte("version_id");

int deadline = rs.getInt("deadline");
Expand Down Expand Up @@ -834,7 +832,7 @@ public JSONObject get(Connection con, ResultSet rs)
block_id, last_payment, last_cancel,
last_payment, work_title,
Crypto.rsEncode(senderId), languageString,
num_input, amount,
amount,
amount_paid_bounties, amount_paid_pow,
num_bounties, num_pow, h + deadline,
code.length, fee, h, bounties_limit,
Expand Down

0 comments on commit 87caf79

Please sign in to comment.