-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Single service mode #68
Conversation
… is never set by unifile (my PR has never been merged)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pretty difficult to follow :|
src/js/UnifileService.js
Outdated
@@ -299,6 +299,7 @@ export default class UnifileService { | |||
} | |||
|
|||
static isService (file) { | |||
return typeof file.isLoggedIn !== 'undefined'; | |||
console.log('isService', file, file.isLoggedIn); | |||
return typeof file.mime === 'application/json'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
weird, pls comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the console log is a mistake
do you think this is ok for a comment?
this mime type is what the server returns when listing services... and I think it never will be the mime type of any other files
Do you think I should rather add a specific field "isService" to the data returned by the server side?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see a lot of use case when a regular file will have a application/json
MIME type, so yes, it should already be in the data without duck-typing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, so do you think I should re-open this PR?
#50
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see a lot of use case when a regular file will have a application/json MIME type, so yes, it should already be in the data without duck-typing
for a static file this would be strange
if you remember we decided that this would be the mime type of services, which make them apear with an icon of service
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're thinking too much with Silex, not CE. As a developer, my FTP might be full of JSON config files I saved here.
You wouldn't want that to mess up CE
src/js/UnifileService.js
Outdated
@@ -124,9 +124,9 @@ export default class UnifileService { | |||
}); | |||
} | |||
|
|||
cd (path) { | |||
cd (path, preventAuth=false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should add it as a flag a the service
level, around
CloudExplorer2/src/js/UnifileService.js
Line 56 in 958e60e
nameMap.set(service.name, service.displayName); |
service
map should be Map<String, {displayName, requiresAuth}>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in fact some services won't require auth, but this is about another topic here: when CE starts, if the path is "/" it will list services, and if there is only one service we want to cd
into this folder. But without auth because we don't want a popup to be opened and blocked (not in a onclick). What happen here is we cd
the service and if the user is not logged in it will return a 403 forbidden
and we will be back to "/"
The best thing would be to send a isLoggedIn
field with the services, so if the user is loggedin we cd
in it, and when we cd
a service to which we are logged in, CE should not bother opening a popup for auth. I made a PR for that but I think it died forgotten.. Maybe it was wrong :-/
src/js/UnifileService.js
Outdated
return new Promise((resolve, reject) => { | ||
if (path.length === 1 && path[0] !== this.currentPath[0]) { | ||
if (!preventAuth && path.length === 1 && path[0] !== this.currentPath[0]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this check is weird (it was weird already)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah.. it's a way to check if we are opening a service or a folder... we should probably use isService or something
but we don't have the files yet at this level, only the path
any suggestions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could retrieve the service with the path, right? If it's the first part of the path, use the service Map
to get the service and fetch the service auth strategy (I think that's what @clemos was trying to say)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, then that's what path.length === 1
does
src/js/CloudExplorer.jsx
Outdated
@@ -162,6 +162,15 @@ export default class CloudExplorer extends React.Component { | |||
files, | |||
loading: false | |||
}); | |||
// the first display, single service mode, try to enter | |||
// this is useful when CE is used by hosting companies to display the user files, and the user has logged in their system | |||
if(!this.initDone && files.length === 1 && path.length === 0/* && files[0].isLoggedIn === true*/) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think initDone should be part of the component state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but more generally, I don't quite understand this part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes again that's a way to open a service when CE starts, so only the 1st time and if it is "/" which is ls
maybe i should put all this somewhere else...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @clemos
src/js/UnifileService.js
Outdated
return new Promise((resolve, reject) => { | ||
if (path.length === 1 && path[0] !== this.currentPath[0]) { | ||
if (!preventAuth && path.length === 1 && path[0] !== this.currentPath[0]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could retrieve the service with the path, right? If it's the first part of the path, use the service Map
to get the service and fetch the service auth strategy (I think that's what @clemos was trying to say)
src/js/UnifileService.js
Outdated
@@ -299,6 +299,7 @@ export default class UnifileService { | |||
} | |||
|
|||
static isService (file) { | |||
return typeof file.isLoggedIn !== 'undefined'; | |||
console.log('isService', file, file.isLoggedIn); | |||
return typeof file.mime === 'application/json'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see a lot of use case when a regular file will have a application/json
MIME type, so yes, it should already be in the data without duck-typing
Ok so
|
oh there is an old issue about the linter: #45 |
+1
Le 1 sept. 2018 à 14:10, à 14:10, "Clément Charmet" <[email protected]> a écrit:
…clemos commented on this pull request.
> @@ -162,6 +162,18 @@ export default class CloudExplorer extends
React.Component {
files,
loading: false
});
+ // the first display, single service mode, try to enter
+ // this is useful when CE is used by hosting companies to
display the user files, and the user has logged in their system
+ if(!this.initDone && files.length === 1 &&
Oh, and also: fuck pre-commit hooks !!!!!
--
You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub:
#68 (comment)
|
closes #62
it is a simplified version of #62