| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,205 @@ | ||
| @import "../../../../css/layout.css"; | ||
| @import "../../../../css/ide.css"; | ||
| @import "../../../../css/sections.css"; | ||
| @import "../../../../css/images.css"; | ||
| @import "../../../../css/theme.css"; | ||
| @import "../../../../css/progress.css"; | ||
| @import "../../../../css/wizard.css"; | ||
|
|
||
|
|
||
| html, body { | ||
| min-width: 350px; | ||
| overflow: hidden; | ||
| } | ||
|
|
||
| .dialogFrame { | ||
| background-color: #fdfdfd; | ||
| } | ||
|
|
||
| #messageArea{ | ||
| display: table-cell; | ||
| width: calc(100% - 16px); | ||
| } | ||
|
|
||
| #messageRow{ | ||
| background: none repeat scroll 0 0 #FFFFFF; | ||
| box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.098), 0 1px 0 0 rgba(0, 0, 0, 0.098); | ||
| height: 25px; | ||
| padding: 3px 5px 2px 9px; | ||
| display: table; | ||
| width: calc(100% - 15px); | ||
| } | ||
|
|
||
| #messageButton{ | ||
| right: -7px; | ||
| margin-top: 1px; | ||
| position: absolute; | ||
| top: 0; | ||
| } | ||
|
|
||
| .Spaces{ | ||
| width: 100%; | ||
| } | ||
|
|
||
| select{ | ||
| height: 24px; | ||
| width: 290px; | ||
| border: 1px solid #bbb; | ||
| } | ||
|
|
||
| .selectCell input { | ||
| height: 24px; | ||
| width: 290px; | ||
| margin-left: 0; | ||
| border: 1px solid #bbb; | ||
| } | ||
|
|
||
| .comboTextInputWrapper{ | ||
| height: 24px; | ||
| width: 290px; | ||
| border: 1px solid #bbb; | ||
| } | ||
|
|
||
| .comboTextInputWrapper input{ | ||
| font-size: inherit; | ||
| } | ||
|
|
||
| .comboTextInputField { | ||
| width: 260px !important; | ||
| height: 24px; | ||
| text-align: left; | ||
| margin-right: 0; | ||
| border: 0px !important; | ||
| } | ||
|
|
||
| .recentEntryButton { | ||
| margin-left: 0; | ||
| height: 22px; | ||
| background: none repeat scroll 0 0 #fff; | ||
| width: 25px; | ||
| } | ||
|
|
||
| .formTable{ | ||
| font-family: Arial,sans-serif; | ||
| font-size: 14px; | ||
| width: 100%; | ||
| } | ||
|
|
||
| .selectCell { | ||
| padding-top: 4px; | ||
| text-align: left; | ||
| } | ||
|
|
||
| .listCell select { | ||
| height: inherit; | ||
| width: 190px; | ||
| } | ||
|
|
||
| #servicesAddRemoveButtonsCol{ | ||
| text-align: center; | ||
| vertical-align: middle; | ||
| } | ||
|
|
||
| .messageContainer { | ||
| display: none; | ||
| padding-top: 2px; | ||
| position: absolute; | ||
| text-align: center; | ||
| box-shadow: 0 2px 0 rgba(0, 0, 0, 0.1); | ||
| background-color: #dff0d8; | ||
| border-bottom-left-radius: 5px; | ||
| border-bottom-right-radius: 5px; | ||
| margin-left: 5%; | ||
| margin-right: auto; | ||
| width: 90%; | ||
| padding-bottom: 5px; | ||
| padding-left: 5px; | ||
| padding-top: 5px; | ||
| } | ||
|
|
||
| .messageContainer.showing { | ||
| display: block; | ||
| transition: top 0.7s ease 0s; | ||
| } | ||
|
|
||
| .retryFields{ | ||
| margin-top: 5px; | ||
| text-align: right; | ||
| } | ||
|
|
||
| .retryFields label { | ||
| margin-left: 5px; | ||
| } | ||
|
|
||
| .errorMessage input{ | ||
| border-color: #eed3d7 !important; | ||
| } | ||
|
|
||
| .errorMessage button{ | ||
| color: #b94a48 !important; | ||
| } | ||
|
|
||
| .errorMessage button:hover{ | ||
| color: #FFFFFF !important; | ||
| } | ||
|
|
||
| .messageContainer.errorMessage{ | ||
| background-color: #f2dede !important; | ||
| border: 1px solid #eed3d7 !important; | ||
| } | ||
|
|
||
| .errorMessage, .errorMessage a{ | ||
| color: #b94a48 !important; | ||
| } | ||
|
|
||
| .messageLabel a{ | ||
| color: #b94a48; | ||
| text-decoration: underline; | ||
| } | ||
|
|
||
| .messageLabel button{ | ||
| border: none; | ||
| border-radius: 5px; | ||
| background: none repeat scroll 0 0 rgba(0, 0, 0, 0); | ||
| color: #b94a48; | ||
| font-family: Arial,Helvetica,Myriad,Tahoma,clean,sans-serif,Lucida Sans Unicode,Lucida Grande,Verdana; | ||
| font-size: 9pt; | ||
| cursor: pointer; | ||
| } | ||
|
|
||
| .messageLabel button:hover{ | ||
| color: #FFFFFF; | ||
| } | ||
|
|
||
| .messageLabel { | ||
| color: #468847; | ||
| float: left; | ||
| max-height: 1000px; | ||
| overflow: hidden; | ||
| padding-left: 5px; | ||
| text-align: center; | ||
| } | ||
|
|
||
| .dialogTitle .closeDialog { | ||
| margin: 0; | ||
| cursor: pointer; | ||
| } | ||
|
|
||
| #memoryInput{ | ||
| margin-right: 5px; | ||
| width: 235px; | ||
| } | ||
|
|
||
| #memoryUnit{ | ||
| width: 50px; | ||
| } | ||
|
|
||
| input[type='number'] { | ||
| -moz-appearance:textfield; | ||
| } | ||
|
|
||
| input[type=number]::-webkit-inner-spin-button, | ||
| input[type=number]::-webkit-outer-spin-button { | ||
| -webkit-appearance: none; | ||
| margin: 0; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| <html> | ||
| <head> | ||
| <link rel="stylesheet" type="text/css" href="genericDeploymentWizard.css" /> | ||
| <script src="../../../../requirejs/require.js"></script> | ||
| <script type="text/javascript"> | ||
| /*global require*/ | ||
| require({ | ||
| baseUrl: '../../../../', | ||
| packages: [], | ||
| paths: { | ||
| i18n: 'requirejs/i18n', | ||
| domReady: 'requirejs/domReady', | ||
| text: 'requirejs/text' | ||
| } | ||
| }); | ||
| require(["cfui/plugins/wizards/generic/genericDeploymentWizard"]); | ||
| </script> | ||
| </head> | ||
| <body id="deployBody" class="dialogFrame"> | ||
|
|
||
| <div class="dialogTitle" id="titleBar"> | ||
| <span id="title" class="dialogTitleText layoutLeft"> | ||
| </span> | ||
| <button aria-label="Close" class="dismissButton layoutRight core-sprite-close imageSprite closeDialog" id="closeDialog"> | ||
| </button> | ||
| </div> | ||
|
|
||
| <div> | ||
| <div id="messageContainer" class="messageContainer"><span id="messageLabel" class="messageLabel"><span id="messageText" style="float:left;"></span><span id="messageButton"></span></span></div> | ||
| <div id="wizard"></div> | ||
| </div> | ||
|
|
||
| </body> | ||
| </html> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,172 @@ | ||
| /******************************************************************************* | ||
| * @license | ||
| * Copyright (c) 2014 IBM Corporation and others. | ||
| * All rights reserved. This program and the accompanying materials are made | ||
| * available under the terms of the Eclipse Public License v1.0 | ||
| * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution | ||
| * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). | ||
| * | ||
| * Contributors: IBM Corporation - initial API and implementation | ||
| ******************************************************************************/ | ||
| /*global parent window document define orion setTimeout*/ | ||
|
|
||
| define(["orion/bootstrap", "orion/xhr", 'orion/webui/littlelib', 'orion/Deferred', 'orion/cfui/cFClient', 'orion/PageUtil', 'orion/selection', | ||
| 'orion/URITemplate', 'orion/PageLinks', 'orion/preferences', 'orion/fileClient', 'cfui/cfUtil', 'cfui/plugins/wizards/common/wizardUtils', 'orion/objects', 'orion/widgets/input/ComboTextInput', | ||
| 'orion/webui/Wizard', 'cfui/plugins/wizards/common/deploymentLogic', 'cfui/plugins/wizards/common/commonPaneBuilder', 'cfui/plugins/wizards/common/corePageBuilder', | ||
| 'cfui/plugins/wizards/common/servicesPageBuilder', 'cfui/plugins/wizards/common/additionalParamPageBuilder'], | ||
| function(mBootstrap, xhr, lib, Deferred, CFClient, PageUtil, mSelection, URITemplate, PageLinks, Preferences, mFileClient, mCfUtil, mWizardUtils, objects, ComboTextInput, Wizard, | ||
| mDeploymentLogic, mCommonPaneBuilder, mCorePageBuilder, mServicesPageBuilder, mAdditionalParamPageBuilder) { | ||
|
|
||
| /* plugin-host communication */ | ||
| var postMsg = mWizardUtils.defaultPostMsg; | ||
| var defaultDecorateError = mCfUtil.defaultDecorateError; | ||
| var postError = mWizardUtils.buildDefaultPostError(defaultDecorateError); | ||
| var closeFrame = mWizardUtils.defaultCloseFrame; | ||
|
|
||
| /* default utils */ | ||
| var showMessage = mWizardUtils.defaultShowMessage; | ||
| var hideMessage = mWizardUtils.defaultHideMessage; | ||
| var showError = mWizardUtils.defaultShowError; | ||
|
|
||
| mBootstrap.startup().then(function(core) { | ||
|
|
||
| /* set up initial message */ | ||
| document.getElementById('title').appendChild(document.createTextNode("Configure Application Deployment")); //$NON-NLS-1$//$NON-NLS-0$ | ||
|
|
||
| /* allow the frame to be closed */ | ||
| document.getElementById('closeDialog').addEventListener('click', closeFrame); //$NON-NLS-1$ //$NON-NLS-0$ | ||
|
|
||
| /* allow frame to be dragged by title bar */ | ||
| mWizardUtils.makeDraggable(this); | ||
|
|
||
| var pageParams = PageUtil.matchResourceParameters(); | ||
| var resourceString = decodeURIComponent(pageParams.resource); | ||
| var resource = JSON.parse(resourceString); | ||
|
|
||
| var serviceRegistry = core.serviceRegistry; | ||
| var cfService = new CFClient.CFService(serviceRegistry); | ||
|
|
||
| /* compute relative content location */ | ||
| var relativeFilePath = new URL(resource.ContentLocation).href; | ||
| var orionHomeUrl = new URL(PageLinks.getOrionHome()); | ||
|
|
||
| if(relativeFilePath.indexOf(orionHomeUrl.origin) === 0) | ||
| relativeFilePath = relativeFilePath.substring(orionHomeUrl.origin.length); | ||
|
|
||
| if(relativeFilePath.indexOf(orionHomeUrl.pathname) === 0) | ||
| relativeFilePath = relativeFilePath.substring(orionHomeUrl.pathname.length); | ||
|
|
||
| var preferences = new Preferences.PreferencesService(serviceRegistry); | ||
| var fileClient = new mFileClient.FileClient(serviceRegistry); | ||
|
|
||
| /* built-in wizard error handler */ | ||
| var handleError = mCfUtil.buildDefaultErrorHandler({ | ||
| cFService : cfService, | ||
| showMessage : showMessage, | ||
| hideMessage : hideMessage, | ||
| showError : showError, | ||
| render : function(fields){ | ||
| document.getElementById('messageText').appendChild(fields); | ||
| } | ||
| }); | ||
|
|
||
| /* deployment plan */ | ||
| var plan = resource.Plan; | ||
| var manifestApplication = plan.Manifest.applications[0]; | ||
|
|
||
| Deferred.all([ | ||
|
|
||
| mCfUtil.getTargets(preferences), | ||
| mWizardUtils.getDefaultTarget(fileClient, resource) | ||
|
|
||
| ]).then(function(results){ | ||
|
|
||
| var clouds = results[0]; | ||
| var defaultTarget = results[1]; | ||
|
|
||
| /* init common pane builder */ | ||
| var commonPaneBuilder = new mCommonPaneBuilder.CommonPaneBuilder({ | ||
| AppPath : resource.AppPath /* relative application path */ | ||
| }); | ||
|
|
||
| /* init core page builder */ | ||
| var corePageBuilder = new mCorePageBuilder.CorePageBuilder({ | ||
| Clouds : clouds, | ||
| DefaultTarget : defaultTarget, | ||
|
|
||
| ManifestApplication : manifestApplication, | ||
| serviceRegistry : serviceRegistry, | ||
| CFService : cfService, | ||
|
|
||
| showMessage : showMessage, | ||
| hideMessage : hideMessage, | ||
| handleError : handleError, | ||
| postError : postError | ||
| }); | ||
|
|
||
| /* init services page builder */ | ||
| var servicesPageBuilder = new mServicesPageBuilder.ServicesPageBuilder({ | ||
| ManifestServices : manifestApplication.services, | ||
|
|
||
| CFService : cfService, | ||
| getTargetSelection : function(){ | ||
| return corePageBuilder.getSelection(); | ||
| }, | ||
|
|
||
| showMessage : showMessage, | ||
| hideMessage : hideMessage, | ||
| handleError : handleError, | ||
| postError : postError | ||
| }); | ||
|
|
||
| /* init additional parameters page builder */ | ||
| var additionalParamPageBuilder = new mAdditionalParamPageBuilder.AdditionalParamPageBuilder({ | ||
| ManifestApplication : manifestApplication | ||
| }); | ||
|
|
||
| /* build pages */ | ||
| var commonPane = commonPaneBuilder.build(); | ||
| var page1 = corePageBuilder.build(); | ||
| var page2 = servicesPageBuilder.build(); | ||
| var page3 = additionalParamPageBuilder.build(); | ||
|
|
||
| var wizard = new Wizard.Wizard({ | ||
| parent: "wizard", | ||
| pages: [page1, page2, page3], | ||
| commonPane: commonPane, | ||
| onCancel: closeFrame, | ||
| buttonNames: { ok: "Deploy" }, | ||
| size: { width: "420px", height: "180px" }, | ||
| onSubmit: mDeploymentLogic.buildDeploymentTrigger({ | ||
|
|
||
| showMessage : showMessage, | ||
| closeFrame : closeFrame, | ||
| disableUI : function(){ | ||
| if(corePageBuilder._orgsDropdown) | ||
| corePageBuilder._orgsDropdown.disabled = true; | ||
|
|
||
| if(corePageBuilder._spacesDropdown) | ||
| corePageBuilder._spacesDropdown.disabled = true; | ||
| }, | ||
|
|
||
| postMsg : postMsg, | ||
| postError : postError, | ||
|
|
||
| CFService : cfService, | ||
| getTargetSelection : function(){ | ||
| return corePageBuilder.getSelection(); | ||
| }, | ||
|
|
||
| saveManifest : function(){ | ||
| var checkbox = commonPaneBuilder._saveManifestCheckbox; | ||
| return checkbox ? checkbox.checked : false; | ||
| }, | ||
|
|
||
| Manifest : plan.Manifest, | ||
| ContentLocation : resource.ContentLocation, | ||
| AppPath : resource.AppPath | ||
| }) | ||
| }); | ||
| }, postError); | ||
| }); | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| <!DOCTYPE html> | ||
| <html> | ||
| <head> | ||
| <meta name="copyright" content="Copyright (c) IBM Corporation and others 2014." > | ||
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | ||
| <script src="../../../requirejs/require.js"></script> | ||
| <script type="text/javascript"> | ||
| /*eslint-env browser, amd*/ | ||
| require({ | ||
| baseUrl: '../../../', | ||
| // set the paths to our library packages | ||
| packages: [], | ||
| paths: { | ||
| text: 'requirejs/text', | ||
| i18n: 'requirejs/i18n', | ||
| domReady: 'requirejs/domReady' | ||
| } | ||
| }); | ||
|
|
||
| require(["../../../orion/plugin.js"], function(PluginProvider){ | ||
|
|
||
| var headers = { | ||
| name : "Cloud Foundry Generic Deployment Wizard", | ||
| version : "1.0", | ||
| description : "This plugin provides a generic deployment wizard integrating with Cloud Foundry." | ||
| }; | ||
|
|
||
| function GenericDeploymentWizard(){}; | ||
| GenericDeploymentWizard.prototype = { | ||
| constructor : GenericDeploymentWizard, | ||
|
|
||
| getInitializationParameters : function(){ | ||
| return { | ||
| LocationTemplate : "{+OrionHome}/cfui/plugins/wizards/generic/genericDeploymentWizard.html", | ||
| Width : "450px", | ||
| Height : "350px" | ||
| }; | ||
| } | ||
| }; | ||
|
|
||
| var genericDeploymentWizard = new GenericDeploymentWizard(); | ||
|
|
||
| var provider = new PluginProvider(headers); | ||
| provider.registerServiceProvider("orion.project.deploy.wizard", | ||
| genericDeploymentWizard, { | ||
| id : "org.eclipse.orion.client.cf.wizard.generic" | ||
| }); | ||
|
|
||
| provider.connect(); | ||
| }); | ||
| </script> | ||
| </head> | ||
| <body> | ||
| </body> | ||
| </html> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| <!DOCTYPE html> | ||
| <html> | ||
| <head> | ||
| <meta name="copyright" content="Copyright (c) IBM Corporation and others 2014." > | ||
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | ||
| <script src="../../../requirejs/require.js"></script> | ||
| <script type="text/javascript"> | ||
| /*eslint-env browser, amd*/ | ||
| require({ | ||
| baseUrl: '../../../', | ||
| // set the paths to our library packages | ||
| packages: [], | ||
| paths: { | ||
| text: 'requirejs/text', | ||
| i18n: 'requirejs/i18n', | ||
| domReady: 'requirejs/domReady' | ||
| } | ||
| }); | ||
|
|
||
| require(["../../../orion/plugin.js"], function(PluginProvider){ | ||
|
|
||
| var headers = { | ||
| name : "Cloud Foundry Node.js Deployment Wizard", | ||
| version : "1.0", | ||
| description : "This plugin provides a node.js deployment wizard integrating with Cloud Foundry." | ||
| }; | ||
|
|
||
| function NodeJSDeploymentWizard(){}; | ||
| NodeJSDeploymentWizard.prototype = { | ||
| constructor : NodeJSDeploymentWizard, | ||
|
|
||
| getInitializationParameters : function(){ | ||
| return { | ||
| LocationTemplate : "{+OrionHome}/cfui/plugins/wizards/nodejs/nodeJSDeploymentWizard.html", | ||
| Width : "450px", | ||
| Height : "350px" | ||
| }; | ||
| } | ||
| }; | ||
|
|
||
| var nodeJSDeploymentWizard = new NodeJSDeploymentWizard(); | ||
|
|
||
| var provider = new PluginProvider(headers); | ||
| provider.registerServiceProvider("orion.project.deploy.wizard", | ||
| nodeJSDeploymentWizard, { | ||
| id : "org.eclipse.orion.client.cf.wizard.nodejs" | ||
| }); | ||
|
|
||
| provider.connect(); | ||
| }); | ||
| </script> | ||
| </head> | ||
| <body> | ||
| </body> | ||
| </html> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,205 @@ | ||
| @import "../../../../css/layout.css"; | ||
| @import "../../../../css/ide.css"; | ||
| @import "../../../../css/sections.css"; | ||
| @import "../../../../css/images.css"; | ||
| @import "../../../../css/theme.css"; | ||
| @import "../../../../css/progress.css"; | ||
| @import "../../../../css/wizard.css"; | ||
|
|
||
|
|
||
| html, body { | ||
| min-width: 350px; | ||
| overflow: hidden; | ||
| } | ||
|
|
||
| .dialogFrame { | ||
| background-color: #fdfdfd; | ||
| } | ||
|
|
||
| #messageArea{ | ||
| display: table-cell; | ||
| width: calc(100% - 16px); | ||
| } | ||
|
|
||
| #messageRow{ | ||
| background: none repeat scroll 0 0 #FFFFFF; | ||
| box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.098), 0 1px 0 0 rgba(0, 0, 0, 0.098); | ||
| height: 25px; | ||
| padding: 3px 5px 2px 9px; | ||
| display: table; | ||
| width: calc(100% - 15px); | ||
| } | ||
|
|
||
| #messageButton{ | ||
| right: -7px; | ||
| margin-top: 1px; | ||
| position: absolute; | ||
| top: 0; | ||
| } | ||
|
|
||
| .Spaces{ | ||
| width: 100%; | ||
| } | ||
|
|
||
| select{ | ||
| height: 24px; | ||
| width: 290px; | ||
| border: 1px solid #bbb; | ||
| } | ||
|
|
||
| .selectCell input { | ||
| height: 24px; | ||
| width: 290px; | ||
| margin-left: 0; | ||
| border: 1px solid #bbb; | ||
| } | ||
|
|
||
| .comboTextInputWrapper{ | ||
| height: 24px; | ||
| width: 290px; | ||
| border: 1px solid #bbb; | ||
| } | ||
|
|
||
| .comboTextInputWrapper input{ | ||
| font-size: inherit; | ||
| } | ||
|
|
||
| .comboTextInputField { | ||
| width: 260px !important; | ||
| height: 24px; | ||
| text-align: left; | ||
| margin-right: 0; | ||
| border: 0px !important; | ||
| } | ||
|
|
||
| .recentEntryButton { | ||
| margin-left: 0; | ||
| height: 22px; | ||
| background: none repeat scroll 0 0 #fff; | ||
| width: 25px; | ||
| } | ||
|
|
||
| .formTable{ | ||
| font-family: Arial,sans-serif; | ||
| font-size: 14px; | ||
| width: 100%; | ||
| } | ||
|
|
||
| .selectCell { | ||
| padding-top: 4px; | ||
| text-align: left; | ||
| } | ||
|
|
||
| .listCell select { | ||
| height: inherit; | ||
| width: 190px; | ||
| } | ||
|
|
||
| #servicesAddRemoveButtonsCol{ | ||
| text-align: center; | ||
| vertical-align: middle; | ||
| } | ||
|
|
||
| .messageContainer { | ||
| display: none; | ||
| padding-top: 2px; | ||
| position: absolute; | ||
| text-align: center; | ||
| box-shadow: 0 2px 0 rgba(0, 0, 0, 0.1); | ||
| background-color: #dff0d8; | ||
| border-bottom-left-radius: 5px; | ||
| border-bottom-right-radius: 5px; | ||
| margin-left: 5%; | ||
| margin-right: auto; | ||
| width: 90%; | ||
| padding-bottom: 5px; | ||
| padding-left: 5px; | ||
| padding-top: 5px; | ||
| } | ||
|
|
||
| .messageContainer.showing { | ||
| display: block; | ||
| transition: top 0.7s ease 0s; | ||
| } | ||
|
|
||
| .retryFields{ | ||
| margin-top: 5px; | ||
| text-align: right; | ||
| } | ||
|
|
||
| .retryFields label { | ||
| margin-left: 5px; | ||
| } | ||
|
|
||
| .errorMessage input{ | ||
| border-color: #eed3d7 !important; | ||
| } | ||
|
|
||
| .errorMessage button{ | ||
| color: #b94a48 !important; | ||
| } | ||
|
|
||
| .errorMessage button:hover{ | ||
| color: #FFFFFF !important; | ||
| } | ||
|
|
||
| .messageContainer.errorMessage{ | ||
| background-color: #f2dede !important; | ||
| border: 1px solid #eed3d7 !important; | ||
| } | ||
|
|
||
| .errorMessage, .errorMessage a{ | ||
| color: #b94a48 !important; | ||
| } | ||
|
|
||
| .messageLabel a{ | ||
| color: #b94a48; | ||
| text-decoration: underline; | ||
| } | ||
|
|
||
| .messageLabel button{ | ||
| border: none; | ||
| border-radius: 5px; | ||
| background: none repeat scroll 0 0 rgba(0, 0, 0, 0); | ||
| color: #b94a48; | ||
| font-family: Arial,Helvetica,Myriad,Tahoma,clean,sans-serif,Lucida Sans Unicode,Lucida Grande,Verdana; | ||
| font-size: 9pt; | ||
| cursor: pointer; | ||
| } | ||
|
|
||
| .messageLabel button:hover{ | ||
| color: #FFFFFF; | ||
| } | ||
|
|
||
| .messageLabel { | ||
| color: #468847; | ||
| float: left; | ||
| max-height: 1000px; | ||
| overflow: hidden; | ||
| padding-left: 5px; | ||
| text-align: center; | ||
| } | ||
|
|
||
| .dialogTitle .closeDialog { | ||
| margin: 0; | ||
| cursor: pointer; | ||
| } | ||
|
|
||
| #memoryInput{ | ||
| margin-right: 5px; | ||
| width: 235px; | ||
| } | ||
|
|
||
| #memoryUnit{ | ||
| width: 50px; | ||
| } | ||
|
|
||
| input[type='number'] { | ||
| -moz-appearance:textfield; | ||
| } | ||
|
|
||
| input[type=number]::-webkit-inner-spin-button, | ||
| input[type=number]::-webkit-outer-spin-button { | ||
| -webkit-appearance: none; | ||
| margin: 0; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| <html> | ||
| <head> | ||
| <link rel="stylesheet" type="text/css" href="nodeJSDeploymentWizard.css" /> | ||
| <script src="../../../../requirejs/require.js"></script> | ||
| <script type="text/javascript"> | ||
| /*global require*/ | ||
| require({ | ||
| baseUrl: '../../../../', | ||
| packages: [], | ||
| paths: { | ||
| i18n: 'requirejs/i18n', | ||
| domReady: 'requirejs/domReady', | ||
| text: 'requirejs/text' | ||
| } | ||
| }); | ||
| require(["cfui/plugins/wizards/nodejs/nodeJSDeploymentWizard"]); | ||
| </script> | ||
| </head> | ||
| <body id="deployBody" class="dialogFrame"> | ||
|
|
||
| <div class="dialogTitle" id="titleBar"> | ||
| <span id="title" class="dialogTitleText layoutLeft"> | ||
| </span> | ||
| <button aria-label="Close" class="dismissButton layoutRight core-sprite-close imageSprite closeDialog" id="closeDialog"> | ||
| </button> | ||
| </div> | ||
|
|
||
| <div> | ||
| <div id="messageContainer" class="messageContainer"><span id="messageLabel" class="messageLabel"><span id="messageText" style="float:left;"></span><span id="messageButton"></span></span></div> | ||
| <div id="wizard"></div> | ||
| </div> | ||
|
|
||
| </body> | ||
| </html> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,224 @@ | ||
| /******************************************************************************* | ||
| * @license | ||
| * Copyright (c) 2014 IBM Corporation and others. | ||
| * All rights reserved. This program and the accompanying materials are made | ||
| * available under the terms of the Eclipse Public License v1.0 | ||
| * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution | ||
| * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). | ||
| * | ||
| * Contributors: IBM Corporation - initial API and implementation | ||
| ******************************************************************************/ | ||
| /*global parent window document define orion setTimeout*/ | ||
|
|
||
| define(["orion/bootstrap", "orion/xhr", 'orion/webui/littlelib', 'orion/Deferred', 'orion/cfui/cFClient', 'orion/PageUtil', 'orion/selection', | ||
| 'orion/URITemplate', 'orion/PageLinks', 'orion/preferences', 'orion/fileClient', 'cfui/cfUtil', 'cfui/plugins/wizards/common/wizardUtils', 'orion/objects', 'orion/widgets/input/ComboTextInput', 'orion/i18nUtil', | ||
| 'orion/webui/Wizard', 'cfui/plugins/wizards/common/deploymentLogic', 'cfui/plugins/wizards/common/commonPaneBuilder', 'cfui/plugins/wizards/common/corePageBuilder', | ||
| 'cfui/plugins/wizards/common/servicesPageBuilder', 'cfui/plugins/wizards/common/additionalParamPageBuilder'], | ||
| function(mBootstrap, xhr, lib, Deferred, CFClient, PageUtil, mSelection, URITemplate, PageLinks, Preferences, mFileClient, mCfUtil, mWizardUtils, objects, ComboTextInput, i18nUtil, Wizard, | ||
| mDeploymentLogic, mCommonPaneBuilder, mCorePageBuilder, mServicesPageBuilder, mAdditionalParamPageBuilder) { | ||
|
|
||
| /* plugin-host communication */ | ||
| var postMsg = mWizardUtils.defaultPostMsg; | ||
| var defaultDecorateError = mCfUtil.defaultDecorateError; | ||
| var postError = mWizardUtils.buildDefaultPostError(defaultDecorateError); | ||
| var closeFrame = mWizardUtils.defaultCloseFrame; | ||
|
|
||
| /* default utils */ | ||
| var showMessage = mWizardUtils.defaultShowMessage; | ||
| var hideMessage = mWizardUtils.defaultHideMessage; | ||
| var showError = mWizardUtils.defaultShowError; | ||
|
|
||
| mBootstrap.startup().then(function(core) { | ||
|
|
||
| /* set up initial message */ | ||
| document.getElementById('title').appendChild(document.createTextNode("Configure Application Deployment")); //$NON-NLS-1$//$NON-NLS-0$ | ||
|
|
||
| /* allow the frame to be closed */ | ||
| document.getElementById('closeDialog').addEventListener('click', closeFrame); //$NON-NLS-1$ //$NON-NLS-0$ | ||
|
|
||
| /* allow frame to be dragged by title bar */ | ||
| mWizardUtils.makeDraggable(this); | ||
|
|
||
| var pageParams = PageUtil.matchResourceParameters(); | ||
| var resourceString = decodeURIComponent(pageParams.resource); | ||
| var resource = JSON.parse(resourceString); | ||
|
|
||
| var serviceRegistry = core.serviceRegistry; | ||
| var cfService = new CFClient.CFService(serviceRegistry); | ||
|
|
||
| /* compute relative content location */ | ||
| var relativeFilePath = new URL(resource.ContentLocation).href; | ||
| var orionHomeUrl = new URL(PageLinks.getOrionHome()); | ||
|
|
||
| if(relativeFilePath.indexOf(orionHomeUrl.origin) === 0) | ||
| relativeFilePath = relativeFilePath.substring(orionHomeUrl.origin.length); | ||
|
|
||
| if(relativeFilePath.indexOf(orionHomeUrl.pathname) === 0) | ||
| relativeFilePath = relativeFilePath.substring(orionHomeUrl.pathname.length); | ||
|
|
||
| var preferences = new Preferences.PreferencesService(serviceRegistry); | ||
| var fileClient = new mFileClient.FileClient(serviceRegistry); | ||
|
|
||
| /* built-in wizard error handler */ | ||
| var handleError = mCfUtil.buildDefaultErrorHandler({ | ||
| cFService : cfService, | ||
| showMessage : showMessage, | ||
| hideMessage : hideMessage, | ||
| showError : showError, | ||
| render : function(fields){ | ||
| document.getElementById('messageText').appendChild(fields); | ||
| } | ||
| }); | ||
|
|
||
| /* deployment plan */ | ||
| var plan = resource.Plan; | ||
| var manifestApplication = plan.Manifest.applications[0]; | ||
|
|
||
| Deferred.all([ | ||
|
|
||
| mCfUtil.getTargets(preferences), | ||
| mWizardUtils.getDefaultTarget(fileClient, resource) | ||
|
|
||
| ]).then(function(results){ | ||
|
|
||
| var clouds = results[0]; | ||
| var defaultTarget = results[1]; | ||
|
|
||
| /* welcome page */ | ||
| var defaultSelection; | ||
| var page0 = new Wizard.WizardPage({ | ||
| template: "<div class=\"deployMessage\" id=\"planMessage\"></div>", | ||
|
|
||
| render: function(){ | ||
| this.wizard.validate(); | ||
| var target = clouds[0]; | ||
|
|
||
| showMessage("Loading deployment configuration..."); | ||
| cfService.getOrgs(target).then(function(resp){ | ||
| hideMessage(); | ||
|
|
||
| var org = resp.Orgs[0]; | ||
| var space = org.Spaces[0]; | ||
|
|
||
| target.Org = org.Name; | ||
| target.Space = space.Name; | ||
|
|
||
| defaultSelection = new mSelection.Selection(serviceRegistry, "orion.Spaces.selection"); //$NON-NLS-0$ | ||
| defaultSelection.setSelections(target); | ||
|
|
||
| var messageTemplate = "<b>${0}</b> is going to be deployed as a <b>node.js</b> application to <b>${1}</b> @ <b>${2}</b> "+ | ||
| "using target <b>${3}</b>. Click \"Deploy\" to proceed or \"Next\" to change the deployment parameters."; | ||
|
|
||
| var message = i18nUtil.formatMessage(messageTemplate, manifestApplication.name, | ||
| space.Name, org.Name, defaultTarget.Name || defaultTarget.Url || target.Name || target.Url); | ||
|
|
||
| var messageDiv = document.getElementById("planMessage"); | ||
| messageDiv.innerHTML = message; | ||
|
|
||
| }, function(error){ | ||
| handleError(error, target, function(){ return page0.render(); }); | ||
| }); | ||
| }, | ||
|
|
||
| validate: function(setValid){ | ||
| setValid(true); | ||
| return; | ||
| }, | ||
|
|
||
| getResults: function(){ | ||
| return {}; | ||
| } | ||
| }); | ||
|
|
||
| /* init common pane builder */ | ||
| var commonPaneBuilder = new mCommonPaneBuilder.CommonPaneBuilder({ | ||
| AppPath : resource.AppPath /* relative application path */ | ||
| }); | ||
|
|
||
| /* init core page builder */ | ||
| var corePageBuilder = new mCorePageBuilder.CorePageBuilder({ | ||
| Clouds : clouds, | ||
| DefaultTarget : defaultTarget, | ||
|
|
||
| ManifestApplication : manifestApplication, | ||
| serviceRegistry : serviceRegistry, | ||
| CFService : cfService, | ||
|
|
||
| showMessage : showMessage, | ||
| hideMessage : hideMessage, | ||
| handleError : handleError, | ||
| postError : postError | ||
| }); | ||
|
|
||
| /* init services page builder */ | ||
| var servicesPageBuilder = new mServicesPageBuilder.ServicesPageBuilder({ | ||
| ManifestServices : manifestApplication.services, | ||
|
|
||
| CFService : cfService, | ||
| getTargetSelection : function(){ | ||
| return corePageBuilder.getSelection(); | ||
| }, | ||
|
|
||
| showMessage : showMessage, | ||
| hideMessage : hideMessage, | ||
| handleError : handleError, | ||
| postError : postError | ||
| }); | ||
|
|
||
| /* init additional parameters page builder */ | ||
| var additionalParamPageBuilder = new mAdditionalParamPageBuilder.AdditionalParamPageBuilder({ | ||
| ManifestApplication : manifestApplication | ||
| }); | ||
|
|
||
| /* build pages */ | ||
| var commonPane = commonPaneBuilder.build(); | ||
| var page1 = corePageBuilder.build(); | ||
| var page2 = servicesPageBuilder.build(); | ||
| var page3 = additionalParamPageBuilder.build(); | ||
|
|
||
| var wizard = new Wizard.Wizard({ | ||
| parent: "wizard", | ||
| pages: [page0, page1, page2, page3], | ||
| commonPane: commonPane, | ||
| onCancel: closeFrame, | ||
| buttonNames: { ok: "Deploy" }, | ||
| size: { width: "420px", height: "180px" }, | ||
| onSubmit: mDeploymentLogic.buildDeploymentTrigger({ | ||
|
|
||
| showMessage : showMessage, | ||
| closeFrame : closeFrame, | ||
| disableUI : function(){ | ||
| if(corePageBuilder._orgsDropdown) | ||
| corePageBuilder._orgsDropdown.disabled = true; | ||
|
|
||
| if(corePageBuilder._spacesDropdown) | ||
| corePageBuilder._spacesDropdown.disabled = true; | ||
| }, | ||
|
|
||
| postMsg : postMsg, | ||
| postError : postError, | ||
|
|
||
| CFService : cfService, | ||
| getTargetSelection : function(){ | ||
|
|
||
| var selection = corePageBuilder.getSelection(); | ||
| if(typeof selection === "undefined" && defaultSelection) | ||
| return defaultSelection; | ||
|
|
||
| return selection; | ||
| }, | ||
|
|
||
| saveManifest : function(){ | ||
| var checkbox = commonPaneBuilder._saveManifestCheckbox; | ||
| return checkbox ? checkbox.checked : false; | ||
| }, | ||
|
|
||
| Manifest : plan.Manifest, | ||
| ContentLocation : resource.ContentLocation, | ||
| AppPath : resource.AppPath | ||
| }) | ||
| }); | ||
|
|
||
| }, postError); | ||
| }); | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,341 @@ | ||
| /******************************************************************************* | ||
| * @license | ||
| * Copyright (c) 2013 IBM Corporation and others. | ||
| * All rights reserved. This program and the accompanying materials are made | ||
| * available under the terms of the Eclipse Public License v1.0 | ||
| * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution | ||
| * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). | ||
| * | ||
| * Contributors: IBM Corporation - initial API and implementation | ||
| ******************************************************************************/ | ||
|
|
||
| /*eslint-env browser, amd*/ | ||
| define(['require', 'orion/xhr', 'orion/Deferred', 'orion/operation'], function(require, xhr, Deferred, operation) { | ||
|
|
||
| var eclipse = eclipse || {}; | ||
|
|
||
| eclipse.CFService = (function(){ | ||
|
|
||
| var contentType = "application/json; charset=UTF-8"; | ||
|
|
||
| /** | ||
| * Creates a new CF service. | ||
| * | ||
| * @class Provides operations for interacting with Cloud Foundry | ||
| * @name org.eclipse.orion.client.cf.CFService | ||
| */ | ||
| function CFService(serviceRegistry) { | ||
| if (serviceRegistry) { | ||
| this._serviceRegistry = serviceRegistry; | ||
| this._serviceRegistration = serviceRegistry.registerService( | ||
| "orion.cf.service", this); | ||
| } | ||
| } | ||
|
|
||
| CFService.prototype = /** @lends org.eclipse.orion.client.cf.CFService.prototype */ | ||
| { | ||
| _getServiceResponse : function(deferred, result) { | ||
| var response = result.response ? JSON.parse(result.response) : null; | ||
|
|
||
| if (result.xhr && result.xhr.status === 202) { | ||
| var def = operation.handle(response.Location); | ||
| def.then(function(data) { | ||
| try { | ||
| deferred.resolve(JSON.parse(data)); | ||
| } catch (e) { | ||
| deferred.resolve(data); | ||
| } | ||
| }, function(data) { | ||
| data.failedOperation = response.Location; | ||
| deferred.reject(data); | ||
| }, deferred.progress); | ||
| deferred.then(null, function(error) { | ||
| def.reject(error); | ||
| }); | ||
| return; | ||
| } | ||
| deferred.resolve(response); | ||
| return; | ||
| }, | ||
|
|
||
| _handleServiceResponseError: function(deferred, error){ | ||
| deferred.reject(this._translateResponseToStatus(error)); | ||
| }, | ||
|
|
||
| _translateResponseToStatus: function(response) { | ||
| var json; | ||
| try { | ||
| json = JSON.parse(response.responseText); | ||
| } catch (e) { | ||
| json = { | ||
| Message : "Problem while performing the action" | ||
| }; | ||
| } | ||
| json.HttpCode = response.status; | ||
| return json; | ||
| }, | ||
|
|
||
| _xhrV1 : function(method, url, data) { | ||
| var self = this; | ||
| var clientDeferred = new Deferred(); | ||
|
|
||
| xhr(method, url, { headers : { "CF-Version" : "1", | ||
| "Content-Type" : contentType | ||
| }, | ||
| timeout : 15000, | ||
| handleAs : "json", | ||
| data : JSON.stringify(data) | ||
| }).then(function(result) { | ||
| self._getServiceResponse(clientDeferred, result); | ||
| }, function(error) { | ||
| self._handleServiceResponseError(clientDeferred, error); | ||
| }); | ||
|
|
||
| return clientDeferred; | ||
| }, | ||
|
|
||
| // Target CF v2 operations | ||
|
|
||
| setTarget: function(url, org, space) { | ||
| var targetObject = { | ||
| 'Url': url | ||
| }; | ||
| if (org) targetObject.Org = org; | ||
| if (space) targetObject.Space = space; | ||
|
|
||
| return this._xhrV1("POST", require.toUrl("cfapi/target"), targetObject); | ||
| }, | ||
|
|
||
| login: function(url, username, password, org, space) { | ||
| var loginData = {}; | ||
|
|
||
| if (url) loginData.Url = url; | ||
| if (username) { | ||
| loginData.Username = username; | ||
| loginData.Password = password; | ||
| } | ||
|
|
||
| return this._xhrV1("POST", require.toUrl("cfapi/target"), loginData); | ||
| }, | ||
|
|
||
| logout: function() { | ||
| return this._xhrV1("DELETE", require.toUrl("cfapi/target")); | ||
| }, | ||
|
|
||
| getLogs: function(target, applicationName, logFileName, instance){ | ||
| if(!applicationName){ | ||
| var deferred = new Deferred(); | ||
| deferred.reject("Application name not set"); | ||
| } | ||
| var location = require.toUrl("cfapi/logs/" + applicationName); | ||
| if(logFileName){ | ||
| location+=("/" + logFileName); | ||
| } | ||
| if(instance){ | ||
| location+=("/" + instance); | ||
| } | ||
| if(target){ | ||
| location += ("?Target=" + JSON.stringify(target)); | ||
| } | ||
| return this._xhrV1("GET", location); | ||
| }, | ||
|
|
||
| getTarget: function() { | ||
| return this._xhrV1("GET", require.toUrl("cfapi/target")); | ||
| }, | ||
|
|
||
| getInfo: function() { | ||
| return this._xhrV1("GET", require.toUrl("cfapi/info")); | ||
| }, | ||
|
|
||
| // Apps CF v2 operations | ||
|
|
||
| pushApp: function(target, name, contentLocation, manifest, saveManifest) { | ||
| var pushReq = {}; | ||
|
|
||
| if (name) | ||
| pushReq.Name = name; | ||
|
|
||
| if (contentLocation) | ||
| pushReq.ContentLocation = contentLocation; | ||
|
|
||
| if (target) | ||
| pushReq.Target = target; | ||
|
|
||
| if(manifest) | ||
| pushReq.Manifest = manifest; | ||
|
|
||
| if(saveManifest) | ||
| pushReq.Persist = saveManifest; | ||
|
|
||
| return this._xhrV1("PUT", require.toUrl("cfapi/apps"), pushReq); | ||
| }, | ||
|
|
||
| getApp: function(target, name, contentLocation) { | ||
| var url = require.toUrl("cfapi/apps"); | ||
|
|
||
| if (name) { | ||
| url += "?Name=" + name; | ||
| } else if (contentLocation) { | ||
| url += "?ContentLocation=" + contentLocation; | ||
| } | ||
|
|
||
| if (target) | ||
| url += "&Target=" + JSON.stringify(target); | ||
|
|
||
| return this._xhrV1("GET", url); | ||
| }, | ||
|
|
||
| getApps: function(target) { | ||
| var url = require.toUrl("cfapi/apps"); | ||
|
|
||
| if (target) | ||
| url += "?Target=" + JSON.stringify(target); | ||
|
|
||
| return this._xhrV1("GET", url); | ||
| }, | ||
|
|
||
| startApp: function(target, name, contentLocation, timeout) { | ||
| var startReq = { | ||
| Name: name, | ||
| ContentLocation: contentLocation, | ||
| Timeout: timeout, | ||
| State: "Started" | ||
| }; | ||
|
|
||
| if (target) | ||
| startReq.Target = target; | ||
|
|
||
| return this._xhrV1("PUT", require.toUrl("cfapi/apps"), startReq); | ||
| }, | ||
|
|
||
| stopApp: function(target, name, contentLocation) { | ||
| var stopReq = { | ||
| Name: name, | ||
| ContentLocation: contentLocation, | ||
| State: "Stopped" | ||
| }; | ||
|
|
||
| if (target) | ||
| stopReq.Target = target; | ||
|
|
||
| return this._xhrV1("PUT", require.toUrl("cfapi/apps"), stopReq); | ||
| }, | ||
|
|
||
| getOrgs: function(target) { | ||
| var url = require.toUrl("cfapi/orgs"); | ||
|
|
||
| if (target) | ||
| url += "?Target=" + JSON.stringify(target); | ||
|
|
||
| return this._xhrV1("GET", url); | ||
| }, | ||
|
|
||
| getRoutes: function(target) { | ||
| var url = require.toUrl("cfapi/routes"); | ||
|
|
||
| if (target) | ||
| url += "?Target=" + JSON.stringify(target); | ||
|
|
||
| return this._xhrV1("GET", url); | ||
| }, | ||
|
|
||
| getServices: function(target) { | ||
| var url = require.toUrl("cfapi/services"); | ||
|
|
||
| if (target) | ||
| url += "?Target=" + JSON.stringify(target); | ||
|
|
||
| return this._xhrV1("GET", url); | ||
| }, | ||
|
|
||
| createRoute: function(target, domainName, hostName) { | ||
| var routeObj = { | ||
| DomainName: domainName, | ||
| Host: hostName | ||
| }; | ||
|
|
||
| if (target) | ||
| routeObj.Target = target; | ||
|
|
||
| return this._xhrV1("PUT", require.toUrl("cfapi/routes"), routeObj); | ||
| }, | ||
|
|
||
| deleteRoute: function(target, domainName, hostName) { | ||
| var routeObj = { | ||
| DomainName: domainName, | ||
| Host: hostName | ||
| }; | ||
|
|
||
| var url = require.toUrl("cfapi/routes"); | ||
| url += "?Route=" + encodeURIComponent(JSON.stringify(routeObj)); | ||
|
|
||
| if (target) | ||
| url += "&Target=" + JSON.stringify(target); | ||
|
|
||
| return this._xhrV1("DELETE", url); | ||
| }, | ||
|
|
||
| deleteRouteById: function(target, routeId) { | ||
| var url = require.toUrl("cfapi/routes/" + routeId); | ||
|
|
||
| if (target) | ||
| url += "?Target=" + JSON.stringify(target); | ||
|
|
||
| return this._xhrV1("DELETE", url); | ||
| }, | ||
|
|
||
| deleteOrphanedRoutes: function (target) { | ||
| var url = require.toUrl("cfapi/routes"); | ||
| url += "?Orphaned=true"; | ||
|
|
||
| if (target) | ||
| url += "&Target=" + JSON.stringify(target); | ||
|
|
||
| return this._xhrV1("DELETE", url); | ||
| }, | ||
|
|
||
| mapRoute: function(target, appId, routeId) { | ||
| var url = require.toUrl("cfapi/apps/" + appId + "/routes/" + routeId); | ||
| if (target) | ||
| url += "?Target=" + JSON.stringify(target); | ||
|
|
||
| return this._xhrV1("PUT", url); | ||
| }, | ||
|
|
||
| unmapRoute: function(target, appId, routeId) { | ||
| var url = require.toUrl("cfapi/apps/" + appId + "/routes/" + routeId); | ||
| if (target) | ||
| url += "?Target=" + JSON.stringify(target); | ||
|
|
||
| return this._xhrV1("DELETE", url); | ||
| }, | ||
|
|
||
| getManifestInfo: function(relFilePath){ | ||
| var url = require.toUrl("cfapi/manifests" + relFilePath); | ||
| return this._xhrV1("GET", url); | ||
| }, | ||
|
|
||
| getDeploymentPlans: function(relFilePath){ | ||
| var url = require.toUrl("cfapi/plans" + relFilePath); | ||
| return this._xhrV1("GET", url); | ||
| }, | ||
|
|
||
| getLogz: function(target, appName){ | ||
| if(!appName){ | ||
| var deferred = new Deferred(); | ||
| deferred.reject("App name is missing"); | ||
| } | ||
| var url = require.toUrl("cfapi/logz/" + appName); | ||
| if(target){ | ||
| url += ("?Target=" + JSON.stringify(target)); | ||
| } | ||
| return this._xhrV1("GET", url); | ||
| }, | ||
| }; | ||
|
|
||
| return CFService; | ||
| }()); | ||
|
|
||
| return eclipse; | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,214 @@ | ||
| /******************************************************************************* | ||
| * Copyright (c) 2013 IBM Corporation and others. | ||
| * All rights reserved. This program and the accompanying materials are made | ||
| * available under the terms of the Eclipse Public License v1.0 | ||
| * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution | ||
| * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). | ||
| * | ||
| * Contributors: IBM Corporation - initial API and implementation | ||
| ******************************************************************************/ | ||
|
|
||
| /*eslint-env browser, amd*/ | ||
| define([ | ||
| 'orion/editor/textModel', | ||
| 'orion/editorView', | ||
| 'orion/inputManager', | ||
| 'orion/objects', | ||
| 'orion/Deferred', | ||
| 'orion/globalCommands', | ||
| 'orion/URL-shim' | ||
| ], function(mTextModel, mEditorView, mInputManager, objects, Deferred, mGlobalCommands) { | ||
|
|
||
| function handleError(statusService, error) { | ||
| if (!statusService) { | ||
| window.console.log(error); | ||
| return; | ||
| } | ||
| if (error.status === 0) { | ||
| error = { | ||
| Severity: "Error", //$NON-NLS-0$ | ||
| Message: "No response" | ||
| }; | ||
| } else { | ||
| var responseText = error.responseText; | ||
| if (responseText) { | ||
| try { | ||
| error = JSON.parse(responseText); | ||
| } catch(e) { | ||
| error = { | ||
| //HTML: true, | ||
| Severity: "Error", //$NON-NLS-0$ | ||
| Message: responseText | ||
| }; | ||
| } | ||
| } | ||
| } | ||
| statusService.setProgressResult(error); | ||
| } | ||
|
|
||
| function LogInputManager(options){ | ||
| mInputManager.InputManager.apply(this, [options]); | ||
| this.cFClient = options.cFClient; | ||
| this.commandRegistry = options.commandRegistry; | ||
| } | ||
|
|
||
| LogInputManager.prototype = new mInputManager.InputManager({}); | ||
|
|
||
| objects.mixin(LogInputManager.prototype, { | ||
| _read: function(location, readOptions){ | ||
| var deferred = new Deferred(); | ||
| var currentInstance = this.applicationInfo.instance || Object.keys(this.applicationInfo.logs)[0]; | ||
| this.cFClient.getLogs(this.applicationInfo.Target, this.applicationInfo.Application, location, this.applicationInfo.instance).then(function(logInfo){ | ||
| var log = logInfo[currentInstance]; | ||
| log.Instance = currentInstance; | ||
| deferred.resolve(log); | ||
|
|
||
| mGlobalCommands.setPageTarget({ | ||
| task: "Cloud Foundry Logs", | ||
| target: log, | ||
| breadcrumbTarget: log, | ||
| serviceRegistry: this.serviceRegistry, | ||
| commandService: this.commandRegistry}); | ||
| }.bind(this)); | ||
| return deferred; | ||
| }, | ||
| setApplicationInfo: function(appInfo){ | ||
| this.applicationInfo = appInfo; | ||
| }, | ||
| getApplicationInfo: function(){ | ||
| return this.applicationInfo; | ||
| }, | ||
| load: function(){ | ||
| var logName = this.getInput(); | ||
| if(!logName){ | ||
| this.lastLogLoaded = null; | ||
| this.lastLogInstance = null; | ||
| return; | ||
| } | ||
|
|
||
| var progressTimeout = null; | ||
|
|
||
| var clearTimeout = function() { | ||
| this.reportStatus(""); | ||
| if (progressTimeout) { | ||
| window.clearTimeout(progressTimeout); | ||
| } | ||
| }.bind(this); | ||
|
|
||
| var errorHandler = function(error) { | ||
| clearTimeout(); | ||
| var statusService = this.serviceRegistry.getService("orion.page.message"); //$NON-NLS-0$ | ||
| handleError(statusService, error); | ||
| this._setNoInput(); | ||
| }.bind(this); | ||
|
|
||
| this._acceptPatch = null; | ||
|
|
||
| if((!this.lastLogLoaded || this.lastLogLoaded!==logName) || (this.applicationInfo.instance !== null && this.lastLogInstance !== this.applicationInfo.instance)){ | ||
| // Read the log | ||
| this.progressService.showWhile(this._read(logName, true), "Loading " + logName).then(function(metadata) { | ||
| this.lastLogLoaded = logName; | ||
| this.lastLogInstance = metadata.Instance; | ||
| this._setInputContents(this._parsedLocation, logName, metadata.Contents, metadata); | ||
| }.bind(this), errorHandler); | ||
| } else { | ||
| progressTimeout = window.setTimeout(function() { | ||
| progressTimeout = null; | ||
| this.reportStatus("Fetching " + logName); | ||
| }.bind(this), 800); | ||
|
|
||
| var found = false; | ||
| var currentInstance = this.applicationInfo.instance || Object.keys(this.applicationInfo.logs)[0]; | ||
| this.cFClient.getLogs(this.applicationInfo.Target, this.applicationInfo.Application).then(function(logs){ | ||
| this.applicationInfo.logs[currentInstance].forEach(function(log){ | ||
| if(log.Name === logName){ | ||
| logs[currentInstance].forEach(function(log2){ | ||
| if(log2.Name === logName){ | ||
| if(log.Size!==log2.Size){ | ||
| found = true; | ||
| this._read(logName, true).then(function(metadata) { | ||
| this._setInputContents(this._parsedLocation, logName, metadata.Contents, metadata); | ||
| this.lastLogLoaded = logName; | ||
| }.bind(this), errorHandler); | ||
| } | ||
| clearTimeout(); | ||
| } | ||
| }.bind(this)); | ||
| } | ||
| }.bind(this)); | ||
|
|
||
| if(!found){ | ||
| clearTimeout(); | ||
| } | ||
| this.applicationInfo.logs = logs; | ||
|
|
||
| }.bind(this), errorHandler); | ||
| } | ||
| }, | ||
| constructor: LogInputManager | ||
| }); | ||
|
|
||
| function LogEditorView(options) { | ||
| this.options = options; | ||
| this._parent = options.parent; | ||
| this.serviceRegistry = options.serviceRegistry; | ||
| this.contentTypeRegistry = options.contentTypeRegistry; | ||
| this.commandRegistry = options.commandRegistry; | ||
| this.progress = options.progressService; | ||
| this.undoStack = options.undoStack; | ||
| this._createInputManager(); | ||
| } | ||
| LogEditorView.prototype = { | ||
| _createInputManager: function(){ | ||
| this.inputManager = new LogInputManager(this.options); | ||
| var defaultOptions = { | ||
| parent: this._parent, | ||
| model: new mTextModel.TextModel(), | ||
| undoStack: this.options.undoStack, | ||
| serviceRegistry: this.options.serviceRegistry, | ||
| pluginRegistry: this.options.pluginRegistry, | ||
| commandRegistry: this.options.commandRegistry, | ||
| contentTypeRegistry: this.options.contentTypeRegistry, | ||
| inputManager: this.inputManager, | ||
| readonly: true, | ||
| preferences: this.options.preferences, | ||
| searcher: this.options.searcher, | ||
| selection: this.options.selection, | ||
| fileService: this.options.fileClient, | ||
| fileClient:this.options.fileClient, | ||
| statusReporter: this.options.statusReporter, | ||
| statusService: this.options.statusService, | ||
| progressService: this.options.progressService | ||
| }; | ||
| this.editorView = new mEditorView.EditorView(defaultOptions); | ||
| }, | ||
| create: function() { | ||
| if(!this.editorCreated){ | ||
| this.editorView.create(); | ||
| this.editorCreated = true; | ||
|
|
||
| this.inputListener = function(evt) { | ||
| evt.editor = this.editorView.editor; | ||
| }.bind(this); | ||
|
|
||
| this.inputManager.addEventListener("InputChanged", this.inputListener); | ||
| this.inputManager.lastLogLoaded = null; | ||
| this.inputManager.lastLogInstance = null; | ||
| } | ||
|
|
||
| }, | ||
| destroy: function() { | ||
| if (this.editorCreated) { | ||
| this.editorView.destroy(); | ||
| if(this.inputListener){ | ||
| this.inputManager.removeEventListener("InputChanged", this.inputListener); | ||
| } | ||
| } | ||
| this.editorCreated = false; | ||
| } | ||
| }; | ||
|
|
||
| return { | ||
| LogEditorView: LogEditorView | ||
| }; | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,169 @@ | ||
| /******************************************************************************* | ||
| * @license | ||
| * Copyright (c) 2014 IBM Corporation and others. | ||
| * All rights reserved. This program and the accompanying materials are made | ||
| * available under the terms of the Eclipse Public License v1.0 | ||
| * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution | ||
| * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). | ||
| * | ||
| * Contributors: IBM Corporation - initial API and implementation | ||
| ******************************************************************************/ | ||
|
|
||
| /*eslint-env browser, amd*/ | ||
| define([ | ||
| 'orion/webui/littlelib', | ||
| 'orion/explorers/explorer', | ||
| 'orion/objects', | ||
| 'orion/URITemplate' | ||
| ], | ||
| function(lib, mExplorer, objects,URITemplate){ | ||
|
|
||
|
|
||
| function LogsModel(application, prefix){ | ||
| this.root = application; | ||
| this.numberOfInstances = Object.keys(this.root.logs).length; | ||
| this.prefix = prefix; | ||
| } | ||
|
|
||
| LogsModel.prototype = new mExplorer.ExplorerModel(); | ||
|
|
||
| objects.mixin(LogsModel.prototype, { | ||
| getRoot: function(onItem){ | ||
| onItem(this.root); | ||
| }, | ||
| getChildren: function(parentItem, onComplete){ | ||
| if(parentItem === this.root){ | ||
|
|
||
| if(this.numberOfInstances===1){ | ||
| var instance = Object.keys(this.root.logs)[0]; | ||
| this.root.children = this.root.logs[instance]; | ||
| this.root.children.forEach(function(child){ | ||
| child.parent = this.root; | ||
| child.Target = this.root.Target; | ||
| child.Instance = instance; | ||
| }.bind(this)); | ||
| onComplete(this.root.children); | ||
| } else { | ||
| var children = []; | ||
| for(var instanceVal in this.root.logs){ | ||
| children.push({Instance: instanceVal, Children: this.root.logs[instanceVal], Type: "Instance", parent: parentItem}); | ||
| } | ||
| this.root.children = children; | ||
| onComplete(children); | ||
| } | ||
|
|
||
| } else if(parentItem.Instance){ | ||
| var children = parentItem.Children; | ||
| children.forEach(function(child){ | ||
| child.parent = parentItem; | ||
| child.Instance = parentItem.Instance; | ||
| child.Target = this.root.Target; | ||
| }.bind(this)); | ||
| parentItem.children = children; | ||
| onComplete(children); | ||
| }else{ | ||
| onComplete([]); | ||
| } | ||
| }, | ||
| getId: function(item){ | ||
| if(item === this.root) return this.prefix + this.root.Application; | ||
| if(item.Instance && item.Children) return this.prefix + this.root.Application + "_" + item.Instance; | ||
| if(item.Instance && item.Name) return this.prefix + this.root.Application + "_" + item.Instance + "_" + item.Name; | ||
| return this.prefix + this.root.Application + "_" + item.Name; | ||
| }, | ||
| constructor: LogsModel | ||
| }); | ||
|
|
||
| function LogsRenderer(options, explorer){ | ||
| this._init(options); | ||
| this.explorer = explorer; | ||
| this.commandService = options.commandRegistry; | ||
| this.actionScopeId = options.actionScopeId; | ||
| this.colorLightDarkRows = options.isMiniNav; | ||
| } | ||
|
|
||
| LogsRenderer.prototype = new mExplorer.SelectionRenderer(); | ||
| LogsRenderer.prototype.constructor = LogsRenderer; | ||
|
|
||
| objects.mixin(LogsRenderer.prototype, { | ||
| getCellElement: function(col_no, item, tableRow){ | ||
| if(col_no!==0){ | ||
| return null; | ||
| } | ||
| var col = document.createElement('td'); //$NON-NLS-0$ | ||
| var span = document.createElement("span"); //$NON-NLS-0$ | ||
| span.id = tableRow.id+"MainCol"; //$NON-NLS-0$ | ||
| span.setAttribute("role", "presentation"); //$NON-NLS-1$ //$NON-NLS-0$ | ||
| col.appendChild(span); | ||
| col.setAttribute("role", "presentation"); //$NON-NLS-1$ //$NON-NLS-0$ | ||
| span.className = "mainNavColumn"; //$NON-NLS-0$ | ||
|
|
||
| if(item.Type === "Log"){ | ||
| var image = document.createElement("span"); | ||
| image.className = "coreImageSprite core-sprite-file"; | ||
| image.style.paddingLeft = "16px"; | ||
| span.appendChild(image); | ||
| var a = document.createElement("a"); | ||
| a.appendChild(document.createTextNode(item.Name)); | ||
| var params = item.Target ? objects.clone(item.Target) : {}; | ||
| objects.mixin(params, {instance: item.Instance, log: item.Name}); | ||
| a.href = new URITemplate("#{,resource,params*}").expand({resource: item.Application, params: params}); | ||
| span.appendChild(a); | ||
| } else if(item.Type === "Instance"){ | ||
| this.getExpandImage(tableRow, span); | ||
| span.appendChild(document.createTextNode("Instance: " + item.Instance)); | ||
| } | ||
| col.appendChild(span); | ||
| return col; | ||
| }, | ||
| rowsChanged: function() { | ||
| mExplorer.SelectionRenderer.prototype.rowsChanged.apply(this, arguments); | ||
| if(this.colorLightDarkRows){ | ||
| lib.$$array(".darkSectionTreeTableRow", this.tableNode).forEach(function(node, i) { | ||
| node.classList.remove("darkSectionTreeTableRow"); | ||
| }); | ||
| lib.$$array(".lightSectionTreeTableRow", this.tableNode).forEach(function(node, i) { | ||
| node.classList.remove("lightSectionTreeTableRow"); | ||
| }); | ||
| } | ||
| }, | ||
| prototype: LogsRenderer | ||
| }); | ||
|
|
||
|
|
||
| function LogsExplorer(serviceRegistry, selection, commandRegistry, parent, titleNode, isMiniNav) { | ||
| this.parent = parent; | ||
| this.titleNode = titleNode; | ||
| mExplorer.Explorer.apply(this, [serviceRegistry, selection, new LogsRenderer({ | ||
| singleSelection: true, | ||
| checkbox: false, | ||
| commandRegistry: commandRegistry, | ||
| isMiniNav: isMiniNav | ||
| }, this), commandRegistry]); | ||
| } | ||
|
|
||
| LogsExplorer.prototype = Object.create(mExplorer.Explorer.prototype); | ||
|
|
||
| objects.mixin(LogsExplorer.prototype, { | ||
| load: function(logs){ | ||
| this.logs = logs; | ||
| if(logs.Application && this.titleNode){ | ||
| lib.empty(this.titleNode); | ||
| var span = document.createElement("span"); | ||
| span.id = "LogsNavigationTitle"; | ||
| span.className = "filesystemName layoutLeft"; | ||
| span.appendChild(document.createTextNode(logs.Application)); | ||
| this.titleNode.appendChild(span); | ||
| } | ||
| var model = new LogsModel(logs, this.parent.id); | ||
| this.createTree(this.parent, model, {indent: '8px'}); | ||
| this.initNavHandler(); | ||
| }, | ||
| constructor: LogsExplorer | ||
| }); | ||
|
|
||
| //return module exports | ||
| return { | ||
| LogsExplorer: LogsExplorer | ||
| }; | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| /******************************************************************************* | ||
| * @license | ||
| * Licensed Materials - Property of IBM | ||
| * (c) Copyright IBM Corporation 2011. All Rights Reserved. | ||
| * | ||
| * Note to U.S. Government Users Restricted Rights: Use, | ||
| * duplication or disclosure restricted by GSA ADP Schedule | ||
| * Contract with IBM Corp. | ||
| *******************************************************************************/ | ||
| /*eslint-env browser, amd*/ | ||
| define(['orion/webui/dialog'], function(dialog) { | ||
|
|
||
| /** | ||
| * @param options {{ | ||
| * title: string, //title of window ("Jazz Login" used if not provided) | ||
| * func: function, //callback function | ||
| * }} | ||
| */ | ||
| function CfLoginDialog(options){ | ||
| this._init(options); | ||
| } | ||
|
|
||
| CfLoginDialog.prototype = new dialog.Dialog(); | ||
|
|
||
| CfLoginDialog.prototype.TEMPLATE = | ||
| '<div style="padding: 5px;" id="userIdRow">'+ | ||
| '<div style="float: left; width: 150px;"><label id="userIdLabel" for="userId"></label></div>'+ | ||
| '<input id="userId" style="width: 200px;" value="">'+ | ||
| '</div>'+ | ||
| '<div style="padding: 5px;" id="passwordRow">'+ | ||
| '<div style="float: left; width: 150px;"><label id="passwordLabel" for="password"></label></div>'+ | ||
| '<input type="password" id="password" style="width: 200px;" value="">'+ | ||
| '</div>'; | ||
|
|
||
| CfLoginDialog.prototype._init = function(options) { | ||
| this.options = options || {}; | ||
| this.title = this.options.title || "Cloud Foundry Login"; | ||
| this.modal = true; | ||
| this.buttons = [{text: 'OK', isDefault: true, callback: this.done.bind(this)}]; | ||
| this._func = options.func; | ||
| this._initialize(); | ||
| }; | ||
| CfLoginDialog.prototype._bindToDom = function() { | ||
| this.$userIdLabel.appendChild(document.createTextNode("User Id:")); | ||
| this.$passwordLabel.appendChild(document.createTextNode("Password:")); | ||
| }; | ||
|
|
||
| CfLoginDialog.prototype.done = function() { | ||
| this.options.func(this.$userId.value, this.$password.value); | ||
| this.hide(); | ||
| }; | ||
|
|
||
| CfLoginDialog.prototype.constructor = CfLoginDialog; | ||
|
|
||
| return CfLoginDialog; | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,159 @@ | ||
| /******************************************************************************* | ||
| * @license | ||
| * Licensed Materials - Property of IBM | ||
| * (c) Copyright IBM Corporation 2011, 2014. All Rights Reserved. | ||
| * | ||
| * Note to U.S. Government Users Restricted Rights: Use, | ||
| * duplication or disclosure restricted by GSA ADP Schedule | ||
| * Contract with IBM Corp. | ||
| *******************************************************************************/ | ||
| /*global dojo dijit eclipse widgets define */ | ||
| /*eslint-env browser*/ | ||
|
|
||
| define(['orion/uiUtils', 'orion/explorers/explorer', 'orion/webui/dialog', 'orion/selection', 'orion/commands', 'orion/commandRegistry'], | ||
| function(mUtil, mExplorer, dialog, mSelection, mCommands, mCommandRegistry) { | ||
|
|
||
| function SelectAppDialogRenderer (options, explorer) { | ||
| this.explorer = explorer; | ||
| this._init(options); | ||
| } | ||
| SelectAppDialogRenderer.prototype = new mExplorer.SelectionRenderer(); | ||
| SelectAppDialogRenderer.prototype.constructor = SelectAppDialogRenderer; | ||
| SelectAppDialogRenderer.prototype.getLabelColumnIndex = function() { | ||
| return 0; | ||
| }; | ||
| SelectAppDialogRenderer.prototype.getCellElement = function(col_no, item, tableRow){ | ||
| var col = document.createElement("td"); //$NON-NLS-0$ | ||
| tableRow.appendChild(col); | ||
| var span = document.createElement("span"); //$NON-NLS-0$ | ||
| span.id = tableRow.id+"navSpan"; //$NON-NLS-0$ | ||
| col.appendChild(span); | ||
| span.className = "mainNavColumn singleNavColumn"; //$NON-NLS-0$ | ||
| if (item instanceof Array){ | ||
| this.getExpandImage(tableRow, span); | ||
| span.appendChild(document.createTextNode("Root")); | ||
| } else { | ||
| span.appendChild(document.createTextNode(item.Name)); | ||
| } | ||
| }; | ||
|
|
||
|
|
||
| /** | ||
| * @param options {{ | ||
| func : function(item) Function to be called with the selected item | ||
| title : String (Optional) Dialog title | ||
| apps: Applications | ||
| serviceRegistry: Service Registry | ||
| }} | ||
| */ | ||
|
|
||
| function SelectAppDialog(options) { | ||
| this._init(options); | ||
| } | ||
|
|
||
| SelectAppDialog.prototype = new dialog.Dialog(); | ||
|
|
||
| SelectAppDialog.prototype.TEMPLATE = | ||
| '<div id="message" style="width: 25em; padding-bottom: 5px;"></div>' + //$NON-NLS-0$ | ||
| '<div id="createArea" style="width: 25em; padding-bottom: 5px;"></div>' + //$NON-NLS-0$ | ||
| '<div id="appsTree" class="explorerTreeClass" style="width:30em; min-height: 25em; max-height:30em; height: auto; overflow-y: auto;"></div>'; //$NON-NLS-0$ | ||
|
|
||
| SelectAppDialog.prototype._init = function(options) { | ||
| this.title = options.title || "Select Project to Add"; | ||
| this._serviceRegistry = options.serviceRegistry; | ||
| this.cfClient = options.cfClient; | ||
| this.commandService = options.commandRegistry; | ||
| this.modal = true; | ||
| this.buttons = [{id: "okbutton", text: 'OK', callback: this.done.bind(this)}]; | ||
| this._func = options.func; | ||
| this.apps = options.apps; | ||
| this._initialize(); | ||
| }; | ||
|
|
||
| SelectAppDialog.prototype._bindToDom = function(parent) { | ||
| this.loadApps(this.apps); // workspace root | ||
| if (this._message) { | ||
| this.$message.appendChild(document.createTextNode(this._message)); | ||
| } else { | ||
| this.$message.style.display = "none"; //$NON-NLS-0$ | ||
| } | ||
| this.$appsTree.focus(); | ||
| }; | ||
|
|
||
|
|
||
| SelectAppDialog.prototype.loadApps = function(item) { | ||
| var progressService = this._serviceRegistry.getService("orion.page.progress"); | ||
| var myTreeModel = new mExplorer.ExplorerModel(); | ||
|
|
||
| myTreeModel.cfClient = this.cfClient; | ||
| myTreeModel.root = item; | ||
|
|
||
| myTreeModel.getRoot = function(onItem){ | ||
| onItem(this.root); | ||
| }; | ||
|
|
||
| myTreeModel.getId = function(/* item */ item){ | ||
| if (item.Guid) { | ||
| var result = item.Guid; | ||
| // remove all non valid chars to make a dom id. | ||
| return result.replace(/[^\.\:\-\_0-9A-Za-z]/g, ""); | ||
| } | ||
|
|
||
| return "root"; | ||
| }; | ||
|
|
||
| myTreeModel.mayHaveChildren = function(/* dojo.data.Item */ parentItem){ | ||
| return false; | ||
| }; | ||
|
|
||
| myTreeModel.getChildren = function(/* dojo.data.Item */ parentItem, /* function(items) */ onComplete){ | ||
| if (parentItem instanceof Array) { | ||
| onComplete(parentItem); | ||
| } else { | ||
| onComplete([]); | ||
| } | ||
| }; | ||
|
|
||
| this.createExplorer(myTreeModel); | ||
| }; | ||
|
|
||
| SelectAppDialog.prototype.createExplorer = function(myTreeModel){ | ||
| var self = this; | ||
| if(this.canCreate){ | ||
| this.commandService.renderCommands(this.$createArea.id, this.$createArea, {}, this, "tool"); | ||
| } | ||
|
|
||
| this.selection = new mSelection.Selection(this._serviceRegistry, "orion.cf.SelectApp.selection"); //$NON-NLS-0$ | ||
|
|
||
| this.selection.addEventListener("selectionChanged", self.validate.bind(self)); | ||
|
|
||
| this.explorer = new mExplorer.Explorer(this._serviceRegistry, this.selection); //$NON-NLS-0$ | ||
| this.explorer.renderer = new SelectAppDialogRenderer({checkbox: false, singleSelection: true, treeTableClass: "directoryPrompter" }, this.explorer); | ||
|
|
||
| this.explorer.createTree(this.$appsTree.id, myTreeModel, {setFocus: true, selectionPolicy: this.explorer.renderer.selectionPolicy, onCollapse: function(model){if(self.getNavHandler()){self.getNavHandler().onCollapse(model);}}}); | ||
| }; | ||
|
|
||
| SelectAppDialog.prototype.validate = function(){ | ||
| var self = this; | ||
| this.selection.getSelection(function(selection) { | ||
| if(selection===null){ | ||
| self.$okbutton.classList.add(this.DISABLED); | ||
| return; | ||
| } | ||
| self.$okbutton.classList.remove(this.DISABLED); | ||
| }); | ||
| }; | ||
|
|
||
| SelectAppDialog.prototype.done = function() { | ||
| this.selection.getSelection(function(selection) { | ||
| this.hide(); | ||
| this._func(selection); | ||
| }.bind(this)); | ||
| }; | ||
|
|
||
| SelectAppDialog.prototype.constructor = SelectAppDialog; | ||
|
|
||
| //return the module exports | ||
| return {SelectAppDialog: SelectAppDialog}; | ||
|
|
||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <classpath> | ||
| <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary/StandardBrowser/html5"/> | ||
| <classpathentry excluding="orion/Deferred.js|requirejs/**" kind="src" path="web"/> | ||
| <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/> | ||
| <classpathentry kind="output" path=""/> | ||
| </classpath> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| eclipse.preferences.version=1 | ||
| encoding/<project>=UTF-8 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| eclipse.preferences.version=1 | ||
| line.separator=\n |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| eclipse.preferences.version=1 | ||
| org.eclipse.wst.jsdt.core.compiler.problem.deprecation=warning | ||
| org.eclipse.wst.jsdt.core.compiler.problem.deprecationInDeprecatedCode=disabled | ||
| org.eclipse.wst.jsdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled | ||
| org.eclipse.wst.jsdt.core.compiler.problem.discouragedReference=warning | ||
| org.eclipse.wst.jsdt.core.compiler.problem.duplicateLocalVariables=warning | ||
| org.eclipse.wst.jsdt.core.compiler.problem.emptyStatement=ignore | ||
| org.eclipse.wst.jsdt.core.compiler.problem.fallthroughCase=ignore | ||
| org.eclipse.wst.jsdt.core.compiler.problem.fieldHiding=ignore | ||
| org.eclipse.wst.jsdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning | ||
| org.eclipse.wst.jsdt.core.compiler.problem.forbiddenReference=error | ||
| org.eclipse.wst.jsdt.core.compiler.problem.hiddenCatchBlock=warning | ||
| org.eclipse.wst.jsdt.core.compiler.problem.indirectStaticAccess=ignore | ||
| org.eclipse.wst.jsdt.core.compiler.problem.localVariableHiding=ignore | ||
| org.eclipse.wst.jsdt.core.compiler.problem.looseVarDecleration=warning | ||
| org.eclipse.wst.jsdt.core.compiler.problem.noEffectAssignment=warning | ||
| org.eclipse.wst.jsdt.core.compiler.problem.nonExternalizedStringLiteral=ignore | ||
| org.eclipse.wst.jsdt.core.compiler.problem.nullReference=ignore | ||
| org.eclipse.wst.jsdt.core.compiler.problem.optionalSemicolon=warning | ||
| org.eclipse.wst.jsdt.core.compiler.problem.parameterAssignment=ignore | ||
| org.eclipse.wst.jsdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore | ||
| org.eclipse.wst.jsdt.core.compiler.problem.potentialNullReference=ignore | ||
| org.eclipse.wst.jsdt.core.compiler.problem.redundantNullCheck=ignore | ||
| org.eclipse.wst.jsdt.core.compiler.problem.undefinedField=warning | ||
| org.eclipse.wst.jsdt.core.compiler.problem.undocumentedEmptyBlock=ignore | ||
| org.eclipse.wst.jsdt.core.compiler.problem.uninitializedGlobalVariable=ignore | ||
| org.eclipse.wst.jsdt.core.compiler.problem.uninitializedLocalVariable=ignore | ||
| org.eclipse.wst.jsdt.core.compiler.problem.unnecessaryElse=ignore | ||
| org.eclipse.wst.jsdt.core.compiler.problem.unresolvedFieldReference=error | ||
| org.eclipse.wst.jsdt.core.compiler.problem.unresolvedMethodReference=error | ||
| org.eclipse.wst.jsdt.core.compiler.problem.unresolvedTypeReference=error | ||
| org.eclipse.wst.jsdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled | ||
| org.eclipse.wst.jsdt.core.compiler.problem.unusedLabel=warning | ||
| org.eclipse.wst.jsdt.core.compiler.problem.unusedLocal=ignore | ||
| org.eclipse.wst.jsdt.core.compiler.problem.unusedParameter=ignore | ||
| org.eclipse.wst.jsdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled | ||
| org.eclipse.wst.jsdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled | ||
| org.eclipse.wst.jsdt.core.compiler.problem.unusedPrivateMember=warning | ||
| semanticValidation=enabled |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| ############################################################################### | ||
| # Copyright (c) 2014 IBM Corporation and others. | ||
| # All rights reserved. This program and the accompanying materials | ||
| # are made available under the terms of the Eclipse Public License v1.0 | ||
| # which accompanies this distribution, and is available at | ||
| # http://www.eclipse.org/legal/epl-v10.html | ||
| # | ||
| # Contributors: | ||
| # IBM Corporation - initial API and implementation | ||
| ############################################################################### | ||
| # about.ini | ||
| # contains information about a feature | ||
| # java.io.Properties file (ISO 8859-1 with "\" escapes) | ||
| # "%key" are externalized strings defined in about.properties | ||
| # This file does not need to be translated. | ||
|
|
||
| # Property "appName" contains name of the application (translated) | ||
| appName=%appName | ||
|
|
||
| # Property "aboutText" contains blurb for "About" dialog (translated) | ||
| aboutText=%aboutText | ||
|
|
||
| # Property "featureImage" contains path to feature image (32x32) | ||
| featureImage=orion-32.png |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| ############################################################################### | ||
| # Copyright (c) 2014 IBM Corporation and others. | ||
| # All rights reserved. This program and the accompanying materials | ||
| # are made available under the terms of the Eclipse Public License v1.0 | ||
| # which accompanies this distribution, and is available at | ||
| # http://www.eclipse.org/legal/epl-v10.html | ||
| # | ||
| # Contributors: | ||
| # IBM Corporation - initial API and implementation | ||
| ############################################################################### | ||
| # about.properties | ||
| # contains externalized strings for feature.xml | ||
| # "%foo" in feature.xml corresponds to the key "foo" in this file | ||
| # java.io.Properties file (ISO 8859-1 with "\" escapes) | ||
| # This file should be translated. | ||
|
|
||
| # "appName" property - name of the feature | ||
| appName=Orion Client Feature | ||
|
|
||
| # "description" property - description of the feature | ||
| aboutText=\ | ||
| Version: {featureVersion}\n\ | ||
| Build id: @qualifier@\n\ | ||
| \n\ | ||
| Copyright (c) 2011, 2014 IBM Corporation and others.\n\ | ||
| \n\ | ||
| Orion is an open source platform for cloud based development\n\ | ||
| Visit https://www.eclipse.org/orion/ | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| Software License Agreement (BSD License) | ||
|
|
||
| Copyright (c) 2009-2011, Kevin Decker <kpdecker@gmail.com> | ||
|
|
||
| All rights reserved. | ||
|
|
||
| Redistribution and use of this software in source and binary forms, with or without modification, | ||
| are permitted provided that the following conditions are met: | ||
|
|
||
| * Redistributions of source code must retain the above | ||
| copyright notice, this list of conditions and the | ||
| following disclaimer. | ||
|
|
||
| * 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. | ||
|
|
||
| * Neither the name of Kevin Decker nor the names of its | ||
| contributors may be used to endorse or promote products | ||
| derived from this software without specific prior | ||
| written permission. | ||
|
|
||
| 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 THE COPYRIGHT OWNER OR | ||
| CONTRIBUTORS 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. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,21 @@ | ||
| ############################################################################### | ||
| # Copyright (c) 2010, 2014 IBM Corporation and others. | ||
| # All rights reserved. This program and the accompanying materials are made | ||
| # available under the terms of the Eclipse Public License v1.0 | ||
| # (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution | ||
| # License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). | ||
| # | ||
| # Contributors: IBM Corporation - initial API and implementation | ||
| ############################################################################### | ||
| bin.includes = META-INF/,\ | ||
| web/,\ | ||
| bundle.properties,\ | ||
| about.html,\ | ||
| about_files/,\ | ||
| about.ini,\ | ||
| about.properties,\ | ||
| orion-32.png | ||
| src.includes = web/,\ | ||
| about.html,\ | ||
| about_files/ | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!-- | ||
| Copyright (C) 2013, SAP AG and others. | ||
| All rights reserved. This program and the accompanying materials | ||
| are made available under the terms of the Eclipse Public License v1.0 | ||
| (http://www.eclipse.org/legal/epl-v10.html), | ||
| and the Eclipse Distribution License v1.0 | ||
| (http://www.eclipse.org/org/documents/edl-v10.html). | ||
| Contributors: | ||
| Matthias Sohn - initial implementation | ||
| --> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
|
|
||
| <groupId>org.eclipse.orion</groupId> | ||
| <artifactId>org.eclipse.orion.client.core</artifactId> | ||
| <version>2.0.0-SNAPSHOT</version> | ||
| <packaging>eclipse-plugin</packaging> | ||
|
|
||
| <parent> | ||
| <groupId>org.eclipse.orion</groupId> | ||
| <artifactId>org.eclipse.orion.client.parent</artifactId> | ||
| <version>1.0.0-SNAPSHOT</version> | ||
| <relativePath>../..</relativePath> | ||
| </parent> | ||
|
|
||
| </project> |