//////////////////////////////////////////////////////////////////////////// // Rev: 2010.1 (P4JsApi 1.0 Example) // // NOTE: This is an example only, and should be modified to work in // a production environment! No warranty is expressed or implied. // Scripts should be tested thoroughly on a test server before // using in a production environment. // //////////////////////////////////////////////////////////////////////////// // Copyright (c) 2010, Perforce Software, Inc. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // 1. Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // 2. Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL PERFORCE SOFTWARE, INC. BE LIABLE FOR ANY // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. //////////////////////////////////////////////////////////////////////////// Ext.onReady(function(){ try { var tools = [{ id:'close', handler: function(e, target, panel) { panel.ownerCt.remove(panel, true); } }]; var processGrid = P4.createProcessesWidget(); var counterGrid = P4.createCountersWidget(); var userGrid = P4.createUsersWidget(); var changesGrid = P4.createChangesWidget(); var accordionItems = []; accordionItems.push(userGrid); accordionItems.push(counterGrid); var column1Items= []; column1Items.push({ title: "Running Commands", tools: tools, layout:'fit', items:processGrid }); column1Items.push({ title: 'Last 10 Submitted Changelists', layout:'fit', tools: tools, items: changesGrid }); var column2Items = []; column2Items.push({ title: '5 Largest db Files', tools: tools, autoScroll:true, html: "<center><div id='dbcontainer' style='height:150px;width:300px'></div></center>" }); column2Items.push( { title: 'Server License', tools: tools, autoScroll:true, html: "<center><div id='usercontainer'style='height:150px;width:300px;'></div></center>" }); var info = P4JsApi.p4("info"); if( info && info.data[0] && info.data[0].serverVersion ) { var versionRegex = /\d\d\d\d\.\d/; var version = versionRegex.exec(info.data[0].serverVersion); if( version && version[0] ) { version = version[0]; var docVersion = version[2] + version[3] + version[5]; var supportPage = {}; supportPage.title = "P4 Admin Guide " + version; supportPage.tools = tools; supportPage.autoScroll = true; supportPage.html = "<iframe height='400' width='99%' src='http://www.perforce.com/perforce/doc." + docVersion + "/manuals/p4sag/index.html' />" column1Items.push(supportPage); } } var viewport = new Ext.Viewport({ layout:'border', id: 'dash_view', items:[{ region:'west', id:'west-panel', title:'Admin', split:true, width: 300, minSize: 200, maxSize: 400, collapsible: true, margins:'10 0 5 5', cmargins:'10 5 5 5', layout:'accordion', layoutConfig:{ animate:true }, items: accordionItems },{ xtype:'portal', id: 'center_panel', region:'center', margins:'10 5 5 0', items:[{ columnWidth:.50, style:'padding:10px 0 10px 10px', items:column1Items },{ columnWidth:.50, style:'padding:10px 0 10px 10px', items: column2Items }] }] }); P4.createDbstatWidget('dbcontainer'); P4.createLicenseWidget('usercontainer'); counterGrid.getView().refresh(); changesGrid.getView().refresh(); userGrid.getView().refresh(); } catch(e) { alert(e); } });
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#4 | 7663 | dscheirer | Rollback //public/perforce/p4jsapi to changelist 7643 | ||
#3 | 7660 | jhalbig |
As per meeting to resolve issue with sync calls made from within async calls hanging P4V (job039138) pulling example code from Public Depot until it can be re-worked and confirmed to function correctly with pending P4JsApi changes. |
||
#2 | 7643 | jhalbig |
Cleaned up any remaining discrepancies in the code. Removed all internal references and debugging code. Cleaned up formatting, added more commenting for submit dialog code. Ready for 2010.1 Beta. |
||
#1 | 7638 | jhalbig | Initial Addition of P4JsApi samples for 2010.1 Beta |