Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sebt3 committed Jan 21, 2024
1 parent d08c2ad commit 451deb8
Show file tree
Hide file tree
Showing 7 changed files with 114 additions and 62 deletions.
43 changes: 33 additions & 10 deletions front/components/vynil/DistribView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import vynilDistribQuery from '@/queries/vynil/DistribView.graphql'
import distribDelete from '@/queries/vynil/DistribDelete.graphql'
import MetadataView from '../core/MetadataView.vue';
import OpenApiEdit from '../core/OpenApiEdit.vue';
import DefaultStatusView from '../core/DefaultStatusView.vue';
import TableHeader from '../core/TableHeader.vue';
import MonacoViewer from '../core/MonacoViewer.vue';
import { useQuery, useMutation, useDistrib, getProperties } from './Distrib.js'
const { viewer, viewerUpdate, onErrorHandler, notifySuccess, notifyError, onNotDistribFound, navigation, setItemFromRoute, toEdit, actionDelete } = useDistrib();setItemFromRoute();
const { result, loading, onResult, onError } = useQuery(vynilDistribQuery, { "name": navigation.currentItem }, { pollInterval: 500 });onError(onErrorHandler); onResult(res => {onNotDistribFound(res);viewerUpdate(res, res.loading?{}:res.data.vynilDistrib.metadata.obj)});
import { ref, useQuery, useMutation, useDistrib, packageColumns, getProperties } from './Distrib.js'
let filter = ref('');
const { viewer, viewerUpdate, onErrorHandler, notifySuccess, notifyError, onNotDistribFound, navigation, pagination, setItemFromRoute, toEdit, actionDelete } = useDistrib();setItemFromRoute();
const { result, loading, onResult, onError } = useQuery(vynilDistribQuery, { "name": navigation.currentItem }, { pollInterval: 500 });onError(onErrorHandler);
onResult(res => {onNotDistribFound(res);viewerUpdate(res, res.loading?{}:res.data.vynilDistrib.metadata.obj)});
const { mutate: deletor, onDone: onDeleteDone, onError: onDeleteError } = useMutation(distribDelete);
onDeleteDone(() => {
notifySuccess('Deletion proceded');
Expand All @@ -19,7 +21,7 @@ onDeleteError((err) => {
</script>
<template>
<div class="row q-mb-sm q-ml-sm">
<div class="col-md-6">
<div class="col-md-4">
<q-card bordered v-if="!loading && result!=undefined && result.vynilDistrib!=undefined && result.vynilDistrib!=null" class="q-ma-sm">
<q-card-section class="bg-primary text-grey-4">
<div class="text-h6 q-mt-none q-mb-none q-pt-none q-pb-none">Distrib
Expand All @@ -37,17 +39,32 @@ onDeleteError((err) => {
<MetadataView :metadata="result.vynilDistrib.metadata" />
</q-card-section>
</q-card>
</div><div class="col-md-4">
<q-card bordered v-if="!loading && result!=undefined && result.vynilDistrib!=undefined && result.vynilDistrib!=null" class="q-ma-sm">
<q-card-section>
<div class="text-h6 text-grey-8 q-mt-none q-mb-none q-pt-none q-pb-none">Status</div>
</q-card-section>
<q-card-section v-if="!loading && result.vynilDistrib!=null && result.vynilDistrib.status != null">
<DefaultStatusView :status="result.vynilDistrib.status" />
<q-card-section>
<div class="q-gutter-md">
<q-field label="Status" stack-label borderless>
<template v-slot:prepend><q-icon name="done" /></template>
<template v-slot:control>
<q-chip class="float-right text-white text-capitalize" label="Ok" color="positive" v-if="result.vynilDistrib.status.errors.length==0"></q-chip>
<q-chip class="float-right text-white text-capitalize" label="Errors" color="negative" v-if="result.vynilDistrib.status.errors.length>0"></q-chip>
</template>
</q-field>
<q-field label="Errors" stack-label borderless v-if="result.vynilDistrib.status.errors.length>0">
<template v-slot:prepend><q-icon name="error" /></template>
<template v-slot:control><div class="self-center full-width no-outline" tabindex="0">
<div v-for="err in result.vynilDistrib.status.errors" v-bind:key="err">{{ err }}</div>
</div></template>
</q-field>
</div>
</q-card-section>
</q-card>
</div><div class="col-md-6">
</div><div class="col-md-4">
<q-card bordered v-if="!loading && result!=undefined && result.vynilDistrib!=undefined && result.vynilDistrib!=null" class="q-ma-sm">
<q-tabs v-model="viewer.tab" class="bg-primary text-grey-4" active-color="white">
<q-tabs v-model="viewer.tab" class="bg-primary text-white">
<q-tab label="Options" name="simple" />
<q-tab label="Specifications" name="spec" />
<q-tab label="full Yaml" name="yaml" />
Expand All @@ -71,4 +88,10 @@ onDeleteError((err) => {
</q-card>
</div>
</div>
</template>
<q-card v-if="!loading && result!=undefined && result.vynilDistrib!=undefined && result.vynilDistrib!=null" class="q-ma-sm">
<q-card-section>
<TableHeader title="Packages" v-model:model-filter="filter" itemtype='Package' :usecreate="false" :userefresh="false" />
<q-table :rows="result.vynilDistrib.packages" :columns="packageColumns" class="no-shadow" v-model:pagination="pagination" :filter="filter" hide-bottom></q-table>
</q-card-section>
</q-card>
</template>
128 changes: 81 additions & 47 deletions front/components/vynil/InstallView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,28 @@ import vynilInstallQuery from '@/queries/vynil/InstallView.graphql'
import installDelete from '@/queries/vynil/InstallDelete.graphql'
import MetadataView from '../core/MetadataView.vue';
import OpenApiEdit from '../core/OpenApiEdit.vue';
import DefaultStatusView from '../core/DefaultStatusView.vue';
import MonacoViewer from '../core/MonacoViewer.vue';
import { useQuery, useMutation, useInstall, getProperties } from './Install.js'
const { viewer, viewerUpdate, onErrorHandler, notifySuccess, notifyError, onNotInstallFound, navigation, setNamespacedItemFromRoute, toEdit, actionDelete } = useInstall();setNamespacedItemFromRoute();
const { result, loading, onResult, onError } = useQuery(vynilInstallQuery, {"namespace": navigation.currentNamespace, "name": navigation.currentItem }, { pollInterval: 500 });onError(onErrorHandler); onResult(res => {onNotInstallFound(res);viewerUpdate(res, res.loading?{}:res.data.vynilInstall.metadata.obj)});
import { useInstall, useMutation, useQuery } from './Install.js'
const { viewer, viewerUpdate, deleteDone, deleteError, onErrorHandler, onNotInstallFound, navigation, setNamespacedItemFromRoute, toEdit, actionDelete, toViewReloaded } = useInstall();setNamespacedItemFromRoute();
const { result, loading, onResult, onError } = useQuery(vynilInstallQuery, {"namespace": navigation.currentNamespace, "name": navigation.currentItem}, { pollInterval: 500 });
const { mutate: deletor, onDone: onDeleteDone, onError: onDeleteError } = useMutation(installDelete);
onDeleteDone(() => {
notifySuccess('Deletion proceded');
})
onDeleteError((err) => {
notifyError('Deletion failed');
console.log('deletion error',err);
})
onResult(res => {onNotInstallFound(res);viewerUpdate(res, res.loading?{}:res.data.vynilInstall.metadata.obj)});onError(onErrorHandler);onDeleteDone(deleteDone);onDeleteError(deleteError);
</script>
<template>
<div class="row q-mb-sm q-ml-sm">
<div class="col-md-6">
<q-card bordered v-if="!loading && result!=undefined && result.vynilInstall!=undefined && result.vynilInstall!=null" class="q-ma-sm">
<div class="col-md-4">
<q-card bordered v-if="!loading && result!=null && result.vynilInstall!=null" class="q-ma-sm">
<q-card-section class="bg-primary text-grey-4">
<div class="text-h6 q-mt-none q-mb-none q-pt-none q-pb-none">Install
<div class="text-h5 q-mt-none q-mb-none q-pt-none q-pb-none">Install
<q-btn-group push class="float-right text-capitalize shadow-3">
<q-btn icon="edit" @click="toEdit(result.vynilInstall.metadata.namespace, result.vynilInstall.metadata.name)">
<q-tooltip>Edit</q-tooltip>
<q-btn icon="edit" @click="toEdit(result.vynilInstall.metadata.namespace, result.vynilInstall.metadata.name)" v-if="result.vynilInstall.metadata.labels == undefined || result.vynilInstall.metadata.labels.filter(l=>l.name == 'vynil.solidite.fr/owner-name').length==0">
<q-tooltip>Edit install {{ result.vynilInstall.metadata.name }}</q-tooltip>
</q-btn>
<q-btn icon="delete" @click="actionDelete(deletor, result.vynilInstall)">
<q-tooltip>Delete</q-tooltip>
<q-btn icon="delete" @click="actionDelete(deletor, result.vynilInstall)" v-if="result.vynilInstall.metadata.labels == undefined || result.vynilInstall.metadata.labels.filter(l=>l.name == 'vynil.solidite.fr/owner-name').length==0">
<q-tooltip>Delete install {{ result.vynilInstall.metadata.name }}</q-tooltip>
</q-btn>
<q-btn icon="arrow_upward" @click="toViewReloaded(result.vynilInstall.metadata.labels.filter(l=>l.name == 'vynil.solidite.fr/owner-namespace')[0].value,result.vynilInstall.metadata.labels.filter(l=>l.name == 'vynil.solidite.fr/owner-name')[0].value);" v-if="result.vynilInstall.metadata.labels != undefined && result.vynilInstall.metadata.labels.filter(l=>l.name == 'vynil.solidite.fr/owner-name').length>0">
<q-tooltip>view parent install {{ result.vynilInstall.metadata.labels.filter(l=>l.name == 'vynil.solidite.fr/owner-namespace')[0].value }}.{{ result.vynilInstall.metadata.labels.filter(l=>l.name == 'vynil.solidite.fr/owner-name')[0].value }}</q-tooltip>
</q-btn>
</q-btn-group>
</div>
Expand All @@ -37,38 +33,76 @@ onDeleteError((err) => {
<MetadataView :metadata="result.vynilInstall.metadata" />
</q-card-section>
</q-card>
<q-card bordered v-if="!loading && result!=undefined && result.vynilInstall!=undefined && result.vynilInstall!=null" class="q-ma-sm">
<q-card-section>
<div class="text-h6 text-grey-8 q-mt-none q-mb-none q-pt-none q-pb-none">Status</div>
</div><div class="col-md-4">
<q-card bordered v-if="!loading && result!=null && result.vynilInstall!=null" class="q-ma-sm">
<q-card-section class="bg-secondary text-grey-4">
<div class="text-h5 q-mt-none q-mb-none q-pt-none q-pb-none">Package</div>
</q-card-section>
<q-card-section v-if="!loading && result.vynilInstall!=null && result.vynilInstall.status != null">
<DefaultStatusView :status="result.vynilInstall.status" />
<q-card-section>
<div class="q-gutter-md">
<q-field label="Distribution" stack-label borderless>
<template v-slot:prepend><q-icon name="alt_route" /></template>
<template v-slot:control><div class="self-center full-width no-outline" tabindex="0">{{ result.vynilInstall.distrib.metadata.name }}</div></template>
</q-field>
<q-field label="Category" stack-label borderless>
<template v-slot:prepend><q-icon name="category" /></template>
<template v-slot:control><div class="self-center full-width no-outline" tabindex="0">{{ result.vynilInstall.category.name }}</div></template>
</q-field>
<q-field label="Name" stack-label borderless>
<template v-slot:prepend><q-icon name="smart_button" /></template>
<template v-slot:control><div class="self-center full-width no-outline" tabindex="0">{{ result.vynilInstall.component.name }}</div></template>
</q-field>
</div>
</q-card-section>
</q-card>
</div><div class="col-md-6">
<q-card bordered v-if="!loading && result!=undefined && result.vynilInstall!=undefined && result.vynilInstall!=null" class="q-ma-sm">
<q-tabs v-model="viewer.tab" class="bg-primary text-grey-4" active-color="white">
<q-tab label="Options" name="simple" />
<q-tab label="Specifications" name="spec" />
<q-tab label="full Yaml" name="yaml" />
</q-tabs>
<q-tab-panels v-model="viewer.tab" animated>
<q-tab-panel name="simple">
<OpenApiEdit
:in="result.vynilInstall"
:properties="getProperties(result.customResourceDefinition.versions.filter(v => v.served)[0].schema.openAPIV3Schema.properties.spec)"
:read-only="true"
:show-default="false"
/>
</q-tab-panel>
<q-tab-panel name="spec">
<MonacoViewer :text="viewer.spec" :key="viewer.spec" />
</q-tab-panel>
<q-tab-panel name="yaml">
<MonacoViewer :text="viewer.full" :key="viewer.spec" />
</q-tab-panel>
</q-tab-panels>
</div><div class="col-md-4">
<q-card bordered v-if="!loading && result!=null && result.vynilInstall!=null" class="q-ma-sm">
<q-card-section>
<div class="text-h5 q-mt-none q-mb-none q-pt-none q-pb-none">Status</div>
</q-card-section>
<q-card-section>
<div class="q-gutter-md">
<q-field label="Status" stack-label borderless>
<template v-slot:prepend><q-icon name="done" /></template>
<template v-slot:control>
<q-chip class="float-right text-white text-capitalize" :label="result.vynilInstall.status.status" color="warning" v-if="['planning','installing'].includes(result.vynilInstall.status.status)"></q-chip>
<q-chip class="float-right text-white text-capitalize" :label="result.vynilInstall.status.status" color="positive" v-if="result.vynilInstall.status.status=='installed'"></q-chip>
<q-chip class="float-right text-white text-capitalize" :label="result.vynilInstall.status.status" color="negative" v-if="result.vynilInstall.status.status=='errors'"></q-chip>
<q-chip class="float-right text-white text-capitalize" :label="result.vynilInstall.status.status" color="info" v-if="!['installed','planning','installing','errors'].includes(result.vynilInstall.status.status)"></q-chip>
</template>
</q-field>
<q-field label="Errors" stack-label borderless v-if="result.vynilInstall.status.errors.length>0">
<template v-slot:prepend><q-icon name="error" /></template>
<template v-slot:control><div class="self-center full-width no-outline" tabindex="0">
<div v-for="err in result.vynilInstall.status.errors" v-bind:key="err">{{ err }}</div>
</div></template>
</q-field>
</div>
</q-card-section>
</q-card>
</div>
</div>
</template>
<q-card v-if="!loading && result!=null && result.vynilInstall!=null" class="q-ma-sm">
<q-tabs v-model="viewer.tab" class="bg-primary text-white">
<q-tab label="Options" name="simple" />
<q-tab label="Specifications" name="spec" />
<q-tab label="full Yaml" name="yaml" />
</q-tabs>
<q-tab-panels v-model="viewer.tab" animated>
<q-tab-panel name="simple">
<OpenApiEdit
:in="result.vynilInstall.options"
:properties="new Map(Object.entries(result.vynilInstall.component.options))"
:read-only="true"
:show-default="false"
/>
</q-tab-panel>
<q-tab-panel name="spec">
<MonacoViewer :text="viewer.spec" :key="viewer.spec" />
</q-tab-panel>
<q-tab-panel name="yaml">
<MonacoViewer :text="viewer.full" :key="viewer.spec" />
</q-tab-panel>
</q-tab-panels>
</q-card>
</template>
1 change: 0 additions & 1 deletion front/queries/projectcalico/IPPoolDelete.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ mutation ProjectcalicoIPPool($name: String!) {
mode
}
ipipMode
nat-outgoing
natOutgoing
nodeSelector
vxlanMode
Expand Down
1 change: 0 additions & 1 deletion front/queries/projectcalico/IPPoolEdit.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ mutation ProjectcalicoIPPool($name: String!, $spec: projectcalicoIPPoolSpec!) {
mode
}
ipipMode
nat-outgoing
natOutgoing
nodeSelector
vxlanMode
Expand Down
1 change: 0 additions & 1 deletion front/queries/projectcalico/IPPoolNew.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ mutation ProjectcalicoIPPool($name: String!, $spec: projectcalicoIPPoolSpec!) {
mode
}
ipipMode
nat-outgoing
natOutgoing
nodeSelector
vxlanMode
Expand Down
1 change: 0 additions & 1 deletion front/queries/projectcalico/IPPoolTable.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ query ProjectcalicoIPPools {
mode
}
ipipMode
nat-outgoing
natOutgoing
nodeSelector
vxlanMode
Expand Down
1 change: 0 additions & 1 deletion front/queries/projectcalico/IPPoolView.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ query ProjectcalicoIPPool($name: String!) {
mode
}
ipipMode
nat-outgoing
natOutgoing
nodeSelector
vxlanMode
Expand Down

0 comments on commit 451deb8

Please sign in to comment.