Skip to content

Commit

Permalink
use getApp instead of list api
Browse files Browse the repository at this point in the history
  • Loading branch information
GnsP committed Oct 29, 2024
1 parent 2825ff9 commit 9d3f9e8
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 24 deletions.
49 changes: 27 additions & 22 deletions app/hydrator/services/create/stores/config-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -1355,29 +1355,34 @@ class HydratorPlusPlusConfigStore {
var config = this.getConfigForExport();
config['app.deploy.update.schedules'] = false;

if (isEdit) {
publish(config.name);
return;
}

let displayPipelineNameExistsError = () => {
this.HydratorPlusPlusConsoleActions.addMessage([{
type: 'error',
content: this.GLOBALS.en.hydrator.studio.error['NAME-ALREADY-EXISTS']
}]);
this.EventPipe.emit('hideLoadingIcon.immediate');
};

// Checking if Pipeline name already exist
this.myAppsApi
.list({ namespace: this.$state.params.namespace })
.$promise
.then( (apps) => {
if (isEdit) {
publish(config.name);
} else {
var appNames = apps.map( (app) => { return app.name; } );
if (appNames.indexOf(config.name) !== -1) {
this.HydratorPlusPlusConsoleActions.addMessage([{
type: 'error',
content: this.GLOBALS.en.hydrator.studio.error['NAME-ALREADY-EXISTS']
}]);
this.EventPipe.emit('hideLoadingIcon.immediate');
} else {
// normal deployment does not need these fields
delete config.change;
delete config.parentVersion;
publish(config.name);
}
}
});
this.myAppsApi.get({
namespace: this.$state.params.namespace,
appId: config.name,
}).$promise.then((app) => {
displayPipelineNameExistsError();
}).catch((err) => {
if (err.status !== 404) {
displayPipelineNameExistsError();
} else {
delete config.change;
delete config.parentVersion;
publish(config.name);
}
});
}
}

Expand Down
5 changes: 3 additions & 2 deletions src/e2e-test/java/io/cdap/cdap/ui/utils/Commands.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.apache.commons.io.FileUtils;
import org.junit.Assert;
import org.openqa.selenium.By;
import org.openqa.selenium.ElementClickInterceptedException;
import org.openqa.selenium.NoAlertPresentException;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.OutputType;
Expand Down Expand Up @@ -363,8 +364,8 @@ public static void dismissTopBanner() {
"//div[@data-testid='valium-banner-hydrator']//button[@class='close ng-scope']");
WaitHelper.waitForElementToBeClickable(bannerCloseButton, 180L);
ElementHelper.clickOnElement(bannerCloseButton);
} catch (NoSuchElementException e) {
// pass
} catch (NoSuchElementException | ElementClickInterceptedException e) {
// pass and just wait for the banner to disappear
}
WaitHelper.waitForElementToBeHidden(Helper.locateElementByTestId("valium-banner-hydrator"));
}
Expand Down

0 comments on commit 9d3f9e8

Please sign in to comment.