Skip to content

Commit

Permalink
mhutchie#462 Updated CI/CD column visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
keydepth committed Apr 12, 2021
1 parent c0b3cdf commit 7b7051d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
8 changes: 4 additions & 4 deletions tests/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ describe('Config', () => {

// Assert
expect(workspaceConfiguration.get).toBeCalledWith('defaultColumnVisibility', {});
expect(value).toStrictEqual({ date: true, author: true, commit: true, cicd: true });
expect(value).toStrictEqual({ date: true, author: true, commit: true, cicd: false });
});

it('Should return the default value when the configuration value is invalid (NULL)', () => {
Expand All @@ -787,7 +787,7 @@ describe('Config', () => {

// Assert
expect(workspaceConfiguration.get).toBeCalledWith('defaultColumnVisibility', {});
expect(value).toStrictEqual({ date: true, author: true, commit: true, cicd: true });
expect(value).toStrictEqual({ date: true, author: true, commit: true, cicd: false });
});

it('Should return the default value when the configuration value is invalid (column value is not a boolean)', () => {
Expand All @@ -799,7 +799,7 @@ describe('Config', () => {

// Assert
expect(workspaceConfiguration.get).toBeCalledWith('defaultColumnVisibility', {});
expect(value).toStrictEqual({ date: true, author: true, commit: true, cicd: true });
expect(value).toStrictEqual({ date: true, author: true, commit: true, cicd: false });
});

it('Should return the default value when the configuration value is not set', () => {
Expand All @@ -808,7 +808,7 @@ describe('Config', () => {

// Assert
expect(workspaceConfiguration.get).toBeCalledWith('defaultColumnVisibility', {});
expect(value).toStrictEqual({ date: true, author: true, commit: true, cicd: true });
expect(value).toStrictEqual({ date: true, author: true, commit: true, cicd: false });
});
});

Expand Down
7 changes: 6 additions & 1 deletion web/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1875,12 +1875,17 @@ class GitGraphView {
});
}

public setColumnVisibility(column: number, columnWidth: number ) {
public setColumnVisibility(column: number, columnWidth: number) {
let colWidths = this.gitRepos[this.currentRepo].columnWidths;
if (colWidths !== null) {
if (column < colWidths.length) {
colWidths[column] = columnWidth;
let columnWidths = [colWidths[0], COLUMN_AUTO, colWidths[1], colWidths[2], colWidths[3], colWidths[4]];
let col = column;
if (column >= 1) {
col = column + 1;
}
columnWidths[col] = columnWidths[0] === COLUMN_AUTO ? COLUMN_AUTO : columnWidth - COLUMN_LEFT_RIGHT_PADDING;
this.saveColumnWidths(columnWidths);
this.render();
}
Expand Down
2 changes: 1 addition & 1 deletion web/settingsWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ class SettingsWidget {
if (this.currentRepo === null) return;
this.view.saveRepoStateValue(this.currentRepo, 'cicdConfigs', config);
this.render();
this.view.setColumnVisibility(4, COLUMN_AUTO);
this.view.setColumnVisibility(4, 80);
}

/**
Expand Down

0 comments on commit 7b7051d

Please sign in to comment.