Skip to content

Commit

Permalink
Fix issue in flag edit and prohibit empty names
Browse files Browse the repository at this point in the history
  • Loading branch information
ckitsanelis committed Sep 28, 2023
1 parent 2af5f14 commit dddc1a6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
1 change: 0 additions & 1 deletion src/viewer/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ export default class App extends React.Component<Props, State> {
currentStructureMatch: [],
lastSelectedRow: undefined,
collapsibleRows: {},
// collapsibleRows: { 1: constructNewSegment(1, 10, 0), 2: constructNewSegment(2, 6, 1), 5: constructNewSegment(5, 15, 0), 7: constructNewSegment(7, 10, 1), 0 : constructNewSegment(0, 20, 2)},
};

this.onMessage = this.onMessage.bind(this);
Expand Down
13 changes: 9 additions & 4 deletions src/viewer/rules/Dialogs/FlagsDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ export default class FlagsDialog extends React.Component<Props, State> {
const userColumns = this.state.rules
.map((r, i) => r.column)
.filter((name) => name != rule.column);
const defaultRuleColumn = `FlagRule${ruleIndex + 1}`;
const keyWidth = "100px";
const textFieldWidth = "250px";
const rows = [
Expand All @@ -186,7 +185,7 @@ export default class FlagsDialog extends React.Component<Props, State> {
value={rule.column}
key="Name"
onInput={(e) =>
this.updateRule(rule.setColumn(e.target.value || defaultRuleColumn), ruleIndex)
this.updateRule(rule.setColumn(e.target.value), ruleIndex)
}
/>,
],
Expand Down Expand Up @@ -262,14 +261,20 @@ export default class FlagsDialog extends React.Component<Props, State> {
{this.state.showEdit && <div className="title-big">Edit Flag Annotation Column</div>}
{this.state.showEdit && (
<VSCodeButton
style={{ marginLeft: "auto" }}
appearance="icon"
style={{ marginLeft: "auto" }}
disabled={this.state.rules[this.state.selectedRule].column === '' ? true : false}
onClick={() => this.onDialogClick(false)}
>
<i className="codicon codicon-arrow-left" />
</VSCodeButton>

)}
<VSCodeButton appearance="icon" onClick={() => this.onDialogClick(true)}>
<VSCodeButton
appearance="icon"
disabled={(this.state.selectedRule === -1) || ((this.state.selectedRule !== -1) && (this.state.rules[this.state.selectedRule].column !== '')) ? false : true}
onClick={() => this.onDialogClick(true)}
>
<i className="codicon codicon-close" />
</VSCodeButton>
</div>
Expand Down
12 changes: 8 additions & 4 deletions src/viewer/rules/Dialogs/StatesDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ export default class StatesDialog extends React.Component<Props, State> {
const userColumns = this.state.rules
.map((r, i) => r.column)
.filter((name) => name != rule.column);
const defaultRuleColumn = `StateRule${ruleIndex + 1}`;
const keyWidth = "100px";
const textFieldWidth = "250px";
const rows = [
Expand All @@ -165,7 +164,7 @@ export default class StatesDialog extends React.Component<Props, State> {
value={rule.column}
key="Name"
onInput={(e) =>
this.updateRule(rule.setColumn(e.target.value || defaultRuleColumn), ruleIndex)
this.updateRule(rule.setColumn(e.target.value), ruleIndex)
}
/>,
],
Expand Down Expand Up @@ -219,14 +218,19 @@ export default class StatesDialog extends React.Component<Props, State> {
)}
{this.state.showEdit && (
<VSCodeButton
style={{ marginLeft: "auto" }}
appearance="icon"
style={{ marginLeft: "auto" }}
disabled={this.state.rules[this.state.selectedRule].column === '' ? true : false}
onClick={() => this.onDialogClick(false)}
>
<i className="codicon codicon-arrow-left" />
</VSCodeButton>
)}
<VSCodeButton appearance="icon" onClick={() => this.onDialogClick(true)}>
<VSCodeButton
appearance="icon"
disabled={(this.state.selectedRule === -1) || ((this.state.selectedRule !== -1) && (this.state.rules[this.state.selectedRule].column !== '')) ? false : true}
onClick={() => this.onDialogClick(true)}
>
<i className="codicon codicon-close" />
</VSCodeButton>
</div>
Expand Down

0 comments on commit dddc1a6

Please sign in to comment.