Permalink
Browse files

fixed some UI bug, fixed an _id related bug

  • Loading branch information...
1 parent 4c17dc4 commit eeec665036230a4b9e71d38c55b76a79284132aa @bububa committed Dec 21, 2010
Showing with 2,649 additions and 1,398 deletions.
  1. +4 −3 ConnectionWindowController.h
  2. +18 −11 ConnectionWindowController.mm
  3. +134 −7 EditConnection.xib
  4. +4 −1 MongoDB.mm
  5. +30 −15 MongoHub.xcodeproj/project.pbxproj
  6. +92 −81 MongoHub.xcodeproj/syd.mode1v3
  7. +340 −260 MongoHub.xcodeproj/syd.pbxuser
  8. +1,258 −1,020 QueryWindow.xib
  9. +45 −0 SSHCommand.sh
  10. +76 −0 Tunnel.h
  11. +648 −0 Tunnel.m
@@ -7,7 +7,7 @@
//
#import <Cocoa/Cocoa.h>
-#import <SSHTunnel/SSHTunnel.h>
+#import "Tunnel.h"
@class DatabasesArrayController;
@class AddDBController;
@class AddCollectionController;
@@ -32,7 +32,7 @@
NSMutableArray *collections;
SidebarNode *selectedDB;
SidebarNode *selectedCollection;
- SSHTunnel *sshTunnel;
+ Tunnel *sshTunnel;
AddDBController *addDBController;
AddCollectionController *addCollectionController;
AuthWindowController *authWindowController;
@@ -51,7 +51,7 @@
@property (nonatomic, retain) NSMutableArray *collections;
@property (nonatomic, retain) SidebarNode *selectedDB;
@property (nonatomic, retain) SidebarNode *selectedCollection;
-@property (nonatomic, retain) SSHTunnel *sshTunnel;
+@property (nonatomic, retain) Tunnel *sshTunnel;
@property (nonatomic, retain) NSTextField *resultsTitle;
@property (nonatomic, retain) AddDBController *addDBController;
@property (nonatomic, retain) AddCollectionController *addCollectionController;
@@ -60,6 +60,7 @@
@property (nonatomic, retain) ImportWindowController *importWindowController;
@property (nonatomic, retain) ExportWindowController *exportWindowController;
+- (void)sshConnected:(NSNotification*)aNotification;
- (void)reloadSidebar;
- (void)reloadDBList;
- (void)useDB:(id)sender;
@@ -21,7 +21,7 @@
#import "Sidebar.h"
#import "SidebarNode.h"
#import "MongoDB.h"
-#import <SSHTunnel/SSHTunnel.h>
+#import "Tunnel.h"
@implementation ConnectionWindowController
@@ -44,11 +44,16 @@ @implementation ConnectionWindowController
@synthesize importWindowController;
@synthesize exportWindowController;
+
- (id)init {
if (![super initWithWindowNibName:@"ConnectionWindow"]) return nil;
return self;
}
+- (void)sshConnected:(NSNotification*)aNotification {
+ NSLog(@"connected");
+}
+
- (void)windowDidLoad {
[super windowDidLoad];
NSString *appVersion = [[NSString alloc] initWithFormat:@"version(%@)", [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString*)kCFBundleVersionKey] ];
@@ -57,16 +62,18 @@ - (void)windowDidLoad {
NSString *hostaddress;
if ([conn.usessh intValue]==1) {
- sshTunnel = [SSHTunnel sshTunnelWithHostname:conn.sshhost
- port:[conn.sshport intValue]
- username:conn.sshpassword
- password:conn.sshpassword];
- [sshTunnel addLocalForwardWithBindAddress:conn.bindaddress
- bindPort:[conn.bindport intValue]
- host:conn.host
- hostPort:[conn.hostport intValue]];
- [sshTunnel launch];
- hostaddress = [NSString stringWithFormat:@"%@:%@", conn.bindaddress, conn.bindport];
+ NSString *portForward = [[NSString alloc] initWithFormat:@"L %d:%@:%d", conn.hostport, conn.bindaddress, conn.bindport];
+ NSMutableArray *portForwardings = [NSMutableArray arrayWithObjects:portForward, nil];
+ [portForward release];
+ [sshTunnel setUser:conn.sshuser];
+ [sshTunnel setPort:[conn.sshport intValue]];
+ [sshTunnel setPortForwardings:portForwardings];
+ [sshTunnel setAliveCountMax:3];
+ [sshTunnel setAliveInterval:30];
+ [sshTunnel setTcpKeepAlive:YES];
+ [sshTunnel setCompression:YES];NSLog(@"here");
+ [sshTunnel start];
+ hostaddress = [NSString stringWithFormat:@"%@:%@", conn.host, conn.hostport];
}else if ([conn.host isEqualToString:@"flame.mongohq.com"]) {
hostaddress = [NSString stringWithFormat:@"%@:%@/%@", conn.host, conn.hostport, conn.defaultdb];
}else {
View
@@ -2,17 +2,17 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1060</int>
- <string key="IBDocument.SystemVersion">10D573</string>
- <string key="IBDocument.InterfaceBuilderVersion">762</string>
- <string key="IBDocument.AppKitVersion">1038.29</string>
- <string key="IBDocument.HIToolboxVersion">460.00</string>
+ <string key="IBDocument.SystemVersion">10H574</string>
+ <string key="IBDocument.InterfaceBuilderVersion">804</string>
+ <string key="IBDocument.AppKitVersion">1038.35</string>
+ <string key="IBDocument.HIToolboxVersion">461.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="NS.object.0">762</string>
+ <string key="NS.object.0">804</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="1"/>
+ <integer value="2"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -772,6 +772,14 @@
</object>
<int key="connectionID">93</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">defaultdbTextField</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="391926733"/>
+ </object>
+ <int key="connectionID">98</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -1388,7 +1396,7 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">97</int>
+ <int key="maxID">98</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -1419,6 +1427,30 @@
<string>id</string>
</object>
</object>
+ <object class="NSMutableDictionary" key="actionInfosByName">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>cancel:</string>
+ <string>enableSSH:</string>
+ <string>save:</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBActionInfo">
+ <string key="name">cancel:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">enableSSH:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">save:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ </object>
+ </object>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
@@ -1429,6 +1461,7 @@
<string>bindaddressTextField</string>
<string>bindportTextField</string>
<string>connectionsArrayController</string>
+ <string>defaultdbTextField</string>
<string>hostTextField</string>
<string>hostportTextField</string>
<string>sshhostTextField</string>
@@ -1448,12 +1481,92 @@
<string>NSTextField</string>
<string>NSTextField</string>
<string>NSTextField</string>
+ <string>NSTextField</string>
<string>NSSecureTextField</string>
<string>NSTextField</string>
<string>NSTextField</string>
<string>NSButton</string>
</object>
</object>
+ <object class="NSMutableDictionary" key="toOneOutletInfosByName">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>adminpassTextField</string>
+ <string>adminuserTextField</string>
+ <string>aliasTextField</string>
+ <string>bindaddressTextField</string>
+ <string>bindportTextField</string>
+ <string>connectionsArrayController</string>
+ <string>defaultdbTextField</string>
+ <string>hostTextField</string>
+ <string>hostportTextField</string>
+ <string>sshhostTextField</string>
+ <string>sshpasswordTextField</string>
+ <string>sshportTextField</string>
+ <string>sshuserTextField</string>
+ <string>usesshCheckBox</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBToOneOutletInfo">
+ <string key="name">adminpassTextField</string>
+ <string key="candidateClassName">NSSecureTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">adminuserTextField</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">aliasTextField</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">bindaddressTextField</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">bindportTextField</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">connectionsArrayController</string>
+ <string key="candidateClassName">ConnectionsArrayController</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">defaultdbTextField</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">hostTextField</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">hostportTextField</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">sshhostTextField</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">sshpasswordTextField</string>
+ <string key="candidateClassName">NSSecureTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">sshportTextField</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">sshuserTextField</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">usesshCheckBox</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ </object>
+ </object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">EditConnectionController.h</string>
@@ -1862,6 +1975,13 @@
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">MCPKit_bundled.framework/Headers/MCPNull.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">QuartzCore.framework/Headers/CAAnimation.h</string>
</object>
</object>
@@ -2014,6 +2134,13 @@
<string key="NS.key.0">showWindow:</string>
<string key="NS.object.0">id</string>
</object>
+ <object class="NSMutableDictionary" key="actionInfosByName">
+ <string key="NS.key.0">showWindow:</string>
+ <object class="IBActionInfo" key="NS.object.0">
+ <string key="name">showWindow:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ </object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSWindowController.h</string>
View
@@ -533,7 +533,7 @@ - (void) insertInDB:(NSString *)dbname
b.append([fieldName UTF8String], [aValue shortValue]);
else if ([ft isEqualToString:@"date"]) {
time_t timestamp = [aValue timeIntervalSince1970];
- b.appendDate([fieldName UTF8String], mongo::Date_t(timestamp));
+ b.appendDate([fieldName UTF8String], timestamp);
}else if ([ft isEqualToString:@"datetime"] || [ft isEqualToString:@"timestamp"] || [ft isEqualToString:@"year"]) {
time_t timestamp = [aValue timeIntervalSince1970];
b.appendTimeT([fieldName UTF8String], timestamp);
@@ -854,6 +854,9 @@ - (NSMutableArray *) bsonDictWrapper:(mongo::BSONObj)retval
fieldType = @"String";
value = [NSString stringWithUTF8String:e.str().c_str()];
}
+ }else if (e.type() == mongo::jstOID) {
+ fieldType = @"ObjectId";
+ value = [NSString stringWithUTF8String:e.__oid().str().c_str()];
}else {
fieldType = @"String";
value = [NSString stringWithUTF8String:e.str().c_str()];
Oops, something went wrong.

0 comments on commit eeec665

Please sign in to comment.