aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorivarlovlie <git@ivarlovlie.no>2022-12-05 07:03:11 +0100
committerivarlovlie <git@ivarlovlie.no>2022-12-05 07:03:30 +0100
commit834721f61aaee7c2e269cb1df70a973289a73852 (patch)
treed882ba79be976d744014effd3c79adff98a5e28b
parent93efdbc1e7def640ec03f92a7fb447d33133c7ae (diff)
downloadgreatoffice-834721f61aaee7c2e269cb1df70a973289a73852.tar.xz
greatoffice-834721f61aaee7c2e269cb1df70a973289a73852.zip
refactor: Small changes
-rw-r--r--code/api/src/Program.cs9
-rw-r--r--code/api/src/Resources/SharedResources.en.Designer.cs6
-rw-r--r--code/api/src/Resources/SharedResources.en.resx4
-rw-r--r--code/api/src/Resources/SharedResources.nb.Designer.cs12
-rw-r--r--code/api/src/Resources/SharedResources.nb.resx7
-rw-r--r--code/api/src/Resources/SharedResources.resx3
-rw-r--r--code/app/src/lib/api/account/index.ts1
-rw-r--r--code/app/src/routes/(main)/(app)/projects/create/+page.svelte32
8 files changed, 55 insertions, 19 deletions
diff --git a/code/api/src/Program.cs b/code/api/src/Program.cs
index 87f0537..749c60a 100644
--- a/code/api/src/Program.cs
+++ b/code/api/src/Program.cs
@@ -1,8 +1,6 @@
global using System;
global using System.Linq;
global using System.IO;
-global using System.Net.Mail;
-global using System.Net;
global using System.Threading;
global using System.Threading.Tasks;
global using System.Collections.Generic;
@@ -74,6 +72,7 @@ public static class Program
new JsonSerializerOptions() {
WriteIndented = true
}));
+
builder.Host.UseSerilog(Log.Logger);
builder.WebHost.ConfigureKestrel(kestrel => { kestrel.AddServerHeader = false; });
@@ -87,7 +86,7 @@ public static class Program
builder.Services.AddLocalization(options => { options.ResourcesPath = "Resources"; });
builder.Services.AddRequestLocalization(options => {
- var supportedCultures = new[] {"en-gb", "no-nb"};
+ var supportedCultures = new[] {"en", "nb"};
options.SetDefaultCulture(supportedCultures[0])
.AddSupportedCultures(supportedCultures)
.AddSupportedUICultures(supportedCultures);
@@ -110,7 +109,6 @@ public static class Program
});
builder.Services.AddQuartzHostedService(options => { options.WaitForJobsToComplete = true; });
-
builder.Services.AddAuthentication(options => {
options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = CookieAuthenticationDefaults.AuthenticationScheme;
@@ -176,11 +174,13 @@ public static class Program
}
});
});
+
builder.Services.AddPagination(options => {
options.DefaultSize = 50;
options.MaxSize = 100;
options.CanChangeSizeFromQuery = true;
});
+
builder.Services
.AddControllers()
.AddDataAnnotationsLocalization()
@@ -191,7 +191,6 @@ public static class Program
public static WebApplication CreateWebApplication(WebApplicationBuilder builder) {
var app = builder.Build();
-
if (app.Environment.IsDevelopment()) {
app.UseDeveloperExceptionPage();
app.UseCors(cors => {
diff --git a/code/api/src/Resources/SharedResources.en.Designer.cs b/code/api/src/Resources/SharedResources.en.Designer.cs
index 4eb786f..02ada48 100644
--- a/code/api/src/Resources/SharedResources.en.Designer.cs
+++ b/code/api/src/Resources/SharedResources.en.Designer.cs
@@ -74,5 +74,11 @@ namespace IOL.GreatOffice.Api.Resources {
return ResourceManager.GetString("One or more fields is invalid", resourceCulture);
}
}
+
+ internal static string Invalid_username_or_password {
+ get {
+ return ResourceManager.GetString("Invalid username or password", resourceCulture);
+ }
+ }
}
}
diff --git a/code/api/src/Resources/SharedResources.en.resx b/code/api/src/Resources/SharedResources.en.resx
index 5987e8d..87e46e0 100644
--- a/code/api/src/Resources/SharedResources.en.resx
+++ b/code/api/src/Resources/SharedResources.en.resx
@@ -38,4 +38,8 @@
<value>One or more fields is invalid</value>
<comment>One or more fields is invalid</comment>
</data>
+ <data name="Invalid username or password" xml:space="preserve">
+ <value>Invalid username or password</value>
+ <comment>Invalid username or password</comment>
+ </data>
</root> \ No newline at end of file
diff --git a/code/api/src/Resources/SharedResources.nb.Designer.cs b/code/api/src/Resources/SharedResources.nb.Designer.cs
index 114c86f..37006f2 100644
--- a/code/api/src/Resources/SharedResources.nb.Designer.cs
+++ b/code/api/src/Resources/SharedResources.nb.Designer.cs
@@ -68,5 +68,17 @@ namespace IOL.GreatOffice.Api.Resources {
return ResourceManager.GetString("One or more fields is invalid", resourceCulture);
}
}
+
+ internal static string Invalid_username_or_password {
+ get {
+ return ResourceManager.GetString("Invalid username or password", resourceCulture);
+ }
+ }
+
+ internal static string One_or_more_validation_errors_occured {
+ get {
+ return ResourceManager.GetString("One or more validation errors occured", resourceCulture);
+ }
+ }
}
}
diff --git a/code/api/src/Resources/SharedResources.nb.resx b/code/api/src/Resources/SharedResources.nb.resx
index 6c8937b..880274e 100644
--- a/code/api/src/Resources/SharedResources.nb.resx
+++ b/code/api/src/Resources/SharedResources.nb.resx
@@ -39,4 +39,11 @@
<comment>One or more fields is invalid</comment>
<value>En eller flere felt er ugyldige</value>
</data>
+ <data name="Invalid username or password" xml:space="preserve">
+ <value>Ugyldig brukernavn eller passord</value>
+ <comment>Invalid username or password</comment>
+ </data>
+ <data name="One or more validation errors occured" xml:space="preserve">
+ <value>En eller flere valideringsfeil har oppstått</value>
+ </data>
</root> \ No newline at end of file
diff --git a/code/api/src/Resources/SharedResources.resx b/code/api/src/Resources/SharedResources.resx
index 377994b..833428b 100644
--- a/code/api/src/Resources/SharedResources.resx
+++ b/code/api/src/Resources/SharedResources.resx
@@ -27,4 +27,7 @@
<value>One or more fields is invalid</value>
<comment>One or more fields is invalid</comment>
</data>
+ <data name="Invalid username or password" xml:space="preserve">
+ <value />
+ </data>
</root> \ No newline at end of file
diff --git a/code/app/src/lib/api/account/index.ts b/code/app/src/lib/api/account/index.ts
index cfd627b..6dbcdc8 100644
--- a/code/app/src/lib/api/account/index.ts
+++ b/code/app/src/lib/api/account/index.ts
@@ -1,5 +1,4 @@
import {api_base} from "$lib/configuration";
-import type {SessionData} from "src/lib/models/base/SessionData";
import {http_delete_async, http_get_async, http_post_async} from "../_fetch";
export const http_account = {
diff --git a/code/app/src/routes/(main)/(app)/projects/create/+page.svelte b/code/app/src/routes/(main)/(app)/projects/create/+page.svelte
index 2b5e7bc..1741506 100644
--- a/code/app/src/routes/(main)/(app)/projects/create/+page.svelte
+++ b/code/app/src/routes/(main)/(app)/projects/create/+page.svelte
@@ -4,42 +4,48 @@
import type { ProjectMember } from "$lib/models/projects/ProjectMember";
import LL from "$lib/i18n/i18n-svelte";
- const formFields = {
+ const formData = {
name: {
value: "",
- error: "",
+ errors: [],
},
description: {
value: "",
- error: "",
+ errors: [],
},
start: {
value: "",
- error: "",
+ errors: [],
},
stop: {
value: "",
- error: "",
+ errors: [],
},
members: {
value: [] as Array<ProjectMember>,
- error: "",
+ errors: [],
},
- clear() {},
};
- async function submit(event: Event) {
+
+ const formError = {
+ title: "",
+ subtitle: "",
+ };
+
+ async function submit_form_async() {
alert("Submitted");
}
+
const { data: members } = useSWR("projectMembers");
</script>
<h1>Create a new project</h1>
-<form on:submit|preventDefault={submit} class="max-w-md flex flex-col gap-2">
- <Input label="Name" bind:value={formFields.name.value} errorText={formFields.name.error} required />
- <TextArea label="Description" bind:value={formFields.description.value} errorText={formFields.description.error} />
+<form on:submit|preventDefault={submit_form_async} class="max-w-md flex flex-col gap-2">
+ <Input label="Name" bind:value={formData.name.value} errors={formData.name.errors} required />
+ <TextArea label="Description" bind:value={formData.description.value} errors={formData.description.errors} />
<section class="grid grid-flow-row sm:grid-flow-col gap-2">
- <Input type="date" label="Start" bind:value={formFields.start.value} errorText={formFields.start.error} />
- <Input type="date" label="Stop" bind:value={formFields.stop.value} errorText={formFields.stop.error} />
+ <Input type="date" label="Start" bind:value={formData.start.value} errors={formData.start.errors} />
+ <Input type="date" label="Stop" bind:value={formData.stop.value} errors={formData.stop.errors} />
</section>
<Combobox options={$members} label={$LL.app.members()}>
<svelte:fragment slot="no-records">