Unfinished deployment viewer
authorVictor Kirhenshtein <victor@netxms.org>
Tue, 15 Feb 2005 17:13:06 +0000 (17:13 +0000)
committerVictor Kirhenshtein <victor@netxms.org>
Tue, 15 Feb 2005 17:13:06 +0000 (17:13 +0000)
src/console/win32/DeploymentView.cpp
src/console/win32/DeploymentView.h
src/console/win32/globals.h
src/console/win32/nxcon.clw
src/console/win32/nxcon.cpp
src/console/win32/nxcon.rc
src/console/win32/resource.h

index 0186621..71fb914 100644 (file)
@@ -27,9 +27,66 @@ CDeploymentView::~CDeploymentView()
 
 BEGIN_MESSAGE_MAP(CDeploymentView, CMDIChildWnd)
        //{{AFX_MSG_MAP(CDeploymentView)
-               // NOTE - the ClassWizard will add and remove mapping macros here.
+       ON_WM_CREATE()
        //}}AFX_MSG_MAP
+   ON_MESSAGE(WM_START_DEPLOYMENT, OnStartDeployment)
 END_MESSAGE_MAP()
 
 /////////////////////////////////////////////////////////////////////////////
 // CDeploymentView message handlers
+
+BOOL CDeploymentView::PreCreateWindow(CREATESTRUCT& cs) 
+{
+       // TODO: Add your specialized code here and/or call the base class
+       
+       return CMDIChildWnd::PreCreateWindow(cs);
+}
+
+
+//
+// WM_CREATE message handler
+//
+
+int CDeploymentView::OnCreate(LPCREATESTRUCT lpCreateStruct) 
+{
+   RECT rect;
+
+       if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1)
+               return -1;
+
+   // Create list view inside window
+   GetClientRect(&rect);
+   rect.top += 20;
+   m_wndListCtrl.Create(WS_CHILD | WS_VISIBLE | LVS_REPORT, rect, this, ID_LIST_VIEW);
+   m_wndListCtrl.InsertColumn(0, _T("Node"), LVCFMT_LEFT, 120);
+   m_wndListCtrl.InsertColumn(1, _T("Status"), LVCFMT_LEFT, 100);
+   m_wndListCtrl.InsertColumn(2, _T("Message"), LVCFMT_LEFT, 250);
+   m_wndListCtrl.SetExtendedStyle(LVS_EX_GRIDLINES);
+       
+       return 0;
+}
+
+
+//
+// Deployment worker thread
+//
+
+static void DeploymentThread(DEPLOYMENT_JOB *pJob)
+{
+   DWORD dwResult;
+
+   dwResult = NXCDeployPackage(g_hSession, pJob->dwPkgId, pJob->dwNumObjects, pJob->pdwObjectList);
+   safe_free(pJob->pdwObjectList);
+   free(pJob);
+}
+
+
+//
+// WM_START_DEPLOYMENT message handler
+//
+
+void CDeploymentView::OnStartDeployment(WPARAM wParam, DEPLOYMENT_JOB *pJob)
+{
+   pJob->hWnd = m_hWnd;
+   CreateThread(NULL, 0, DeploymentThread, pJob, 0, &dwThreadId);
+}
index 4186f18..42df7fe 100644 (file)
@@ -25,16 +25,20 @@ public:
 // Overrides
        // ClassWizard generated virtual function overrides
        //{{AFX_VIRTUAL(CDeploymentView)
+       protected:
+       virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
        //}}AFX_VIRTUAL
 
 // Implementation
 protected:
+       CListCtrl m_wndListCtrl;
        virtual ~CDeploymentView();
 
        // Generated message map functions
        //{{AFX_MSG(CDeploymentView)
-               // NOTE - the ClassWizard will add and remove member functions here.
+       afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
        //}}AFX_MSG
+   afx_msg void OnStartDeployment(WPARAM wParam, DEPLOYMENT_JOB *pJob);
        DECLARE_MESSAGE_MAP()
 };
 
