Add icon for some service providers
This commit is contained in:
parent
389360c367
commit
bb0d9c857a
|
@ -48,6 +48,7 @@ import (
|
||||||
func init() {
|
func init() {
|
||||||
router.GET("/api/service_specs", ApiHandler(getServiceSpecs))
|
router.GET("/api/service_specs", ApiHandler(getServiceSpecs))
|
||||||
router.GET("/api/service_specs/:ssid", ApiHandler(getServiceSpec))
|
router.GET("/api/service_specs/:ssid", ApiHandler(getServiceSpec))
|
||||||
|
router.GET("/api/service_specs/:ssid/icon.png", ApiHandler(getServiceSpecIcon))
|
||||||
}
|
}
|
||||||
|
|
||||||
type service_field struct {
|
type service_field struct {
|
||||||
|
@ -75,7 +76,9 @@ func getServiceSpecs(_ *config.Options, p httprouter.Params, body io.Reader) Res
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func getServiceSpecImg(ssid string) Response {
|
func getServiceSpecIcon(_ *config.Options, p httprouter.Params, body io.Reader) Response {
|
||||||
|
ssid := string(p.ByName("ssid"))
|
||||||
|
|
||||||
if cnt, ok := svcs.Icons[strings.TrimSuffix(ssid, ".png")]; ok {
|
if cnt, ok := svcs.Icons[strings.TrimSuffix(ssid, ".png")]; ok {
|
||||||
return &FileResponse{
|
return &FileResponse{
|
||||||
contentType: "image/png",
|
contentType: "image/png",
|
||||||
|
|
|
@ -35,35 +35,55 @@
|
||||||
<b-tabs :content-class="contentClass">
|
<b-tabs :content-class="contentClass">
|
||||||
<b-tab title="All" active>
|
<b-tab title="All" active>
|
||||||
<b-list-group>
|
<b-list-group>
|
||||||
<b-list-group-item v-for="(svc, idx) in availableNewServices()" :key="idx" :active="value === idx" button @click="$emit('input', idx)">
|
<b-list-group-item v-for="(svc, idx) in availableNewServices()" :key="idx" :active="value === idx" button class="d-flex" @click="$emit('input', idx)">
|
||||||
{{ svc.name }}
|
<div v-if="svc._svcicon" class="d-inline-block align-self-center text-center" style="width: 75px;">
|
||||||
<small class="text-muted">{{ svc.description }}</small>
|
<img :src="svc._svcicon" :alt="svc.name" style="max-width: 100%; max-height: 2.5em; margin: -.6em .4em -.6em -.6em">
|
||||||
<b-badge v-for="(categorie, idcat) in svc.categories" :key="idcat" variant="gray" class="float-right ml-1">
|
</div>
|
||||||
{{ categorie }}
|
<div>
|
||||||
</b-badge>
|
{{ svc.name }}
|
||||||
|
<small class="text-muted">{{ svc.description }}</small>
|
||||||
|
<b-badge v-for="(categorie, idcat) in svc.categories" :key="idcat" variant="gray" class="float-right ml-1">
|
||||||
|
{{ categorie }}
|
||||||
|
</b-badge>
|
||||||
|
</div>
|
||||||
</b-list-group-item>
|
</b-list-group-item>
|
||||||
<b-list-group-item v-for="(svc, idx) in disabledNewServices()" :key="idx" :active="value === idx" disabled @click="$emit('input', idx)">
|
<b-list-group-item v-for="(svc, idx) in disabledNewServices()" :key="idx" :active="value === idx" class="d-flex" disabled @click="$emit('input', idx)">
|
||||||
<span :title="svc.description">{{ svc.name }}</span> <small class="font-italic text-danger">{{ filteredNewServices[idx] }}</small>
|
<div v-if="svc._svcicon" class="d-inline-block align-self-center text-center" style="width: 75px;">
|
||||||
<b-badge v-for="(categorie, idcat) in svc.categories" :key="idcat" variant="gray" class="float-right ml-1">
|
<img :src="svc._svcicon" :alt="svc.name" style="max-width: 100%; max-height: 2.5em; margin: -.6em .4em -.6em -.6em">
|
||||||
{{ categorie }}
|
</div>
|
||||||
</b-badge>
|
<div>
|
||||||
|
<span :title="svc.description">{{ svc.name }}</span> <small class="font-italic text-danger">{{ filteredNewServices[idx] }}</small>
|
||||||
|
<b-badge v-for="(categorie, idcat) in svc.categories" :key="idcat" variant="gray" class="float-right ml-1">
|
||||||
|
{{ categorie }}
|
||||||
|
</b-badge>
|
||||||
|
</div>
|
||||||
</b-list-group-item>
|
</b-list-group-item>
|
||||||
</b-list-group>
|
</b-list-group>
|
||||||
</b-tab>
|
</b-tab>
|
||||||
<b-tab v-for="(family, idxf) in families" :key="idxf" :title="family.label">
|
<b-tab v-for="(family, idxf) in families" :key="idxf" :title="family.label">
|
||||||
<b-list-group>
|
<b-list-group>
|
||||||
<b-list-group-item v-for="(svc, idx) in availableNewServices(family.family)" :key="idx" :active="value === idx" button @click="$emit('input', idx)">
|
<b-list-group-item v-for="(svc, idx) in availableNewServices(family.family)" :key="idx" :active="value === idx" button class="d-flex" @click="$emit('input', idx)">
|
||||||
{{ svc.name }}
|
<div v-if="svc._svcicon" class="d-inline-block align-self-center text-center" style="width: 75px;">
|
||||||
<small class="text-muted">{{ svc.description }}</small>
|
<img :src="svc._svcicon" :alt="svc.name" style="max-width: 100%; max-height: 2.5em; margin: -.6em .4em -.6em -.6em">
|
||||||
<b-badge v-for="(categorie, idcat) in svc.categories" :key="idcat" variant="gray" class="float-right ml-1">
|
</div>
|
||||||
{{ categorie }}
|
<div>
|
||||||
</b-badge>
|
{{ svc.name }}
|
||||||
|
<small class="text-muted">{{ svc.description }}</small>
|
||||||
|
<b-badge v-for="(categorie, idcat) in svc.categories" :key="idcat" variant="gray" class="float-right ml-1">
|
||||||
|
{{ categorie }}
|
||||||
|
</b-badge>
|
||||||
|
</div>
|
||||||
</b-list-group-item>
|
</b-list-group-item>
|
||||||
<b-list-group-item v-for="(svc, idx) in disabledNewServices(family.family)" :key="idx" :active="value === idx" disabled @click="$emit('input', idx)">
|
<b-list-group-item v-for="(svc, idx) in disabledNewServices(family.family)" :key="idx" :active="value === idx" class="d-flex" disabled @click="$emit('input', idx)">
|
||||||
<span :title="svc.description">{{ svc.name }}</span> <small class="font-italic text-danger">{{ filteredNewServices[idx] }}</small>
|
<div v-if="svc._svcicon" class="d-inline-block align-self-center text-center" style="width: 75px;">
|
||||||
<b-badge v-for="(categorie, idcat) in svc.categories" :key="idcat" variant="gray" class="float-right ml-1">
|
<img :src="svc._svcicon" :alt="svc.name" style="max-width: 100%; max-height: 2.5em; margin: -.6em .4em -.6em -.6em">
|
||||||
{{ categorie }}
|
</div>
|
||||||
</b-badge>
|
<div>
|
||||||
|
<span :title="svc.description">{{ svc.name }}</span> <small class="font-italic text-danger">{{ filteredNewServices[idx] }}</small>
|
||||||
|
<b-badge v-for="(categorie, idcat) in svc.categories" :key="idcat" variant="gray" class="float-right ml-1">
|
||||||
|
{{ categorie }}
|
||||||
|
</b-badge>
|
||||||
|
</div>
|
||||||
</b-list-group-item>
|
</b-list-group-item>
|
||||||
</b-list-group>
|
</b-list-group>
|
||||||
</b-tab>
|
</b-tab>
|
||||||
|
|
|
@ -78,7 +78,11 @@ func RegisterService(creator ServiceCreator, analyzer ServiceAnalyzer, infos Ser
|
||||||
name := baseType.String()
|
name := baseType.String()
|
||||||
log.Println("Registering new service:", name)
|
log.Println("Registering new service:", name)
|
||||||
|
|
||||||
|
// Override given parameters by true one
|
||||||
infos.Type = name
|
infos.Type = name
|
||||||
|
if _, ok := Icons[name]; ok {
|
||||||
|
infos.Icon = "/api/service_specs/" + name + "/icon.png"
|
||||||
|
}
|
||||||
|
|
||||||
svc := &Svc{
|
svc := &Svc{
|
||||||
creator,
|
creator,
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -67,6 +67,7 @@ type ServiceRestrictions struct {
|
||||||
type ServiceInfos struct {
|
type ServiceInfos struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Type string `json:"_svctype"`
|
Type string `json:"_svctype"`
|
||||||
|
Icon string `json:"_svcicon,omitempty"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
Family string `json:"family"`
|
Family string `json:"family"`
|
||||||
Categories []string `json:"categories"`
|
Categories []string `json:"categories"`
|
||||||
|
|
BIN
services/providers/google/GSuite.png
Normal file
BIN
services/providers/google/GSuite.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.1 KiB |
Loading…
Reference in New Issue
Block a user