Skip to content

Commit

Permalink
PREAPPS-5263: add zimletConfig into accountInfo response
Browse files Browse the repository at this point in the history
- addressed review comments

PREAPPS-5263: fixed an issue when there are no zimlet configs available and the app was erroring out
  • Loading branch information
itsmeprashant authored and yashrajpchavda committed Aug 21, 2020
1 parent f81f28e commit 761fe27
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 10 deletions.
18 changes: 16 additions & 2 deletions src/batch-client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ import {
SearchResponse,
SendMessageInfo,
ShareNotification,
Tag
Tag,
ZimletConfigEntity
} from '../normalize/entities';
import {
batchJsonRequest,
Expand Down Expand Up @@ -282,7 +283,20 @@ export class ZimbraBatchClient {
status: res.license.status,
attr: mapValuesDeep(res.license.attr, coerceStringToBoolean)
}
})
}),
zimlets: {
zimlet:
get(res, 'zimlets.zimlet') &&
get(res, 'zimlets.zimlet').map(
({ zimlet, zimletContext, zimletConfig }: any) => ({
zimlet,
zimletContext,
...(zimletConfig && {
zimletConfig: normalize(ZimletConfigEntity)(zimletConfig)
})
})
)
}
}));

public action = (type: ActionType, options: ActionOptions) => {
Expand Down
18 changes: 18 additions & 0 deletions src/normalize/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -690,3 +690,21 @@ export const Tag = new Entity({
export const Mailbox = new Entity({
s: 'used'
});

export const ZimletConfigPropertyEntity = new Entity({
_content: 'content'
});

export const ZimletConfigGlobalEntity = new Entity({
property: ['property', ZimletConfigPropertyEntity]
});

export const ZimletConfigHostEntity = new Entity({
property: ['property', ZimletConfigPropertyEntity]
});

export const ZimletConfigEntity = new Entity({
global: ['global', ZimletConfigGlobalEntity],
host: ['host', ZimletConfigHostEntity],
property: ['property', ZimletConfigPropertyEntity]
});
23 changes: 19 additions & 4 deletions src/schema/generated-schema-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,11 @@ export type AccountZimlet = {

export type AccountZimletConfigInfo = {
__typename?: 'AccountZimletConfigInfo';
global?: Maybe<Array<Maybe<ZimletConfigGlobal>>>;
host?: Maybe<Array<Maybe<ZimletConfigHost>>>;
property?: Maybe<Array<Maybe<ZimletConfigProperty>>>;
name?: Maybe<Scalars['String']>;
version?: Maybe<Scalars['String']>;
description?: Maybe<Scalars['String']>;
extension?: Maybe<Scalars['String']>;
target?: Maybe<Scalars['String']>;
label?: Maybe<Scalars['String']>;
};

export type AccountZimletContext = {
Expand Down Expand Up @@ -3935,6 +3934,22 @@ export type WorkingHoursInstance = {
end?: Maybe<Scalars['Float']>;
};

export type ZimletConfigGlobal = {
__typename?: 'ZimletConfigGlobal';
property?: Maybe<Array<Maybe<ZimletConfigProperty>>>;
};

export type ZimletConfigHost = {
__typename?: 'ZimletConfigHost';
property?: Maybe<Array<Maybe<ZimletConfigProperty>>>;
};

export type ZimletConfigProperty = {
__typename?: 'ZimletConfigProperty';
name?: Maybe<Scalars['String']>;
content?: Maybe<Scalars['String']>;
};

export type ZimletPref = {
__typename?: 'ZimletPref';
name?: Maybe<Scalars['String']>;
Expand Down
20 changes: 16 additions & 4 deletions src/schema/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1206,13 +1206,25 @@ type AccountZimletDesc {
zimbraXZimletCompatibleSemVer: String
}

type ZimletConfigProperty {
name: String
content: String
}

type ZimletConfigGlobal {
property: [ZimletConfigProperty]
}

type ZimletConfigHost {
property: [ZimletConfigProperty]
}

type AccountZimletConfigInfo {
global: [ZimletConfigGlobal]
host: [ZimletConfigHost]
property: [ZimletConfigProperty]
name: String
version: String
description: String
extension: String
target: String
label: String
}

type AccountInfoAttrs {
Expand Down

0 comments on commit 761fe27

Please sign in to comment.