Skip to content

Commit

Permalink
Merge pull request #1756 from gettakaro/main-promotion
Browse files Browse the repository at this point in the history
  • Loading branch information
niekcandaele authored Dec 1, 2024
2 parents c1676d6 + b5b9cc1 commit 6d20fe8
Show file tree
Hide file tree
Showing 79 changed files with 1,762 additions and 993 deletions.
4 changes: 2 additions & 2 deletions containers/homer/assets/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ message:
links:
- name: "Github"
icon: "fab fa-github"
url: "https://github.com/gettakaro/takaro"
url: "https://aka.takaro.io/github"
target: "_blank"
- name: "Docs"
icon: "fa fa-book"
Expand Down Expand Up @@ -137,4 +137,4 @@ services:
- name: "Redis Insight"
icon: "fas fa-database"
subtitle: "Redis UI"
url: "http://127.0.0.1:5540"
url: "http://127.0.0.1:5540"
190 changes: 61 additions & 129 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
"class-validator-jsonschema": "5.0.1",
"concurrently": "9.0.1",
"convict": "6.2.4",
"cronstrue": "2.51.0",
"csv": "6.3.10",
"discord-api-types": "0.37.101",
"discord.js": "14.16.3",
Expand Down
3 changes: 0 additions & 3 deletions packages/e2e/src/web-main/pages/GameServersPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ export class GameServersPage extends BasePage {
await this.page.getByRole('option', { name: value }).locator('div').click();
}