index 3377fba..e9b3d3b 100644 (file)
@@ -72,6 +72,8 @@ extern CConsoleApp theApp;
 #define WM_STATE_CHANGE          (WM_USER + 8)
 #define WM_ALARM_UPDATE          (WM_USER + 9)
 #define WM_POLLER_MESSAGE        (WM_USER + 10)
+#define WM_START_DEPLOYMENT      (WM_USER + 11)
+#define WM_DEPLOYMENT_INFO       (WM_USER + 12)
 
 
 //
@@ -132,6 +134,19 @@ struct DEF_IMG
 };
 
 
+//
+// Package deployment startup info
+//
+
+struct DEPLOYMENT_JOB
+{
+   DWORD dwPkgId;
+   DWORD dwNumObjects;
+   DWORD *pdwObjectList;
+   HWND hWnd;
+};
+
+
 //
 // Communication functions
 //
index 73b52de..def4be6 100644 (file)
@@ -16,9 +16,9 @@ Class7=CEventBrowser
 Class9=CMapView
 
 ResourceCount=113
-Resource1=IDD_DCI_COLLECTION (English (U.S.))
+Resource1=IDD_USER_PROPERTIES (English (U.S.))
 Resource2=IDD_OBJECT_NODE_GENERAL
-Resource3=IDD_EDIT_TRAP (English (U.S.))
+Resource3=IDD_CREATE_TG (English (U.S.))
 Resource4=IDD_SELECT_OBJECT
 Resource5=IDD_SELECT_ACTION
 Class2=CChildView
@@ -32,9 +32,9 @@ Resource7=IDD_NEW_USER
 Class12=CObjectBrowser
 Resource8=IDD_CREATE_CONTAINER
 Class13=CObjectPropDlg
-Resource9=IDD_EDIT_RULE_SEVERITY (English (U.S.))
-Resource10=IDD_SELECT_AGENT_PARAM (English (U.S.))
-Resource11=IDA_GRAPH (English (U.S.))
+Resource9=IDD_EDIT_RULE_COMMENT (English (U.S.))
+Resource10=IDD_EDIT_TRAP_ARG (English (U.S.))
+Resource11=IDA_EVENT_EDITOR (English (U.S.))
 Resource12=IDR_CTRLPANEL (English (U.S.))
 Resource13=IDR_EVENTS (English (U.S.))
 Resource14=IDR_MAPFRAME (English (U.S.))
@@ -42,33 +42,33 @@ Resource15=IDR_OBJECTS (English (U.S.))
 Resource16=IDD_DUMMY (English (U.S.))
 Class14=CEventEditor
 Class15=CEditEventDlg
-Resource17=IDD_REQUEST_PROCESSING (English (U.S.))
+Resource17=IDD_EDIT_EVENT (English (U.S.))
 Class16=CDebugFrame
-Resource18=IDA_NETMAP (English (U.S.))
+Resource18=IDA_OBJECT_BROWSER (English (U.S.))
 Resource19=IDD_OBJECT_PROPERTIES (English (U.S.))
 Resource20=IDD_SELECT_EVENT
 Class17=CObjectPreview
-Resource21=IDD_CREATE_NODE (English (U.S.))
+Resource21=IDD_ACTION_PROPERTIES (English (U.S.))
 Class18=CToolBox
 Class19=CObjectInfoBox
 Class20=CObjectSearchBox
-Resource22=IDD_EDIT_RULE_COMMENT (English (U.S.))
+Resource22=IDD_THRESHOLD (English (U.S.))
 Class21=CEditBox
 Class22=COPGeneral
 Class23=CNodePropsGeneral
-Resource23=IDA_ACTION_EDITOR (English (U.S.))
+Resource23=IDA_ALARM_BROWSER (English (U.S.))
 Class24=CObjectPropCaps
 Class25=CObjectPropSheet
 Resource24=IDA_MDI_DEFAULT
 Class26=CRequestProcessingDlg
-Resource25=IDA_TRAP_EDITOR (English (U.S.))
+Resource25=IDA_NETMAP (English (U.S.))
 Resource26=IDD_PROGRESS (English (U.S.))
 Resource27=IDD_EDIT_RULE_ALARM
