-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CHE-1771: Add Runtime page to Workspace details #2371
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 14 additions & 14 deletions
28
dashboard/src/app/workspaces/create-workspace/select-stack/recipe/workspace-recipe.styl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
136 changes: 136 additions & 0 deletions
136
dashboard/src/app/workspaces/workspace-details/environments/environments.controller.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
/* | ||
* Copyright (c) 2015-2016 Codenvy, S.A. | ||
* 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: | ||
* Codenvy, S.A. - initial API and implementation | ||
*/ | ||
'use strict'; | ||
|
||
/** | ||
* @ngdoc controller | ||
* @name workspace.details.controller:WorkspaceEnvironmentsController | ||
* @description This class is handling the controller for details of workspace : section environments | ||
* @author Oleksii Kurinnyi | ||
*/ | ||
export class WorkspaceEnvironmentsController { | ||
|
||
/** | ||
* Default constructor that is using resource injection | ||
* @ngInject for Dependency injection | ||
*/ | ||
constructor($timeout, cheEnvironmentRegistry) { | ||
this.cheEnvironmentRegistry = cheEnvironmentRegistry; | ||
|
||
this.editorOptions = { | ||
lineWrapping: true, | ||
lineNumbers: false, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can remove line numbers panel at all - by setting gutters: [] |
||
readOnly: true, | ||
gutters: [], | ||
onLoad: (editor) => { | ||
$timeout(() => { | ||
editor.refresh(); | ||
}, 1000); | ||
} | ||
}; | ||
|
||
this.machinesViewStatus = {}; | ||
|
||
this.init(); | ||
} | ||
|
||
/** | ||
* Sets initial values | ||
*/ | ||
init() { | ||
this.newEnvironmentName = this.environmentName; | ||
this.environment = this.workspaceConfig.environments[this.environmentName]; | ||
|
||
this.recipeType = this.environment.recipe.type; | ||
this.environmentManager = this.cheEnvironmentRegistry.getEnvironmentManager(this.recipeType); | ||
|
||
this.editorOptions.mode = this.environmentManager.editorMode; | ||
|
||
this.machines = this.environmentManager.getMachines(this.environment); | ||
} | ||
|
||
/** | ||
* Returns true if environment name is unique | ||
* | ||
* @param name {string} environment name to validate | ||
* @returns {boolean} | ||
*/ | ||
isUnique(name) { | ||
return name === this.environmentName || !this.workspaceConfig.environments[name]; | ||
} | ||
|
||
/** | ||
* Updates name of environment | ||
* @param isFormValid {boolean} | ||
*/ | ||
updateEnvironmentName(isFormValid) { | ||
if (!isFormValid || this.newEnvironmentName === this.environmentName) { | ||
return; | ||
} | ||
|
||
this.workspaceConfig.environments[this.newEnvironmentName] = this.environment; | ||
delete this.workspaceConfig.environments[this.environmentName]; | ||
|
||
if (this.workspaceConfig.defaultEnv === this.environmentName) { | ||
this.workspaceConfig.defaultEnv = this.newEnvironmentName; | ||
} | ||
|
||
this.doUpdateEnvironments(); | ||
} | ||
|
||
/** | ||
* Callback which is called in order to update environment config | ||
* @returns {Promise} | ||
*/ | ||
updateEnvironmentConfig() { | ||
let newEnvironment = this.environmentManager.getEnvironment(this.environment, this.machines); | ||
this.workspaceConfig.environments[this.newEnvironmentName] = newEnvironment; | ||
return this.doUpdateEnvironments().then(() => { | ||
this.init(); | ||
}); | ||
} | ||
|
||
/** | ||
* Callback which is called in order to rename specified machine | ||
* @param oldName | ||
* @param newName | ||
* @returns {*} | ||
*/ | ||
updateMachineName(oldName, newName) { | ||
let newEnvironment = this.environmentManager.renameMachine(this.environment, oldName, newName); | ||
this.workspaceConfig.environments[this.newEnvironmentName] = newEnvironment; | ||
return this.doUpdateEnvironments().then(() => { | ||
this.init(); | ||
}) | ||
} | ||
|
||
/** | ||
* Callback which is called in order to delete specified machine | ||
* @param name | ||
* @returns {*} | ||
*/ | ||
deleteMachine(name) { | ||
let newEnvironment = this.environmentManager.deleteMachine(this.environment, name); | ||
this.workspaceConfig.environments[this.newEnvironmentName] = newEnvironment; | ||
return this.doUpdateEnvironments().then(() => { | ||
this.init(); | ||
}) | ||
} | ||
|
||
/** | ||
* Calls parent controller's callback to update environment | ||
* @returns {IPromise<TResult>|*|Promise.<TResult>} | ||
*/ | ||
doUpdateEnvironments() { | ||
return this.environmentOnChange(); | ||
} | ||
|
||
} |
49 changes: 49 additions & 0 deletions
49
dashboard/src/app/workspaces/workspace-details/environments/environments.directive.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright (c) 2015-2016 Codenvy, S.A. | ||
* 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: | ||
* Codenvy, S.A. - initial API and implementation | ||
*/ | ||
'use strict'; | ||
|
||
/** | ||
* @ngdoc directive | ||
* @name workspaces.details.directive:workspaceEnvironments | ||
* @restrict E | ||
* @element | ||
* | ||
* @description | ||
* <workspace-environments></workspace-environmentss>` for displaying workspace environments. | ||
* | ||
* @usage | ||
* <workspace-environments></workspace-environments> | ||
* | ||
* @author Oleksii Kurinnyi | ||
*/ | ||
export class WorkspaceEnvironments { | ||
|
||
/** | ||
* Default constructor that is using resource | ||
* @ngInject for Dependency injection | ||
*/ | ||
constructor () { | ||
this.restrict = 'E'; | ||
this.templateUrl = 'app/workspaces/workspace-details/environments/environments.html'; | ||
|
||
this.controller = 'WorkspaceEnvironmentsController'; | ||
this.controllerAs = 'workspaceEnvironmentsController'; | ||
this.bindToController = true; | ||
|
||
this.scope = { | ||
environmentName: '=', | ||
environmentViewStatus: '=', | ||
workspaceConfig: '=', | ||
environmentOnChange: '&' | ||
} | ||
} | ||
} | ||
|
74 changes: 74 additions & 0 deletions
74
dashboard/src/app/workspaces/workspace-details/environments/environments.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<!-- | ||
|
||
Copyright (c) 2015 Codenvy, S.A. | ||
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: | ||
Codenvy, S.A. - initial API and implementation | ||
|
||
--> | ||
<div class="workspace-environments"> | ||
|
||
<!-- Name --> | ||
<che-label-container che-label-name="Name"> | ||
<ng-form flex layout="column" name="workspaceEnvironmentsForm"> | ||
<div layout="column" class="workspace-environments-input"> | ||
<che-input che-form="workspaceEnvironmentsForm" | ||
che-name="name" | ||
che-place-holder="Name of the environment" | ||
aria-label="Name of the environment" | ||
ng-model="workspaceEnvironmentsController.newEnvironmentName" | ||
ng-change="workspaceEnvironmentsController.updateEnvironmentName(workspaceEnvironmentsForm.$valid)" | ||
ng-model-options="{ updateOn: 'default blur', debounce: { 'default': 2000, 'blur': 0 } }" | ||
custom-validator="workspaceEnvironmentsController.isUnique($value)" | ||
required | ||
ng-maxlength="128" | ||
ng-pattern="/^[A-Za-z0-9_\-\.]+$/"> | ||
<div ng-message="required">A name is required.</div> | ||
<div ng-message="pattern">The name should not contain special characters like space, dollar, etc. | ||
</div> | ||
<div ng-message="maxlength">The name has to be less than 128 characters long.</div> | ||
<div ng-message="md-maxlength">The name has to be less than 128 characters long.</div> | ||
<div ng-message="customValidator">This environment name is already used.</div> | ||
</che-input> | ||
</div> | ||
</ng-form> | ||
</che-label-container> | ||
|
||
<!-- Machines --> | ||
<che-label-container ng-if="workspaceEnvironmentsController.environment.machines.length" | ||
che-label-name="Machines" | ||
class="che-label-container-last"> | ||
</che-label-container> | ||
<workspace-machine-config ng-repeat="machine in workspaceEnvironmentsController.machines" | ||
machine-name="machine.name" | ||
machines-list="workspaceEnvironmentsController.machines" | ||
environment-manager="workspaceEnvironmentsController.environmentManager" | ||
machine-name-on-change="workspaceEnvironmentsController.updateMachineName(oldName,newName)" | ||
machine-config-on-change="workspaceEnvironmentsController.updateEnvironmentConfig()" | ||
machine-on-delete="workspaceEnvironmentsController.deleteMachine(name)" | ||
machine-is-opened="workspaceEnvironmentsController.machinesViewStatus[machine.name]"></workspace-machine-config> | ||
|
||
<!-- Recipe Content--> | ||
<che-label-container che-label-name="Recipe" | ||
che-label-description="The contents of the runtime started by the workspace." | ||
ng-if="workspaceEnvironmentsController.environment.recipe.content"> | ||
<div layout="row" layout-wrap> | ||
<div flex class="recipe-editor"> | ||
<ui-codemirror ui-codemirror="workspaceEnvironmentsController.editorOptions" | ||
ng-model="workspaceEnvironmentsController.environment.recipe.content"></ui-codemirror> | ||
</div> | ||
</div> | ||
</che-label-container> | ||
<!-- OR Location --> | ||
<che-label-container che-label-name="Recipe Location" | ||
ng-if="workspaceEnvironmentsController.recipeType !== 'dockerimage' && workspaceEnvironmentsController.environment.recipe.location"> | ||
<che-text-info che-text="workspaceEnvironmentsController.environment.recipe.location" | ||
che-href="workspaceEnvironmentsController.environment.recipe.location" | ||
che-copy-clipboard="true" | ||
class="recipe-location"></che-text-info> | ||
</che-label-container> | ||
</div> |
17 changes: 17 additions & 0 deletions
17
dashboard/src/app/workspaces/workspace-details/environments/environments.styl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.workspace-environments | ||
padding 0 14px 14px | ||
|
||
.workspace-environments-input | ||
margin -6px 0 | ||
|
||
.recipe-editor | ||
margin -4px 0 | ||
min-width 500px | ||
max-width 1000px | ||
|
||
.CodeMirror | ||
height auto | ||
border 1px solid $list-separator-color | ||
|
||
.recipe-location a | ||
word-break break-all |
56 changes: 56 additions & 0 deletions
56
...ils/environments/list-env-variables/add-variable-dialog/add-variable-dialog.controller.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright (c) 2015-2016 Codenvy, S.A. | ||
* 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: | ||
* Codenvy, S.A. - initial API and implementation | ||
*/ | ||
'use strict'; | ||
|
||
/** | ||
* @ngdoc controller | ||
* @name list.environment.variables.controller:AddVariableDialogController | ||
* @description This class is handling the controller for the dialog box about adding the environment variable. | ||
* @author Oleksii Kurinnyi | ||
*/ | ||
export class AddVariableDialogController { | ||
|
||
/** | ||
* Default constructor that is using resource | ||
* @ngInject for Dependency injection | ||
*/ | ||
constructor($mdDialog) { | ||
this.$mdDialog = $mdDialog; | ||
this.updateInProgress = false; | ||
|
||
this.name = ''; | ||
this.value = ''; | ||
} | ||
|
||
isUnique(name) { | ||
return !this.variables[name]; | ||
} | ||
|
||
/** | ||
* It will hide the dialog box. | ||
*/ | ||
hide() { | ||
this.$mdDialog.hide(); | ||
} | ||
|
||
/** | ||
* Adds new environment variable | ||
*/ | ||
addVariable() { | ||
this.updateInProgress = true; | ||
|
||
this.callbackController.updateEnvVariable(this.name, this.value).finally(() => { | ||
this.updateInProgress = false; | ||
this.hide(); | ||
}); | ||
} | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you could add in PR comment that this new dependency is handled by https://dev.eclipse.org/ipzilla/show_bug.cgi?id=11918
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done