Better restrictions

This commit is contained in:
Douglas Barone 2022-08-29 13:19:38 -04:00
parent caa958b34a
commit 60a0e793ac

View File

@ -14,7 +14,13 @@
</v-btn>
</v-toolbar>
<v-progress-linear class="mb-4" :indeterminate="loading || !accessPoint" />
<v-card v-if="accessPoint" :elevation="0" class="ma-2" :disabled="loading">
<v-form :disabled="!userInSameCampus">
<v-card
v-if="accessPoint"
:elevation="0"
class="ma-2"
:disabled="loading"
>
<v-text-field
v-model="name"
label="Nome"
@ -30,7 +36,7 @@
clearable
/>
<v-textarea v-model="notes" label="Observações" outlined clearable />
<v-card-actions>
<v-card-actions v-if="userInSameCampus">
<v-btn color="error darken-1" icon @click="onDeleteAccessPoint">
<v-icon>mdi-delete</v-icon>
</v-btn>
@ -45,10 +51,16 @@
Cancelar
</v-btn>
</v-card-actions>
<v-card-actions v-else>
<v-alert color="info" outlined icon="mdi-information">
Você pode alterar APs do seu campus.
</v-alert>
</v-card-actions>
<v-alert v-for="error in errors" :key="error" class="mt-4" type="error">
{{ error }}
</v-alert>
</v-card>
</v-form>
</v-navigation-drawer>
</template>
@ -148,7 +160,22 @@ Continuar?`
}
}
},
computed: {
userInSameCampus() {
return this.me.campus == this.accessPoint.subnetInfo.shortName
}
},
apollo: {
me: {
cachePolicy: 'cache-and-network',
query: gql`
{
me {
campus
}
}
`
},
accessPoint: {
cachePolicy: 'cache-and-network',
query: gql`
@ -161,6 +188,10 @@ Continuar?`
mac
local
notes
subnetInfo {
shortName
}
}
}
`,