private validateInputs()

in src/Explorer/Panes/AddCollectionPanel/AddCollectionPanel.tsx [1195:1236]


  private validateInputs(): boolean {
    if (!this.state.createNewDatabase && !this.state.selectedDatabaseId) {
      this.setState({ errorMessage: "Please select an existing database" });
      return false;
    }

    const throughput = this.state.createNewDatabase ? this.newDatabaseThroughput : this.collectionThroughput;
    if (throughput > CollectionCreation.DefaultCollectionRUs100K && !this.isCostAcknowledged) {
      const errorMessage = this.isNewDatabaseAutoscale
        ? "Please acknowledge the estimated monthly spend."
        : "Please acknowledge the estimated daily spend.";
      this.setState({ errorMessage });
      return false;
    }

    if (throughput > CollectionCreation.MaxRUPerPartition && !this.state.isSharded) {
      this.setState({ errorMessage: "Unsharded collections support up to 10,000 RUs" });
      return false;
    }

    if (
      userContext.apiType === "Gremlin" &&
      (this.state.partitionKey === "/id" || this.state.partitionKey === "/label")
    ) {
      this.setState({ errorMessage: "/id and /label as partition keys are not allowed for graph." });
      return false;
    }

    if (this.shouldShowVectorSearchParameters()) {
      if (!this.state.vectorPolicyValidated) {
        this.setState({ errorMessage: "Please fix errors in container vector policy" });
        return false;
      }

      if (!this.state.fullTextPolicyValidated) {
        this.setState({ errorMessage: "Please fix errors in container full text search polilcy" });
        return false;
      }
    }

    return true;
  }