|
67 | 67 | return |
68 | 68 | } |
69 | 69 | linkNode.textContent = `${params.provider}/${params.organization}` |
70 | | - linkNode.href = `https://app.codacy.com/${encodeURIComponent(params.provider)}/${encodeURIComponent(params.organization)}` |
| 70 | + linkNode.href = `https://app.codacy.com/organizations/${encodeURIComponent(params.provider)}/${encodeURIComponent(params.organization)}` |
71 | 71 | break |
72 | 72 | case 'repository': |
73 | 73 | if (!params.provider || !params.organization || !params.repository) { |
|
177 | 177 | */ |
178 | 178 | function handleLoginStateChange(loggedIn, isOrgInCodacy, isRepoInCodacy, userInfo, organizationInfo, repositoryInfo) { |
179 | 179 | const upgradeBox = document.getElementById('upgrade-box') |
| 180 | + const upgradeButton = document.getElementById('upgrade-button') |
180 | 181 | /** @type {HTMLImageElement | null} */ |
181 | 182 | const cloudIcon = /** @type {HTMLImageElement | null} */ (document.getElementById('cloud-icon')) |
182 | 183 | const cloudDescription = document.getElementById('cloud-description') |
|
193 | 194 | const userName = escapeHtml(userInfo?.name) |
194 | 195 | const organizationProvider = escapeHtml(organizationInfo?.provider) |
195 | 196 |
|
196 | | - if (upgradeBox) { |
197 | | - upgradeBox.style.display = 'none' |
198 | | - } |
199 | 197 | if ( |
200 | 198 | cloudIcon && |
201 | 199 | iconUris && |
202 | 200 | cloudDescription && |
203 | 201 | connectToCodacyButton && |
204 | 202 | addOrgButton && |
205 | 203 | addRepoButton && |
206 | | - noOrgDescription |
| 204 | + noOrgDescription && |
| 205 | + upgradeBox && |
| 206 | + upgradeButton |
207 | 207 | ) { |
208 | 208 | connectToCodacyButton.style.display = 'none' |
209 | 209 | cloudIcon.src = iconUris.finished |
210 | 210 | if (isOrgInCodacy && isRepoInCodacy) { |
211 | 211 | addOrgButton.style.display = 'none' |
212 | 212 | addRepoButton.style.display = 'none' |
213 | 213 | noOrgDescription.style.display = 'none' |
| 214 | + if (organizationInfo.billing === 'premium') { |
| 215 | + upgradeBox.style.display = 'none' |
| 216 | + } else { |
| 217 | + upgradeBox.style.display = 'block' |
| 218 | + upgradeButton.setAttribute( |
| 219 | + 'href', |
| 220 | + `https://app.codacy.com/organizations/${encodeURIComponent(organizationProvider)}/${encodeURIComponent(organizationName)}/settings/billing` |
| 221 | + ) |
| 222 | + } |
214 | 223 | setCloudDescription(cloudDescription, { |
215 | 224 | type: 'repository', |
216 | 225 | params: { organization: organizationName, provider: organizationProvider, repository: repositoryName }, |
217 | 226 | }) |
218 | 227 | } else if (isOrgInCodacy) { |
219 | 228 | addRepoButton.style.display = 'inline-block' |
| 229 | + addOrgButton.style.display = 'none' |
220 | 230 | noOrgDescription.style.display = 'none' |
221 | 231 | cloudIcon.src = iconUris.warning |
| 232 | + if (organizationInfo.billing === 'premium') { |
| 233 | + upgradeBox.style.display = 'none' |
| 234 | + } else { |
| 235 | + upgradeBox.style.display = 'block' |
| 236 | + upgradeButton.setAttribute( |
| 237 | + 'href', |
| 238 | + `https://app.codacy.com/organizations/${encodeURIComponent(organizationProvider)}/${encodeURIComponent(organizationName)}/settings/billing` |
| 239 | + ) |
| 240 | + } |
222 | 241 | setCloudDescription(cloudDescription, { |
223 | 242 | type: 'organization', |
224 | 243 | params: { organization: organizationName, provider: organizationProvider }, |
|
228 | 247 | noOrgDescription.style.display = 'inline-block' |
229 | 248 | addRepoButton.style.display = 'none' |
230 | 249 | cloudIcon.src = iconUris.warning |
| 250 | + upgradeBox.style.display = 'block' |
| 251 | + upgradeButton.setAttribute('href', 'https://www.codacy.com/pricing') |
231 | 252 | setCloudDescription(cloudDescription, { type: 'user', params: { user: userName } }) |
232 | 253 | } |
233 | 254 | } |
|
237 | 258 | addRepoButton && |
238 | 259 | noOrgDescription && |
239 | 260 | upgradeBox && |
| 261 | + upgradeButton && |
240 | 262 | cloudIcon && |
241 | 263 | cloudDescription && |
242 | 264 | connectToCodacyButton |
243 | 265 | ) { |
244 | 266 | upgradeBox.style.display = 'block' |
| 267 | + upgradeButton.setAttribute('href', 'https://www.codacy.com/pricing') |
245 | 268 | cloudIcon.src = iconUris.unfinished |
246 | 269 | cloudDescription.textContent = 'Customize local analysis and keep your PRs up to standards in the IDE.' |
247 | 270 | addOrgButton.style.display = 'none' |
|
406 | 429 | const addRepositorySection = document.getElementById('add-repository-section') |
407 | 430 | const installCliButton = document.getElementById('install-cli-button') |
408 | 431 | const cliHeaderActions = document.getElementById('cli-header-actions') |
| 432 | + const dependenciesDescription = document.getElementById('dependencies-description') |
409 | 433 | /** @type {IconUris | undefined} */ |
410 | 434 | // @ts-expect-error - iconUris is injected by the extension |
411 | 435 | const iconUris = window.iconUris |
|
422 | 446 | if (installCliButton) { |
423 | 447 | installCliButton.style.display = 'none' |
424 | 448 | } |
| 449 | + if (dependenciesDescription) { |
| 450 | + dependenciesDescription.style.display = 'none' |
| 451 | + } |
425 | 452 | cliDescription.textContent = 'Codacy CLI installed' |
426 | 453 | cliIcon.src = iconUris.finished |
427 | 454 | if (addOrganizationSection && addRepositorySection) { |
|
445 | 472 | if (installCliButton) { |
446 | 473 | installCliButton.style.display = 'inline-block' |
447 | 474 | } |
| 475 | + if (dependenciesDescription) { |
| 476 | + dependenciesDescription.style.display = 'inline-block' |
| 477 | + } |
448 | 478 | cliDescription.textContent = 'Get instant feedback as you type by analyzing your code locally.' |
449 | 479 | cliIcon.src = iconUris.unfinished |
450 | 480 | } |
|
0 commit comments