Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Project Management #2308

Merged
merged 82 commits into from
Oct 28, 2019
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
cfee43f
Add Git + GitHub context headers
simurai Feb 12, 2019
8d867b0
add project repo change ability
wadethestealth Oct 15, 2019
73b1ff8
update project context ui for github tab
wadethestealth Oct 15, 2019
d4ce922
rename to header-view
wadethestealth Oct 15, 2019
1f3cfc6
add header view to git tab
wadethestealth Oct 15, 2019
0ceb2ff
remove avatar and refresh button for mvp
wadethestealth Oct 16, 2019
1d8cef8
fix lint
wadethestealth Oct 16, 2019
5e3414a
remove padding
wadethestealth Oct 16, 2019
691ca1d
fix 'CurrentPullRequestContainer' test warnings
wadethestealth Oct 16, 2019
0dc2505
fix 'GitTabContainer' test warnings
wadethestealth Oct 16, 2019
61a39e3
fix 'GitHubTabContainer' test warnings
wadethestealth Oct 16, 2019
c22dc33
create generic Error Boundary
wadethestealth Oct 16, 2019
59db453
fix 'Decoration' test warnings
wadethestealth Oct 16, 2019
1323ea4
fix 'Marker' test warnings
wadethestealth Oct 16, 2019
f8df70e
fix 'IssueDetailContainer' test warnings
wadethestealth Oct 16, 2019
ecac2bd
fix 'IssueishSearchContainer' test warnings
wadethestealth Oct 16, 2019
ad45fe4
fix 'ReviewsContainer' test warnings
wadethestealth Oct 16, 2019
3e7fd43
fix 'ChangedFileController' test warnings
wadethestealth Oct 16, 2019
924807c
fix 'CommentDecorationsController' test warnings
wadethestealth Oct 16, 2019
7a9d05c
fix 'CommentDecorationsContainer' test warnings
wadethestealth Oct 16, 2019
0162fc9
correctly consume Relay Query error on 'IssueishSearchContainer' test
wadethestealth Oct 16, 2019
004d5b4
fix async test error
wadethestealth Oct 17, 2019
32f0360
update test props for github tab view
wadethestealth Oct 17, 2019
52ef584
remove active pane context guessing
wadethestealth Oct 17, 2019
9cbd126
LINT MEH BABHEH :baby:
wadethestealth Oct 17, 2019
413cd2d
Merge remote-tracking branch 'upstream/master' into project-management
wadethestealth Oct 17, 2019
98adefc
update to not prefer absent context from preferred/saved state work dir
wadethestealth Oct 17, 2019
083f650
update some test for github-package
wadethestealth Oct 17, 2019
5a0fd75
remove unapplicable tests
wadethestealth Oct 17, 2019
35e0df5
remove unnecessary test case step
wadethestealth Oct 17, 2019
e7f5ec8
simplify rendering header
wadethestealth Oct 17, 2019
d64c079
clean up header render
wadethestealth Oct 17, 2019
e1e7795
undo test nesting
wadethestealth Oct 18, 2019
63cd27e
remove only
wadethestealth Oct 18, 2019
61cdf7c
Merge branch 'master' into project-management
wadethestealth Oct 22, 2019
571a095
revert globals
wadethestealth Oct 22, 2019
73de350
replace context with describe
wadethestealth Oct 22, 2019
52c70d9
update error catching
wadethestealth Oct 22, 2019
21e025b
remove only
wadethestealth Oct 22, 2019
8d6870b
remove unapplicable
wadethestealth Oct 22, 2019
558c9a0
remove active pane listener
wadethestealth Oct 23, 2019
f03e06a
update all tests
wadethestealth Oct 23, 2019
34adef2
lints
wadethestealth Oct 23, 2019
72eb56c
lints
wadethestealth Oct 23, 2019
aa2edc9
add test cases
wadethestealth Oct 23, 2019
265072c
add integration tests
wadethestealth Oct 23, 2019
40df468
lint
wadethestealth Oct 23, 2019
bfedc49
Update test/atom/marker.test.js
wadethestealth Oct 24, 2019
24aa298
update bad assert
wadethestealth Oct 24, 2019
ebfa43c
name change
wadethestealth Oct 24, 2019
cf1fd25
remove comments
wadethestealth Oct 24, 2019
3c73da4
update error boundary
wadethestealth Oct 24, 2019
5dbdd62
name change
wadethestealth Oct 24, 2019
dde9b3b
remove extras
wadethestealth Oct 24, 2019
22b6a80
remove unused pane function
wadethestealth Oct 24, 2019
8bd2612
remove unused refs
wadethestealth Oct 24, 2019
a1cb095
change render logic to use function call instead of switch statement
wadethestealth Oct 24, 2019
5bb76cb
Update lib/views/header-view.js
wadethestealth Oct 24, 2019
d5a555a
Update lib/error-boundary.js
wadethestealth Oct 25, 2019
44f6ea5
update tests to shallow instead of mount
wadethestealth Oct 25, 2019
1a9938a
Merge branch 'project-management' of https://github.com/wadethestealt…
wadethestealth Oct 25, 2019
faa00ae
name change to TabHeaderView
wadethestealth Oct 25, 2019
6f249de
simplify context removal from pool
wadethestealth Oct 25, 2019
1d00a4c
add event for when open workdirs change
wadethestealth Oct 25, 2019
23d1dc4
typo
wadethestealth Oct 25, 2019
810ad66
name change to avoid confusion
wadethestealth Oct 25, 2019
ef802dc
use workdirs instead of project paths
wadethestealth Oct 25, 2019
9ec4e75
lint
wadethestealth Oct 25, 2019
d33d7da
invalid use of property
wadethestealth Oct 25, 2019
6a34a52
use workdirs working prototype
wadethestealth Oct 25, 2019
70f8028
remove stub restores
wadethestealth Oct 25, 2019
80f8b89
fix incorrect assert
wadethestealth Oct 25, 2019
f9fc198
update test
wadethestealth Oct 25, 2019
9bfe8f9
fix tests
wadethestealth Oct 25, 2019
95dcc1b
update tests
wadethestealth Oct 25, 2019
2192a25
lints
wadethestealth Oct 25, 2019
a28ece8
test fixes
wadethestealth Oct 25, 2019
1e2a8b8
update test cases
wadethestealth Oct 26, 2019
11d39d1
lints
wadethestealth Oct 26, 2019
7a0315a
add work dir pool tests
wadethestealth Oct 26, 2019
879b702
lints
wadethestealth Oct 26, 2019
1069fc9
remove extra fixture
wadethestealth Oct 26, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions lib/containers/github-tab-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,18 @@ export default class GitHubTabContainer extends React.Component {
}

