Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
tank
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AURA
tank
Commits
d8234561
Commit
d8234561
authored
6 years ago
by
Christian Pointner
Browse files
Options
Downloads
Patches
Plain Diff
creating group works now
parent
b37a0fd8
No related branches found
No related tags found
No related merge requests found
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
api/v1/api_groups.go
+10
-1
10 additions, 1 deletion
api/v1/api_groups.go
cmd/tank/bindata_assetfs.go
+4
-4
4 additions, 4 deletions
cmd/tank/bindata_assetfs.go
cmd/tank/ui/index.html
+29
-2
29 additions, 2 deletions
cmd/tank/ui/index.html
cmd/tank/ui/js/main.js
+39
-0
39 additions, 0 deletions
cmd/tank/ui/js/main.js
with
82 additions
and
7 deletions
api/v1/api_groups.go
+
10
−
1
View file @
d8234561
...
@@ -26,6 +26,8 @@ package v1
...
@@ -26,6 +26,8 @@ package v1
import
(
import
(
"net/http"
"net/http"
"github.com/gorilla/mux"
)
)
func
(
api
*
API
)
ListGroups
()
http
.
Handler
{
func
(
api
*
API
)
ListGroups
()
http
.
Handler
{
...
@@ -42,6 +44,13 @@ func (api *API) ListGroups() http.Handler {
...
@@ -42,6 +44,13 @@ func (api *API) ListGroups() http.Handler {
func
(
api
*
API
)
CreateGroup
()
http
.
Handler
{
func
(
api
*
API
)
CreateGroup
()
http
.
Handler
{
return
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
return
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
sendWebResponse
(
w
,
http
.
StatusNotImplemented
,
ErrorResponse
{
Error
:
"creating groups not yet implemented"
})
// TODO: implement clone depending on query parameter
vars
:=
mux
.
Vars
(
r
)
group
,
err
:=
api
.
store
.
CreateGroup
(
vars
[
"group-id"
])
if
err
!=
nil
{
sendStoreError
(
w
,
err
)
return
}
sendWebResponse
(
w
,
http
.
StatusCreated
,
group
)
})
})
}
}
This diff is collapsed.
Click to expand it.
cmd/tank/bindata_assetfs.go
+
4
−
4
View file @
d8234561
This diff is collapsed.
Click to expand it.
cmd/tank/ui/index.html
+
29
−
2
View file @
d8234561
...
@@ -35,7 +35,9 @@
...
@@ -35,7 +35,9 @@
<div
class=
"col-2"
></div>
<div
class=
"col-2"
></div>
<div
class=
"col-8"
>
<div
class=
"col-8"
>
<div
id=
"error"
>
<div
id=
"error"
>
<div
id=
"error-message"
class=
"alert alert-danger"
role=
"alert"
>
<div
class=
"alert alert-danger alert-dismissible"
role=
"alert"
>
<span
id=
"error-message"
></span>
<button
type=
"button"
class=
"close"
data-dismiss=
"alert"
><span
>
×
</span></button>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -54,7 +56,7 @@
...
@@ -54,7 +56,7 @@
<button
disabled=
"disabled"
type=
"button"
class=
"btn btn-outline-secondary groupClone"
>
Clone
</button>
<button
disabled=
"disabled"
type=
"button"
class=
"btn btn-outline-secondary groupClone"
>
Clone
</button>
<button
type=
"button"
class=
"btn btn-outline-secondary dropdown-toggle"
data-toggle=
"dropdown"
></button>
<button
type=
"button"
class=
"btn btn-outline-secondary dropdown-toggle"
data-toggle=
"dropdown"
></button>
<div
class=
"dropdown-menu"
>
<div
class=
"dropdown-menu"
>
<button
type=
"button"
class=
"dropdown-item
groupNew"
>
New Group
</button>
<button
type=
"button"
class=
"dropdown-item
"
data-toggle=
"modal"
data-target=
"#
groupNew
Modal
"
>
New Group
</button>
<div
role=
"separator"
class=
"dropdown-divider"
></div>
<div
role=
"separator"
class=
"dropdown-divider"
></div>
<button
type=
"button"
class=
"dropdown-item disabled groupAddFile"
>
Add File
</button>
<button
type=
"button"
class=
"dropdown-item disabled groupAddFile"
>
Add File
</button>
<button
type=
"button"
class=
"dropdown-item disabled groupAddPlaylist"
>
Add Playlist
</button>
<button
type=
"button"
class=
"dropdown-item disabled groupAddPlaylist"
>
Add Playlist
</button>
...
@@ -147,7 +149,32 @@
...
@@ -147,7 +149,32 @@
</td>
</td>
</tr>
</tr>
</table>
</table>
</div>
<!-- Modals -->
<div
class=
"modal fade"
id=
"groupNewModal"
tabindex=
"-1"
role=
"dialog"
>
<div
class=
"modal-dialog modal-dialog-centered"
role=
"document"
>
<div
class=
"modal-content"
>
<form
id=
"groupNewForm"
>
<div
class=
"modal-header"
>
<h5
class=
"modal-title"
>
New group
</h5>
<a
class=
"close"
data-dismiss=
"modal"
><span>
×
</span></a>
</div>
<div
class=
"modal-body"
>
<form>
<div
class=
"form-group"
>
<label
for=
"recipient-name"
class=
"col-form-label"
>
Name:
</label>
<input
type=
"text"
class=
"form-control"
id=
"groupNewName"
>
</div>
</form>
</div>
<div
class=
"modal-footer"
>
<button
type=
"button"
class=
"btn btn-secondary"
data-dismiss=
"modal"
>
Cancel
</button>
<button
type=
"button"
class=
"btn btn-primary groupNew"
disabled=
"disabled"
data-dismiss=
"modal"
>
Create Group
</button>
</div>
</form>
</div>
</div>
</div>
</div>
<script
src=
"js/jquery.min.js"
></script>
<script
src=
"js/jquery.min.js"
></script>
...
...
This diff is collapsed.
Click to expand it.
cmd/tank/ui/js/main.js
+
39
−
0
View file @
d8234561
...
@@ -61,6 +61,23 @@ main.GroupList.prototype.fetch = function() {
...
@@ -61,6 +61,23 @@ main.GroupList.prototype.fetch = function() {
});
});
};
};
main
.
GroupList
.
prototype
.
new_group
=
function
(
group_name
)
{
var
self
=
this
;
$
.
ajax
({
method
:
"
POST
"
,
url
:
"
/api/v1/groups/
"
+
group_name
,
success
:
function
(
data
)
{
self
.
fetch
()
},
dataType
:
"
json
"
}).
fail
(
function
(
jqxhr
,
textStatus
,
error
)
{
if
(
error
==
""
)
{
self
.
error
(
"
connection problem
"
);
}
else
{
self
.
error
(
jqxhr
.
responseJSON
.
error
);
}
});
}
/****** group ******/
/****** group ******/
var
group
=
null
;
var
group
=
null
;
...
@@ -328,10 +345,32 @@ main.PlaylistView.prototype.render = function() {
...
@@ -328,10 +345,32 @@ main.PlaylistView.prototype.render = function() {
/***************** controller *****************/
/***************** controller *****************/
function
modal_group_new_init
()
{
$
(
'
#groupNewModal
'
).
on
(
'
show.bs.modal
'
,
function
(
event
)
{
var
groupNewName
=
$
(
this
).
find
(
'
#groupNewName
'
);
groupNewName
.
val
(
""
);
groupNewName
.
on
(
'
keyup
'
,
function
()
{
if
(
groupNewName
.
val
().
length
==
0
)
{
groupNewBtn
.
prop
(
'
disabled
'
,
true
)
}
else
{
groupNewBtn
.
prop
(
'
disabled
'
,
false
)
}
});
var
groupNewBtn
=
$
(
this
).
find
(
'
button.groupNew
'
);
groupNewBtn
.
prop
(
'
disabled
'
,
true
)
groupNewBtn
.
on
(
'
click
'
,
function
()
{
groups
.
new_group
(
groupNewName
.
val
());
});
$
(
this
).
find
(
'
#groupNewForm
'
).
on
(
'
submit
'
,
function
()
{
groupNewBtn
.
trigger
(
'
click
'
);
return
false
;
});
});
}
function
main_init
()
{
function
main_init
()
{
groups
=
new
main
.
GroupList
();
groups
=
new
main
.
GroupList
();
groupListView
=
new
main
.
GroupListView
(
groups
);
groupListView
=
new
main
.
GroupListView
(
groups
);
modal_group_new_init
();
groups
.
fetch
();
groups
.
fetch
();
$
(
'
#groupSelect
'
).
on
(
'
change
'
,
function
(
event
)
{
$
(
'
#groupSelect
'
).
on
(
'
change
'
,
function
(
event
)
{
var
group_name
=
event
.
target
.
value
;
var
group_name
=
event
.
target
.
value
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment