private string GetJobInfo() { var lane_id = Utils.TryParseInt32(Request ["lane_id"]); var host_id = Utils.TryParseInt32(Request ["host_id"]); var response = Utils.LocalWebService.GetViewLaneData2( login, lane_id, Request ["lane"], host_id, Request ["host"], Utils.TryParseInt32(Request ["revision_id"]), Request ["revision"], false); DBRevision dbr = response.Revision; DBRevisionWork revisionwork = response.RevisionWork; DBLane lane = response.Lane; DBHost host = response.Host; DBRevision revision = response.Revision; var jobinfo = new { revision = dbr.revision, status = revisionwork.State, author = dbr.author, commit_date = dbr.date.ToUniversalTime(), host = response.WorkHost.host, host_id = response.WorkHost.id }; return(JsonConvert.SerializeObject(jobinfo, Formatting.Indented)); }
public static DBRevisionWork Find(DB db, DBLane lane, DBHost host, DBRevision revision) { DBRevisionWork result; using (IDbCommand cmd = db.CreateCommand()) { cmd.CommandText = "SELECT * FROM RevisionWork WHERE lane_id = @lane_id AND revision_id = @revision_id "; if (host != null) { cmd.CommandText += " AND host_id = @host_id;"; DB.CreateParameter(cmd, "host_id", host.id); } DB.CreateParameter(cmd, "lane_id", lane.id); DB.CreateParameter(cmd, "revision_id", revision.id); using (IDataReader reader = cmd.ExecuteReader()) { if (!reader.Read()) { return(null); } result = new DBRevisionWork(reader); if (reader.Read()) { throw new ApplicationException(string.Format("Found more than one revision work for the specified lane/host/revision ({0}/{1}/{2})", lane.lane, host == null ? "null" : host.host, revision.revision)); } return(result); } } }
protected void Page_Load(object sender, EventArgs e) { try { GetViewLaneDataResponse response; response = Master.WebService.GetViewLaneData2(Master.WebServiceLogin, Utils.TryParseInt32(Request ["lane_id"]), Request ["lane"], Utils.TryParseInt32(Request ["host_id"]), Request ["host"], Utils.TryParseInt32(Request ["revision_id"]), Request ["revision"], false); DBHost host = response.Host; DBLane lane = response.Lane; DBRevision revision = response.Revision; if (lane == null || host == null || revision == null) { Response.Redirect("index.aspx", false); return; } header.InnerHtml = ViewLane.GenerateHeader(response, lane, host, revision, "Html report for"); htmlreport.Attributes ["src"] = Request.Url.ToString().Replace("Embedded", ""); htmlreport.Attributes ["onload"] = "javascript: resizeToFillIFrame (document.getElementById ('" + htmlreport.ClientID + "'));"; ClientScript.RegisterStartupScript(GetType(), "resizeIFrame", "<script type='text/javascript'>resizeToFillIFrame (document.getElementById ('" + htmlreport.ClientID + "'));</script>"); } catch (Exception ex) { Response.Write(ex.ToString().Replace("\n", "<br/>")); } }
public DBHost LookupHost(string host, bool throwOnError) { DBHost result = null; using (IDbCommand cmd = CreateCommand()) { cmd.CommandText = "SELECT * FROM Host WHERE host = @host"; DB.CreateParameter(cmd, "host", host); using (IDataReader reader = cmd.ExecuteReader()) { if (!reader.Read()) { if (!throwOnError) { return(null); } throw new Exception(string.Format("Could not find the host '{0}'.", host)); } result = new DBHost(reader); if (reader.Read()) { if (!throwOnError) { return(null); } throw new Exception(string.Format("Found more than one host named '{0}'.", host)); } } } return(result); }
private string BuildConnectionString(LogEventInfo logEvent) { if (ConnectionString != null) { return(ConnectionString.Render(logEvent)); } var sb = new StringBuilder(); sb.Append("Server="); sb.Append(DBHost.Render(logEvent)); sb.Append(";"); if (DBUserName == null) { sb.Append("Trusted_Connection=SSPI;"); } else { sb.Append("User id="); sb.Append(DBUserName.Render(logEvent)); sb.Append(";Password="******";"); } if (DBDatabase != null) { sb.Append("Database="); sb.Append(DBDatabase.Render(logEvent)); } return(sb.ToString()); }
public string GenerateHeader(GetViewTableDataResponse response, DBLane lane, DBHost host, bool horizontal) { string result; string format; string disabled_msg = string.Empty; if (!response.Enabled) { disabled_msg = " (Disabled)"; } if (Authentication.IsInRole(response, MonkeyWrench.DataClasses.Logic.Roles.Administrator)) { format = @"<h2>Build Matrix for <a href='EditLane.aspx?lane_id={0}'>'{2}'</a> on <a href='EditHost.aspx?host_id={5}'>'{4}'</a>{6}</h2><br/>"; } else { format = @"<h2>Build Matrix for '{2}' on '{4}'{6}</h2><br/>"; } format += @"<a href='ViewTable.aspx?lane_id={0}&host_id={1}&horizontal={3}'>Reverse x/y axis</a><br/>"; if (Authentication.IsInRole(response, MonkeyWrench.DataClasses.Logic.Roles.Administrator)) { format += string.Format(@"<a href='javascript:clearRevisions ({0}, {1})'>Clear selected revisions</a><br/>", lane.id, host.id); } format += "<br/>"; result = string.Format(format, lane.id, host.id, lane.lane, horizontal ? "false" : "true", host.host, host.id, disabled_msg); return(result); }
/// <summary> /// Sets workhost to the specified host and saves it to the db. /// </summary> /// <param name="db"></param> /// <param name="host"></param> public static bool SetWorkHost(this DBRevisionWork rw, DB db, DBHost host) { object result; string update_cmd = string.Format(@"UPDATE RevisionWork SET workhost_id = {0}, assignedtime = NOW() WHERE id = {1} AND workhost_id IS NULL;", host.id, rw.id); using (IDbCommand cmd = db.CreateCommand()) { cmd.CommandText = update_cmd; var rv = cmd.ExecuteNonQuery(); if (rv != 1) { log.DebugFormat("{0}: {1} (failed)", cmd.CommandText, rv); return(false); } } using (IDbCommand cmd = db.CreateCommand()) { cmd.CommandText = @" SELECT workhost_id FROM RevisionWork where id = @id AND workhost_id = @workhost_id; "; DB.CreateParameter(cmd, "workhost_id", host.id); DB.CreateParameter(cmd, "id", rw.id); result = cmd.ExecuteScalar(); if (result != null && (result is int || result is long)) { rw.workhost_id = host.id; log.DebugFormat("{0}: {1} (succeeded)", update_cmd, result); return(true); } log.DebugFormat("{0}: {1} (failed 2)", update_cmd, result); return(false); } }
/// <summary> /// /// </summary> /// <param name="db"></param> /// <param name="lane"></param> /// <param name="host"></param> /// <param name="limit"></param> /// <param name="page">First page = 0, second page = 1, etc.</param> /// <returns></returns> public static List <DBRevisionWorkView> Query(DB db, DBLane lane, DBHost host, int limit, int page) { Console.WriteLine("Query {0} {1} {2} {3}", lane, host, limit, page); List <DBRevisionWorkView> result = new List <DBRevisionWorkView> (); using (IDbTransaction transaction = db.BeginTransaction()) { using (IDbCommand cmd = db.CreateCommand()) { // copy&paste from CustomTypes.sql cmd.CommandText = @" SELECT RevisionWork.id, Revision.revision INTO TEMP revisionwork_temptable FROM RevisionWork INNER JOIN Revision on RevisionWork.revision_id = Revision.id WHERE RevisionWork.lane_id = @lane_id AND RevisionWork.host_id = @host_id ORDER BY Revision.date DESC LIMIT @limit OFFSET @offset; -- For some reason postgresql thinks the temp table has 1230 entries, while it usually has about 20 entries, -- and decides to do a sequential scan on the work tabe. Analyze it to make it realize its untrue presumptions. ANALYZE revisionwork_temptable; SELECT Work.id, Work.command_id, Work.state, Work.starttime, Work.endtime, Work.duration, Work.logfile, Work.summary, Host.host, Lane.lane, Revision.author, Revision.revision, Command.command, Command.nonfatal, Command.alwaysexecute, Command.sequence, Command.internal, RevisionWork.lane_id, RevisionWork.host_id, RevisionWork.revision_id, RevisionWork.state AS revisionwork_state, WorkHost.host AS workhost FROM Work INNER JOIN RevisionWork ON Work.revisionwork_id = RevisionWork.id INNER JOIN Revision ON RevisionWork.revision_id = Revision.id INNER JOIN Lane ON RevisionWork.lane_id = Lane.id INNER JOIN Host ON RevisionWork.host_id = Host.id LEFT JOIN Host AS WorkHost ON RevisionWork.workhost_id = WorkHost.id INNER JOIN Command ON Work.command_id = Command.id WHERE Work.revisionwork_id IN (SELECT id FROM revisionwork_temptable) ORDER BY Revision.date DESC; "; DB.CreateParameter(cmd, "lane_id", lane.id); DB.CreateParameter(cmd, "host_id", host.id); DB.CreateParameter(cmd, "limit", limit); DB.CreateParameter(cmd, "offset", page * limit); using (IDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { result.Add(new DBRevisionWorkView(reader)); } } } return(result); } }
public static void AddLane(this DBHost me, DB db, int lane_id) { using (IDbCommand cmd = db.CreateCommand()) { cmd.CommandText = "INSERT INTO HostLane (host_id, lane_id) VALUES (@host_id, @lane_id);"; DB.CreateParameter(cmd, "host_id", me.id); DB.CreateParameter(cmd, "lane_id", lane_id); cmd.ExecuteNonQuery(); } }
public static void RemoveLane(this DBHost me, DB db, int lane_id) { using (IDbCommand cmd = db.CreateCommand()) { cmd.CommandText = "DELETE FROM HostLane WHERE host_id = @host_id AND lane_id = @lane_id;"; DB.CreateParameter(cmd, "host_id", me.id); DB.CreateParameter(cmd, "lane_id", lane_id); cmd.ExecuteNonQuery(); } }
private void tsbUpDate_Click(object sender, EventArgs e) { List <DBHost> list = new List <DBHost>(); foreach (TreeNode treeNode in this.tvMain.Nodes) { if (treeNode.Checked) { DBHost dBHost = new DBHost(); DBHost dBHost2 = (DBHost)treeNode.Tag; dBHost.Host = dBHost2.Host; dBHost.Password = dBHost2.Password; dBHost.Port = dBHost2.Port; dBHost.User = dBHost2.User; foreach (TreeNode treeNode2 in treeNode.Nodes) { if (treeNode2.Checked) { dBHost.DBInfos.Add((DBInfo)treeNode2.Tag); } } if (dBHost.DBInfos.Count > 0) { list.Add(dBHost); } } } if (list.Count > 0) { new frmUpDate(list).ShowDialog(); foreach (TreeNode treeNode in this.tvMain.Nodes) { if (treeNode.Checked) { foreach (TreeNode treeNode2 in treeNode.Nodes) { if (treeNode2.Checked) { DBInfo dBInfo = (DBInfo)treeNode2.Tag; treeNode2.Text = string.Concat(new object[] { "[", dBInfo.DBVersion, "]", dBInfo.DBName }); } } } } } else { MessageBox.Show("请选择数据库", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } }
public static void EnableLane(this DBHost me, DB db, int lane_id, bool enable) { using (IDbCommand cmd = db.CreateCommand()) { cmd.CommandText = "UPDATE HostLane SET enabled = @enabled WHERE host_id = @host_id AND lane_id = @lane_id;"; DB.CreateParameter(cmd, "host_id", me.id); DB.CreateParameter(cmd, "lane_id", lane_id); DB.CreateParameter(cmd, "enabled", enable); cmd.ExecuteNonQuery(); } }
protected void cmdSave_Click(object sender, EventArgs e) { DBHost host = response.Host; host.host = txtHost.Text; host.architecture = txtArchitecture.Text; host.description = txtDescription.Text; host.queuemanagement = cmbQueueManagement.SelectedIndex; host.enabled = chkEnabled.Checked; Utils.LocalWebService.EditHostWithPassword(Master.WebServiceLogin, host, txtPassword.Text); RedirectToSelf(); }
void GenerateActionLink(StringBuilder header, DBLane lane, DBHost host, DBRevision dbr, string cmd, string short_label, string long_label, bool hidden = false) { var href = confirmViewLaneAction(lane, host, dbr, cmd, short_label); if (hidden) { header.AppendFormat("- <a style='{0}' href='{1}'>{2}</a>", "display:none", href, long_label); } else { header.AppendFormat("- <a href='{0}'>{1}</a>", href, long_label); } }
private void tvMain_AfterSelect(object sender, TreeViewEventArgs e) { Tree.SetBackColor(this.tvMain, e.Node); if (e.Node.Parent != null) { this.CurrInfo = (DBInfo)e.Node.Tag; this.CurrHost = (DBHost)e.Node.Parent.Tag; } else { this.CurrHost = (DBHost)e.Node.Tag; } }
public string GenerateHeader(GetViewWorkTableDataResponse response, DBLane lane, DBHost host, DBCommand command) { if (!Authentication.IsInRole(response, MonkeyWrench.DataClasses.Logic.Roles.Administrator)) { return(string.Format(@" <h2>Step {4} on lane '{2}' on '{3}' (<a href='ViewTable.aspx?lane_id={0}&host_id={1}'>table</a>)</h2><br/>", lane.id, host.id, lane.lane, host.host, command.command)); } else { return(string.Format(@" <h2>Step {4} on lane '<a href='EditLane.aspx?lane_id={0}'>{2}</a>' on '<a href='EditHost.aspx?host_id={1}'>{3}</a>' (<a href='ViewTable.aspx?lane_id={0}&host_id={1}'>table</a>)</h2><br/>", lane.id, host.id, lane.lane, host.host, command.command)); } }
protected void cmdSave_Click(object sender, EventArgs e) { try { DBHost host = response.Host; host.host = txtHost.Text; host.architecture = txtArchitecture.Text; host.description = txtDescription.Text; host.queuemanagement = cmbQueueManagement.SelectedIndex; host.enabled = chkEnabled.Checked; Master.WebService.EditHostWithPassword(Master.WebServiceLogin, host, txtPassword.Text); RedirectToSelf(); } catch (Exception ex) { lblMessage.Text = Utils.FormatException(ex, true); } }
public static List <DBHostLaneView> GetLanes(this DBHost me, DB db) { List <DBHostLaneView> result = new List <DBHostLaneView> (); using (IDbCommand cmd = db.CreateCommand()) { cmd.CommandText = "SELECT * FROM HostLaneView WHERE host_id = @host_id ORDER BY lane;"; DB.CreateParameter(cmd, "host_id", me.id); using (IDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { result.Add(new DBHostLaneView(reader)); } } } return(result); }
public virtual void Stat(Log4Grid.Models.StatModel e) { if ((DBApplication.name == e.App).Count <DBApplication>(DB) == 0) { DBApplication app = new DBApplication(); app.Name = e.App; app.Save(DB); } DBHost host = (DBHost.appID == e.App & DBHost.name == e.Host).ListFirst <DBHost>(DB); if (host == null) { host = new DBHost(); host.Name = e.Host; host.AppID = e.App; } host.CpuUsage = e.CpuUsage; host.MemoryUsage = e.MemoryUsage; host.LastActiveTime = DateTime.Now; host.Save(DB); }
/// <summary> /// Will return a locked revision work. /// </summary> /// <param name="lane"></param> /// <param name="host"></param> /// <returns></returns> public DBRevisionWork GetRevisionWork(DBLane lane, DBHost host, DBHost workhost) { DBRevisionWork result = null; using (IDbCommand cmd = CreateCommand()) { // sorting by RevisionWork.workhost_id ensures that we'll get // revisionwork which has been started at the top of the list. cmd.CommandText = @" SELECT RevisionWork.* FROM RevisionWork INNER JOIN Revision ON RevisionWork.revision_id = Revision.id WHERE RevisionWork.host_id = @host_id AND (RevisionWork.workhost_id = @workhost_id OR RevisionWork.workhost_id IS NULL) AND RevisionWork.lane_id = @lane_id AND RevisionWork.state <> @dependencynotfulfilled AND RevisionWork.state <> 10 AND RevisionWork.State <> @ignore AND RevisionWork.completed = false ORDER BY RevisionWork.workhost_id IS NULL ASC, Revision.date DESC LIMIT 1 ;"; DB.CreateParameter(cmd, "host_id", host.id); DB.CreateParameter(cmd, "lane_id", lane.id); DB.CreateParameter(cmd, "workhost_id", workhost.id); DB.CreateParameter(cmd, "dependencynotfulfilled", (int)DBState.DependencyNotFulfilled); DB.CreateParameter(cmd, "ignore", (int)DBState.Ignore); using (IDataReader reader = cmd.ExecuteReader()) { if (reader.Read()) { result = new DBRevisionWork(reader); } } } return(result); }
public async Task DoWorkAsync() { _context.Database.OpenConnection(); _context.Database.ExecuteSqlCommand("SET IDENTITY_INSERT dbo.S3Buckets ON"); ListBucketsResponse listBucketResponse = await _S3Client.ListBucketsAsync(new ListBucketsRequest()); bool sageMakerBucketFound = false, apacheWebLogBucketFound = false, SSHLogBucketFound = false, windowsSecurityLogBucketFound = false, squidProxyLogBucketFound = false; foreach (var bucket in listBucketResponse.Buckets) { if (bucket.BucketName.Equals("master-sagemaker-data")) { sageMakerBucketFound = true; if (_context.S3Buckets.Find(1) == null) { _context.S3Buckets.Add(new Models.S3Bucket { ID = 1, Name = "master-sagemaker-data" }); } } else if (bucket.BucketName.Equals("smartinsights-test-website")) { apacheWebLogBucketFound = true; if (_context.S3Buckets.Find(2) == null) { _context.S3Buckets.Add(new Models.S3Bucket { ID = 2, Name = "smartinsights-test-website" }); } } else if (bucket.BucketName.Equals("smartinsights-ssh-logs")) { SSHLogBucketFound = true; if (_context.S3Buckets.Find(3) == null) { _context.S3Buckets.Add(new Models.S3Bucket { ID = 3, Name = "smartinsights-ssh-logs" }); } } else if (bucket.BucketName.Equals("smartinsights-windows-security-logs")) { windowsSecurityLogBucketFound = true; if (_context.S3Buckets.Find(4) == null) { _context.S3Buckets.Add(new Models.S3Bucket { ID = 4, Name = "smartinsights-windows-security-logs" }); } } else if (bucket.BucketName.Equals("smartinsights-squid-proxy-logs")) { squidProxyLogBucketFound = true; if (_context.S3Buckets.Find(5) == null) { _context.S3Buckets.Add(new Models.S3Bucket { ID = 5, Name = "smartinsights-squid-proxy-logs" }); } } if (sageMakerBucketFound && apacheWebLogBucketFound && SSHLogBucketFound && windowsSecurityLogBucketFound && squidProxyLogBucketFound) { break; } } if (!sageMakerBucketFound && _context.S3Buckets.Find(2) == null) { PutBucketResponse putBucketResponse2 = await _S3Client.PutBucketAsync(new PutBucketRequest { BucketName = "master-sagemaker-data", UseClientRegion = true, CannedACL = S3CannedACL.Private }); PutBucketTaggingResponse putBucketTaggingResponse2 = await _S3Client.PutBucketTaggingAsync(new PutBucketTaggingRequest { BucketName = "master-sagemaker-data", TagSet = new List <Tag> { new Tag { Key = "Project", Value = "OSPJ" } } }); PutPublicAccessBlockResponse putPublicAccessBlockResponse2 = await _S3Client.PutPublicAccessBlockAsync(new PutPublicAccessBlockRequest { BucketName = "master-sagemaker-data", PublicAccessBlockConfiguration = new PublicAccessBlockConfiguration { BlockPublicAcls = true, BlockPublicPolicy = true, IgnorePublicAcls = true, RestrictPublicBuckets = true } }); if (putBucketResponse2.HttpStatusCode.Equals(HttpStatusCode.OK) && putPublicAccessBlockResponse2.HttpStatusCode.Equals(HttpStatusCode.OK)) { _context.S3Buckets.Add(new Models.S3Bucket { ID = 1, Name = "master-sagemaker-data" }); } } if (!apacheWebLogBucketFound && _context.S3Buckets.Find(3) == null) { PutBucketResponse putBucketResponse3 = await _S3Client.PutBucketAsync(new PutBucketRequest { BucketName = "smartinsights-test-website", UseClientRegion = true, CannedACL = S3CannedACL.Private }); PutBucketTaggingResponse putBucketTaggingResponse3 = await _S3Client.PutBucketTaggingAsync(new PutBucketTaggingRequest { BucketName = "smartinsights-test-website", TagSet = new List <Tag> { new Tag { Key = "Project", Value = "OSPJ" } } }); PutPublicAccessBlockResponse putPublicAccessBlockResponse3 = await _S3Client.PutPublicAccessBlockAsync(new PutPublicAccessBlockRequest { BucketName = "smartinsights-test-website", PublicAccessBlockConfiguration = new PublicAccessBlockConfiguration { BlockPublicAcls = true, BlockPublicPolicy = true, IgnorePublicAcls = true, RestrictPublicBuckets = true } }); if (putBucketResponse3.HttpStatusCode.Equals(HttpStatusCode.OK) && putPublicAccessBlockResponse3.HttpStatusCode.Equals(HttpStatusCode.OK)) { _context.S3Buckets.Add(new Models.S3Bucket { ID = 2, Name = "smartinsights-apache-web-logs" }); } } if (!SSHLogBucketFound && _context.S3Buckets.Find(4) == null) { PutBucketResponse putBucketResponse4 = await _S3Client.PutBucketAsync(new PutBucketRequest { BucketName = "smartinsights-ssh-logs", UseClientRegion = true, CannedACL = S3CannedACL.Private }); PutBucketTaggingResponse putBucketTaggingResponse4 = await _S3Client.PutBucketTaggingAsync(new PutBucketTaggingRequest { BucketName = "smartinsights-ssh-logs", TagSet = new List <Tag> { new Tag { Key = "Project", Value = "OSPJ" } } }); PutPublicAccessBlockResponse putPublicAccessBlockResponse4 = await _S3Client.PutPublicAccessBlockAsync(new PutPublicAccessBlockRequest { BucketName = "smartinsights-ssh-logs", PublicAccessBlockConfiguration = new PublicAccessBlockConfiguration { BlockPublicAcls = true, BlockPublicPolicy = true, IgnorePublicAcls = true, RestrictPublicBuckets = true } }); if (putBucketResponse4.HttpStatusCode.Equals(HttpStatusCode.OK) && putPublicAccessBlockResponse4.HttpStatusCode.Equals(HttpStatusCode.OK)) { _context.S3Buckets.Add(new Models.S3Bucket { ID = 3, Name = "smartinsights-ssh-logs" }); } } if (!windowsSecurityLogBucketFound && _context.S3Buckets.Find(5) == null) { PutBucketResponse putBucketResponse5 = await _S3Client.PutBucketAsync(new PutBucketRequest { BucketName = "smartinsights-windows-security-logs", UseClientRegion = true, CannedACL = S3CannedACL.Private }); PutBucketTaggingResponse putBucketTaggingResponse5 = await _S3Client.PutBucketTaggingAsync(new PutBucketTaggingRequest { BucketName = "smartinsights-windows-security-logs", TagSet = new List <Tag> { new Tag { Key = "Project", Value = "OSPJ" } } }); PutPublicAccessBlockResponse putPublicAccessBlockResponse5 = await _S3Client.PutPublicAccessBlockAsync(new PutPublicAccessBlockRequest { BucketName = "smartinsights-windows-security-logs", PublicAccessBlockConfiguration = new PublicAccessBlockConfiguration { BlockPublicAcls = true, BlockPublicPolicy = true, IgnorePublicAcls = true, RestrictPublicBuckets = true } }); if (putBucketResponse5.HttpStatusCode.Equals(HttpStatusCode.OK) && putPublicAccessBlockResponse5.HttpStatusCode.Equals(HttpStatusCode.OK)) { _context.S3Buckets.Add(new Models.S3Bucket { ID = 4, Name = "smartinsights-windows-security-logs" }); } } if (!squidProxyLogBucketFound && _context.S3Buckets.Find(6) == null) { PutBucketResponse putBucketResponse6 = await _S3Client.PutBucketAsync(new PutBucketRequest { BucketName = "smartinsights-squid-proxy-logs", UseClientRegion = true, CannedACL = S3CannedACL.Private }); PutBucketTaggingResponse putBucketTaggingResponse6 = await _S3Client.PutBucketTaggingAsync(new PutBucketTaggingRequest { BucketName = "smartinsights-squid-proxy-logs", TagSet = new List <Tag> { new Tag { Key = "Project", Value = "OSPJ" } } }); PutPublicAccessBlockResponse putPublicAccessBlockResponse6 = await _S3Client.PutPublicAccessBlockAsync(new PutPublicAccessBlockRequest { BucketName = "smartinsights-squid-proxy-logs", PublicAccessBlockConfiguration = new PublicAccessBlockConfiguration { BlockPublicAcls = true, BlockPublicPolicy = true, IgnorePublicAcls = true, RestrictPublicBuckets = true } }); if (putBucketResponse6.HttpStatusCode.Equals(HttpStatusCode.OK) && putPublicAccessBlockResponse6.HttpStatusCode.Equals(HttpStatusCode.OK)) { _context.S3Buckets.Add(new Models.S3Bucket { ID = 5, Name = "smartinsights-squid-proxy-logs" }); } } await _context.SaveChangesAsync(); _context.Database.ExecuteSqlCommand("SET IDENTITY_INSERT dbo.S3Buckets OFF"); _context.Database.ExecuteSqlCommand("SET IDENTITY_INSERT dbo.GlueDatabases ON"); try { GetDatabaseResponse getDatabaseResponse = await _GlueClient.GetDatabaseAsync(new GetDatabaseRequest { Name = "master-database" }); if (_context.GlueDatabases.Find(1) == null) { _context.GlueDatabases.Add(new Models.GlueDatabase { ID = 1, Name = "master-database" }); } } catch (EntityNotFoundException) { CreateDatabaseResponse createDatabaseResponse = await _GlueClient.CreateDatabaseAsync(new CreateDatabaseRequest { DatabaseInput = new DatabaseInput { Name = "master-database" } }); if (createDatabaseResponse.HttpStatusCode.Equals(HttpStatusCode.OK)) { _context.GlueDatabases.Add(new Models.GlueDatabase { ID = 1, Name = "master-database" }); } } finally { await _context.SaveChangesAsync(); _context.Database.ExecuteSqlCommand("SET IDENTITY_INSERT dbo.GlueDatabases OFF"); } GetConnectionsResponse getConnectionsResponse = await _GlueClient.GetConnectionsAsync(new GetConnectionsRequest { HidePassword = false }); bool GlueDBConnectionNameMatch = false, GlueDBConnectionParamtetersMatch = false; foreach (Connection c in getConnectionsResponse.ConnectionList) { if (c.Name.Equals(Environment.GetEnvironmentVariable("GLUE_DB-CONNECTION_NAME"))) { GlueDBConnectionNameMatch = true; } c.ConnectionProperties.TryGetValue("JDBC_CONNECTION_URL", out string DBHost); c.ConnectionProperties.TryGetValue("USERNAME", out string DBUserName); c.ConnectionProperties.TryGetValue("PASSWORD", out string DBPassword); if (DBHost.Contains(Environment.GetEnvironmentVariable("RDS_HOSTNAME")) && DBUserName.Equals(Environment.GetEnvironmentVariable("RDS_USERNAME")) && DBPassword.Equals(Environment.GetEnvironmentVariable("RDS_PASSWORD"))) { GlueDBConnectionParamtetersMatch = true; } if (GlueDBConnectionNameMatch && GlueDBConnectionParamtetersMatch) { break; } } if (!GlueDBConnectionParamtetersMatch) { if (GlueDBConnectionNameMatch) { DeleteConnectionResponse deleteConnectionResponse = await _GlueClient.DeleteConnectionAsync(new DeleteConnectionRequest { ConnectionName = Environment.GetEnvironmentVariable("GLUE_DB-CONNECTION_NAME") }); if (deleteConnectionResponse.HttpStatusCode.Equals(HttpStatusCode.OK)) { await _GlueClient.CreateConnectionAsync(new CreateConnectionRequest { ConnectionInput = new ConnectionInput { ConnectionProperties = new Dictionary <string, string>() { { "JDBC_CONNECTION_URL", "jdbc:sqlserver://" + Environment.GetEnvironmentVariable("RDS_HOSTNAME") + ":" + Environment.GetEnvironmentVariable("RDS_PORT") + ";databaseName=" + Environment.GetEnvironmentVariable("GLUE_INGESTION-DB_NAME") }, { "JDBC_ENFORCE_SSL", "false" }, { "USERNAME", Environment.GetEnvironmentVariable("RDS_USERNAME") }, { "PASSWORD", Environment.GetEnvironmentVariable("RDS_PASSWORD") }, }, ConnectionType = ConnectionType.JDBC, Name = Environment.GetEnvironmentVariable("GLUE_DB-CONNECTION_NAME"), PhysicalConnectionRequirements = new PhysicalConnectionRequirements { AvailabilityZone = "ap-southeast-1c", SubnetId = "subnet-0daa6ec8e25a13077", SecurityGroupIdList = new List <string> { "sg-0e1e79f6d49b3ed11" } } } }); } } else { await _GlueClient.CreateConnectionAsync(new CreateConnectionRequest { ConnectionInput = new ConnectionInput { ConnectionProperties = new Dictionary <string, string>() { { "JDBC_CONNECTION_URL", "jdbc:sqlserver://" + Environment.GetEnvironmentVariable("RDS_HOSTNAME") + ":" + Environment.GetEnvironmentVariable("RDS_PORT") + ";databaseName=" + Environment.GetEnvironmentVariable("GLUE_INGESTION-DB_NAME") }, { "JDBC_ENFORCE_SSL", "false" }, { "USERNAME", Environment.GetEnvironmentVariable("RDS_USERNAME") }, { "PASSWORD", Environment.GetEnvironmentVariable("RDS_PASSWORD") }, }, ConnectionType = ConnectionType.JDBC, Name = Environment.GetEnvironmentVariable("GLUE_DB-CONNECTION_NAME"), PhysicalConnectionRequirements = new PhysicalConnectionRequirements { AvailabilityZone = "ap-southeast-1c", SubnetId = "subnet-0daa6ec8e25a13077", SecurityGroupIdList = new List <string> { "sg-0e1e79f6d49b3ed11" } } } }); } } if (!_context.LogInputs.Any()) { _context.Database.ExecuteSqlCommand("SET IDENTITY_INSERT dbo.LogInputs ON"); _context.LogInputs.Add(new Models.LogInput { ID = 1, Name = "Test Website", FirehoseStreamName = "SmartInsights-Test-Website", ConfigurationJSON = "{\r\n \"cloudwatch.emitMetrics\": false,\r\n \"awsSecretAccessKey\": \"XW2HNGQnW9ygpvPDzQQemY0AhsFlUGwiKnVpZGbO\",\r\n \"firehose.endpoint\": \"firehose.ap-southeast-1.amazonaws.com\",\r\n \"awsAccessKeyId\": \"AKIASXW25GZQH5IABE4P\",\r\n \"flows\": [\r\n {\r\n \"filePattern\": \"/var/www/example.hansen-lim.me/log/access.log\",\r\n \"deliveryStream\": \"SmartInsights-Test-Website\",\r\n \"dataProcessingOptions\": [\r\n {\r\n \"optionName\": \"LOGTOJSON\",\r\n \"logFormat\": \"COMBINEDAPACHELOG\"\r\n }\r\n ]\r\n}", LogInputCategory = Models.LogInputCategory.ApacheWebServer, LinkedUserID = 1, LinkedS3BucketID = _context.S3Buckets.Find(2).ID, LinkedS3Bucket = _context.S3Buckets.Find(2), InitialIngest = true }); _context.LogInputs.Add(new Models.LogInput { ID = 2, Name = "Linux SSH Server Logs", FirehoseStreamName = "SmartInsights-SSH-Login-Logs", ConfigurationJSON = "{\r\n \"cloudwatch.emitMetrics\": false,\r\n \"awsSecretAccessKey\": \"XW2HNGQnW9ygpvPDzQQemY0AhsFlUGwiKnVpZGbO\",\r\n \"firehose.endpoint\": \"firehose.ap-southeast-1.amazonaws.com\",\r\n \"awsAccessKeyId\": \"AKIASXW25GZQH5IABE4P\",\r\n \"flows\": [\r\n {\r\n \"filePattern\": \"/opt/log/www1/secure.log\",\r\n \"deliveryStream\": \"SmartInsights-SSH-Login-Logs\",\r\n \"dataProcessingOptions\": [\r\n {\r\n \"optionName\": \"LOGTOJSON\",\r\n \"logFormat\": \"SYSLOG\",\r\n \"matchPattern\": \"^([\\\\w]+) ([\\\\w]+) ([\\\\d]+) ([\\\\d]+) ([\\\\w:]+) ([\\\\w]+) ([\\\\w]+)\\\\[([\\\\d]+)\\\\]\\\\: ([\\\\w\\\\s.\\\\:=]+)$\",\r\n \"customFieldNames\": [\"weekday\", \"month\", \"day\", \"year\", \"time\", \"host\", \"process\", \"identifer\",\"message\"]\r\n }\r\n ]\r\n}", LogInputCategory = Models.LogInputCategory.SSH, LinkedUserID = 1, LinkedS3BucketID = _context.S3Buckets.Find(3).ID, LinkedS3Bucket = _context.S3Buckets.Find(3), InitialIngest = true }); _context.LogInputs.Add(new Models.LogInput { ID = 3, Name = "Windows Security Events", FirehoseStreamName = "SmartInsights-Windows-Security-Logs", ConfigurationJSON = "{ \r\n \"Sources\":[ \r\n { \r\n \"Id\":\"" + "WinSecurityLog" + "\",\r\n \"SourceType\":\"WindowsEventLogSource\",\r\n \"LogName\":\" " + "Security" + " \"\r\n \"IncludeEventData\" : true\r\n }\r\n ],\r\n \"Sinks\":[ \r\n { \r\n \"Id\":\"WinSecurityKinesisFirehose\",\r\n \"SinkType\":\"KinesisFirehose\",\r\n \"AccessKey\":\"" + "AKIASXW25GZQH5IABE4P" + "\",\r\n \"SecretKey\":\"" + "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" + "\",\r\n \"Region\":\"ap-southeast-1\",\r\n \"StreamName\":\"" + "SmartInsights-Windows-Security-Logs" + "\"\r\n \"Format\": \"json\"\r\n }\r\n ],\r\n \"Pipes\":[ \r\n { \r\n \"Id\":\"WinSecurityPipe\",\r\n \"SourceRef\":\"WinSecurityLog\",\r\n \"SinkRef\":\"WinSecurityKinesisFirehose\"\r\n }\r\n ],\r\n \"SelfUpdate\":0\r\n}", LogInputCategory = Models.LogInputCategory.WindowsEventLogs, LinkedUserID = 1, LinkedS3BucketID = _context.S3Buckets.Find(4).ID, LinkedS3Bucket = _context.S3Buckets.Find(4), InitialIngest = true }); _context.LogInputs.Add(new Models.LogInput { ID = 4, Name = "Squid Proxy Server", FirehoseStreamName = "SmartInsights-Cisco-Squid-Proxy-Logs", ConfigurationJSON = "{\r\n \"cloudwatch.emitMetrics\": false,\r\n \"awsSecretAccessKey\": \"XW2HNGQnW9ygpvPDzQQemY0AhsFlUGwiKnVpZGbO\",\r\n \"firehose.endpoint\": \"firehose.ap-southeast-1.amazonaws.com\",\r\n \"awsAccessKeyId\": \"AKIASXW25GZQH5IABE4P\",\r\n \"flows\": [\r\n {\r\n \"filePattern\": \"/opt/log/cisco_router1/cisco_ironport_web.log\",\r\n \"deliveryStream\": \"SmartInsights-Cisco-Squid-Proxy-Logs\",\r\n \"dataProcessingOptions\": [\r\n {\r\n \"optionName\": \"LOGTOJSON\",\r\n \"logFormat\": \"SYSLOG\",\r\n \"matchPattern\": \"^([\\\\w.]+) (?:[\\\\d]+) ([\\\\d.]+) ([\\\\w]+)\\\\/([\\\\d]+) ([\\\\d]+) ([\\\\w.]+) ([\\\\S]+) ([\\\\S]+) (?:[\\\\w]+)\\\\/([\\\\S]+) ([\\\\S]+) (?:[\\\\S\\\\s]+)$\",\r\n \"customFieldNames\": [\"timestamp\",\"destination_ip_address\",\"action\",\"http_status_code\",\"bytes_in\",\"http_method\",\"requested_url\",\"user\",\"requested_url_domain\",\"content_type\"]\r\n }\r\n ]\r\n }\r\n ]\r\n}", LogInputCategory = Models.LogInputCategory.SquidProxy, LinkedUserID = 1, LinkedS3BucketID = _context.S3Buckets.Find(5).ID, LinkedS3Bucket = _context.S3Buckets.Find(5), InitialIngest = true }); await _context.SaveChangesAsync(); _context.Database.ExecuteSqlCommand("SET IDENTITY_INSERT dbo.LogInputs OFF"); _context.GlueConsolidatedEntities.Add(new Models.GlueConsolidatedEntity { CrawlerName = "Test Website", LinkedLogInputID = _context.LogInputs.Find(1).ID, JobName = "Test Website" }); _context.GlueConsolidatedEntities.Add(new Models.GlueConsolidatedEntity { CrawlerName = "SSH Logs", LinkedLogInputID = _context.LogInputs.Find(2).ID, JobName = "SSH Logs" }); _context.GlueConsolidatedEntities.Add(new Models.GlueConsolidatedEntity { CrawlerName = "Windows Security Logs", LinkedLogInputID = _context.LogInputs.Find(3).ID, JobName = "Windows Security Logs" }); _context.GlueConsolidatedEntities.Add(new Models.GlueConsolidatedEntity { CrawlerName = "Squid Proxy Logs", LinkedLogInputID = _context.LogInputs.Find(4).ID, JobName = "Squid Proxy Logs" }); _context.AlertTriggers.Add(new Models.Trigger { Name = "Logins", AlertTriggerType = Models.AlertTriggerType.IPInsights, CondtionalField = "request", CondtionType = "Equal", Condtion = "GET /staging HTTP/1.1", IPAddressField = "host", UserField = "authuser", CurrentInputDataKey = "Test-Website/Input/ipinsights/data-2020-02-11-03-15-42.csv", CurrentModelFileKey = "Test-Website/Model", CheckpointKey = "Test-Website/Checkpoint", SagemakerStatus = Models.SagemakerStatus.Trained, SagemakerErrorStage = Models.SagemakerErrorStage.None, CurrentModelName = "Test-WebsiteModel-2020-02-11-03-21-38", TrainingJobName = "Test-Website-IPInsights-Training-2020-02-11-03-15-42", TrainingJobARN = "arn:aws:sagemaker:ap-southeast-1:188363912800:training-job/test-website-ipinsights-training-2020-02-11-03-15-42", EndpointConfigurationName = "Test-WebsiteEndpointConfig-2020-02-11-03-21-39", EndpointConfigurationARN = "arn:aws:sagemaker:ap-southeast-1:188363912800:endpoint-config/test-websiteendpointconfig-2020-02-11-03-21-39", InferenceBookmark = 13, TrainingBookmark = 13, LinkedLogInputID = _context.LogInputs.Find(1).ID }); await _context.SaveChangesAsync(); } _context.Database.CloseConnection(); }
protected void Page_Load(object sender, EventArgs e) { GetBuildBotStatusResponse response; string action; response = Utils.LocalWebService.GetBuildBotStatus(Master.WebServiceLogin); action = Request ["action"]; if (!string.IsNullOrEmpty(action)) { switch (action) { case "select-release": { int release_id; int host_id; if (int.TryParse(Request ["release_id"], out release_id)) { if (int.TryParse(Request ["host_id"], out host_id)) { DBHost host = response.Hosts.Find((v) => v.id == host_id); if (host == null) { lblMessage.Text = "Invalid host id"; } else { host.release_id = release_id == 0 ? null : new int?(release_id); Utils.LocalWebService.EditHost(Master.WebServiceLogin, host); Response.Redirect("BuildBotStatus.aspx", false); return; } } else { lblMessage.Text = "Invalid host"; } } else { lblMessage.Text = "Invalid release"; } break; } } } if (response.Exception != null) { lblMessage.Text = response.Exception.Message; } else { foreach (DBBuildBotStatus status in response.Status) { DBHost host = response.Hosts.Find((v) => v.id == status.host_id); DBRelease configured_release = host.release_id.HasValue ? response.Releases.Find((v) => v.id == host.release_id.Value) : null; TableRow row = new TableRow(); row.Cells.Add(Utils.CreateTableCell(host.host)); row.Cells.Add(Utils.CreateTableCell(status.version)); row.Cells.Add(Utils.CreateTableCell(status.report_date.ToString("yyyy/MM/dd HH:mm:ss UTC"))); row.Cells.Add(Utils.CreateTableCell(string.Format("<a href='javascript: selectBuildBotRelease (\"{0}\", {1}, \"{2}\")'>{0}</a>", configured_release == null ? "Manual" : configured_release.version, host.id, tblReleases.ClientID))); tblStatus.Rows.Add(row); } foreach (DBRelease release in response.Releases) { TableRow row = new TableRow(); row.Cells.Add(Utils.CreateTableCell(string.Format("<a href='javascript: executeBuildBotSelection ({0})'>Select</a>", release.id))); row.Cells.Add(Utils.CreateTableCell(release.version)); row.Cells.Add(Utils.CreateTableCell(release.revision)); row.Cells.Add(Utils.CreateTableCell(release.description)); tblReleases.Rows.Add(row); } tblReleases.Attributes ["style"] = "display:none"; } }
private Dictionary <String, Object> BuildStatusFrom(int laneId, int revId, DBRevisionWork work, DBHost host) { if (host == null) { throw new HttpException(404, "Build has not been assigned yet, cannot generate status."); } var buildView = Utils.LocalWebService.GetViewLaneData(login, laneId, "", host.id, "", revId, ""); var steps = new List <Dictionary <String, Object> >(); for (int sidx = 0; sidx < buildView.WorkViews.Count; sidx++) { var step = buildView.WorkViews [sidx]; var files = buildView.WorkFileViews [sidx]; var links = buildView.Links.Where(l => l.work_id == step.id); steps.Add(BuildStepStatus(sidx, step, files, links)); } return(new Dictionary <String, Object> { { "build_host", buildView.WorkHost.host }, { "build_host_id", buildView.WorkHost.id }, { "branch", MaxRevisionToBranch(buildView.Lane.max_revision) }, { "commit", buildView.Revision.revision }, { "completed", buildView.RevisionWork.completed }, { "end_time", work.endtime }, { "host", host.host }, { "host_id", host.id }, { "lane_id", laneId }, { "lane_name", buildView.Lane.lane }, { "revision_id", revId }, { "repository", buildView.Lane.repository }, { "start_time", buildView.WorkViews [0].starttime }, { "status", work.State.ToString().ToLowerInvariant() }, { "steps", steps }, { "url", BuildLink(laneId, revId, host.id) } }); }
private string GetStepHistory() { using (var db = new DB()) { var results = new List <object>(); DBHost host = null; DBLane lane = null; DBCommand command = null; GetViewWorkTableDataResponse response = null; MonkeyWrench.WebServices.Authentication.Authenticate(Context, db, login, null, true); response = Utils.LocalWebService.GetViewWorkTableData(login, Utils.TryParseInt32(Request ["lane_id"]), Request ["lane"], Utils.TryParseInt32(Request ["host_id"]), Request ["host"], Utils.TryParseInt32(Request ["command_id"]), Request ["command"]); lane = response.Lane; host = response.Host; command = response.Command; if (lane == null || host == null || command == null) { return("[]"); } List <DBWorkView2> steps; steps = response.WorkViews; for (int i = 0; i < steps.Count; i++) { DBWorkView2 view = steps [i]; List <DBWorkFileView> files = response.WorkFileViews [i]; DBState state = (DBState)view.state; // revision string result; switch (state) { case DBState.NotDone: result = "queued"; break; case DBState.Executing: result = "running"; break; case DBState.Failed: result = view.nonfatal ? "issues" : "failure"; break; case DBState.Success: case DBState.Aborted: case DBState.Timeout: case DBState.Paused: default: result = state.ToString().ToLowerInvariant(); break; } DateTime starttime = view.starttime.ToLocalTime(); DateTime endtime = view.endtime.ToLocalTime(); int duration = (int)(endtime - starttime).TotalSeconds; results.Add(new Dictionary <string, object> { { "id", view.id }, { "author", view.author }, { "workhost_id", view.workhost_id == null ? -1 : view.workhost_id }, { "workhost", view.workhost == null ? "" : view.workhost }, { "start", view.starttime.ToUniversalTime() }, { "duration", duration }, { "duration_string", MonkeyWrench.Utilities.GetDurationFromWorkView(view).ToString() }, { "lane", lane.lane }, { "revision_id", view.revision_id }, { "revision", view.revision }, { "status", result }, { "summary", view.summary } }); } return(JsonConvert.SerializeObject(results, Formatting.Indented)); } }
public string GenerateLane(GetViewWorkTableDataResponse response, DBLane lane, DBHost host, DBCommand command) { StringBuilder matrix = new StringBuilder(); List <DBWorkView2> steps; steps = response.WorkViews; matrix.AppendLine("<table class='buildstatus'>"); matrix.AppendLine("<tr>"); matrix.AppendLine("\t<th>Revision</th>"); matrix.AppendLine("\t<th>Start Time</th>"); matrix.AppendLine("\t<th>Duration</th>");; matrix.AppendLine("\t<th>Html report</th>"); matrix.AppendLine("\t<th>Summary</th>"); matrix.AppendLine("\t<th>Files</th>"); matrix.AppendLine("</tr>"); for (int i = 0; i < steps.Count; i++) { DBWorkView2 view = steps [i]; List <DBWorkFileView> files = response.WorkFileViews [i]; DBState state = (DBState)view.state; matrix.Append("<tr>"); // revision string result; switch (state) { case DBState.NotDone: result = "queued"; break; case DBState.Executing: result = "running"; break; case DBState.Failed: result = view.nonfatal ? "issues" : "failure"; break; case DBState.Success: case DBState.Aborted: case DBState.Timeout: case DBState.Paused: default: result = state.ToString().ToLowerInvariant(); break; } // result matrix.AppendFormat("\t<td class='{0}'><a href='ViewLane.aspx?lane_id={2}&host_id={3}&revision_id={4}'>{1}</a></td>", result, view.revision, lane.id, host.id, view.revision_id); if (state > DBState.NotDone && state != DBState.Paused && state != DBState.Ignore) { matrix.AppendFormat("<td>{0}</td>", view.starttime.ToString("yyyy/MM/dd HH:mm:ss UTC")); } else { matrix.AppendLine("<td>-</td>"); } // duration matrix.Append("\t<td>"); if (state >= DBState.Executing && state != DBState.Paused && state != DBState.Ignore) { matrix.Append("["); matrix.Append(MonkeyWrench.Utilities.GetDurationFromWorkView(view).ToString()); matrix.Append("]"); } else { matrix.Append("-"); } matrix.AppendLine("</td>"); // html report matrix.AppendLine("<td>"); DBWorkFileView index_html = null; foreach (DBWorkFileView file in files) { if (file.filename == "index.html") { index_html = file; break; } } if (index_html != null) { matrix.AppendFormat("<a href='ViewHtmlReport.aspx?workfile_id={0}'>View html report</a>", index_html.id); } else { matrix.AppendLine("-"); } matrix.AppendLine("</td>"); // summary matrix.AppendLine("<td>"); matrix.AppendLine(view.summary); matrix.AppendLine("</td>"); matrix.AppendLine("</tr>"); } matrix.AppendLine("</table>"); return(matrix.ToString()); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); string action = null; int id; response = Utils.LocalWebService.GetViewLaneData2(Master.WebServiceLogin, Utils.TryParseInt32(Request ["lane_id"]), Request ["lane"], Utils.TryParseInt32(Request ["host_id"]), Request ["host"], Utils.TryParseInt32(Request ["revision_id"]), Request ["revision"], false); if (response.Exception != null) { if (response.Exception.HttpCode == 403) { Master.RequestLogin(); return; } lblMessage.Text = response.Exception.Message; return; } if (Authentication.IsInRole(response, MonkeyWrench.DataClasses.Logic.Roles.Administrator)) { action = Request ["action"]; } DBHost host = response.Host; DBLane lane = response.Lane; DBRevision revision = response.Revision; if (lane == null || host == null || revision == null) { Response.Redirect("index.aspx", false); return; } if (!string.IsNullOrEmpty(action)) { switch (action) { case "clearrevision": Utils.LocalWebService.ClearRevision(Master.WebServiceLogin, lane.id, host.id, revision.id); break; case "deleterevision": Utils.LocalWebService.RescheduleRevision(Master.WebServiceLogin, lane.id, host.id, revision.id); break; case "ignorerevision": Utils.LocalWebService.IgnoreRevision(Master.WebServiceLogin, lane.id, host.id, revision.id); break; case "abortrevision": Utils.LocalWebService.AbortRevision(Master.WebServiceLogin, lane.id, host.id, revision.id); break; case "clearstep": if (int.TryParse(Request ["work_id"], out id)) { Utils.LocalWebService.ClearWork(Master.WebServiceLogin, id); } break; case "abortstep": if (int.TryParse(Request ["work_id"], out id)) { Utils.LocalWebService.AbortWork(Master.WebServiceLogin, id); } break; case "pausestep": if (int.TryParse(Request ["work_id"], out id)) { Utils.LocalWebService.PauseWork(Master.WebServiceLogin, id); } break; case "resumestep": if (int.TryParse(Request ["work_id"], out id)) { Utils.LocalWebService.ResumeWork(Master.WebServiceLogin, id); } break; } Response.Redirect(string.Format("ViewLane.aspx?lane_id={0}&host_id={1}&revision_id={2}", lane.id, host.id, revision.id), false); Page.Visible = false; return; } header.InnerHtml = GenerateHeader(response, lane, host, revision, "Build of"); buildtable.InnerHtml = GenerateLane(response); }
private void DBHost_GotFocus(object sender, KeyboardFocusChangedEventArgs e) { DBHost.SelectAll(); }
/// <summary> /// Finds pending steps for the current revision /// </summary> /// <returns></returns> public static List <DBWorkView2> GetNextWork(this DBRevisionWork rw, DB db, DBLane lane, DBHost host, DBRevision revision, bool multiple_work) { List <DBWorkView2> result = new List <DBWorkView2> ();; if (revision == null) { throw new ArgumentNullException("revision"); } if (lane == null) { throw new ArgumentNullException("lane"); } if (host == null) { throw new ArgumentNullException("host"); } rw.FilterPendingWork(db, db.GetWork(rw), result, multiple_work); if (result.Count == 0 && !rw.completed) { rw.completed = true; rw.UpdateState(db); } return(result); }
private void DBHost_GotMouseCapture(object sender, MouseEventArgs e) { DBHost.SelectAll(); }
public frmCreate(DBHost host, DBInfo info) { this.InitializeComponent(); this.m_host = host; this.m_info = info; }