if (!this.props.repository.isPresent()) {
// TODO include a better message here.
return null;
return (
<GitHubTabController
{...this.props}
remoteOperationObserver={this.state.remoteOperationObserver}

allRemotes={new RemoteSet()}
branches={new BranchSet()}
aheadCount={0}
pushInProgress={false}
isLoading={false}
/>
);
}

return (
Expand Down
5 changes: 1 addition & 4 deletions lib/controllers/editor-comment-decorations-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ export default class EditorCommentDecorationsController extends React.Component
workspace: PropTypes.object.isRequired,
editor: PropTypes.object.isRequired,
threadsForPath: PropTypes.arrayOf(PropTypes.shape({
rootCommentID: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
]).isRequired,
rootCommentID: PropTypes.string.isRequired,
position: PropTypes.number,
threadID: PropTypes.string.isRequired,
})).isRequired,
Expand Down
7 changes: 6 additions & 1 deletion lib/controllers/git-tab-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default class GitTabController extends React.Component {
workingDirectoryPath: PropTypes.string,
mergeMessage: PropTypes.string,
fetchInProgress: PropTypes.bool.isRequired,
currentWorkDir: PropTypes.string,

workspace: PropTypes.object.isRequired,
commands: PropTypes.object.isRequired,
Expand All @@ -52,6 +53,8 @@ export default class GitTabController extends React.Component {
openInitializeDialog: PropTypes.func.isRequired,
controllerRef: RefHolderPropType,
changeWorkingDirectory: PropTypes.func.isRequired,
onDidChangeWorkDirs: PropTypes.func.isRequired,
getCurrentWorkDirs: PropTypes.func.isRequired,
};

constructor(props, context) {
Expand Down Expand Up @@ -100,7 +103,7 @@ export default class GitTabController extends React.Component {
unstagedChanges={this.props.unstagedChanges}
stagedChanges={this.props.stagedChanges}
mergeConflicts={this.props.mergeConflicts}
workingDirectoryPath={this.props.workingDirectoryPath}
workingDirectoryPath={this.props.workingDirectoryPath || this.props.currentWorkDir}
mergeMessage={this.props.mergeMessage}
userStore={this.userStore}
selectedCoAuthors={this.state.selectedCoAuthors}
Expand All @@ -121,6 +124,8 @@ export default class GitTabController extends React.Component {
discardWorkDirChangesForPaths={this.props.discardWorkDirChangesForPaths}
undoLastDiscard={this.props.undoLastDiscard}
changeWorkingDirectory={this.props.changeWorkingDirectory}
getCurrentWorkDirs={this.props.getCurrentWorkDirs}
onDidChangeWorkDirs={this.props.onDidChangeWorkDirs}

attemptFileStageOperation={this.attemptFileStageOperation}
attemptStageAllOperation={this.attemptStageAllOperation}
Expand Down
9 changes: 6 additions & 3 deletions lib/controllers/github-tab-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import GitHubTabView from '../views/github-tab-view';

export default class GitHubTabController extends React.Component {
static propTypes = {
project: PropTypes.object.isRequired,
workspace: PropTypes.object.isRequired,
repository: PropTypes.object.isRequired,
remoteOperationObserver: OperationStateObserverPropType.isRequired,
Expand All @@ -22,8 +21,11 @@ export default class GitHubTabController extends React.Component {
aheadCount: PropTypes.number,
pushInProgress: PropTypes.bool.isRequired,
isLoading: PropTypes.bool.isRequired,
currentWorkDir: PropTypes.string,

changeWorkingDirectory: PropTypes.func.isRequired,
onDidChangeWorkDirs: PropTypes.func.isRequired,
getCurrentWorkDirs: PropTypes.func.isRequired,
}

render() {
Expand All @@ -40,13 +42,12 @@ export default class GitHubTabController extends React.Component {

return (
<GitHubTabView
project={this.props.project}
workspace={this.props.workspace}
remoteOperationObserver={this.props.remoteOperationObserver}
loginModel={this.props.loginModel}
rootHolder={this.props.rootHolder}

workingDirectory={this.props.workingDirectory}
workingDirectory={this.props.workingDirectory || this.props.currentWorkDir}
branches={this.props.branches}
currentBranch={currentBranch}
remotes={gitHubRemotes}
Expand All @@ -59,6 +60,8 @@ export default class GitHubTabController extends React.Component {
handlePushBranch={this.handlePushBranch}
handleRemoteSelect={this.handleRemoteSelect}
changeWorkingDirectory={this.props.changeWorkingDirectory}
getCurrentWorkDirs={this.props.getCurrentWorkDirs}
onDidChangeWorkDirs={this.props.onDidChangeWorkDirs}
/>
);
}
Expand Down
13 changes: 12 additions & 1 deletion lib/controllers/root-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ export default class RootController extends React.Component {
switchboard: PropTypes.instanceOf(Switchboard),
pipelineManager: PropTypes.object,

currentWorkDir: PropTypes.string,

// Git actions
initialize: PropTypes.func.isRequired,
clone: PropTypes.func.isRequired,
Expand Down Expand Up @@ -259,6 +261,10 @@ export default class RootController extends React.Component {
}

renderPaneItems() {
const {workdirContextPool} = this.props;
const getCurrentWorkDirs = workdirContextPool.getCurrentWorkDirs.bind(workdirContextPool);
const onDidChangeWorkDirs = workdirContextPool.onDidChangePoolContexts.bind(workdirContextPool);

return (
<Fragment>
<PaneItem
Expand All @@ -285,6 +291,9 @@ export default class RootController extends React.Component {
discardWorkDirChangesForPaths={this.discardWorkDirChangesForPaths}
undoLastDiscard={this.undoLastDiscard}
refreshResolutionProgress={this.refreshResolutionProgress}
currentWorkDir={this.props.currentWorkDir}
getCurrentWorkDirs={getCurrentWorkDirs}
onDidChangeWorkDirs={onDidChangeWorkDirs}
changeWorkingDirectory={this.props.changeWorkingDirectory}
/>
)}
Expand All @@ -298,8 +307,10 @@ export default class RootController extends React.Component {
ref={itemHolder.setter}
repository={this.props.repository}
loginModel={this.props.loginModel}
project={this.props.project}
workspace={this.props.workspace}
currentWorkDir={this.props.currentWorkDir}
getCurrentWorkDirs={getCurrentWorkDirs}
onDidChangeWorkDirs={onDidChangeWorkDirs}
changeWorkingDirectory={this.props.changeWorkingDirectory}
/>
)}
Expand Down
3 changes: 2 additions & 1 deletion lib/github-package.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ export default class GithubPackage {
startOpen={this.startOpen}
startRevealed={this.startRevealed}
removeFilePatchItem={this.removeFilePatchItem}
currentWorkDir={this.getActiveWorkdir()}
changeWorkingDirectory={changeWorkingDirectory}
/>, this.element, callback,
);
Expand Down Expand Up @@ -550,7 +551,7 @@ export default class GithubPackage {
}

// It is only possible to reach here if there there was no preferred directory, there are no project paths and the
// the active context's repository is undetermined.
// the active context's repository is not undetermined.
return this.activeContext;
}

Expand Down
52 changes: 43 additions & 9 deletions lib/models/workdir-context-pool.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import compareSets from 'compare-sets';

import {Emitter, CompositeDisposable} from 'event-kit';
import {Emitter} from 'event-kit';
import WorkdirContext from './workdir-context';

/**
Expand Down Expand Up @@ -46,7 +46,7 @@ export default class WorkdirContextPool {
return filtered.length === 1 ? filtered[0] : WorkdirContext.absent({...this.options});
}

add(directory, options = {}) {
add(directory, options = {}, silenceEmitter = false) {
if (this.contexts.has(directory)) {
return this.getContext(directory);
}
Expand All @@ -67,20 +67,32 @@ export default class WorkdirContextPool {
forwardEvent('onDidUpdateRepository', 'did-update-repository');
forwardEvent('onDidDestroyRepository', 'did-destroy-repository');

if (!silenceEmitter) {
this.emitter.emit('did-change-contexts', {added: new Set([directory])});
}

return context;
}

replace(directory, options = {}) {
this.remove(directory);
this.add(directory, options);
replace(directory, options = {}, silenceEmitter = false) {
this.remove(directory, true);
this.add(directory, options, true);

if (!silenceEmitter) {
this.emitter.emit('did-change-contexts', {altered: new Set([directory])});
}
}

remove(directory) {
remove(directory, silenceEmitter = false) {
const existing = this.contexts.get(directory);
this.contexts.delete(directory);

if (existing) {
existing.destroy();

if (!silenceEmitter) {
this.emitter.emit('did-change-contexts', {removed: new Set([directory])});
}
}
}

Expand All @@ -89,13 +101,21 @@ export default class WorkdirContextPool {
const {added, removed} = compareSets(previous, directories);

for (const directory of added) {
this.add(directory, options);
this.add(directory, options, true);
}
for (const directory of removed) {
this.remove(directory);
this.remove(directory, true);
}

if (added.size !== 0 || removed.size !== 0) {
this.emitter.emit('did-change-contexts', {added, removed});
}
}

getCurrentWorkDirs() {
return this.contexts.keys();
}

withResidentContexts(callback) {
const results = [];
for (const [workdir, context] of this.contexts) {
Expand All @@ -108,6 +128,10 @@ export default class WorkdirContextPool {
return this.emitter.on('did-start-observer', callback);
}

onDidChangePoolContexts(callback) {
return this.emitter.on('did-change-contexts', callback);
}

onDidChangeWorkdirOrHead(callback) {
return this.emitter.on('did-change-workdir-or-head', callback);
}
Expand All @@ -125,7 +149,17 @@ export default class WorkdirContextPool {
}

clear() {
this.withResidentContexts(workdir => this.remove(workdir));
const workdirs = new Set();

this.withResidentContexts(workdir => {
this.remove(workdir, true);
workdirs.add(workdir);
});

WorkdirContext.destroyAbsent();

if (workdirs.size !== 0) {
this.emitter.emit('did-change-contexts', {removed: workdirs});
}
}
}
9 changes: 6 additions & 3 deletions lib/views/git-tab-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ export default class GitTabView extends React.Component {
discardWorkDirChangesForPaths: PropTypes.func.isRequired,
openFiles: PropTypes.func.isRequired,
changeWorkingDirectory: PropTypes.func.isRequired,
onDidChangeWorkDirs: PropTypes.func.isRequired,
getCurrentWorkDirs: PropTypes.func.isRequired,
};

constructor(props, context) {
Expand Down Expand Up @@ -118,9 +120,10 @@ export default class GitTabView extends React.Component {
renderHeader() {
return (
<TabHeaderView
handleProjectSelect={e => this.props.changeWorkingDirectory(e.target.value)}
currentProject={this.props.workingDirectoryPath}
projectPaths={this.props.project.getPaths()}
handleWorkDirSelect={e => this.props.changeWorkingDirectory(e.target.value)}
currentWorkDir={this.props.workingDirectoryPath}
getCurrentWorkDirs={this.props.getCurrentWorkDirs}
onDidChangeWorkDirs={this.props.onDidChangeWorkDirs}
/>
);
}
Expand Down
10 changes: 6 additions & 4 deletions lib/views/github-tab-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import RemoteContainer from '../containers/remote-container';

export default class GitHubTabView extends React.Component {
static propTypes = {
project: PropTypes.object.isRequired,
workspace: PropTypes.object.isRequired,
remoteOperationObserver: OperationStateObserverPropType.isRequired,
loginModel: GithubLoginModelPropType.isRequired,
Expand All @@ -31,6 +30,8 @@ export default class GitHubTabView extends React.Component {
handlePushBranch: PropTypes.func.isRequired,
handleRemoteSelect: PropTypes.func.isRequired,
changeWorkingDirectory: PropTypes.func.isRequired,
onDidChangeWorkDirs: PropTypes.func.isRequired,
getCurrentWorkDirs: PropTypes.func.isRequired,
}

render() {
Expand Down Expand Up @@ -97,9 +98,10 @@ export default class GitHubTabView extends React.Component {
renderHeader() {
return (
<TabHeaderView
handleProjectSelect={e => this.props.changeWorkingDirectory(e.target.value)}
currentProject={this.props.workingDirectory}
projectPaths={this.props.project.getPaths()}
handleWorkDirSelect={e => this.props.changeWorkingDirectory(e.target.value)}
currentWorkDir={this.props.workingDirectory}
getCurrentWorkDirs={this.props.getCurrentWorkDirs}
onDidChangeWorkDirs={this.props.onDidChangeWorkDirs}
/>
);
}
Expand Down
Loading