-
- Application Metrics
-
+ Application Metrics
@@ -74,14 +72,10 @@ export const MetricsPage = () => {
-
- JVM Metrics
-
+ JVM Metrics
-
- {metrics?.jvm ? : ''}
-
+ {metrics?.jvm ? : ''}
{threadDump ? : ''}
{metrics?.processMetrics ? (
@@ -142,4 +136,3 @@ export const MetricsPage = () => {
};
export default MetricsPage;
-
diff --git a/generators/react/templates/src/main/webapp/app/modules/administration/user-management/user-management-delete-dialog.tsx.ejs b/generators/react/templates/src/main/webapp/app/modules/administration/user-management/user-management-delete-dialog.tsx.ejs
index f363f65483d2..fd48ae417aa1 100644
--- a/generators/react/templates/src/main/webapp/app/modules/administration/user-management/user-management-delete-dialog.tsx.ejs
+++ b/generators/react/templates/src/main/webapp/app/modules/administration/user-management/user-management-delete-dialog.tsx.ejs
@@ -49,17 +49,23 @@ export const UserManagementDeleteDialog = () => {
return (
- Confirm delete operation
+
+ Confirm delete operation
+
- Are you sure you want to delete this User?
+
+ Are you sure you want to delete this User?
+
-
+
+
Cancel
-
+
+
Delete
diff --git a/generators/react/templates/src/main/webapp/app/modules/administration/user-management/user-management.reducer.spec.ts.ejs b/generators/react/templates/src/main/webapp/app/modules/administration/user-management/user-management.reducer.spec.ts.ejs
index 1103a1a8578d..8158d84cc46b 100644
--- a/generators/react/templates/src/main/webapp/app/modules/administration/user-management/user-management.reducer.spec.ts.ejs
+++ b/generators/react/templates/src/main/webapp/app/modules/administration/user-management/user-management.reducer.spec.ts.ejs
@@ -16,7 +16,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-%>
-
import { configureStore } from '@reduxjs/toolkit';
import axios from 'axios';
import sinon from 'sinon';
@@ -29,7 +28,7 @@ import userManagement, {
createUser,
updateUser,
deleteUser,
- reset
+ reset,
} from './user-management.reducer';
import { defaultValue } from 'app/shared/model/user.model';
import { AUTHORITIES } from 'app/config/constants';
@@ -51,7 +50,7 @@ describe('User management reducer tests', () => {
errorMessage: null,
updating: false,
updateSuccess: false,
- totalItems: 0
+ totalItems: 0,
});
expect(isEmpty(state.users));
expect(isEmpty(state.authorities));
@@ -76,31 +75,23 @@ describe('User management reducer tests', () => {
});
it('should set state to loading', () => {
- testMultipleTypes(
- [getUsers.pending.type, getUsersAsAdmin.pending.type, getUser.pending.type],
- {},
- state => {
- expect(state).toMatchObject({
- errorMessage: null,
- updateSuccess: false,
- loading: true,
- });
- }
- );
+ testMultipleTypes([getUsers.pending.type, getUsersAsAdmin.pending.type, getUser.pending.type], {}, state => {
+ expect(state).toMatchObject({
+ errorMessage: null,
+ updateSuccess: false,
+ loading: true,
+ });
+ });
});
it('should set state to updating', () => {
- testMultipleTypes(
- [createUser.pending.type, updateUser.pending.type, deleteUser.pending.type],
- {},
- state => {
- expect(state).toMatchObject({
- errorMessage: null,
- updateSuccess: false,
- updating: true,
- });
- }
- );
+ testMultipleTypes([createUser.pending.type, updateUser.pending.type, deleteUser.pending.type], {}, state => {
+ expect(state).toMatchObject({
+ errorMessage: null,
+ updateSuccess: false,
+ updating: true,
+ });
+ });
});
});
@@ -125,7 +116,7 @@ describe('User management reducer tests', () => {
errorMessage: 'error happened',
});
},
- { message: 'error happened' }
+ { message: 'error happened' },
);
});
});
@@ -155,7 +146,7 @@ describe('User management reducer tests', () => {
expect(toTest).toMatchObject({
loading: false,
- user: payload.data
+ user: payload.data,
});
});
@@ -165,22 +156,18 @@ describe('User management reducer tests', () => {
expect(toTest).toMatchObject({
loading: false,
- authorities: payload.data
+ authorities: payload.data,
});
});
it('should set state to successful update', () => {
- testMultipleTypes(
- [createUser.fulfilled.type, updateUser.fulfilled.type],
- { data: 'some handsome user' },
- types => {
- expect(types).toMatchObject({
- updating: false,
- updateSuccess: true,
- user: 'some handsome user',
- });
- }
- );
+ testMultipleTypes([createUser.fulfilled.type, updateUser.fulfilled.type], { data: 'some handsome user' }, types => {
+ expect(types).toMatchObject({
+ updating: false,
+ updateSuccess: true,
+ user: 'some handsome user',
+ });
+ });
});
it('should set state to successful update with an empty user', () => {
@@ -188,7 +175,7 @@ describe('User management reducer tests', () => {
expect(toTest).toMatchObject({
updating: false,
- updateSuccess: true
+ updateSuccess: true,
});
expect(isEmpty(toTest.user));
});
@@ -204,7 +191,7 @@ describe('User management reducer tests', () => {
user: defaultValue,
updating: false,
updateSuccess: false,
- totalItems: 0
+ totalItems: 0,
};
const initialStateNew = {
...initialState,
@@ -317,10 +304,7 @@ describe('User management reducer tests', () => {
it('dispatches RESET actions', async () => {
await store.dispatch(reset());
- expect(store.getState()).toEqual([
- expect.any(Object),
- expect.objectContaining(reset()),
- ]);
+ expect(store.getState()).toEqual([expect.any(Object), expect.objectContaining(reset())]);
});
});
});
diff --git a/generators/react/templates/src/main/webapp/app/modules/administration/user-management/user-management.reducer.ts.ejs b/generators/react/templates/src/main/webapp/app/modules/administration/user-management/user-management.reducer.ts.ejs
index e39d2e6ce6da..6d6c936c1f2f 100644
--- a/generators/react/templates/src/main/webapp/app/modules/administration/user-management/user-management.reducer.ts.ejs
+++ b/generators/react/templates/src/main/webapp/app/modules/administration/user-management/user-management.reducer.ts.ejs
@@ -30,10 +30,9 @@ const initialState = {
user: defaultValue,
updating: false,
updateSuccess: false,
- totalItems: 0
+ totalItems: 0,
};
-
const apiUrl = 'api/users';
const adminUrl = 'api/admin/users';
@@ -61,7 +60,7 @@ export const getUser = createAsyncThunk(
const requestUrl = `${adminUrl}/${id}`;
return axios.get(requestUrl);
},
- { serializeError: serializeAxiosError }
+ { serializeError: serializeAxiosError },
);
export const createUser = createAsyncThunk(
@@ -71,7 +70,7 @@ export const createUser = createAsyncThunk(
thunkAPI.dispatch(getUsersAsAdmin({}));
return result;
},
- { serializeError: serializeAxiosError }
+ { serializeError: serializeAxiosError },
);
export const updateUser = createAsyncThunk(
@@ -81,7 +80,7 @@ export const updateUser = createAsyncThunk(
thunkAPI.dispatch(getUsersAsAdmin({}));
return result;
},
- { serializeError: serializeAxiosError }
+ { serializeError: serializeAxiosError },
);
export const deleteUser = createAsyncThunk(
@@ -92,7 +91,7 @@ export const deleteUser = createAsyncThunk(
thunkAPI.dispatch(getUsersAsAdmin({}));
return result;
},
- { serializeError: serializeAxiosError }
+ { serializeError: serializeAxiosError },
);
export type UserManagementState = Readonly;
@@ -142,23 +141,12 @@ export const UserManagementSlice = createSlice({
state.updateSuccess = false;
state.updating = true;
})
- .addMatcher(
- isRejected(
- getUsers,
- getUsersAsAdmin,
- getUser,
- getRoles,
- createUser,
- updateUser,
- deleteUser
- ),
- (state, action) => {
- state.loading = false;
- state.updating = false;
- state.updateSuccess = false;
- state.errorMessage = action.error.message;
- }
- );
+ .addMatcher(isRejected(getUsers, getUsersAsAdmin, getUser, getRoles, createUser, updateUser, deleteUser), (state, action) => {
+ state.loading = false;
+ state.updating = false;
+ state.updateSuccess = false;
+ state.errorMessage = action.error.message;
+ });
},
});
diff --git a/generators/react/templates/src/main/webapp/app/modules/administration/user-management/user-management.tsx.ejs b/generators/react/templates/src/main/webapp/app/modules/administration/user-management/user-management.tsx.ejs
index f8c3ad4391d6..014d9a738df2 100644
--- a/generators/react/templates/src/main/webapp/app/modules/administration/user-management/user-management.tsx.ejs
+++ b/generators/react/templates/src/main/webapp/app/modules/administration/user-management/user-management.tsx.ejs
@@ -42,7 +42,7 @@ export const UserManagement = () => {
const navigate = useNavigate();
const [pagination, setPagination] = useState(
- overridePaginationStateWithQueryParams(getPaginationState(pageLocation, ITEMS_PER_PAGE, 'id'), pageLocation.search)
+ overridePaginationStateWithQueryParams(getPaginationState(pageLocation, ITEMS_PER_PAGE, 'id'), pageLocation.search),
);
const getUsersFromProps = () => {
@@ -51,7 +51,7 @@ export const UserManagement = () => {
page: pagination.activePage - 1,
size: pagination.itemsPerPage,
sort: `${pagination.sort},${pagination.order}`,
- })
+ }),
);
const endURL = `?page=${pagination.activePage}&sort=${pagination.sort},${pagination.order}`;
if (pageLocation.search !== endURL) {
@@ -73,7 +73,7 @@ export const UserManagement = () => {
...pagination,
activePage: +page,
sort: sortSplit[0],
- order: sortSplit[1]
+ order: sortSplit[1],
});
}
}, [pageLocation.search]);
@@ -82,13 +82,13 @@ export const UserManagement = () => {
setPagination({
...pagination,
order: pagination.order === ASC ? DESC : ASC,
- sort: p
+ sort: p,
});
const handlePagination = currentPage =>
setPagination({
...pagination,
- activePage: currentPage
+ activePage: currentPage,
});
const handleSyncList = () => {
@@ -100,7 +100,7 @@ export const UserManagement = () => {
updateUser({
...user,
activated: !user.activated,
- })
+ }),
);
};
@@ -114,7 +114,7 @@ export const UserManagement = () => {
if (sortFieldName !== fieldName) {
return faSort;
} else {
- return (order === ASC) ? faSortUp : faSortDown;
+ return order === ASC ? faSortUp : faSortDown;
}
};
@@ -124,7 +124,8 @@ export const UserManagement = () => {
Users
- Refresh List
+ {' '}
+ Refresh List
Create a new user
diff --git a/generators/react/templates/src/main/webapp/app/setup-tests.ts.ejs b/generators/react/templates/src/main/webapp/app/setup-tests.ts.ejs
index abe7adf11fad..1390499d474a 100644
--- a/generators/react/templates/src/main/webapp/app/setup-tests.ts.ejs
+++ b/generators/react/templates/src/main/webapp/app/setup-tests.ts.ejs
@@ -1,3 +1,3 @@
import { loadIcons } from './config/icon-loader';
-loadIcons();
\ No newline at end of file
+loadIcons();
diff --git a/generators/react/templates/src/main/webapp/app/shared/auth/private-route.spec.tsx.ejs b/generators/react/templates/src/main/webapp/app/shared/auth/private-route.spec.tsx.ejs
index 5882971dfb41..7dc12af1abb5 100644
--- a/generators/react/templates/src/main/webapp/app/shared/auth/private-route.spec.tsx.ejs
+++ b/generators/react/templates/src/main/webapp/app/shared/auth/private-route.spec.tsx.ejs
@@ -27,7 +27,7 @@ describe('private-route component', () => {
return render(
{Elem}
-
+ ,
);
};
@@ -42,7 +42,7 @@ describe('private-route component', () => {
account: {
authorities: [],
},
- })
+ }),
).toThrow(Error);
console.error = originalError;
});
@@ -58,11 +58,9 @@ describe('private-route component', () => {
account: {
authorities: [],
},
- }
- );
- expect(container.innerHTML).toMatch(
- /
.*<\/div><\/div>/
+ },
);
+ expect(container.innerHTML).toMatch(/
.*<\/div><\/div>/);
});
it('Should render a route for the component provided when authenticated', () => {
@@ -76,7 +74,7 @@ describe('private-route component', () => {
account: {
authorities: ['ADMIN'],
},
- }
+ },
);
expect(container.innerHTML).toEqual('
Test
');
});
@@ -100,7 +98,7 @@ describe('private-route component', () => {
account: {
authorities: ['ADMIN'],
},
- }
+ },
);
expect(container.innerHTML).not.toEqual('
Test
');
expect(container.innerHTML).toEqual('
Login
');
diff --git a/generators/react/templates/src/main/webapp/app/shared/error/error-boundary-routes.spec.tsx.ejs b/generators/react/templates/src/main/webapp/app/shared/error/error-boundary-routes.spec.tsx.ejs
index f2b4ccd89ade..bf14ce279452 100644
--- a/generators/react/templates/src/main/webapp/app/shared/error/error-boundary-routes.spec.tsx.ejs
+++ b/generators/react/templates/src/main/webapp/app/shared/error/error-boundary-routes.spec.tsx.ejs
@@ -25,7 +25,7 @@ describe('error-boundary-routes component', () => {
} />
-
+ ,
);
expect(container.innerHTML).toEqual('
An unexpected error has occurred. ');
});
@@ -37,7 +37,7 @@ describe('error-boundary-routes component', () => {
} />
} />
-
+ ,
);
expect(container.innerHTML).toEqual('
No error
');
});
@@ -48,7 +48,7 @@ describe('error-boundary-routes component', () => {
} />
-
+ ,
);
expect(container.innerHTML).toEqual('
No error
');
});
diff --git a/generators/react/templates/src/main/webapp/app/shared/error/error-boundary.spec.tsx.ejs b/generators/react/templates/src/main/webapp/app/shared/error/error-boundary.spec.tsx.ejs
index f76bb852ca54..d4f13946ccaf 100644
--- a/generators/react/templates/src/main/webapp/app/shared/error/error-boundary.spec.tsx.ejs
+++ b/generators/react/templates/src/main/webapp/app/shared/error/error-boundary.spec.tsx.ejs
@@ -8,9 +8,7 @@ const ErrorComp = () => {
};
describe('error component', () => {
-
beforeEach(() => {
-
// ignore console and jsdom errors
jest.spyOn((window as any)._virtualConsole, 'emit').mockImplementation(() => false);
jest.spyOn((window as any).console, 'error').mockImplementation(() => false);
@@ -25,7 +23,7 @@ describe('error component', () => {
render(
-
+ ,
);
expect(spy).toHaveBeenCalled();
});
diff --git a/generators/react/templates/src/main/webapp/app/shared/error/error-boundary.tsx.ejs b/generators/react/templates/src/main/webapp/app/shared/error/error-boundary.tsx.ejs
index e3b04965dba2..c7329b9f1e83 100644
--- a/generators/react/templates/src/main/webapp/app/shared/error/error-boundary.tsx.ejs
+++ b/generators/react/templates/src/main/webapp/app/shared/error/error-boundary.tsx.ejs
@@ -15,7 +15,7 @@ class ErrorBoundary extends React.Component
- {error && error.toString()}
-
- {errorInfo.componentStack}
-
- ) : undefined;
+
+ {error && error.toString()}
+
+ {errorInfo.componentStack}
+
+ ) : undefined;
return (
An unexpected error has occurred.
diff --git a/generators/react/templates/src/main/webapp/app/shared/layout/header/header.scss.ejs b/generators/react/templates/src/main/webapp/app/shared/layout/header/header.scss.ejs
index 2a89461b12ad..31a9a2ce5b16 100644
--- a/generators/react/templates/src/main/webapp/app/shared/layout/header/header.scss.ejs
+++ b/generators/react/templates/src/main/webapp/app/shared/layout/header/header.scss.ejs
@@ -126,7 +126,7 @@ Navbar styles
.brand-title {
font-size: 1.25rem;
- margin-left: .25rem;
+ margin-left: 0.25rem;
color: $header-color;
&:hover {
color: $header-color-hover;
diff --git a/generators/react/templates/src/main/webapp/app/shared/layout/header/header.spec.tsx.ejs b/generators/react/templates/src/main/webapp/app/shared/layout/header/header.spec.tsx.ejs
index b7e17524609e..3c6c9a919198 100644
--- a/generators/react/templates/src/main/webapp/app/shared/layout/header/header.spec.tsx.ejs
+++ b/generators/react/templates/src/main/webapp/app/shared/layout/header/header.spec.tsx.ejs
@@ -60,7 +60,7 @@ describe('Header', () => {
-
+ ,
);
mountedWrapper = container.innerHTML;
}
@@ -127,5 +127,4 @@ describe('Header', () => {
// Find AccountMenu component
expect(html).toContain('account-menu');
});
-
});
diff --git a/generators/react/templates/src/main/webapp/app/shared/layout/menus/account.spec.tsx.ejs b/generators/react/templates/src/main/webapp/app/shared/layout/menus/account.spec.tsx.ejs
index 073b3b44db30..b0fc945da892 100644
--- a/generators/react/templates/src/main/webapp/app/shared/layout/menus/account.spec.tsx.ejs
+++ b/generators/react/templates/src/main/webapp/app/shared/layout/menus/account.spec.tsx.ejs
@@ -34,7 +34,7 @@ describe('AccountMenu', () => {
const { container } = render(
-
+ ,
);
mountedWrapper = container.innerHTML;
}
@@ -45,7 +45,7 @@ describe('AccountMenu', () => {
const { container } = (mountedWrapper = render(
-
+ ,
));
mountedWrapper = container.innerHTML;
}
diff --git a/generators/react/templates/src/main/webapp/app/shared/layout/menus/locale.tsx.ejs b/generators/react/templates/src/main/webapp/app/shared/layout/menus/locale.tsx.ejs
index c2ccccabb3d6..371bf3253315 100644
--- a/generators/react/templates/src/main/webapp/app/shared/layout/menus/locale.tsx.ejs
+++ b/generators/react/templates/src/main/webapp/app/shared/layout/menus/locale.tsx.ejs
@@ -23,7 +23,7 @@ import { locales, languages } from 'app/config/translation';
export const LocaleMenu = ({ currentLocale, onClick }: { currentLocale: string; onClick: (event: any) => void }) =>
Object.keys(languages).length > 1 ? (
-
+
{locales.map(locale => (
{languages[locale].name}
diff --git a/generators/react/templates/src/main/webapp/app/shared/layout/menus/menu-components.tsx.ejs b/generators/react/templates/src/main/webapp/app/shared/layout/menus/menu-components.tsx.ejs
index d6abf80401e8..a74d4ca7bebc 100644
--- a/generators/react/templates/src/main/webapp/app/shared/layout/menus/menu-components.tsx.ejs
+++ b/generators/react/templates/src/main/webapp/app/shared/layout/menus/menu-components.tsx.ejs
@@ -22,13 +22,13 @@ import { UncontrolledDropdown, DropdownToggle, DropdownMenu } from 'reactstrap';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
export const NavDropdown = props => (
-
-
-
- {props.name}
-
-
- {props.children}
-
-
+
+
+
+ {props.name}
+
+
+ {props.children}
+
+
);
diff --git a/generators/react/templates/src/main/webapp/app/shared/layout/menus/menu-item.tsx.ejs b/generators/react/templates/src/main/webapp/app/shared/layout/menus/menu-item.tsx.ejs
index 3156b52b7187..dd90c921c3cf 100644
--- a/generators/react/templates/src/main/webapp/app/shared/layout/menus/menu-item.tsx.ejs
+++ b/generators/react/templates/src/main/webapp/app/shared/layout/menus/menu-item.tsx.ejs
@@ -41,4 +41,3 @@ const MenuItem = (props: IMenuItem) => {
};
export default MenuItem;
-
diff --git a/generators/react/templates/src/main/webapp/app/shared/layout/password/password-strength-bar.tsx.ejs b/generators/react/templates/src/main/webapp/app/shared/layout/password/password-strength-bar.tsx.ejs
index ecccae5a745c..bf0d73432fbc 100644
--- a/generators/react/templates/src/main/webapp/app/shared/layout/password/password-strength-bar.tsx.ejs
+++ b/generators/react/templates/src/main/webapp/app/shared/layout/password/password-strength-bar.tsx.ejs
@@ -35,21 +35,21 @@ export const PasswordStrengthBar = ({ password }: IPasswordStrengthBarProps) =>
lowerLetters: /[a-z]+/.test(p),
upperLetters: /[A-Z]+/.test(p),
numbers: /\d+/.test(p),
- symbols: regex.test(p)
+ symbols: regex.test(p),
};
const passedMatches = Object.values(flags).filter((isMatchedFlag: boolean) => !!isMatchedFlag).length;
- force += 2 * p.length + ((p.length >= 10) ? 1 : 0);
+ force += 2 * p.length + (p.length >= 10 ? 1 : 0);
force += passedMatches * 10;
// penalty (short password)
- force = (p.length <= 6) ? Math.min(force, 10) : force;
+ force = p.length <= 6 ? Math.min(force, 10) : force;
// penalty (poor variety of characters)
- force = (passedMatches === 1) ? Math.min(force, 10) : force;
- force = (passedMatches === 2) ? Math.min(force, 20) : force;
- force = (passedMatches === 3) ? Math.min(force, 40) : force;
+ force = passedMatches === 1 ? Math.min(force, 10) : force;
+ force = passedMatches === 2 ? Math.min(force, 20) : force;
+ force = passedMatches === 3 ? Math.min(force, 40) : force;
return force;
};
@@ -73,12 +73,7 @@ export const PasswordStrengthBar = ({ password }: IPasswordStrengthBarProps) =>
const getPoints = force => {
const pts = [] as any[];
for (let i = 0; i < 5; i++) {
- pts.push(
-
- );
+ pts.push( );
}
return pts;
};
@@ -91,9 +86,7 @@ export const PasswordStrengthBar = ({ password }: IPasswordStrengthBarProps) =>
Password strength:
-
+
);
};
diff --git a/generators/react/templates/src/main/webapp/app/shared/model/user.model.ts.ejs b/generators/react/templates/src/main/webapp/app/shared/model/user.model.ts.ejs
index a5de68f9fafa..b61b024e3f8e 100644
--- a/generators/react/templates/src/main/webapp/app/shared/model/user.model.ts.ejs
+++ b/generators/react/templates/src/main/webapp/app/shared/model/user.model.ts.ejs
@@ -16,7 +16,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-%>
-
export interface IUser {
id?: any;
login?: string;
@@ -46,5 +45,5 @@ export const defaultValue: Readonly = {
createdDate: null,
lastModifiedBy: '',
lastModifiedDate: null,
- password: ''
+ password: '',
};
diff --git a/generators/react/templates/src/main/webapp/app/shared/reducers/application-profile.spec.ts.ejs b/generators/react/templates/src/main/webapp/app/shared/reducers/application-profile.spec.ts.ejs
index fd144faa9fcb..2e45b5461fdd 100644
--- a/generators/react/templates/src/main/webapp/app/shared/reducers/application-profile.spec.ts.ejs
+++ b/generators/react/templates/src/main/webapp/app/shared/reducers/application-profile.spec.ts.ejs
@@ -16,7 +16,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-%>
-
import axios from 'axios';
import sinon from 'sinon';
import { configureStore } from '@reduxjs/toolkit';
@@ -27,7 +26,7 @@ describe('Profile reducer tests', () => {
const initialState = {
ribbonEnv: '',
inProduction: true,
- isOpenAPIEnabled: false
+ isOpenAPIEnabled: false,
};
describe('Common tests', () => {
it('should return the initial state', () => {
@@ -38,30 +37,30 @@ describe('Profile reducer tests', () => {
it('should return the right payload in prod', () => {
const payload = {
data: {
- 'display-ribbon-on-profiles' : 'awesome ribbon stuff',
- activeProfiles : [ 'prod' ]
- }
+ 'display-ribbon-on-profiles': 'awesome ribbon stuff',
+ activeProfiles: ['prod'],
+ },
};
expect(profile(undefined, { type: getProfile.fulfilled.type, payload })).toEqual({
ribbonEnv: 'awesome ribbon stuff',
inProduction: true,
- isOpenAPIEnabled: false
+ isOpenAPIEnabled: false,
});
});
it('should return the right payload in dev with OpenAPI enabled', () => {
const payload = {
data: {
- 'display-ribbon-on-profiles' : 'awesome ribbon stuff',
- activeProfiles : [ 'api-docs', 'dev' ]
- }
+ 'display-ribbon-on-profiles': 'awesome ribbon stuff',
+ activeProfiles: ['api-docs', 'dev'],
+ },
};
expect(profile(undefined, { type: getProfile.fulfilled.type, payload })).toEqual({
ribbonEnv: 'awesome ribbon stuff',
inProduction: false,
- isOpenAPIEnabled: true
+ isOpenAPIEnabled: true,
});
});
});
diff --git a/generators/react/templates/src/main/webapp/app/shared/reducers/application-profile.ts.ejs b/generators/react/templates/src/main/webapp/app/shared/reducers/application-profile.ts.ejs
index c5c20364f5be..411efa97b3a8 100644
--- a/generators/react/templates/src/main/webapp/app/shared/reducers/application-profile.ts.ejs
+++ b/generators/react/templates/src/main/webapp/app/shared/reducers/application-profile.ts.ejs
@@ -24,10 +24,10 @@ import { serializeAxiosError } from './reducer.utils';
const initialState = {
ribbonEnv: '',
inProduction: true,
- isOpenAPIEnabled: false
+ isOpenAPIEnabled: false,
};
-export type ApplicationProfileState = Readonly;
+export type ApplicationProfileState = Readonly;
export const getProfile = createAsyncThunk('applicationProfile/get_profile', async () => axios.get('management/info'), {
serializeError: serializeAxiosError,
diff --git a/generators/react/templates/src/main/webapp/app/shared/reducers/authentication.spec.ts.ejs b/generators/react/templates/src/main/webapp/app/shared/reducers/authentication.spec.ts.ejs
index f97fff2eed10..40815753eab6 100644
--- a/generators/react/templates/src/main/webapp/app/shared/reducers/authentication.spec.ts.ejs
+++ b/generators/react/templates/src/main/webapp/app/shared/reducers/authentication.spec.ts.ejs
@@ -98,7 +98,7 @@ describe('Authentication reducer tests', () => {
expect(toTest).toMatchObject({
isAuthenticated: true,
loading: false,
- account: payload.data
+ account: payload.data,
});
});
@@ -108,7 +108,7 @@ describe('Authentication reducer tests', () => {
expect(toTest).toMatchObject({
isAuthenticated: false,
loading: false,
- account: payload.data
+ account: payload.data,
});
});
});
@@ -276,7 +276,7 @@ describe('Authentication reducer tests', () => {
await store.dispatch(login('test', 'test'));
expect(Storage.session.get(AUTH_TOKEN_KEY)).toBe('TestToken');
expect(Storage.local.get(AUTH_TOKEN_KEY)).toBe(undefined);
- clearAuthToken()
+ clearAuthToken();
expect(Storage.session.get(AUTH_TOKEN_KEY)).toBe(undefined);
expect(Storage.local.get(AUTH_TOKEN_KEY)).toBe(undefined);
});
@@ -288,7 +288,7 @@ describe('Authentication reducer tests', () => {
await store.dispatch(login('user', 'user', true));
expect(Storage.session.get(AUTH_TOKEN_KEY)).toBe(undefined);
expect(Storage.local.get(AUTH_TOKEN_KEY)).toBe('TestToken');
- clearAuthToken()
+ clearAuthToken();
expect(Storage.session.get(AUTH_TOKEN_KEY)).toBe(undefined);
expect(Storage.local.get(AUTH_TOKEN_KEY)).toBe(undefined);
});
diff --git a/generators/react/templates/src/main/webapp/app/shared/reducers/authentication.ts.ejs b/generators/react/templates/src/main/webapp/app/shared/reducers/authentication.ts.ejs
index 8dab470e8e53..ae2984ae7dc7 100644
--- a/generators/react/templates/src/main/webapp/app/shared/reducers/authentication.ts.ejs
+++ b/generators/react/templates/src/main/webapp/app/shared/reducers/authentication.ts.ejs
@@ -86,9 +86,13 @@ interface IAuthParams {
rememberMe?: boolean;
}
-export const authenticate = createAsyncThunk('authentication/login', async (auth: IAuthParams) => axios.post('api/authenticate', auth), {
- serializeError: serializeAxiosError,
-});
+export const authenticate = createAsyncThunk(
+ 'authentication/login',
+ async (auth: IAuthParams) => axios.post('api/authenticate', auth),
+ {
+ serializeError: serializeAxiosError,
+ },
+);
export const login: (username: string, password: string, rememberMe?: boolean) => AppThunk =
(username, password, rememberMe = false) =>
diff --git a/generators/react/templates/src/main/webapp/app/shared/reducers/locale.spec.ts.ejs b/generators/react/templates/src/main/webapp/app/shared/reducers/locale.spec.ts.ejs
index df2c8b80e35b..b4e4f715fda6 100644
--- a/generators/react/templates/src/main/webapp/app/shared/reducers/locale.spec.ts.ejs
+++ b/generators/react/templates/src/main/webapp/app/shared/reducers/locale.spec.ts.ejs
@@ -13,14 +13,14 @@ describe('Locale reducer tests', () => {
it('should return the initial state', () => {
const localeState = locale(undefined, { type: '' });
expect(localeState).toMatchObject({
- currentLocale: ''
+ currentLocale: '',
});
});
it('should correctly set the first time locale', () => {
const localeState = locale(undefined, updateLocale(defaultLocale));
expect(localeState).toMatchObject({
- currentLocale: defaultLocale
+ currentLocale: defaultLocale,
});
expect(TranslatorContext.context.locale).toEqual(defaultLocale);
});
@@ -35,10 +35,10 @@ describe('Locale reducer tests', () => {
lastChange: new Date().getTime(),
loadedKeys: [],
},
- updateLocale('es')
+ updateLocale('es'),
);
expect(localeState).toMatchObject({
- currentLocale: 'es'
+ currentLocale: 'es',
});
expect(TranslatorContext.context.locale).toEqual('es');
});
@@ -61,9 +61,9 @@ describe('Locale reducer tests', () => {
expect(Object.keys(TranslatorContext.context.translations)).not.toContainEqual(defaultLocale);
const getState = jest.fn(() => ({ locale: { sourcePrefixes: '', loadedLocales: [defaultLocale], loadedKeys: [] } }));
-
+
const result = await setLocale(defaultLocale)(dispatch, getState, extra);
-
+
const pendingAction = dispatch.mock.calls[0][0];
expect(pendingAction.meta.requestStatus).toBe('pending');
expect(setLocale.fulfilled.match(result)).toBe(true);
@@ -87,9 +87,9 @@ describe('Locale reducer tests', () => {
expect(Object.keys(TranslatorContext.context.translations)).not.toContainEqual(defaultLocale);
const getState = jest.fn(() => ({ locale: { sourcePrefixes: [], loadedLocales: [], loadedKeys: [] } }));
-
+
const result = await setLocale(defaultLocale)(dispatch, getState, extra);
-
+
const pendingAction = dispatch.mock.calls[0][0];
expect(pendingAction.meta.requestStatus).toBe('pending');
expect(setLocale.fulfilled.match(result)).toBe(true);
@@ -102,9 +102,12 @@ describe('Locale reducer tests', () => {
describe('with no prefixes and keys loaded', () => {
let store;
- const reducer = createReducer({ locale: { currentLocale: defaultLocale, sourcePrefixes: [], loadedLocales: [], loadedKeys: [] } }, builder => {
- builder.addDefaultCase(() => {});
- });
+ const reducer = createReducer(
+ { locale: { currentLocale: defaultLocale, sourcePrefixes: [], loadedLocales: [], loadedKeys: [] } },
+ builder => {
+ builder.addDefaultCase(() => {});
+ },
+ );
beforeEach(() => {
store = configureStore({
reducer,
@@ -113,10 +116,12 @@ describe('Locale reducer tests', () => {
});
it('dispatches loaded action with keys and sourcePrefix', async () => {
- const getState = jest.fn(() => ({ locale: { currentLocale: defaultLocale, sourcePrefixes: [], loadedLocales: [], loadedKeys: [] } }));
-
+ const getState = jest.fn(() => ({
+ locale: { currentLocale: defaultLocale, sourcePrefixes: [], loadedLocales: [], loadedKeys: [] },
+ }));
+
const result = await addTranslationSourcePrefix(sourcePrefix)(dispatch, getState, extra);
-
+
const pendingAction = dispatch.mock.calls[0][0];
expect(pendingAction.meta.requestStatus).toBe('pending');
expect(addTranslationSourcePrefix.fulfilled.match(result)).toBe(true);
@@ -125,9 +130,12 @@ describe('Locale reducer tests', () => {
describe('with prefix already added', () => {
let store;
- const reducer = createReducer({ locale: { currentLocale: defaultLocale, sourcePrefixes: [sourcePrefix], loadedLocales: [], loadedKeys: [] } }, builder => {
- builder.addDefaultCase(() => {});
- });
+ const reducer = createReducer(
+ { locale: { currentLocale: defaultLocale, sourcePrefixes: [sourcePrefix], loadedLocales: [], loadedKeys: [] } },
+ builder => {
+ builder.addDefaultCase(() => {});
+ },
+ );
beforeEach(() => {
store = configureStore({
reducer,
@@ -136,8 +144,10 @@ describe('Locale reducer tests', () => {
});
it("doesn't dispatches loaded action", async () => {
- const getState = jest.fn(() => ({ locale: { currentLocale: defaultLocale, sourcePrefixes: [sourcePrefix], loadedLocales: [], loadedKeys: [] } }));
-
+ const getState = jest.fn(() => ({
+ locale: { currentLocale: defaultLocale, sourcePrefixes: [sourcePrefix], loadedLocales: [], loadedKeys: [] },
+ }));
+
const result = await addTranslationSourcePrefix(sourcePrefix)(dispatch, getState, extra);
const pendingAction = dispatch.mock.calls[0][0];
@@ -148,9 +158,14 @@ describe('Locale reducer tests', () => {
describe('with key already loaded', () => {
let store;
- const reducer = createReducer({ locale: { currentLocale: defaultLocale, sourcePrefixes: [], loadedLocales: [], loadedKeys: [`${sourcePrefix}${defaultLocale}`] } }, builder => {
- builder.addDefaultCase(() => {});
- });
+ const reducer = createReducer(
+ {
+ locale: { currentLocale: defaultLocale, sourcePrefixes: [], loadedLocales: [], loadedKeys: [`${sourcePrefix}${defaultLocale}`] },
+ },
+ builder => {
+ builder.addDefaultCase(() => {});
+ },
+ );
beforeEach(() => {
store = configureStore({
reducer,
@@ -159,10 +174,12 @@ describe('Locale reducer tests', () => {
});
it("doesn't dispatches loaded action", async () => {
- const getState = jest.fn(() => ({ locale: { currentLocale: defaultLocale, sourcePrefixes: [], loadedLocales: [], loadedKeys: [`${sourcePrefix}${defaultLocale}`] } }));
-
+ const getState = jest.fn(() => ({
+ locale: { currentLocale: defaultLocale, sourcePrefixes: [], loadedLocales: [], loadedKeys: [`${sourcePrefix}${defaultLocale}`] },
+ }));
+
const result = await addTranslationSourcePrefix(sourcePrefix)(dispatch, getState, extra);
-
+
const pendingAction = dispatch.mock.calls[0][0];
expect(pendingAction.meta.requestStatus).toBe('pending');
expect(addTranslationSourcePrefix.fulfilled.match(result)).toBe(true);
diff --git a/generators/react/templates/src/main/webapp/app/shared/reducers/locale.ts.ejs b/generators/react/templates/src/main/webapp/app/shared/reducers/locale.ts.ejs
index 8fb8d2e08d08..340f793ce35a 100644
--- a/generators/react/templates/src/main/webapp/app/shared/reducers/locale.ts.ejs
+++ b/generators/react/templates/src/main/webapp/app/shared/reducers/locale.ts.ejs
@@ -30,7 +30,7 @@ const initialState = {
loadedLocales: [],
};
-export type LocaleState = Readonly;
+export type LocaleState = Readonly;
const loadLocaleAndRegisterLocaleFile = async (locale: string, prefix: string) => {
if (prefix || !Object.keys(TranslatorContext.context.translations).includes(locale)) {
@@ -49,7 +49,7 @@ export const setLocale = createAsyncThunk('locale/setLocale', async (locale: str
if (loadedKeys.includes(key)) return undefined;
await loadLocaleAndRegisterLocaleFile(locale, sourcePrefix);
return key;
- })
+ }),
)
).filter(Boolean);
thunkAPI.dispatch(loaded({ keys, locale }));
@@ -70,7 +70,7 @@ export const addTranslationSourcePrefix = createAsyncThunk(
}
}
return key;
- }
+ },
);
export const LocaleSlice = createSlice({
diff --git a/generators/react/templates/src/main/webapp/app/shared/reducers/user-management.spec.ts.ejs b/generators/react/templates/src/main/webapp/app/shared/reducers/user-management.spec.ts.ejs
index 5fbaee63610e..19c06bdb8a28 100644
--- a/generators/react/templates/src/main/webapp/app/shared/reducers/user-management.spec.ts.ejs
+++ b/generators/react/templates/src/main/webapp/app/shared/reducers/user-management.spec.ts.ejs
@@ -45,10 +45,8 @@ describe('User management reducer tests', () => {
type: getUsers.rejected.type,
payload: 'something happened',
error: { message: 'error happened' },
- })
- ).toEqual(
- { ...initialState, errorMessage: 'error happened' }
- )
+ }),
+ ).toEqual({ ...initialState, errorMessage: 'error happened' });
});
});
@@ -57,7 +55,7 @@ describe('User management reducer tests', () => {
const payload = { data: 'some handsome users' };
const toTest = userManagement(undefined, { type: getUsers.fulfilled.type, payload });
expect(toTest).toMatchObject({
- users: payload.data
+ users: payload.data,
});
});
});
diff --git a/generators/react/templates/src/main/webapp/app/shared/reducers/user-management.ts.ejs b/generators/react/templates/src/main/webapp/app/shared/reducers/user-management.ts.ejs
index 0c6d4054705b..ed5ad3b1a92f 100644
--- a/generators/react/templates/src/main/webapp/app/shared/reducers/user-management.ts.ejs
+++ b/generators/react/templates/src/main/webapp/app/shared/reducers/user-management.ts.ejs
@@ -50,7 +50,7 @@ export const UserManagementSlice = createSlice({
builder
.addCase(getUsers.pending, state => state)
.addCase(getUsers.rejected, (state, action) => {
- state.errorMessage = action.error.message;
+ state.errorMessage = action.error.message;
})
.addCase(getUsers.fulfilled, (state, action) => {
state.users = action.payload.data;
diff --git a/generators/react/templates/src/main/webapp/app/shared/util/date-utils.ts.ejs b/generators/react/templates/src/main/webapp/app/shared/util/date-utils.ts.ejs
index a73ceb503817..2e3b1c7c6265 100644
--- a/generators/react/templates/src/main/webapp/app/shared/util/date-utils.ts.ejs
+++ b/generators/react/templates/src/main/webapp/app/shared/util/date-utils.ts.ejs
@@ -20,9 +20,8 @@ import dayjs from 'dayjs';
import { APP_LOCAL_DATETIME_FORMAT } from 'app/config/constants';
-export const convertDateTimeFromServer = date =>
- date ? dayjs(date).format(APP_LOCAL_DATETIME_FORMAT) : null;
+export const convertDateTimeFromServer = date => (date ? dayjs(date).format(APP_LOCAL_DATETIME_FORMAT) : null);
-export const convertDateTimeToServer = (date?: string) : dayjs.Dayjs | null => (date ? dayjs(date) : null);
+export const convertDateTimeToServer = (date?: string): dayjs.Dayjs | null => (date ? dayjs(date) : null);
export const displayDefaultDateTime = () => dayjs().startOf('day').format(APP_LOCAL_DATETIME_FORMAT);
diff --git a/generators/react/templates/src/main/webapp/app/shared/util/entity-utils.spec.ts.ejs b/generators/react/templates/src/main/webapp/app/shared/util/entity-utils.spec.ts.ejs
index 76c77b0b38f8..9b47a0c249d4 100644
--- a/generators/react/templates/src/main/webapp/app/shared/util/entity-utils.spec.ts.ejs
+++ b/generators/react/templates/src/main/webapp/app/shared/util/entity-utils.spec.ts.ejs
@@ -16,8 +16,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-%>
-
-
import { cleanEntity, mapIdList } from './entity-utils';
describe('Entity utils', () => {
@@ -25,13 +23,13 @@ describe('Entity utils', () => {
it('should not remove fields with an id', () => {
const entityA = {
a: {
- id: 5
- }
+ id: 5,
+ },
};
const entityB = {
a: {
- id: '5'
- }
+ id: '5',
+ },
};
expect(cleanEntity({ ...entityA })).toEqual(entityA);
@@ -41,8 +39,8 @@ describe('Entity utils', () => {
it('should remove fields with an empty id', () => {
const entity = {
a: {
- id: ''
- }
+ id: '',
+ },
};
expect(cleanEntity({ ...entity })).toEqual({});
@@ -53,7 +51,7 @@ describe('Entity utils', () => {
a: '',
b: 5,
c: [],
- d: '5'
+ d: '5',
};
expect(cleanEntity({ ...entity })).toEqual(entity);
@@ -61,13 +59,13 @@ describe('Entity utils', () => {
});
describe('mapIdList', () => {
- it('should map ids no matter the element\'s type', () => {
- const ids = ['jhipster', '', 1, { key: 'value'}];
+ it("should map ids no matter the element's type", () => {
+ const ids = ['jhipster', '', 1, { key: 'value' }];
expect(mapIdList(ids)).toEqual([{ id: 'jhipster' }, { id: 1 }, { id: { key: 'value' } }]);
});
- it('should return an empty array', () => {
+ it('should return an empty array', () => {
const ids = [];
expect(mapIdList(ids)).toEqual([]);
diff --git a/generators/react/templates/src/main/webapp/app/shared/util/entity-utils.ts.ejs b/generators/react/templates/src/main/webapp/app/shared/util/entity-utils.ts.ejs
index 87840d207ac3..68f50c57f507 100644
--- a/generators/react/templates/src/main/webapp/app/shared/util/entity-utils.ts.ejs
+++ b/generators/react/templates/src/main/webapp/app/shared/util/entity-utils.ts.ejs
@@ -27,7 +27,7 @@ import { IPaginationBaseState, ISortBaseState } from 'react-jhipster';
* @param entity Object to clean.
*/
export const cleanEntity = entity => {
- const keysToKeep = Object.keys(entity).filter(k => !(entity[k] instanceof Object) || (entity[k]['id'] !== '' && entity[k]['id'] !== -1));
+ const keysToKeep = Object.keys(entity).filter(k => !(entity[k] instanceof Object) || (entity[k]['id'] !== '' && entity[k]['id'] !== -1));
return pick(entity, keysToKeep);
};
@@ -52,7 +52,9 @@ export const overrideSortStateWithQueryParams = (paginationBaseState: ISortBaseS
};
export const overridePaginationStateWithQueryParams = (paginationBaseState: IPaginationBaseState, locationSearch: string) => {
- const sortedPaginationState: IPaginationBaseState = overrideSortStateWithQueryParams(paginationBaseState, locationSearch);
+ const sortedPaginationState: IPaginationBaseState = (
+ overrideSortStateWithQueryParams(paginationBaseState, locationSearch)
+ );
const params = new URLSearchParams(locationSearch);
const page = params.get('page');
if (page) {
diff --git a/generators/react/templates/webpack/utils.js.ejs b/generators/react/templates/webpack/utils.js.ejs
index a0ddece120b4..45511688f1f6 100644
--- a/generators/react/templates/webpack/utils.js.ejs
+++ b/generators/react/templates/webpack/utils.js.ejs
@@ -22,7 +22,7 @@ const tsconfig = require('../tsconfig.json');
module.exports = {
root,
- mapTypescriptAliasToWebpackAlias
+ mapTypescriptAliasToWebpackAlias,
};
const _root = path.resolve(__dirname, '..');
diff --git a/generators/react/templates/webpack/webpack.common.js.ejs b/generators/react/templates/webpack/webpack.common.js.ejs
index fd5605f9837f..5fc4c4b66e81 100644
--- a/generators/react/templates/webpack/webpack.common.js.ejs
+++ b/generators/react/templates/webpack/webpack.common.js.ejs
@@ -38,16 +38,16 @@ const getTsLoaderRule = env => {
// There should be 1 cpu for the fork-ts-checker-webpack-plugin.
// The value may need to be adjusted (e.g. to 1) in some CI environments,
// as cpus() may report more cores than what are available to the build.
- workers: require('os').cpus().length - 1
- }
+ workers: require('os').cpus().length - 1,
+ },
},
{
loader: 'ts-loader',
options: {
transpileOnly: true,
- happyPackMode: true
- }
- }
+ happyPackMode: true,
+ },
+ },
];
return rules;
};