-Resource28=IDA_EPP (English (U.S.))
+Resource28=IDR_MAINFRAME (English (U.S.))
 Class27=CObjectPropsGeneral
-Resource29=IDD_CREATE_NETSRV (English (U.S.))
+Resource29=IDD_SELECT_INTERNAL_ITEM (English (U.S.))
 Class28=CObjectPropsSecurity
-Resource30=IDD_SELECT_ACTION (English (U.S.))
+Resource30=IDD_CP_GENERAL (English (U.S.))
 Resource31=IDD_SELECT_USER
 Resource32=IDD_OBJECT_SECURITY
 Class29=CUserSelectDlg
@@ -79,36 +79,36 @@ Class31=CNewUserDlg
 Resource35=IDD_THRESHOLD
 Resource36=IDA_EPP
 Class32=CUserPropDlg
-Resource37=IDD_EDIT_TRAP_ARG (English (U.S.))
+Resource37=IDD_CREATE_TEMPLATE (English (U.S.))
 Resource38=IDD_ABOUTBOX
 Class33=CGroupPropDlg
 Resource39=IDD_CP_GENERAL
 Resource40=IDA_TRAP_EDITOR
 Resource41=IDM_VIEW_SPECIFIC
-Resource42=IDD_OBJECT_GENERAL (English (U.S.))
+Resource42=IDD_OBJECT_NODE_GENERAL (English (U.S.))
 Class34=CPasswordChangeDlg
 Class35=CNodeSummary
 Class36=CNetSummaryFrame
 Class37=CDataCollectionEditor
-Resource43=IDD_NEW_ACTION (English (U.S.))
+Resource43=IDD_EDIT_RULE_SEVERITY (English (U.S.))
 Class38=CDCIPropPage
-Resource44=IDD_OBJECT_CAPS (English (U.S.))
+Resource44=IDD_LOGIN (English (U.S.))
 Class39=CDCIDataView
-Resource45=IDD_CREATE_TEMPLATE (English (U.S.))
+Resource45=IDD_CREATE_NODE (English (U.S.))
 Class40=CGraph
 Class41=CGraphFrame
 Class42=CDCIThresholdsPage
-Resource46=IDD_EDIT_RULE_ALARM (English (U.S.))
-Resource47=IDD_LOGIN (English (U.S.))
+Resource46=IDD_SELECT_EVENT (English (U.S.))
+Resource47=IDA_GRAPH (English (U.S.))
 Resource48=IDM_CONTEXT
 Class43=CThresholdDlg
-Resource49=IDD_OBJECT_SECURITY (English (U.S.))
+Resource49=IDD_OBJECT_CAPS (English (U.S.))
 Resource50=IDD_EDIT_TRAP_ARG
 Class44=CMIBBrowserDlg
 Class45=CEventPolicyEditor
 Class46=CRuleList
 Class47=CRuleHeader
-Resource51=IDD_GRAPH_PROPERTIES (English (U.S.))
+Resource51=IDD_DATA_QUERY (English (U.S.))
 Resource52=IDD_CREATE_NODE
 Class48=CObjectSelDlg
 Resource53=IDD_OBJECT_CAPS
@@ -117,22 +117,22 @@ Class49=CRuleCommentDlg
 Resource55=IDD_DCI_COLLECTION
 Class50=CEventSelDlg
 Resource56=IDD_DATA_QUERY
-Resource57=IDD_EDIT_EVENT (English (U.S.))
+Resource57=IDA_PACKAGE_MGR (English (U.S.))
 Resource58=IDD_CREATE_TG
-Resource59=IDD_SELECT_USER (English (U.S.))
-Resource60=IDD_THRESHOLD (English (U.S.))
+Resource59=IDD_REQUEST_PROCESSING (English (U.S.))
+Resource60=IDD_SET_PASSWORD (English (U.S.))
 Class51=CObjectPropsPresentation
