-
Notifications
You must be signed in to change notification settings - Fork 4.5k
chore: git mod - git context & context aware comps #38060
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
24 commits
Select commit
Hold shift + click to select a range
1119f65
chore: adding apis for git
2900b65
fix: review changes
0d1fa18
Merge branch 'release' of github.com:appsmithorg/appsmith into chore/…
146238c
fix: fixing enum imports
e72e02f
chore: changing named export to default export
54b5d93
Merge branch 'release' of github.com:appsmithorg/appsmith into chore/…
a1b608b
Merge branch 'release' of github.com:appsmithorg/appsmith into chore/…
0bb662f
fix: adding saga for commit and connect
d7e6c79
chore: adding global profile and config redux slice
02e128b
chore: adding saga for git profile update
3218b3a
chore: adding fetch branches saga
f9c4030
chore: adding fetch and update local profile
adafd14
fix: fixing connectsaga
488b346
fix: review changes
942193d
chore: adding branch based sagas
e9167f2
fix: moving things around
d024160
chore: adding ctx
ef34582
chore: expanding context provider and making contextaware comps
c3d9a31
fix: remove gittest
9b1414e
fix: test fixes
2de337e
fix: review changes
3a2a045
Merge branch 'release' of github.com:appsmithorg/appsmith into chore/…
59f91f4
fix: resolving conflict errors
e1eb35a
fix: review changes
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
app/client/src/git/components/CtxAwareGitQuickActions/hooks/useStatusChangeCount.ts
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,40 @@ | ||
| import type { FetchStatusResponseData } from "git/requests/fetchStatusRequest.types"; | ||
| import { useMemo } from "react"; | ||
|
|
||
| // does not include modules or moduleinstances | ||
| export const calcStatusChangeCount = (status: FetchStatusResponseData) => { | ||
| const { | ||
| modified = [], | ||
| modifiedDatasources = 0, | ||
| modifiedJSLibs = 0, | ||
| modifiedJSObjects = 0, | ||
| modifiedModules = 0, | ||
| modifiedPages = 0, | ||
| modifiedQueries = 0, | ||
| } = status || {}; | ||
| const themeCount = modified.includes("theme.json") ? 1 : 0; | ||
| const settingsCount = modified.includes("application.json") ? 1 : 0; | ||
|
|
||
| // does not include ahead and behind remote counts | ||
| return ( | ||
| modifiedDatasources + | ||
| modifiedJSLibs + | ||
| modifiedJSObjects + | ||
| modifiedModules + | ||
| modifiedPages + | ||
| modifiedQueries + | ||
| themeCount + | ||
| settingsCount | ||
| ); | ||
| }; | ||
|
|
||
| export default function useStatusChangeCount( | ||
| status: FetchStatusResponseData | null, | ||
| ) { | ||
| const statusChangeCount = useMemo( | ||
| () => (status ? calcStatusChangeCount(status) : 0), | ||
| [status], | ||
| ); | ||
|
|
||
| return statusChangeCount; | ||
| } |
54 changes: 54 additions & 0 deletions
54
app/client/src/git/components/CtxAwareGitQuickActions/index.tsx
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,54 @@ | ||
| import React from "react"; | ||
| import GitQuickActions from "../GitQuickActions"; | ||
| import { useGitContext } from "../GitContextProvider"; | ||
| import useStatusChangeCount from "./hooks/useStatusChangeCount"; | ||
|
|
||
| function CtxAwareGitQuickActions() { | ||
| const { | ||
| discard, | ||
| discardLoading, | ||
| fetchStatusLoading, | ||
| pull, | ||
| pullError, | ||
| pullLoading, | ||
| status, | ||
| toggleGitConnectModal, | ||
| toggleGitOpsModal, | ||
| toggleGitSettingsModal, | ||
| } = useGitContext(); | ||
|
|
||
| const isGitConnected = false; | ||
| const isAutocommitEnabled = true; | ||
| const isAutocommitPolling = false; | ||
| const isConnectPermitted = true; | ||
| const isProtectedMode = false; | ||
|
|
||
| const isPullFailing = !!pullError; | ||
| const isStatusClean = status?.isClean ?? false; | ||
| const statusBehindCount = status?.behindCount ?? 0; | ||
| const statusChangeCount = useStatusChangeCount(status); | ||
|
|
||
| return ( | ||
| <GitQuickActions | ||
| discard={discard} | ||
| isAutocommitEnabled={isAutocommitEnabled} | ||
| isAutocommitPolling={isAutocommitPolling} | ||
| isConnectPermitted={isConnectPermitted} | ||
| isDiscardLoading={discardLoading} | ||
| isFetchStatusLoading={fetchStatusLoading} | ||
| isGitConnected={isGitConnected} | ||
| isProtectedMode={isProtectedMode} | ||
| isPullFailing={isPullFailing} | ||
| isPullLoading={pullLoading} | ||
| isStatusClean={isStatusClean} | ||
| pull={pull} | ||
| statusBehindCount={statusBehindCount} | ||
| statusChangeCount={statusChangeCount} | ||
| toggleGitConnectModal={toggleGitConnectModal} | ||
| toggleGitOpsModal={toggleGitOpsModal} | ||
| toggleGitSettingsModal={toggleGitSettingsModal} | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
| export default CtxAwareGitQuickActions; | ||
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.