Skip to content
This repository has been archived by the owner on Nov 22, 2019. It is now read-only.

Commit

Permalink
TEIIDTOOLS-330 - First working of UI support for publish
Browse files Browse the repository at this point in the history
* Changes the publish action from sending to git repository to generating
  a service in openshift.
  • Loading branch information
phantomjinx committed Mar 26, 2018
1 parent 87ef7ae commit aeeebe5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 26 deletions.
8 changes: 4 additions & 4 deletions ngapp/src/app/dataservices/dataservices.component.ts
Expand Up @@ -447,19 +447,19 @@ export class DataservicesComponent extends AbstractPageComponent implements OnIn
this.logger.log("[DataservicesPageComponent] Publishing Dataservice: " + svcName);
const self = this;
this.dataserviceService
.exportDataservice(svcName)
.publishDataservice(svcName)
.subscribe(
(wasSuccess) => {
self.exportNotificationHeader = this.exportSuccessHeader;
self.exportNotificationMessage = " " + svcName + " was published successfully!";
self.exportNotificationMessage = " " + svcName + " publishing successfully initiated!";
self.exportNotificationType = NotificationType.SUCCESS;
this.logger.log("[DataservicesPageComponent] Publish Dataservice was successful");
this.logger.log("[DataservicesPageComponent] Dataservice publishing initiation was successful");
},
(error) => {
self.exportNotificationHeader = this.exportFailedHeader;
self.exportNotificationMessage = " Failed to publish dataservice " + svcName + "!";
self.exportNotificationType = NotificationType.DANGER;
this.logger.log("[DataservicesPageComponent] Publish Dataservice failed.");
this.logger.log("[DataservicesPageComponent] Publish dataservice " + svcName + " failed.");
}
);
}
Expand Down
26 changes: 4 additions & 22 deletions ngapp/src/app/dataservices/shared/dataservice.service.ts
Expand Up @@ -454,36 +454,18 @@ export class DataserviceService extends ApiService {
}

/**
* Export a dataservice to a git repository
* Publish a dataservice
* @param {string} dataserviceName the dataservice name
* @returns {Observable<boolean>}
*/
public exportDataservice(dataserviceName: string): Observable<boolean> {
const repoPathKey = this.appSettings.GIT_REPO_PATH_KEY;
const repoBranchKey = this.appSettings.GIT_REPO_BRANCH_KEY;
const repoUsernameKey = this.appSettings.GIT_REPO_USERNAME_KEY;
const repoPasswordKey = this.appSettings.GIT_REPO_PASSWORD_KEY;
const repoAuthorEmailKey = this.appSettings.GIT_REPO_AUTHOR_EMAIL_KEY;
const repoAuthorNameKey = this.appSettings.GIT_REPO_AUTHOR_NAME_KEY;
const repoFilePathKey = this.appSettings.GIT_REPO_FILE_PATH_KEY;
public publishDataservice(dataserviceName: string): Observable<boolean> {

// The payload for the rest call
const payload = {
"storageType": "git",
"dataPath": "/" + this.getKomodoUserWorkspacePath() + "/" + dataserviceName,
"parameters":
{
[repoPathKey] : this.appSettings.getGitRepoProperty(repoPathKey),
[repoBranchKey] : this.appSettings.getGitRepoProperty(repoBranchKey),
[repoFilePathKey] : dataserviceName,
[repoUsernameKey] : this.appSettings.getGitRepoProperty(repoUsernameKey),
[repoPasswordKey] : btoa(this.appSettings.getGitRepoProperty(repoPasswordKey)),
[repoAuthorNameKey] : this.appSettings.getGitRepoProperty(repoAuthorNameKey),
[repoAuthorEmailKey] : this.appSettings.getGitRepoProperty(repoAuthorEmailKey)
}
"name": dataserviceName
};

const url = environment.komodoImportExportUrl + "/" + DataservicesConstants.dataservicesExport;
const url = environment.komodoTeiidUrl + "/" + DataservicesConstants.dataservicesPublish;

return this.http
.post(url, payload, this.getAuthRequestOptions())
Expand Down
Expand Up @@ -15,6 +15,7 @@ import { NavigationItemConfig } from "patternfly-ng";
export class DataservicesConstants {

public static readonly dataservicesExport = "export";
public static readonly dataservicesPublish = "publish";

public static readonly dataserviceRootRoute = "dataservice";
public static readonly dataserviceRootPath = "/" + DataservicesConstants.dataserviceRootRoute;
Expand Down

0 comments on commit aeeebe5

Please sign in to comment.