Skip to content

Commit

Permalink
Merge pull request #2324 from posit-dev/sagerb-suppress-config-based-…
Browse files Browse the repository at this point in the history
…operations-when-in-error

Suppress calls to agent when active config is in error
  • Loading branch information
sagerb authored Sep 30, 2024
2 parents 383c0a8 + 33d8b86 commit 448819f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
20 changes: 19 additions & 1 deletion extensions/vscode/src/views/homeView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,12 @@ export class HomeViewProvider implements WebviewViewProvider, Disposable {
console.error("homeView::updateFileList: No active configuration.");
return;
}
if (isConfigurationError(activeConfig)) {
console.error(
"homeView::updateFileList: Skipping - error in active configuration.",
);
return;
}
try {
await showProgress("Updating File List", Views.HomeView, async () => {
const api = await useApi();
Expand Down Expand Up @@ -958,6 +964,12 @@ export class HomeViewProvider implements WebviewViewProvider, Disposable {
console.error("homeView::addSecret: No active configuration.");
return;
}
if (isConfigurationError(activeConfig)) {
console.error(
"homeView::addSecret: Unable to add secret into a configuration with error.",
);
return;
}

const name = await this.inputSecretName();
if (name === undefined) {
Expand Down Expand Up @@ -988,6 +1000,12 @@ export class HomeViewProvider implements WebviewViewProvider, Disposable {
console.error("homeView::removeSecret: No active configuration.");
return;
}
if (isConfigurationError(activeConfig)) {
console.error(
"homeView::removeSecret: Unable to remove secret from a configuration with error.",
);
return;
}

try {
await showProgress("Removing Secret", Views.HomeView, async () => {
Expand Down Expand Up @@ -1461,7 +1479,7 @@ export class HomeViewProvider implements WebviewViewProvider, Disposable {

public sendRefreshedFilesLists = async () => {
const activeConfig = await this.state.getSelectedConfiguration();
if (activeConfig) {
if (activeConfig && !isConfigurationError(activeConfig)) {
try {
const response = await showProgress(
"Refreshing Files",
Expand Down
8 changes: 7 additions & 1 deletion extensions/vscode/webviews/homeView/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
<main>
<OverlayableView :activateOverlay="home.showDisabledOverlay">
<EvenEasierDeploy class="easy-deploy-container" />
<template v-if="home.selectedConfiguration">
<template
v-if="
home.selectedConfiguration &&
!isConfigurationError(home.selectedConfiguration)
"
>
<ProjectFiles v-model:expanded="projectFilesExpanded" />
<Secrets />
<PythonPackages />
Expand All @@ -30,6 +35,7 @@ import HelpAndFeedback from "src/components/views/HelpAndFeedback.vue";
import { useHostConduitService } from "src/HostConduitService";
import { useHomeStore } from "./stores/home";
import { isConfigurationError } from "../../../src/api";
useHostConduitService();
Expand Down

0 comments on commit 448819f

Please sign in to comment.