-
Notifications
You must be signed in to change notification settings - Fork 3
feat: Organization full page support #135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
0e33c77
Merge pull request #122 from contentstack/develop
MaitriGurey1 726f589
fix: resolve data file field handler
abhishek305 beb17b5
fix: PR feedback
abhishek305 4ab6a5b
fix: PR feedbacn optional chain
abhishek305 da6825e
Added Content type sidebar UI location
praveen-mohan-cs be6497e
sca-scan.yml
aravindbuilt e59ce41
jira.yml
aravindbuilt fe70f19
sast-scan.yml
aravindbuilt 15206b3
Updated codeowners
aravindbuilt 19b239c
Merge branch 'main' into staging
abhishek305 65fc727
fix: resolve data file field handler
abhishek305 a50a136
fix: PR feedback
abhishek305 0b79d1a
fix: PR feedbacn optional chain
abhishek305 218c8bd
Merge branch 'staging' of https://github.com/contentstack/app-sdk int…
praveen-mohan-cs 59eb67e
Addressed PR comments
praveen-mohan-cs 51577bb
Addressed PR comments
praveen-mohan-cs ee18192
Merge pull request #132 from contentstack/feat/DEVREL-203-content-typ…
praveen-mohan-cs e2ae3e6
Version bump
praveen-mohan-cs 50303b1
Merge pull request #133 from contentstack/feat/DEVREL-203-content-typ…
praveen-mohan-cs 5529760
Merge branch 'main' into staging
praveen-mohan-cs a15cecb
sca-scan.yml
aravindbuilt c576a67
jira.yml
aravindbuilt 3a1c5de
sast-scan.yml
aravindbuilt 1e23222
Updated codeowners
aravindbuilt 19763e0
Merge branch 'main' into staging
abhishek305 2e76370
License update
abhishek305 82e0dd2
feat: Organization full page support
abhishek305 3785653
chore: version update
abhishek305 f10a29d
PR: feedback
abhishek305 9e20e26
Merge branch 'develop' into MKT-10640
abhishek305 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import { IOrgFullPageLocationInitData, LocationType } from "../src/types"; | ||
| import { OrganizationDetails } from "../src/types/organization.types"; | ||
|
|
||
| const mockData: IOrgFullPageLocationInitData = { | ||
| type: LocationType.ORGANIZATION_FULL_PAGE, | ||
| app_id: "app_id", | ||
| installation_uid: "installation_uid", | ||
| extension_uid: "extension_uid", | ||
| region: "NA", | ||
| stack: {} as any, | ||
| user: {} as any, | ||
| currentBranch: "currentBranch", | ||
| organization: {} as OrganizationDetails, | ||
| }; | ||
| const organizationFullPage = { | ||
| currentOrganization: mockData.organization, | ||
| }; | ||
|
|
||
| afterEach(() => { | ||
| jest.clearAllMocks(); | ||
| }); | ||
|
|
||
| test("should return organization details", () => { | ||
| expect(organizationFullPage.currentOrganization).toBe(mockData.organization); | ||
| }); | ||
|
|
||
| test("should handle missing organization details", () => { | ||
| const invalidData: IOrgFullPageLocationInitData = { | ||
| ...mockData, | ||
| organization: null as any, // check missing organization details | ||
| }; | ||
| const invalidOrganizationFullPage = { | ||
| currentOrganization: invalidData.organization, | ||
| }; | ||
| expect(invalidOrganizationFullPage.currentOrganization).toBeNull(); | ||
| }); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| import EventEmitter from "wolfy87-eventemitter"; | ||
| import postRobot from "post-robot"; | ||
| import { IContentTypeSidebarInitData } from "./types"; | ||
| import { ContentType } from "./types/stack.types"; | ||
| import { GenericObjectType } from "./types/common.types"; | ||
|
|
||
| /** Class representing a Content type Sidebar UI Location from Contentstack UI. */ | ||
|
|
||
| class ContentTypeSidebarWidget { | ||
| /** | ||
| * @hideconstructor | ||
| */ | ||
|
|
||
| currentContentType: ContentType; | ||
| _emitter: EventEmitter; | ||
| _connection: typeof postRobot; | ||
| _changedData?: GenericObjectType; | ||
|
|
||
| constructor( | ||
| initializationData: IContentTypeSidebarInitData, | ||
| connection: typeof postRobot, | ||
| emitter: EventEmitter | ||
| ) { | ||
| this.currentContentType = initializationData.currentContentType; | ||
|
|
||
| this._emitter = emitter; | ||
|
|
||
| this._connection = connection; | ||
|
|
||
| const thisContentType = this; | ||
|
|
||
| this._emitter.on("contentTypeSave", (event: { data: ContentType }) => { | ||
| thisContentType.currentContentType = event.data; | ||
| }); | ||
|
|
||
| this.getData = this.getData.bind(this); | ||
| this.onSave = this.onSave.bind(this); | ||
| } | ||
|
|
||
| /** | ||
| * Get the current content type data. | ||
| * @returns {ContentTypeData} The current content type data. | ||
| */ | ||
| getData(): ContentType { | ||
| return this.currentContentType; | ||
| } | ||
|
|
||
| /** | ||
| * Executes the provided callback function every time a content type is saved. | ||
| * @param {function} callback - The function to be called when a content type is saved. | ||
| * @param {ContentType} arg0 - The content type data passed as an argument to the callback function when a content type is saved. | ||
| */ | ||
| onSave(callback: (arg0: ContentType) => void) { | ||
| const contentTypeObj = this; | ||
| if (callback && typeof callback === "function") { | ||
| contentTypeObj._emitter.on( | ||
| "contentTypeSave", | ||
| (event: { data: ContentType }) => { | ||
| callback(event.data); | ||
| } | ||
| ); | ||
| this._emitter.emitEvent("_eventRegistration", [ | ||
| { name: "contentTypeSave" }, | ||
| ]); | ||
| } else { | ||
| throw Error("Callback must be a function"); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| export default ContentTypeSidebarWidget; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import { GenericObjectType } from "./common.types"; | ||
|
|
||
| export declare interface OrganizationDetails { | ||
| uid: string; | ||
| name: string; | ||
| owner_uid: string; | ||
| expires_on: string; | ||
| enabled: boolean; | ||
| created_at: string; | ||
| updated_at: string; | ||
| tags: string[]; | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.