Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SupportAdmin
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Coscine
frontend
apps
SupportAdmin
Merge requests
!8
Topic/1689 display allocated quota for admin page
Code
Review changes
Check out branch
Open in Workspace
Download
Patches
Plain diff
Expand sidebar
Merged
Topic/1689 display allocated quota for admin page
Topic/1689-DisplayAllocatedQuotaForAdminPage
into
Product/1623-allocatedQuotaForAdmin
Overview
0
Commits
4
Pipelines
4
Changes
8
Merged
Topic/1689 display allocated quota for admin page
Kimia Beheshti
requested to merge
Topic/1689-DisplayAllocatedQuotaForAdminPage
into
Product/1623-allocatedQuotaForAdmin
Sep 1, 2021
Overview
0
Commits
4
Pipelines
4
Changes
8
coscine/issues#1689
0
0
Merge request reports
Compare
Product/1623-allocatedQuotaForAdmin
version 2
69d5ae8b
Sep 7, 2021
version 1
e53dc3f4
Sep 1, 2021
Product/1623-allocatedQuotaForAdmin (base)
and
latest version
latest version
ffa272af
4 commits,
Sep 8, 2021
version 2
69d5ae8b
2 commits,
Sep 7, 2021
version 1
e53dc3f4
1 commit,
Sep 1, 2021
8 files
+
263
−
185
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
8
src/SupportAdminApp.vue
+
185
−
141
View file @ ffa272af
Edit in single-file editor
Open in Web IDE
Show full file
<
template
>
<div
id=
"SupportAdmin"
class=
"container"
>
<b-row>
<div
class=
"col-sm-8"
>
<div>
<h4>
{{
$t
(
'
headline
'
)
}}
</h4>
</div>
<div
id=
"SupportAdmin"
class=
"container"
>
<b-row>
<div
class=
"col-sm-8"
>
<div>
<h4>
{{
$t
(
"
headline
"
)
}}
</h4>
</div>
</b-row>
<b-row>
<div
class=
"col-sm-2"
></div>
<div
class=
"col-sm-8"
>
<b-form
id=
"project_request_form"
@
submit.stop.prevent=
"onSubmit"
>
<b-input-group
class=
"mt-3"
>
</div>
</b-row>
<b-row>
<div
class=
"col-sm-2"
></div>
<div
class=
"col-sm-8"
>
<b-form
id=
"project_request_form"
@
submit.stop.prevent=
"onSubmit"
>
<b-input-group
class=
"mt-3"
>
<b-form-input
id=
"projectId"
ref=
"projectId"
v-model=
"form.projectId"
aria-describedby=
"projectHelp"
: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-input-group-append>
</b-input-group>
</b-form>
<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>
</b-col>
<b-col
sm=
"10"
>
<b-form-input
id=
"projectId"
ref=
"projectId"
v-model=
"form.projectId"
aria-describedby=
"projectHelp"
: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-input-group-append>
</b-input-group>
</b-form>
<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>
</b-col>
<b-col
sm=
"10"
>
<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>
</b-col>
<b-col
sm=
"10"
>
<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>
</b-col>
<b-col
sm=
"10"
>
<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>
<b-table
id=
"project_qouta_table"
:fields=
"headers"
:items=
"projectQuotas"
:busy=
"busy"
:locale=
"$i18n.locale"
:sort-by.sync=
"sortBy"
:sort-desc.sync=
"sortDesc"
:show-empty=
"true"
:empty-text=
"emptyText"
fixed
sticky-header=
"100%"
no-border-collapse
sort-icon-right
striped
bordered
outlined
hover
head-variant=
"dark"
>
<template
#cell(newQuota)=
"row"
>
<b-form-input
id=
"data"
v-model=
"row.item.newQuota"
aria-describedby=
"projectHelp"
: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>
</
template
>
</b-table>
</div>
</b-row>
</div>
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>
</b-col>
<b-col
sm=
"10"
>
<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>
</b-col>
<b-col
sm=
"10"
>
<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>
<b-table
id=
"project_qouta_table"
:fields=
"headers"
:items=
"projectQuotas"
:busy=
"busy"
:locale=
"$i18n.locale"
:sort-by.sync=
"sortBy"
:sort-desc.sync=
"sortDesc"
:show-empty=
"true"
:empty-text=
"emptyText"
fixed
sticky-header=
"100%"
no-border-collapse
sort-icon-right
striped
bordered
outlined
hover
head-variant=
"dark"
>
<template
#cell(newQuota)=
"row"
>
<b-form-input
id=
"data"
v-model=
"row.item.newQuota"
aria-describedby=
"projectHelp"
: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>
</
template
>
</b-table>
</div>
</b-row>
</div>
</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
"
,
sortable
:
true
,
},
{
label
:
this
.
$t
(
'
current
Quota
'
),
key
:
'
current
Quota
'
,
label
:
this
.
$t
(
"
allocated
Quota
"
),
key
:
"
allocated
Quota
"
,
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
,
},
],
@@ -142,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
});
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
=
{
@@ -186,42 +227,45 @@ 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
,
{
title
:
givenTitle
,
autoHideDelay
:
5000
,
toaster
:
'
b-toaster-bottom-right
'
,
noCloseButton
:
true
,
},
);
makeToast
(
text
=
"
Message
"
,
givenTitle
=
"
Title
"
)
{
this
.
$bvToast
.
toast
(
text
,
{
title
:
givenTitle
,
autoHideDelay
:
5000
,
toaster
:
"
b-toaster-bottom-right
"
,
noCloseButton
:
true
,
});
},
},
});
</
script
>
<
style
scoped
>
h5
{
margin-top
:
0.4em
;
}
</
style
>
\ No newline at end of file
</
style
>
Loading