Commit 4b8fcaa8 authored by sourabh_roy's avatar sourabh_roy
Browse files

OSDU Backup

parent 213bd9c0
Pipeline #46423 passed with stages
in 3 minutes and 18 seconds
......@@ -17,8 +17,9 @@ import { AuthService } from './common/Authentication/auth.service';
import { appInitializer} from './common/app.initializer';
import { NgMultiSelectDropDownModule } from 'ng-multiselect-dropdown';
import { NgSelectModule } from '@ng-select/ng-select';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HashLocationStrategy, LocationStrategy } from '@angular/common';
//import {ROUTER_PROVIDERS} from 'angular2/router'
import { FormsModule, ReactiveFormsModule, } from '@angular/forms';
export function initializeApp(appConfig: AppConfig) {
return () => appConfig.load();
......@@ -40,7 +41,10 @@ export function initializeApp(appConfig: AppConfig) {
],
providers: [AppConfig,AuthService,
// {provide: APP_INITIALIZER, useFactory: appInitializer, deps: [AuthService], multi: true,} ,
{ provide: APP_INITIALIZER, useFactory: initializeApp, deps: [AppConfig], multi: true },],
{ provide: APP_INITIALIZER, useFactory: initializeApp, deps: [AppConfig], multi: true },
// {provide : LocationStrategy , useClass: HashLocationStrategy}
],
bootstrap: [AppComponent]
})
......
......@@ -227,87 +227,73 @@ export class AuthService {
token = this.getTokenSession();
// if(this.cloud_provider_name != "ibm"){
this.router.events.subscribe((e) => {
if (e instanceof NavigationEnd) {
href= e.url;
if (e instanceof NavigationEnd) {
href= e.url;
if(this.cloud_provider_name=="gcp"){
code= href.split("&")[0].split("=")[1];
}
else if(this.cloud_provider_name=="ibm"){
if(href.includes('&')){
code= href.split("&")[1].split("=")[1];
}
}
}
else{
code = href.split('=')[1];
}
console.log("inside auth refresh");
if (code == undefined) {
}
console.log("inside auth refresh");
if (code == undefined) {
if (token == null) {
if(this.cloud_provider_name=="gcp"){
if (this.cloud_provider_name == "gcp") {
window.location.href = `${this.auth_url}?response_type=code&prompt=consent&client_id=${this.client_id}&redirect_uri=${this.redirect_uri}&scope=${this.scope}&access_type=offline`;
}
else if(this.cloud_provider_name=="aws"){
else if (this.cloud_provider_name == "aws") {
window.location.href = `${this.auth_url}?response_type=code&client_id=${this.client_id}&redirect_uri=${this.redirect_uri}&scope=${this.scope}`;
}
else if(this.cloud_provider_name=='azure'){
window.location.href=`${this.auth_url}${this.tennant_id}/oauth2/v2.0/authorize?response_type=code&client_id=${this.client_id}&redirect_uri=${this.redirect_uri}&scope=${this.scope}`
else if (this.cloud_provider_name == 'azure') {
window.location.href = `${this.auth_url}${this.tennant_id}/oauth2/v2.0/authorize?response_type=code&client_id=${this.client_id}&redirect_uri=${this.redirect_uri}&scope=${this.scope}`
}
else if(this.cloud_provider_name=="ibm"){
else if (this.cloud_provider_name == "ibm") {
window.location.href = `${this.auth_url}?response_type=code&prompt=consent&client_id=${this.client_id}&redirect_uri=${this.redirect_uri}&scope=${this.scope}`;
// this.router.navigate(['/login']);
}
}
else{
var checkExpired=this.checkGreaterThanOneDay(this.getrefreshTimer());
if(checkExpired){
else {
var checkExpired = this.checkGreaterThanOneDay(this.getrefreshTimer());
if (checkExpired) {
let timer = this.refreshTokenTimer(this.getIdToken());
if (timer <= 0) {
this.subscribeRefreshToken();
}
}
else{
else {
this.logout();
}
}
}
else {
if(this.cloud_provider_name=='azure'){
code=code.slice(0,-14);
}
else {
if (this.cloud_provider_name == 'azure') {
code = code.slice(0, -14);
}
if (token == null) {
if(this.cloud_provider_name=="gcp"){
if (this.cloud_provider_name == "gcp") {
this.subscribeAuthToken_gcp(code);
}
else if(this.cloud_provider_name=="aws" || this.cloud_provider_name=="azure"){
else if (this.cloud_provider_name == "aws" || this.cloud_provider_name == "azure") {
this.subscribeAuthToken(code);
}
else if(this.cloud_provider_name=="ibm"){
else if (this.cloud_provider_name == "ibm") {
this.subscribeAuthToken_ibm(code);
}
// else if(this.cloud_provider_name=="ibm"){
// this.subscribeAuthToken_ibm(code);
// }
}
else {
var checkExpired=this.checkGreaterThanOneDay(this.getrefreshTimer());
if(checkExpired){
var checkExpired = this.checkGreaterThanOneDay(this.getrefreshTimer());
if (checkExpired) {
let timer = this.refreshTokenTimer(this.getIdToken());
if (timer <= 0) {
this.subscribeRefreshToken();
}
}
else{
else {
this.logout();
// if(this.cloud_provider_name=="gcp"){
// this.subscribeAuthToken_gcp(code);
......@@ -316,14 +302,12 @@ export class AuthService {
// this.subscribeAuthToken(code);
// }
}
}
}
}
});
// }
// }
}
async subscribeRefreshToken() {
......
......@@ -15,6 +15,8 @@ export class CommonService {
isUserGuide:boolean;
userGuideLink='';
bkgndColor='';
bkgndColorDash='';
filterByValue(array, string) {
return array.filter(o =>
......
......@@ -66,6 +66,30 @@ export class RestAPILayerService {
}
httpOptionsSample = {
headers: new HttpHeaders({
'Authorization': 'Bearer ' + this.access_token,
'data-partition-id': this.data_partition,
'Content-Type':'application/json',
'Access-Control-Allow-Origin': '*',
}),
};
getSampleRecords(): Observable<any> {
let endpoint ='https://osdu-cpd-osdu.ofp-sb-ocp-10950c7751231d81f87a5591303da0c9-0000.ams03.containers.appdomain.cloud/osdu-storage/api/storage/v2/query/'
this.param = 'records?kind=opendes:wks:reference-data--GhgInventoryCategory:1.0.0'
// this.param = 'ResetPassword?GUID='+guid+'&password='+pwd;
let errorData={
'api':this.param,
}
return this.http.get<any>(endpoint+this.param, this.httpOptions).pipe(
map(this.extractData),
catchError(this.auth.errorHandler<any>('addProduct',errorData))
);
}
//----------------------- Entitlement APIS------------------------
......@@ -136,8 +160,7 @@ export class RestAPILayerService {
getLegalTagList(): Observable<any> {
this.param = 'legaltags?valid=true'
// this.param = 'ResetPassword?GUID='+guid+'&password='+pwd;
let errorData={
'api':this.param,
}
......@@ -239,12 +262,10 @@ export class RestAPILayerService {
this.param = 'query/kinds'
// this.param = 'ResetPassword?GUID='+guid+'&password='+pwd;
let errorData={
'api':this.param,
}
return this.http.get<any>(this.storage_endpoint_url + this.storage_host+this.param, this.httpOptions).pipe(
map(this.extractData),
catchError(this.auth.errorHandler<any>('addProduct',errorData))
);
}
......@@ -329,7 +350,7 @@ getWorkFlowList(): Observable<any> {
let errorData={
'api':this.param,
}
return this.http.post<any>(this.workflow_endpoint_url+ this.workflow_host+ this.param,data, this.httpOptions).pipe(
return this.http.put<any>(this.workflow_endpoint_url+ this.workflow_host+ this.param,data, this.httpOptions).pipe(
map(this.extractData),
catchError(this.auth.errorHandler<any>('addProduct',errorData))
);
......@@ -346,5 +367,56 @@ getWorkFlowList(): Observable<any> {
catchError(this.auth.errorHandler<any>('addProduct',errorData))
);
}
deleteWorkflowNAme(workflow) {
this.param = 'workflow/'+workflow;
let errorData = {
'api': this.param,
}
return this.http.delete<any>(this.workflow_endpoint_url+ this.workflow_host+ this.param, this.httpOptions).pipe(
map(this.extractData),
catchError(this.auth.errorHandler<any>('addProduct', errorData))
);
}
postTriggerWorkflowRun(name,data){
this.param = 'workflow/'+name+'/workflowRun';
let errorData={
'api':this.param,
}
return this.http.post<any>(this.workflow_endpoint_url+ this.workflow_host+ this.param,data, this.httpOptions).pipe(
map(this.extractData),
catchError(this.auth.errorHandler<any>('addProduct',errorData))
);
}
//-----------------------------EDS-------------------------------------------------------
getConnectionSourceRegistry(data){
this.param = 'query'
let errorData={
'api':this.param,
}
return this.http.post<any>(this.search_endpoint_url +this.search_host+ this.param,data, this.httpOptions).pipe(
map(this.extractData),
catchError(this.auth.errorHandler<any>('addProduct',errorData))
);
}
getConnectionSourceDataJob(data){
this.param = 'query'
let errorData={
'api':this.param,
}
return this.http.post<any>(this.search_endpoint_url +this.search_host+ this.param,data, this.httpOptions).pipe(
map(this.extractData),
catchError(this.auth.errorHandler<any>('addProduct',errorData))
);
}
}
......@@ -71,7 +71,7 @@
</div>
<div class="col-sm-6 col-lg-6">
<!-- routerLink="/data-ingestion/workflow" -->
<div class="container1 cont_router1">
<div class="container1 cont_router1" (click)="navigateToWorkFlow()" >
<div class="card text-white bg-flat-color-1">
<div class="card-body pb-0">
<div class="text-light"><i class="fa fa-paper-plane" aria-hidden="true"></i>&nbsp; WorkFlow Service(Coming Soon!)
......
......@@ -28,6 +28,8 @@ export class DashboardMainComponent implements OnInit {
constructor(public restService:RestAPILayerService, public router: Router, public cmnSrc: CommonService, private cd: ChangeDetectorRef,private auth:AuthService) {
this.cmnSrc.sideNavLists=dashboardList[0]["sideValues"];
this.cmnSrc.SideNavHeader=dashboardList[0]["header"];
this.cmnSrc.bkgndColor="dashboard";
this.cmnSrc.bkgndColorDash="#00a6de";
this.cmnSrc.isUserGuide=true;
this.cmnSrc.userGuideLink="https://community.opengroup.org/osdu/ui/admin-ui/-/wikis/Admin-UI-User-Guide";
......@@ -53,6 +55,11 @@ export class DashboardMainComponent implements OnInit {
}
navigateToWorkFlow(){
if(this.auth.cloud_provider_name=='gcp'){
this.router.navigateByUrl("/data-ingestion/workflow")
}
}
}
......@@ -12,7 +12,7 @@ import { RestAPILayerService } from 'src/app/common/rest-apilayer.service';
})
export class CreateWorkflowComponent implements OnInit {
ngDagName='';
//ngDagName='';
ngWorkflowName='';
ngDescription='';
......@@ -41,28 +41,51 @@ export class CreateWorkflowComponent implements OnInit {
// "dagName": this.ngDagName,
// },
"description": this.ngDescription
}
this.spinner.show();
this.restService.postWorkFlowCreate(data).subscribe((result) => {
this.spinner.hide();
this.isSuccess = true;
this.isError = false;
this.successMessge = "You have successfully created " + this.ngWorkflowName + "."
resetForm.reset();
this.ngWorkflowName == '';
this.ngDagName = '';
this.ngDescription = '';
}, (err) => {
this.spinner.hide();
this.isError = true;
this.isSuccess = false;
this.errorMessge = err;
console.log(err);
});
let count=0;
for(let element in this){
if(element.includes('ng')){
if(this[element]==null){
count+=1;
}
else{
if(this[element].toString()==''){
count+=1;
}
}
}
}
if(count>0){
this.isSuccess=false;
this.isError=true;
this.errorMessge="Please enter all the fields."
}
else{
this.spinner.show();
this.restService.postWorkFlowCreate(data).subscribe((result) => {
this.spinner.hide();
this.isSuccess = true;
this.isError = false;
this.successMessge = "You have successfully created " + this.ngWorkflowName + "."
resetForm.reset();
this.ngWorkflowName == '';
// this.ngDagName = '';
this.ngDescription = '';
}, (err) => {
this.spinner.hide();
this.isError = true;
this.isSuccess = false;
this.errorMessge = err;
console.log(err);
});
}
}
}
......@@ -10,9 +10,10 @@ import { WorkFlowRunComponent } from './work-flow-run/work-flow-run.component';
import { WorkflowsComponent } from './workflows/workflows.component';
import { WfRunViewComponent } from './wf-run-view/wf-run-view.component';
import { CreateWorkflowComponent } from './create-workflow/create-workflow.component';
import { WorkflowRunDetailsComponent } from './workflow-run-details/workflow-run-details.component';
@NgModule({
declarations: [DataIngestionComponent, WorkFlowRunComponent, WorkflowsComponent, WfRunViewComponent, CreateWorkflowComponent],
declarations: [DataIngestionComponent, WorkFlowRunComponent, WorkflowsComponent, WfRunViewComponent, CreateWorkflowComponent, WorkflowRunDetailsComponent],
imports: [
CommonModule,DataIngestionRoutingModule,NgxSpinnerModule,FormsModule,NgbModule,NgSelectModule
]
......
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { Router } from '@angular/router';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { NgxSpinnerService } from 'ngx-spinner';
......@@ -9,11 +9,14 @@ import { RestAPILayerService } from 'src/app/common/rest-apilayer.service';
@Component({
selector: 'app-data-ingestion',
templateUrl: './data-ingestion.component.html',
styleUrls: ['./data-ingestion.component.css']
styleUrls: ['./data-ingestion.component.css'],
encapsulation: ViewEncapsulation.None,
})
export class DataIngestionComponent implements OnInit {
constructor(){}
constructor(public cmnSrc: CommonService, ){
this.cmnSrc.bkgndColor="workflow";
}
ngOnInit(): void {
......
import { Component, OnInit } from '@angular/core';
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { NgxSpinnerService } from 'ngx-spinner';
import { CommonService } from 'src/app/common/common.service';
......@@ -20,6 +20,7 @@ export class WfRunViewComponent implements OnInit {
isSuccess:boolean=false;
isError:boolean=false;
@Output() passEntryEdit: EventEmitter<any> = new EventEmitter();
constructor(public activeModal: NgbActiveModal,public cmnSrvc: CommonService, private spinner: NgxSpinnerService,public restService:RestAPILayerService,) { }
ngOnInit(): void {
......@@ -28,19 +29,27 @@ export class WfRunViewComponent implements OnInit {
requestSubmit(){
this.spinner.show();
// const data={
// "status":this.ngWellRunStatus
// }
const data={
"executionContext": {
"key":this.ngWellRunStatus
}
"status":this.ngWellRunStatus
}
const outputParam={
"status":this.ngWellRunStatus,
"runId":this.runID
}
this.restService.updateWorkFlowRunStatus(this.runName,this.runID,data).subscribe((result) => {
this.spinner.hide();
console.log(result)
if(typeof(result)=="object"){
this.isSuccess=true;
this.isError=false;
this.successMessge="Successfully updated the status.";
this.passEntryEdit.emit({ data:outputParam });
}
else{
this.isError=true;
this.isSuccess=false;
this.errorMessge=result;
}
}, (err) => {
this.isError=true;
this.isSuccess=false;
......
......@@ -13,3 +13,15 @@ th{
th.thHover:hover {
color: black !important;
}
/* swwetalert */
.sweet-alert .sa-icon {
width: 80px !important;
height: 87px !important;
border: 4px solid gray;
border-radius: 50%;
margin: 20px auto;
position: relative;
box-sizing: content-box;
}
\ No newline at end of file
......@@ -19,7 +19,7 @@
</div>
<div class="col-xs-6 col-md-4">
<button type="button" class="btn btn-success openAddGroupModal" [disabled]="ngselectedWorkFlowName=='0' || ngselectedWorkFlowName==undefined" (click)="showDataWorkFlow(ngselectedWorkFlowName)"><i class="fa fa-search"></i>&nbsp; Search</button>
<!-- <button type="button" class="btn btn-success openAddGroupModal" (click)="openModalCreate()" style="margin-left: 1%; background: rgb(0 124 102 / 1)!important; border-color: rgb(0 124 102 / 1)!important;" ><i class="fa fa-plus"></i>&nbsp; Add Member</button> -->
<button type="button" class="btn btn-success openAddGroupModal" (click)="triggerRun()" style="margin-left: 1%; background: rgb(0 124 102 / 1)!important; border-color: rgb(0 124 102 / 1)!important;" >&nbsp; Trigger Workflow Run</button>
</div>
<div class="col-xs-6 col-md-3">
<input id="myInput" type="text" placeholder="Search.." name="myInput" [(ngModel)]="myInput" (keyup)="searchFilter($event.target.value)">
......@@ -39,12 +39,19 @@
</div>
<table id="tblMemeberDetails" class="table table-striped">
<thead>
<th class="thHover" (click)="sort('runId')">runId</th>
<th class="thHover" (click)="sort('runId')">runId
<div class="tool-tip" style="margin-left: 0%;">
<i style="color: white;" class="fa fa-info-circle " aria-hidden="true"></i>
<p class="tool-tip__info">
<span style="text-transform: none;" class="info">Click on Run Id's to view Run Details or to update the status.</span>
</p>
</div>
</th>
<th class="thHover" (click)="sort('submittedBy')">submittedBy</th>
<th class="thHover" (click)="sort('startTimeStamp')">StartTime</th>
<th class="thHover" (click)="sort('endTimeStamp')">EndTime</th>
<th class="thHover" (click)="sort('status')">status</th>
<th></th>
<!-- <th></th> -->
<!-- <th class="thHover" (click)="sort(name)" *ngFor="let name of headers">{{name}} <span style="float: right;" [ngClass]="istoggle ? 'fa fa-toggle-down' : 'fa fa-toggle-up'"></span></th> -->
</thead>
......@@ -59,9 +66,14 @@
<p class="tool-tip__info">
<span class="info">Click here to view {{run.runId}} details or update status.</span>
</p>
</div>
</div>
</td> -->
<td>{{run.runId}}</td>
<td>
<a href="javascript:void(0);" (click)="openModalRun(run)" class="editUserhref">
{{run.runId}}
</a>
<!-- {{run.runId}} -->
</td>
<td>{{run.submittedBy}}</td>
<td>{{run.startTimeStamp | date:'short'}}</td>
<td *ngIf="run.endTimeStamp==0">{{run.endTimeStamp}}</td>
......@@ -69,13 +81,13 @@
<td>
<span [ngStyle]="{'color':styleStatus(run.status)}"><b>{{run.status}}</b> </span>
</td>
<td (click)="updateStatusFunc(run)">
<!-- <td (click)="updateStatusFunc(run)">
<button type="button" style="border: 0px;
box-shadow: 2px 2px 1px 0px;">
<i style="color: #e59034;" class="fa fa-pencil"></i>
</button>
</td>
</td> -->
</tr>
</tbody>
</table>
......
declare var swal:any;
import { getCurrencySymbol } from '@angular/common';
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
......@@ -7,6 +8,7 @@ import { AuthService } from 'src/app/common/Authentication/auth.service';
import { CommonService } from 'src/app/common/common.service';
import { RestAPILayerService } from 'src/app/common/rest-apilayer.service';
import { WfRunViewComponent} from '../wf-run-view/wf-run-view.component';
import { WorkflowRunDetailsComponent} from '../workflow-run-details/workflow-run-details.component';