Skip to content
This repository was archived by the owner on Feb 18, 2021. It is now read-only.

Commit

Permalink
Multiline textarea copy, Scorecard no-title card, dialog always appea…
Browse files Browse the repository at this point in the history
…rs on top
  • Loading branch information
deadlyfingers committed Jul 8, 2017
1 parent 05dd39b commit 7a053b7
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 12 deletions.
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@
"**/node_modules": true,
"**/build": true,
"**/coverage": true
}
},
"tslint.configFile": "client/tslint.json",
"tslint.nodePath": "client/node_modules"
}
11 changes: 8 additions & 3 deletions client/src/components/Card/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ interface ICardProps {
widgets?: React.ReactNode;
titleStyle?: React.CSSProperties;
contentStyle?: React.CSSProperties;
hideTitle?: boolean;
}

interface ICardState {
Expand All @@ -21,20 +22,24 @@ interface ICardState {

export default class Card extends React.PureComponent<ICardProps, ICardState> {

static defaultProps = {
hideTitle: false
};

state = {
hover: false,
};

constructor(props: ICardProps) {
super(props);
}

render() {
const { id, title, subtitle, children, titleStyle, contentStyle } = this.props;
const { id, title, subtitle, children, titleStyle, contentStyle, hideTitle } = this.props;
const { hover } = this.state;

let elements: React.ReactNode[] = [];
if (title) {
if (title && !hideTitle) {
elements.push(
<span key={0}>{title}</span>
);
Expand Down
3 changes: 2 additions & 1 deletion client/src/components/Card/Settings/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ export default class Edit extends React.PureComponent<ISettingsProps, ISettingsS
onHide={this.closeDialog}
dialogStyle={{ width: '80%' }}
contentStyle={{ margin: '0px', padding: '0px' }}
lastChild={true}
>
<Toolbar
colored
Expand Down Expand Up @@ -251,7 +252,7 @@ export default class Edit extends React.PureComponent<ISettingsProps, ISettingsS
this.toast('Browser not supported');
return;
}
const input = document.createElement('input');
const input = document.createElement('textarea');
input.style.position = 'fixed';
input.style.opacity = '0';
input.value = text;
Expand Down
9 changes: 4 additions & 5 deletions client/src/components/Card/Settings/SettingsStore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ class SettingsStore extends AbstractStoreModel<ISettingsStoreState> implements I
// merge
target.data = Object.assign(target.data, data);
return a;
}, []);
}, []);

// Order by largest data set
result.sort((a, b) => b.data.toString().length - a.data.toString().length);
Expand All @@ -261,6 +261,7 @@ class SettingsStore extends AbstractStoreModel<ISettingsStoreState> implements I
// Move '|' to start of each line
let str = query.replace(/(\|)((\s??\n\s??)(.+?))/gm, '\n| $4');
str = str.replace(/(and)/gm, '\n $1'); // force newline on 'and'
str = str.replace(/([^\(\'\"])(,\s*)(?=(\w+[^\)\'\"]\w+))/gim, '$1,\n '); // force newline on ','
const timespanQuery = '| where timestamp > ago(' + timespan + ') \n';
// Checks for '|' at start
const matches = str.match(/^(\s*\||\s*\w+\s*\|)/ig);
Expand All @@ -280,15 +281,13 @@ class SettingsStore extends AbstractStoreModel<ISettingsStoreState> implements I
return str;
}
// Apply selected filters to connected query
filters.every((filter) => {
filters.forEach((filter) => {
const { dependency, queryProperty } = filter;
const selectedFilters = dependencies[dependency] || [];
const selectedFilters: string[] = dependencies[dependency] || [];
if (selectedFilters.length > 0) {
const f = '| where ' + selectedFilters.map((value) => `${queryProperty}=="${value}"`).join(' or ');
str = `${str}${f} \n`;
return true;
}
return false;
});
return str;
}
Expand Down
8 changes: 6 additions & 2 deletions client/src/components/generic/Scorecard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ const styles = {
padding: 0,
verticalAlign: 'middle'
} as React.CSSProperties,
scorecard: {
title: {
margin: 0,
padding: 0,
} as React.CSSProperties,
content: {
margin: 0,
padding: 0,
overflow: 'visible'
Expand Down Expand Up @@ -95,7 +99,7 @@ export default class Scorecard extends GenericComponent<IScorecardProps, any> {
this.valueToCard(val, idx, className, colorPosition, scorecardWidth));

return (
<Card id={id} title={title} titleStyle={styles.scorecard} contentStyle={styles.scorecard}>
<Card id={id} title={title} hideTitle={true} titleStyle={styles.title} contentStyle={styles.content}>
<div className="md-grid--no-spacing md-card-scorecard">
{cards}
</div>
Expand Down

0 comments on commit 7a053b7

Please sign in to comment.