summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.ts')
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.ts129
1 files changed, 77 insertions, 52 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.ts
index 45210f80..61b2a343 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.ts
@@ -46,6 +46,7 @@ import { InformationModalComponent } from 'src/app/modals/information-modal/info
import { ErrorModalComponent } from 'src/app/modals/error-modal/error-modal.component';
import { ConfirmationModalComponent } from 'src/app/modals/confirmation-modal/confirmation-modal.component';
import { Column, ColumnTypes, DataTableSettings } from 'portalsdk-tag-lib';
+import { ActivatedRoute } from '@angular/router';
@Component({
selector: 'app-self',
@@ -54,7 +55,10 @@ import { Column, ColumnTypes, DataTableSettings } from 'portalsdk-tag-lib';
})
export class SelfComponent implements OnInit {
- constructor(public userService: UserService, public profileService: ProfileService, private ngModal: NgbModal) { }
+ constructor(public userService: UserService,
+ public profileService: ProfileService,
+ private ngModal: NgbModal,
+ private route: ActivatedRoute) { }
user: User;
isAppCentralized;
@@ -98,6 +102,11 @@ export class SelfComponent implements OnInit {
ngOnInit() {
+ this.profileId = "";
+ console.log("ngOnInit called ",this.profileId);
+ if(this.route.snapshot.queryParams['profile_id']){
+ this.profileId = this.route.snapshot.queryParams['profile_id'];
+ }
this.showSpinner = false;
this.finalSelectedRoles = [];
let result = this.userService.getFunctionalMenuStaticDetailSession();
@@ -106,7 +115,11 @@ export class SelfComponent implements OnInit {
this.user = user;
this.isAppCentralized = this.user.isAppCentralized;
});
- this.getSelfProfileDetail();
+ if (this.profileId != undefined && this.profileId != "") {
+ this.getProfileById(this.profileId);
+ } else {
+ this.getSelfProfileDetail();
+ }
}
/**
@@ -116,65 +129,77 @@ export class SelfComponent implements OnInit {
this.showSpinner = true;
this.response = this.profileService.getSelfProfile();
this.response.subscribe(data => {
- let res;
- res = data;
- this.result = JSON.parse(res.data);
- this.profile = JSON.parse(this.result.profile);
- this.oriProfile = JSON.parse(this.result.profile); /*original value*/
+ this.assignProfileDetails(data);
+ });
+ this.showSpinner = false;
+ }
- this.profileId = this.profile.id;
- this.ociavailableRoles = JSON.parse(this.result.availableRoles);
- this.ociTimeZones = JSON.parse(this.result.timeZones);
- this.ociCountries = JSON.parse(this.result.countries);
- this.stateList = JSON.parse(this.result.stateList);
+ /**
+ * Get Profile Details by ProfileId
+ */
+ getProfileById(profileId) {
+ this.showSpinner = true;
+ this.profileService.getProfileById(profileId).subscribe(response => {
+ this.assignProfileDetails(response);
+ })
+ this.showSpinner = false;
+ }
- for( let state of this.stateList)
- {
- if(state.value == this.profile.state){
- this.profile.state= state.value;
- }
- }
+ assignProfileDetails(data) {
+ let res;
+ res = data;
+ this.result = JSON.parse(res.data);
+
+ this.profile = JSON.parse(this.result.profile);
+ this.oriProfile = JSON.parse(this.result.profile); /*original value*/
- for( let country of this.ociCountries)
- {
- if(country.value == this.profile.country){
- this.profile.country= country.value;
- }
- }
+ this.profileId = this.profile.id;
+ this.ociavailableRoles = this.profile.roles;
+ console.log("Profile specific roles : ", this.ociavailableRoles);
+ this.ociTimeZones = JSON.parse(this.result.timeZones);
+ this.ociCountries = JSON.parse(this.result.countries);
+ this.stateList = JSON.parse(this.result.stateList);
- for( let timeZone of this.ociTimeZones)
- {
- if(timeZone.value == this.profile.timeZoneId){
- this.profile.timeZoneId= timeZone.value;
- }
- }
+ for (let state of this.stateList) {
+ if (state.value == this.profile.state) {
+ this.profile.state = state.value;
+ }
+ }
+
+ for (let country of this.ociCountries) {
+ if (country.value == this.profile.country) {
+ this.profile.country = country.value;
+ }
+ }
+
+ for (let timeZone of this.ociTimeZones) {
+ if (timeZone.value == this.profile.timeZoneId) {
+ this.profile.timeZoneId = timeZone.value;
+ }
+ }
- console.log("Data : ", this.ociavailableRoles);
- this.columns.push(new Column("name", "Name", ColumnTypes.TEXT, false, null));
- this.settings = new DataTableSettings()
- this.settings.columns = this.columns;
- this.settings.isPaginationEnabled = false;
- this.settings.isReadOnly = true;
- this.settings.isTableSearchEnabled = false;
- this.settings.isToggleEnabled = true;
+ this.columns.push(new Column("name", "Name", ColumnTypes.TEXT, false, null));
+ this.settings = new DataTableSettings()
+ this.settings.columns = this.columns;
+ this.settings.isPaginationEnabled = false;
+ this.settings.isReadOnly = true;
+ this.settings.isTableSearchEnabled = false;
+ this.settings.isToggleEnabled = true;
- if (this.ociavailableRoles != null) {
- for (let role of this.ociavailableRoles) {
- role.selected = false;
- for (let profileRole of this.profile.roles) {
- if (profileRole.id === role.id) {
- role.selected = true;
- }
- if (role.id === 1) {
- this.isUserSystemAdmin = true;
- }
+ if (this.ociavailableRoles != null) {
+ for (let role of this.ociavailableRoles) {
+ role.selected = false;
+ for (let profileRole of this.profile.roles) {
+ if (profileRole.id === role.id) {
+ role.selected = true;
+ }
+ if (role.id === 1) {
+ this.isUserSystemAdmin = true;
}
- this.availableRoles.push(role);
}
+ this.availableRoles.push(role);
}
-
- });
- this.showSpinner = false;
+ }
}
/**