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
39f1f70a
Commit
39f1f70a
authored
May 19, 2017
by
Jeffrey Phillips
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add BindingService and DNS1123_SUBDOMAIN_VALIDATION constant
parent
7e65a620
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
146 additions
and
14 deletions
+146
-14
origin-web-common-services.js
dist/origin-web-common-services.js
+37
-0
origin-web-common-ui.js
dist/origin-web-common-ui.js
+11
-4
origin-web-common.js
dist/origin-web-common.js
+48
-4
origin-web-common.min.js
dist/origin-web-common.min.js
+0
-0
templates.js
dist/scripts/templates.js
+2
-2
bindResults.html
src/components/binding/bindResults.html
+2
-2
bindResults.js
src/components/binding/bindResults.js
+0
-1
openshiftCommonUI.module.js
src/openshiftCommonUI.module.js
+9
-1
bindService.js
src/services/bindService.js
+37
-0
No files found.
dist/origin-web-common-services.js
View file @
39f1f70a
...
@@ -996,6 +996,43 @@ angular.module('openshiftCommonServices')
...
@@ -996,6 +996,43 @@ angular.module('openshiftCommonServices')
});
});
;
'use strict'
;
;
'use strict'
;
angular
.
module
(
"openshiftCommonServices"
)
.
service
(
"BindingService"
,
function
(
$filter
,
$q
,
DataService
,
DNS1123_SUBDOMAIN_VALIDATION
){
var
bindingResource
=
{
group
:
'servicecatalog.k8s.io'
,
resource
:
'bindings'
};
var
makeBinding
=
function
(
serviceToBind
)
{
var
generateName
=
$filter
(
'generateName'
);
return
{
kind
:
'Binding'
,
apiVersion
:
'servicecatalog.k8s.io/v1alpha1'
,
metadata
:
{
generateName
:
serviceToBind
+
'-'
},
spec
:
{
instanceRef
:
{
name
:
serviceToBind
},
secretName
:
generateName
(
_
.
trunc
(
serviceToBind
,
DNS1123_SUBDOMAIN_VALIDATION
.
maxlength
-
6
)
+
'-'
)
}
};
};
return
{
bindingResource
:
bindingResource
,
bindService
:
function
(
context
,
serviceToBind
,
appToBind
)
{
var
newBinding
=
makeBinding
(
serviceToBind
);
// TODO: Use appToBind to bind the service to the application
return
DataService
.
create
(
bindingResource
,
null
,
newBinding
,
context
);
}
};
});
;
'use strict'
;
angular
.
module
(
'openshiftCommonServices'
)
angular
.
module
(
'openshiftCommonServices'
)
.
factory
(
'Constants'
,
function
()
{
.
factory
(
'Constants'
,
function
()
{
var
constants
=
_
.
clone
(
window
.
OPENSHIFT_CONSTANTS
||
{});
var
constants
=
_
.
clone
(
window
.
OPENSHIFT_CONSTANTS
||
{});
...
...
dist/origin-web-common-ui.js
View file @
39f1f70a
...
@@ -4,7 +4,15 @@
...
@@ -4,7 +4,15 @@
* @description
* @description
* Base module for openshiftCommonUI.
* Base module for openshiftCommonUI.
*/
*/
angular
.
module
(
'openshiftCommonUI'
,
[]);
angular
.
module
(
'openshiftCommonUI'
,
[])
// DNS1123 subdomain patterns are used for name validation of many resources,
// including persistent volume claims, config maps, and secrets.
// See https://github.com/kubernetes/kubernetes/blob/master/pkg/api/validation/validation.go
.
constant
(
'DNS1123_SUBDOMAIN_VALIDATION'
,
{
pattern
:
/^
[
a-z0-9
]([
-a-z0-9
]
*
[
a-z0-9
])?(\.[
a-z0-9
]([
-a-z0-9
]
*
[
a-z0-9
])?)
*$/
,
maxlength
:
253
,
description
:
'Name must consist of lower-case letters, numbers, periods, and hyphens. It must start and end with a letter or a number.'
});
hawtioPluginLoader
.
addModule
(
'openshiftCommonUI'
);
hawtioPluginLoader
.
addModule
(
'openshiftCommonUI'
);
...
@@ -82,8 +90,8 @@ hawtioPluginLoader.addModule('openshiftCommonUI');
...
@@ -82,8 +90,8 @@ hawtioPluginLoader.addModule('openshiftCommonUI');
" <div class=
\"
sub-title
\"
>
\
n"
+
" <div class=
\"
sub-title
\"
>
\
n"
+
" The binding operation created the secret
\
n"
+
" The binding operation created the secret
\
n"
+
" <a ng-if=
\"
ctrl.secretHref && 'secrets' | canI : 'list'
\"
\
n"
+
" <a ng-if=
\"
ctrl.secretHref && 'secrets' | canI : 'list'
\"
\
n"
+
" ng-href=
\"
{{ctrl.secretHref}}
\"
>{{ctrl.
generatedS
ecretName}}</a>
\
n"
+
" ng-href=
\"
{{ctrl.secretHref}}
\"
>{{ctrl.
binding.spec.s
ecretName}}</a>
\
n"
+
" <span ng-if=
\"
!ctrl.secretHref || !('secrets' | canI : 'list')
\"
>{{ctrl.
generatedS
ecretName}}</span>
\
n"
+
" <span ng-if=
\"
!ctrl.secretHref || !('secrets' | canI : 'list')
\"
>{{ctrl.
binding.spec.s
ecretName}}</span>
\
n"
+
" that you may need to reference in your application.
\
n"
+
" that you may need to reference in your application.
\
n"
+
" <span ng-if=
\"
ctrl.showPodPresets
\"
>Its data will be available to your application as environment variables.</span>
\
n"
+
" <span ng-if=
\"
ctrl.showPodPresets
\"
>Its data will be available to your application as environment variables.</span>
\
n"
+
" </div>
\
n"
+
" </div>
\
n"
+
...
@@ -443,7 +451,6 @@ angular.module('openshiftCommonUI').component('bindResults', {
...
@@ -443,7 +451,6 @@ angular.module('openshiftCommonUI').component('bindResults', {
progressInline
:
'@'
,
progressInline
:
'@'
,
serviceToBind
:
'<'
,
serviceToBind
:
'<'
,
applicationToBind
:
'<'
,
applicationToBind
:
'<'
,
generatedSecretName
:
'<'
,
showPodPresets
:
'<'
,
showPodPresets
:
'<'
,
secretHref
:
'<'
secretHref
:
'<'
},
},
...
...
dist/origin-web-common.js
View file @
39f1f70a
...
@@ -175,7 +175,15 @@ hawtioPluginLoader.registerPreBootstrapTask(function(next) {
...
@@ -175,7 +175,15 @@ hawtioPluginLoader.registerPreBootstrapTask(function(next) {
* @description
* @description
* Base module for openshiftCommonUI.
* Base module for openshiftCommonUI.
*/
*/
angular
.
module
(
'openshiftCommonUI'
,
[]);
angular
.
module
(
'openshiftCommonUI'
,
[])
// DNS1123 subdomain patterns are used for name validation of many resources,
// including persistent volume claims, config maps, and secrets.
// See https://github.com/kubernetes/kubernetes/blob/master/pkg/api/validation/validation.go
.
constant
(
'DNS1123_SUBDOMAIN_VALIDATION'
,
{
pattern
:
/^
[
a-z0-9
]([
-a-z0-9
]
*
[
a-z0-9
])?(\.[
a-z0-9
]([
-a-z0-9
]
*
[
a-z0-9
])?)
*$/
,
maxlength
:
253
,
description
:
'Name must consist of lower-case letters, numbers, periods, and hyphens. It must start and end with a letter or a number.'
});
hawtioPluginLoader
.
addModule
(
'openshiftCommonUI'
);
hawtioPluginLoader
.
addModule
(
'openshiftCommonUI'
);
...
@@ -253,8 +261,8 @@ hawtioPluginLoader.addModule('openshiftCommonUI');
...
@@ -253,8 +261,8 @@ hawtioPluginLoader.addModule('openshiftCommonUI');
" <div class=
\"
sub-title
\"
>
\
n"
+
" <div class=
\"
sub-title
\"
>
\
n"
+
" The binding operation created the secret
\
n"
+
" The binding operation created the secret
\
n"
+
" <a ng-if=
\"
ctrl.secretHref && 'secrets' | canI : 'list'
\"
\
n"
+
" <a ng-if=
\"
ctrl.secretHref && 'secrets' | canI : 'list'
\"
\
n"
+
" ng-href=
\"
{{ctrl.secretHref}}
\"
>{{ctrl.
generatedS
ecretName}}</a>
\
n"
+
" ng-href=
\"
{{ctrl.secretHref}}
\"
>{{ctrl.
binding.spec.s
ecretName}}</a>
\
n"
+
" <span ng-if=
\"
!ctrl.secretHref || !('secrets' | canI : 'list')
\"
>{{ctrl.
generatedS
ecretName}}</span>
\
n"
+
" <span ng-if=
\"
!ctrl.secretHref || !('secrets' | canI : 'list')
\"
>{{ctrl.
binding.spec.s
ecretName}}</span>
\
n"
+
" that you may need to reference in your application.
\
n"
+
" that you may need to reference in your application.
\
n"
+
" <span ng-if=
\"
ctrl.showPodPresets
\"
>Its data will be available to your application as environment variables.</span>
\
n"
+
" <span ng-if=
\"
ctrl.showPodPresets
\"
>Its data will be available to your application as environment variables.</span>
\
n"
+
" </div>
\
n"
+
" </div>
\
n"
+
...
@@ -614,7 +622,6 @@ angular.module('openshiftCommonUI').component('bindResults', {
...
@@ -614,7 +622,6 @@ angular.module('openshiftCommonUI').component('bindResults', {
progressInline
:
'@'
,
progressInline
:
'@'
,
serviceToBind
:
'<'
,
serviceToBind
:
'<'
,
applicationToBind
:
'<'
,
applicationToBind
:
'<'
,
generatedSecretName
:
'<'
,
showPodPresets
:
'<'
,
showPodPresets
:
'<'
,
secretHref
:
'<'
secretHref
:
'<'
},
},
...
@@ -2542,6 +2549,43 @@ angular.module('openshiftCommonServices')
...
@@ -2542,6 +2549,43 @@ angular.module('openshiftCommonServices')
});
});
;
'use strict'
;
;
'use strict'
;
angular
.
module
(
"openshiftCommonServices"
)
.
service
(
"BindingService"
,
[
"$filter"
,
"$q"
,
"DataService"
,
"DNS1123_SUBDOMAIN_VALIDATION"
,
function
(
$filter
,
$q
,
DataService
,
DNS1123_SUBDOMAIN_VALIDATION
){
var
bindingResource
=
{
group
:
'servicecatalog.k8s.io'
,
resource
:
'bindings'
};
var
makeBinding
=
function
(
serviceToBind
)
{
var
generateName
=
$filter
(
'generateName'
);
return
{
kind
:
'Binding'
,
apiVersion
:
'servicecatalog.k8s.io/v1alpha1'
,
metadata
:
{
generateName
:
serviceToBind
+
'-'
},
spec
:
{
instanceRef
:
{
name
:
serviceToBind
},
secretName
:
generateName
(
_
.
trunc
(
serviceToBind
,
DNS1123_SUBDOMAIN_VALIDATION
.
maxlength
-
6
)
+
'-'
)
}
};
};
return
{
bindingResource
:
bindingResource
,
bindService
:
function
(
context
,
serviceToBind
,
appToBind
)
{
var
newBinding
=
makeBinding
(
serviceToBind
);
// TODO: Use appToBind to bind the service to the application
return
DataService
.
create
(
bindingResource
,
null
,
newBinding
,
context
);
}
};
}]);
;
'use strict'
;
angular
.
module
(
'openshiftCommonServices'
)
angular
.
module
(
'openshiftCommonServices'
)
.
factory
(
'Constants'
,
function
()
{
.
factory
(
'Constants'
,
function
()
{
var
constants
=
_
.
clone
(
window
.
OPENSHIFT_CONSTANTS
||
{});
var
constants
=
_
.
clone
(
window
.
OPENSHIFT_CONSTANTS
||
{});
...
...
dist/origin-web-common.min.js
View file @
39f1f70a
This diff is collapsed.
Click to expand it.
dist/scripts/templates.js
View file @
39f1f70a
...
@@ -72,8 +72,8 @@ angular.module('openshiftCommonUI').run(['$templateCache', function($templateCac
...
@@ -72,8 +72,8 @@ angular.module('openshiftCommonUI').run(['$templateCache', function($templateCac
" <div class=
\"
sub-title
\"
>
\
n"
+
" <div class=
\"
sub-title
\"
>
\
n"
+
" The binding operation created the secret
\
n"
+
" The binding operation created the secret
\
n"
+
" <a ng-if=
\"
ctrl.secretHref && 'secrets' | canI : 'list'
\"
\
n"
+
" <a ng-if=
\"
ctrl.secretHref && 'secrets' | canI : 'list'
\"
\
n"
+
" ng-href=
\"
{{ctrl.secretHref}}
\"
>{{ctrl.
generatedS
ecretName}}</a>
\
n"
+
" ng-href=
\"
{{ctrl.secretHref}}
\"
>{{ctrl.
binding.spec.s
ecretName}}</a>
\
n"
+
" <span ng-if=
\"
!ctrl.secretHref || !('secrets' | canI : 'list')
\"
>{{ctrl.
generatedS
ecretName}}</span>
\
n"
+
" <span ng-if=
\"
!ctrl.secretHref || !('secrets' | canI : 'list')
\"
>{{ctrl.
binding.spec.s
ecretName}}</span>
\
n"
+
" that you may need to reference in your application.
\
n"
+
" that you may need to reference in your application.
\
n"
+
" <span ng-if=
\"
ctrl.showPodPresets
\"
>Its data will be available to your application as environment variables.</span>
\
n"
+
" <span ng-if=
\"
ctrl.showPodPresets
\"
>Its data will be available to your application as environment variables.</span>
\
n"
+
" </div>
\
n"
+
" </div>
\
n"
+
...
...
src/components/binding/bindResults.html
View file @
39f1f70a
...
@@ -19,8 +19,8 @@
...
@@ -19,8 +19,8 @@
<div
class=
"sub-title"
>
<div
class=
"sub-title"
>
The binding operation created the secret
The binding operation created the secret
<a
ng-if=
"ctrl.secretHref && 'secrets' | canI : 'list'"
<a
ng-if=
"ctrl.secretHref && 'secrets' | canI : 'list'"
ng-href=
"{{ctrl.secretHref}}"
>
{{ctrl.
generatedS
ecretName}}
</a>
ng-href=
"{{ctrl.secretHref}}"
>
{{ctrl.
binding.spec.s
ecretName}}
</a>
<span
ng-if=
"!ctrl.secretHref || !('secrets' | canI : 'list')"
>
{{ctrl.
generatedS
ecretName}}
</span>
<span
ng-if=
"!ctrl.secretHref || !('secrets' | canI : 'list')"
>
{{ctrl.
binding.spec.s
ecretName}}
</span>
that you may need to reference in your application.
that you may need to reference in your application.
<span
ng-if=
"ctrl.showPodPresets"
>
Its data will be available to your application as environment variables.
</span>
<span
ng-if=
"ctrl.showPodPresets"
>
Its data will be available to your application as environment variables.
</span>
</div>
</div>
...
...
src/components/binding/bindResults.js
View file @
39f1f70a
...
@@ -8,7 +8,6 @@ angular.module('openshiftCommonUI').component('bindResults', {
...
@@ -8,7 +8,6 @@ angular.module('openshiftCommonUI').component('bindResults', {
progressInline
:
'@'
,
progressInline
:
'@'
,
serviceToBind
:
'<'
,
serviceToBind
:
'<'
,
applicationToBind
:
'<'
,
applicationToBind
:
'<'
,
generatedSecretName
:
'<'
,
showPodPresets
:
'<'
,
showPodPresets
:
'<'
,
secretHref
:
'<'
secretHref
:
'<'
},
},
...
...
src/openshiftCommonUI.module.js
View file @
39f1f70a
...
@@ -4,7 +4,15 @@
...
@@ -4,7 +4,15 @@
* @description
* @description
* Base module for openshiftCommonUI.
* Base module for openshiftCommonUI.
*/
*/
angular
.
module
(
'openshiftCommonUI'
,
[]);
angular
.
module
(
'openshiftCommonUI'
,
[])
// DNS1123 subdomain patterns are used for name validation of many resources,
// including persistent volume claims, config maps, and secrets.
// See https://github.com/kubernetes/kubernetes/blob/master/pkg/api/validation/validation.go
.
constant
(
'DNS1123_SUBDOMAIN_VALIDATION'
,
{
pattern
:
/^
[
a-z0-9
]([
-a-z0-9
]
*
[
a-z0-9
])?(\.[
a-z0-9
]([
-a-z0-9
]
*
[
a-z0-9
])?)
*$/
,
maxlength
:
253
,
description
:
'Name must consist of lower-case letters, numbers, periods, and hyphens. It must start and end with a letter or a number.'
});
hawtioPluginLoader
.
addModule
(
'openshiftCommonUI'
);
hawtioPluginLoader
.
addModule
(
'openshiftCommonUI'
);
src/services/bindService.js
0 → 100644
View file @
39f1f70a
'use strict'
;
angular
.
module
(
"openshiftCommonServices"
)
.
service
(
"BindingService"
,
function
(
$filter
,
$q
,
DataService
,
DNS1123_SUBDOMAIN_VALIDATION
){
var
bindingResource
=
{
group
:
'servicecatalog.k8s.io'
,
resource
:
'bindings'
};
var
makeBinding
=
function
(
serviceToBind
)
{
var
generateName
=
$filter
(
'generateName'
);
return
{
kind
:
'Binding'
,
apiVersion
:
'servicecatalog.k8s.io/v1alpha1'
,
metadata
:
{
generateName
:
serviceToBind
+
'-'
},
spec
:
{
instanceRef
:
{
name
:
serviceToBind
},
secretName
:
generateName
(
_
.
trunc
(
serviceToBind
,
DNS1123_SUBDOMAIN_VALIDATION
.
maxlength
-
6
)
+
'-'
)
}
};
};
return
{
bindingResource
:
bindingResource
,
bindService
:
function
(
context
,
serviceToBind
,
appToBind
)
{
var
newBinding
=
makeBinding
(
serviceToBind
);
// TODO: Use appToBind to bind the service to the application
return
DataService
.
create
(
bindingResource
,
null
,
newBinding
,
context
);
}
};
});
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