mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Prettier: Upgrade to 2 (#30387)
* Updated package json but not updated source files * Update eslint plugin * updated files
This commit is contained in:
@@ -24,7 +24,7 @@ import { setSearchQuery } from './state/reducers';
|
||||
const timeRangeValidationEvents: ValidationEvents = {
|
||||
[EventsWithValidation.onBlur]: [
|
||||
{
|
||||
rule: value => {
|
||||
rule: (value) => {
|
||||
if (!value) {
|
||||
return true;
|
||||
}
|
||||
@@ -189,7 +189,7 @@ export class ApiKeysPage extends PureComponent<Props, any> {
|
||||
className="gf-form-input"
|
||||
value={newApiKey.name}
|
||||
placeholder="Name"
|
||||
onChange={evt => this.onApiKeyStateUpdate(evt, ApiKeyStateProps.Name)}
|
||||
onChange={(evt) => this.onApiKeyStateUpdate(evt, ApiKeyStateProps.Name)}
|
||||
/>
|
||||
</div>
|
||||
<div className="gf-form">
|
||||
@@ -198,9 +198,9 @@ export class ApiKeysPage extends PureComponent<Props, any> {
|
||||
<select
|
||||
className="gf-form-input gf-size-auto"
|
||||
value={newApiKey.role}
|
||||
onChange={evt => this.onApiKeyStateUpdate(evt, ApiKeyStateProps.Role)}
|
||||
onChange={(evt) => this.onApiKeyStateUpdate(evt, ApiKeyStateProps.Role)}
|
||||
>
|
||||
{Object.keys(OrgRole).map(role => {
|
||||
{Object.keys(OrgRole).map((role) => {
|
||||
return (
|
||||
<option key={role} label={role} value={role}>
|
||||
{role}
|
||||
@@ -218,7 +218,7 @@ export class ApiKeysPage extends PureComponent<Props, any> {
|
||||
placeholder="1d"
|
||||
validationEvents={timeRangeValidationEvents}
|
||||
value={newApiKey.secondsToLive}
|
||||
onChange={evt => this.onApiKeyStateUpdate(evt, ApiKeyStateProps.SecondsToLive)}
|
||||
onChange={(evt) => this.onApiKeyStateUpdate(evt, ApiKeyStateProps.SecondsToLive)}
|
||||
/>
|
||||
</div>
|
||||
<div className="gf-form">
|
||||
@@ -260,7 +260,7 @@ export class ApiKeysPage extends PureComponent<Props, any> {
|
||||
<Switch
|
||||
label="Show expired"
|
||||
checked={includeExpired}
|
||||
onChange={event => {
|
||||
onChange={(event) => {
|
||||
// @ts-ignore
|
||||
this.onIncludeExpiredChange(event.target.checked);
|
||||
}}
|
||||
@@ -276,7 +276,7 @@ export class ApiKeysPage extends PureComponent<Props, any> {
|
||||
</thead>
|
||||
{apiKeys.length > 0 ? (
|
||||
<tbody>
|
||||
{apiKeys.map(key => {
|
||||
{apiKeys.map((key) => {
|
||||
return (
|
||||
<tr key={key.id}>
|
||||
<td>{key.name}</td>
|
||||
|
||||
@@ -7,7 +7,7 @@ export function addApiKey(
|
||||
openModal: (key: string) => void,
|
||||
includeExpired: boolean
|
||||
): ThunkResult<void> {
|
||||
return async dispatch => {
|
||||
return async (dispatch) => {
|
||||
const result = await getBackendSrv().post('/api/auth/keys', apiKey);
|
||||
dispatch(setSearchQuery(''));
|
||||
dispatch(loadApiKeys(includeExpired));
|
||||
@@ -16,14 +16,14 @@ export function addApiKey(
|
||||
}
|
||||
|
||||
export function loadApiKeys(includeExpired: boolean): ThunkResult<void> {
|
||||
return async dispatch => {
|
||||
return async (dispatch) => {
|
||||
const response = await getBackendSrv().get('/api/auth/keys?includeExpired=' + includeExpired);
|
||||
dispatch(apiKeysLoaded(response));
|
||||
};
|
||||
}
|
||||
|
||||
export function deleteApiKey(id: number, includeExpired: boolean): ThunkResult<void> {
|
||||
return async dispatch => {
|
||||
return async (dispatch) => {
|
||||
getBackendSrv()
|
||||
.delete(`/api/auth/keys/${id}`)
|
||||
.then(() => dispatch(loadApiKeys(includeExpired)));
|
||||
|
||||
@@ -5,7 +5,7 @@ export const getApiKeysCount = (state: ApiKeysState) => state.keys.length;
|
||||
export const getApiKeys = (state: ApiKeysState) => {
|
||||
const regex = RegExp(state.searchQuery, 'i');
|
||||
|
||||
return state.keys.filter(key => {
|
||||
return state.keys.filter((key) => {
|
||||
return regex.test(key.name) || regex.test(key.role);
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user