Skip to content
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

Fix the list of workspaces in organization #14058

Merged
merged 1 commit into from
Aug 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class ListOrganizationWorkspacesController {
/**
* Workspace API interaction.
*/
private cheWorkspace: any;
private cheWorkspace: CheWorkspace;
/**
* Service for displaying notifications.
*/
Expand Down Expand Up @@ -226,7 +226,7 @@ export class ListOrganizationWorkspacesController {
this.cheListHelper.itemsSelectionStatus[workspaceId] = false;

let workspace = this.cheWorkspace.getWorkspaceById(workspaceId);
workspaceName = workspace.config.name;
workspaceName = this.getWorkspaceName(workspace);
let stoppedStatusPromise = this.cheWorkspace.fetchStatusChange(workspaceId, 'STOPPED');

// stop workspace if it's status is RUNNING
Expand Down Expand Up @@ -306,7 +306,7 @@ export class ListOrganizationWorkspacesController {
* @param tab {string}
*/
redirectToWorkspaceDetails(workspace: che.IWorkspace, tab?: string): void {
this.$location.path('/workspace/' + workspace.namespace + '/' + workspace.config.name).search({tab: tab ? tab : 'Overview'});
this.$location.path('/workspace/' + workspace.namespace + '/' + this.getWorkspaceName(workspace)).search({tab: tab ? tab : 'Overview'});
}

/**
Expand All @@ -315,6 +315,10 @@ export class ListOrganizationWorkspacesController {
* @returns {string}
*/
getMemoryLimit(workspace: che.IWorkspace): string {
if (!workspace.config && workspace.devfile) {
return '-';
}

const environment = workspace.config.environments[workspace.config.defaultEnv];
if (!environment) {
return '-';
Expand All @@ -341,4 +345,7 @@ export class ListOrganizationWorkspacesController {
return workspace && workspace.status ? workspace.status : 'unknown';
}

getWorkspaceName(workspace: che.IWorkspace): string {
return this.cheWorkspace.getWorkspaceDataManager().getName(workspace);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@
<che-list ng-show="listOrganizationWorkspacesController.cheListHelper.visibleItemsNumber > 0">
<che-list-item
ng-repeat="workspace in listOrganizationWorkspacesController.cheListHelper.getVisibleItems() | orderBy:[listOrganizationWorkspacesController.workspaceOrderBy, 'config.name']"
flex ng-mouseover="hover=true" ng-mouseout="hover=false">
flex ng-mouseover="hover=true" ng-mouseout="hover=false" ng-init="workspaceName = listOrganizationWorkspacesController.getWorkspaceName(workspace)">
<div flex="100"
id="ws-name-{{workspace.config.name}}"
id="ws-name-{{workspaceName}}"
data-ws-status="{{workspace.status}}"
layout="row"
layout-align="start stretch"
Expand All @@ -67,7 +67,7 @@
<che-list-item-checked
ng-model="listOrganizationWorkspacesController.cheListHelper.itemsSelectionStatus[workspace.id]"
ng-show="('RUNNING' === workspace.status || 'STOPPED' === workspace.status)"
che-aria-label-checkbox="Workspace {{workspace.config.name}}"
che-aria-label-checkbox="Workspace {{workspaceName}}"
ng-click="listOrganizationWorkspacesController.cheListHelper.updateBulkSelectionStatus()"></che-list-item-checked>
</div>
<div flex
Expand All @@ -83,11 +83,11 @@
<span class="che-xs-header noselect" hide-gt-xs>Name</span>
<div layout="row" flex>
<workspace-status-indicator flex="none" che-status="listOrganizationWorkspacesController.getWorkspaceStatus(workspace.id)"></workspace-status-indicator>
<div class="workspace-name-clip" id="ws-full-name-{{workspace.namespace}}/{{workspace.config.name}}">
<div class="workspace-name-clip" id="ws-full-name-{{workspace.namespace}}/{{workspaceName}}">
<span
uib-tooltip="{{'RUNNING' === workspace.status ? 'Running' : 'Last modified: ' + (workspace.attributes.updated | amTimeAgo)}}"
class="che-hover">
<che-clip-the-middle>{{workspace.namespace}}/{{workspace.config.name}}</che-clip-the-middle>
<che-clip-the-middle>{{workspace.namespace}}/{{workspaceName}}</che-clip-the-middle>
</span>
</div>
</div>
Expand Down Expand Up @@ -122,7 +122,7 @@
ng-if="listOrganizationWorkspacesController.isSupported(workspace) === true">
<che-workspace-status workspace-id="workspace.id"
name="workspace-stop-start-button"></che-workspace-status>
<a href="#/workspace/{{workspace.namespace}}/{{workspace.config.name}}?tab=Config"
<a href="#/workspace/{{workspace.namespace}}/{{workspaceName}}?tab=Config"
name="configure-workspace-button"
uib-tooltip="Configure workspace">
<span class="fa fa-cog"></span>
Expand Down