-Resource61=IDD_SELECT_OBJECT (English (U.S.))
+Resource61=IDD_DCI_THRESHOLDS (English (U.S.))
 Resource62=IDD_EDIT_RULE_COMMENT
 Class52=CRuleSeverityDlg
 Resource63=IDD_ACTION_PROPERTIES
 Class53=CRuleAlarmDlg
 Class54=CAlarmBrowser
-Resource64=IDA_ALARM_BROWSER (English (U.S.))
+Resource64=IDA_MDI_DEFAULT (English (U.S.))
 Resource65=IDD_DCI_TRANSFORM
-Resource66=IDD_SELECT_INTERNAL_ITEM (English (U.S.))
-Resource67=IDD_DCI_THRESHOLDS (English (U.S.))
-Resource68=IDD_USER_PROPERTIES (English (U.S.))
+Resource66=IDD_EDIT_TRAP (English (U.S.))
+Resource67=IDD_GROUP_PROPERTIES (English (U.S.))
+Resource68=IDD_OBJECT_SECURITY (English (U.S.))
 Class55=CConsolePropsGeneral
 Class56=CActionEditor
 Resource69=IDA_ACTION_EDITOR
@@ -143,18 +143,18 @@ Class58=CEditActionDlg
 Resource72=IDA_NETMAP
 Class59=CActionSelDlg
 Resource73=IDD_MIB_BROWSER
-Resource74=IDD_GROUP_PROPERTIES (English (U.S.))
-Resource75=IDD_OBJECT_PRESENTATION (English (U.S.))
+Resource74=IDD_SELECT_USER (English (U.S.))
+Resource75=IDD_SELECT_OBJECT (English (U.S.))
 Resource76=IDD_USER_PROPERTIES
 Class60=CCreateObjectDlg
 Class61=CCreateContainerDlg
 Resource77=IDR_MAINFRAME
 Class62=CCreateNodeDlg
-Resource78=IDD_INPUT_BOX (English (U.S.))
-Resource79=IDD_ACTION_PROPERTIES (English (U.S.))
-Resource80=IDD_OBJECT_NODE_GENERAL (English (U.S.))
+Resource78=IDD_GRAPH_PROPERTIES (English (U.S.))
+Resource79=IDD_EDIT_RULE_ALARM (English (U.S.))
+Resource80=IDD_ABOUTBOX (English (U.S.))
 Class63=CDCITransformPage
-Resource81=IDD_CP_GENERAL (English (U.S.))
+Resource81=IDD_OBJECT_PRESENTATION (English (U.S.))
 Class64=CPollNodeDlg
 Resource82=IDD_POLL_NODE (English (U.S.))
 Class65=CNodePoller
@@ -180,28 +180,28 @@ Class73=CColorSelector
 Class74=CPackageMgr
 Resource94=IDD_GROUP_PROPERTIES
 Resource95=IDD_GRAPH_PROPERTIES
-Resource96=IDD_OBJECT_NETSRV_GENERAL (English (U.S.))
-Resource97=IDR_MAINFRAME (English (U.S.))
-Resource98=IDA_MDI_DEFAULT (English (U.S.))
-Resource99=IDA_OBJECT_BROWSER (English (U.S.))
-Resource100=IDD_NEW_USER (English (U.S.))
-Resource101=IDD_SET_PASSWORD (English (U.S.))
-Resource102=IDD_DCI_TRANSFORM (English (U.S.))
-Resource103=IDD_CREATE_TG (English (U.S.))
-Resource104=IDD_DATA_QUERY (English (U.S.))
-Resource105=IDM_VIEW_SPECIFIC (English (U.S.))
-Resource106=IDM_CONTEXT (English (U.S.))
-Resource107=IDD_ABOUTBOX (English (U.S.))
+Resource96=IDD_SELECT_AGENT_PARAM (English (U.S.))
+Resource97=IDD_INPUT_BOX (English (U.S.))
+Resource98=IDD_CREATE_NETSRV (English (U.S.))
+Resource99=IDD_OBJECT_NETSRV_GENERAL (English (U.S.))
+Resource100=IDD_OBJECT_GENERAL (English (U.S.))
+Resource101=IDD_NEW_USER (English (U.S.))
+Resource102=IDD_SELECT_ACTION (English (U.S.))
+Resource103=IDD_CREATE_CONTAINER (English (U.S.))
+Resource104=IDD_DCI_TRANSFORM (English (U.S.))
+Resource105=IDM_CONTEXT (English (U.S.))
+Resource106=IDM_VIEW_SPECIFIC (English (U.S.))
+Resource107=IDA_TRAP_EDITOR (English (U.S.))
 Class75=CInternalItemSelDlg
