Better restrictions

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

View File

@ -14,41 +14,53 @@
</v-btn> </v-btn>
</v-toolbar> </v-toolbar>
<v-progress-linear class="mb-4" :indeterminate="loading || !accessPoint" /> <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-text-field <v-card
v-model="name" v-if="accessPoint"
label="Nome" :elevation="0"
hint="Nome amigável ou apelido (opcional)" class="ma-2"
outlined :disabled="loading"
clearable >
/> <v-text-field
<v-text-field v-model="name"
v-model="local" label="Nome"
label="Local" hint="Nome amigável ou apelido (opcional)"
hint="Localização aproximada (opcional)" outlined
outlined clearable
clearable />
/> <v-text-field
<v-textarea v-model="notes" label="Observações" outlined clearable /> v-model="local"
<v-card-actions> label="Local"
<v-btn color="error darken-1" icon @click="onDeleteAccessPoint"> hint="Localização aproximada (opcional)"
<v-icon>mdi-delete</v-icon> outlined
</v-btn> clearable
<v-spacer /> />
<v-btn color="primary" @click="onUpdateAccessPoint"> <v-textarea v-model="notes" label="Observações" outlined clearable />
<v-icon left>mdi-check</v-icon> <v-card-actions v-if="userInSameCampus">
Salvar <v-btn color="error darken-1" icon @click="onDeleteAccessPoint">
</v-btn> <v-icon>mdi-delete</v-icon>
</v-btn>
<v-spacer />
<v-btn color="primary" @click="onUpdateAccessPoint">
<v-icon left>mdi-check</v-icon>
Salvar
</v-btn>
<v-btn color="secondary" text @click="show = false"> <v-btn color="secondary" text @click="show = false">
<v-icon left>mdi-close</v-icon> <v-icon left>mdi-close</v-icon>
Cancelar Cancelar
</v-btn> </v-btn>
</v-card-actions> </v-card-actions>
<v-alert v-for="error in errors" :key="error" class="mt-4" type="error"> <v-card-actions v-else>
{{ error }} <v-alert color="info" outlined icon="mdi-information">
</v-alert> Você pode alterar APs do seu campus.
</v-card> </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> </v-navigation-drawer>
</template> </template>
@ -148,7 +160,22 @@ Continuar?`
} }
} }
}, },
computed: {
userInSameCampus() {
return this.me.campus == this.accessPoint.subnetInfo.shortName
}
},
apollo: { apollo: {
me: {
cachePolicy: 'cache-and-network',
query: gql`
{
me {
campus
}
}
`
},
accessPoint: { accessPoint: {
cachePolicy: 'cache-and-network', cachePolicy: 'cache-and-network',
query: gql` query: gql`
@ -161,6 +188,10 @@ Continuar?`
mac mac
local local
notes notes
subnetInfo {
shortName
}
} }
} }
`, `,