Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
origin-web-common
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Java-于龙
origin-web-common
Commits
c45e3254
Unverified
Commit
c45e3254
authored
Aug 28, 2017
by
benjaminapetersen
Committed by
benjaminapetersen
Sep 18, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add apiService.getPreferredVersion, and constant apiPreferredVersions
parent
2a98c3d5
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
220 additions
and
8 deletions
+220
-8
origin-web-common-services.js
dist/origin-web-common-services.js
+14
-1
origin-web-common-ui.js
dist/origin-web-common-ui.js
+6
-0
origin-web-common.js
dist/origin-web-common.js
+54
-2
origin-web-common.min.js
dist/origin-web-common.min.js
+93
-4
apiPreferredVersions.js
src/constants/apiPreferredVersions.js
+33
-0
preferredVersion.js
src/filters/preferredVersion.js
+6
-0
apiService.js
src/services/apiService.js
+14
-1
No files found.
dist/origin-web-common-services.js
View file @
c45e3254
...
...
@@ -234,6 +234,7 @@ ResourceGroupVersion.prototype.equals = function(resource, group, version) {
angular
.
module
(
'openshiftCommonServices'
)
.
factory
(
'APIService'
,
function
(
API_CFG
,
APIS_CFG
,
API_PREFERRED_VERSIONS
,
AuthService
,
Constants
,
Logger
,
...
...
@@ -532,6 +533,17 @@ angular.module('openshiftCommonServices')
return
includeClusterScoped
?
allKinds
:
namespacedKinds
;
};
// Provides us a way to ensure we consistently use the
// correct {resource, group} for API calls. Version
// will typically fallback to the preferredVersion of the API
var
getPreferredVersion
=
function
(
resource
)
{
var
preferred
=
API_PREFERRED_VERSIONS
[
resource
];
if
(
!
preferred
)
{
Logger
.
log
(
"No preferred version for "
,
resource
);
}
return
preferred
;
};
return
{
toResourceGroupVersion
:
toResourceGroupVersion
,
...
...
@@ -549,7 +561,8 @@ angular.module('openshiftCommonServices')
invalidObjectKindOrVersion
:
invalidObjectKindOrVersion
,
unsupportedObjectKindOrVersion
:
unsupportedObjectKindOrVersion
,
availableKinds
:
availableKinds
availableKinds
:
availableKinds
,
getPreferredVersion
:
getPreferredVersion
};
});
;
'use strict'
;
...
...
dist/origin-web-common-ui.js
View file @
c45e3254
...
...
@@ -1568,6 +1568,12 @@ angular.module('openshiftCommonUI')
;
'use strict'
;
angular
.
module
(
'openshiftCommonUI'
)
.
filter
(
'preferredVersion'
,
function
(
APIService
)
{
return
APIService
.
getPreferredVersion
;
});
;
'use strict'
;
angular
.
module
(
'openshiftCommonUI'
)
.
filter
(
'prettifyJSON'
,
function
(
parseJSONFilter
)
{
return
function
(
json
)
{
var
jsonObj
=
parseJSONFilter
(
json
);
...
...
dist/origin-web-common.js
View file @
c45e3254
...
...
@@ -1421,6 +1421,39 @@ angular.module('openshiftCommonUI')
}]);
;
'use strict'
;
angular
.
module
(
'openshiftCommonServices'
)
.
constant
(
'API_PREFERRED_VERSIONS'
,
{
autoscaling
:
{
group
:
'autoscaling'
,
resource
:
'horizontalpodautoscalers'
},
appliedclusterresourcequotas
:
{
group
:
'quota.openshift.io'
,
resource
:
'appliedclusterresourcequotas'
},
bindings
:
{
group
:
'servicecatalog.k8s.io'
,
resource
:
'bindings'
},
builds
:
{
group
:
'build.openshift.io'
,
resource
:
'builds'
},
buildconfigs
:
{
group
:
'build.openshift.io'
,
resource
:
'buildconfigs'
},
configmaps
:
'configmaps'
,
deployments
:
{
group
:
'apps'
,
resource
:
'deployments'
},
deploymentconfigs
:
{
group
:
'apps.openshift.io'
,
resource
:
'deploymentconfigs'
},
imagestreams
:
{
group
:
'image.openshift.io'
,
resource
:
'imagestreams'
},
imagestreamtags
:
{
group
:
'image.openshift.io'
,
resource
:
'imagestreamtags'
},
instances
:
{
group
:
'servicecatalog.k8s.io'
,
resource
:
'instances'
},
limitranges
:
'limitranges'
,
pods
:
'pods'
,
projects
:
{
group
:
'project.openshift.io'
,
resource
:
'projects'
},
projectrequests
:
{
group
:
'project.openshift.io'
,
resource
:
'projectrequests'
},
persistentvolumeclaims
:
'persistentvolumeclaims'
,
replicasets
:
{
group
:
'extensions'
,
resource
:
'replicasets'
},
replicationcontrollers
:
'replicationcontrollers'
,
resourcequotas
:
'resourcequotas'
,
rolebindings
:
'rolebindings'
,
routes
:
{
group
:
'route.openshift.io'
,
resource
:
'routes'
},
secrets
:
'secrets'
,
selfsubjectrulesreviews
:
{
group
:
'authorization.k8s.io'
,
resource
:
'selfsubjectrulesreviews'
},
services
:
'services'
,
serviceaccounts
:
'serviceaccounts'
,
serviceclasses
:
{
group
:
'servicecatalog.k8s.io'
,
resource
:
'serviceclasses'
},
statefulsets
:
{
group
:
'apps'
,
resource
:
'statefulsets'
},
templates
:
{
group
:
'template.openshift.io'
,
resource
:
'templates'
}
});
;
'use strict'
;
angular
.
module
(
'openshiftCommonUI'
)
.
filter
(
"alertStatus"
,
function
()
{
return
function
(
type
)
{
...
...
@@ -1739,6 +1772,12 @@ angular.module('openshiftCommonUI')
;
'use strict'
;
angular
.
module
(
'openshiftCommonUI'
)
.
filter
(
'preferredVersion'
,
[
"APIService"
,
function
(
APIService
)
{
return
APIService
.
getPreferredVersion
;
}]);
;
'use strict'
;
angular
.
module
(
'openshiftCommonUI'
)
.
filter
(
'prettifyJSON'
,
[
"parseJSONFilter"
,
function
(
parseJSONFilter
)
{
return
function
(
json
)
{
var
jsonObj
=
parseJSONFilter
(
json
);
...
...
@@ -2117,8 +2156,9 @@ ResourceGroupVersion.prototype.equals = function(resource, group, version) {
};
angular
.
module
(
'openshiftCommonServices'
)
.
factory
(
'APIService'
,
[
"API_CFG"
,
"APIS_CFG"
,
"AuthService"
,
"Constants"
,
"Logger"
,
"$q"
,
"$http"
,
"$filter"
,
"$window"
,
function
(
API_CFG
,
.
factory
(
'APIService'
,
[
"API_CFG"
,
"APIS_CFG"
,
"A
PI_PREFERRED_VERSIONS"
,
"A
uthService"
,
"Constants"
,
"Logger"
,
"$q"
,
"$http"
,
"$filter"
,
"$window"
,
function
(
API_CFG
,
APIS_CFG
,
API_PREFERRED_VERSIONS
,
AuthService
,
Constants
,
Logger
,
...
...
@@ -2417,6 +2457,17 @@ angular.module('openshiftCommonServices')
return
includeClusterScoped
?
allKinds
:
namespacedKinds
;
};
// Provides us a way to ensure we consistently use the
// correct {resource, group} for API calls. Version
// will typically fallback to the preferredVersion of the API
var
getPreferredVersion
=
function
(
resource
)
{
var
preferred
=
API_PREFERRED_VERSIONS
[
resource
];
if
(
!
preferred
)
{
Logger
.
log
(
"No preferred version for "
,
resource
);
}
return
preferred
;
};
return
{
toResourceGroupVersion
:
toResourceGroupVersion
,
...
...
@@ -2434,7 +2485,8 @@ angular.module('openshiftCommonServices')
invalidObjectKindOrVersion
:
invalidObjectKindOrVersion
,
unsupportedObjectKindOrVersion
:
unsupportedObjectKindOrVersion
,
availableKinds
:
availableKinds
availableKinds
:
availableKinds
,
getPreferredVersion
:
getPreferredVersion
};
}]);
;
'use strict'
;
...
...
dist/origin-web-common.min.js
View file @
c45e3254
...
...
@@ -485,7 +485,90 @@ content ? (scope.truncatedContent = truncateFilter(content, scope.limit, scope.u
});
}
};
}
]),
angular
.
module
(
"openshiftCommonUI"
).
filter
(
"alertStatus"
,
function
()
{
}
]),
angular
.
module
(
"openshiftCommonServices"
).
constant
(
"API_PREFERRED_VERSIONS"
,
{
autoscaling
:{
group
:
"autoscaling"
,
resource
:
"horizontalpodautoscalers"
},
appliedclusterresourcequotas
:{
group
:
"quota.openshift.io"
,
resource
:
"appliedclusterresourcequotas"
},
bindings
:{
group
:
"servicecatalog.k8s.io"
,
resource
:
"bindings"
},
builds
:{
group
:
"build.openshift.io"
,
resource
:
"builds"
},
buildconfigs
:{
group
:
"build.openshift.io"
,
resource
:
"buildconfigs"
},
configmaps
:
"configmaps"
,
deployments
:{
group
:
"apps"
,
resource
:
"deployments"
},
deploymentconfigs
:{
group
:
"apps.openshift.io"
,
resource
:
"deploymentconfigs"
},
imagestreams
:{
group
:
"image.openshift.io"
,
resource
:
"imagestreams"
},
imagestreamtags
:{
group
:
"image.openshift.io"
,
resource
:
"imagestreamtags"
},
instances
:{
group
:
"servicecatalog.k8s.io"
,
resource
:
"instances"
},
limitranges
:
"limitranges"
,
pods
:
"pods"
,
projects
:{
group
:
"project.openshift.io"
,
resource
:
"projects"
},
projectrequests
:{
group
:
"project.openshift.io"
,
resource
:
"projectrequests"
},
persistentvolumeclaims
:
"persistentvolumeclaims"
,
replicasets
:{
group
:
"extensions"
,
resource
:
"replicasets"
},
replicationcontrollers
:
"replicationcontrollers"
,
resourcequotas
:
"resourcequotas"
,
rolebindings
:
"rolebindings"
,
routes
:{
group
:
"route.openshift.io"
,
resource
:
"routes"
},
secrets
:
"secrets"
,
selfsubjectrulesreviews
:{
group
:
"authorization.k8s.io"
,
resource
:
"selfsubjectrulesreviews"
},
services
:
"services"
,
serviceaccounts
:
"serviceaccounts"
,
serviceclasses
:{
group
:
"servicecatalog.k8s.io"
,
resource
:
"serviceclasses"
},
statefulsets
:{
group
:
"apps"
,
resource
:
"statefulsets"
},
templates
:{
group
:
"template.openshift.io"
,
resource
:
"templates"
}
}),
angular
.
module
(
"openshiftCommonUI"
).
filter
(
"alertStatus"
,
function
()
{
return
function
(
type
)
{
var
status
;
switch
(
type
.
toLowerCase
())
{
...
...
@@ -646,7 +729,9 @@ return "object" == typeof jsonObj ? jsonObj :null;
return
null
;
}
};
}),
angular
.
module
(
"openshiftCommonUI"
).
filter
(
"prettifyJSON"
,
[
"parseJSONFilter"
,
function
(
parseJSONFilter
)
{
}),
angular
.
module
(
"openshiftCommonUI"
).
filter
(
"preferredVersion"
,
[
"APIService"
,
function
(
APIService
)
{
return
APIService
.
getPreferredVersion
;
}
]),
angular
.
module
(
"openshiftCommonUI"
).
filter
(
"prettifyJSON"
,
[
"parseJSONFilter"
,
function
(
parseJSONFilter
)
{
return
function
(
json
)
{
var
jsonObj
=
parseJSONFilter
(
json
);
return
jsonObj
?
JSON
.
stringify
(
jsonObj
,
null
,
4
)
:
json
;
...
...
@@ -816,7 +901,7 @@ var segments = (this.resource || "").split("/");
return
segments
.
shift
(),
segments
;
},
ResourceGroupVersion
.
prototype
.
equals
=
function
(
resource
,
group
,
version
)
{
return
this
.
resource
!==
resource
?
!
1
:
1
===
arguments
.
length
?
!
0
:
this
.
group
!==
group
?
!
1
:
2
===
arguments
.
length
?
!
0
:
this
.
version
!==
version
?
!
1
:
!
0
;
},
angular
.
module
(
"openshiftCommonServices"
).
factory
(
"APIService"
,
[
"API_CFG"
,
"APIS_CFG"
,
"A
uthService"
,
"Constants"
,
"Logger"
,
"$q"
,
"$http"
,
"$filter"
,
"$window"
,
function
(
API_CFG
,
APIS_CFG
,
AuthService
,
Constants
,
Logger
,
$q
,
$http
,
$filter
,
$window
)
{
},
angular
.
module
(
"openshiftCommonServices"
).
factory
(
"APIService"
,
[
"API_CFG"
,
"APIS_CFG"
,
"A
PI_PREFERRED_VERSIONS"
,
"AuthService"
,
"Constants"
,
"Logger"
,
"$q"
,
"$http"
,
"$filter"
,
"$window"
,
function
(
API_CFG
,
APIS_CFG
,
API_PREFERRED_VERSIONS
,
AuthService
,
Constants
,
Logger
,
$q
,
$http
,
$filter
,
$window
)
{
function
normalizeResource
(
resource
)
{
if
(
!
resource
)
return
resource
;
var
i
=
resource
.
indexOf
(
"/"
);
...
...
@@ -947,6 +1032,9 @@ return value.group + "/" + value.kind;
});
},
namespacedKinds
=
calculateAvailableKinds
(
!
1
),
allKinds
=
calculateAvailableKinds
(
!
0
),
availableKinds
=
function
(
includeClusterScoped
)
{
return
includeClusterScoped
?
allKinds
:
namespacedKinds
;
},
getPreferredVersion
=
function
(
resource
)
{
var
preferred
=
API_PREFERRED_VERSIONS
[
resource
];
return
preferred
||
Logger
.
log
(
"No preferred version for "
,
resource
),
preferred
;
};
return
{
toResourceGroupVersion
:
toResourceGroupVersion
,
...
...
@@ -958,7 +1046,8 @@ kindToResourceGroupVersion:kindToResourceGroupVersion,
apiInfo
:
apiInfo
,
invalidObjectKindOrVersion
:
invalidObjectKindOrVersion
,
unsupportedObjectKindOrVersion
:
unsupportedObjectKindOrVersion
,
availableKinds
:
availableKinds
availableKinds
:
availableKinds
,
getPreferredVersion
:
getPreferredVersion
};
}
]),
angular
.
module
(
"openshiftCommonServices"
).
service
(
"ApplicationsService"
,
[
"$q"
,
"DataService"
,
function
(
$q
,
DataService
)
{
var
listStandaloneReplicationControllers
=
function
(
context
)
{
...
...
src/constants/apiPreferredVersions.js
0 → 100644
View file @
c45e3254
'use strict'
;
angular
.
module
(
'openshiftCommonServices'
)
.
constant
(
'API_PREFERRED_VERSIONS'
,
{
autoscaling
:
{
group
:
'autoscaling'
,
resource
:
'horizontalpodautoscalers'
},
appliedclusterresourcequotas
:
{
group
:
'quota.openshift.io'
,
resource
:
'appliedclusterresourcequotas'
},
bindings
:
{
group
:
'servicecatalog.k8s.io'
,
resource
:
'bindings'
},
builds
:
{
group
:
'build.openshift.io'
,
resource
:
'builds'
},
buildconfigs
:
{
group
:
'build.openshift.io'
,
resource
:
'buildconfigs'
},
configmaps
:
'configmaps'
,
deployments
:
{
group
:
'apps'
,
resource
:
'deployments'
},
deploymentconfigs
:
{
group
:
'apps.openshift.io'
,
resource
:
'deploymentconfigs'
},
imagestreams
:
{
group
:
'image.openshift.io'
,
resource
:
'imagestreams'
},
imagestreamtags
:
{
group
:
'image.openshift.io'
,
resource
:
'imagestreamtags'
},
instances
:
{
group
:
'servicecatalog.k8s.io'
,
resource
:
'instances'
},
limitranges
:
'limitranges'
,
pods
:
'pods'
,
projects
:
{
group
:
'project.openshift.io'
,
resource
:
'projects'
},
projectrequests
:
{
group
:
'project.openshift.io'
,
resource
:
'projectrequests'
},
persistentvolumeclaims
:
'persistentvolumeclaims'
,
replicasets
:
{
group
:
'extensions'
,
resource
:
'replicasets'
},
replicationcontrollers
:
'replicationcontrollers'
,
resourcequotas
:
'resourcequotas'
,
rolebindings
:
'rolebindings'
,
routes
:
{
group
:
'route.openshift.io'
,
resource
:
'routes'
},
secrets
:
'secrets'
,
selfsubjectrulesreviews
:
{
group
:
'authorization.k8s.io'
,
resource
:
'selfsubjectrulesreviews'
},
services
:
'services'
,
serviceaccounts
:
'serviceaccounts'
,
serviceclasses
:
{
group
:
'servicecatalog.k8s.io'
,
resource
:
'serviceclasses'
},
statefulsets
:
{
group
:
'apps'
,
resource
:
'statefulsets'
},
templates
:
{
group
:
'template.openshift.io'
,
resource
:
'templates'
}
});
src/filters/preferredVersion.js
0 → 100644
View file @
c45e3254
'use strict'
;
angular
.
module
(
'openshiftCommonUI'
)
.
filter
(
'preferredVersion'
,
function
(
APIService
)
{
return
APIService
.
getPreferredVersion
;
});
src/services/apiService.js
View file @
c45e3254
...
...
@@ -41,6 +41,7 @@ ResourceGroupVersion.prototype.equals = function(resource, group, version) {
angular
.
module
(
'openshiftCommonServices'
)
.
factory
(
'APIService'
,
function
(
API_CFG
,
APIS_CFG
,
API_PREFERRED_VERSIONS
,
AuthService
,
Constants
,
Logger
,
...
...
@@ -339,6 +340,17 @@ angular.module('openshiftCommonServices')
return
includeClusterScoped
?
allKinds
:
namespacedKinds
;
};
// Provides us a way to ensure we consistently use the
// correct {resource, group} for API calls. Version
// will typically fallback to the preferredVersion of the API
var
getPreferredVersion
=
function
(
resource
)
{
var
preferred
=
API_PREFERRED_VERSIONS
[
resource
];
if
(
!
preferred
)
{
Logger
.
log
(
"No preferred version for "
,
resource
);
}
return
preferred
;
};
return
{
toResourceGroupVersion
:
toResourceGroupVersion
,
...
...
@@ -356,6 +368,7 @@ angular.module('openshiftCommonServices')
invalidObjectKindOrVersion
:
invalidObjectKindOrVersion
,
unsupportedObjectKindOrVersion
:
unsupportedObjectKindOrVersion
,
availableKinds
:
availableKinds
availableKinds
:
availableKinds
,
getPreferredVersion
:
getPreferredVersion
};
});
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