mirror of
https://github.com/levinsv/pgadmin3.git
synced 2026-05-15 14:15:49 -06:00
Move node "Jobs" in node Database
Задания для pgpro_scheduler теперь отображаются в узле Database
Так же вывод лога работы Job в закладке "Статистика" изменён.
Выводяться строки лога таким запросом:
select log_time,detail critical,message,hint
from pg_log l where l.log_time>'$Started'::timestamp - interval '1min'
and l.log_time<'$Finised'::timestamp + interval '1min'
and detail::int>=0
This commit is contained in:
parent
2e72900cdd
commit
c13bc24e7d
4 changed files with 31 additions and 24 deletions
|
|
@ -15,7 +15,7 @@
|
|||
#include "schema/pgServer.h"
|
||||
|
||||
|
||||
class pgproJobFactory : public pgServerObjFactory
|
||||
class pgproJobFactory : public pgDatabaseObjFactory
|
||||
{
|
||||
public:
|
||||
pgproJobFactory();
|
||||
|
|
@ -36,7 +36,7 @@ protected:
|
|||
};
|
||||
extern pgproJobFactory projobFactory;
|
||||
|
||||
class pgproJob : public pgServerObject
|
||||
class pgproJob : public pgDatabaseObject
|
||||
{
|
||||
public:
|
||||
pgproJob(const wxString &newName = wxT(""));
|
||||
|
|
@ -378,10 +378,10 @@ protected:
|
|||
};
|
||||
|
||||
|
||||
class pgproJobCollection : public pgServerObjCollection
|
||||
class pgproJobCollection : public pgDatabaseObjCollection
|
||||
{
|
||||
public:
|
||||
pgproJobCollection(pgaFactory *factory, pgServer *sv);
|
||||
pgproJobCollection(pgaFactory *factory, pgDatabase *db);
|
||||
wxString GetTranslatedMessage(int kindOfMessage) const;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
#include "pro_scheduler/pgproJob.h"
|
||||
|
||||
pgproJob::pgproJob(const wxString &newName)
|
||||
: pgServerObject(projobFactory, newName)
|
||||
: pgDatabaseObject(projobFactory, newName)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -258,7 +258,12 @@ pgObject *pgproJobFactory::CreateObjects(pgCollection *collection, ctlTree *brow
|
|||
job = new pgproJob(jobs->GetVal(wxT("name")));
|
||||
job->iSetStatus(status);
|
||||
job->iSetOwner(jobs->GetVal(wxT("owner")));
|
||||
job->iSetServer(collection->GetServer());
|
||||
//job->iSetServer(collection->GetServer());
|
||||
pgDatabase* db = collection->GetDatabase();
|
||||
if (db == NULL) {
|
||||
assert(db == NULL);
|
||||
}
|
||||
job->iSetDatabase(collection->GetDatabase());
|
||||
job->iSetRecId(jobs->GetLong(wxT("id")));
|
||||
job->iSetComment(jobs->GetVal(wxT("comments")));
|
||||
|
||||
|
|
@ -356,10 +361,10 @@ void pgproJob::ShowStatistics(frmMain *form, ctlListView *statistics)
|
|||
|
||||
wxString wxDTend = DateToAnsiStr(GetFinished());
|
||||
if (wxDTend.IsEmpty()) wxDTend=DateToAnsiStr(wxDateTime::Now());
|
||||
sql=wxT("select log_time,detail critical,message,application_name from pg_log l where l.log_time>'") + DateToAnsiStr(GetStarted())+
|
||||
sql=wxT("select log_time,detail critical,message,hint from pg_log l where l.log_time>'") + DateToAnsiStr(GetStarted())+
|
||||
wxT("'::timestamp - interval '1min' and l.log_time<='")+ wxDTend +
|
||||
wxT("'::timestamp + interval '1min' and hint='")+GetTryName()+wxT("'");
|
||||
|
||||
wxT("'::timestamp + interval '1min' and detail::int>=0");
|
||||
//+GetTryName()+wxT("'");
|
||||
pgSet *stats = GetConnection()->ExecuteSet(sql);
|
||||
wxString critical;
|
||||
wxDateTime startTime;
|
||||
|
|
@ -391,8 +396,8 @@ bool pgproJob::RunNow()
|
|||
}
|
||||
|
||||
|
||||
pgproJobCollection::pgproJobCollection(pgaFactory *factory, pgServer *sv)
|
||||
: pgServerObjCollection(factory, sv)
|
||||
pgproJobCollection::pgproJobCollection(pgaFactory *factory, pgDatabase *db)
|
||||
: pgDatabaseObjCollection(factory, db)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -448,7 +453,7 @@ void pgproJob::SetEnabled(ctlTree *browser, const bool b)
|
|||
#include "images/jobrun.pngc"
|
||||
|
||||
pgproJobFactory::pgproJobFactory()
|
||||
: pgServerObjFactory(__("pgpro_Scheduler Job"), __("New Job"), __("Create a new Job."), job_png_img)
|
||||
: pgDatabaseObjFactory(__("pgpro_Scheduler Job"), __("New Job"), __("Create a new Job."), job_png_img)
|
||||
{
|
||||
metaType = PGM_PROJOB;
|
||||
disabledId = addIcon(jobdisabled_png_img);
|
||||
|
|
@ -459,7 +464,8 @@ pgproJobFactory::pgproJobFactory()
|
|||
|
||||
pgCollection *pgproJobFactory::CreateCollection(pgObject *obj)
|
||||
{
|
||||
return new pgproJobCollection(GetCollectionFactory(), (pgServer *)obj);
|
||||
return new pgproJobCollection(GetCollectionFactory(), (pgDatabase *) obj);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include "slony/slCluster.h"
|
||||
#include "frm/frmHint.h"
|
||||
#include "frm/frmReport.h"
|
||||
#include "pro_scheduler/pgproJob.h"
|
||||
|
||||
|
||||
pgDatabase::pgDatabase(const wxString &newName)
|
||||
|
|
@ -641,6 +642,17 @@ void pgDatabase::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *pr
|
|||
browser->AppendCollection(this, synonymFactory);
|
||||
if (settings->GetDisplayOption(_("Schemas")))
|
||||
browser->AppendCollection(this, schemaFactory);
|
||||
if (settings->GetDisplayOption(_("pgpro_scheduler")))
|
||||
{
|
||||
wxString exists = connection()->ExecuteScalar(
|
||||
wxT("select true ok from pg_extension where extname='pgpro_scheduler'\n"));
|
||||
|
||||
if (!exists.IsNull())
|
||||
{
|
||||
browser->AppendCollection(this, projobFactory);
|
||||
}
|
||||
}
|
||||
|
||||
if (settings->GetDisplayOption(_("Slony-I Clusters")))
|
||||
browser->AppendCollection(this, slClusterFactory);
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@
|
|||
#include "schema/pgRole.h"
|
||||
#include "schema/gpResQueue.h"
|
||||
#include "agent/pgaJob.h"
|
||||
#include "pro_scheduler/pgproJob.h"
|
||||
#include "utils/utffile.h"
|
||||
#include "utils/pgfeatures.h"
|
||||
#include "utils/registry.h"
|
||||
|
|
@ -1131,16 +1130,6 @@ void pgServer::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *prop
|
|||
browser->AppendCollection(this, jobFactory);
|
||||
}
|
||||
}
|
||||
if (settings->GetDisplayOption(_("pgpro_scheduler")))
|
||||
{
|
||||
wxString exists = conn->ExecuteScalar(
|
||||
wxT("select true ok from pg_extension where extname='pgpro_scheduler'\n"));
|
||||
|
||||
if (!exists.IsNull())
|
||||
{
|
||||
browser->AppendCollection(this, projobFactory);
|
||||
}
|
||||
}
|
||||
|
||||
if (conn->BackendMinimumVersion(8, 1))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue