Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ada74b88
authored
Feb 05, 2013
by
Dányi Bence
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
store: quota ui improved
parent
81145047
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
8 deletions
+34
-8
one/static/cloud.js
+34
-8
No files found.
one/static/cloud.js
View file @
ada74b88
...
@@ -268,8 +268,10 @@ $(function() {
...
@@ -268,8 +268,10 @@ $(function() {
if
(
tests
.
progress
)
{
if
(
tests
.
progress
)
{
$
(
'#upload-zone'
).
hide
();
$
(
'#upload-zone'
).
hide
();
$
(
'#upload-progress-text'
).
show
();
$
(
'#upload-progress-text'
).
show
();
var
originalUsedQuota
=
self
.
quota
.
rawUsed
();
xhr
.
upload
.
onprogress
=
function
(
event
)
{
xhr
.
upload
.
onprogress
=
function
(
event
)
{
if
(
event
.
lengthComputable
)
{
if
(
event
.
lengthComputable
)
{
self
.
quota
.
rawUsed
(
originalUsedQuota
+
parseInt
(
event
.
loaded
/
1024
));
var
complete
=
(
event
.
loaded
/
event
.
total
*
100
|
0
);
var
complete
=
(
event
.
loaded
/
event
.
total
*
100
|
0
);
//progress.value = progress.innerHTML = complete;
//progress.value = progress.innerHTML = complete;
self
.
uploadProgress
(
parseInt
(
complete
)
+
'%'
);
self
.
uploadProgress
(
parseInt
(
complete
)
+
'%'
);
...
@@ -303,15 +305,39 @@ $(function() {
...
@@ -303,15 +305,39 @@ $(function() {
return
false
;
return
false
;
});
});
self
.
quota
=
{
self
.
quota
=
{
u
sed
:
ko
.
observable
(),
rawU
sed
:
ko
.
observable
(),
s
oft
:
ko
.
observable
(),
rawS
oft
:
ko
.
observable
(),
h
ard
:
ko
.
observable
()
rawH
ard
:
ko
.
observable
()
};
};
self
.
quota
.
used
=
ko
.
computed
(
function
(){
var
suffix
=
'KB MB GB'
.
split
(
' '
);
var
l
=
self
.
quota
.
rawUsed
();
for
(
var
i
=
0
;
l
>
1024
;
i
++
)
{
l
/=
1024
;
}
return
l
.
toFixed
(
1
)
+
' '
+
suffix
[
i
];
});
self
.
quota
.
hard
=
ko
.
computed
(
function
(){
var
suffix
=
'KB MB GB'
.
split
(
' '
);
var
l
=
self
.
quota
.
rawHard
();
for
(
var
i
=
0
;
l
>
1024
;
i
++
)
{
l
/=
1024
;
}
return
l
.
toFixed
(
1
)
+
' '
+
suffix
[
i
];
});
self
.
quota
.
soft
=
ko
.
computed
(
function
(){
var
suffix
=
'KB MB GB'
.
split
(
' '
);
var
l
=
self
.
quota
.
rawSoft
();
for
(
var
i
=
0
;
l
>
1024
;
i
++
)
{
l
/=
1024
;
}
return
l
.
toFixed
(
1
)
+
' '
+
suffix
[
i
];
});
self
.
quota
.
usedBar
=
ko
.
computed
(
function
()
{
self
.
quota
.
usedBar
=
ko
.
computed
(
function
()
{
return
(
self
.
quota
.
used
()
/
self
.
quota
.
h
ard
()
*
100
).
toFixed
(
0
)
+
'%'
;
return
(
self
.
quota
.
rawUsed
()
/
self
.
quota
.
rawH
ard
()
*
100
).
toFixed
(
0
)
+
'%'
;
},
self
);
},
self
);
self
.
quota
.
softPos
=
ko
.
computed
(
function
()
{
self
.
quota
.
softPos
=
ko
.
computed
(
function
()
{
return
(
self
.
quota
.
soft
()
/
self
.
quota
.
h
ard
()
*
100
).
toFixed
(
0
)
+
'%'
;
return
(
self
.
quota
.
rawSoft
()
/
self
.
quota
.
rawH
ard
()
*
100
).
toFixed
(
0
)
+
'%'
;
},
self
)
},
self
)
function
refreshQuota
()
{
function
refreshQuota
()
{
...
@@ -320,9 +346,9 @@ $(function() {
...
@@ -320,9 +346,9 @@ $(function() {
'url'
:
'/ajax/store/quota'
,
'url'
:
'/ajax/store/quota'
,
dataType
:
'json'
,
dataType
:
'json'
,
success
:
function
(
data
)
{
success
:
function
(
data
)
{
self
.
quota
.
u
sed
(
parseInt
(
data
.
Used
));
self
.
quota
.
rawU
sed
(
parseInt
(
data
.
Used
));
self
.
quota
.
s
oft
(
parseInt
(
data
.
Soft
));
self
.
quota
.
rawS
oft
(
parseInt
(
data
.
Soft
));
self
.
quota
.
h
ard
(
parseInt
(
data
.
Hard
));
self
.
quota
.
rawH
ard
(
parseInt
(
data
.
Hard
));
}
}
})
})
}
}
...
...
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