Dashboard: code clean-up (#8333)

* make dashboard *.ts files compliant to typescript and tslint rules

Signed-off-by: Oleksii Kurinnyi <okurinny@redhat.com>

* remove unused component

Signed-off-by: Oleksii Kurinnyi <okurinny@redhat.com>
6.19.x
Oleksii Kurinnyi 2018-01-18 11:27:17 +02:00 committed by GitHub
parent 2cac9c5374
commit cc873d9e4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
94 changed files with 598 additions and 1152 deletions

View File

@ -10,7 +10,6 @@
*/
'use strict';
import {AdminsPluginsConfig} from './plugins/plugins-config';
import {AdminsUserManagementConfig} from './user-management/user-management-config';
/**
@ -19,8 +18,9 @@ import {AdminsUserManagementConfig} from './user-management/user-management-conf
export class AdminsConfig {
constructor(register: che.IRegisterService) {
new AdminsPluginsConfig(register);
/* tslint:disable */
new AdminsUserManagementConfig(register);
/* tslint:enable */
}
}

View File

@ -1,36 +0,0 @@
/*
* Copyright (c) 2015-2018 Red Hat, Inc.
* 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:
* Red Hat, Inc. - initial API and implementation
*/
'use strict';
/* exported PluginFilter */
import {AdminPluginsCtrl} from './plugins.controller';
import {PluginsFilter} from './plugins-filter';
export class AdminsPluginsConfig {
constructor(register) {
register.controller('AdminPluginsCtrl', AdminPluginsCtrl);
new PluginsFilter(register);
// config routes
register.app.config(function ($routeProvider) {
$routeProvider.accessWhen('/admin/plugins', {
templateUrl: 'app/admin/plugins/plugins.html',
controller: 'AdminPluginsCtrl',
controllerAs: 'adminPluginsCtrl'
});
})
;
}
}

View File

@ -1,40 +0,0 @@
/*
* Copyright (c) 2015-2018 Red Hat, Inc.
* 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:
* Red Hat, Inc. - initial API and implementation
*/
'use strict';
export class PluginsFilter {
constructor(register) {
// Register this factory
register.app.filter('filterStagedPlugins', function () {
return function (toFilterPlugins) {
// no plugins, nothing to get
if (!toFilterPlugins) {
return [];
}
let filtered = [];
for (var i = 0; i < toFilterPlugins.length; i++) {
var plugin = toFilterPlugins[i];
if ('STAGED_INSTALL' === plugin.status || 'STAGED_UNINSTALL' === plugin.status) {
filtered.push(plugin);
}
}
return filtered;
};
});
}
}

View File

@ -1,288 +0,0 @@
/*
* Copyright (c) 2015-2018 Red Hat, Inc.
* 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:
* Red Hat, Inc. - initial API and implementation
*/
'use strict';
/**
* @ngdoc controller
* @name admin.plugins.controller:PluginsCtrl
* @description This class is handling the controller of the plugins
* @author Florent Benoit
*/
export class AdminPluginsCtrl {
/**
* Default constructor
* @ngInject for Dependency injection
*/
constructor($scope, $q, $mdDialog, $interval, $location, $anchorScroll, cheNotification, cheAdminPlugins) {
this.$scope = $scope;
this.$q = $q;
this.$mdDialog = $mdDialog;
this.$interval = $interval;
this.$location = $location;
this.$anchorScroll = $anchorScroll;
this.cheNotification = cheNotification;
this.cheAdminPlugins = cheAdminPlugins;
this.isLoading = true;
this.buildInProgress = false;
this.displayReloadChe = false;
this.buildCheFailed = false;
this.plugins = [];
this.refreshPlugins();
}
refreshPlugins() {
let promise = this.cheAdminPlugins.fetchPlugins();
promise.then(() => {
this.updateData();
this.isLoading = false;
}, (error: any) => {
this.isLoading = false;
if (error && error.status === 304) {
this.updateData();
}
});
}
/**
* Require to remove the given plugin
* @param pluginName name of the plugin to remove
*/
remove(event, pluginName) {
let confirm = this.$mdDialog.confirm()
.title('Would you like to remove plug-in ' + pluginName + '?')
.content('')
.ariaLabel('Remove plug-in')
.ok('Delete it!')
.cancel('Cancel')
.clickOutsideToClose(true)
.targetEvent(event);
this.$mdDialog.show(confirm).then(() => {
let promise = this.cheAdminPlugins.removePlugin(pluginName);
promise.then(() => {
this.refreshPlugins();
}, (error) => {
this.cheNotification.showError(error.data.message ? error.data.message : 'Delete failed.');
console.log('error', error);
});
});
}
/**
* Require to install the given plugin
* @param pluginName name of the plugin to install and then add into staged
*/
install(pluginName) {
let promise = this.cheAdminPlugins.updatePlugin(pluginName, 'TO_INSTALL');
let installPromise = promise.then(() => {
this.refreshPlugins();
});
return installPromise;
}
/**
* Require to install the given plugin
* @param pluginName name of the plugin to install and then add into staged
*/
uninstall(pluginName) {
let promise = this.cheAdminPlugins.updatePlugin(pluginName, 'TO_UNINSTALL');
let uninstallPromise = promise.then(() => {
this.refreshPlugins();
});
return uninstallPromise;
}
prettyPrintStatus(plugin) {
if ('STAGED_INSTALL' === plugin.status) {
return 'To Be Installed';
} else if ('STAGED_UNINSTALL' === plugin.status) {
return 'To Be Uninstalled';
}
}
cancelStage(plugin) {
let action;
if ('STAGED_INSTALL' === plugin.status) {
action = 'UNDO_TO_INSTALL';
} else if ('STAGED_UNINSTALL' === plugin.status) {
action = 'UNDO_TO_UNINSTALL';
} else {
return;
}
let promise = this.cheAdminPlugins.updatePlugin(plugin.name, action);
let cancelPromise = promise.then(() => {
this.refreshPlugins();
});
return cancelPromise;
}
updateData() {
this.plugins.length = 0;
let updatePlugins = this.cheAdminPlugins.getPlugins();
updatePlugins.forEach((plugin) => {
this.plugins.push(plugin);
});
}
dropzoneAcceptURL(url) {
if (!url.startsWith('upload:') && !url.startsWith('https://eclipse.org/che/?install')) {
let deferred = this.$q.defer();
deferred.reject({data: {message:'The plugin URL is invalid'}});
return deferred.promise;
}
var pluginReference = this.getPluginReference(url);
let promise = this.cheAdminPlugins.addPlugin(pluginReference);
let addPromise = promise.then(() => {
this.refreshPlugins();
}, (error) => {
throw error;
});
return addPromise;
}
/**
* Gets the plugin URI based on groupId, etc or if not found return the input URL
* @param uri
* @returns {*}
*/
getPluginReference(uri) {
var query = uri;
var result = {};
query.split('&').forEach(function(part) {
var item = part.split('=');
result[item[0]] = decodeURIComponent(item[1]);
});
return result.uri || uri;
}
buildAssembly() {
this.buildInProgress = true;
this.displayReloadChe = false;
this.buildCheFailed = false;
this.displayLog = false;
let startInstallPromise = this.cheAdminPlugins.startInstall();
startInstallPromise.then((data) => {
// get ID
let id = data.id;
this.follow = this.$interval(() => {
this.followProcess(id);
}, 5000);
}, (error) => {
this.buildInProgress = false;
this.cheNotification.showError(error.data.message ? error.data.message : error);
});
}
followProcess(id) {
this.checkInstall(id);
}
checkInstall(id) {
let checkStatusPromise = this.cheAdminPlugins.getInstallDetails(id);
checkStatusPromise.then((data) => {
var regExp = new RegExp('\n', 'g');
this.currentBuildLog = data.log.replace(regExp, '<br>');
if ('SUCCESS' === data.status || 'FAILED' === data.status) {
// cancel scan
this.$interval.cancel(this.follow);
this.finishInstall(data.status);
}
});
}
finishInstall(status) {
this.refreshPlugins();
this.buildInProgress = false;
if (status === 'SUCCESS') {
this.displayReloadChe = true;
} else {
this.displayReloadChe = false;
this.buildCheFailed = true;
}
}
/**
* Reload the app
*/
reloadChe() {
this.reloadcheInProgress = true;
let promise = this.cheAdminPlugins.reloadCheApp();
promise.then(() => {
this.reloadcheInProgress = false;
this.reloadcheDone = true;
this.displayReloadChe = false;
}, () => {
this.reloadcheInProgress = false;
this.displayReloadChe = false;
});
}
scrollToStaged() {
this.$location.hash('plugin-staged');
this.$anchorScroll();
}
toggleDisplayLog() {
this.displayLog = !this.displayLog;
}
}

View File

@ -1,180 +0,0 @@
<!--
Copyright (c) 2015-2018 Red Hat, Inc.
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:
Red Hat, Inc. - initial API and implementation
-->
<che-toolbar che-title="Plug-Ins"></che-toolbar>
<md-content layout="column" class="plugins-content" md-scroll-y flex>
<che-panel che-title="Installed">
<div class="plugins-panel-subtitle">Plug-ins that are packaged and linked in this Che assembly.</div>
<div class="plugins-nothing-now" ng-show="(adminPluginsCtrl.plugins | filter: { status: 'INSTALLED' }).length == 0">
No user plug-ins are currently installed in this Che assembly.
</div>
<div ng-show="(adminPluginsCtrl.plugins | filter: { status: 'INSTALLED' }).length > 0">
<table flex class="plugins-table">
<thead>
<tr>
<th>Plug-In</th>
<th>Version</th>
<th>Scope</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="plugin in adminPluginsCtrl.plugins | filter: { status: 'INSTALLED' }">
<td>{{plugin.name}}</td>
<td>{{plugin.version}}</td>
<td>{{plugin.category}}</td>
<td> <che-link che-no-padding ng-click="adminPluginsCtrl.uninstall(plugin.name)" che-link-text="Uninstall"></che-link>
</td>
<tr>
<tr ng-repeat="plugin in adminPluginsCtrl.plugins | filter: { status: 'STAGED_UNINSTALL' }">
<td>{{plugin.name}}</td>
<td>{{plugin.version}}</td>
<td>{{plugin.category}}</td>
<td class="plugins-greyed-action">To Be Uninstalled</td>
<tr>
</tbody>
</table>
<div class="plugins-review-box" ng-show="(adminPluginsCtrl.plugins | filter: { status: 'STAGED_UNINSTALL' }).length > 0">
{{(adminPluginsCtrl.plugins | filter: { status: 'STAGED_UNINSTALL' }).length}} staged for installation<!--<che-link che-no-padding ng-click="adminPluginsCtrl.scrollToStaged()" che-link-text="Review"></che-link>-->
</div>
</div>
</che-panel>
<che-panel che-title="Available">
<div class="plugins-panel-subtitle">Plug-ins that can be added to this Che assembly.</div>
<div layout="row">
<div class="plugins-staged-zone-action" layout="row" flex="66">
<che-dropzone che-callback-controller="adminPluginsCtrl"></che-dropzone>
</div>
<div layout="row" flex layout-align="end center">
<che-button-default che-button-title="refresh"></che-button-default>
</div>
</div>
<div ng-show="((adminPluginsCtrl.plugins | filter: { status: 'AVAILABLE' }).length > 0) || ((adminPluginsCtrl.plugins | filter: { status: 'STAGED_INSTALL' }).length > 0)">
<table flex class="plugins-table">
<thead>
<tr>
<th>Plug-In</th>
<th>Version</th>
<th>Scope</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="plugin in adminPluginsCtrl.plugins | filter: { status: 'AVAILABLE' }">
<td>{{plugin.name}}</td>
<td>{{plugin.version}}</td>
<td>{{plugin.category}}</td>
<td>
<che-link ng-click="adminPluginsCtrl.install(plugin.name)" che-link-text="Stage"></che-link>
<che-link ng-click="adminPluginsCtrl.remove($event, plugin.name)" che-link-text="Delete"></che-link>
</td>
<tr>
<tr ng-repeat="plugin in adminPluginsCtrl.plugins | filter: { status: 'STAGED_INSTALL' }">
<td>{{plugin.name}}</td>
<td>{{plugin.version}}</td>
<td>{{plugin.category}}</td>
<td class="plugins-greyed-action">To Be Installed</td>
<tr>
</tbody>
</table>
<div class="plugins-review-box" ng-show="(adminPluginsCtrl.plugins | filter: { status: 'STAGED_INSTALL' }).length > 0">
<ng-pluralize count="(adminPluginsCtrl.plugins | filter: { status: 'STAGED_INSTALL' }).length"
when="{'one': '{} staged change',
'other': '{} staged changes'}">
</ng-pluralize> on available plug-ins:&nbsp;<che-link ng-click="adminPluginsCtrl.scrollToStaged()" che-link-text="Review"></che-link>
</div>
</div>
</che-panel>
<a id="plugin-staged"></a>
<che-panel che-title="Staged">
<div class="plugins-panel-subtitle">Plug-ins that will be packaged and linked into this Che assembly.</div>
<div class="plugins-nothing-now" ng-show="(adminPluginsCtrl.plugins | filterStagedPlugins).length == 0">
There are no plug-ins currently staged.
</div>
<div ng-show="(adminPluginsCtrl.plugins | filterStagedPlugins).length > 0">
<table flex class="plugins-table">
<thead>
<tr>
<th>Plug-In</th>
<th>Version</th>
<th>Scope</th>
<th>State</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="plugin in adminPluginsCtrl.plugins | filterStagedPlugins">
<td>{{plugin.name}}</td>
<td>{{plugin.version}}</td>
<td>{{plugin.category}}</td>
<td>{{adminPluginsCtrl.prettyPrintStatus(plugin)}}</td>
<td><che-link che-no-padding ng-click="adminPluginsCtrl.cancelStage(plugin)" che-link-text="Remove"></che-link></td>
<tr>
</tbody>
</table>
<div layout="column" layout-align="end end">
<che-button-primary ng-click="adminPluginsCtrl.buildAssembly()" ng-disabled="adminPluginsCtrl.buildInProgress" che-button-title="build assembly"></che-button-primary>
</div>
</div>
<div layout="column">
<div ng-show="adminPluginsCtrl.reloadcheDone">Che App Reloaded</div>
<div class="plugins-build-failed" ng-show="adminPluginsCtrl.buildCheFailed">Build of Che App failed. See log below</div>
<div layout="row" ng-show="adminPluginsCtrl.displayReloadChe">
<che-button-default ng-click="adminPluginsCtrl.reloadChe()" che-button-title="Reload Eclipse Che"></che-button-default>
<div ng-show="adminPluginsCtrl.reloadcheInProgress"><md-progress-circular md-diameter="25" md-theme="maincontent-theme" md-mode="indeterminate"></md-progress-circular></div>
</div>
<div layout="row" layout-align="start center" ng-show="adminPluginsCtrl.buildInProgress">
<div class="plugin-install-build-label">Building...</div>
<div><md-progress-circular md-diameter="25" md-theme="maincontent-theme" md-mode="indeterminate"></md-progress-circular></div>
</div>
<div layout="column">
<che-button-default ng-show="adminPluginsCtrl.currentBuildLog.length > 0" ng-click="adminPluginsCtrl.toggleDisplayLog()" che-button-title="{{adminPluginsCtrl.displayLog ? 'Hide Log' : 'Show Build Log'}}"></che-button-default>
<div ng-show="adminPluginsCtrl.displayLog && adminPluginsCtrl.currentBuildLog.length > 0" class="plugins-install-output" ng-bind-html="adminPluginsCtrl.currentBuildLog">
</div>
</div>
</div>
</che-panel>
<div class="plugin-empty-space"></div>
</md-content>

View File

@ -1,63 +0,0 @@
md-content.plugins-content
background-color $list-separator-color
.plugins-staged-zone-action
padding-top 20px
padding-bottom 20px
.plugins-table
width 100%
.plugins-table che-link
margin-left 10px
.plugins-table, .plugins-table th, .plugins-table td
border-collapse collapse
empty-cells show
border-width 1px
border-style solid
border-color $list-separator-color
.plugins-table th
background-color $table-header-color
font-size 18px
color $label-primary-color
.plugins-table th, .plugins-table td
padding: 1em
.plugins-greyed-action
color $label-info-color
font-style italic
.plugins-install-output
height 450px
overflow scroll
padding 15px
box-shadow-simple()
.plugin-install-build-label
font-size 18px
color $label-info-color
margin-right 20px
.plugins-panel-subtitle
margin-top -15px
margin-bottom 15px
.plugins-review-box
margin-top 10px
text-align right
.plugin-empty-space
min-height 700px
.plugins-nothing-now
color $label-info-color
.plugins-build-failed
color red
margin-bottom 15px

View File

