-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add front cache and improve AWS UX (#49)
* feat: add front cache and improve AWS UX * feat: improve types * feat: rewrite of latest page * feat: improvement for registry v2 * fix build * fix: docker build * chore: dependencies * feat: use session token * feat: clean useCLI * feat: improve docker, deps * feat: fix credentials detection * chore: add changelog
- Loading branch information
1 parent
90b9e7d
commit d9e486a
Showing
30 changed files
with
9,497 additions
and
7,979 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import { Option } from '@swan-io/boxed' | ||
import { getCookie } from '~~/functions/cookies' | ||
|
||
export class DB { | ||
public upsertRepositories (repositories: Array<any>): Option<Array<any>> { | ||
const alreadySavedRepositories = this.findRepositories() | ||
|
||
let repositoriesToSave = [] | ||
if (alreadySavedRepositories.isSome()) { | ||
repositoriesToSave = Array.from( | ||
new Set([ | ||
...alreadySavedRepositories.get(), | ||
...repositories | ||
] | ||
.map(obj => JSON.stringify(obj)) | ||
) | ||
).map(obj => JSON.parse(obj)) | ||
} else { | ||
repositoriesToSave = [...repositories] | ||
} | ||
|
||
localStorage.setItem(this.computeKey('repositories'), JSON.stringify(repositoriesToSave)) | ||
|
||
return Option.Some(repositoriesToSave) | ||
} | ||
|
||
public findRepositories (): Option<Array<any>> { | ||
const item = localStorage.getItem(this.computeKey('repositories')) | ||
|
||
if (item) { | ||
return Option.Some(JSON.parse(item)) | ||
} | ||
|
||
return Option.None() | ||
} | ||
|
||
public saveRepositoryImages ( | ||
repositoryName: string, | ||
images: any | ||
): void { | ||
localStorage.setItem(this.computeKey(`images-for-repo-${repositoryName}`), JSON.stringify(images)) | ||
} | ||
|
||
public findRepositoryImages ( | ||
repositoryName: string, | ||
): Option<any> { | ||
const item = localStorage.getItem(this.computeKey(`images-for-repo-${repositoryName}`)) | ||
|
||
if (item) { | ||
return Option.Some(JSON.parse(item)) | ||
} | ||
|
||
return Option.None() | ||
} | ||
|
||
public saveLatestRepositories (repositories: Array<any>): Option<Array<any>> { | ||
localStorage.setItem(this.computeKey('latest-repositories'), JSON.stringify(repositories)) | ||
|
||
return Option.Some(repositories) | ||
} | ||
|
||
public findLatestRepositories (): Option<Array<any>> { | ||
const item = localStorage.getItem(this.computeKey('latest-repositories')) | ||
|
||
if (item) { | ||
return Option.Some(JSON.parse(item)) | ||
} | ||
|
||
return Option.None() | ||
} | ||
|
||
private computeKey (key: string): string { | ||
const provider = Option.fromNullable(getCookie('fuzzy-engine-provider')) | ||
if (provider.isSome()) { | ||
key = `${provider.get()}-${key}` | ||
} | ||
|
||
return key | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
export default defineNuxtConfig({ | ||
ssr: true, | ||
typescript: { | ||
shim: false | ||
shim: false, | ||
}, | ||
app: { | ||
head: { | ||
|
Oops, something went wrong.