-Resource108=IDD_MIB_BROWSER (English (U.S.))
+Resource108=IDD_DCI_COLLECTION (English (U.S.))
 Class76=CAgentParamSelDlg
-Resource109=IDA_PACKAGE_MGR (English (U.S.))
+Resource109=IDA_ACTION_EDITOR (English (U.S.))
 Class77=CInputBox
-Resource110=IDD_CREATE_CONTAINER (English (U.S.))
+Resource110=IDD_NEW_ACTION (English (U.S.))
 Class78=CCreateNetSrvDlg
-Resource111=IDA_EVENT_EDITOR (English (U.S.))
+Resource111=IDA_EPP (English (U.S.))
 Class79=CNetSrvPropsGeneral
-Resource112=IDD_SELECT_EVENT (English (U.S.))
+Resource112=IDD_MIB_BROWSER (English (U.S.))
 Class80=CNodePropsPolling
 Class81=CDeploymentView
 Resource113=IDD_OBJECT_NODE_POLL (English (U.S.))
@@ -2979,4 +2979,5 @@ HeaderFile=DeploymentView.h
 ImplementationFile=DeploymentView.cpp
 BaseClass=CMDIChildWnd
 Filter=M
+VirtualFilter=mfWC
 
index 56c44b1..0b7b180 100644 (file)
@@ -1525,7 +1525,18 @@ void CConsoleApp::WakeUpNode(DWORD dwObjectId)
 void CConsoleApp::DeployPackage(DWORD dwPkgId, DWORD dwNumObjects, DWORD *pdwObjectList)
 {
        CMainFrame* pFrame = STATIC_DOWNCAST(CMainFrame, m_pMainWnd);
+   CMDIChildWnd *pWnd;
 
-       pFrame->CreateNewChild(
-               RUNTIME_CLASS(CDeploymentView), IDR_PACKAGE_MGR, m_hMDIMenu, m_hMDIAccel);
+       pWnd = pFrame->CreateNewChild(
+               RUNTIME_CLASS(CDeploymentView), IDR_DEPLOYMENT_VIEW, m_hMDIMenu, m_hMDIAccel);
+   if (pWnd != NULL)
+   {
+      DEPLOYMENT_JOB *pJob;
+
+      pJob = (DEPLOYMENT_JOB *)malloc(sizeof(DEPLOYMENT_JOB));
+      pJob->dwPkgId = dwPkgId;
+      pJob->dwNumObjects = dwNumObjects;
+      pJob->pdwObjectList = (DWORD *)nx_memdup(pdwObjectList, sizeof(DWORD) * dwNumObjects);
+      pWnd->PostMessage(WM_START_DEPLOYMENT, 0, (LPARAM)pJob);
+   }
 }
index b2678ed..8792d8d 100644 (file)
@@ -2155,6 +2155,7 @@ END
 STRINGTABLE DISCARDABLE 
 BEGIN
     IDR_PACKAGE_MGR         "\nPackage Manager\nPackage Manager"
+    IDR_DEPLOYMENT_VIEW     "\nPackage Deployment\nPackage Deployment"
 END
 
 #endif    // English (U.S.) resources
index 1489bff..f0fde71 100644 (file)
 #define IDC_EDIT_POLLER                 1232
 #define IDC_EDIT_IPADDR                 1233
 #define IDR_PACKAGE_MGR                 8156
+#define IDR_DEPLOYMENT_VIEW             8157
 #define ID_VIEW_CONTROLPANEL            32771
 #define ID_VIEW_EVENTS                  32774
 #define ID_VIEW_MAP                     32776