({
workspace,
template,
latestVersion,
permissions,
isUpdating,
isRestarting,
handleStart,
handleStop,
handleRestart,
handleUpdate,
handleCancel,
handleDormantActivate,
handleToggleFavorite,
handleRetry,
handleDebug,
})
| 62 | } |
| 63 | |
| 64 | export const WorkspaceTopbar: FC<WorkspaceTopbarProps> = ({ |
| 65 | workspace, |
| 66 | template, |
| 67 | latestVersion, |
| 68 | permissions, |
| 69 | isUpdating, |
| 70 | isRestarting, |
| 71 | handleStart, |
| 72 | handleStop, |
| 73 | handleRestart, |
| 74 | handleUpdate, |
| 75 | handleCancel, |
| 76 | handleDormantActivate, |
| 77 | handleToggleFavorite, |
| 78 | handleRetry, |
| 79 | handleDebug, |
| 80 | }) => { |
| 81 | const { entitlements, organizations, showOrganizations } = useDashboard(); |
| 82 | const getLink = useLinks(); |
| 83 | |
| 84 | // Quota |
| 85 | const hasDailyCost = workspace.latest_build.daily_cost > 0; |
| 86 | const { data: quota } = useQuery({ |
| 87 | ...workspaceQuota(workspace.organization_name, workspace.owner_name), |
| 88 | |
| 89 | // Don't need to tie the enabled condition to showOrganizations because |
| 90 | // even if the customer hasn't enabled the orgs enterprise feature, all |
| 91 | // workspaces have an associated organization under the hood |
| 92 | enabled: hasDailyCost, |
| 93 | }); |
| 94 | |
| 95 | // Dormant |
| 96 | const allowAdvancedScheduling = |
| 97 | entitlements.features.advanced_template_scheduling.enabled; |
| 98 | // This check can be removed when https://github.com/coder/coder/milestone/19 |
| 99 | // is merged up |
| 100 | const shouldDisplayDormantData = displayDormantDeletion( |
| 101 | workspace, |
| 102 | allowAdvancedScheduling, |
| 103 | ); |
| 104 | |
| 105 | const activeOrg = organizations.find( |
| 106 | (org) => org.id === workspace.organization_id, |
| 107 | ); |
| 108 | |
| 109 | const orgDisplayName = activeOrg?.display_name || workspace.organization_name; |
| 110 | |
| 111 | const isImmutable = |
| 112 | workspace.latest_build.status === "deleted" || |
| 113 | workspace.latest_build.status === "deleting"; |
| 114 | |
| 115 | const templateLink = getLink( |
| 116 | linkToTemplate(workspace.organization_name, workspace.template_name), |
| 117 | ); |
| 118 | |
| 119 | return ( |
| 120 | <Topbar className="[grid-area:topbar]"> |
| 121 | <Tooltip> |
nothing calls this directly
no test coverage detected