Просмотр исходного кода

Merge pull request #1232 from porter-dev/master

API refactor and frontend fixes -> staging
abelanger5 4 лет назад
Родитель
Сommit
b4bcc86523
2 измененных файлов с 11 добавлено и 2 удалено
  1. 5 0
      api/server/authz/cluster.go
  2. 6 2
      dashboard/src/main/CurrentError.tsx

+ 5 - 0
api/server/authz/cluster.go

@@ -4,6 +4,7 @@ import (
 	"context"
 	"fmt"
 	"net/http"
+	"strings"
 
 	"github.com/porter-dev/porter/api/server/shared/apierrors"
 	"github.com/porter-dev/porter/api/server/shared/config"
@@ -142,6 +143,10 @@ func (d *OutOfClusterAgentGetter) GetHelmAgent(r *http.Request, cluster *models.
 		namespace = nsPolicy.Resource.Name
 	}
 
+	if strings.ToLower(namespace) == "all" {
+		namespace = ""
+	}
+
 	helmAgent, err := helm.GetAgentFromK8sAgent("secret", namespace, d.config.Logger, k8sAgent)
 
 	if err != nil {

+ 6 - 2
dashboard/src/main/CurrentError.tsx

@@ -26,11 +26,15 @@ export default class CurrentError extends Component<PropsType, StateType> {
   }
 
   render() {
+    let currentError = this.props.currentError;
+    if (!React.isValidElement(this.props.currentError)) {
+      currentError = String(this.props.currentError);
+    }
     if (this.props.currentError) {
       if (!this.state.expanded) {
         return (
           <StyledCurrentError>
-            <ErrorText>Error: {this.props.currentError}</ErrorText>
+            <ErrorText>Error: {currentError}</ErrorText>
             <ExpandButton onClick={() => this.setState({ expanded: true })}>
               <i className="material-icons">launch</i>
             </ExpandButton>
@@ -53,7 +57,7 @@ export default class CurrentError extends Component<PropsType, StateType> {
         <Overlay>
           <ExpandedError>
             Porter encountered an error. Full error log:
-            <CodeBlock>{this.props.currentError}</CodeBlock>
+            <CodeBlock>{currentError}</CodeBlock>
             <ExpandButtonAlt onClick={() => this.setState({ expanded: false })}>
               <i className="material-icons">remove</i>
             </ExpandButtonAlt>