async clickTestConnection() {
await this.page.getByRole('button', { name: 'Test connection' }).click();
}
async clickSave() {
await this.page.getByRole('button', { name: 'Save changes' }).click();
}
Expand Down
8 changes: 0 additions & 8 deletions packages/e2e/src/web-main/views/gameservers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ test('Can create gameserver', async ({ page, takaro }) => {
const hostInput = page.getByPlaceholder('Http://127.0.0.1:3002');
await hostInput.click();
await hostInput.fill(integrationConfig.get('mockGameserver.host'));

// test connection
await GameServersPage.clickTestConnection();
await GameServersPage.clickSave();

await expect(page.getByRole('heading', { name: serverName })).toBeVisible();
Expand All @@ -32,7 +29,6 @@ test('Should show error when creating a gameserver with name that already exists
const hostInputs1 = page.getByPlaceholder('Http://127.0.0.1:3002');
await hostInputs1.click();
await hostInputs1.fill(integrationConfig.get('mockGameserver.host'));
await GameServersPage.clickTestConnection();
await GameServersPage.clickSave();
await expect(page.getByRole('heading', { name: serverName })).toBeVisible();

Expand All @@ -42,7 +38,6 @@ test('Should show error when creating a gameserver with name that already exists
const hostInputs2 = page.getByPlaceholder('Http://127.0.0.1:3002');
await hostInputs2.click();
await hostInputs2.fill(integrationConfig.get('mockGameserver.host'));
await GameServersPage.clickTestConnection();
await GameServersPage.clickSave();
await expect(page.getByText('Game server with this name already exists')).toBeVisible();
});
Expand All @@ -58,14 +53,12 @@ test('Should show error when updating a gameserver with name that already exists
const hostInputs1 = page.getByPlaceholder('Http://127.0.0.1:3002');
await hostInputs1.click();
await hostInputs1.fill(integrationConfig.get('mockGameserver.host'));
await GameServersPage.clickTestConnection();
await GameServersPage.clickSave();
await expect(page.getByRole('heading', { name: serverName })).toBeVisible();

// this will edit the first server and try to set the name to the same as the second server
await GameServersPage.action('Edit');
await GameServersPage.nameCreateEdit(serverName);
await GameServersPage.clickTestConnection();
await GameServersPage.clickSave();
await expect(page.getByText('Game server with this name already exists')).toBeVisible();
});
Expand All @@ -82,7 +75,6 @@ test('Can edit gameserver', async ({ page, takaro }) => {

const newGameServerName = 'My edited mock server';
await GameServersPage.nameCreateEdit(newGameServerName);
await GameServersPage.clickTestConnection();
await GameServersPage.clickSave();
await expect(page.getByText(newGameServerName)).toBeVisible();
});
Expand Down
2 changes: 1 addition & 1 deletion packages/lib-apiclient/src/generated/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Takaro app-api
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: development - 113fb57eed0f5d322a110ccec38b872a84a11b26
* The version of the OpenAPI document: development - c3c169ee2703ed3d5c50c1bb88ccfdd588028ca2
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion packages/lib-apiclient/src/generated/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Takaro app-api
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: development - 113fb57eed0f5d322a110ccec38b872a84a11b26
* The version of the OpenAPI document: development - c3c169ee2703ed3d5c50c1bb88ccfdd588028ca2
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion packages/lib-apiclient/src/generated/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Takaro app-api
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: development - 113fb57eed0f5d322a110ccec38b872a84a11b26
* The version of the OpenAPI document: development - c3c169ee2703ed3d5c50c1bb88ccfdd588028ca2
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion packages/lib-apiclient/src/generated/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Takaro app-api
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: development - 113fb57eed0f5d322a110ccec38b872a84a11b26
* The version of the OpenAPI document: development - c3c169ee2703ed3d5c50c1bb88ccfdd588028ca2
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion packages/lib-apiclient/src/generated/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Takaro app-api
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: development - 113fb57eed0f5d322a110ccec38b872a84a11b26
* The version of the OpenAPI document: development - c3c169ee2703ed3d5c50c1bb88ccfdd588028ca2
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
4 changes: 2 additions & 2 deletions packages/lib-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@rjsf/validator-ajv8": "5.20.0",
"@sentry/react": "8.32.0",
"@tanstack/react-table": "8.20.5",
"@tanstack/react-router": "1.58.15",
"@tanstack/react-router": "1.79.0",
"@types/luxon": "3.4.2",
"@visx/axis": "3.10.1",
"@visx/brush": "3.10.4",
Expand All @@ -51,7 +51,7 @@
"@visx/shape": "3.5.0",
"@visx/tooltip": "3.3.0",
"@visx/vendor": "3.5.0",
"@visx/zoom": "^3.3.0",
"@visx/zoom": "3.3.0",
"framer-motion": "11.9.0",
"luxon": "3.5.0",
"notistack": "3.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const Default = styled.button<{
span {
font-size: 1.25rem;
font-weight: 600;
white-space: nowrap;
color: ${({ theme, color }) => {
switch (color) {
case 'white':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export const ToggleButtonGroup: FC<ToggleButtonGroupProps> & SubComponents = ({
const m = new Map<string, boolean>();
Children.forEach(children, (child) => {
if (isValidElement(child)) {
console.log(child.props.value, defaultValue);
if (child.props.value === defaultValue) {
m.set(child.props.value, true);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ const Chart = <T,>({
const theme = useTheme();
const { hideTooltip, showTooltip, tooltipData, tooltipLeft = 0, tooltipTop = 0 } = useTooltip<T>();

const centerX = width / 2 + 50;
const centerY = height / 2 + 150;
const scale = (width / 1000) * 100;
const centerX = width / 2;
const centerY = height / 2;
const scale = Math.min(width, height) * 0.25;

const colorScale = scaleLinear({
domain: [Math.min(...data.map((d) => yAccessor(d))), Math.max(...data.map((d) => yAccessor(d)))],
Expand Down
31 changes: 30 additions & 1 deletion packages/lib-components/src/components/data/Table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
AiOutlinePicRight as TightDensityIcon,
AiOutlineRight as ExpandIcon,
AiOutlineUp as CollapseIcon,
AiOutlineSearch as SearchIcon,
} from 'react-icons/ai';
import { ColumnHeader } from './subcomponents/ColumnHeader';
import { ColumnVisibility } from './subcomponents/ColumnVisibility';
Expand All @@ -37,7 +38,8 @@ import { PageSizeSelect } from './subcomponents/Pagination/PageSizeSelect';

import { ColumnFilter, PageOptions } from '../../../hooks/useTableActions';
import { GenericCheckBox as CheckBox } from '../../inputs/CheckBox/Generic';
import { useLocalStorage } from '../../../hooks';
import { useDebounce, useLocalStorage } from '../../../hooks';
import { UnControlledTextField } from '../../../components';

export interface TableProps<DataType extends object> {
id: string;
Expand All @@ -58,6 +60,10 @@ export interface TableProps<DataType extends object> {
/// Renders actions that are only visible when one or more rows are selected.
renderRowSelectionActions?: () => JSX.Element;

/// When callback is assigned, an input field will appear in the toolbar.
onSearchInputChanged?: (input: string) => void;
searchInputPlaceholder?: string;

title?: string;

rowSelection?: {
Expand Down Expand Up @@ -95,6 +101,8 @@ export function Table<DataType extends object>({
rowSelection,
columnSearch,
renderDetailPanel,
onSearchInputChanged,
searchInputPlaceholder = 'Search...',
renderToolbar,
canExpand = () => false,
renderRowSelectionActions,
Expand Down Expand Up @@ -127,6 +135,15 @@ export function Table<DataType extends object>({

const [columnPinning, setColumnPinning] = useState<ColumnPinningState>({});
const { storedValue: density, setValue: setDensity } = useLocalStorage<Density>(`table-density-${id}`, 'tight');
const [searchInput, setSearchInput] = useState<string>('');
const debouncedValue = useDebounce(searchInput, 350);

useEffect(() => {
if (onSearchInputChanged) {
onSearchInputChanged(debouncedValue);
table.resetPagination();
}
}, [debouncedValue]);

// Might because potentially none fullfil the canExpand condtion.
const rowsMightExpand = renderDetailPanel ? true : false;
Expand Down Expand Up @@ -246,6 +263,18 @@ export function Table<DataType extends object>({
</Flex>
<Flex>
{renderToolbar && renderToolbar()}
{onSearchInputChanged && (
<UnControlledTextField
name="search-input"
value={searchInput}
placeholder={searchInputPlaceholder}
id={id + '-search-input'}
hasDescription={false}
hasError={false}
icon={<SearchIcon />}
onChange={(e) => setSearchInput(e.currentTarget.value)}
/>
)}
{!isLoading && <Filter table={table} />}
<ColumnVisibility
table={table}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ export function FilterRow<DataType extends object>({
control={control}
name={`filters.${index}.column`}
label="Column"
inPortal
render={(selectedItems) => {
if (selectedItems.length === 0) {
return 'Select a column';
Expand All @@ -95,7 +94,6 @@ export function FilterRow<DataType extends object>({
control={control}
name={`filters.${index}.operator`}
label="Condition"
inPortal
render={() => {
const operator = currentOperator?.toString();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export const PageSizeSelect: FC<PageSizeSelectProps> = ({ onPageSizeChange, page
id="page-size"
multiple={false}
name="pageSize"
inPortal={true}
value={pageSize.toString() || '10'}
onChange={onPageSizeChange}
render={(selectedItems) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ export const QuickSelect: FC<QuickSelectProps> = ({ id }) => {
<StyledForm onSubmit={handleSubmit(onSubmit)}>
<InputsContainer>
<SelectField
inPortal
control={control}
name="tense"
render={(selectedItems) => (
Expand All @@ -120,7 +119,6 @@ export const QuickSelect: FC<QuickSelectProps> = ({ id }) => {
<TextField control={control} type="number" name="step" />

<SelectField
inPortal
control={control}
name="unit"
render={(selectedItems) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ export const RelativePicker: FC<RelativePickerProps> = ({ onChange, id, timeDire
<StyledForm onSubmit={handleSubmit(handleChange)}>
<InputsContainer>
<SelectField
inPortal
control={control}
readOnly={timeDirection !== 'pastAndFuture'}
name="tense"
Expand All @@ -121,7 +120,6 @@ export const RelativePicker: FC<RelativePickerProps> = ({ onChange, id, timeDire
</SelectField>
<TextField control={control} type="number" name="step" />
<SelectField
inPortal
control={control}
name="unit"
render={(selectedItems) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ export const GenericDurationField = forwardRef<HTMLDivElement, GenericDurationFi
/>
<SelectField
key={`${name}-${index}-unit`}
inPortal
control={control}
name={`durations.${index}.unit`}
multiple={false}
Expand Down
Loading

0 comments on commit 6d20fe8

Please sign in to comment.