Skip to content

Commit

Permalink
Merge pull request #1170 from appwrite/fix-function-version-check
Browse files Browse the repository at this point in the history
fix: function version check
  • Loading branch information
ArmanNik authored Jul 1, 2024
2 parents 5c6b1e9 + c0befb1 commit da42584
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 29 deletions.
20 changes: 8 additions & 12 deletions src/lib/components/filters/content.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,6 @@
apply: { applied: number };
}>();
dispatch('apply', { applied: $tags.length });
// $: if (column?.type === 'datetime' && !value) {
// const today = new Date();
// console.log(today.toISOString());
// value = today.toISOString();
// console.log('value', value);
// }
</script>

<div>
Expand Down Expand Up @@ -101,10 +94,10 @@
name="value"
bind:tags={arrayValues}
placeholder="Select value"
options={column?.elements?.map((value) => ({
label: value,
value,
checked: arrayValues.includes(value)
options={column?.elements?.map((e) => ({
label: e?.label ?? e,
value: e?.value ?? e,
checked: arrayValues.includes(e?.value ?? e)
}))}>
</InputSelectCheckbox>
{:else}
Expand All @@ -123,7 +116,10 @@
id="value"
bind:value
placeholder="Select value"
options={column?.elements?.map((value) => ({ label: value, value }))}
options={column?.elements?.map((e) => ({
label: e?.label ?? e,
value: e?.value ?? e
}))}
label="Value"
showLabel={false} />
{:else if column.type === 'integer' || column.type === 'double'}
Expand Down
8 changes: 7 additions & 1 deletion src/lib/components/filters/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,13 @@ const operatorsDefault = new Map<
ValidOperators.NotEqual,
{
query: Query.notEqual,
types: [ValidTypes.String, ValidTypes.Integer, ValidTypes.Double, ValidTypes.Boolean]
types: [
ValidTypes.String,
ValidTypes.Integer,
ValidTypes.Double,
ValidTypes.Boolean,
ValidTypes.Enum
]
}
],
[
Expand Down
2 changes: 1 addition & 1 deletion src/lib/helpers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export type Column = {
filter?: boolean;
array?: boolean;
format?: string;
elements?: string[];
elements?: string[] | { value: string; label: string }[];
};

export function isValueOfStringEnum<T extends Record<string, string>>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@
width: 110,
array: true,
format: 'enum',
elements: ['ready', 'processing', 'building', 'cancelled', 'failed']
// processing", "building", "waiting", "ready","failed
elements: ['ready', 'processing', 'building', 'waiting', 'cancelled', 'failed']
},
{
id: 'type',
Expand All @@ -60,7 +59,11 @@
width: 90,
array: true,
format: 'enum',
elements: ['manual', 'cli', 'vcs']
elements: [
{ value: 'manual', label: 'Manual' },
{ value: 'cli', label: 'CLI' },
{ value: 'vcs', label: 'Git' }
]
},
{
id: '$updatedAt',
Expand All @@ -74,18 +77,16 @@
{
id: 'buildTime',
title: 'Build time',
type: 'string',
type: 'integer',
show: true,
width: 80,
format: 'string'
width: 80
},
{
id: 'size',
title: 'Size',
type: 'integer',
show: true,
width: 80,
format: 'integer'
width: 80
}
]);
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
placeholder="Entrypoint"
bind:value={entrypoint}
required />
{#if $func.version !== 'v3'}
{#if $func.version === 'v2'}
<Alert type="info">
<svelte:fragment slot="title">
Build commands now available for functions v3.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
</p>

<FormList>
{#if $execute?.version !== 'v3'}
{#if $execute?.version === 'v2'}
<Alert type="info">
<svelte:fragment slot="title">
Customizable execution data now available for functions v3.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,9 @@
{
id: 'responseStatusCode',
title: 'Status code',
type: 'string',
type: 'integer',
show: true,
width: 100,
array: true,
format: 'integer'
},
{
Expand All @@ -85,7 +84,7 @@
{
id: 'duration',
title: 'Duration',
type: 'string',
type: 'integer',
show: true,
width: 80,
format: 'integer'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
<WizardSecondaryContent>
<Form bind:this={formComponent} onSubmit={handleSubmit} bind:isSubmitting>
<FormList>
{#if func?.version !== 'v3'}
{#if func?.version === 'v2'}
<Alert type="info">
<svelte:fragment slot="title">
Customizable execution data now available for functions v3.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

<Container>
<Heading tag="h2" size="5">Settings</Heading>
{#if $func.version !== 'v3' && showAlert}
{#if $func.version === 'v2' && showAlert}
<Alert
type="warning"
dismissible
Expand Down

0 comments on commit da42584

Please sign in to comment.