Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/client/src/components/ClusterForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const clusterToDelete = ref('')
const isDeletingCluster = ref(false)

if (!localCluster.value.zoneId && props.allZones.length) {
localCluster.value.zoneId = props.allZones[0].id
localCluster.value.zoneId = props.allZones[0]!.id
}

const schema = computed(() => {
Expand Down Expand Up @@ -113,7 +113,7 @@ function updateKubeconfig(files: FileList) {
snackbarStore.setMessage('Pas de current-context. Choisissez un contexte.')
}
}
reader.readAsText(files[0])
reader.readAsText(files[0]!)
} catch (error) {
// @ts-ignore
kConfigError.value = error?.message
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/components/ProjectClustersInfos.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ onMounted(async () => {
<div
title="Zone"
>
<v-icon name="ri:focus-3-line" />: {{ zoneStore.zonesById[cluster.zoneId].label }}
<v-icon name="ri:focus-3-line" />: {{ zoneStore.zonesById[cluster.zoneId]?.label }}
</div>
<div
title="Confidentialité"
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/components/ProjectSecretsButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function closeModal(e?: MouseEvent | TouchEvent) {
</h6>
<DsfrTable
class="horizontal-table"
:headers="Object.keys(projectSecrets[service])"
:headers="Object.keys(projectSecrets[service] ?? {})"
title=""
>
<tr
Expand Down
4 changes: 2 additions & 2 deletions apps/client/src/components/ServicesConfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function groupManifest(configItems: PluginConfigItem[] = []) {
return configItems.reduce((acc, curr) => {
if (!curr.section) curr.section = 'default'
if (curr.section in acc.items) {
acc.items[curr.section].push(curr as PluginConfigItem)
acc.items[curr.section]!.push(curr as PluginConfigItem)
} else {
acc.items[curr.section] = [curr as PluginConfigItem]
acc.sectionNumber++
Expand All @@ -55,7 +55,7 @@ const updated = ref<PluginsUpdateBody>({})

function update(data: { value: string, key: string, plugin: string }) {
if (!updated.value[data.plugin]) updated.value[data.plugin] = {}
updated.value[data.plugin][data.key] = data.value
updated.value[data.plugin]![data.key] = data.value
}

function getItemsToShowLength(items: PluginConfigItem[] | (PluginConfigItem & { value: any })[] | undefined, scope: PermissionTarget): number | undefined {
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/components/TeamCt.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const retrieveUsersToAdd = pDebounce(async (letters: LettersQuery['letters']) =>
if (letters.length < 3) return
// Ne pas relancer de requête à chaque lettre ajoutée si aucun user ne correspond aux premières lettres données
if (lettersNotMatching.value && letters.includes(lettersNotMatching.value) && !usersToAdd.value?.length) return
usersToAdd.value = await projectStore.projectsBySlug[props.project.slug].Members.getCandidateUsers(letters)
usersToAdd.value = await projectStore.projectsBySlug[props.project.slug]?.Members.getCandidateUsers(letters)
// Stockage des lettres qui ne renvoient aucun résultat
if (!usersToAdd.value?.length) {
lettersNotMatching.value = letters
Expand Down
10 changes: 5 additions & 5 deletions apps/client/src/stores/admin-role.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ export const useAdminRoleStore = defineStore('adminRole', () => {

const countMembersRoles = async () => {
memberCounts.value
= await apiClient.AdminRoles.adminRoleMemberCounts().then((res: any) =>
= await apiClient.AdminRoles.adminRoleMemberCounts().then((res) =>
extractData(res, 200),
)
return memberCounts.value
}

const listRoles = async () => {
roles.value = await apiClient.AdminRoles.listAdminRoles().then((response: any) =>
roles.value = await apiClient.AdminRoles.listAdminRoles().then((response) =>
extractData(response, 200),
)
if (AdminAuthorized.ListRoles(userStore.adminPerms)) {
Expand All @@ -31,12 +31,12 @@ export const useAdminRoleStore = defineStore('adminRole', () => {
const createRole = async () => {
roles.value = await apiClient.AdminRoles.createAdminRole({
body: { name: 'Nouveau rôle' },
}).then((res: any) => extractData(res, 201))
}).then((res) => extractData(res, 201))
}

const deleteRole = async (roleId: AdminRole['id']) => {
await apiClient.AdminRoles.deleteAdminRole({ params: { roleId } }).then(
(res: any) => extractData(res, 204),
(res) => extractData(res, 204),
)
await listRoles()
}
Expand All @@ -46,7 +46,7 @@ export const useAdminRoleStore = defineStore('adminRole', () => {
) => {
roles.value = await apiClient.AdminRoles.patchAdminRoles({
body,
}).then((res: any) => extractData(res, 200))
}).then((res) => extractData(res, 200))
}

return {
Expand Down
6 changes: 3 additions & 3 deletions apps/client/src/stores/admin-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ export const useAdminTokenStore = defineStore('adminToken', () => {
query: typeof adminTokenContract.listAdminTokens.query._type = {},
) => {
return apiClient.AdminTokens.listAdminTokens({ query }).then(
(response: any) => extractData(response, 200),
(response) => extractData(response, 200),
)
}

const createToken = async (
body: typeof adminTokenContract.createAdminToken.body._type,
) => {
return apiClient.AdminTokens.createAdminToken({ body }).then((res: any) =>
return apiClient.AdminTokens.createAdminToken({ body }).then((res) =>
extractData(res, 201),
)
}

const deleteToken = async (tokenId: AdminToken['id']) => {
await apiClient.AdminTokens.deleteAdminToken({ params: { tokenId } }).then(
(res: any) => extractData(res, 204),
(res) => extractData(res, 204),
)
}

Expand Down
14 changes: 7 additions & 7 deletions apps/client/src/stores/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,28 @@ export const useClusterStore = defineStore('cluster', () => {

const getClusters = async () => {
clusters.value = await apiClient.Clusters.listClusters().then(
(response: any) => extractData(response, 200),
(response) => extractData(response, 200),
)
return clusters.value
}

const getClusterDetails = async (clusterId: Cluster['id']) =>
apiClient.Clusters.getClusterDetails({ params: { clusterId } }).then(
(response: any) => extractData(response, 200),
(response) => extractData(response, 200),
)

const getClusterUsage = async (clusterId: Cluster['id']) =>
apiClient.Clusters.getClusterUsage({ params: { clusterId } }).then(
(response: any) => extractData(response, 200),
(response) => extractData(response, 200),
)

const getClusterAssociatedEnvironments = (clusterId: Cluster['id']) =>
apiClient.Clusters.getClusterEnvironments({ params: { clusterId } }).then(
(response: any) => extractData(response, 200),
(response) => extractData(response, 200),
)

const addCluster = (cluster: CreateClusterBody) =>
apiClient.Clusters.createCluster({ body: cluster }).then((response: any) =>
apiClient.Clusters.createCluster({ body: cluster }).then((response) =>
extractData(response, 201),
)

Expand All @@ -43,12 +43,12 @@ export const useClusterStore = defineStore('cluster', () => {
...body
}: UpdateClusterBody & { id: Cluster['id'] }) =>
apiClient.Clusters.updateCluster({ body, params: { clusterId: id } }).then(
(response: any) => extractData(response, 200),
(response) => extractData(response, 200),
)

const deleteCluster = (clusterId: Cluster['id']) =>
apiClient.Clusters.deleteCluster({ params: { clusterId } }).then(
(response: any) => extractData(response, 204),
(response) => extractData(response, 204),
)

return {
Expand Down
4 changes: 2 additions & 2 deletions apps/client/src/stores/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ export const useLogStore = defineStore('log', () => {

const getAllLogs = async ({ offset, limit }: GetLogsQuery = { offset: 0, limit: 100 }) => {
const res = await apiClient.Logs.getLogs({ query: { offset, limit, clean: false } })
.then((response: any) => extractData(response, 200))
.then((response) => extractData(response, 200))
count.value = res.total
logs.value = res.logs as Log[]
}

const listLogs = async ({ offset, limit, clean, projectId }: GetLogsQuery = { offset: 0, limit: 10 }) => {
return apiClient.Logs.getLogs({ query: { offset, limit, clean, projectId } })
.then((response: any) => extractData(response, 200))
.then((response) => extractData(response, 200))
}

return {
Expand Down
4 changes: 2 additions & 2 deletions apps/client/src/stores/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ export const usePluginsConfigStore = defineStore('plugins', () => {
const services: ProjectService[] = []

const getPluginsConfig = () => apiClient.SystemPlugin.getPluginsConfig()
.then((response: any) => extractData(response, 200))
.then((response) => extractData(response, 200))

const updatePluginsConfig = (body: PluginsUpdateBody) => apiClient.SystemPlugin.updatePluginsConfig({ body })
.then((response: any) => extractData(response, 204))
.then((response) => extractData(response, 204))

return {
services,
Expand Down
17 changes: 9 additions & 8 deletions apps/client/src/stores/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const useProjectStore = defineStore('project', () => {
const updateStore = async (projectsRecieved: ProjectV2[]) => {
return projectsRecieved.map((project) => {
if (project.slug in projectsBySlug.value) {
return projectsBySlug.value[project.slug].Commands.updateData(project)
return projectsBySlug.value[project.slug]!.Commands.updateData(project)
}
const newProject = new Project(project)
projectsBySlug.value[project.slug] = newProject
Expand All @@ -49,13 +49,13 @@ export const useProjectStore = defineStore('project', () => {
const selectFromStore = (slugs: ProjectV2['slug'][]) => {
return slugs
.filter(slug => slug in projectsBySlug.value)
.map(slug => projectsBySlug.value[slug])
.map(slug => projectsBySlug.value[slug]!)
}

const getProject = async (projectId: ProjectV2['id']) => {
const res = await apiClient.Projects.getProject({
params: { projectId },
}).then((response: any) => extractData(response, 200))
}).then((response) => extractData(response, 200))
return (await updateStore([res]))[0]
}

Expand All @@ -66,16 +66,17 @@ export const useProjectStore = defineStore('project', () => {
},
) => {
const res = await apiClient.Projects.listProjects({ query }).then(
(response: any) => extractData(response, 200),
(response) => extractData(response, 200),
)
await updateStore(res)
return selectFromStore(res.map((project: any) => project.slug))
const slugs = res.map((project) => project.slug as ProjectV2['slug'])
return selectFromStore(slugs)
}

const listMyProjects = pDebounce(async () => {
const res = await apiClient.Projects.listProjects({
query: { filter: 'member', statusNotIn: 'archived' },
}).then((response: any) => extractData(response, 200))
}).then((response) => extractData(response, 200))
for (const storedProject of myProjects.value) {
if (
!res.some((responseProject: any) => responseProject.id === storedProject.id)
Expand All @@ -89,14 +90,14 @@ export const useProjectStore = defineStore('project', () => {

const createProject = async (body: CreateProjectBody) => {
const project = await apiClient.Projects.createProject({ body }).then(
(response: any) => extractData(response, 201),
(response) => extractData(response, 201),
)
projectsBySlug.value[project.slug] = new Project(project)
return project
}

const generateProjectsData = () =>
apiClient.Projects.getProjectsData().then((response: any) =>
apiClient.Projects.getProjectsData().then((response) =>
extractData(response, 200),
)

Expand Down
6 changes: 3 additions & 3 deletions apps/client/src/stores/service-chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const useServiceChainStore = defineStore('serviceChain', () => {

const getServiceChainsList = async () => {
serviceChains.value
= await apiClient.ServiceChains.listServiceChains().then((response: any) =>
= await apiClient.ServiceChains.listServiceChains().then((response) =>
extractData(response, 200),
)
return serviceChains.value
Expand All @@ -26,14 +26,14 @@ export const useServiceChainStore = defineStore('serviceChain', () => {
const getServiceChainDetails = async (serviceChainId: ServiceChain['id']) =>
apiClient.ServiceChains.getServiceChainDetails({
params: { serviceChainId },
}).then((response: any) =>
}).then((response) =>
ServiceChainDetailsSchema.parse(extractData(response, 200)),
)

const getServiceChainFlows = async (serviceChainId: ServiceChain['id']) =>
apiClient.ServiceChains.getServiceChainFlows({
params: { serviceChainId },
}).then((response: any) =>
}).then((response) =>
ServiceChainFlowsSchema.parse(extractData(response, 200)),
)

Expand Down
4 changes: 2 additions & 2 deletions apps/client/src/stores/services-monitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const useServiceStore = defineStore('serviceMonitor', () => {
services.value = await (displayCause.value
? apiClient.Services.getCompleteServiceHealth()
: apiClient.Services.getServiceHealth())
.then((res: any) => extractData(res, 200))
.then((res) => extractData(res, 200))
callStastus.value = 'ok'
} catch {
callStastus.value = 'error'
Expand All @@ -96,7 +96,7 @@ export const useServiceStore = defineStore('serviceMonitor', () => {

const refreshServicesHealth = async () => {
await apiClient.Services.refreshServiceHealth()
.then((res: any) => extractData(res, 200))
.then((res) => extractData(res, 200))
return checkServicesHealth()
}

Expand Down
10 changes: 5 additions & 5 deletions apps/client/src/stores/stage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@ export const useStageStore = defineStore('stage', () => {

const getAllStages = async () => {
stages.value = await apiClient.Stages.listStages()
.then((response: any) => extractData(response, 200))
.then((response) => extractData(response, 200))
return stages.value
}

const getStageAssociatedEnvironments = (stageId: string) =>
apiClient.Stages.getStageEnvironments({ params: { stageId } })
.then((response: any) => extractData(response, 200))
.then((response) => extractData(response, 200))

const addStage = (body: CreateStageBody) =>
apiClient.Stages.createStage({ body })
.then((response: any) => extractData(response, 201))
.then((response) => extractData(response, 201))

const updateStage = (stageId: string, body: UpdateStageBody) =>
apiClient.Stages.updateStage({ params: { stageId }, body })
.then((response: any) => extractData(response, 200))
.then((response) => extractData(response, 200))

const deleteStage = (stageId: string) =>
apiClient.Stages.deleteStage({ params: { stageId } })
.then((response: any) => extractData(response, 204))
.then((response) => extractData(response, 204))

return {
stages,
Expand Down
4 changes: 2 additions & 2 deletions apps/client/src/stores/system-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ export const useSystemSettingsStore = defineStore('systemSettings', () => {

const listSystemSettings = async (query: typeof systemSettingsContract.listSystemSettings.query._type = {}) => {
systemSettings.value = await apiClient.SystemSettings.listSystemSettings(query)
.then((response: any) => extractData(response, 200))
.then((response) => extractData(response, 200))
}

const upsertSystemSetting = async (newSystemSetting: UpsertSystemSettingBody) => {
const res = await apiClient.SystemSettings.upsertSystemSetting({ body: newSystemSetting })
.then((response: any) => extractData(response, 201))
.then((response) => extractData(response, 201))
systemSettings.value = systemSettings.value
.toSpliced(systemSettings.value
.findIndex(systemSetting => systemSetting.key === res.key), 1, res)
Expand Down
6 changes: 3 additions & 3 deletions apps/client/src/stores/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { apiClient, extractData } from '../api/xhr-client.js'
export const useTokenStore = defineStore('token', () => {
const listPersonalAccessTokens = async () => {
return apiClient.PersonalAccessTokens.listPersonalAccessTokens().then(
(response: any) => extractData(response, 200),
(response) => extractData(response, 200),
)
}

Expand All @@ -17,15 +17,15 @@ export const useTokenStore = defineStore('token', () => {
) => {
return apiClient.PersonalAccessTokens.createPersonalAccessToken({
body,
}).then((res: any) => extractData(res, 201))
}).then((res) => extractData(res, 201))
}

const deletePersonalAccessToken = async (
tokenId: PersonalAccessToken['id'],
) => {
await apiClient.PersonalAccessTokens.deletePersonalAccessToken({
params: { tokenId },
}).then((res: any) => extractData(res, 204))
}).then((res) => extractData(res, 204))
}

return {
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/stores/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const useUserStore = defineStore('user', () => {
userProfile.value = getUserProfile()
await systemSettingsStore.listSystemSettings().catch(() => undefined)
await apiClient.Users.auth()
.then((res: any) => apiAuthInfos.value = extractData(res, 200))
.then((res) => apiAuthInfos.value = extractData(res, 200))
}

const setIsLoggedIn = async () => {
Expand Down
Loading
Loading