mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-10 16:15:12 +00:00
feat: rehauled console (#3525)
* new console * move npm ci to angular build * rel path for assets * local grpc copy * login policy, rm clear views, features rel path * lock Co-authored-by: Livio Amstutz <[email protected]>
This commit is contained in:
co-authored by
Livio Amstutz
parent
00f7dbe875
commit
08ae39ae19
@@ -35,9 +35,13 @@ import {
|
||||
SetCustomVerifyEmailMessageTextRequest,
|
||||
SetCustomVerifyPhoneMessageTextRequest,
|
||||
} from 'src/app/proto/generated/zitadel/management_pb';
|
||||
import { Org } from 'src/app/proto/generated/zitadel/org_pb';
|
||||
import { MessageCustomText } from 'src/app/proto/generated/zitadel/text_pb';
|
||||
import { AdminService } from 'src/app/services/admin.service';
|
||||
import { Breadcrumb, BreadcrumbService, BreadcrumbType } from 'src/app/services/breadcrumb.service';
|
||||
import { GrpcAuthService } from 'src/app/services/grpc-auth.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { StorageLocation, StorageService } from 'src/app/services/storage.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
import { InfoSectionType } from '../../info-section/info-section.component';
|
||||
@@ -111,8 +115,9 @@ const REQUESTMAP = {
|
||||
get: new GetCustomPasswordResetMessageTextRequest(),
|
||||
set: new SetCustomPasswordResetMessageTextRequest(),
|
||||
getDefault: new GetDefaultPasswordResetMessageTextRequest(),
|
||||
setFcn: (map: Partial<SetCustomPasswordResetMessageTextRequest.AsObject>):
|
||||
SetCustomPasswordResetMessageTextRequest => {
|
||||
setFcn: (
|
||||
map: Partial<SetCustomPasswordResetMessageTextRequest.AsObject>,
|
||||
): SetCustomPasswordResetMessageTextRequest => {
|
||||
const req = new SetCustomPasswordResetMessageTextRequest();
|
||||
req.setButtonText(map.buttonText ?? '');
|
||||
req.setFooterText(map.footerText ?? '');
|
||||
@@ -129,8 +134,9 @@ const REQUESTMAP = {
|
||||
get: new GetCustomDomainClaimedMessageTextRequest(),
|
||||
set: new SetCustomDomainClaimedMessageTextRequest(),
|
||||
getDefault: new GetDefaultDomainClaimedMessageTextRequest(),
|
||||
setFcn: (map: Partial<SetCustomDomainClaimedMessageTextRequest.AsObject>):
|
||||
SetCustomDomainClaimedMessageTextRequest => {
|
||||
setFcn: (
|
||||
map: Partial<SetCustomDomainClaimedMessageTextRequest.AsObject>,
|
||||
): SetCustomDomainClaimedMessageTextRequest => {
|
||||
const req = new SetCustomDomainClaimedMessageTextRequest();
|
||||
req.setButtonText(map.buttonText ?? '');
|
||||
req.setFooterText(map.footerText ?? '');
|
||||
@@ -147,8 +153,9 @@ const REQUESTMAP = {
|
||||
get: new GetCustomPasswordlessRegistrationMessageTextRequest(),
|
||||
set: new SetCustomPasswordlessRegistrationMessageTextRequest(),
|
||||
getDefault: new GetDefaultPasswordlessRegistrationMessageTextRequest(),
|
||||
setFcn: (map: Partial<SetCustomPasswordlessRegistrationMessageTextRequest.AsObject>):
|
||||
SetCustomPasswordlessRegistrationMessageTextRequest => {
|
||||
setFcn: (
|
||||
map: Partial<SetCustomPasswordlessRegistrationMessageTextRequest.AsObject>,
|
||||
): SetCustomPasswordlessRegistrationMessageTextRequest => {
|
||||
const req = new SetCustomPasswordlessRegistrationMessageTextRequest();
|
||||
req.setButtonText(map.buttonText ?? '');
|
||||
req.setFooterText(map.footerText ?? '');
|
||||
@@ -166,8 +173,7 @@ const REQUESTMAP = {
|
||||
[MESSAGETYPES.INIT]: {
|
||||
get: new AdminGetDefaultInitMessageTextRequest(),
|
||||
set: new SetDefaultInitMessageTextRequest(),
|
||||
setFcn: (map: Partial<MessageCustomText.AsObject>):
|
||||
SetDefaultInitMessageTextRequest => {
|
||||
setFcn: (map: Partial<MessageCustomText.AsObject>): SetDefaultInitMessageTextRequest => {
|
||||
const req = new SetDefaultInitMessageTextRequest();
|
||||
req.setButtonText(map.buttonText ?? '');
|
||||
req.setFooterText(map.footerText ?? '');
|
||||
@@ -183,8 +189,7 @@ const REQUESTMAP = {
|
||||
[MESSAGETYPES.VERIFYEMAIL]: {
|
||||
get: new AdminGetDefaultVerifyEmailMessageTextRequest(),
|
||||
set: new SetDefaultVerifyEmailMessageTextRequest(),
|
||||
setFcn: (map: Partial<MessageCustomText.AsObject>):
|
||||
SetDefaultVerifyEmailMessageTextRequest => {
|
||||
setFcn: (map: Partial<MessageCustomText.AsObject>): SetDefaultVerifyEmailMessageTextRequest => {
|
||||
const req = new SetDefaultVerifyEmailMessageTextRequest();
|
||||
req.setButtonText(map.buttonText ?? '');
|
||||
req.setFooterText(map.footerText ?? '');
|
||||
@@ -200,8 +205,7 @@ const REQUESTMAP = {
|
||||
[MESSAGETYPES.VERIFYPHONE]: {
|
||||
get: new AdminGetDefaultVerifyPhoneMessageTextRequest(),
|
||||
set: new SetDefaultVerifyPhoneMessageTextRequest(),
|
||||
setFcn: (map: Partial<MessageCustomText.AsObject>):
|
||||
SetDefaultVerifyPhoneMessageTextRequest => {
|
||||
setFcn: (map: Partial<MessageCustomText.AsObject>): SetDefaultVerifyPhoneMessageTextRequest => {
|
||||
const req = new SetDefaultVerifyPhoneMessageTextRequest();
|
||||
req.setButtonText(map.buttonText ?? '');
|
||||
req.setFooterText(map.footerText ?? '');
|
||||
@@ -217,8 +221,9 @@ const REQUESTMAP = {
|
||||
[MESSAGETYPES.PASSWORDRESET]: {
|
||||
get: new AdminGetCustomPasswordResetMessageTextRequest(),
|
||||
set: new SetDefaultPasswordResetMessageTextRequest(),
|
||||
setFcn: (map: Partial<SetDefaultPasswordResetMessageTextRequest.AsObject>):
|
||||
SetDefaultPasswordResetMessageTextRequest => {
|
||||
setFcn: (
|
||||
map: Partial<SetDefaultPasswordResetMessageTextRequest.AsObject>,
|
||||
): SetDefaultPasswordResetMessageTextRequest => {
|
||||
const req = new SetDefaultPasswordResetMessageTextRequest();
|
||||
req.setButtonText(map.buttonText ?? '');
|
||||
req.setFooterText(map.footerText ?? '');
|
||||
@@ -234,8 +239,9 @@ const REQUESTMAP = {
|
||||
[MESSAGETYPES.DOMAINCLAIMED]: {
|
||||
get: new GetDefaultDomainClaimedMessageTextRequest(),
|
||||
set: new SetDefaultDomainClaimedMessageTextRequest(),
|
||||
setFcn: (map: Partial<SetDefaultDomainClaimedMessageTextRequest.AsObject>):
|
||||
SetDefaultDomainClaimedMessageTextRequest => {
|
||||
setFcn: (
|
||||
map: Partial<SetDefaultDomainClaimedMessageTextRequest.AsObject>,
|
||||
): SetDefaultDomainClaimedMessageTextRequest => {
|
||||
const req = new SetDefaultDomainClaimedMessageTextRequest();
|
||||
req.setButtonText(map.buttonText ?? '');
|
||||
req.setFooterText(map.footerText ?? '');
|
||||
@@ -251,8 +257,9 @@ const REQUESTMAP = {
|
||||
[MESSAGETYPES.PASSWORDLESS]: {
|
||||
get: new GetDefaultPasswordlessRegistrationMessageTextRequest(),
|
||||
set: new SetDefaultPasswordlessRegistrationMessageTextRequest(),
|
||||
setFcn: (map: Partial<SetDefaultPasswordlessRegistrationMessageTextRequest.AsObject>):
|
||||
SetDefaultPasswordlessRegistrationMessageTextRequest => {
|
||||
setFcn: (
|
||||
map: Partial<SetDefaultPasswordlessRegistrationMessageTextRequest.AsObject>,
|
||||
): SetDefaultPasswordlessRegistrationMessageTextRequest => {
|
||||
const req = new SetDefaultPasswordlessRegistrationMessageTextRequest();
|
||||
req.setButtonText(map.buttonText ?? '');
|
||||
req.setFooterText(map.footerText ?? '');
|
||||
@@ -273,8 +280,8 @@ const REQUESTMAP = {
|
||||
styleUrls: ['./message-texts.component.scss'],
|
||||
})
|
||||
export class MessageTextsComponent implements OnDestroy {
|
||||
public getDefaultInitMessageTextMap$: Observable<{ [key: string]: string; }> = of({});
|
||||
public getCustomInitMessageTextMap$: BehaviorSubject<{ [key: string]: string; }> = new BehaviorSubject({});
|
||||
public getDefaultInitMessageTextMap$: Observable<{ [key: string]: string }> = of({});
|
||||
public getCustomInitMessageTextMap$: BehaviorSubject<{ [key: string]: string | boolean }> = new BehaviorSubject({}); // boolean because of isDefault
|
||||
|
||||
public currentType: MESSAGETYPES = MESSAGETYPES.INIT;
|
||||
|
||||
@@ -288,148 +295,186 @@ export class MessageTextsComponent implements OnDestroy {
|
||||
|
||||
public InfoSectionType: any = InfoSectionType;
|
||||
public chips: {
|
||||
[messagetype: string]: Array<{ key: string; value: string; }>;
|
||||
[messagetype: string]: Array<{ key: string; value: string }>;
|
||||
} = {
|
||||
[MESSAGETYPES.DOMAINCLAIMED]: [
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.preferredLoginName', value: '{{.PreferredLoginName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.domain', value: '{{.Domain}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.tempUsername', value: '{{.TempUsername}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.username', value: '{{.UserName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.firstname', value: '{{.FirstName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.lastname', value: '{{.Lastname}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.nickName', value: '{{.NickName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.displayName', value: '{{.DisplayName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.lastEmail', value: '{{.LastEmail}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.verifiedEmail', value: '{{.VerifiedEmail}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.lastPhone', value: '{{.LastPhone}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.verifiedPhone', value: '{{.VerifiedPhone}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.loginnames', value: '{{.LoginNames}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.changedate', value: '{{.ChangeDate}}' },
|
||||
],
|
||||
[MESSAGETYPES.INIT]: [
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.code', value: '{{.Code}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.preferredLoginName', value: '{{.PreferredLoginName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.username', value: '{{.UserName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.firstname', value: '{{.FirstName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.lastname', value: '{{.Lastname}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.nickName', value: '{{.NickName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.displayName', value: '{{.DisplayName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.lastEmail', value: '{{.LastEmail}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.verifiedEmail', value: '{{.VerifiedEmail}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.lastPhone', value: '{{.LastPhone}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.verifiedPhone', value: '{{.VerifiedPhone}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.loginnames', value: '{{.LoginNames}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.changedate', value: '{{.ChangeDate}}' },
|
||||
],
|
||||
[MESSAGETYPES.PASSWORDRESET]: [
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.code', value: '{{.Code}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.preferredLoginName', value: '{{.PreferredLoginName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.username', value: '{{.UserName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.firstname', value: '{{.FirstName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.lastname', value: '{{.Lastname}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.nickName', value: '{{.NickName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.displayName', value: '{{.DisplayName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.lastEmail', value: '{{.LastEmail}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.verifiedEmail', value: '{{.VerifiedEmail}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.lastPhone', value: '{{.LastPhone}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.verifiedPhone', value: '{{.VerifiedPhone}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.loginnames', value: '{{.LoginNames}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.changedate', value: '{{.ChangeDate}}' },
|
||||
],
|
||||
[MESSAGETYPES.VERIFYEMAIL]: [
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.code', value: '{{.Code}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.preferredLoginName', value: '{{.PreferredLoginName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.username', value: '{{.UserName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.firstname', value: '{{.FirstName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.lastname', value: '{{.Lastname}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.nickName', value: '{{.NickName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.displayName', value: '{{.DisplayName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.lastEmail', value: '{{.LastEmail}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.verifiedEmail', value: '{{.VerifiedEmail}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.lastPhone', value: '{{.LastPhone}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.verifiedPhone', value: '{{.VerifiedPhone}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.loginnames', value: '{{.LoginNames}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.changedate', value: '{{.ChangeDate}}' },
|
||||
],
|
||||
[MESSAGETYPES.VERIFYPHONE]: [
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.code', value: '{{.Code}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.preferredLoginName', value: '{{.PreferredLoginName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.username', value: '{{.UserName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.firstname', value: '{{.FirstName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.lastname', value: '{{.Lastname}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.nickName', value: '{{.NickName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.displayName', value: '{{.DisplayName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.lastEmail', value: '{{.LastEmail}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.verifiedEmail', value: '{{.VerifiedEmail}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.lastPhone', value: '{{.LastPhone}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.verifiedPhone', value: '{{.VerifiedPhone}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.loginnames', value: '{{.LoginNames}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.changedate', value: '{{.ChangeDate}}' },
|
||||
],
|
||||
[MESSAGETYPES.PASSWORDLESS]: [
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.preferredLoginName', value: '{{.PreferredLoginName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.username', value: '{{.UserName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.firstname', value: '{{.FirstName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.lastname', value: '{{.Lastname}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.nickName', value: '{{.NickName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.displayName', value: '{{.DisplayName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.lastEmail', value: '{{.LastEmail}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.verifiedEmail', value: '{{.VerifiedEmail}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.lastPhone', value: '{{.LastPhone}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.verifiedPhone', value: '{{.VerifiedPhone}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.loginnames', value: '{{.LoginNames}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.changedate', value: '{{.ChangeDate}}' },
|
||||
],
|
||||
};
|
||||
[MESSAGETYPES.DOMAINCLAIMED]: [
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.preferredLoginName', value: '{{.PreferredLoginName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.domain', value: '{{.Domain}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.tempUsername', value: '{{.TempUsername}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.username', value: '{{.UserName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.firstname', value: '{{.FirstName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.lastname', value: '{{.Lastname}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.nickName', value: '{{.NickName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.displayName', value: '{{.DisplayName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.lastEmail', value: '{{.LastEmail}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.verifiedEmail', value: '{{.VerifiedEmail}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.lastPhone', value: '{{.LastPhone}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.verifiedPhone', value: '{{.VerifiedPhone}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.loginnames', value: '{{.LoginNames}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.changedate', value: '{{.ChangeDate}}' },
|
||||
],
|
||||
[MESSAGETYPES.INIT]: [
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.code', value: '{{.Code}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.preferredLoginName', value: '{{.PreferredLoginName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.username', value: '{{.UserName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.firstname', value: '{{.FirstName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.lastname', value: '{{.Lastname}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.nickName', value: '{{.NickName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.displayName', value: '{{.DisplayName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.lastEmail', value: '{{.LastEmail}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.verifiedEmail', value: '{{.VerifiedEmail}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.lastPhone', value: '{{.LastPhone}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.verifiedPhone', value: '{{.VerifiedPhone}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.loginnames', value: '{{.LoginNames}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.changedate', value: '{{.ChangeDate}}' },
|
||||
],
|
||||
[MESSAGETYPES.PASSWORDRESET]: [
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.code', value: '{{.Code}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.preferredLoginName', value: '{{.PreferredLoginName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.username', value: '{{.UserName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.firstname', value: '{{.FirstName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.lastname', value: '{{.Lastname}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.nickName', value: '{{.NickName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.displayName', value: '{{.DisplayName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.lastEmail', value: '{{.LastEmail}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.verifiedEmail', value: '{{.VerifiedEmail}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.lastPhone', value: '{{.LastPhone}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.verifiedPhone', value: '{{.VerifiedPhone}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.loginnames', value: '{{.LoginNames}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.changedate', value: '{{.ChangeDate}}' },
|
||||
],
|
||||
[MESSAGETYPES.VERIFYEMAIL]: [
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.code', value: '{{.Code}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.preferredLoginName', value: '{{.PreferredLoginName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.username', value: '{{.UserName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.firstname', value: '{{.FirstName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.lastname', value: '{{.Lastname}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.nickName', value: '{{.NickName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.displayName', value: '{{.DisplayName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.lastEmail', value: '{{.LastEmail}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.verifiedEmail', value: '{{.VerifiedEmail}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.lastPhone', value: '{{.LastPhone}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.verifiedPhone', value: '{{.VerifiedPhone}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.loginnames', value: '{{.LoginNames}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.changedate', value: '{{.ChangeDate}}' },
|
||||
],
|
||||
[MESSAGETYPES.VERIFYPHONE]: [
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.code', value: '{{.Code}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.preferredLoginName', value: '{{.PreferredLoginName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.username', value: '{{.UserName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.firstname', value: '{{.FirstName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.lastname', value: '{{.Lastname}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.nickName', value: '{{.NickName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.displayName', value: '{{.DisplayName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.lastEmail', value: '{{.LastEmail}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.verifiedEmail', value: '{{.VerifiedEmail}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.lastPhone', value: '{{.LastPhone}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.verifiedPhone', value: '{{.VerifiedPhone}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.loginnames', value: '{{.LoginNames}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.changedate', value: '{{.ChangeDate}}' },
|
||||
],
|
||||
[MESSAGETYPES.PASSWORDLESS]: [
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.preferredLoginName', value: '{{.PreferredLoginName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.username', value: '{{.UserName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.firstname', value: '{{.FirstName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.lastname', value: '{{.Lastname}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.nickName', value: '{{.NickName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.displayName', value: '{{.DisplayName}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.lastEmail', value: '{{.LastEmail}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.verifiedEmail', value: '{{.VerifiedEmail}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.lastPhone', value: '{{.LastPhone}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.verifiedPhone', value: '{{.VerifiedPhone}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.loginnames', value: '{{.LoginNames}}' },
|
||||
{ key: 'POLICY.MESSAGE_TEXTS.CHIPS.changedate', value: '{{.ChangeDate}}' },
|
||||
],
|
||||
};
|
||||
|
||||
public locale: string = 'en';
|
||||
public LOCALES: string[] = ['en', 'de', 'it'];
|
||||
private sub: Subscription = new Subscription();
|
||||
public currentPolicy: GridPolicy = MESSAGE_TEXTS_POLICY;
|
||||
public orgName: string = '';
|
||||
public canWrite$: Observable<boolean> = this.authService.isAllowed([
|
||||
this.serviceType === PolicyComponentServiceType.ADMIN
|
||||
? 'iam.policy.write'
|
||||
: this.serviceType === PolicyComponentServiceType.MGMT
|
||||
? 'policy.write'
|
||||
: '',
|
||||
]);
|
||||
|
||||
constructor(
|
||||
private authService: GrpcAuthService,
|
||||
private route: ActivatedRoute,
|
||||
private toast: ToastService,
|
||||
private injector: Injector,
|
||||
private dialog: MatDialog,
|
||||
private storageService: StorageService,
|
||||
breadcrumbService: BreadcrumbService,
|
||||
) {
|
||||
this.sub = this.route.data.pipe(switchMap(data => {
|
||||
this.serviceType = data.serviceType;
|
||||
switch (this.serviceType) {
|
||||
case PolicyComponentServiceType.MGMT:
|
||||
this.service = this.injector.get(ManagementService as Type<ManagementService>);
|
||||
this.service.getSupportedLanguages().then(lang => {
|
||||
this.LOCALES = lang.languagesList;
|
||||
});
|
||||
this.loadData(this.currentType);
|
||||
break;
|
||||
case PolicyComponentServiceType.ADMIN:
|
||||
this.service = this.injector.get(AdminService as Type<AdminService>);
|
||||
this.service.getSupportedLanguages().then(lang => {
|
||||
this.LOCALES = lang.languagesList;
|
||||
});
|
||||
this.loadData(this.currentType);
|
||||
break;
|
||||
}
|
||||
this.sub = this.route.data
|
||||
.pipe(
|
||||
switchMap((data) => {
|
||||
this.serviceType = data.serviceType;
|
||||
switch (this.serviceType) {
|
||||
case PolicyComponentServiceType.MGMT:
|
||||
this.service = this.injector.get(ManagementService as Type<ManagementService>);
|
||||
this.service.getSupportedLanguages().then((lang) => {
|
||||
this.LOCALES = lang.languagesList;
|
||||
});
|
||||
this.loadData(this.currentType);
|
||||
const org: Org.AsObject | null = this.storageService.getItem('organization', StorageLocation.session);
|
||||
if (org && org.id) {
|
||||
this.orgName = org.name;
|
||||
}
|
||||
|
||||
return this.route.params;
|
||||
})).subscribe();
|
||||
const iambread = new Breadcrumb({
|
||||
type: BreadcrumbType.IAM,
|
||||
name: 'System',
|
||||
routerLink: ['/system'],
|
||||
});
|
||||
const bread: Breadcrumb = {
|
||||
type: BreadcrumbType.ORG,
|
||||
routerLink: ['/org'],
|
||||
};
|
||||
breadcrumbService.setBreadcrumb([iambread, bread]);
|
||||
break;
|
||||
case PolicyComponentServiceType.ADMIN:
|
||||
this.service = this.injector.get(AdminService as Type<AdminService>);
|
||||
this.service.getSupportedLanguages().then((lang) => {
|
||||
this.LOCALES = lang.languagesList;
|
||||
});
|
||||
this.loadData(this.currentType);
|
||||
|
||||
const iamBread = new Breadcrumb({
|
||||
type: BreadcrumbType.IAM,
|
||||
name: 'System',
|
||||
routerLink: ['/system'],
|
||||
});
|
||||
breadcrumbService.setBreadcrumb([iamBread]);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return this.route.params;
|
||||
}),
|
||||
)
|
||||
.subscribe();
|
||||
}
|
||||
|
||||
public getDefaultValues(type: MESSAGETYPES, req: any): Promise<any> {
|
||||
switch (type) {
|
||||
case MESSAGETYPES.INIT:
|
||||
return this.stripDetails((this.service).getDefaultInitMessageText(req));
|
||||
return this.stripDetails(this.service.getDefaultInitMessageText(req));
|
||||
case MESSAGETYPES.VERIFYPHONE:
|
||||
return this.stripDetails((this.service).getDefaultVerifyPhoneMessageText(req));
|
||||
return this.stripDetails(this.service.getDefaultVerifyPhoneMessageText(req));
|
||||
case MESSAGETYPES.VERIFYEMAIL:
|
||||
return this.stripDetails((this.service).getDefaultVerifyEmailMessageText(req));
|
||||
return this.stripDetails(this.service.getDefaultVerifyEmailMessageText(req));
|
||||
case MESSAGETYPES.PASSWORDRESET:
|
||||
return this.stripDetails((this.service).getDefaultPasswordResetMessageText(req));
|
||||
return this.stripDetails(this.service.getDefaultPasswordResetMessageText(req));
|
||||
case MESSAGETYPES.DOMAINCLAIMED:
|
||||
return this.stripDetails((this.service).getDefaultDomainClaimedMessageText(req));
|
||||
return this.stripDetails(this.service.getDefaultDomainClaimedMessageText(req));
|
||||
case MESSAGETYPES.PASSWORDLESS:
|
||||
return this.stripDetails((this.service).getDefaultPasswordlessRegistrationMessageText(req));
|
||||
return this.stripDetails(this.service.getDefaultPasswordlessRegistrationMessageText(req));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -483,19 +528,20 @@ export class MessageTextsComponent implements OnDestroy {
|
||||
const reqDefaultInit = REQUESTMAP[this.serviceType][type].getDefault;
|
||||
|
||||
reqDefaultInit.setLanguage(this.locale);
|
||||
console.log(this.locale);
|
||||
this.getDefaultInitMessageTextMap$ = from(
|
||||
this.getDefaultValues(type, reqDefaultInit),
|
||||
);
|
||||
this.getDefaultInitMessageTextMap$ = from(this.getDefaultValues(type, reqDefaultInit));
|
||||
}
|
||||
|
||||
const reqCustomInit = REQUESTMAP[this.serviceType][type].get.setLanguage(this.locale);
|
||||
this.getCustomInitMessageTextMap$.next(
|
||||
await this.getCurrentValues(type, reqCustomInit),
|
||||
);
|
||||
return this.getCurrentValues(type, reqCustomInit)
|
||||
?.then((data) => {
|
||||
this.getCustomInitMessageTextMap$.next(data);
|
||||
})
|
||||
.catch((error) => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
|
||||
public updateCurrentValues(values: { [key: string]: string; }): void {
|
||||
public updateCurrentValues(values: { [key: string]: string }): void {
|
||||
const req = REQUESTMAP[this.serviceType][this.currentType].setFcn;
|
||||
const mappedValues = req(values);
|
||||
this.updateRequest = mappedValues;
|
||||
@@ -504,9 +550,11 @@ export class MessageTextsComponent implements OnDestroy {
|
||||
|
||||
public saveCurrentMessage(): any {
|
||||
const handler = (prom: Promise<any>): Promise<any> => {
|
||||
return prom.then(() => {
|
||||
this.toast.showInfo('POLICY.MESSAGE_TEXTS.TOAST.UPDATED', true);
|
||||
}).catch(error => this.toast.showError(error));
|
||||
return prom
|
||||
.then(() => {
|
||||
this.toast.showInfo('POLICY.MESSAGE_TEXTS.TOAST.UPDATED', true);
|
||||
})
|
||||
.catch((error) => this.toast.showError(error));
|
||||
};
|
||||
if (this.serviceType === PolicyComponentServiceType.MGMT) {
|
||||
switch (this.currentType) {
|
||||
@@ -521,8 +569,9 @@ export class MessageTextsComponent implements OnDestroy {
|
||||
case MESSAGETYPES.DOMAINCLAIMED:
|
||||
return handler((this.service as ManagementService).setCustomDomainClaimedMessageCustomText(this.updateRequest));
|
||||
case MESSAGETYPES.PASSWORDLESS:
|
||||
return handler((this.service as ManagementService)
|
||||
.getCustomPasswordlessRegistrationMessageText(this.updateRequest));
|
||||
return handler(
|
||||
(this.service as ManagementService).getCustomPasswordlessRegistrationMessageText(this.updateRequest),
|
||||
);
|
||||
}
|
||||
} else if (this.serviceType === PolicyComponentServiceType.ADMIN) {
|
||||
switch (this.currentType) {
|
||||
@@ -537,8 +586,7 @@ export class MessageTextsComponent implements OnDestroy {
|
||||
case MESSAGETYPES.DOMAINCLAIMED:
|
||||
return handler((this.service as AdminService).setDefaultDomainClaimedMessageText(this.updateRequest));
|
||||
case MESSAGETYPES.PASSWORDLESS:
|
||||
return handler((this.service as AdminService)
|
||||
.setDefaultPasswordlessRegistrationMessageText(this.updateRequest));
|
||||
return handler((this.service as AdminService).setDefaultPasswordlessRegistrationMessageText(this.updateRequest));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -555,16 +603,18 @@ export class MessageTextsComponent implements OnDestroy {
|
||||
width: '400px',
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe(resp => {
|
||||
dialogRef.afterClosed().subscribe((resp) => {
|
||||
if (resp && this.serviceType === PolicyComponentServiceType.MGMT) {
|
||||
const handler = (prom: Promise<any>): Promise<any> => {
|
||||
return prom.then(() => {
|
||||
setTimeout(() => {
|
||||
this.loadData(this.currentType);
|
||||
}, 1000);
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
return prom
|
||||
.then(() => {
|
||||
setTimeout(() => {
|
||||
this.loadData(this.currentType);
|
||||
}, 1000);
|
||||
})
|
||||
.catch((error) => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
};
|
||||
|
||||
switch (this.currentType) {
|
||||
@@ -579,8 +629,9 @@ export class MessageTextsComponent implements OnDestroy {
|
||||
case MESSAGETYPES.DOMAINCLAIMED:
|
||||
return handler((this.service as ManagementService).resetCustomDomainClaimedMessageTextToDefault(this.locale));
|
||||
case MESSAGETYPES.DOMAINCLAIMED:
|
||||
return handler((this.service as ManagementService)
|
||||
.resetCustomPasswordlessRegistrationMessageTextToDefault(this.locale));
|
||||
return handler(
|
||||
(this.service as ManagementService).resetCustomPasswordlessRegistrationMessageTextToDefault(this.locale),
|
||||
);
|
||||
default:
|
||||
return Promise.reject();
|
||||
}
|
||||
@@ -591,10 +642,10 @@ export class MessageTextsComponent implements OnDestroy {
|
||||
}
|
||||
|
||||
private stripDetails(prom: Promise<any>): Promise<any> {
|
||||
return prom.then(res => {
|
||||
return prom.then((res) => {
|
||||
if (res.customText) {
|
||||
delete res.customText.details;
|
||||
return Object.assign({}, res.customText as unknown as { [key: string]: string; });
|
||||
return Object.assign({}, res.customText as unknown as { [key: string]: string });
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
@@ -604,8 +655,7 @@ export class MessageTextsComponent implements OnDestroy {
|
||||
this.sub.unsubscribe();
|
||||
}
|
||||
|
||||
public setCurrentType(key: MESSAGETYPES): void {
|
||||
this.currentType = key;
|
||||
public changedCurrentType(): void {
|
||||
this.loadData(this.currentType);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user