Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
a3014deb
Commit
a3014deb
authored
May 16, 2019
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added table component for files listing
Part of
https://gitlab.com/gitlab-org/gitlab-ce/issues/61578
parent
80130930
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
163 additions
and
12 deletions
+163
-12
app/assets/javascripts/repository/components/table/header.vue
...assets/javascripts/repository/components/table/header.vue
+9
-0
app/assets/javascripts/repository/components/table/index.vue
app/assets/javascripts/repository/components/table/index.vue
+65
-0
app/assets/javascripts/repository/graphql.js
app/assets/javascripts/repository/graphql.js
+7
-1
app/assets/javascripts/repository/mixins/get_ref.js
app/assets/javascripts/repository/mixins/get_ref.js
+14
-0
app/assets/javascripts/repository/pages/index.vue
app/assets/javascripts/repository/pages/index.vue
+4
-10
app/assets/javascripts/repository/pages/tree.vue
app/assets/javascripts/repository/pages/tree.vue
+6
-1
app/assets/javascripts/repository/queries/getFiles.graphql
app/assets/javascripts/repository/queries/getFiles.graphql
+8
-0
locale/gitlab.pot
locale/gitlab.pot
+3
-0
spec/frontend/repository/components/table/index_spec.js
spec/frontend/repository/components/table/index_spec.js
+47
-0
No files found.
app/assets/javascripts/repository/components/table/header.vue
0 → 100644
View file @
a3014deb
<
template
>
<thead>
<tr>
<th
id=
"name"
scope=
"col"
>
{{
s__
(
'
ProjectFileTree|Name
'
)
}}
</th>
<th
id=
"last-commit"
scope=
"col"
class=
"d-none d-sm-table-cell"
>
{{
__
(
'
Last commit
'
)
}}
</th>
<th
id=
"last-update"
scope=
"col"
class=
"text-right"
>
{{
__
(
'
Last update
'
)
}}
</th>
</tr>
</thead>
</
template
>
app/assets/javascripts/repository/components/table/index.vue
0 → 100644
View file @
a3014deb
<
script
>
import
{
GlLoadingIcon
}
from
'
@gitlab/ui
'
;
import
{
sprintf
,
__
}
from
'
../../../locale
'
;
import
getRefMixin
from
'
../../mixins/get_ref
'
;
import
getFiles
from
'
../../queries/getFiles.graphql
'
;
import
TableHeader
from
'
./header.vue
'
;
export
default
{
components
:
{
GlLoadingIcon
,
TableHeader
,
},
mixins
:
[
getRefMixin
],
apollo
:
{
files
:
{
query
:
getFiles
,
variables
()
{
return
{
ref
:
this
.
ref
,
path
:
this
.
path
,
};
},
},
},
props
:
{
path
:
{
type
:
String
,
required
:
true
,
},
},
data
()
{
return
{
files
:
[],
};
},
computed
:
{
tableCaption
()
{
return
sprintf
(
__
(
'
Files, directories, and submodules in the path %{path} for commit reference %{ref}
'
),
{
path
:
this
.
path
,
ref
:
this
.
ref
},
);
},
isLoadingFiles
()
{
return
this
.
$apollo
.
queries
.
files
.
loading
;
},
},
};
</
script
>
<
template
>
<div
class=
"tree-content-holder"
>
<div
class=
"table-holder bordered-box"
>
<table
class=
"table tree-table qa-file-tree"
aria-live=
"polite"
>
<caption
class=
"sr-only"
>
{{
tableCaption
}}
</caption>
<table-header
/>
<tbody></tbody>
</table>
<gl-loading-icon
v-if=
"isLoadingFiles"
class=
"my-3"
size=
"md"
/>
</div>
</div>
</
template
>
app/assets/javascripts/repository/graphql.js
View file @
a3014deb
...
@@ -4,7 +4,13 @@ import createDefaultClient from '~/lib/graphql';
...
@@ -4,7 +4,13 @@ import createDefaultClient from '~/lib/graphql';
Vue
.
use
(
VueApollo
);
Vue
.
use
(
VueApollo
);
const
defaultClient
=
createDefaultClient
({});
const
defaultClient
=
createDefaultClient
({
Query
:
{
files
()
{
return
[];
},
},
});
export
default
new
VueApollo
({
export
default
new
VueApollo
({
defaultClient
,
defaultClient
,
...
...
app/assets/javascripts/repository/mixins/get_ref.js
0 → 100644
View file @
a3014deb
import
getRef
from
'
../queries/getRef.graphql
'
;
export
default
{
apollo
:
{
ref
:
{
query
:
getRef
,
},
},
data
()
{
return
{
ref
:
''
,
};
},
};
app/assets/javascripts/repository/pages/index.vue
View file @
a3014deb
<
script
>
<
script
>
import
getRef
from
'
../queries/getRef.graphql
'
;
import
FileTable
from
'
../components/table/index.vue
'
;
export
default
{
export
default
{
apollo
:
{
components
:
{
ref
:
{
FileTable
,
query
:
getRef
,
},
},
},
data
()
{
data
()
{
return
{
return
{
...
@@ -16,9 +14,5 @@ export default {
...
@@ -16,9 +14,5 @@ export default {
</
script
>
</
script
>
<
template
>
<
template
>
<div>
<file-table
path=
"/"
/>
<router-link
:to=
"
{ path: `/tree/${ref}/app` }">
Go to tree
</router-link>
</div>
</
template
>
</
template
>
app/assets/javascripts/repository/pages/tree.vue
View file @
a3014deb
<
script
>
<
script
>
import
FileTable
from
'
../components/table/index.vue
'
;
export
default
{
export
default
{
component
:
{
FileTable
,
},
props
:
{
props
:
{
path
:
{
path
:
{
type
:
String
,
type
:
String
,
...
@@ -11,5 +16,5 @@ export default {
...
@@ -11,5 +16,5 @@ export default {
</
script
>
</
script
>
<
template
>
<
template
>
<
div>
{{
path
}}
</div
>
<
file-table
:path=
"path"
/
>
</
template
>
</
template
>
app/assets/javascripts/repository/queries/getFiles.graphql
0 → 100644
View file @
a3014deb
query
getFiles
(
$path
:
String
!,
$ref
:
String
!)
{
files
(
path
:
$path
,
ref
:
$ref
)
@client
{
id
name
fullPath
type
}
}
locale/gitlab.pot
View file @
a3014deb
...
@@ -4327,6 +4327,9 @@ msgstr ""
...
@@ -4327,6 +4327,9 @@ msgstr ""
msgid "Files"
msgid "Files"
msgstr ""
msgstr ""
msgid "Files, directories, and submodules in the path %{path} for commit reference %{ref}"
msgstr ""
msgid "Filter"
msgid "Filter"
msgstr ""
msgstr ""
...
...
spec/frontend/repository/components/table/index_spec.js
0 → 100644
View file @
a3014deb
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
GlLoadingIcon
}
from
'
@gitlab/ui
'
;
import
Table
from
'
~/repository/components/table/index.vue
'
;
let
vm
;
function
factory
(
path
,
loading
=
false
)
{
vm
=
shallowMount
(
Table
,
{
propsData
:
{
path
,
},
mocks
:
{
$apollo
:
{
queries
:
{
files
:
{
loading
},
},
},
},
});
}
describe
(
'
Repository table component
'
,
()
=>
{
afterEach
(()
=>
{
vm
.
destroy
();
});
it
.
each
`
path | ref
${
'
/
'
}
|
${
'
master
'
}
${
'
app/assets
'
}
|
${
'
master
'
}
${
'
/
'
}
|
${
'
test
'
}
`
(
'
renders table caption for $ref in $path
'
,
({
path
,
ref
})
=>
{
factory
(
path
);
vm
.
setData
({
ref
});
expect
(
vm
.
find
(
'
caption
'
).
text
()).
toEqual
(
`Files, directories, and submodules in the path
${
path
}
for commit reference
${
ref
}
`
,
);
});
it
(
'
renders loading icon
'
,
()
=>
{
factory
(
'
/
'
,
true
);
expect
(
vm
.
find
(
GlLoadingIcon
).
exists
()).
toBe
(
true
);
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment