forked from openshift/console
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
49 additions
and
24 deletions.
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
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
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
31 changes: 31 additions & 0 deletions
31
frontend/packages/kubevirt-plugin/src/utils/guest-agent-strings.ts
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,31 @@ | ||
import { | ||
GUEST_AGENT_REQUIRED_MESSAGE, | ||
NOT_AVAILABLE_MESSAGE, | ||
NO_LOGGED_IN_USERS_MSG, | ||
VM_NOT_RUNNING_MESSAGE, | ||
} from '../strings/vm/messages'; | ||
import { pluralize } from './strings'; | ||
import { VMStatus } from '../constants/vm/vm-status'; | ||
|
||
export const getNumLoggedInUsersMessage = (numLoggedInUsers: number | null) => { | ||
if (numLoggedInUsers == null) { | ||
return NOT_AVAILABLE_MESSAGE; | ||
} | ||
|
||
if (numLoggedInUsers === 0) { | ||
return NO_LOGGED_IN_USERS_MSG; | ||
} | ||
|
||
return `${numLoggedInUsers} ${pluralize(numLoggedInUsers, 'user')}`; | ||
}; | ||
|
||
export const getGuestAgentFieldNotAvailMsg = ( | ||
isGuestAgentInstalled: boolean, | ||
vmStatus: VMStatus, | ||
): string => { | ||
if (vmStatus !== VMStatus.RUNNING) { | ||
return VM_NOT_RUNNING_MESSAGE; | ||
} | ||
|
||
return isGuestAgentInstalled ? NOT_AVAILABLE_MESSAGE : GUEST_AGENT_REQUIRED_MESSAGE; | ||
}; |
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