Skip to content
Snippets Groups Projects
Commit ffa272af authored by L. Ellenbeck's avatar L. Ellenbeck
Browse files

Merge branch 'Topic/1689-FixLintingIssues' into 'Topic/1689-DisplayAllocatedQuotaForAdminPage'

Topic/1689 fix linting issues

See merge request !9
parents 69d5ae8b 8203f112
No related branches found
No related tags found
2 merge requests!9Topic/1689 fix linting issues,!8Topic/1689 display allocated quota for admin page
Pipeline #543519 passed
module.exports = {
root: true,
env: {
node: true,
},
extends: [
"plugin:vue/essential",
"eslint:recommended",
"@vue/typescript/recommended",
"@vue/prettier",
"@vue/prettier/@typescript-eslint",
],
parserOptions: {
ecmaVersion: 2020,
},
rules: {
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
},
};
......@@ -3,7 +3,7 @@
<b-row>
<div class="col-sm-8">
<div>
<h4>{{ $t('headline') }}</h4>
<h4>{{ $t("headline") }}</h4>
</div>
</div>
</b-row>
......@@ -17,41 +17,61 @@
ref="projectId"
v-model="form.projectId"
aria-describedby="projectHelp"
:placeholder="$t('projectInputTooltip')">
:placeholder="$t('projectInputTooltip')"
>
</b-form-input>
<b-input-group-append>
<b-button variant="primary" id="query_project_button" @click="queryProject()">{{ $t('projectSelectButton') }}</b-button>
<b-button
variant="primary"
id="query_project_button"
@click="queryProject()"
>{{ $t("projectSelectButton") }}</b-button
>
</b-input-group-append>
</b-input-group>
</b-form>
<h5 id='project_query_status'>{{ requestStatus }}</h5>
<h5 id="project_query_status">{{ requestStatus }}</h5>
<b-container fluid>
<b-row class="my-1">
<b-col sm="2">
<label for="project_name">{{ $t('projectName') }}</label>
<label for="project_name">{{ $t("projectName") }}</label>
</b-col>
<b-col sm="10">
<b-form-input id="project_name" v-model="form.projectName" :readonly="true"></b-form-input>
<b-form-input
id="project_name"
v-model="form.projectName"
:readonly="true"
></b-form-input>
</b-col>
</b-row>
<b-row class="my-1">
<b-col sm="2">
<label for="project_short_name">{{ $t('projectShortName') }}</label>
<label for="project_short_name">{{
$t("projectShortName")
}}</label>
</b-col>
<b-col sm="10">
<b-form-input id="project_short_name" v-model="form.projectShortName" :readonly="true"></b-form-input>
<b-form-input
id="project_short_name"
v-model="form.projectShortName"
:readonly="true"
></b-form-input>
</b-col>
</b-row>
<b-row class="my-1">
<b-col sm="2">
<label for="project_guid">{{ $t('projectGuid') }}</label>
<label for="project_guid">{{ $t("projectGuid") }}</label>
</b-col>
<b-col sm="10">
<b-form-input id="project_guid" v-model="form.projectGuid" :readonly="true"></b-form-input>
<b-form-input
id="project_guid"
v-model="form.projectGuid"
:readonly="true"
></b-form-input>
</b-col>
</b-row>
</b-container>
<h5 style="text-align: left;">{{ $t('projectQuotaHeadline') }}:</h5>
<h5 style="text-align: left">{{ $t("projectQuotaHeadline") }}:</h5>
<b-table
id="project_qouta_table"
:fields="headers"
......@@ -70,17 +90,25 @@
bordered
outlined
hover
head-variant="dark">
head-variant="dark"
>
<template #cell(newQuota)="row">
<b-form-input
id="data"
v-model="row.item.newQuota"
aria-describedby="projectHelp"
:placeholder="$t('newQuotaInputPlaceHolder')">
:placeholder="$t('newQuotaInputPlaceHolder')"
>
</b-form-input>
</template>
<template #cell(action)="row">
<button id=action v-on:click.stop.prevent="saveNewQuota(row.item)" class="btn btn-primary float-right">{{ $t('save') }}</button>
<button
id="action"
v-on:click.stop.prevent="saveNewQuota(row.item)"
class="btn btn-primary float-right"
>
{{ $t("save") }}
</button>
</template>
</b-table>
</div>
......@@ -89,57 +117,56 @@
</template>
<script lang="ts">
import Vue from 'vue';
import { GuidUtil } from '@coscine/app-util';
import { AdminApi } from '@coscine/api-connection';
import { ToastPlugin } from 'bootstrap-vue';
import { error } from 'jquery';
import Vue from "vue";
import { GuidUtil } from "@coscine/app-util";
import { AdminApi } from "@coscine/api-connection";
import { ToastPlugin } from "bootstrap-vue";
import { error } from "jquery";
Vue.use(ToastPlugin);
export default Vue.extend({
name: 'supportadmin',
components: {
},
name: "supportadmin",
components: {},
data() {
return {
requestStatus: this.$t('projectNotSelected'),
requestStatus: this.$t("projectNotSelected"),
form: {
projectId: '',
projectName: '',
projectShortName: '',
projectGuid: '',
projectId: "",
projectName: "",
projectShortName: "",
projectGuid: "",
},
projectQuotas: [] as any,
filter: String,
busy: false,
emptyText: 'No Quotas',
sortBy: 'resourceType',
emptyText: "No Quotas",
sortBy: "resourceType",
sortDesc: false,
filteredRows: 0,
headers: [
{
label: this.$t('resourceType'),
key: 'resourceType',
label: this.$t("resourceType"),
key: "resourceType",
sortable: true,
},
{
label: this.$t('currentQuota'),
key: 'currentQuota',
label: this.$t("currentQuota"),
key: "currentQuota",
sortable: true,
},
{
label: this.$t('allocatedQuota'),
key: 'allocatedQuota',
label: this.$t("allocatedQuota"),
key: "allocatedQuota",
sortable: true,
},
{
label: this.$t('newQuota'),
key: 'newQuota',
label: this.$t("newQuota"),
key: "newQuota",
sortable: true,
},
{
label: this.$t('action'),
key: 'action',
label: this.$t("action"),
key: "action",
sortable: true,
},
],
......@@ -147,42 +174,51 @@ export default Vue.extend({
},
methods: {
getProjectQuotas() {
AdminApi.GetProject(this.form.projectId,
AdminApi.GetProject(
this.form.projectId,
(response: any) => {
this.clearResults('');
this.clearResults("");
if (response.data.guid) {
this.requestStatus = this.$t('projectFound');
this.requestStatus = this.$t("projectFound");
this.form.projectName = response.data.name;
this.form.projectShortName = response.data.shortName;
this.form.projectGuid = response.data.guid;
const quotas = response.data.quotas;
for (const d of quotas) {
this.projectQuotas.push({quotaId: d.quotaId, resourceType: d.resourceType, currentQuota: d.quota, allocatedQuota: d.allocated});
this.projectQuotas.push({
quotaId: d.quotaId,
resourceType: d.resourceType,
currentQuota: d.quota,
allocatedQuota: d.allocated,
});
}
} else {
this.clearResults('projectNotFound');
this.clearResults("projectNotFound");
}
},
(errorState: any) => {
const message = this.$t('queryProjectFailureText').toString();
this.makeToast(message, this.$t('queryProjectFailureHeadline').toString());
},
const message = this.$t("queryProjectFailureText").toString();
this.makeToast(
message,
this.$t("queryProjectFailureHeadline").toString()
);
}
);
},
queryProject() {
// if the field is empty:
if (!this.form.projectId.trim()) {
this.clearResults('projectNotSelected');
this.clearResults("projectNotSelected");
} else {
this.getProjectQuotas();
}
},
saveNewQuota(selectedQuota: any) {
let message: string = '' + this.$t('successNotificationText');
message = message.replace('{projectName}', this.form.projectShortName);
message = message.replace('{resourceType}', selectedQuota.resourceType);
let message: string = "" + this.$t("successNotificationText");
message = message.replace("{projectName}", this.form.projectShortName);
message = message.replace("{resourceType}", selectedQuota.resourceType);
if (selectedQuota.newQuota) {
message = message.replace('{newQuota}', '' + selectedQuota.newQuota);
message = message.replace("{newQuota}", "" + selectedQuota.newQuota);
}
const updatedQuota = {
......@@ -191,39 +227,42 @@ export default Vue.extend({
};
if (updatedQuota.quota) {
AdminApi.UpdateQuota(updatedQuota,
AdminApi.UpdateQuota(
updatedQuota,
(response: any) => {
this.makeToast(message, this.$t('successNotificationHeadline').toString());
this.makeToast(
message,
this.$t("successNotificationHeadline").toString()
);
this.getProjectQuotas();
},
(errorState: any) => {
message = this.$t('failureNotificationText').toString();
this.makeToast(message, this.$t('failureNotificationHeadline').toString());
},
message = this.$t("failureNotificationText").toString();
this.makeToast(
message,
this.$t("failureNotificationHeadline").toString()
);
}
);
}
},
clearResults(headline: string) {
this.requestStatus = this.$t(headline);
this.projectQuotas = [];
this.form.projectName = '';
this.form.projectShortName = '';
this.form.projectGuid = '';
this.form.projectName = "";
this.form.projectShortName = "";
this.form.projectGuid = "";
},
makeToast(text: string = 'Message', givenTitle: string = 'Title') {
this.$bvToast.toast(
text,
{
makeToast(text = "Message", givenTitle = "Title") {
this.$bvToast.toast(text, {
title: givenTitle,
autoHideDelay: 5000,
toaster: 'b-toaster-bottom-right',
toaster: "b-toaster-bottom-right",
noCloseButton: true,
},
);
});
},
},
});
</script>
<style scoped>
h5 {
......
declare var coscine: {
declare let coscine: {
i18n: {
supportadmin: {},
},
supportadmin: VueI18n.LocaleMessages | undefined;
};
};
import jQuery from 'jquery';
import BootstrapVue from 'bootstrap-vue';
import Vue from 'vue';
import SupportAdmin from './SupportAdminApp.vue';
import VueI18n from 'vue-i18n';
import { LanguageUtil } from '@coscine/app-util';
import jQuery from "jquery";
import BootstrapVue from "bootstrap-vue";
import Vue from "vue";
import SupportAdmin from "./SupportAdminApp.vue";
import VueI18n from "vue-i18n";
import { LanguageUtil } from "@coscine/app-util";
Vue.config.productionTip = false;
Vue.use(BootstrapVue);
......@@ -21,5 +19,5 @@ jQuery(() => {
new Vue({
render: (h) => h(SupportAdmin),
i18n,
}).$mount('supportadmin');
}).$mount("supportadmin");
});
import Vue, { VNode } from 'vue';
import Vue, { VNode } from "vue";
declare global {
namespace JSX {
......
declare module '*.vue' {
import Vue from 'vue';
declare module "*.vue" {
import Vue from "vue";
export default Vue;
}
declare module '@coscine/api-connection';
declare module '@coscine/app-util';
declare module '@coscine/component-library';
declare module "@coscine/api-connection";
declare module "@coscine/app-util";
declare module "@coscine/component-library";
......@@ -2,18 +2,18 @@ module.exports = {
devServer: {
disableHostCheck: true,
},
publicPath: './',
publicPath: "./",
configureWebpack: {
devtool: 'source-map',
devtool: "source-map",
devServer: {
port: 9369,
}
},
},
filenameHashing: false,
chainWebpack: config => {
config.optimization.delete('splitChunks')
chainWebpack: (config) => {
config.optimization.delete("splitChunks");
},
css: {
extract: false,
},
}
\ No newline at end of file
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment