fix: default DC path for viya

This commit is contained in:
Mihajlo Medjedovic
2025-06-02 11:24:18 +02:00
parent ec11a74265
commit f3125ff464
3 changed files with 46 additions and 3 deletions

View File

@@ -13,6 +13,7 @@ import { EventService } from 'src/app/services/event.service'
import { LoggerService } from 'src/app/services/logger.service'
import { SasViyaService } from 'src/app/services/sas-viya.service'
import { SasService } from 'src/app/services/sas.service'
import { ViyaApiCurrentUser } from 'src/app/viya-api-explorer/models/viya-api-current-user.model'
import {
Item,
ViyaApiIdentities
@@ -48,7 +49,9 @@ export class AutomaticComponent implements OnInit {
public recreateDatabase: boolean = true
public createDatabaseLoading: boolean = false
public adminGroupsLoading: boolean = false
public currentUserInfoLoading: boolean = false
public adminGroups: { id: string; name: string }[] = []
public currentUserInfo: ViyaApiCurrentUser | null = null
/** autoDeployStatus
* This object presents the status for two steps that we have for deploy.
@@ -75,6 +78,19 @@ export class AutomaticComponent implements OnInit {
ngOnInit(): void {
this.getAdminGroups()
this.getCurrentUser()
}
public async getCurrentUser() {
this.currentUserInfoLoading = true
this.sasViyaService.getCurrentUser().subscribe((res: ViyaApiCurrentUser) => {
this.currentUserInfoLoading = false
this.currentUserInfo = res
this.dcPath = `/export/viya/homes/${res.id}`
})
}
public async getAdminGroups() {

View File

@@ -7,6 +7,7 @@ import { ViyaApis } from '../viya-api-explorer/models/viya-apis.models'
import { ViyaApiFolderMembers } from '../viya-api-explorer/models/viya-api-folder-content.model'
import { ViyaApiFolder } from '../viya-api-explorer/models/viya-api-folder.model'
import { ViyaApiIdentities } from '../viya-api-explorer/models/viya-api-identities.model'
import { ViyaApiCurrentUser } from '../viya-api-explorer/models/viya-api-current-user.model'
@Injectable({
providedIn: 'root'
@@ -121,7 +122,7 @@ export class SasViyaService {
* @returns The folder info object
*/
getFolderByPath(path: string): Observable<ViyaApiFolder> {
return this.http.get<any>(
return this.http.get<ViyaApiFolder>(
`${this.serverUrl}/folders/folders/@item?path=${path}`,
{
withCredentials: true
@@ -130,7 +131,7 @@ export class SasViyaService {
}
getFolderMembers(folderId: string): Observable<ViyaApiFolderMembers> {
return this.http.get<any>(
return this.http.get<ViyaApiFolderMembers>(
`${this.serverUrl}/folders/folders/${folderId}/members`,
{
withCredentials: true
@@ -139,11 +140,20 @@ export class SasViyaService {
}
getAdminGroups(limit: number = 5000): Observable<ViyaApiIdentities> {
return this.http.get<any>(
return this.http.get<ViyaApiIdentities>(
`${this.serverUrl}/identities/groups?sortBy=name&limit=${limit}`,
{
withCredentials: true
}
)
}
getCurrentUser(): Observable<ViyaApiCurrentUser> {
return this.http.get<ViyaApiCurrentUser>(
`${this.serverUrl}/identities/users/@currentUser`,
{
withCredentials: true
}
)
}
}

View File

@@ -0,0 +1,17 @@
export interface ViyaApiCurrentUser {
creationTimeStamp: string;
modifiedTimeStamp: string;
id: string;
type: string;
name: string;
links: Link[];
version: number;
}
export interface Link {
method: string;
rel: string;
href: string;
uri: string;
type: string;
}