@ -10,21 +10,15 @@
*/
'use strict';
import {CheNotification} from '../../../../components/notification/che-notification.factory';
import {CheProfile} from '../../../../components/api/che-profile.factory';
enum Tab {Profile, Organization}
interface IScope extends ng.IScope {
profileInformationForm: ng.IFormController;
}
interface IProfileAttributes {
firstName?: string;
lastName?: string;
phone?: string;
country?: string;
employer?: string;
jobtitle?: string;
}
const MAX_ITEMS = 12;
/**
@ -42,11 +36,11 @@ export class AdminUserDetailsController {
/**
* User profile service.
*/
private cheProfile: any;
private cheProfile: CheProfile;
/**
* Notification service.
*/
private cheNotification: any;
private cheNotification: CheNotification;
/**
* Index of the selected tab.
*/
@ -58,7 +52,7 @@ export class AdminUserDetailsController {
/**
* Profile attributes.
*/
private profileAttributes: IProfileAttributes;
private profileAttributes: che.IProfileAttributes;
/**
* Loading state of the page.
*/
@ -84,7 +78,13 @@ export class AdminUserDetailsController {
* Default constructor that is using resource injection
* @ngInject for Dependency injection
*/
constructor(cheProfile: any, $location: ng.ILocationService, $timeout: ng.ITimeoutService, $scope: ng.IScope, cheNotification: any, cheOrganization: che.api.ICheOrganization, initData: {userId; userName}) {
constructor(cheProfile: CheProfile,
$location: ng.ILocationService,
$timeout: ng.ITimeoutService,
$scope: ng.IScope,
cheNotification: CheNotification,
cheOrganization: che.api.ICheOrganization,
initData: {userId; userName}) {
this.cheOrganization = cheOrganization;
this.$location = $location;
this.cheProfile = cheProfile;

View File

@ -10,6 +10,10 @@
*/
'use strict';
import {CheUser} from '../../../components/api/che-user.factory';
import {CheNotification} from '../../../components/notification/che-notification.factory';
import {ConfirmDialogService} from '../../../components/service/confirm-dialog/confirm-dialog.service';
const MAX_ITEMS = 12;
/**
@ -21,16 +25,16 @@ export class AdminsUserManagementCtrl {
$log: ng.ILogService;
$mdDialog: ng.material.IDialogService;
$location: ng.ILocationService;
cheUser: any;
cheNotification: any;
cheUser: CheUser;
cheNotification: CheNotification;
pagesInfo: any;
users: Array<any>;
usersMap: Map<string, any>;
users: Array<che.IUser>;
usersMap: Map<string, che.IUser>;
userFilter: {name: string};
userOrderBy: string;
isLoading: boolean;
private confirmDialogService: any;
private confirmDialogService: ConfirmDialogService;
private cheOrganization: che.api.ICheOrganization;
private userOrganizationCount: {[userId: string]: number} = {};
private cheListHelper: che.widget.ICheListHelper;
@ -43,10 +47,10 @@ export class AdminsUserManagementCtrl {
$rootScope: che.IRootScopeService,
$log: ng.ILogService,
$mdDialog: ng.material.IDialogService,
cheUser: any,
cheUser: CheUser,
$location: ng.ILocationService,
cheNotification: any,
confirmDialogService: any,
cheNotification: CheNotification,
confirmDialogService: ConfirmDialogService,
cheOrganization: che.api.ICheOrganization,
$scope: ng.IScope,
cheListHelperFactory: che.widget.ICheListHelperFactory) {

View File

@ -25,7 +25,7 @@ export class AdministrationConfig {
register.controller('EditRegistryController', EditRegistryController);
// config routes
register.app.config(($routeProvider: ng.route.IRouteProvider) => {
register.app.config(($routeProvider: che.route.IRouteProvider) => {
$routeProvider.accessWhen('/administration', {
title: 'Administration',
templateUrl: 'app/administration/administration.html'

View File

@ -24,24 +24,17 @@
*
* @author Oleksii Orel
*/
export class DockerRegistryList {
export class DockerRegistryList implements ng.IDirective {
/**
* Default constructor that is using resource
* @ngInject for Dependency injection
*/
constructor() {
this.restrict = 'E';
this.templateUrl = 'app/administration/docker-registry/docker-registry-list/docker-registry-list.html';
this.replace = false;
restrict = 'E';
templateUrl = 'app/administration/docker-registry/docker-registry-list/docker-registry-list.html';
replace = false;
this.controller = 'DockerRegistryListController';
this.controllerAs = 'dockerRegistryListController';
controller = 'DockerRegistryListController';
controllerAs = 'dockerRegistryListController';
this.bindToController = true;
bindToController = true;
this.scope = true;
}
scope = true;
}

View File

@ -12,8 +12,8 @@
export class CheColorsConfig {
constructor(register) {
// Register this factory
constructor(register: che.IRegisterService) {
// register this factory
register.app.constant('jsonColors', JSON.stringify({
'$che-navy-color': '#353E50',
'$che-medium-blue-color': '#4A90E2',

View File

@ -12,8 +12,8 @@
export class CheColorsConfig {
constructor(register) {
// Register this factory
constructor(register: che.IRegisterService) {
// register this factory
register.app.constant('jsonColors', JSON.stringify(%CONTENT%));
}

View File

@ -12,8 +12,8 @@
export class CheOutputColorsConfig {
constructor(register) {
// Register this factory
constructor(register: che.IRegisterService) {
// register this factory
register.app.constant('jsonOutputColors', JSON.stringify(%CONTENT%));
}
}

View File

@ -15,36 +15,36 @@
*/
export class CheJobsConfig {
constructor(register) {
// Register this factory
register.app.constant('jsonJobs', JSON.stringify([{
name: 'Architect'
}, {
name: 'Team Lead'
}, {
name: 'DevOps'
}, {
name: 'Developer'
}, {
name: 'System Administrator'
}, {
name: 'Manager'
}, {
name: 'Director'
}, {
name: 'VP'
}, {
name: 'C-Level'
}, {
name: 'Freelance'
}, {
name: 'Educator'
}, {
name: 'Student'
}, {
name: 'Hobbyist'
}]
));
constructor(register: che.IRegisterService) {
// register this factory
register.app.constant('jsonJobs', JSON.stringify([{
name: 'Architect'
}, {
name: 'Team Lead'
}, {
name: 'DevOps'
}, {
name: 'Developer'
}, {
name: 'System Administrator'
}, {
name: 'Manager'
}, {
name: 'Director'
}, {
name: 'VP'
}, {
name: 'C-Level'
}, {
name: 'Freelance'
}, {
name: 'Educator'
}, {
name: 'Student'
}, {
name: 'Hobbyist'
}]
));
}
}
}

View File

@ -13,7 +13,6 @@
import {DashboardLastWorkspacesController} from './last-workspaces/last-workspaces.controller';
import {DashboardLastWorkspaces} from './last-workspaces/last-workspaces.directive';
import {DashboardPanel} from './dashboard-panel/dashboard-panel.directive';
import {CheService} from '../../components/api/che-service.factory';
import {CheWorkspace} from '../../components/api/workspace/che-workspace.factory';
export class DashboardConfig {
@ -33,7 +32,7 @@ export class DashboardConfig {
title: 'Dashboard',
templateUrl: 'app/dashboard/dashboard.html',
resolve: {
check: ['$q', '$location', 'cheWorkspace', 'cheService', ($q: ng.IQService, $location: ng.ILocationService, cheWorkspace: CheWorkspace, cheService: CheService) => {
check: ['$q', '$location', 'cheWorkspace', ($q: ng.IQService, $location: ng.ILocationService, cheWorkspace: CheWorkspace) => {
cheWorkspace.fetchWorkspaces().then(() => {
if (cheWorkspace.getWorkspaces().length === 0) {
$location.path('/create-workspace');
@ -46,8 +45,7 @@ export class DashboardConfig {
}]
}
});
})
;
});
}
}

View File

@ -16,29 +16,23 @@
* @description This class is handling the directive of the panel for displaying dashboard entries.
* @author Oleksii Kurinnyi
*/
export class DashboardPanel {
export class DashboardPanel implements ng.IDirective {
/**
* Default constructor that is using resource
* @ngInject for Dependency injection
*/
constructor() {
this.restrict = 'E';
this.transclude = true;
this.replace = true;
}
restrict = 'E';
transclude = true;
replace = true;
/**
* Template for the panel
* @param element
* @param attrs
* @param $element
* @param $attrs
* @returns {string} the template
*/
template(element, attrs) {
template($element: ng.IAugmentedJQuery, $attrs: ng.IAttributes): string {
return ''
+ '<div class="dashboard-panel">'
+ '<div class="dashboard-panel-title" layout="row" layout-align="start center">'
+ '<span>' + attrs.panelTitle + '</span>'
+ '<span>' + ($attrs as any).panelTitle + '</span>'
+ '</div>'
+ '<div class="dashboard-panel-content">'
+ '<ng-transclude></ng-transclude>'

View File

@ -16,20 +16,13 @@
* @description This class is handling the directive of the listing last opened workspaces in the dashboard
* @author Oleksii Orel
*/
export class DashboardLastWorkspaces {
export class DashboardLastWorkspaces implements ng.IDirective {
restrict = 'E';
templateUrl = 'app/dashboard/last-workspaces/last-workspaces.html';
/**
* Default constructor that is using resource
* @ngInject for Dependency injection
*/
constructor() {
this.restrict = 'E';
this.templateUrl = 'app/dashboard/last-workspaces/last-workspaces.html';
this.controller = 'DashboardLastWorkspacesController';
this.controllerAs = 'dashboardLastWorkspacesController';
this.bindToController = true;
}
controller = 'DashboardLastWorkspacesController';
controllerAs = 'dashboardLastWorkspacesController';
bindToController = true;
}

View File

@ -24,7 +24,7 @@
*
* @author Florent Benoit
*/
export class Diagnostics {
export class Diagnostics implements ng.IDirective {
replace: boolean = false;
restrict: string = 'E';

View File

@ -14,15 +14,15 @@
* Defines a directive for displaying action box.
* @author Florent Benoit
*/
export class FactoryActionBox {
private restrict: string;
private templateUrl: string;
private replace: boolean;
private controller: string;
private controllerAs: string;
private bindToController: boolean;
export class FactoryActionBox implements ng.IDirective {
restrict: string;
templateUrl: string;
replace: boolean;
controller: string;
controllerAs: string;
bindToController: boolean;
private scope: {
scope: {
[propName: string]: string;
};

View File

@ -14,15 +14,15 @@
* Defines a directive for displaying factory commands.
* @author Florent Benoit
*/
export class FactoryCommand {
private restrict: string;
private templateUrl: string;
private replace: boolean;
private controller: string;
private controllerAs: string;
private bindToController: boolean;
export class FactoryCommand implements ng.IDirective {
restrict: string;
templateUrl: string;
replace: boolean;
controller: string;
controllerAs: string;
bindToController: boolean;
private scope: {
scope: {
[propName: string]: string;
};

View File

@ -51,7 +51,7 @@ export class FactoryFromFileCtrl {
this.isImporting = this.uploader.isUploading;
var ctrl = this;
const ctrl = this;
// filters
this.uploader.filters.push({

View File

@ -18,15 +18,15 @@ interface IFactoryFromFileScope extends ng.IScope {
* Defines a directive for configuring factory from file.
* @author Oleksii Orel
*/
export class FactoryFromFile {
private restrict: string;
private templateUrl: string;
private replace: boolean;
private controller: string;
private controllerAs: string;
private bindToController: boolean;
export class FactoryFromFile implements ng.IDirective {
restrict: string;
templateUrl: string;
replace: boolean;
controller: string;
controllerAs: string;
bindToController: boolean;
private scope: {
scope: {
[propName: string]: string;
};

View File

@ -58,7 +58,7 @@ export class CreateFactoryConfig {
// config routes
register.app.config(($routeProvider: any) => {
register.app.config(($routeProvider: che.route.IRouteProvider) => {
$routeProvider.accessWhen('/factories/create-factory', {
title: 'New Factory',
templateUrl: 'app/factories/create-factory/create-factory.html',

View File

@ -43,7 +43,14 @@ export class CreateFactoryCtrl {
* Default constructor that is using resource injection
* @ngInject for Dependency injection
*/
constructor($location: ng.ILocationService, cheAPI: CheAPI, $log: ng.ILogService, cheNotification: CheNotification, $scope: ng.IScope, $filter: ng.IFilterService, lodash: any, $document: ng.IDocumentService) {
constructor($location: ng.ILocationService,
cheAPI: CheAPI,
$log: ng.ILogService,
cheNotification: CheNotification,
$scope: ng.IScope,
$filter: ng.IFilterService,
lodash: any,
$document: ng.IDocumentService) {
this.$location = $location;
this.cheAPI = cheAPI;
this.$log = $log;

View File

@ -14,14 +14,14 @@
* Defines a directive for creating factory from git.
* @author Florent Benoit
*/
export class CreateFactoryGit {
private restrict: string;
private templateUrl: string;
private controller: string;
private controllerAs: string;
private bindToController: boolean;
export class CreateFactoryGit implements ng.IDirective {
restrict: string;
templateUrl: string;
controller: string;
controllerAs: string;
bindToController: boolean;
private scope: {
scope: {
[propName: string]: string;
};

View File

@ -14,15 +14,15 @@
* Defines a directive for displaying factory from template widget.
* @author Oleksii Orel
*/
export class FactoryFromTemplate {
private restrict: string;
private templateUrl: string;
private controller: string;
private controllerAs: string;
private bindToController: boolean;
private replace: boolean;
export class FactoryFromTemplate implements ng.IDirective {
restrict: string;
templateUrl: string;
controller: string;
controllerAs: string;
bindToController: boolean;
replace: boolean;
private scope: {
scope: {
[propName: string]: string;
};

View File

@ -32,7 +32,7 @@ export class FactoryConfig {
register.service('loadFactoryService', LoadFactoryService);
// config routes
register.app.config(function ($routeProvider) {
register.app.config(function ($routeProvider: che.route.IRouteProvider) {
$routeProvider.accessWhen('/factories', {
title: 'Factories',
templateUrl: 'app/factories/list-factories/list-factories.html',
@ -55,9 +55,11 @@ export class FactoryConfig {
});
// config files
/* tslint:disable */
new FactoryDetailsConfig(register);
new CreateFactoryConfig(register);
new LastFactoriesConfig(register);
/* tslint:enable */
}
}

View File

@ -20,7 +20,7 @@ export class FactoryDetailsConfig {
register.controller('FactoryDetailsController', FactoryDetailsController);
// config routes
register.app.config(($routeProvider: any) => {
register.app.config(($routeProvider: che.route.IRouteProvider) => {
let locationProvider = {
title: 'Factory',
templateUrl: 'app/factories/factory-details/factory-details.html',
@ -34,6 +34,8 @@ export class FactoryDetailsConfig {
});
// config files
/* tslint:disable */
new InformationTabConfig(register);
/* tslint:enable */
}
}

View File

@ -25,7 +25,9 @@ export class FactoryDetailsController {
* @ngInject for Dependency injection
*/
constructor($route: ng.route.IRouteService, cheFactory: CheFactory, cheNotification: CheNotification) {
/* tslint:disable */
'ngInject';
/* tslint:enable */
this.cheFactory = cheFactory;
let factoryId = $route.current.params.id;

View File

@ -37,7 +37,7 @@ export class FactoryInformationController {
private factory: che.IFactory;
private copyOriginFactory: che.IFactory;
private factoryContent: string;
private workspaceImportedRecipe: any;
// private workspaceImportedRecipe: any;
private environmentName: string;
private workspaceName: string;
private stackId: string;
@ -49,8 +49,16 @@ export class FactoryInformationController {
* Default constructor that is using resource injection
* @ngInject for Dependency injection
*/
constructor($scope: ng.IScope, cheAPI: CheAPI, cheNotification: CheNotification, $location: ng.ILocationService, $log: ng.ILogService,
$timeout: ng.ITimeoutService, lodash: any, $filter: ng.IFilterService, $q: ng.IQService, confirmDialogService: ConfirmDialogService) {
constructor($scope: ng.IScope,
cheAPI: CheAPI,
cheNotification: CheNotification,
$location: ng.ILocationService,
$log: ng.ILogService,
$timeout: ng.ITimeoutService,
lodash: any,
$filter: ng.IFilterService,
$q: ng.IQService,
confirmDialogService: ConfirmDialogService) {
this.cheAPI = cheAPI;
this.cheNotification = cheNotification;
this.$location = $location;

View File

@ -16,13 +16,13 @@
* @description This class is handling the directive of the listing last opened factories
* @author Oleksii Orel
*/
export class LastFactories {
private restrict: string;
private templateUrl: string;
private replace: boolean;
private controller: string;
private controllerAs: string;
private bindToController: boolean;
export class LastFactories implements ng.IDirective {
restrict: string;
templateUrl: string;
replace: boolean;
controller: string;
controllerAs: string;
bindToController: boolean;
/**
* Default constructor that is using resource

View File

@ -20,14 +20,17 @@ export class FactoryItemController {
private $location: ng.ILocationService;
private cheFactory: CheFactory;
private cheEnvironmentRegistry: CheEnvironmentRegistry;
private lodash: _.LoDashStatic;
private lodash: any;
private factory: che.IFactory;
/**
* Default constructor that is using resource injection
* @ngInject for Dependency injection
*/
constructor($location: ng.ILocationService, cheFactory: CheFactory, cheEnvironmentRegistry: CheEnvironmentRegistry, lodash: _.LoDashStatic) {
constructor($location: ng.ILocationService,
cheFactory: CheFactory,
cheEnvironmentRegistry: CheEnvironmentRegistry,
lodash: any) {
this.$location = $location;
this.cheFactory = cheFactory;
this.cheEnvironmentRegistry = cheEnvironmentRegistry;

View File

@ -14,7 +14,7 @@
* Defines a directive for factory item in list.
* @author Oleksii Orel
*/
export class CheFactoryItem {
export class CheFactoryItem implements ng.IDirective {
restrict: string = 'E';
templateUrl: string = 'app/factories/list-factories/factory-item/factory-item.html';

View File

@ -16,7 +16,7 @@ import {RouteHistory} from '../../../components/routing/route-history.service';
import {CheJsonRpcApi} from '../../../components/api/json-rpc/che-json-rpc-api.factory';
import {CheJsonRpcMasterApi} from '../../../components/api/json-rpc/che-json-rpc-master-api';
const WS_AGENT_STEP: number = 3
const WS_AGENT_STEP: number = 3;
/**
* This class is handling the controller for the factory loading.
@ -27,7 +27,7 @@ export class LoadFactoryController {
private $timeout: ng.ITimeoutService;
private $mdDialog: ng.material.IDialogService;
private loadFactoryService: LoadFactoryService;
private lodash: _.LoDashStatic;
private lodash: any;
private cheNotification: CheNotification;
private $location: ng.ILocationService;
private routeHistory: RouteHistory;
@ -46,9 +46,17 @@ export class LoadFactoryController {
* Default constructor that is using resource
* @ngInject for Dependency injection
*/
constructor(cheAPI: CheAPI, cheJsonRpcApi: CheJsonRpcApi, $route: ng.route.IRouteService, $timeout: ng.ITimeoutService,
$mdDialog: ng.material.IDialogService, loadFactoryService: LoadFactoryService, lodash: _.LoDashStatic, cheNotification: CheNotification,
$location: ng.ILocationService, routeHistory: RouteHistory, $window: ng.IWindowService) {
constructor(cheAPI: CheAPI,
cheJsonRpcApi: CheJsonRpcApi,
$route: ng.route.IRouteService,
$timeout: ng.ITimeoutService,
$mdDialog: ng.material.IDialogService,
loadFactoryService: LoadFactoryService,
lodash: any,
cheNotification: CheNotification,
$location: ng.ILocationService,
routeHistory: RouteHistory,
$window: ng.IWindowService) {
this.cheAPI = cheAPI;
this.$timeout = $timeout;
this.$mdDialog = $mdDialog;
@ -60,7 +68,7 @@ export class LoadFactoryController {
this.$window = $window;
this.workspaces = [];
this.workspace = {};
this.workspace = {} as che.IWorkspace;
this.hideMenuAndFooter();
this.jsonRpcMasterApi = cheJsonRpcApi.getJsonRpcMasterApi(cheAPI.getWorkspace().getJsonRpcApiLocation());
@ -202,11 +210,11 @@ export class LoadFactoryController {
*/
getWorkspaceToStart(): void {
let createPolicy = (this.factory.policies) ? this.factory.policies.create : 'perClick';
var workspace = null;
let workspace = null;
switch (createPolicy) {
case 'perUser' :
workspace = this.lodash.find(this.workspaces, (w: che.IWorkspace) => {
return this.factory.id === w.attributes.factoryId;
return this.factory.id === (w.attributes as any).factoryId;
});
break;
case 'perAccount' :
@ -465,7 +473,7 @@ export class LoadFactoryController {
detectProjectsToImport(projects: Array<che.IProject>): void {
this.projectsToImport = 0;
projects.forEach((project: che.IProject) => {
projects.forEach((project: che.IProjectTemplate) => {
if (!this.isProjectOnFileSystem(project)) {
this.projectsToImport++;
this.importProject(this.workspace.id, project);
@ -480,7 +488,7 @@ export class LoadFactoryController {
/**
* Project is on file system if there is no errors except code=9.
*/
isProjectOnFileSystem(project: che.IProject): boolean {
isProjectOnFileSystem(project: che.IProjectTemplate): boolean {
let problems = project.problems;
if (!problems || problems.length === 0) {
return true;
@ -557,7 +565,7 @@ export class LoadFactoryController {
} else {
// add every factory parameter by prefix
Object.keys(this.routeParams).forEach((key: string) => {
ideParams.push('factory-' + key + ':' + this.$window.encodeURIComponent(this.routeParams[key]));
ideParams.push('factory-' + key + ':' + (this.$window as any).encodeURIComponent(this.routeParams[key]));
});
}
@ -658,7 +666,7 @@ export class LoadFactoryController {
*/
downloadLogs(): void {
let logs = '';
this.getLoadingSteps().forEach((step) => {
this.getLoadingSteps().forEach((step: any) => {
logs += step.logs + '\n';
});
window.open('data:text/csv,' + encodeURIComponent(logs));

View File

@ -90,7 +90,7 @@ export class LoadFactoryService {
* Reset the loading progress.
*/
resetLoadProgress(): void {
this.loadingSteps.forEach((step) => {
this.loadingSteps.forEach((step: any) => {
step.logs = '';
step.hasError = false;
});

View File

@ -10,6 +10,14 @@
*/
'use strict';
interface IDropdonwMenuAttributes extends ng.IAttributes {
navbarDropdownRightClick: any;
}
interface IDropdonwMenuRootScope extends ng.IRootScopeService {
navbarDropdownActiveMenu: HTMLElement;
}
/**
* @ngDoc directive
* @name navbar.directive:NavbarDropdownMenu
@ -28,7 +36,7 @@ export class NavbarDropdownMenu implements ng.IDirective {
/**
* Root scope service.
*/
$rootScope: ng.IRootScopeService;
$rootScope: IDropdonwMenuRootScope;
restrict: string = 'E';
bindToController: boolean = true;
@ -54,118 +62,121 @@ export class NavbarDropdownMenu implements ng.IDirective {
*/
constructor($timeout: ng.ITimeoutService,
$document: ng.IDocumentService,
$rootScope: ng.IRootScopeService) {
$rootScope: IDropdonwMenuRootScope) {
this.$timeout = $timeout;
this.$document = $document;
this.$rootScope = $rootScope;
}
compile($element, attrs) {
compile($element: ng.IAugmentedJQuery, $attrs: IDropdonwMenuAttributes): ng.IDirectivePrePost {
let jqButton = $element.find('[ng-transclude]');
if (angular.isDefined(attrs['navbarDropdownRightClick'])) {
if (angular.isDefined($attrs.navbarDropdownRightClick)) {
jqButton.attr('ng-click', '');
jqButton.attr('che-on-right-click', '$mdOpenMenu($event)');
} else {
jqButton.attr('ng-click', '$mdOpenMenu($event)');
}
return {};
}
link($scope, $element) {
link($scope: ng.IScope, $element: ng.IAugmentedJQuery): void {
// store active menu element in rootScope
let menuContentEl = $element.find('.navbar-dropdown-menu'),
menuEl = $element.find('md-menu');
$scope.$watch(() => {
return menuContentEl.is(':visible');
}, (visible) => {
}, (visible: boolean) => {
if (visible) {
this.$rootScope.navbarDropdownActiveMenu = menuEl[0];
}
});
let self = this;
this.$document.off('.dropdown-menu')
.on('mousedown.dropdown-menu contextmenu.dropdown-menu', '.md-menu-backdrop', (e) => {
let eventType = e.type,
eventWhich = e.which,
backdropEl = angular.element(e.target);
this.$document
.off('.dropdown-menu')
.on('mousedown.dropdown-menu contextmenu.dropdown-menu', '.md-menu-backdrop', (e: JQueryEventObject) => {
let eventType = e.type,
eventWhich = e.which,
backdropEl = angular.element(e.target);
if (eventType === 'mousedown') {
if (eventWhich === 3) {
// prevent event propagation for right mousedown
// and wait for contextmenu event
e.preventDefault();
e.stopPropagation();
return false;
} else {
eventType = 'click';
}
}
var x = e.clientX,
y = e.clientY,
stack = [];
let elementMouseIsOver = self.$document[0].elementFromPoint(x, y);
elementMouseIsOver.style.pointerEvents = 'none';
stack.push(elementMouseIsOver);
// iterate elements under cursor
let limit = 50,
nextTargetEl;
while (elementMouseIsOver && elementMouseIsOver.tagName !== 'BODY' && elementMouseIsOver.tagName !== 'MD-MENU' && limit > 0){
elementMouseIsOver = self.$document[0].elementFromPoint(x, y);
// break when top of tree is reached
if (stack[stack.length-1] === elementMouseIsOver) {
break;
}
let curEl = angular.element(elementMouseIsOver);
// element to trigger event
if (!nextTargetEl) {
nextTargetEl = curEl;
if (eventType === 'mousedown') {
if (eventWhich === 3) {
// prevent event propagation for right mousedown
// and wait for contextmenu event
e.preventDefault();
e.stopPropagation();
return false;
} else {
eventType = 'click';
}
}
const x = e.clientX,
y = e.clientY,
stack = [];
let elementMouseIsOver = (self.$document[0] as any).elementFromPoint(x, y);
elementMouseIsOver.style.pointerEvents = 'none';
stack.push(elementMouseIsOver);
limit--;
}
// iterate elements under cursor
let limit = 50,
nextTargetEl;
while (elementMouseIsOver && elementMouseIsOver.tagName !== 'BODY' && elementMouseIsOver.tagName !== 'MD-MENU' && limit > 0) {
elementMouseIsOver = (self.$document[0] as any).elementFromPoint(x, y);
// click on menu's backdrop to hide menu
backdropEl.triggerHandler('click');
// break when top of tree is reached
if (stack[stack.length - 1] === elementMouseIsOver) {
break;
}
if (elementMouseIsOver && elementMouseIsOver.tagName === 'MD-MENU') {
// if menu is found then
// check if click is caught over the same menu
if(elementMouseIsOver === this.$rootScope.navbarDropdownActiveMenu) {
// clear active menu
delete this.$rootScope.navbarDropdownActiveMenu;
let curEl = angular.element(elementMouseIsOver);
// element to trigger event
if (!nextTargetEl) {
nextTargetEl = curEl;
}
elementMouseIsOver.style.pointerEvents = 'none';
stack.push(elementMouseIsOver);
limit--;
}
// click on menu's backdrop to hide menu
backdropEl.triggerHandler('click');
if (elementMouseIsOver && elementMouseIsOver.tagName === 'MD-MENU') {
// if menu is found then
// check if click is caught over the same menu
if (elementMouseIsOver === this.$rootScope.navbarDropdownActiveMenu) {
// clear active menu
delete this.$rootScope.navbarDropdownActiveMenu;
} else {
// open new menu by triggering mouse event
angular.element(nextTargetEl).trigger({
type: eventType,
which: eventWhich
} as JQueryEventObject);
}
} else {
// open new menu by triggering mouse event
// if menu isn't found
// just trigger same mouse event on first found element
angular.element(nextTargetEl).trigger({
type: eventType,
which: eventWhich
});
} as JQueryEventObject);
}
} else {
// if menu isn't found
// just trigger same mouse event on first found element
angular.element(nextTargetEl).trigger({
type: eventType,
which: eventWhich
});
}
// clean pointer events
for (let i=0; i<stack.length; i++) {
stack[i].style.pointerEvents = '';
}
// clean pointer events
for (let i = 0; i < stack.length; i++) {
stack[i].style.pointerEvents = '';
}
e.preventDefault();
e.stopPropagation();
e.preventDefault();
e.stopPropagation();
return false;
});
return false;
});
}
}

View File

@ -18,11 +18,13 @@
*/
export class NavBarSelectedCtrl {
$mdSidenav: ng.material.ISidenavService;
/**
* Default constructor that is using resource
* @ngInject for Dependency injection
*/
constructor ($mdSidenav) {
constructor ($mdSidenav: ng.material.ISidenavService) {
this.$mdSidenav = $mdSidenav;
}

View File

@ -45,9 +45,8 @@ export class NavBarSelected implements ng.IDirective {
/**
* Monitor click
* $scope: ng.IScope, $element: ng.IAugmentedJQuery, $attrs: ICheFormatOutputAttributes
*/
link($scope: ng.IScope, element: ng.IAugmentedJQuery, attrs: INavBarSelectedAttributes) {
link($scope: ng.IScope, $element: ng.IAugmentedJQuery, $attrs: INavBarSelectedAttributes) {
const select = (elem: ng.IAugmentedJQuery) => {
// if there is a previous selected element, unselect it
if (this.$rootScope.selectedNavBarElement) {
@ -60,40 +59,40 @@ export class NavBarSelected implements ng.IDirective {
};
// highlight item at start
if (attrs.href === '#' + this.$location.path()) {
select(element);
if ($attrs.href === '#' + this.$location.path()) {
select($element);
}
// highlight item on click
element.bind('click', (event: JQueryEventObject) => {
$element.bind('click', (event: JQueryEventObject) => {
// prevent activating menu item if Ctrl key is pressed
if (event.ctrlKey) {
this.$rootScope.selectedNavBarElement.focus();
return;
}
select(element);
select($element);
});
element.bind('mousedown', () => {
element.addClass('navbar-item-no-hover');
$element.bind('mousedown', () => {
$element.addClass('navbar-item-no-hover');
});
element.bind('mouseup', () => {
if (element !== this.$rootScope.selectedNavBarElement) {
element.blur();
$element.bind('mouseup', () => {
if ($element !== this.$rootScope.selectedNavBarElement) {
$element.blur();
}
});
element.bind('mouseover', () => {
element.removeClass('navbar-item-no-hover');
$element.bind('mouseover', () => {
$element.removeClass('navbar-item-no-hover');
});
$scope.$on('navbar-selected:set', (event: ng.IAngularEvent, path: string) => {
// unselect previously selected item
if (this.$rootScope.selectedNavBarElement === element) {
if (this.$rootScope.selectedNavBarElement === $element) {
this.$rootScope.selectedNavBarElement.removeClass('che-navbar-selected');
delete this.$rootScope.selectedNavBarElement;
}
// select item
if (attrs.href === path) {
select(element);
if ($attrs.href === path) {
select($element);
}
});
}

View File

@ -14,7 +14,7 @@ import {CheKeycloak} from '../../components/api/che-keycloak.factory';
import {CheService} from '../../components/api/che-service.factory';
export class CheNavBarController {
private menuItemUrl = {
menuItemUrl = {
dashboard: '#/',
workspaces: '#/workspaces',
administration: '#/administration',

View File

@ -14,12 +14,12 @@
* Defines a directive for creating navbar.
* @author Florent Benoit
*/
export class CheNavBar {
private replace: boolean;
private restrict: string;
private templateUrl: string;
private controller: string;
private controllerAs: string;
export class CheNavBar implements ng.IDirective {
replace: boolean;
restrict: string;
templateUrl: string;
controller: string;
controllerAs: string;
/**
* Default constructor that is using resource

View File

@ -26,7 +26,7 @@ export class NavbarNotificationController {
*/
constructor(applicationNotifications: ApplicationNotifications, $scope: ng.IScope) {
this.applicationNotifications = applicationNotifications;
$scope.$on("$mdMenuClose", () => {
$scope.$on('$mdMenuClose', () => {
this.removeReadNotifications();
});
}
@ -53,7 +53,7 @@ export class NavbarNotificationController {
*/
removeReadNotifications(): void {
let notificationsToRemove = [];
let notifications = this.applicationNotifications.getNotifications()
let notifications = this.applicationNotifications.getNotifications();
notifications.forEach((notification: any) => {
if (notification.removeOnRead) {
notificationsToRemove.push(notification);

View File

@ -16,21 +16,14 @@
* @description This class is handling the directive to handle the container with notifications
* @author Ann Shumilova
*/
export class NavbarNotification {
export class NavbarNotification implements ng.IDirective {
/**
* Default constructor that is using resource
* @ngInject for Dependency injection
*/
constructor() {
this.restrict = 'E';
this.bindToController = true;
this.templateUrl = 'app/navbar/notification/navbar-notification.html';
this.controller = 'NavbarNotificationController';
this.controllerAs = 'navbarNotificationController';
restrict = 'E';
bindToController = true;
templateUrl = 'app/navbar/notification/navbar-notification.html';
controller = 'NavbarNotificationController';
controllerAs = 'navbarNotificationController';
this.transclude = true;
}
transclude = true;
}

View File

@ -14,8 +14,6 @@ import {CheAPIBuilder} from '../../../components/api/builder/che-api-builder.fac
import {CheHttpBackend} from '../../../components/api/test/che-http-backend';
import IdeSvc from '../../ide/ide.service';
import {CheBranding} from '../../../components/branding/che-branding.factory';
import {IWorkspaceAttributes} from '../../../components/api/builder/che-workspace-builder';
/**
* Test of the NavbarRecentWorkspacesController
@ -68,7 +66,7 @@ describe('NavbarRecentWorkspacesController', () => {
let wrkspName = 'testName' + i;
let wrkspCreateDate = new Date(2001, 1, 1, i, 1).toString();
let wrkspUpdateDate = new Date(2001, 1, 1, i, 2).toString();
let wrkspAttr = {'created': Date.parse(wrkspCreateDate), 'updated': Date.parse(wrkspUpdateDate)} as IWorkspaceAttributes;
let wrkspAttr = <che.IWorkspaceAttributes>{'created': Date.parse(wrkspCreateDate), 'updated': Date.parse(wrkspUpdateDate)};
let workspace = apiBuilder.getWorkspaceBuilder().withId(wrkspId).withAttributes(wrkspAttr).withName(wrkspName).build();
workspaces.push(workspace);
}

View File

@ -16,7 +16,7 @@
* @description This class is handling the directive of the listing recent opened workspaces in the navbar
* @author Oleksii Kurinnyi
*/
export class NavbarRecentWorkspaces {
export class NavbarRecentWorkspaces implements ng.IDirective {
restrict: string;
templateUrl: string;
controller: string;

View File

@ -57,10 +57,6 @@ export class OrganizationSelectMembersDialogController {
* The list of users, that are available to be added
*/
private availableUsers: Array<IOrganizationMember>;
/**
* The list of users, that are going to be added
*/
private usersToAdd: Array<IOrganizationMember>;
/**
* Current user.
*/
@ -122,7 +118,7 @@ export class OrganizationSelectMembersDialogController {
map[member.id] = member;
return map;
}, {});
this.availableUsers = this.parentOrganizationMembers.filter((parentOrganizationMember: che.IUser) => {
this.availableUsers = <any>this.parentOrganizationMembers.filter((parentOrganizationMember: che.IUser) => {
return !existingMembers[parentOrganizationMember.id] && parentOrganizationMember.id !== this.user.id;
});

View File

@ -24,7 +24,7 @@ export class ProfileConfig {
};
// config routes
register.app.config(function ($routeProvider) {
register.app.config(function ($routeProvider: che.route.IRouteProvider) {
$routeProvider.accessWhen('/account', locationProvider);
});
}

View File

@ -33,10 +33,10 @@ export class ProfileController {
this.profileUrl = cheKeycloak.getProfileUrl();
let profile = cheProfile.getProfile();
this.firstName = <string>profile.attributes['firstName'];
this.lastName = <string>profile.attributes['lastName'];
this.firstName = <string>profile.attributes.firstName;
this.lastName = <string>profile.attributes.lastName;
this.email = profile.email;
this.userName = <string>profile.attributes['preferred_username'];
this.userName = <string>(profile.attributes as any).preferred_username;
}
/**

View File

@ -12,8 +12,8 @@
export class ProxySettingsConfig {
constructor(register) {
// Register this factory
constructor(register: che.IRegisterService) {
// register this factory
register.app.constant('proxySettings', '%CONTENT%');
}

View File

@ -14,7 +14,6 @@ import {ImportStackService} from '../../stack-details/import-stack.service';
import {CheStack} from '../../../../components/api/che-stack.factory';
import {IEnvironmentManagerMachine} from '../../../../components/api/environment/environment-manager-machine';
import {CheBranding} from '../../../../components/branding/che-branding.factory';
import {EnvironmentManager} from '../../../../components/api/environment/environment-manager';
import {CheRecipeTypes} from '../../../../components/api/recipe/che-recipe-types';
import {RecipeEditor} from './recipe-editor/recipe-editor';
import {CheWorkspace} from '../../../../components/api/workspace/che-workspace.factory';
@ -68,7 +67,7 @@ export class BuildStackController {
* It will hide the dialog box.
*/
cancel(): void {
this.importStackService.setStack({});
this.importStackService.setStack({} as che.IStack);
this.$mdDialog.cancel();
}

View File

@ -11,7 +11,6 @@
'use strict';
import {EnvironmentManager} from '../../../../../components/api/environment/environment-manager';
import {CheRecipeTypes} from '../../../../../components/api/recipe/che-recipe-types';
export class RecipeEditor {

View File

@ -18,11 +18,17 @@
*/
export class StackItemController {
$location: ng.ILocationService;
lodash: any;
stack: che.IStack;
/**
* Default constructor that is using resource
* @ngInject for Dependency injection
*/
constructor($location, lodash) {
constructor($location: ng.ILocationService,
lodash: any) {
this.$location = $location;
this.lodash = lodash;
}
@ -39,8 +45,8 @@ export class StackItemController {
* @param stack stack with components
* @returns {*}
*/
getComponents(stack) {
return this.lodash.map(stack.components, (component) => {
getComponents(stack: che.IStack) {
return this.lodash.map(stack.components, (component: any) => {
return component.name;
}).join(', ');
}

View File

@ -15,33 +15,28 @@
* Expects in parent scope:
* @param{object} stack
*/
export class StackItem {
export class StackItem implements ng.IDirective {
/**
* Default constructor.
*/
constructor() {
this.restrict = 'E';
restrict = 'E';
// we require ngModel as we want to use it inside our directive
this.require = ['ngModel'];
// we require ngModel as we want to use it inside our directive
require = ['ngModel'];
// scope values
this.scope = {
stack: '=stack',
userId: '=userId',
isSelectable: '=cheSelectable',
isSelect: '=?ngModel',
onCheckboxClick: '&?cheOnCheckboxClick',
onDelete: '&cheOnDelete',
onDuplicate: '&cheOnDuplicate'
};
// scope values
scope = {
stack: '=stack',
userId: '=userId',
isSelectable: '=cheSelectable',
isSelect: '=?ngModel',
onCheckboxClick: '&?cheOnCheckboxClick',
onDelete: '&cheOnDelete',
onDuplicate: '&cheOnDuplicate'
};
this.templateUrl = 'app/stacks/list-stacks/stack-item/stack-item.html';
templateUrl = 'app/stacks/list-stacks/stack-item/stack-item.html';
this.controller = 'StackItemController';
this.controllerAs = 'stackItemController';
this.bindToController = true;
}
controller = 'StackItemController';
controllerAs = 'stackItemController';
bindToController = true;
}

View File

@ -18,7 +18,7 @@ import {StackValidationService} from './stack-validation.service';
*/
export class ImportStackService {
private stackValidationService: StackValidationService;
private stack: che.IStack | {};
private stack: che.IStack;
/**
@ -28,7 +28,7 @@ export class ImportStackService {
constructor(stackValidationService: StackValidationService) {
this.stackValidationService = stackValidationService;
this.stack = {};
this.stack = {} as che.IStack;
}
/**
@ -36,7 +36,7 @@ export class ImportStackService {
*
* @param stack {che.IStack}
*/
setStack(stack: che.IStack | {}): void {
setStack(stack: che.IStack): void {
this.stack = stack;
}
@ -45,7 +45,7 @@ export class ImportStackService {
*
* @returns {che.IStack}
*/
getStack(): che.IStack | {} {
getStack(): che.IStack {
return this.stack;
}

View File

@ -20,7 +20,7 @@ import {StackController} from '../stack.controller';
*/
export class SelectTemplateController {
stack: che.IStack;
selectedTemplates: Array<che.IProject>;
selectedTemplates: Array<che.IProjectTemplate>;
projectsOrderBy: string;
private $mdDialog: ng.material.IDialogService;
@ -53,10 +53,10 @@ export class SelectTemplateController {
/**
* Helper method used to get the length of keys of the given object
* @param projectTemplate {che.IProject}
* @param projectTemplate {che.IProjectTemplate}
* @param isAdd {boolean}
*/
updateSelectedTemplates(projectTemplate: che.IProject, isAdd: boolean): void {
updateSelectedTemplates(projectTemplate: che.IProjectTemplate, isAdd: boolean): void {
if (isAdd) {
this.selectedTemplates.push(projectTemplate);
} else {

View File

@ -302,7 +302,8 @@ export class StackController {
this.createStack();
return;
}
this.cheStack.updateStack(this.stack.id, this.stackJson).then((stack: any) => {
const stack = angular.fromJson(this.stackJson);
this.cheStack.updateStack(this.stack.id, stack).then((stack: any) => {
this.cheNotification.showInfo('Stack is successfully updated.');
this.isLoading = false;
this.stack = stack;
@ -320,7 +321,8 @@ export class StackController {
* Creates new stack.
*/
createStack(): void {
this.cheStack.createStack(this.stackJson).then((stack: any) => {
const stack = angular.fromJson(this.stackJson);
this.cheStack.createStack(stack).then((stack: any) => {
this.stack = stack;
this.isLoading = false;
this.cheStack.fetchStacks();
@ -380,11 +382,11 @@ export class StackController {
/**
* Update projects sequentially by iterating on the number of the projects.
* @param workspaceId{string} - the ID of the workspace to use for adding commands
* @param projects{Array<any>} - the array to follow
* @param projects{Array<IProjectTemplate>} - the array to follow
* @param index{number} - the index of the array of commands
* @param deferred{ng.IDeferred<any>}
*/
updateProjects(workspaceId: string, projects: Array<che.IProject>, index: number, deferred: ng.IDeferred<any>): void {
updateProjects(workspaceId: string, projects: Array<che.IProjectTemplate>, index: number, deferred: ng.IDeferred<any>): void {
if (index < projects.length) {
let project = projects[index];
let projectTypeResolverService = this.cheWorkspace.getWorkspaceAgent(workspaceId).getProjectTypeResolver();
@ -406,12 +408,12 @@ export class StackController {
/**
* Add projects.
* @param workspaceId{string} - the ID of the workspace to use for adding projects
* @param projects{Array<che.IProject>} - the adding projects
* @param projects{Array<che.IProjectTemplate>} - the adding projects
* @param deferred{ng.IDeferred<any>}
*
* @returns {ng.IPromise<any>}
*/
addProjects(workspaceId: string, projects: Array<che.IProject>, deferred: ng.IDeferred<any>): void {
addProjects(workspaceId: string, projects: Array<che.IProjectTemplate>, deferred: ng.IDeferred<any>): void {
if (projects && projects.length) {
let workspaceAgent = this.cheWorkspace.getWorkspaceAgent(workspaceId);
workspaceAgent.getProject().createProjects(projects).then(() => {
@ -427,9 +429,9 @@ export class StackController {
/**
* Show popup for stack's testing
* @param stack {che.IStack}
* @param projects {Array<che.IProject>}
* @param projects {Array<che.IProjectTemplate>}
*/
showStackTestPopup(stack: che.IStack, projects: Array<che.IProject>): void {
showStackTestPopup(stack: che.IStack, projects: Array<che.IProjectTemplate>): void {
this.showIDE = false;
stack.workspaceConfig.projects = [];
let deferred = this.$q.defer();

View File

@ -107,7 +107,7 @@ export class ListMembersController {
* Handler for value changed in the list.
* @param member
*/
onValueChanged(member): void {
onValueChanged(member: any): void {
member.roles = [angular.fromJson(member.role)];
}

View File

@ -38,6 +38,4 @@ export class ListMembers implements ng.IDirective {
owner: '='
};
constructor () {
}
}

View File

@ -10,6 +10,10 @@
*/
'use strict';
import {TeamDetailsService} from '../team-details.service';
import {ConfirmDialogService} from '../../../../components/service/confirm-dialog/confirm-dialog.service';
import {CheNotification} from '../../../../components/notification/che-notification.factory';
import {CheProfile} from '../../../../components/api/che-profile.factory';
import {CheUser} from '../../../../components/api/che-user.factory';
/**
* @ngdoc controller
@ -22,6 +26,10 @@ export class ListTeamMembersController {
* Location service.
*/
$location: ng.ILocationService;
/**
* Selection and filtration helper
*/
cheListHelper: che.widget.ICheListHelper;
/**
* Team API interaction.
@ -34,11 +42,11 @@ export class ListTeamMembersController {
/**
* User API interaction.
*/
private cheUser: any;
private cheUser: CheUser;
/**
* User profile API interaction.
*/
private cheProfile: any;
private cheProfile: CheProfile;
/**
* Permissions API interaction.
*/
@ -50,11 +58,11 @@ export class ListTeamMembersController {
/**
* Notifications service.
*/
private cheNotification: any;
private cheNotification: CheNotification;
/**
* Confirm dialog service.
*/
private confirmDialogService: any;
private confirmDialogService: ConfirmDialogService;
/**
* Promises service.
*/
@ -87,19 +95,25 @@ export class ListTeamMembersController {
* The editable (whether current user can edit members list and see invitations) state of the members (comes from outside).
*/
private editable: any;
/**
* Selection and filtration helper
*/
cheListHelper: che.widget.ICheListHelper;
/**
* Default constructor that is using resource
* @ngInject for Dependency injection
*/
constructor(cheTeam: che.api.ICheTeam, chePermissions: che.api.IChePermissions, cheInvite: che.api.ICheInvite, cheUser: any, cheProfile: any,
confirmDialogService: any, $mdDialog: angular.material.IDialogService, $q: ng.IQService, cheNotification: any,
lodash: any, $location: ng.ILocationService, teamDetailsService: TeamDetailsService,
$scope: ng.IScope, cheListHelperFactory: che.widget.ICheListHelperFactory) {
constructor(cheTeam: che.api.ICheTeam,
chePermissions: che.api.IChePermissions,
cheInvite: che.api.ICheInvite,
cheUser: CheUser,
cheProfile: CheProfile,
confirmDialogService: ConfirmDialogService,
$mdDialog: angular.material.IDialogService,
$q: ng.IQService,
cheNotification: CheNotification,
lodash: any,
$location: ng.ILocationService,
teamDetailsService: TeamDetailsService,
$scope: ng.IScope,
cheListHelperFactory: che.widget.ICheListHelperFactory) {
this.cheTeam = cheTeam;
this.cheInvite = cheInvite;
this.chePermissions = chePermissions;

View File

@ -98,7 +98,7 @@ export class MemberItemController {
let roles = this.cheTeam.getRolesFromActions(this.member.permissions.actions);
let titles = [];
let processedActions = []
let processedActions = [];
roles.forEach((role: any) => {
titles.push(role.title);
processedActions = processedActions.concat(role.actions);

View File

@ -34,6 +34,4 @@ export class MemberItem implements ng.IDirective {
isOwner: '=isOwner'
};
constructor() {
}
}

View File

@ -39,7 +39,9 @@ export class AddImportProjectController {
* Callback to check uniqueness of project name.
* Provided by parent controller.
*/
/* tslint:disable */
private isProjectNameUnique: (data: {name: string}) => boolean;
/* tslint:enable */
/**
* Callback provided by parent controller.
*/

View File

@ -25,7 +25,9 @@ export class EditProjectController {
* Callback to check uniqueness of project name.
* Provided by parent controller.
*/
/* tslint:disable */
private isProjectNameUnique: (data: {name: string}) => boolean;
/* tslint:enable */
/**
* Callback which should be called for changes to be saved.
* Provided by parent controller.

View File

@ -41,7 +41,9 @@ export class ProjectMetadataController {
* Original template name provided from parent controller.
* Provided by parent controller.
*/
/* tslint:disable */
private templateName: string;
/* tslint:enable */
/**
* Callback to check uniqueness of project name.
* Provided by parent controller.

View File

@ -24,7 +24,7 @@ interface IUsageChartScope extends ng.IScope {
* Defines a directive for displaying usage of resource: chart + description.
* @author Ann Shumilova
*/
export class UsageChart {
export class UsageChart implements ng.IDirective {
restrict: string;
templateUrl: string;
replace: boolean;
@ -54,28 +54,28 @@ export class UsageChart {
}
link($scope: IUsageChartScope, element: ng.IAugmentedJQuery, attrs: any): void {
link($scope: IUsageChartScope, $element: ng.IAugmentedJQuery, $attrs: ng.IAttributes): void {
if ($scope.usedColor) {
element.find('.usage-chart-used-value').css('color', $scope.usedColor);
element.find('.usage-chart-label').css('color', $scope.usedColor);
$element.find('.usage-chart-used-value').css('color', $scope.usedColor);
$element.find('.usage-chart-label').css('color', $scope.usedColor);
}
$scope.$watch(function () {
return element.is(':visible');
return $element.is(':visible');
}, function () {
if (element.is(':visible')) {
if ($element.is(':visible')) {
$scope.loaded = true;
}
});
let t = this;
attrs.$observe('cheUsed', function () {
$attrs.$observe('cheUsed', function () {
if ($scope.used && $scope.provided) {
t.initChart($scope);
}
});
attrs.$observe('cheProvided', function () {
$attrs.$observe('cheProvided', function () {
if ($scope.used && $scope.provided) {
t.initChart($scope);
}
@ -92,9 +92,9 @@ export class UsageChart {
$scope.config = {
tooltips: true,
labels: false,
mouseover: () => {},
mouseout: () => {},
click: () => {},
// mouseover: () => {},
// mouseout: () => {},
// click: () => {},
legend: {
display: false,
position: 'right'

View File

@ -27,7 +27,9 @@ export class AddDeveloperController {
/**
* true if user owns the workspace.
*/
/* tslint:disable */
private canShare: boolean;
/* tslint:enable */
/**
* List of users to share the workspace.
*/

View File

@ -95,8 +95,24 @@ export class ShareWorkspaceController {
* Default constructor that is using resource
* @ngInject for Dependency injection
*/
constructor(cheWorkspace: CheWorkspace, cheUser: CheUser, chePermissions: che.api.IChePermissions, cheNotification: CheNotification, $mdDialog: ng.material.IDialogService, $document: ng.IDocumentService, $mdConstant: any, $route: ng.route.IRouteService, $q: ng.IQService, lodash: any, confirmDialogService: ConfirmDialogService, cheTeam: che.api.ICheTeam, $log: ng.ILogService, $scope: ng.IScope, cheListHelperFactory: che.widget.ICheListHelperFactory) {
constructor(cheWorkspace: CheWorkspace,
cheUser: CheUser,
chePermissions: che.api.IChePermissions,
cheNotification: CheNotification,
$mdDialog: ng.material.IDialogService,
$document: ng.IDocumentService,
$mdConstant: any,
$route: ng.route.IRouteService,
$q: ng.IQService,
lodash: any,
confirmDialogService: ConfirmDialogService,
cheTeam: che.api.ICheTeam,
$log: ng.ILogService,
$scope: ng.IScope,
cheListHelperFactory: che.widget.ICheListHelperFactory) {
/* tslint:disable */
'ngInject';
/* tslint:enable */
this.cheWorkspace = cheWorkspace;
this.cheUser = cheUser;

View File

@ -24,7 +24,7 @@ interface IEnvironmentVariable {
*/
export class ListEnvVariablesController {
$mdDialog: ng.material.IDialogService;
lodash: _.LoDashStatic;
lodash: any;
isNoSelected: boolean = true;
isBulkChecked: boolean = false;
@ -46,7 +46,9 @@ export class ListEnvVariablesController {
* Default constructor that is using resource
* @ngInject for Dependency injection
*/
constructor($mdDialog: ng.material.IDialogService, lodash: _.LoDashStatic, confirmDialogService: ConfirmDialogService) {
constructor($mdDialog: ng.material.IDialogService,
lodash: any,
confirmDialogService: ConfirmDialogService) {
this.$mdDialog = $mdDialog;
this.lodash = lodash;
this.confirmDialogService = confirmDialogService;

View File

@ -20,7 +20,7 @@ import {IEnvironmentManagerMachineServer} from '../../../../../../components/api
*/
export class EditServerDialogController {
$mdDialog: ng.material.IDialogService;
lodash: _.LoDashStatic;
lodash: any;
popupTitle: string;
@ -44,7 +44,8 @@ export class EditServerDialogController {
* Default constructor that is using resource
* @ngInject for Dependency injection
*/
constructor($mdDialog: ng.material.IDialogService, lodash: _.LoDashStatic) {
constructor($mdDialog: ng.material.IDialogService,
lodash: any) {
this.$mdDialog = $mdDialog;
this.lodash = lodash;

View File

@ -24,7 +24,7 @@ interface IServerListItem extends IEnvironmentManagerMachineServer {
*/
export class ListServersController {
$mdDialog: ng.material.IDialogService;
lodash: _.LoDashStatic;
lodash: any;
isNoSelected: boolean = true;
isBulkChecked: boolean = false;
@ -46,7 +46,9 @@ export class ListServersController {
* Default constructor that is using resource
* @ngInject for Dependency injection
*/
constructor($mdDialog: ng.material.IDialogService, lodash: _.LoDashStatic, confirmDialogService: ConfirmDialogService) {
constructor($mdDialog: ng.material.IDialogService,
lodash: any,
confirmDialogService: ConfirmDialogService) {
this.$mdDialog = $mdDialog;
this.lodash = lodash;
this.confirmDialogService = confirmDialogService;

View File

@ -27,7 +27,7 @@ export class WorkspaceMachineConfigController {
$mdDialog: ng.material.IDialogService;
$q: ng.IQService;
$timeout: ng.ITimeoutService;
lodash: _.LoDashStatic;
lodash: any;
timeoutPromise;
@ -52,7 +52,12 @@ export class WorkspaceMachineConfigController {
* Default constructor that is using resource injection
* @ngInject for Dependency injection
*/
constructor($mdDialog: ng.material.IDialogService, $q: ng.IQService, $scope: ng.IScope, $timeout: ng.ITimeoutService, lodash: _.LoDashStatic, confirmDialogService: ConfirmDialogService) {
constructor($mdDialog: ng.material.IDialogService,
$q: ng.IQService,
$scope: ng.IScope,
$timeout: ng.ITimeoutService,
lodash: any,
confirmDialogService: ConfirmDialogService) {
this.$mdDialog = $mdDialog;
this.$q = $q;
this.$timeout = $timeout;

View File

@ -24,7 +24,7 @@
*
* @author Oleksii Kurinnyi
*/
export class WorkspaceMachineConfig {
export class WorkspaceMachineConfig implements ng.IDirective {
restrict = 'E';
templateUrl = 'app/workspaces/workspace-details/environments/machine-config/machine-config.html';
@ -43,10 +43,5 @@ export class WorkspaceMachineConfig {
machineIsOpened: '='
};
/**
* Default constructor that is using resource
* @ngInject for Dependency injection
*/
constructor () { }
}

View File

@ -26,7 +26,7 @@ export class ExportWorkspaceDialogController {
private $mdDialog: ng.material.IDialogService;
private cheRemote: CheRemote;
private $window: ng.IWindowService;
private lodash: _.LoDashStatic;
private lodash: any;
private editorOptions: any;
private destination: string;
@ -45,9 +45,15 @@ export class ExportWorkspaceDialogController {
* Default constructor that is using resource
* @ngInject for Dependency injection
*/
constructor($q: ng.IQService, $filter: ng.IFilterService, lodash: _.LoDashStatic, cheRemote: CheRemote,
cheNotification: CheNotification, $mdDialog: ng.material.IDialogService, $log: ng.ILogService,
$window: ng.IWindowService, $scope: ng.IScope) {
constructor($q: ng.IQService,
$filter: ng.IFilterService,
lodash: any,
cheRemote: CheRemote,
cheNotification: CheNotification,
$mdDialog: ng.material.IDialogService,
$log: ng.ILogService,
$window: ng.IWindowService,
$scope: ng.IScope) {
this.$q = $q;
this.$filter = $filter;
this.lodash = lodash;
@ -72,7 +78,7 @@ export class ExportWorkspaceDialogController {
this.copyOfConfig = this.getCopyOfConfig();
this.exportConfigContent = this.$filter('json')(angular.fromJson(this.copyOfConfig), 2);
$scope.selectedIndex = this.destination === 'file' ? 0 : 1;
($scope as any).selectedIndex = this.destination === 'file' ? 0 : 1;
}
/**
@ -101,7 +107,7 @@ export class ExportWorkspaceDialogController {
removeLinks(object: any) {
delete object.links;
return this.lodash.forEach(object, (value) => {
return this.lodash.forEach(object, (value: any) => {
if (angular.isObject(value)) {
return this.removeLinks(value);
} else {

View File

@ -18,15 +18,20 @@
*/
export class ExportWorkspaceController {
$mdDialog: ng.material.IDialogService;
workspaceId: string;
workspaceDetails: che.IWorkspace;
/**
* Default constructor that is using resource
* @ngInject for Dependency injection
*/
constructor($mdDialog) {
constructor($mdDialog: ng.material.IDialogService) {
this.$mdDialog = $mdDialog;
}
showExport($event, destination) {
showExport($event: MouseEvent, destination: string) {
this.$mdDialog.show({
targetEvent: $event,
controller: 'ExportWorkspaceDialogController',

View File

@ -24,26 +24,20 @@
*
* @author Florent Benoit
*/
export class ExportWorkspace {
export class ExportWorkspace implements ng.IDirective {
/**
* Default constructor that is using resource
* @ngInject for Dependency injection
*/
constructor () {
this.restrict = 'E';
this.templateUrl = 'app/workspaces/workspace-details/export-workspace/export-workspace.html';
restrict = 'E';
templateUrl = 'app/workspaces/workspace-details/export-workspace/export-workspace.html';
this.controller = 'ExportWorkspaceController';
this.controllerAs = 'exportWorkspaceCtrl';
this.bindToController = true;
controller = 'ExportWorkspaceController';
controllerAs = 'exportWorkspaceCtrl';
bindToController = true;
// scope values
this.scope = {
workspaceId: '@workspaceId',
workspaceDetails: '=workspaceDetails',
workspaceExportDisabled: '='
};
}
// scope values
scope = {
workspaceId: '@workspaceId',
workspaceDetails: '=workspaceDetails',
workspaceExportDisabled: '='
};
}

View File

@ -20,7 +20,7 @@ import {CheBranding} from '../../../../../components/branding/che-branding.facto
export class ReadyToGoStacksController {
private $scope: ng.IScope;
private lodash: _.LoDashStatic;
private lodash: any;
private tabName: string;
private selectedStackId: string;
private allStackTags: Array<any> = [];
@ -35,7 +35,10 @@ export class ReadyToGoStacksController {
* Default constructor that is using resource
* @ngInject for Dependency injection
*/
constructor($scope: ng.IScope, lodash: _.LoDashStatic, cheStack: CheStack, cheBranding: CheBranding) {
constructor($scope: ng.IScope,
lodash: any,
cheStack: CheStack,
cheBranding: CheBranding) {
this.$scope = $scope;
this.lodash = lodash;
this.priorityStacks = cheBranding.getWorkspace().priorityStacks;

View File

@ -24,24 +24,18 @@
*
* @author Florent Benoit
*/
export class ReadyToGoStacks {
export class ReadyToGoStacks implements ng.IDirective {
/**
* Default constructor that is using resource
* @ngInject for Dependency injection
*/
constructor() {
this.restrict = 'E';
this.templateUrl = 'app/workspaces/workspace-details/select-stack/ready-to-go-stacks/ready-to-go-stacks.html';
restrict = 'E';
templateUrl = 'app/workspaces/workspace-details/select-stack/ready-to-go-stacks/ready-to-go-stacks.html';
this.controller = 'ReadyToGoStacksController';
this.controllerAs = 'readyToGoStacksCtrl';
this.bindToController = true;
controller = 'ReadyToGoStacksController';
controllerAs = 'readyToGoStacksCtrl';
bindToController = true;
// scope values
this.scope = {
tabName: '@cheTabName'
};
}
// scope values
scope = {
tabName: '@cheTabName'
};
}

View File

@ -19,7 +19,7 @@ import {CheStack} from '../../../../../components/api/che-stack.factory';
export class CreateProjectStackLibraryController {
private $scope: ng.IScope;
private lodash: _.LoDashStatic;
private lodash: any;
private tabName: string;
private selectedStackId: string;
private allStackTags: Array<string> = [];
@ -30,7 +30,9 @@ export class CreateProjectStackLibraryController {
* Default constructor that is using resource
* @ngInject for Dependency injection
*/
constructor($scope: ng.IScope, cheStack: CheStack, lodash: _.LoDashStatic) {
constructor($scope: ng.IScope,
cheStack: CheStack,
lodash: any) {
this.$scope = $scope;
this.lodash = lodash;
@ -43,7 +45,7 @@ export class CreateProjectStackLibraryController {
});
}
$scope.$on('event:library:selectStackId', (event, data) => {
$scope.$on('event:library:selectStackId', (event: ng.IAngularEvent, data: string) => {
this.setStackSelectionById(data);
});
}

View File

@ -21,25 +21,18 @@
*
* @author Florent Benoit
*/
export class CreateProjectStackLibrary {
export class CreateProjectStackLibrary implements ng.IDirective {
/**
* Default constructor that is using resource
* @ngInject for Dependency injection
*/
constructor() {
this.restrict = 'E';
this.templateUrl = 'app/workspaces/workspace-details/select-stack/stack-library/create-project-stack-library.html';
restrict = 'E';
templateUrl = 'app/workspaces/workspace-details/select-stack/stack-library/create-project-stack-library.html';
this.controller = 'CreateProjectStackLibraryController';
this.controllerAs = 'createProjectStackLibraryCtrl';
this.bindToController = true;
controller = 'CreateProjectStackLibraryController';
controllerAs = 'createProjectStackLibraryCtrl';
bindToController = true;
// scope values
this.scope = {
tabName: '@cheTabName'
};
}
// scope values
scope = {
tabName: '@cheTabName'
};
}

View File

@ -16,14 +16,14 @@
* @description This class is handling the directive for the container with warnings
* @author Ann Shumilova
*/
export class WorkspaceWarnings {
private restrict: string;
private bindToController:boolean;
private templateUrl: string;
private controller: string;
private controllerAs: string;
private transclude: boolean;
private scope: {
export class WorkspaceWarnings implements ng.IDirective {
restrict: string;
bindToController: boolean;
templateUrl: string;
controller: string;
controllerAs: string;
transclude: boolean;
scope: {
[propName: string]: string
};
@ -41,7 +41,7 @@ export class WorkspaceWarnings {
this.transclude = true;
this.scope = {
workspace: '=workspace'
}
};
}
}

View File

@ -210,21 +210,10 @@ export class EditMachineDialogController {
this.$mdDialog.hide();
}
/**
* Stringify machine recipe.
*/
private stringifyMachineRecipe(): void {
try {
this.machineRecipeScript = this.environmentManager.stringifyRecipe(this.machine.recipe);
} catch (e) {
this.$log.error('Cannot parse machine\'s recipe, error: ', e);
}
}
/**
* Parse machine recipe.
*/
private parseMachineRecipe(): void {
parseMachineRecipe(): void {
try {
this.machine.recipe = this.environmentManager.parseMachineRecipe(this.machineRecipeScript);
// checks critical recipe changes
@ -249,6 +238,17 @@ export class EditMachineDialogController {
}
}
/**
* Stringify machine recipe.
*/
private stringifyMachineRecipe(): void {
try {
this.machineRecipeScript = this.environmentManager.stringifyRecipe(this.machine.recipe);
} catch (e) {
this.$log.error('Cannot parse machine\'s recipe, error: ', e);
}
}
/**
* Gets full name.
* @param {string} name

View File

@ -25,7 +25,9 @@ export class AddProjectPopoverController {
* Callback to check uniqueness of project name.
* Provided by parent controller.
*/
/* tslint:disable */
private isProjectNameUnique: (data: {name: string}) => boolean;
/* tslint:enable */
/**
* Callback which is called when project templates are added to the list of ready-to-import projects.
* Provided by parent controller.

View File

@ -231,7 +231,7 @@ export class ProjectDetailsController {
this.cheAPI.getWorkspace().fetchWorkspaceDetails(this.workspace.namespace + ':' + this.workspace.config.name).finally(() => {
this.$location.path('/workspace/' + this.workspace.namespace + '/' + this.workspace.config.name).search({tab: 'Projects'});
});
}, (error) => {
}, (error: any) => {
this.$log.log('error', error);
});
});
@ -243,7 +243,9 @@ export class ProjectDetailsController {
*/
getWorkspaceProjects(): Array<che.IProject> {
let projects = this.cheAPI.getWorkspace().getWorkspaceProjects()[this.workspace.id];
let _projects = this.lodash.filter(projects, (project) => { return project.name !== this.projectName});
let _projects = this.lodash.filter(projects, (project: che.IProject) => {
return project.name !== this.projectName;
});
return _projects;
}

View File

@ -70,7 +70,7 @@ export class ProjectRepositoryController {
}
if (projectDetails.mixins.indexOf(subversionMixinId) !== -1) {
//update remote svn url
// update remote svn url
if (!this.wsagent.getSvn().getRemoteUrlByKey(projectDetails.workspaceId, projectDetails.path)) {
const promise = this.wsagent.getSvn().fetchRemoteUrl(projectDetails.workspaceId, projectDetails.path);
@ -83,7 +83,7 @@ export class ProjectRepositoryController {
}
if (projectDetails.mixins.indexOf(gitMixinId) !== -1) {
//update git local url
// update git local url
if (!this.wsagent.getGit().getLocalUrlByKey(projectDetails.path)) {
const promise = this.wsagent.getGit().fetchLocalUrl(projectDetails.path);
@ -94,7 +94,7 @@ export class ProjectRepositoryController {
this.localGitRepository = this.wsagent.getGit().getLocalUrlByKey(projectDetails.path);
}
//update git remote urls
// update git remote urls
if (!this.wsagent.getGit().getRemoteUrlArrayByKey(projectDetails.path)) {
const promise = this.wsagent.getGit().fetchRemoteUrlArray(projectDetails.path);

View File

@ -72,7 +72,13 @@ export class WorkspaceDetailsSshCtrl {
* Default constructor that is using resource
* @ngInject for Dependency injection
*/
constructor($route : ng.route.IRouteService, cheSsh: CheSsh, cheWorkspace: CheWorkspace, cheNotification, $mdDialog : ng.material.IDialogService, $log : ng.ILogService, $q : ng.IQService, $timeout : ng.ITimeoutService) {
constructor($route: ng.route.IRouteService,
cheSsh: CheSsh,
cheWorkspace: CheWorkspace,
cheNotification: CheNotification,
$mdDialog: ng.material.IDialogService,
$log: ng.ILogService,
$q: ng.IQService) {
this.cheWorkspace = cheWorkspace;
this.cheSsh = cheSsh;
this.cheNotification = cheNotification;
@ -80,7 +86,7 @@ export class WorkspaceDetailsSshCtrl {
this.$log = $log;
this.$q = $q;
this.machineSshAgents = new Array<>();
this.machineSshAgents = [];
this.namespace = $route.current.params.namespace;
this.workspaceName = $route.current.params.workspaceName;
this.workspaceKey = this.namespace + ':' + this.workspaceName;
@ -121,15 +127,22 @@ export class WorkspaceDetailsSshCtrl {
*/
removeDefaultKey() {
this.cheSsh.removeKey('workspace', this.workspaceId).then(
() => {this.$timeout( this.updateData(), 3000)}
);
() => {
this.$timeout(() => {
this.updateData();
}, 3000);
});
}
/**
* Generate a new default workspace keypair
*/
generateDefaultKey() {
this.cheSsh.generateKey('workspace', this.workspaceId).then(() => {this.$timeout( this.updateData(), 3000)});
this.cheSsh.generateKey('workspace', this.workspaceId).then(() => {
this.$timeout(() => {
this.updateData();
}, 3000);
});
}

View File

@ -24,8 +24,7 @@
*
* @author Florent Benoit
*/
export class WorkspaceDetailsSsh {
export class WorkspaceDetailsSsh implements ng.IDirective {
restrict: string = 'E';
templateUrl: string = 'app/workspaces/workspace-details/workspace-ssh/workspace-details-ssh.html';
@ -34,13 +33,4 @@ export class WorkspaceDetailsSsh {
controllerAs: string = 'workspaceDetailsSshCtrl';
bindToController: boolean = true;
/**
* Default constructor that is using resource
* @ngInject for Dependency injection
*/
constructor () {
}
}

View File

@ -26,7 +26,9 @@ export class CheWorkspaceRamAllocationSliderController {
* @ngInject for Dependency injection
*/
constructor ($timeout: ng.ITimeoutService, $scope: ng.IScope) {
"ngInject";
/* tslint:disable */
'ngInject';
/* tslint:enable */
this.$timeout = $timeout;
$scope.$watch(() => {

View File

@ -15,30 +15,25 @@
* It will change upon width of the screen
* @author Oleksii Kurinnyi
*/
export class CheWorkspaceRamAllocationSlider {
export class CheWorkspaceRamAllocationSlider implements ng.IDirective {
/**
* Default constructor that is using resource
* @ngInject for Dependency injection
*/
constructor () {
this.restrict = 'E';
restrict = 'E';
this.replace = true;
this.templateUrl = 'app/workspaces/workspace-ram-slider/che-workspace-ram-allocation-slider.html';
replace = true;
templateUrl = 'app/workspaces/workspace-ram-slider/che-workspace-ram-allocation-slider.html';
// we require ngModel as we want to use it inside our directive
this.require = 'ngModel';
// we require ngModel as we want to use it inside our directive
require = 'ngModel';
this.bindToController = true;
bindToController = true;
this.controller = 'CheWorkspaceRamAllocationSliderController';
this.controllerAs = 'cheWorkspaceRamAllocationSliderController';
controller = 'CheWorkspaceRamAllocationSliderController';
controllerAs = 'cheWorkspaceRamAllocationSliderController';
// scope values
scope = {
ngModel: '=',
cheOnChange: '&'
};
// scope values
this.scope = {
ngModel: '=',
cheOnChange: '&'
};
}
}

View File

@ -14,7 +14,7 @@
* Defines a directive for creating simple indicator of workspace's status.
* @author Oleksii Kurinnyi
*/
export class WorkspaceStatusIndicator {
export class WorkspaceStatusIndicator implements ng.IDirective {
restrict: string;
replace: boolean;
scope;
@ -35,12 +35,12 @@ export class WorkspaceStatusIndicator {
/**
* Template for the simple indicator of workspace's status
* @param element
* @param attr
* @param $element
* @param $attrs
* @returns {string} the template
*/
template (element, attr) {
let emptyCircleOnStopped = attr.cheEmptyCircle;
template ($element: ng.IAugmentedJQuery, $attrs: ng.IAttributes) {
let emptyCircleOnStopped = ($attrs as any).cheEmptyCircle;
return '<span ng-switch="status" class="workspace-status-indicator">' +
'<span ng-switch-when="STOPPED" class="fa ' + (emptyCircleOnStopped ? 'fa-circle-o' : 'fa-circle') + ' workspace-status-stopped"></span>' +

View File

@ -27,5 +27,4 @@ export class WorkspaceStatus implements ng.IDirective {
status: '=cheStatus',
isSupported: '=cheIsSupported'
};
}

View File

@ -11,12 +11,6 @@
'use strict';
import IWorkspaceEnvironment = che.IWorkspaceEnvironment;
export interface IWorkspaceAttributes {
created: number;
updated?: number;
[propName: string]: string | number;
}
/**
* This class is providing a builder for Workspace
* @author Florent Benoit
@ -44,7 +38,7 @@ export class CheWorkspaceBuilder {
return this;
}
withAttributes(attributes: IWorkspaceAttributes): CheWorkspaceBuilder {
withAttributes(attributes: che.IWorkspaceAttributes): CheWorkspaceBuilder {
this.workspace.attributes = attributes;
return this;
}

View File

@ -55,12 +55,12 @@ export class CheAgent {
// reset global list
this.agents.length = 0;
agents.forEach((agent: che.IAgent[]) => {
agents.forEach((agent: che.IAgent) => {
this.agents.push(agent);
});
defer.resolve(this.agents);
}, (error: any) => {
if (error.status != 304) {
if (error.status !== 304) {
defer.reject(error);
} else {
defer.resolve(this.agents);

View File

@ -14,6 +14,9 @@ import {IParser} from './parser';
export interface IComposeServiceRecipe {
image: string;
environment: any;
depends_on: any[];
links: any[];
[propName: string]: any;
}

View File

@ -285,19 +285,21 @@ declare namespace che {
temporary?: boolean;
status?: string;
namespace?: string;
attributes?: {
updated?: number;
created?: number;
stackId?: string;
errorMessage?: string;
[propName: string]: string | number;
};
attributes?: IWorkspaceAttributes;
config: IWorkspaceConfig;
runtime?: IWorkspaceRuntime;
isLocked?: boolean;
usedResources?: string;
}
export interface IWorkspaceAttributes {
created: number;
updated?: number;
stackId?: string;
errorMessage?: string;
[propName: string]: string | number;
}
export interface IWorkspaceConfig {
name?: string;
defaultEnv?: string;

View File

@ -6,7 +6,8 @@
"exclude": [
"node_modules",
"bower_components"
"bower_components",
"target"
]
}